Fix for #113445. Minor code clean-up for Van-Gogh plug-in (lic).

This commit is contained in:
Maurits Rijk
2003-05-25 20:10:24 +00:00
parent dd9a0a4a63
commit 1f33558c2f
9 changed files with 261 additions and 317 deletions

View File

@ -1,3 +1,15 @@
2003-05-25 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_csim_parse.[ch]: regenerated
* plug-ins/imagemap/imap_main.c (save_as_csim): write quoted WIDTH,
TAG and BORDER tags.
* plug-ins/imagemap/Makefile.am: added -i flag to lex to generate
case-insensitive scanners.
* plug-ins/imagemap/imap_csim.y: parse now accepts both tag=FLOAT and
tag="FLOAT" to support both old and newstyle HTML. Should fix #113445.
* plug-ins/common/lic.c: minor code clean-up
2003-05-25 Michael Natterer <mitch@gimp.org> 2003-05-25 Michael Natterer <mitch@gimp.org>
* app/tools/tool_manager.[ch] (tool_manager_set,get): Use * app/tools/tool_manager.[ch] (tool_manager_set,get): Use

View File

@ -54,8 +54,6 @@
#define CHECKBOUNDS(x,y) (x>=0 && y>=0 && x<width && y<height) #define CHECKBOUNDS(x,y) (x>=0 && y>=0 && x<width && y<height)
#define EPSILON 1.0e-5
#define numx 40 /* Pseudo-random vector grid size */ #define numx 40 /* Pseudo-random vector grid size */
#define numy 40 #define numy 40
@ -397,11 +395,7 @@ lic_noise (gint x,
i = (i - minv) / (maxv - minv); i = (i - minv) / (maxv - minv);
if (i < 0.0) i = CLAMP (i, 0.0, 1.0);
i = 0.0;
if (i > 1.0)
i = 1.0;
i = (i / 2.0) + 0.5; i = (i / 2.0) + 0.5;
@ -485,68 +479,35 @@ lic_image (gint x,
} }
static gdouble static gdouble
get_hue (GimpRGB *col) get_hue (const GimpRGB *col)
{ {
gdouble max, min, delta; GimpHSL hsl;
gdouble hue = -1.0;
max = gimp_rgb_max (col); gimp_rgb_to_hsl (col, &hsl);
min = gimp_rgb_min (col); return hsl.h;
if (max == min)
{
hue = -1.0;
}
else
{
delta = max - min;
if (col->r == max)
hue = (col->g - col->b) / delta;
else if (col->g == max)
hue = 2.0 + (col->b - col->r) / delta;
else if (col->b == max)
hue = 4.0 + (col->r - col->g) / delta;
hue *= 60.0;
if (hue < 0.0)
hue += 360.0;
}
return hue;
} }
static gdouble static gdouble
get_saturation (GimpRGB *col) get_saturation (const GimpRGB *col)
{ {
gdouble max, min, l; GimpHSL hsl;
gdouble sat;
max = gimp_rgb_max (col); gimp_rgb_to_hsl (col, &hsl);
min = gimp_rgb_min (col); return hsl.s;
if (max == min)
{
sat = 0.0;
}
else
{
l = (max + min) / 2.0;
if (l <= 0.5)
sat = (max - min) / (max + min);
else
sat = (max - min) / (2.0 - max - min);
}
return sat;
} }
static gdouble static gdouble
get_brightness (GimpRGB *col) get_brightness (const GimpRGB *col)
{ {
return (gimp_rgb_max (col) + gimp_rgb_min (col)) / 2.0; GimpHSL hsl;
gimp_rgb_to_hsl (col, &hsl);
return hsl.l;
} }
static guchar* static guchar*
rgb_to_hsl (GimpDrawable *image, rgb_to_hsl (GimpDrawable *image,
gdouble (*hsl_func)(GimpRGB *col)) gdouble (*hsl_func)(const GimpRGB *col))
{ {
guchar *themap, data[4]; guchar *themap, data[4];
gint w, h, x, y; gint w, h, x, y;
@ -601,7 +562,7 @@ rgb_to_brightness (GimpDrawable *image)
} }
static void static void
compute_lic_derivative (void) compute_lic (gboolean rotate)
{ {
gint xcount, ycount; gint xcount, ycount;
glong counter = 0; glong counter = 0;
@ -612,61 +573,19 @@ compute_lic_derivative (void)
{ {
for (xcount = 0; xcount < width; xcount++) for (xcount = 0; xcount < width; xcount++)
{ {
/* Get direction vector at (x,y) and normalize it */ /* Get derivative at (x,y) and normalize it */
/* ============================================== */
vx = gradx (scalarfield, xcount, ycount);
vy = grady (scalarfield, xcount, ycount);
tmp = sqrt (vx * vx + vy * vy);
if (tmp != 0.0)
{
tmp = 1.0 / tmp;
vx *= tmp;
vy *= tmp;
}
/* Convolve with the LIC at (x,y) */
/* ============================== */
if (licvals.effect_convolve == 0)
{
color = peek (xcount, ycount);
tmp = lic_noise (xcount, ycount, vx, vy);
gimp_rgb_multiply (&color, tmp);
}
else
lic_image (xcount, ycount, vx, vy, &color);
poke (xcount, ycount, &color);
counter++;
if ((counter % width) == 0)
gimp_progress_update ((gfloat) counter / (gfloat) maxcounter);
}
}
}
static void
compute_lic_gradient (void)
{
gint xcount, ycount;
glong counter = 0;
GimpRGB color;
gdouble vx, vy, tmp;
for (ycount = 0; ycount < height; ycount++)
{
for (xcount = 0; xcount < width; xcount++)
{
/* Get derivative at (x,y), rotate it 90 degrees and normalize it */
/* ============================================================== */ /* ============================================================== */
vx = gradx (scalarfield, xcount, ycount); vx = gradx (scalarfield, xcount, ycount);
vy = grady (scalarfield, xcount, ycount); vy = grady (scalarfield, xcount, ycount);
vx = -1.0 * vx; tmp = vy; vy = vx; vx = tmp; /* Rotate if needed */
if (rotate)
{
tmp = vy;
vy = -vx;
vx = tmp;
}
tmp = sqrt (vx * vx + vy * vy); tmp = sqrt (vx * vx + vy * vy);
if (tmp != 0.0) if (tmp != 0.0)
@ -751,10 +670,7 @@ compute_image (void)
break; break;
} }
if (licvals.effect_operator == 0) compute_lic (licvals.effect_operator);
compute_lic_derivative ();
else
compute_lic_gradient ();
g_free (scalarfield); g_free (scalarfield);
@ -795,7 +711,7 @@ effect_image_constrain (gint32 image_id,
gpointer data) gpointer data)
{ {
if (drawable_id == -1) if (drawable_id == -1)
return(TRUE); return TRUE;
return gimp_drawable_is_rgb (drawable_id); return gimp_drawable_is_rgb (drawable_id);
} }
@ -990,9 +906,6 @@ create_main_dialog (void)
/******************/ /******************/
static void lic_interactive (GimpDrawable *drawable); static void lic_interactive (GimpDrawable *drawable);
/*
static void lic_noninteractive (GimpDrawable *drawable);
*/
/*************************************/ /*************************************/
/* Set parameters to standard values */ /* Set parameters to standard values */
@ -1137,12 +1050,4 @@ lic_interactive (GimpDrawable *drawable)
gdk_flush (); gdk_flush ();
} }
/*
static void
lic_noninteractive (GimpDrawable *drawable)
{
g_message ("Noninteractive not yet implemented! Sorry.\n");
}
*/
MAIN () MAIN ()

View File

@ -155,7 +155,7 @@ LDADD = \
## code (cern_, csim_, ncsa_). ## code (cern_, csim_, ncsa_).
## Require flex because the standard lex does not support the -P option. ## Require flex because the standard lex does not support the -P option.
LEX=flex LEX=flex -i
YACC=bison -y YACC=bison -y
imap_cern_lex.c: imap_cern.l imap_cern_lex.c: imap_cern.l

View File

@ -4,7 +4,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -57,6 +57,8 @@ static MapInfo_t *_map_info;
%token<value> FLOAT %token<value> FLOAT
%token<id> STRING %token<id> STRING
%type<val> integer_value
%% %%
csim_file : image start_map comment_lines area_list end_map csim_file : image start_map comment_lines area_list end_map
@ -74,20 +76,30 @@ image_tags : /* Empty */
image_tag : image_width image_tag : image_width
| image_height | image_height
| BORDER '=' FLOAT {} | BORDER '=' integer_value {}
| USEMAP '=' STRING {} | USEMAP '=' STRING {}
| ALT '=' STRING {} | ALT '=' STRING {}
; ;
image_width : WIDTH '=' FLOAT image_width : WIDTH '=' integer_value
{ {
_map_info->old_image_width = (gint) $3; _map_info->old_image_width = $3;
} }
; ;
image_height : HEIGHT '=' FLOAT image_height : HEIGHT '=' integer_value
{ {
_map_info->old_image_height = (gint) $3; _map_info->old_image_height = $3;
}
;
integer_value : FLOAT
{
$$ = (gint) $1;
}
| STRING
{
$$ = (gint) atof($1);
} }
; ;

View File

@ -44,7 +44,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -99,12 +99,12 @@ typedef union {
#define YYFINAL 101 #define YYFINAL 103
#define YYFLAG -32768 #define YYFLAG -32768
#define YYNTBASE 33 #define YYNTBASE 33
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 282 ? yytranslate[x] : 61) #define YYTRANSLATE(x) ((unsigned)(x) <= 282 ? yytranslate[x] : 62)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const char yytranslate[] = static const char yytranslate[] =
@ -144,29 +144,30 @@ static const char yytranslate[] =
static const short yyprhs[] = static const short yyprhs[] =
{ {
0, 0, 6, 14, 15, 18, 20, 22, 26, 30, 0, 0, 6, 14, 15, 18, 20, 22, 26, 30,
34, 38, 42, 49, 50, 53, 55, 57, 59, 63, 34, 38, 42, 44, 46, 53, 54, 57, 59, 61,
67, 71, 72, 75, 80, 82, 85, 86, 89, 91, 63, 67, 71, 75, 76, 79, 84, 86, 89, 90,
93, 95, 97, 99, 101, 103, 105, 107, 109, 113, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111,
117, 121, 123, 127, 131, 135, 139, 143, 147 113, 117, 121, 125, 127, 131, 135, 139, 143, 147,
151
}; };
static const short yyrhs[] = static const short yyrhs[] =
{ {
34, 39, 40, 45, 60, 0, 29, 3, 4, 30, 34, 40, 41, 46, 61, 0, 29, 3, 4, 30,
28, 35, 47, 0, 0, 35, 36, 0, 37, 0, 28, 35, 48, 0, 0, 35, 36, 0, 37, 0,
38, 0, 7, 30, 27, 0, 8, 30, 28, 0, 38, 0, 7, 30, 39, 0, 8, 30, 28, 0,
15, 30, 28, 0, 5, 30, 27, 0, 6, 30, 15, 30, 28, 0, 5, 30, 39, 0, 6, 30,
27, 0, 29, 9, 11, 30, 28, 31, 0, 0, 39, 0, 27, 0, 28, 0, 29, 9, 11, 30,
40, 41, 0, 43, 0, 44, 0, 42, 0, 25, 28, 31, 0, 0, 41, 42, 0, 44, 0, 45,
28, 26, 0, 23, 28, 26, 0, 24, 28, 26, 0, 43, 0, 25, 28, 26, 0, 23, 28, 26,
0, 0, 45, 46, 0, 29, 12, 48, 47, 0, 0, 24, 28, 26, 0, 0, 46, 47, 0, 29,
31, 0, 32, 31, 0, 0, 48, 49, 0, 50, 12, 49, 48, 0, 31, 0, 32, 31, 0, 0,
0, 51, 0, 52, 0, 53, 0, 54, 0, 55, 49, 50, 0, 51, 0, 52, 0, 53, 0, 54,
0, 56, 0, 57, 0, 58, 0, 59, 0, 13, 0, 55, 0, 56, 0, 57, 0, 58, 0, 59,
30, 28, 0, 14, 30, 28, 0, 16, 30, 28, 0, 60, 0, 13, 30, 28, 0, 14, 30, 28,
0, 17, 0, 15, 30, 28, 0, 18, 30, 28, 0, 16, 30, 28, 0, 17, 0, 15, 30, 28,
0, 19, 30, 28, 0, 20, 30, 28, 0, 21, 0, 18, 30, 28, 0, 19, 30, 28, 0, 20,
30, 28, 0, 22, 30, 28, 0, 29, 10, 31, 30, 28, 0, 21, 30, 28, 0, 22, 30, 28,
0 0, 29, 10, 31, 0
}; };
#endif #endif
@ -175,11 +176,12 @@ static const short yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] = static const short yyrline[] =
{ {
0, 62, 65, 71, 72, 75, 76, 77, 78, 79, 0, 64, 67, 73, 74, 77, 78, 79, 80, 81,
82, 88, 94, 100, 101, 104, 105, 106, 109, 114, 84, 90, 96, 100, 106, 112, 113, 116, 117, 118,
121, 131, 132, 135, 142, 143, 146, 147, 150, 151, 121, 126, 133, 143, 144, 147, 154, 155, 158, 159,
152, 153, 154, 155, 156, 157, 158, 159, 162, 179, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
237, 247, 252, 258, 264, 270, 276, 282, 288 174, 191, 249, 259, 264, 270, 276, 282, 288, 294,
300
}; };
#endif #endif
@ -195,11 +197,12 @@ static const char *const yytname[] =
"ONFOCUS", "ONBLUR", "AUTHOR", "DESCRIPTION", "BEGIN_COMMENT", "ONFOCUS", "ONBLUR", "AUTHOR", "DESCRIPTION", "BEGIN_COMMENT",
"END_COMMENT", "FLOAT", "STRING", "'<'", "'='", "'>'", "'/'", "END_COMMENT", "FLOAT", "STRING", "'<'", "'='", "'>'", "'/'",
"csim_file", "image", "image_tags", "image_tag", "image_width", "csim_file", "image", "image_tags", "image_tag", "image_width",
"image_height", "start_map", "comment_lines", "comment_line", "image_height", "integer_value", "start_map", "comment_lines",
"real_comment", "author_line", "description_line", "area_list", "area", "comment_line", "real_comment", "author_line", "description_line",
"xhtml_close", "tag_list", "tag", "shape_tag", "coords_tag", "href_tag", "area_list", "area", "xhtml_close", "tag_list", "tag", "shape_tag",
"nohref_tag", "alt_tag", "target_tag", "onmouseover_tag", "coords_tag", "href_tag", "nohref_tag", "alt_tag", "target_tag",
"onmouseout_tag", "onfocus_tag", "onblur_tag", "end_map", 0 "onmouseover_tag", "onmouseout_tag", "onfocus_tag", "onblur_tag",
"end_map", 0
}; };
#endif #endif
@ -207,20 +210,22 @@ static const char *const yytname[] =
static const short yyr1[] = static const short yyr1[] =
{ {
0, 33, 34, 35, 35, 36, 36, 36, 36, 36, 0, 33, 34, 35, 35, 36, 36, 36, 36, 36,
37, 38, 39, 40, 40, 41, 41, 41, 42, 43, 37, 38, 39, 39, 40, 41, 41, 42, 42, 42,
44, 45, 45, 46, 47, 47, 48, 48, 49, 49, 43, 44, 45, 46, 46, 47, 48, 48, 49, 49,
49, 49, 49, 49, 49, 49, 49, 49, 50, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
52, 53, 54, 55, 56, 57, 58, 59, 60 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61
}; };
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] = static const short yyr2[] =
{ {
0, 5, 7, 0, 2, 1, 1, 3, 3, 3, 0, 5, 7, 0, 2, 1, 1, 3, 3, 3,
3, 3, 6, 0, 2, 1, 1, 1, 3, 3, 3, 3, 1, 1, 6, 0, 2, 1, 1, 1,
3, 0, 2, 4, 1, 2, 0, 2, 1, 1, 3, 3, 3, 0, 2, 4, 1, 2, 0, 2,
1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3, 1, 3, 3, 3, 3, 3, 3, 3 3, 3, 3, 1, 3, 3, 3, 3, 3, 3,
3
}; };
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
@ -228,76 +233,74 @@ static const short yyr2[] =
error. */ error. */
static const short yydefact[] = static const short yydefact[] =
{ {
0, 0, 0, 0, 0, 13, 0, 0, 21, 0, 0, 0, 0, 0, 0, 15, 0, 0, 23, 0,
0, 0, 0, 0, 14, 17, 15, 16, 0, 3, 0, 0, 0, 0, 16, 19, 17, 18, 0, 3,
0, 0, 0, 0, 0, 22, 1, 0, 0, 19, 0, 0, 0, 0, 0, 24, 1, 0, 0, 21,
20, 18, 0, 26, 0, 0, 0, 0, 0, 24, 22, 20, 0, 28, 0, 0, 0, 0, 0, 26,
0, 4, 5, 6, 2, 12, 48, 0, 0, 0, 0, 4, 5, 6, 2, 14, 50, 0, 0, 0,
0, 0, 0, 25, 0, 0, 0, 0, 41, 0, 0, 0, 0, 27, 0, 0, 0, 0, 43, 0,
0, 0, 0, 0, 23, 27, 28, 29, 30, 31, 0, 0, 0, 0, 25, 29, 30, 31, 32, 33,
32, 33, 34, 35, 36, 37, 10, 11, 7, 8, 34, 35, 36, 37, 38, 39, 12, 13, 10, 11,
9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0,
38, 39, 42, 40, 43, 44, 45, 46, 47, 0, 0, 0, 40, 41, 44, 42, 45, 46, 47, 48,
0, 0 49, 0, 0, 0
}; };
static const short yydefgoto[] = static const short yydefgoto[] =
{ {
99, 2, 27, 41, 42, 43, 5, 8, 14, 15, 101, 2, 27, 41, 42, 43, 78, 5, 8, 14,
16, 17, 18, 25, 44, 47, 65, 66, 67, 68, 15, 16, 17, 18, 25, 44, 47, 65, 66, 67,
69, 70, 71, 72, 73, 74, 75, 26 68, 69, 70, 71, 72, 73, 74, 75, 26
}; };
static const short yypact[] = static const short yypact[] =
{ {
-21, 18, -7, 19, 15,-32768, 1, 14, -19, 0, -21, 22, -1, 27, 23,-32768, 3, 24, -19, 6,
2, 5, 6, 7,-32768,-32768,-32768,-32768, 8,-32768, 7, 8, 10, 11,-32768,-32768,-32768,-32768, 12,-32768,
10, 13, 16, 17, -3,-32768,-32768, -5, 9,-32768, 14, 17, 18, 19, -3,-32768,-32768, -5, 9,-32768,
-32768,-32768, 20,-32768, 11, 22, 23, 24, 25,-32768, -32768,-32768, 15,-32768, 20, 21, 25, 26, 28,-32768,
26,-32768,-32768,-32768,-32768,-32768,-32768, -2, 21, 29, 16,-32768,-32768,-32768,-32768,-32768,-32768, -2, -6, -6,
31, 32, 33,-32768, 34, 35, 36, 37,-32768, 38, -6, 29, 31,-32768, 30, 32, 33, 34,-32768, 35,
39, 40, 41, 42,-32768,-32768,-32768,-32768,-32768,-32768, 36, 37, 38, 39,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768, 45, 46, 47, 48, 49, 50, 51, 52, 53, -32768,-32768,-32768, 42, 43, 44, 45, 46, 47, 48,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 44, 49, 50,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
59,-32768 -32768, 52, 53,-32768
}; };
static const short yypgoto[] = static const short yypgoto[] =
{ {
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, -26,-32768,-32768,-32768,
-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 1,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768
}; };
#define YYLAST 81 #define YYLAST 78
static const short yytable[] = static const short yytable[] =
{ {
34, 35, 36, 37, 11, 12, 13, 32, 1, 33, 34, 35, 36, 37, 11, 12, 13, 32, 1, 33,
38, 54, 55, 56, 57, 58, 59, 60, 61, 62, 38, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 3, 4, 6, 7, 10, 39, 40, 19, 39, 63, 76, 77, 79, 80, 3, 39, 40, 4, 39,
40, 9, 20, 21, 22, 23, 64, 24, 28, 29, 40, 6, 7, 9, 19, 10, 21, 20, 22, 23,
45, 48, 30, 31, 100, 0, 0, 0, 76, 0, 45, 24, 28, 29, 30, 31, 46, 53, 64, 0,
0, 46, 49, 50, 51, 52, 77, 53, 78, 101, 48, 49, 102, 103, 0, 50, 51, 81, 52, 82,
79, 80, 0, 0, 81, 82, 83, 84, 85, 86, 83, 0, 84, 85, 86, 87, 88, 89, 90, 91,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 92, 93, 94, 95, 96, 97, 98, 99, 100
97, 98
}; };
static const short yycheck[] = static const short yycheck[] =
{ {
5, 6, 7, 8, 23, 24, 25, 10, 29, 12, 5, 6, 7, 8, 23, 24, 25, 10, 29, 12,
15, 13, 14, 15, 16, 17, 18, 19, 20, 21, 15, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 3, 29, 4, 9, 11, 31, 32, 28, 31, 22, 27, 28, 49, 50, 3, 31, 32, 29, 31,
32, 30, 30, 28, 28, 28, 47, 29, 28, 26, 32, 4, 9, 30, 28, 11, 28, 30, 28, 28,
31, 30, 26, 26, 0, -1, -1, -1, 27, -1, 31, 29, 28, 26, 26, 26, 31, 31, 47, -1,
-1, 31, 30, 30, 30, 30, 27, 31, 27, 0, 30, 30, 0, 0, -1, 30, 30, 28, 30, 28,
28, 28, -1, -1, 30, 30, 30, 30, 30, 30, 30, -1, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28
28, 28
}; };
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/bison/bison.simple" #line 3 "/usr/share/bison/bison.simple"
@ -1007,72 +1010,84 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 2: case 2:
#line 66 "imap_csim.y" #line 68 "imap_csim.y"
{ {
g_strreplace(&_map_info->image_name, yyvsp[-2].id); g_strreplace(&_map_info->image_name, yyvsp[-2].id);
; }
break;} break;
case 7: case 7:
#line 77 "imap_csim.y"
{;
break;}
case 8:
#line 78 "imap_csim.y"
{;
break;}
case 9:
#line 79 "imap_csim.y" #line 79 "imap_csim.y"
{; {}
break;} break;
case 8:
#line 80 "imap_csim.y"
{}
break;
case 9:
#line 81 "imap_csim.y"
{}
break;
case 10: case 10:
#line 83 "imap_csim.y" #line 85 "imap_csim.y"
{ {
_map_info->old_image_width = (gint) yyvsp[0].value; _map_info->old_image_width = yyvsp[0].val;
; }
break;} break;
case 11: case 11:
#line 89 "imap_csim.y" #line 91 "imap_csim.y"
{ {
_map_info->old_image_height = (gint) yyvsp[0].value; _map_info->old_image_height = yyvsp[0].val;
; }
break;} break;
case 12: case 12:
#line 95 "imap_csim.y" #line 97 "imap_csim.y"
{
yyval.val = (gint) yyvsp[0].value;
}
break;
case 13:
#line 101 "imap_csim.y"
{
yyval.val = (gint) atof(yyvsp[0].id);
}
break;
case 14:
#line 107 "imap_csim.y"
{ {
g_strreplace(&_map_info->title, yyvsp[-1].id); g_strreplace(&_map_info->title, yyvsp[-1].id);
; }
break;} break;
case 18: case 20:
#line 110 "imap_csim.y" #line 122 "imap_csim.y"
{ {
; }
break;} break;
case 19: case 21:
#line 115 "imap_csim.y" #line 127 "imap_csim.y"
{ {
g_strreplace(&_map_info->author, yyvsp[-1].id); g_strreplace(&_map_info->author, yyvsp[-1].id);
; }
break;} break;
case 20: case 22:
#line 122 "imap_csim.y" #line 134 "imap_csim.y"
{ {
gchar *description; gchar *description;
description = g_strconcat(_map_info->description, yyvsp[-1].id, "\n", description = g_strconcat(_map_info->description, yyvsp[-1].id, "\n",
NULL); NULL);
g_strreplace(&_map_info->description, description); g_strreplace(&_map_info->description, description);
; }
break;} break;
case 23: case 25:
#line 136 "imap_csim.y" #line 148 "imap_csim.y"
{ {
if (current_type != UNDEFINED) if (current_type != UNDEFINED)
add_shape(current_object); add_shape(current_object);
; }
break;} break;
case 38: case 40:
#line 163 "imap_csim.y" #line 175 "imap_csim.y"
{ {
if (!g_ascii_strcasecmp(yyvsp[0].id, "RECT")) { if (!g_ascii_strcasecmp(yyvsp[0].id, "RECT")) {
current_object = create_rectangle(0, 0, 0, 0); current_object = create_rectangle(0, 0, 0, 0);
@ -1086,10 +1101,10 @@ case 38:
} else if (!g_ascii_strcasecmp(yyvsp[0].id, "DEFAULT")) { } else if (!g_ascii_strcasecmp(yyvsp[0].id, "DEFAULT")) {
current_type = UNDEFINED; current_type = UNDEFINED;
} }
; }
break;} break;
case 39: case 41:
#line 180 "imap_csim.y" #line 192 "imap_csim.y"
{ {
char *p; char *p;
if (current_type == RECTANGLE) { if (current_type == RECTANGLE) {
@ -1144,59 +1159,59 @@ case 39:
polygon_remove_last_point(polygon); polygon_remove_last_point(polygon);
polygon->points = points; polygon->points = points;
} }
; }
break;} break;
case 40: case 42:
#line 238 "imap_csim.y" #line 250 "imap_csim.y"
{ {
if (current_type == UNDEFINED) { if (current_type == UNDEFINED) {
g_strreplace(&_map_info->default_url, yyvsp[0].id); g_strreplace(&_map_info->default_url, yyvsp[0].id);
} else { } else {
object_set_url(current_object, yyvsp[0].id); object_set_url(current_object, yyvsp[0].id);
} }
; }
break;} break;
case 41:
#line 248 "imap_csim.y"
{
;
break;}
case 42:
#line 253 "imap_csim.y"
{
object_set_comment(current_object, yyvsp[0].id);
;
break;}
case 43: case 43:
#line 259 "imap_csim.y" #line 260 "imap_csim.y"
{ {
object_set_target(current_object, yyvsp[0].id); }
; break;
break;}
case 44: case 44:
#line 265 "imap_csim.y" #line 265 "imap_csim.y"
{ {
object_set_mouse_over(current_object, yyvsp[0].id); object_set_comment(current_object, yyvsp[0].id);
; }
break;} break;
case 45: case 45:
#line 271 "imap_csim.y" #line 271 "imap_csim.y"
{ {
object_set_mouse_out(current_object, yyvsp[0].id); object_set_target(current_object, yyvsp[0].id);
; }
break;} break;
case 46: case 46:
#line 277 "imap_csim.y" #line 277 "imap_csim.y"
{ {
object_set_focus(current_object, yyvsp[0].id); object_set_mouse_over(current_object, yyvsp[0].id);
; }
break;} break;
case 47: case 47:
#line 283 "imap_csim.y" #line 283 "imap_csim.y"
{
object_set_mouse_out(current_object, yyvsp[0].id);
}
break;
case 48:
#line 289 "imap_csim.y"
{
object_set_focus(current_object, yyvsp[0].id);
}
break;
case 49:
#line 295 "imap_csim.y"
{ {
object_set_blur(current_object, yyvsp[0].id); object_set_blur(current_object, yyvsp[0].id);
; }
break;} break;
} }
#line 705 "/usr/share/bison/bison.simple" #line 705 "/usr/share/bison/bison.simple"
@ -1430,7 +1445,7 @@ yyreturn:
#endif #endif
return yyresult; return yyresult;
} }
#line 291 "imap_csim.y" #line 303 "imap_csim.y"
static void static void

View File

@ -1,5 +1,5 @@
#ifndef BISON_IMAP_CSIM_TAB_H #ifndef BISON_IMAP_CSIM_PARSE_H
# define BISON_IMAP_CSIM_TAB_H # define BISON_IMAP_CSIM_PARSE_H
#ifndef YYSTYPE #ifndef YYSTYPE
typedef union { typedef union {
@ -40,4 +40,4 @@ typedef union {
extern YYSTYPE csim_lval; extern YYSTYPE csim_lval;
#endif /* not BISON_IMAP_CSIM_TAB_H */ #endif /* not BISON_IMAP_CSIM_PARSE_H */

View File

@ -866,7 +866,7 @@ save_as_csim(gpointer param, OutputFunc_t output)
char *p; char *p;
gchar *description; gchar *description;
output(param, "<img src=\"%s\" width=%d height=%d border=0 " output(param, "<img src=\"%s\" width=\"%d\" height=\"%d\" border=\"0\" "
"usemap=\"#%s\" />\n\n", _map_info.image_name, "usemap=\"#%s\" />\n\n", _map_info.image_name,
_image_width, _image_height, _map_info.title); _image_width, _image_height, _map_info.title);
output(param, "<map name=\"%s\">\n", _map_info.title); output(param, "<map name=\"%s\">\n", _map_info.title);

View File

@ -3,7 +3,7 @@
* *
* Generates clickable image maps. * Generates clickable image maps.
* *
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl * Copyright (C) 1998-2003 Maurits Rijk lpeek.mrijk@consunet.nl
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -432,7 +432,6 @@ menu_build_mru_items(MRU_t *mru)
GList *children; GList *children;
children = gtk_container_get_children(GTK_CONTAINER(_menu.open_recent)); children = gtk_container_get_children(GTK_CONTAINER(_menu.open_recent));
p = g_list_nth(children, position); p = g_list_nth(children, position);
for (i = 0; i < _menu.nr_off_mru_items; i++, p = p->next) { for (i = 0; i < _menu.nr_off_mru_items; i++, p = p->next) {
gtk_widget_destroy((GtkWidget*) p->data); gtk_widget_destroy((GtkWidget*) p->data);
@ -450,7 +449,7 @@ menu_build_mru_items(MRU_t *mru)
add_accelerator(item, accelerator_key, GDK_CONTROL_MASK); add_accelerator(item, accelerator_key, GDK_CONTROL_MASK);
} }
} }
_menu.nr_off_mru_items = i + 1; _menu.nr_off_mru_items = i;
} }
void void

View File

@ -75,7 +75,7 @@ INSTOBJEXT = @INSTOBJEXT@
.po.pox: .po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot $(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*pox $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo: .po.mo:
$(MSGFMT) -o $@ $< $(MSGFMT) -o $@ $<
@ -168,9 +168,7 @@ uninstall:
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
done done
if test "$(PACKAGE)" = "glib"; then \ rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
fi
check: all check: all
@ -179,7 +177,6 @@ dvi info tags TAGS ID:
mostlyclean: mostlyclean:
rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
rm -fr *.o rm -fr *.o
rm -f .intltool-merge-cache
clean: mostlyclean clean: mostlyclean
@ -201,31 +198,35 @@ dist distdir: update-po $(DISTFILES)
update-po: Makefile update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot $(MAKE) $(GETTEXT_PACKAGE).pot
tmpdir=`pwd`; \
cd $(srcdir); \ cd $(srcdir); \
catalogs='$(CATALOGS)'; \ catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \ for cat in $$catalogs; do \
cat=`basename $$cat`; \ cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
cp $$lang.po $$lang.old.po; \
echo "$$lang:"; \ echo "$$lang:"; \
if $$tmpdir/$(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist -o $$tmpdir/$$lang.new.po $$lang; then \ if $(MSGMERGE) $$lang; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$lang.old.po; \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
exit 1; \
fi; \
fi; \
else \ else \
echo "msgmerge for $$cat failed!"; \ echo "msgmerge for $$cat failed!"; \
rm -f $$tmpdir/$$lang.new.po; \ rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
fi; \ fi; \
done done
.po: Makefile
$(MAKE) $(PACKAGE).pot;
PATH=`pwd`/../src:$$PATH; \
echo; printf "$*: "; \
if $(MSGMERGE) $*; then \
rm -f $*.old.po; \
else \
echo "msgmerge for * failed!"; \
mv $*.old.po $*.po; \
fi; \
msgfmt --statistics $*.po; echo;
# POTFILES is created from POTFILES.in by stripping comments, empty lines # POTFILES is created from POTFILES.in by stripping comments, empty lines
# and Intltool tags (enclosed in square brackets), and appending a full # and Intltool tags (enclosed in square brackets), and appending a full
# relative path to them # relative path to them