plug-ins: imagemap, tabs to spaces

This commit is contained in:
Mikael Magnusson 2011-02-21 11:51:47 +01:00
parent 8f294661b2
commit e012caf1a3
78 changed files with 4025 additions and 4025 deletions

View File

@ -66,14 +66,14 @@ browse_cb (GtkWidget *widget,
GtkWidget *dialog; GtkWidget *dialog;
dialog = browse->file_chooser = dialog = browse->file_chooser =
gtk_file_chooser_dialog_new (browse->name, gtk_file_chooser_dialog_new (browse->name,
GTK_WINDOW (gtk_widget_get_toplevel (widget)), GTK_WINDOW (gtk_widget_get_toplevel (widget)),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL); NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK, GTK_RESPONSE_OK,
@ -83,8 +83,8 @@ browse_cb (GtkWidget *widget,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
g_signal_connect (dialog, "destroy", g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&dialog); &dialog);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (select_cb), G_CALLBACK (select_cb),
browse); browse);
@ -94,7 +94,7 @@ browse_cb (GtkWidget *widget,
static void static void
handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *data, guint info, guint time) GtkSelectionData *data, guint info, guint time)
{ {
gboolean success = FALSE; gboolean success = FALSE;
@ -130,9 +130,9 @@ browse_widget_new (const gchar *name)
browse->file = gtk_entry_new (); browse->file = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX(browse->hbox), browse->file, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX(browse->hbox), browse->file, TRUE, TRUE, 0);
gtk_drag_dest_set (browse->file, GTK_DEST_DEFAULT_ALL, target_table, gtk_drag_dest_set (browse->file, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY); 2, GDK_ACTION_COPY);
g_signal_connect (browse->file, "drag-data-received", g_signal_connect (browse->file, "drag-data-received",
G_CALLBACK(handle_drop), NULL); G_CALLBACK(handle_drop), NULL);
gtk_widget_show (browse->file); gtk_widget_show (browse->file);
@ -143,7 +143,7 @@ browse_widget_new (const gchar *name)
gtk_box_pack_end(GTK_BOX (browse->hbox), button, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX (browse->hbox), button, FALSE, FALSE, 0);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK(browse_cb), (gpointer) browse); G_CALLBACK(browse_cb), (gpointer) browse);
gtk_widget_show (button); gtk_widget_show (button);
return browse; return browse;
@ -157,7 +157,7 @@ browse_widget_set_filename(BrowseWidget_t *browse, const gchar *filename)
void void
browse_widget_set_filter(BrowseWidget_t *browse, BrowseFilter_t filter, browse_widget_set_filter(BrowseWidget_t *browse, BrowseFilter_t filter,
gpointer data) gpointer data)
{ {
browse->filter = filter; browse->filter = filter;
browse->filter_data = data; browse->filter_data = data;

File diff suppressed because it is too large Load Diff

View File

@ -176,7 +176,7 @@ typedef union YYSTYPE
} }
/* Line 187 of yacc.c. */ /* Line 187 of yacc.c. */
#line 179 "y.tab.c" #line 179 "y.tab.c"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
@ -320,7 +320,7 @@ YYID (i)
# endif # endif
# if (defined __cplusplus && ! defined _STDLIB_H \ # if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \ && ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free))) && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H # ifndef _STDLIB_H
# define _STDLIB_H 1 # define _STDLIB_H 1
@ -346,7 +346,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \ #if (! defined yyoverflow \
&& (! defined __cplusplus \ && (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */ /* A type that is properly aligned for any stack member. */
union yyalloc union yyalloc
@ -371,13 +371,13 @@ union yyalloc
# define YYCOPY(To, From, Count) \ # define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From))) __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else # else
# define YYCOPY(To, From, Count) \ # define YYCOPY(To, From, Count) \
do \ do \
{ \ { \
YYSIZE_T yyi; \ YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \ (To)[yyi] = (From)[yyi]; \
} \ } \
while (YYID (0)) while (YYID (0))
# endif # endif
# endif # endif
@ -387,15 +387,15 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next stack. Advance YYPTR to a properly aligned location for the next
stack. */ stack. */
# define YYSTACK_RELOCATE(Stack) \ # define YYSTACK_RELOCATE(Stack) \
do \ do \
{ \ { \
YYSIZE_T yynewbytes; \ YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \ YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \ Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \ yyptr += yynewbytes / sizeof (*yyptr); \
} \ } \
while (YYID (0)) while (YYID (0))
#endif #endif
@ -418,7 +418,7 @@ union yyalloc
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 267 #define YYMAXUTOK 267
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
@ -597,44 +597,44 @@ static const yytype_uint8 yystos[] =
12 12
}; };
#define yyerrok (yyerrstatus = 0) #define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY) #define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2) #define YYEMPTY (-2)
#define YYEOF 0 #define YYEOF 0
#define YYACCEPT goto yyacceptlab #define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab #define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab #define YYERROR goto yyerrorlab
/* Like YYERROR except do call yyerror. This remains here temporarily /* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC. to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */ Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab #define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus) #define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \ #define YYBACKUP(Token, Value) \
do \ do \
if (yychar == YYEMPTY && yylen == 1) \ if (yychar == YYEMPTY && yylen == 1) \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \ yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \ YYPOPSTACK (1); \
goto yybackup; \ goto yybackup; \
} \ } \
else \ else \
{ \ { \
yyerror (YY_("syntax error: cannot back up")); \ yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \ YYERROR; \
} \ } \
while (YYID (0)) while (YYID (0))
#define YYTERROR 1 #define YYTERROR 1
#define YYERRCODE 256 #define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
@ -643,22 +643,22 @@ while (YYID (0))
#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
do \ do \
if (YYID (N)) \ if (YYID (N)) \
{ \ { \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \ } \
else \ else \
{ \ { \
(Current).first_line = (Current).last_line = \ (Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \ YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \ (Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \ YYRHSLOC (Rhs, 0).last_column; \
} \ } \
while (YYID (0)) while (YYID (0))
#endif #endif
@ -669,10 +669,10 @@ while (YYID (0))
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL # if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \ (Loc).first_line, (Loc).first_column, \
(Loc).last_line, (Loc).last_column) (Loc).last_line, (Loc).last_column)
# else # else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0) # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif # endif
@ -695,21 +695,21 @@ while (YYID (0))
# define YYFPRINTF fprintf # define YYFPRINTF fprintf
# endif # endif
# define YYDPRINTF(Args) \ # define YYDPRINTF(Args) \
do { \ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (YYID (0)) } while (YYID (0))
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \ do { \
if (yydebug) \ if (yydebug) \
{ \ { \
YYFPRINTF (stderr, "%s ", Title); \ YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \ yy_symbol_print (stderr, \
Type, Value); \ Type, Value); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (YYID (0)) } while (YYID (0))
@ -741,7 +741,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
switch (yytype) switch (yytype)
{ {
default: default:
break; break;
} }
} }
@ -793,10 +793,10 @@ yy_stack_print (bottom, top)
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
# define YY_STACK_PRINT(Bottom, Top) \ # define YY_STACK_PRINT(Bottom, Top) \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_stack_print ((Bottom), (Top)); \ yy_stack_print ((Bottom), (Top)); \
} while (YYID (0)) } while (YYID (0))
@ -819,21 +819,21 @@ yy_reduce_print (yyvsp, yyrule)
int yyi; int yyi;
unsigned long int yylno = yyrline[yyrule]; unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno); yyrule - 1, yylno);
/* The symbols being reduced. */ /* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) for (yyi = 0; yyi < yynrhs; yyi++)
{ {
fprintf (stderr, " $%d = ", yyi + 1); fprintf (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)]) &(yyvsp[(yyi + 1) - (yynrhs)])
); );
fprintf (stderr, "\n"); fprintf (stderr, "\n");
} }
} }
# define YY_REDUCE_PRINT(Rule) \ # define YY_REDUCE_PRINT(Rule) \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (yyvsp, Rule); \ yy_reduce_print (yyvsp, Rule); \
} while (YYID (0)) } while (YYID (0))
@ -849,7 +849,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */ /* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH #ifndef YYINITDEPTH
# define YYINITDEPTH 200 # define YYINITDEPTH 200
#endif #endif
@ -936,27 +936,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr; char const *yyp = yystr;
for (;;) for (;;)
switch (*++yyp) switch (*++yyp)
{ {
case '\'': case '\'':
case ',': case ',':
goto do_not_strip_quotes; goto do_not_strip_quotes;
case '\\': case '\\':
if (*++yyp != '\\') if (*++yyp != '\\')
goto do_not_strip_quotes; goto do_not_strip_quotes;
/* Fall through. */ /* Fall through. */
default: default:
if (yyres) if (yyres)
yyres[yyn] = *yyp; yyres[yyn] = *yyp;
yyn++; yyn++;
break; break;
case '"': case '"':
if (yyres) if (yyres)
yyres[yyn] = '\0'; yyres[yyn] = '\0';
return yyn; return yyn;
} }
do_not_strip_quotes: ; do_not_strip_quotes: ;
} }
@ -994,7 +994,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
# if 0 # if 0
/* This is so xgettext sees the translatable formats that are /* This is so xgettext sees the translatable formats that are
constructed on the fly. */ constructed on the fly. */
YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s");
YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s");
YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s");
@ -1007,13 +1007,13 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
static char const yyexpecting[] = ", expecting %s"; static char const yyexpecting[] = ", expecting %s";
static char const yyor[] = " or %s"; static char const yyor[] = " or %s";
char yyformat[sizeof yyunexpected char yyformat[sizeof yyunexpected
+ sizeof yyexpecting - 1 + sizeof yyexpecting - 1
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof yyor - 1))]; * (sizeof yyor - 1))];
char const *yyprefix = yyexpecting; char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in /* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */ YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0; int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */ /* Stay within bounds of both yycheck and yytname. */
@ -1025,22 +1025,22 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
yyfmt = yystpcpy (yyformat, yyunexpected); yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx) for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{ {
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{ {
yycount = 1; yycount = 1;
yysize = yysize0; yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0'; yyformat[sizeof yyunexpected - 1] = '\0';
break; break;
} }
yyarg[yycount++] = yytname[yyx]; yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= (yysize1 < yysize); yysize_overflow |= (yysize1 < yysize);
yysize = yysize1; yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix); yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor; yyprefix = yyor;
} }
yyf = YY_(yyformat); yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf); yysize1 = yysize + yystrlen (yyf);
@ -1048,29 +1048,29 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
yysize = yysize1; yysize = yysize1;
if (yysize_overflow) if (yysize_overflow)
return YYSIZE_MAXIMUM; return YYSIZE_MAXIMUM;
if (yyresult) if (yyresult)
{ {
/* Avoid sprintf, as that infringes on the user's name space. /* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */ produced a string with the wrong number of "%s"s. */
char *yyp = yyresult; char *yyp = yyresult;
int yyi = 0; int yyi = 0;
while ((*yyp = *yyf) != '\0') while ((*yyp = *yyf) != '\0')
{ {
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{ {
yyp += yytnamerr (yyp, yyarg[yyi++]); yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2; yyf += 2;
} }
else else
{ {
yyp++; yyp++;
yyf++; yyf++;
} }
} }
} }
return yysize; return yysize;
} }
} }
@ -1104,7 +1104,7 @@ yydestruct (yymsg, yytype, yyvaluep)
{ {
default: default:
break; break;
} }
} }
@ -1217,7 +1217,7 @@ yyparse ()
yystate = 0; yystate = 0;
yyerrstatus = 0; yyerrstatus = 0;
yynerrs = 0; yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers. /* Initialize stack pointers.
Waste one element of value and location stack Waste one element of value and location stack
@ -1247,25 +1247,25 @@ yyparse ()
#ifdef yyoverflow #ifdef yyoverflow
{ {
/* Give user a chance to reallocate the stack. Use copies of /* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into these so that the &'s don't force the real ones into
memory. */ memory. */
YYSTYPE *yyvs1 = yyvs; YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss; yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the /* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */ be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"), yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp), &yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp), &yyvs1, yysize * sizeof (*yyvsp),
&yystacksize); &yystacksize);
yyss = yyss1; yyss = yyss1;
yyvs = yyvs1; yyvs = yyvs1;
} }
#else /* no yyoverflow */ #else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE # ifndef YYSTACK_RELOCATE
@ -1273,23 +1273,23 @@ yyparse ()
# else # else
/* Extend the stack our own way. */ /* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize) if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab; goto yyexhaustedlab;
yystacksize *= 2; yystacksize *= 2;
if (YYMAXDEPTH < yystacksize) if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH; yystacksize = YYMAXDEPTH;
{ {
yytype_int16 *yyss1 = yyss; yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr = union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr) if (! yyptr)
goto yyexhaustedlab; goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyvs);
# undef YYSTACK_RELOCATE # undef YYSTACK_RELOCATE
if (yyss1 != yyssa) if (yyss1 != yyssa)
YYSTACK_FREE (yyss1); YYSTACK_FREE (yyss1);
} }
# endif # endif
#endif /* no yyoverflow */ #endif /* no yyoverflow */
@ -1299,10 +1299,10 @@ yyparse ()
YYDPRINTF ((stderr, "Stack size increased to %lu\n", YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize)); (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
YYABORT; YYABORT;
} }
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@ -1351,7 +1351,7 @@ yybackup:
if (yyn <= 0) if (yyn <= 0)
{ {
if (yyn == 0 || yyn == YYTABLE_NINF) if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab; goto yyerrlab;
yyn = -yyn; yyn = -yyn;
goto yyreduce; goto yyreduce;
} }
@ -1411,37 +1411,37 @@ yyreduce:
case 10: case 10:
#line 74 "imap_cern.y" #line 74 "imap_cern.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
g_strreplace(&info->default_url, (yyvsp[(2) - (2)].id)); g_strreplace(&info->default_url, (yyvsp[(2) - (2)].id));
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 11: case 11:
#line 83 "imap_cern.y" #line 83 "imap_cern.y"
{ {
gint x = (gint) (yyvsp[(3) - (12)].value); gint x = (gint) (yyvsp[(3) - (12)].value);
gint y = (gint) (yyvsp[(5) - (12)].value); gint y = (gint) (yyvsp[(5) - (12)].value);
gint width = (gint) fabs((yyvsp[(8) - (12)].value) - x); gint width = (gint) fabs((yyvsp[(8) - (12)].value) - x);
gint height = (gint) fabs((yyvsp[(10) - (12)].value) - y); gint height = (gint) fabs((yyvsp[(10) - (12)].value) - y);
current_object = create_rectangle(x, y, width, height); current_object = create_rectangle(x, y, width, height);
object_set_url(current_object, (yyvsp[(12) - (12)].id)); object_set_url(current_object, (yyvsp[(12) - (12)].id));
add_shape(current_object); add_shape(current_object);
g_free ((yyvsp[(12) - (12)].id)); g_free ((yyvsp[(12) - (12)].id));
} }
break; break;
case 12: case 12:
#line 96 "imap_cern.y" #line 96 "imap_cern.y"
{ {
gint x = (gint) (yyvsp[(3) - (8)].value); gint x = (gint) (yyvsp[(3) - (8)].value);
gint y = (gint) (yyvsp[(5) - (8)].value); gint y = (gint) (yyvsp[(5) - (8)].value);
gint r = (gint) (yyvsp[(7) - (8)].value); gint r = (gint) (yyvsp[(7) - (8)].value);
current_object = create_circle(x, y, r); current_object = create_circle(x, y, r);
object_set_url(current_object, (yyvsp[(8) - (8)].id)); object_set_url(current_object, (yyvsp[(8) - (8)].id));
add_shape(current_object); add_shape(current_object);
g_free ((yyvsp[(8) - (8)].id)); g_free ((yyvsp[(8) - (8)].id));
} }
break; break;
case 13: case 13:
@ -1452,55 +1452,55 @@ yyreduce:
case 14: case 14:
#line 108 "imap_cern.y" #line 108 "imap_cern.y"
{ {
object_set_url(current_object, (yyvsp[(4) - (4)].id)); object_set_url(current_object, (yyvsp[(4) - (4)].id));
add_shape(current_object); add_shape(current_object);
g_free ((yyvsp[(4) - (4)].id)); g_free ((yyvsp[(4) - (4)].id));
} }
break; break;
case 16: case 16:
#line 117 "imap_cern.y" #line 117 "imap_cern.y"
{ {
} }
break; break;
case 17: case 17:
#line 122 "imap_cern.y" #line 122 "imap_cern.y"
{ {
Polygon_t *polygon = ObjectToPolygon(current_object); Polygon_t *polygon = ObjectToPolygon(current_object);
GdkPoint *point = new_point((gint) (yyvsp[(2) - (5)].value), (gint) (yyvsp[(4) - (5)].value)); GdkPoint *point = new_point((gint) (yyvsp[(2) - (5)].value), (gint) (yyvsp[(4) - (5)].value));
polygon->points = g_list_append(polygon->points, polygon->points = g_list_append(polygon->points,
(gpointer) point); (gpointer) point);
} }
break; break;
case 21: case 21:
#line 136 "imap_cern.y" #line 136 "imap_cern.y"
{ {
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 22: case 22:
#line 142 "imap_cern.y" #line 142 "imap_cern.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
g_strreplace(&info->author, (yyvsp[(2) - (2)].id)); g_strreplace(&info->author, (yyvsp[(2) - (2)].id));
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 23: case 23:
#line 150 "imap_cern.y" #line 150 "imap_cern.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
gchar *description; gchar *description;
description = g_strconcat(info->description, (yyvsp[(2) - (2)].id), "\n", description = g_strconcat(info->description, (yyvsp[(2) - (2)].id), "\n",
NULL); NULL);
g_strreplace(&info->description, description); g_strreplace(&info->description, description);
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
@ -1544,35 +1544,35 @@ yyerrlab:
yyerror (YY_("syntax error")); yyerror (YY_("syntax error"));
#else #else
{ {
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
{ {
YYSIZE_T yyalloc = 2 * yysize; YYSIZE_T yyalloc = 2 * yysize;
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
yyalloc = YYSTACK_ALLOC_MAXIMUM; yyalloc = YYSTACK_ALLOC_MAXIMUM;
if (yymsg != yymsgbuf) if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg); YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yyalloc); yymsg = (char *) YYSTACK_ALLOC (yyalloc);
if (yymsg) if (yymsg)
yymsg_alloc = yyalloc; yymsg_alloc = yyalloc;
else else
{ {
yymsg = yymsgbuf; yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf; yymsg_alloc = sizeof yymsgbuf;
} }
} }
if (0 < yysize && yysize <= yymsg_alloc) if (0 < yysize && yysize <= yymsg_alloc)
{ {
(void) yysyntax_error (yymsg, yystate, yychar); (void) yysyntax_error (yymsg, yystate, yychar);
yyerror (yymsg); yyerror (yymsg);
} }
else else
{ {
yyerror (YY_("syntax error")); yyerror (YY_("syntax error"));
if (yysize != 0) if (yysize != 0)
goto yyexhaustedlab; goto yyexhaustedlab;
} }
} }
#endif #endif
} }
@ -1582,20 +1582,20 @@ yyerrlab:
if (yyerrstatus == 3) if (yyerrstatus == 3)
{ {
/* If just tried and failed to reuse look-ahead token after an /* If just tried and failed to reuse look-ahead token after an
error, discard it. */ error, discard it. */
if (yychar <= YYEOF) if (yychar <= YYEOF)
{ {
/* Return failure if at end of input. */ /* Return failure if at end of input. */
if (yychar == YYEOF) if (yychar == YYEOF)
YYABORT; YYABORT;
} }
else else
{ {
yydestruct ("Error: discarding", yydestruct ("Error: discarding",
yytoken, &yylval); yytoken, &yylval);
yychar = YYEMPTY; yychar = YYEMPTY;
} }
} }
/* Else will try to reuse look-ahead token after shifting the error /* Else will try to reuse look-ahead token after shifting the error
@ -1627,29 +1627,29 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. | | yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/ `-------------------------------------------------------------*/
yyerrlab1: yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;) for (;;)
{ {
yyn = yypact[yystate]; yyn = yypact[yystate];
if (yyn != YYPACT_NINF) if (yyn != YYPACT_NINF)
{ {
yyn += YYTERROR; yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{ {
yyn = yytable[yyn]; yyn = yytable[yyn];
if (0 < yyn) if (0 < yyn)
break; break;
} }
} }
/* Pop the current state because it cannot handle the error token. */ /* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss) if (yyssp == yyss)
YYABORT; YYABORT;
yydestruct ("Error: popping", yydestruct ("Error: popping",
yystos[yystate], yyvsp); yystos[yystate], yyvsp);
YYPOPSTACK (1); YYPOPSTACK (1);
yystate = *yyssp; yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
@ -1695,7 +1695,7 @@ yyexhaustedlab:
yyreturn: yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY) if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead", yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval); yytoken, &yylval);
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */ this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@ -1703,7 +1703,7 @@ yyreturn:
while (yyssp != yyss) while (yyssp != yyss)
{ {
yydestruct ("Cleanup: popping", yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp); yystos[*yyssp], yyvsp);
YYPOPSTACK (1); YYPOPSTACK (1);
} }
#ifndef yyoverflow #ifndef yyoverflow

View File

@ -76,7 +76,7 @@ typedef union YYSTYPE
} }
/* Line 1489 of yacc.c. */ /* Line 1489 of yacc.c. */
#line 79 "y.tab.h" #line 79 "y.tab.h"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1

View File

@ -44,7 +44,7 @@ static void circle_draw_sashes(Object_t* obj, GdkWindow *window, GdkGC* gc);
static MoveSashFunc_t circle_near_sash(Object_t *obj, gint x, gint y); static MoveSashFunc_t circle_near_sash(Object_t *obj, gint x, gint y);
static gboolean circle_point_is_on(Object_t *obj, gint x, gint y); static gboolean circle_point_is_on(Object_t *obj, gint x, gint y);
static void circle_get_dimensions(Object_t *obj, gint *x, gint *y, static void circle_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height); gint *width, gint *height);
static void circle_resize(Object_t *obj, gint percentage_x, gint percentage_y); static void circle_resize(Object_t *obj, gint percentage_x, gint percentage_y);
static void circle_move(Object_t *obj, gint dx, gint dy); static void circle_move(Object_t *obj, gint dx, gint dy);
static gpointer circle_create_info_widget(GtkWidget *frame); static gpointer circle_create_info_widget(GtkWidget *frame);
@ -52,24 +52,24 @@ static void circle_fill_info_tab(Object_t *obj, gpointer data);
static void circle_set_initial_focus(Object_t *obj, gpointer data); static void circle_set_initial_focus(Object_t *obj, gpointer data);
static void circle_update(Object_t* obj, gpointer data); static void circle_update(Object_t* obj, gpointer data);
static void circle_write_csim(Object_t* obj, gpointer param, static void circle_write_csim(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void circle_write_cern(Object_t* obj, gpointer param, static void circle_write_cern(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void circle_write_ncsa(Object_t* obj, gpointer param, static void circle_write_ncsa(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static const gchar* circle_get_stock_icon_name(void); static const gchar* circle_get_stock_icon_name(void);
static ObjectClass_t circle_class = { static ObjectClass_t circle_class = {
N_("C_ircle"), N_("C_ircle"),
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */
circle_is_valid, circle_is_valid,
NULL, /* circle_destruct */ NULL, /* circle_destruct */
circle_clone, circle_clone,
circle_assign, circle_assign,
NULL, /* circle_normalize */ NULL, /* circle_normalize */
circle_draw, circle_draw,
circle_draw_sashes, circle_draw_sashes,
circle_near_sash, circle_near_sash,
@ -78,7 +78,7 @@ static ObjectClass_t circle_class = {
circle_resize, circle_resize,
circle_move, circle_move,
circle_create_info_widget, circle_create_info_widget,
circle_fill_info_tab, /* circle_update_info_widget */ circle_fill_info_tab, /* circle_update_info_widget */
circle_fill_info_tab, circle_fill_info_tab,
circle_set_initial_focus, circle_set_initial_focus,
circle_update, circle_update,
@ -167,7 +167,7 @@ circle_resize(Object_t *obj, gint percentage_x, gint percentage_y)
circle->x = circle->x * percentage_x / 100; circle->x = circle->x * percentage_x / 100;
circle->y = circle->y * percentage_y / 100; circle->y = circle->y * percentage_y / 100;
circle->r = circle->r * ((percentage_x < percentage_y) circle->r = circle->r * ((percentage_x < percentage_y)
? percentage_x : percentage_y) / 100; ? percentage_x : percentage_y) / 100;
} }
static MoveSashFunc_t static MoveSashFunc_t
@ -195,7 +195,7 @@ circle_point_is_on(Object_t *obj, gint x, gint y)
static void static void
circle_get_dimensions(Object_t *obj, gint *x, gint *y, circle_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height) gint *width, gint *height)
{ {
Circle_t *circle = ObjectToCircle(obj); Circle_t *circle = ObjectToCircle(obj);
*x = circle->x - circle->r; *x = circle->x - circle->r;
@ -262,14 +262,14 @@ circle_create_info_widget(GtkWidget *frame)
label = create_label_in_table(table, 0, 0, _("Center _x:")); label = create_label_in_table(table, 0, 0, _("Center _x:"));
props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0, props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0,
max_width - 1); max_width - 1);
g_signal_connect(props->x, "value-changed", g_signal_connect(props->x, "value-changed",
G_CALLBACK (x_changed_cb), (gpointer) props); G_CALLBACK (x_changed_cb), (gpointer) props);
create_label_in_table(table, 0, 2, _("pixels")); create_label_in_table(table, 0, 2, _("pixels"));
label = create_label_in_table(table, 1, 0, _("Center _y:")); label = create_label_in_table(table, 1, 0, _("Center _y:"));
props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0, props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0,
max_height - 1); max_height - 1);
g_signal_connect(props->y, "value-changed", g_signal_connect(props->y, "value-changed",
G_CALLBACK (y_changed_cb), (gpointer) props); G_CALLBACK (y_changed_cb), (gpointer) props);
create_label_in_table(table, 1, 2, _("pixels")); create_label_in_table(table, 1, 2, _("pixels"));
@ -318,7 +318,7 @@ circle_write_csim(Object_t *obj, gpointer param, OutputFunc_t output)
{ {
Circle_t *circle = ObjectToCircle(obj); Circle_t *circle = ObjectToCircle(obj);
output(param, "\"circle\" coords=\"%d,%d,%d\"", circle->x, circle->y, output(param, "\"circle\" coords=\"%d,%d,%d\"", circle->x, circle->y,
circle->r); circle->r);
} }
static void static void
@ -333,7 +333,7 @@ circle_write_ncsa(Object_t *obj, gpointer param, OutputFunc_t output)
{ {
Circle_t *circle = ObjectToCircle(obj); Circle_t *circle = ObjectToCircle(obj);
output(param, "circle %s %d,%d %d,%d", obj->url, output(param, "circle %s %d,%d %d,%d", obj->url,
circle->x, circle->y, circle->x, circle->y + circle->r); circle->x, circle->y, circle->x, circle->y + circle->r);
} }
static const gchar* static const gchar*
@ -367,9 +367,9 @@ circle_factory_set_xy1(Object_t *obj, guint state, gint x, gint y)
} }
static ObjectFactory_t circle_factory1 = { static ObjectFactory_t circle_factory1 = {
NULL, /* Object pointer */ NULL, /* Object pointer */
NULL, /* Finish func */ NULL, /* Finish func */
NULL, /* Cancel func */ NULL, /* Cancel func */
circle_factory_create_object1, circle_factory_create_object1,
circle_factory_set_xy1 circle_factory_set_xy1
}; };
@ -393,9 +393,9 @@ circle_factory_set_xy2(Object_t *obj, guint state, gint x, gint y)
} }
static ObjectFactory_t circle_factory2 = { static ObjectFactory_t circle_factory2 = {
NULL, /* Object pointer */ NULL, /* Object pointer */
NULL, /* Finish func */ NULL, /* Finish func */
NULL, /* Cancel func */ NULL, /* Cancel func */
circle_factory_create_object2, circle_factory_create_object2,
circle_factory_set_xy2 circle_factory_set_xy2
}; };

View File

@ -31,15 +31,15 @@
static CmdExecuteValue_t clear_command_execute(Command_t *parent); static CmdExecuteValue_t clear_command_execute(Command_t *parent);
static CommandClass_t clear_command_class = { static CommandClass_t clear_command_class = {
NULL, /* clear_command_destruct */ NULL, /* clear_command_destruct */
clear_command_execute, clear_command_execute,
NULL, /* clear_command_undo */ NULL, /* clear_command_undo */
NULL /* clear_command_redo */ NULL /* clear_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
ObjectList_t *list; ObjectList_t *list;
} ClearCommand_t; } ClearCommand_t;
Command_t* Command_t*
@ -55,7 +55,7 @@ remove_one_object(Object_t *obj, gpointer data)
{ {
ClearCommand_t *command = (ClearCommand_t*) data; ClearCommand_t *command = (ClearCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
delete_command_new(command->list, obj)); delete_command_new(command->list, obj));
} }
static CmdExecuteValue_t static CmdExecuteValue_t

View File

@ -32,10 +32,10 @@ static CmdExecuteValue_t copy_command_execute(Command_t *parent);
static void copy_command_undo(Command_t *parent); static void copy_command_undo(Command_t *parent);
static CommandClass_t copy_command_class = { static CommandClass_t copy_command_class = {
NULL, /* copy_command_destruct */ NULL, /* copy_command_destruct */
copy_command_execute, copy_command_execute,
copy_command_undo, copy_command_undo,
NULL /* copy_command_redo */ NULL /* copy_command_redo */
}; };
typedef struct { typedef struct {
@ -58,7 +58,7 @@ copy_command_execute(Command_t *parent)
{ {
CopyCommand_t *command = (CopyCommand_t*) parent; CopyCommand_t *command = (CopyCommand_t*) parent;
command->paste_buffer = object_list_copy(command->paste_buffer, command->paste_buffer = object_list_copy(command->paste_buffer,
get_paste_buffer()); get_paste_buffer());
object_list_copy_to_paste_buffer(command->list); object_list_copy_to_paste_buffer(command->list);
return CMD_APPEND; return CMD_APPEND;
} }

View File

@ -36,12 +36,12 @@ static CommandClass_t copy_object_command_class = {
copy_object_command_destruct, copy_object_command_destruct,
copy_object_command_execute, copy_object_command_execute,
copy_object_command_undo, copy_object_command_undo,
NULL /* copy_object_command_redo */ NULL /* copy_object_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
Object_t *obj; Object_t *obj;
ObjectList_t *paste_buffer; ObjectList_t *paste_buffer;
} CopyObjectCommand_t; } CopyObjectCommand_t;
@ -52,7 +52,7 @@ copy_object_command_new(Object_t *obj)
command->obj = object_ref(obj); command->obj = object_ref(obj);
command->paste_buffer = NULL; command->paste_buffer = NULL;
return command_init(&command->parent, _("Copy"), return command_init(&command->parent, _("Copy"),
&copy_object_command_class); &copy_object_command_class);
} }
static void static void
@ -69,7 +69,7 @@ copy_object_command_execute(Command_t *parent)
ObjectList_t *paste_buffer = get_paste_buffer(); ObjectList_t *paste_buffer = get_paste_buffer();
command->paste_buffer = object_list_copy(command->paste_buffer, command->paste_buffer = object_list_copy(command->paste_buffer,
paste_buffer); paste_buffer);
clear_paste_buffer(); clear_paste_buffer();
object_list_append(paste_buffer, object_clone(command->obj)); object_list_append(paste_buffer, object_clone(command->obj));

View File

@ -38,14 +38,14 @@ static CommandClass_t create_command_class = {
create_command_destruct, create_command_destruct,
create_command_execute, create_command_execute,
create_command_undo, create_command_undo,
NULL /* create_command_redo */ NULL /* create_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
ObjectList_t *list; ObjectList_t *list;
Object_t *obj; Object_t *obj;
gboolean changed; gboolean changed;
} CreateCommand_t; } CreateCommand_t;
Command_t* Command_t*

View File

@ -36,11 +36,11 @@ static CommandClass_t cut_command_class = {
cut_command_destruct, cut_command_destruct,
cut_command_execute, cut_command_execute,
cut_command_undo, cut_command_undo,
NULL /* cut_command_redo */ NULL /* cut_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
ObjectList_t *list; ObjectList_t *list;
ObjectList_t *paste_buffer; ObjectList_t *paste_buffer;
} CutCommand_t; } CutCommand_t;
@ -66,7 +66,7 @@ remove_one_object(Object_t *obj, gpointer data)
{ {
CutCommand_t *command = (CutCommand_t*) data; CutCommand_t *command = (CutCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
delete_command_new(command->list, obj)); delete_command_new(command->list, obj));
} }
static CmdExecuteValue_t static CmdExecuteValue_t
@ -76,7 +76,7 @@ cut_command_execute(Command_t *parent)
gpointer id; gpointer id;
command->paste_buffer = object_list_copy(command->paste_buffer, command->paste_buffer = object_list_copy(command->paste_buffer,
get_paste_buffer()); get_paste_buffer());
id = object_list_add_remove_cb(command->list, remove_one_object, command); id = object_list_add_remove_cb(command->list, remove_one_object, command);
object_list_cut(command->list); object_list_cut(command->list);
object_list_remove_remove_cb(command->list, id); object_list_remove_remove_cb(command->list, id);

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t cut_object_command_execute(Command_t *parent); static CmdExecuteValue_t cut_object_command_execute(Command_t *parent);
static CommandClass_t cut_object_command_class = { static CommandClass_t cut_object_command_class = {
NULL, /* cut_object_command_destruct */ NULL, /* cut_object_command_destruct */
cut_object_command_execute, cut_object_command_execute,
NULL, /* cut_object_command_undo */ NULL, /* cut_object_command_undo */
NULL /* cut_object_command_redo */ NULL /* cut_object_command_redo */
}; };
typedef struct { typedef struct {
@ -48,7 +48,7 @@ cut_object_command_new(Object_t *obj)
Command_t *parent; Command_t *parent;
parent = command_init(&command->parent, _("Cut"), parent = command_init(&command->parent, _("Cut"),
&cut_object_command_class); &cut_object_command_class);
command_add_subcommand(parent, copy_object_command_new(obj)); command_add_subcommand(parent, copy_object_command_new(obj));
command_add_subcommand(parent, delete_command_new(obj->list, obj)); command_add_subcommand(parent, delete_command_new(obj->list, obj));

View File

@ -36,15 +36,15 @@ static CommandClass_t delete_command_class = {
delete_command_destruct, delete_command_destruct,
delete_command_execute, delete_command_execute,
delete_command_undo, delete_command_undo,
NULL /* delete_command_redo */ NULL /* delete_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
ObjectList_t *list; ObjectList_t *list;
Object_t *obj; Object_t *obj;
gint position; gint position;
gboolean changed; gboolean changed;
} DeleteCommand_t; } DeleteCommand_t;
Command_t* Command_t*
@ -54,7 +54,7 @@ delete_command_new(ObjectList_t *list, Object_t *obj)
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, _("Delete"), return command_init(&command->parent, _("Delete"),
&delete_command_class); &delete_command_class);
} }
static void static void

View File

@ -33,18 +33,18 @@ static CmdExecuteValue_t delete_point_command_execute(Command_t *parent);
static void delete_point_command_undo(Command_t *parent); static void delete_point_command_undo(Command_t *parent);
static CommandClass_t delete_point_command_class = { static CommandClass_t delete_point_command_class = {
NULL, /* delete_point_command_destruct */ NULL, /* delete_point_command_destruct */
delete_point_command_execute, delete_point_command_execute,
delete_point_command_undo, delete_point_command_undo,
NULL /* delete_point_command_redo */ NULL /* delete_point_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
Polygon_t *polygon; Polygon_t *polygon;
GdkPoint *point; GdkPoint *point;
GdkPoint copy; GdkPoint copy;
gint position; gint position;
} DeletePointCommand_t; } DeletePointCommand_t;
Command_t* Command_t*
@ -56,9 +56,9 @@ delete_point_command_new(Object_t *obj, GdkPoint *point)
command->point = point; command->point = point;
command->copy = *point; command->copy = *point;
command->position = g_list_index(command->polygon->points, command->position = g_list_index(command->polygon->points,
(gpointer) point); (gpointer) point);
return command_init(&command->parent, _("Delete Point"), return command_init(&command->parent, _("Delete Point"),
&delete_point_command_class); &delete_point_command_class);
} }
static CmdExecuteValue_t static CmdExecuteValue_t
@ -82,5 +82,5 @@ delete_point_command_undo(Command_t *parent)
command->point = new_point(point->x, point->y); command->point = new_point(point->x, point->y);
polygon->points = g_list_insert(polygon->points, (gpointer) command->point, polygon->points = g_list_insert(polygon->points, (gpointer) command->point,
command->position); command->position);
} }

View File

@ -33,7 +33,7 @@ static void edit_object_command_undo(Command_t *parent);
static CommandClass_t edit_object_command_class = { static CommandClass_t edit_object_command_class = {
edit_object_command_destruct, edit_object_command_destruct,
NULL, /* edit_object_command_execute */ NULL, /* edit_object_command_execute */
edit_object_command_undo, edit_object_command_undo,
edit_object_command_undo edit_object_command_undo
}; };
@ -51,7 +51,7 @@ edit_object_command_new(Object_t *obj)
command->obj = object_ref(obj); command->obj = object_ref(obj);
command->copy = object_clone(obj); command->copy = object_clone(obj);
return command_init(&command->parent, _("Edit Object"), return command_init(&command->parent, _("Edit Object"),
&edit_object_command_class); &edit_object_command_class);
} }
static void static void

View File

@ -38,18 +38,18 @@
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
typedef struct { typedef struct {
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
ObjectList_t *list; ObjectList_t *list;
GimpDrawable *drawable; GimpDrawable *drawable;
GtkWidget *alternate; GtkWidget *alternate;
GtkWidget *all; GtkWidget *all;
GtkWidget *left_border; GtkWidget *left_border;
GtkWidget *right_border; GtkWidget *right_border;
GtkWidget *upper_border; GtkWidget *upper_border;
GtkWidget *lower_border; GtkWidget *lower_border;
GtkWidget *url; GtkWidget *url;
} GimpGuidesDialog_t; } GimpGuidesDialog_t;
static gint static gint
@ -80,7 +80,7 @@ gimp_guides_ok_cb(gpointer data)
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->right_border))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->right_border)))
vguides = g_slist_append(vguides, vguides = g_slist_append(vguides,
GINT_TO_POINTER(gimp_image_width(image_ID))); GINT_TO_POINTER(gimp_image_width(image_ID)));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->upper_border))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->upper_border)))
hguides = g_slist_append(NULL, GINT_TO_POINTER(0)); hguides = g_slist_append(NULL, GINT_TO_POINTER(0));
@ -89,7 +89,7 @@ gimp_guides_ok_cb(gpointer data)
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->lower_border))) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(param->lower_border)))
hguides = g_slist_append(hguides, hguides = g_slist_append(hguides,
GINT_TO_POINTER(gimp_image_height(image_ID))); GINT_TO_POINTER(gimp_image_height(image_ID)));
url = gtk_entry_get_text(GTK_ENTRY(param->url)); url = gtk_entry_get_text(GTK_ENTRY(param->url));
@ -101,12 +101,12 @@ gimp_guides_ok_cb(gpointer data)
gint position = gimp_image_get_guide_position(image_ID, guide_num); gint position = gimp_image_get_guide_position(image_ID, guide_num);
if (gimp_image_get_guide_orientation(image_ID, guide_num) if (gimp_image_get_guide_orientation(image_ID, guide_num)
== GIMP_ORIENTATION_HORIZONTAL) { == GIMP_ORIENTATION_HORIZONTAL) {
hguides = g_slist_insert_sorted(hguides, GINT_TO_POINTER(position), hguides = g_slist_insert_sorted(hguides, GINT_TO_POINTER(position),
guide_sort_func); guide_sort_func);
} else { /* GIMP_ORIENTATION_VERTICAL */ } else { /* GIMP_ORIENTATION_VERTICAL */
vguides = g_slist_insert_sorted(vguides, GINT_TO_POINTER(position), vguides = g_slist_insert_sorted(vguides, GINT_TO_POINTER(position),
guide_sort_func); guide_sort_func);
} }
guide_num = gimp_image_find_next_guide(image_ID, guide_num); guide_num = gimp_image_find_next_guide(image_ID, guide_num);
} }
@ -116,18 +116,18 @@ gimp_guides_ok_cb(gpointer data)
subcommand_start(_("Use Gimp Guides")); subcommand_start(_("Use Gimp Guides"));
for (hg = hguides; hg && hg->next; for (hg = hguides; hg && hg->next;
hg = (all) ? hg->next : hg->next->next) { hg = (all) ? hg->next : hg->next->next) {
gint y = GPOINTER_TO_INT(hg->data); gint y = GPOINTER_TO_INT(hg->data);
gint height = GPOINTER_TO_INT(hg->next->data) - y; gint height = GPOINTER_TO_INT(hg->next->data) - y;
for (vg = vguides; vg && vg->next; for (vg = vguides; vg && vg->next;
vg = (all) ? vg->next : vg->next->next) { vg = (all) ? vg->next : vg->next->next) {
gint x = GPOINTER_TO_INT(vg->data); gint x = GPOINTER_TO_INT(vg->data);
gint width = GPOINTER_TO_INT(vg->next->data) - x; gint width = GPOINTER_TO_INT(vg->next->data) - x;
Object_t *obj = create_rectangle(x, y, width, height); Object_t *obj = create_rectangle(x, y, width, height);
Command_t *command = create_command_new(param->list, obj); Command_t *command = create_command_new(param->list, obj);
object_set_url(obj, url); object_set_url(obj, url);
command_execute(command); command_execute(command);
} }
} }
@ -208,7 +208,7 @@ make_gimp_guides_dialog(void)
static void static void
init_gimp_guides_dialog(GimpGuidesDialog_t *dialog, ObjectList_t *list, init_gimp_guides_dialog(GimpGuidesDialog_t *dialog, ObjectList_t *list,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
dialog->list = list; dialog->list = list;
dialog->drawable = drawable; dialog->drawable = drawable;
@ -229,10 +229,10 @@ do_create_gimp_guides_dialog(ObjectList_t *list, GimpDrawable *drawable)
static CmdExecuteValue_t gimp_guides_command_execute(Command_t *parent); static CmdExecuteValue_t gimp_guides_command_execute(Command_t *parent);
static CommandClass_t gimp_guides_command_class = { static CommandClass_t gimp_guides_command_class = {
NULL, /* guides_command_destruct */ NULL, /* guides_command_destruct */
gimp_guides_command_execute, gimp_guides_command_execute,
NULL, /* guides_command_undo */ NULL, /* guides_command_undo */
NULL /* guides_command_redo */ NULL /* guides_command_redo */
}; };
typedef struct { typedef struct {
@ -248,7 +248,7 @@ gimp_guides_command_new(ObjectList_t *list, GimpDrawable *drawable)
command->list = list; command->list = list;
command->drawable = drawable; command->drawable = drawable;
return command_init(&command->parent, _("Use Gimp Guides"), return command_init(&command->parent, _("Use Gimp Guides"),
&gimp_guides_command_class); &gimp_guides_command_class);
} }
static CmdExecuteValue_t static CmdExecuteValue_t

View File

@ -35,20 +35,20 @@
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
typedef struct { typedef struct {
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
GtkWidget *image_dimensions; GtkWidget *image_dimensions;
GtkWidget *guide_bounds; GtkWidget *guide_bounds;
GtkWidget *width; GtkWidget *width;
GtkWidget *height; GtkWidget *height;
GtkWidget *left; GtkWidget *left;
GtkWidget *top; GtkWidget *top;
GtkWidget *horz_spacing; GtkWidget *horz_spacing;
GtkWidget *vert_spacing; GtkWidget *vert_spacing;
GtkWidget *no_across; GtkWidget *no_across;
GtkWidget *no_down; GtkWidget *no_down;
GtkWidget *base_url; GtkWidget *base_url;
ObjectList_t *list; ObjectList_t *list;
} GuidesDialog_t; } GuidesDialog_t;
static void static void
@ -75,12 +75,12 @@ guides_ok_cb(gpointer data)
for (i = 0; i < rows; i++) { for (i = 0; i < rows; i++) {
gint x = left; gint x = left;
for (j = 0; j < cols; j++) { for (j = 0; j < cols; j++) {
Object_t *obj = create_rectangle(x, y, width, height); Object_t *obj = create_rectangle(x, y, width, height);
Command_t *command = create_command_new(param->list, obj); Command_t *command = create_command_new(param->list, obj);
object_set_url(obj, gtk_entry_get_text(GTK_ENTRY(param->base_url))); object_set_url(obj, gtk_entry_get_text(GTK_ENTRY(param->base_url)));
command_execute(command); command_execute(command);
x += width + hspace; x += width + hspace;
} }
y += height + vspace; y += height + vspace;
} }
@ -110,7 +110,7 @@ recalc_bounds(GtkWidget *widget, gpointer data)
bound_h = (height + vspace) * rows - vspace; bound_h = (height + vspace) * rows - vspace;
bounds = g_strdup_printf (_("Resulting Guide Bounds: %d,%d to %d,%d (%d areas)"), bounds = g_strdup_printf (_("Resulting Guide Bounds: %d,%d to %d,%d (%d areas)"),
left, top, left + bound_w, top + bound_h, rows * cols); left, top, left + bound_w, top + bound_h, rows * cols);
if (left + bound_w > get_image_width() || if (left + bound_w > get_image_width() ||
top + bound_h > get_image_height()) top + bound_h > get_image_height())
{ {
@ -141,9 +141,9 @@ make_guides_dialog (void)
hbox = gimp_hint_box_new ( hbox = gimp_hint_box_new (
_("Guides are pre-defined rectangles covering the image. You define " _("Guides are pre-defined rectangles covering the image. You define "
"them by their width, height, and spacing from each other. This " "them by their width, height, and spacing from each other. This "
"allows you to rapidly create the most common image map type - " "allows you to rapidly create the most common image map type - "
"image collection of \"thumbnails\", suitable for navigation bars.")); "image collection of \"thumbnails\", suitable for navigation bars."));
gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox); gtk_widget_show (hbox);
@ -189,13 +189,13 @@ make_guides_dialog (void)
label = create_label_in_table(table, 2, 2, _("_No. across:")); label = create_label_in_table(table, 2, 2, _("_No. across:"));
data->no_across = create_spin_button_in_table(table, label, 2, 3, 0, 0, data->no_across = create_spin_button_in_table(table, label, 2, 3, 0, 0,
100); 100);
g_signal_connect (data->no_across, "changed", g_signal_connect (data->no_across, "changed",
G_CALLBACK(recalc_bounds), (gpointer) data); G_CALLBACK(recalc_bounds), (gpointer) data);
label = create_label_in_table(table, 3, 0, _("_Vert. spacing:")); label = create_label_in_table(table, 3, 0, _("_Vert. spacing:"));
data->vert_spacing = create_spin_button_in_table(table, label, 3, 1, 0, 0, data->vert_spacing = create_spin_button_in_table(table, label, 3, 1, 0, 0,
100); 100);
g_signal_connect (data->vert_spacing, "changed", g_signal_connect (data->vert_spacing, "changed",
G_CALLBACK(recalc_bounds), (gpointer) data); G_CALLBACK(recalc_bounds), (gpointer) data);
@ -252,10 +252,10 @@ do_create_guides_dialog_local (ObjectList_t *list)
static CmdExecuteValue_t guides_command_execute(Command_t *parent); static CmdExecuteValue_t guides_command_execute(Command_t *parent);
static CommandClass_t guides_command_class = { static CommandClass_t guides_command_class = {
NULL, /* guides_command_destruct */ NULL, /* guides_command_destruct */
guides_command_execute, guides_command_execute,
NULL, /* guides_command_undo */ NULL, /* guides_command_undo */
NULL /* guides_command_redo */ NULL /* guides_command_redo */
}; };
typedef struct { typedef struct {

View File

@ -34,19 +34,19 @@ static CmdExecuteValue_t insert_point_command_execute(Command_t *parent);
static void insert_point_command_undo(Command_t *parent); static void insert_point_command_undo(Command_t *parent);
static CommandClass_t insert_point_command_class = { static CommandClass_t insert_point_command_class = {
NULL, /* insert_point_command_destruct */ NULL, /* insert_point_command_destruct */
insert_point_command_execute, insert_point_command_execute,
insert_point_command_undo, insert_point_command_undo,
NULL /* insert_point_command_redo */ NULL /* insert_point_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
Polygon_t *polygon; Polygon_t *polygon;
gint x; gint x;
gint y; gint y;
gint edge; gint edge;
gint position; gint position;
} InsertPointCommand_t; } InsertPointCommand_t;
Command_t* Command_t*
@ -59,7 +59,7 @@ insert_point_command_new(Object_t *obj, gint x, gint y, gint edge)
command->y = y; command->y = y;
command->edge = edge; command->edge = edge;
return command_init(&command->parent, _("Insert Point"), return command_init(&command->parent, _("Insert Point"),
&insert_point_command_class); &insert_point_command_class);
} }
static CmdExecuteValue_t static CmdExecuteValue_t
@ -75,7 +75,7 @@ insert_point_command_execute(Command_t *parent)
command->position = command->edge - 1; command->position = command->edge - 1;
} else { } else {
polygon->points = g_list_insert(polygon->points, (gpointer) point, polygon->points = g_list_insert(polygon->points, (gpointer) point,
command->edge); command->edge);
command->position = command->edge; command->position = command->edge;
} }
redraw_preview(); redraw_preview();
@ -92,5 +92,5 @@ insert_point_command_undo(Command_t *parent)
g_free(p->data); g_free(p->data);
polygon->points = g_list_remove_link(polygon->points, p); polygon->points = g_list_remove_link(polygon->points, p);
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
} }

View File

@ -37,8 +37,8 @@ static CmdExecuteValue_t move_command_execute(Command_t *parent);
static CommandClass_t move_command_class = { static CommandClass_t move_command_class = {
move_command_destruct, move_command_destruct,
move_command_execute, move_command_execute,
NULL, /* move_command_undo */ NULL, /* move_command_undo */
NULL /* move_command_redo */ NULL /* move_command_redo */
}; };
typedef struct { typedef struct {
@ -58,7 +58,7 @@ typedef struct {
gint image_width; gint image_width;
gint image_height; gint image_height;
GdkCursorType cursor; /* Remember previous cursor */ GdkCursorType cursor; /* Remember previous cursor */
gboolean moved_first_time; gboolean moved_first_time;
} MoveCommand_t; } MoveCommand_t;
@ -73,7 +73,7 @@ move_command_new(Preview_t *preview, Object_t *obj, gint x, gint y)
command->start_x = x; command->start_x = x;
command->start_y = y; command->start_y = y;
object_get_dimensions(obj, &command->obj_x, &command->obj_y, object_get_dimensions(obj, &command->obj_x, &command->obj_y,
&command->obj_width, &command->obj_height); &command->obj_width, &command->obj_height);
command->obj_start_x = command->obj_x; command->obj_start_x = command->obj_x;
command->obj_start_y = command->obj_y; command->obj_start_y = command->obj_y;
@ -149,7 +149,7 @@ button_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
command->obj_y -= command->obj_start_y; command->obj_y -= command->obj_start_y;
if (command->obj_x || command->obj_y) if (command->obj_x || command->obj_y)
command_list_add(object_move_command_new(command->obj, command->obj_x, command_list_add(object_move_command_new(command->obj, command->obj_x,
command->obj_y)); command->obj_y));
/* preview_thaw(); */ /* preview_thaw(); */
} }

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t move_down_command_execute(Command_t *parent); static CmdExecuteValue_t move_down_command_execute(Command_t *parent);
static CommandClass_t move_down_command_class = { static CommandClass_t move_down_command_class = {
NULL, /* move_down_command_destruct */ NULL, /* move_down_command_destruct */
move_down_command_execute, move_down_command_execute,
NULL, /* move_down_command_undo */ NULL, /* move_down_command_undo */
NULL /* move_down_command_redo */ NULL /* move_down_command_redo */
}; };
typedef struct { typedef struct {
@ -50,7 +50,7 @@ move_down_command_new(ObjectList_t *list)
command->list = list; command->list = list;
command->add = FALSE; command->add = FALSE;
return command_init(&command->parent, _("Move Down"), return command_init(&command->parent, _("Move Down"),
&move_down_command_class); &move_down_command_class);
} }
static void static void
@ -60,7 +60,7 @@ move_down_one_object(Object_t *obj, gpointer data)
if (command->add) { if (command->add) {
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
object_down_command_new(command->list, obj)); object_down_command_new(command->list, obj));
command->add = FALSE; command->add = FALSE;
} }
else { else {

View File

@ -40,19 +40,19 @@ static CommandClass_t move_sash_command_class = {
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
GtkWidget *widget; GtkWidget *widget;
Object_t *obj; Object_t *obj;
gint x; gint x;
gint y; gint y;
gint image_width; gint image_width;
gint image_height; gint image_height;
MoveSashFunc_t sash_func; MoveSashFunc_t sash_func;
} MoveSashCommand_t; } MoveSashCommand_t;
Command_t* Command_t*
move_sash_command_new(GtkWidget *widget, Object_t *obj, move_sash_command_new(GtkWidget *widget, Object_t *obj,
gint x, gint y, MoveSashFunc_t sash_func) gint x, gint y, MoveSashFunc_t sash_func)
{ {
MoveSashCommand_t *command = g_new(MoveSashCommand_t, 1); MoveSashCommand_t *command = g_new(MoveSashCommand_t, 1);
Command_t *parent; Command_t *parent;
@ -66,7 +66,7 @@ move_sash_command_new(GtkWidget *widget, Object_t *obj,
command->sash_func = sash_func; command->sash_func = sash_func;
parent = command_init(&command->parent, _("Move Sash"), parent = command_init(&command->parent, _("Move Sash"),
&move_sash_command_class); &move_sash_command_class);
command_add_subcommand(parent, edit_object_command_new(obj)); command_add_subcommand(parent, edit_object_command_new(obj));
return parent; return parent;

View File

@ -32,10 +32,10 @@ static CmdExecuteValue_t move_selected_command_execute(Command_t *parent);
static void move_selected_command_undo(Command_t *parent); static void move_selected_command_undo(Command_t *parent);
static CommandClass_t move_selected_command_class = { static CommandClass_t move_selected_command_class = {
NULL, /* move_selected_command_destruct */ NULL, /* move_selected_command_destruct */
move_selected_command_execute, move_selected_command_execute,
move_selected_command_undo, move_selected_command_undo,
NULL /* move_selected_command_redo */ NULL /* move_selected_command_redo */
}; };
typedef struct { typedef struct {
@ -53,7 +53,7 @@ move_selected_command_new(ObjectList_t *list, gint dx, gint dy)
command->dx = dx; command->dx = dx;
command->dy = dy; command->dy = dy;
return command_init(&command->parent, _("Move Selected Objects"), return command_init(&command->parent, _("Move Selected Objects"),
&move_selected_command_class); &move_selected_command_class);
} }
static CmdExecuteValue_t static CmdExecuteValue_t

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t move_to_front_command_execute(Command_t *parent); static CmdExecuteValue_t move_to_front_command_execute(Command_t *parent);
static CommandClass_t move_to_front_command_class = { static CommandClass_t move_to_front_command_class = {
NULL, /* move_to_front_command_destruct, */ NULL, /* move_to_front_command_destruct, */
move_to_front_command_execute, move_to_front_command_execute,
NULL, /* move_to_front_command_undo */ NULL, /* move_to_front_command_undo */
NULL /* move_to_front_command_redo */ NULL /* move_to_front_command_redo */
}; };
typedef struct { typedef struct {
@ -48,7 +48,7 @@ move_to_front_command_new(ObjectList_t *list)
MoveToFrontCommand_t *command = g_new(MoveToFrontCommand_t, 1); MoveToFrontCommand_t *command = g_new(MoveToFrontCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, _("Move To Front"), return command_init(&command->parent, _("Move To Front"),
&move_to_front_command_class); &move_to_front_command_class);
} }
static void static void
@ -56,7 +56,7 @@ remove_one_object(Object_t *obj, gpointer data)
{ {
MoveToFrontCommand_t *command = (MoveToFrontCommand_t*) data; MoveToFrontCommand_t *command = (MoveToFrontCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
delete_command_new(command->list, obj)); delete_command_new(command->list, obj));
} }
static void static void
@ -64,7 +64,7 @@ add_one_object(Object_t *obj, gpointer data)
{ {
MoveToFrontCommand_t *command = (MoveToFrontCommand_t*) data; MoveToFrontCommand_t *command = (MoveToFrontCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
create_command_new(command->list, obj)); create_command_new(command->list, obj));
} }
static CmdExecuteValue_t static CmdExecuteValue_t

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t move_up_command_execute(Command_t *parent); static CmdExecuteValue_t move_up_command_execute(Command_t *parent);
static CommandClass_t move_up_command_class = { static CommandClass_t move_up_command_class = {
NULL, /* move_up_command_destruct */ NULL, /* move_up_command_destruct */
move_up_command_execute, move_up_command_execute,
NULL, /* move_up_command_undo */ NULL, /* move_up_command_undo */
NULL /* move_up_command_redo */ NULL /* move_up_command_redo */
}; };
typedef struct { typedef struct {
@ -59,7 +59,7 @@ move_up_one_object(Object_t *obj, gpointer data)
if (command->add) { if (command->add) {
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
object_up_command_new(command->list, obj)); object_up_command_new(command->list, obj));
command->add = FALSE; command->add = FALSE;
} }
else { else {

View File

@ -36,7 +36,7 @@ static CommandClass_t object_down_command_class = {
object_down_command_destruct, object_down_command_destruct,
object_down_command_execute, object_down_command_execute,
object_down_command_undo, object_down_command_undo,
NULL /* object_down_command_redo */ NULL /* object_down_command_redo */
}; };
typedef struct { typedef struct {
@ -52,7 +52,7 @@ object_down_command_new(ObjectList_t *list, Object_t *obj)
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, _("Move Down"), return command_init(&command->parent, _("Move Down"),
&object_down_command_class); &object_down_command_class);
} }
static void static void

View File

@ -36,7 +36,7 @@ static CommandClass_t object_move_command_class = {
object_move_command_destruct, object_move_command_destruct,
object_move_command_execute, object_move_command_execute,
object_move_command_undo, object_move_command_undo,
NULL /* object_move_command_redo */ NULL /* object_move_command_redo */
}; };
typedef struct { typedef struct {
@ -54,7 +54,7 @@ object_move_command_new(Object_t *obj, gint dx, gint dy)
command->dx = dx; command->dx = dx;
command->dy = dy; command->dy = dy;
return command_init(&command->parent, _("Move"), return command_init(&command->parent, _("Move"),
&object_move_command_class); &object_move_command_class);
} }
static void static void

View File

@ -36,7 +36,7 @@ static CommandClass_t object_up_command_class = {
object_up_command_destruct, object_up_command_destruct,
object_up_command_execute, object_up_command_execute,
object_up_command_undo, object_up_command_undo,
NULL /* object_up_command_redo */ NULL /* object_up_command_redo */
}; };
typedef struct { typedef struct {
@ -52,7 +52,7 @@ object_up_command_new(ObjectList_t *list, Object_t *obj)
command->list = list; command->list = list;
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, _("Move Up"), return command_init(&command->parent, _("Move Up"),
&object_up_command_class); &object_up_command_class);
} }
static void static void

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t paste_command_execute(Command_t *parent); static CmdExecuteValue_t paste_command_execute(Command_t *parent);
static CommandClass_t paste_command_class = { static CommandClass_t paste_command_class = {
NULL, /* paste_command_destruct, */ NULL, /* paste_command_destruct, */
paste_command_execute, paste_command_execute,
NULL, /* paste_command_undo */ NULL, /* paste_command_undo */
NULL /* paste_command_redo */ NULL /* paste_command_redo */
}; };
typedef struct { typedef struct {
@ -55,7 +55,7 @@ paste_one_object(Object_t *obj, gpointer data)
{ {
PasteCommand_t *command = (PasteCommand_t*) data; PasteCommand_t *command = (PasteCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
create_command_new(command->list, obj)); create_command_new(command->list, obj));
} }
static CmdExecuteValue_t static CmdExecuteValue_t

View File

@ -36,7 +36,7 @@ static CommandClass_t select_command_class = {
select_command_destruct, select_command_destruct,
select_command_execute, select_command_execute,
select_command_undo, select_command_undo,
NULL /* select_command_redo */ NULL /* select_command_redo */
}; };
typedef struct { typedef struct {

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t select_all_command_execute(Command_t *parent); static CmdExecuteValue_t select_all_command_execute(Command_t *parent);
static CommandClass_t select_all_command_class = { static CommandClass_t select_all_command_class = {
NULL, /* select_all_command_destruct, */ NULL, /* select_all_command_destruct, */
select_all_command_execute, select_all_command_execute,
NULL, /* select_all_command_undo */ NULL, /* select_all_command_undo */
NULL /* select_all_command_redo */ NULL /* select_all_command_redo */
}; };
typedef struct { typedef struct {
@ -48,7 +48,7 @@ select_all_command_new(ObjectList_t *list)
SelectAllCommand_t *command = g_new(SelectAllCommand_t, 1); SelectAllCommand_t *command = g_new(SelectAllCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, _("Select All"), return command_init(&command->parent, _("Select All"),
&select_all_command_class); &select_all_command_class);
} }
static void static void

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t select_next_command_execute(Command_t *parent); static CmdExecuteValue_t select_next_command_execute(Command_t *parent);
static CommandClass_t select_next_command_class = { static CommandClass_t select_next_command_class = {
NULL, /* select_next_command_destruct */ NULL, /* select_next_command_destruct */
select_next_command_execute, select_next_command_execute,
NULL, /* select_next_command_undo */ NULL, /* select_next_command_undo */
NULL /* select_next_command_redo */ NULL /* select_next_command_redo */
}; };
typedef struct { typedef struct {
@ -48,7 +48,7 @@ select_next_command_new(ObjectList_t *list)
SelectNextCommand_t *command = g_new(SelectNextCommand_t, 1); SelectNextCommand_t *command = g_new(SelectNextCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, _("Select Next"), return command_init(&command->parent, _("Select Next"),
&select_next_command_class); &select_next_command_class);
} }
static void static void

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t select_prev_command_execute(Command_t *parent); static CmdExecuteValue_t select_prev_command_execute(Command_t *parent);
static CommandClass_t select_prev_command_class = { static CommandClass_t select_prev_command_class = {
NULL, /* select_prev_command_destruct */ NULL, /* select_prev_command_destruct */
select_prev_command_execute, select_prev_command_execute,
NULL, /* select_prev_command_undo */ NULL, /* select_prev_command_undo */
NULL /* select_prev_command_redo */ NULL /* select_prev_command_redo */
}; };
typedef struct { typedef struct {
@ -48,7 +48,7 @@ select_prev_command_new(ObjectList_t *list)
SelectPrevCommand_t *command = g_new(SelectPrevCommand_t, 1); SelectPrevCommand_t *command = g_new(SelectPrevCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, _("Select Previous"), return command_init(&command->parent, _("Select Previous"),
&select_prev_command_class); &select_prev_command_class);
} }
static void static void

View File

@ -33,25 +33,25 @@
static CmdExecuteValue_t select_region_command_execute(Command_t *parent); static CmdExecuteValue_t select_region_command_execute(Command_t *parent);
static CommandClass_t select_region_command_class = { static CommandClass_t select_region_command_class = {
NULL, /* select_region_command_destruct, */ NULL, /* select_region_command_destruct, */
select_region_command_execute, select_region_command_execute,
NULL, /* select_region_command_undo */ NULL, /* select_region_command_undo */
NULL /* select_region_command_redo */ NULL /* select_region_command_redo */
}; };
typedef struct { typedef struct {
Command_t parent; Command_t parent;
GtkWidget *widget; GtkWidget *widget;
ObjectList_t *list; ObjectList_t *list;
gint x; gint x;
gint y; gint y;
Object_t *obj; Object_t *obj;
Command_t *unselect_command; Command_t *unselect_command;
} SelectRegionCommand_t; } SelectRegionCommand_t;
Command_t* Command_t*
select_region_command_new(GtkWidget *widget, ObjectList_t *list, gint x, select_region_command_new(GtkWidget *widget, ObjectList_t *list, gint x,
gint y) gint y)
{ {
SelectRegionCommand_t *command = g_new(SelectRegionCommand_t, 1); SelectRegionCommand_t *command = g_new(SelectRegionCommand_t, 1);
Command_t *sub_command; Command_t *sub_command;
@ -61,7 +61,7 @@ select_region_command_new(GtkWidget *widget, ObjectList_t *list, gint x,
command->x = x; command->x = x;
command->y = y; command->y = y;
(void) command_init(&command->parent, _("Select Region"), (void) command_init(&command->parent, _("Select Region"),
&select_region_command_class); &select_region_command_class);
sub_command = unselect_all_command_new(list, NULL); sub_command = unselect_all_command_new(list, NULL);
command_add_subcommand(&command->parent, sub_command); command_add_subcommand(&command->parent, sub_command);
@ -112,14 +112,14 @@ select_release(GtkWidget *widget, GdkEventButton *event, gpointer data)
id = object_list_add_select_cb(command->list, select_one_object, command); id = object_list_add_select_cb(command->list, select_one_object, command);
count = object_list_select_region(command->list, rectangle->x, rectangle->y, count = object_list_select_region(command->list, rectangle->x, rectangle->y,
rectangle->width, rectangle->height); rectangle->width, rectangle->height);
object_list_remove_select_cb(command->list, id); object_list_remove_select_cb(command->list, id);
if (count) { if (count) {
command_list_add(&command->parent); command_list_add(&command->parent);
} else { /* Nothing selected */ } else { /* Nothing selected */
if (command->unselect_command->sub_commands) if (command->unselect_command->sub_commands)
command_list_add(&command->parent); command_list_add(&command->parent);
} }
object_unref(obj); object_unref(obj);
} }

View File

@ -31,10 +31,10 @@
static CmdExecuteValue_t send_to_back_command_execute(Command_t *parent); static CmdExecuteValue_t send_to_back_command_execute(Command_t *parent);
static CommandClass_t send_to_back_command_class = { static CommandClass_t send_to_back_command_class = {
NULL, /* send_to_back_command_destruct, */ NULL, /* send_to_back_command_destruct, */
send_to_back_command_execute, send_to_back_command_execute,
NULL, /* send_to_back_command_undo */ NULL, /* send_to_back_command_undo */
NULL /* send_to_back_command_redo */ NULL /* send_to_back_command_redo */
}; };
typedef struct { typedef struct {
@ -48,7 +48,7 @@ send_to_back_command_new(ObjectList_t *list)
SendToBackCommand_t *command = g_new(SendToBackCommand_t, 1); SendToBackCommand_t *command = g_new(SendToBackCommand_t, 1);
command->list = list; command->list = list;
return command_init(&command->parent, _("Send To Back"), return command_init(&command->parent, _("Send To Back"),
&send_to_back_command_class); &send_to_back_command_class);
} }
static void static void
@ -56,7 +56,7 @@ remove_one_object(Object_t *obj, gpointer data)
{ {
SendToBackCommand_t *command = (SendToBackCommand_t*) data; SendToBackCommand_t *command = (SendToBackCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
delete_command_new(command->list, obj)); delete_command_new(command->list, obj));
} }
static void static void
@ -64,7 +64,7 @@ add_one_object(Object_t *obj, gpointer data)
{ {
SendToBackCommand_t *command = (SendToBackCommand_t*) data; SendToBackCommand_t *command = (SendToBackCommand_t*) data;
command_add_subcommand(&command->parent, command_add_subcommand(&command->parent,
create_command_new(command->list, obj)); create_command_new(command->list, obj));
} }
static CmdExecuteValue_t static CmdExecuteValue_t

View File

@ -36,7 +36,7 @@ static CommandClass_t unselect_command_class = {
unselect_command_destruct, unselect_command_destruct,
unselect_command_execute, unselect_command_execute,
unselect_command_undo, unselect_command_undo,
NULL /* unselect_command_redo */ NULL /* unselect_command_redo */
}; };
typedef struct { typedef struct {
@ -50,7 +50,7 @@ unselect_command_new(Object_t *obj)
UnselectCommand_t *command = g_new(UnselectCommand_t, 1); UnselectCommand_t *command = g_new(UnselectCommand_t, 1);
command->obj = object_ref(obj); command->obj = object_ref(obj);
return command_init(&command->parent, _("Unselect"), return command_init(&command->parent, _("Unselect"),
&unselect_command_class); &unselect_command_class);
} }
static void static void

View File

@ -36,8 +36,8 @@ static CmdExecuteValue_t unselect_all_command_execute(Command_t *command);
static CommandClass_t unselect_all_command_class = { static CommandClass_t unselect_all_command_class = {
unselect_all_command_destruct, unselect_all_command_destruct,
unselect_all_command_execute, unselect_all_command_execute,
NULL, /* unselect_all_command_undo */ NULL, /* unselect_all_command_undo */
NULL /* unselect_all_command_redo */ NULL /* unselect_all_command_redo */
}; };
typedef struct { typedef struct {
@ -53,7 +53,7 @@ unselect_all_command_new(ObjectList_t *list, Object_t *exception)
command->list = list; command->list = list;
command->exception = (exception) ? object_ref(exception) : exception; command->exception = (exception) ? object_ref(exception) : exception;
return command_init(&command->parent, _("Unselect All"), return command_init(&command->parent, _("Unselect All"),
&unselect_all_command_class); &unselect_all_command_class);
} }
static void static void
@ -79,7 +79,7 @@ unselect_all_command_execute(Command_t *parent)
CmdExecuteValue_t rvalue; CmdExecuteValue_t rvalue;
id = object_list_add_select_cb(command->list, select_one_object, id = object_list_add_select_cb(command->list, select_one_object,
command); command);
if (object_list_deselect_all(command->list, command->exception)) { if (object_list_deselect_all(command->list, command->exception)) {
rvalue = CMD_APPEND; rvalue = CMD_APPEND;
} else { } else {

View File

@ -37,7 +37,7 @@ static CommandList_t *_current_command_list = &_command_list;
static void static void
command_list_callback_add(CommandListCallback_t *list, command_list_callback_add(CommandListCallback_t *list,
CommandListCallbackFunc_t func, gpointer data) CommandListCallbackFunc_t func, gpointer data)
{ {
CommandListCB_t *cb = g_new(CommandListCB_t, 1); CommandListCB_t *cb = g_new(CommandListCB_t, 1);
cb->func = func; cb->func = func;
@ -133,10 +133,10 @@ subcommand_list_add(CommandList_t *list, Command_t *command)
} }
static CommandClass_t parent_command_class = { static CommandClass_t parent_command_class = {
NULL, /* parent_command_destruct */ NULL, /* parent_command_destruct */
NULL, /* parent_command_execute */ NULL, /* parent_command_execute */
NULL, /* parent_command_undo */ NULL, /* parent_command_undo */
NULL /* parent_command_redo */ NULL /* parent_command_redo */
}; };
static Command_t* static Command_t*
@ -179,22 +179,22 @@ _command_list_set_undo_level(CommandList_t *list, gint level)
GList *p, *q; GList *p, *q;
/* first remove data at the front */ /* first remove data at the front */
for (p = list->list; diff && p != list->undo; p = q, diff--) { for (p = list->list; diff && p != list->undo; p = q, diff--) {
Command_t *curr = (Command_t*) p->data; Command_t *curr = (Command_t*) p->data;
q = p->next; q = p->next;
command_destruct(curr); command_destruct(curr);
list->list = g_list_remove_link(list->list, p); list->list = g_list_remove_link(list->list, p);
} }
/* If still to long start removing redo levels at the end */ /* If still to long start removing redo levels at the end */
for (p = g_list_last(list->list); diff && p != list->undo; p = q, for (p = g_list_last(list->list); diff && p != list->undo; p = q,
diff--) { diff--) {
Command_t *curr = (Command_t*) p->data; Command_t *curr = (Command_t*) p->data;
q = p->prev; q = p->prev;
command_destruct(curr); command_destruct(curr);
list->list = g_list_remove_link(list->list, p); list->list = g_list_remove_link(list->list, p);
} }
command_list_callback_call(&list->update_cb, command_list_callback_call(&list->update_cb,
(Command_t*) list->undo->data); (Command_t*) list->undo->data);
} }
list->undo_levels = level; list->undo_levels = level;
} }
@ -233,9 +233,9 @@ command_list_execute(CommandList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Command_t *command = (Command_t*) p->data; Command_t *command = (Command_t*) p->data;
if (command->sub_commands) if (command->sub_commands)
command_list_execute(command->sub_commands); command_list_execute(command->sub_commands);
if (command->class->execute) if (command->class->execute)
(void) command->class->execute(command); (void) command->class->execute(command);
} }
} }
@ -246,13 +246,13 @@ command_execute(Command_t *command)
command->locked = FALSE; command->locked = FALSE;
} else { } else {
if (command->sub_commands) if (command->sub_commands)
command_list_execute(command->sub_commands); command_list_execute(command->sub_commands);
if (command->class->execute) { if (command->class->execute) {
CmdExecuteValue_t value = command->class->execute(command); CmdExecuteValue_t value = command->class->execute(command);
if (value == CMD_APPEND) if (value == CMD_APPEND)
command_list_add(command); command_list_add(command);
else if (value == CMD_DESTRUCT) else if (value == CMD_DESTRUCT)
command_destruct(command); command_destruct(command);
} }
} }
} }
@ -357,10 +357,10 @@ command_add_subcommand(Command_t *command, Command_t *sub_command)
static CmdExecuteValue_t basic_command_execute(Command_t *command); static CmdExecuteValue_t basic_command_execute(Command_t *command);
static CommandClass_t basic_command_class = { static CommandClass_t basic_command_class = {
NULL, /* basic_command_destruct */ NULL, /* basic_command_destruct */
basic_command_execute, basic_command_execute,
NULL, NULL,
NULL /* basic_command_redo */ NULL /* basic_command_redo */
}; };
typedef struct { typedef struct {

View File

@ -43,8 +43,8 @@ struct CommandClass_t {
struct Command_t { struct Command_t {
CommandClass_t *class; CommandClass_t *class;
CommandList_t *sub_commands; CommandList_t *sub_commands;
const gchar *name; const gchar *name;
gboolean locked; gboolean locked;
}; };
@ -65,8 +65,8 @@ struct CommandList_t {
CommandList_t *parent; CommandList_t *parent;
gint undo_levels; gint undo_levels;
GList *list; GList *list;
GList *undo; /* Pointer to current undo command */ GList *undo; /* Pointer to current undo command */
GList *redo; /* Pointer to current redo command */ GList *redo; /* Pointer to current redo command */
CommandListCallback_t update_cb; CommandListCallback_t update_cb;
}; };
@ -84,7 +84,7 @@ Command_t *command_list_get_redo_command(void);
Command_t *command_new(void (*func)(void)); Command_t *command_new(void (*func)(void));
Command_t *command_init(Command_t *command, const gchar *name, Command_t *command_init(Command_t *command, const gchar *name,
CommandClass_t *class); CommandClass_t *class);
void command_execute(Command_t *command); void command_execute(Command_t *command);
void command_undo(Command_t *command); void command_undo(Command_t *command);
void command_redo(Command_t *command); void command_redo(Command_t *command);

View File

@ -37,13 +37,13 @@ Command_t *delete_command_new(ObjectList_t *list, Object_t *obj);
Command_t *delete_point_command_new(Object_t *obj, GdkPoint *point); Command_t *delete_point_command_new(Object_t *obj, GdkPoint *point);
Command_t *edit_object_command_new(Object_t *obj); Command_t *edit_object_command_new(Object_t *obj);
Command_t *gimp_guides_command_new(ObjectList_t *list, Command_t *gimp_guides_command_new(ObjectList_t *list,
GimpDrawable *_drawable); GimpDrawable *_drawable);
Command_t *guides_command_new(ObjectList_t *list); Command_t *guides_command_new(ObjectList_t *list);
Command_t *insert_point_command_new(Object_t *obj, gint x, gint y, gint edge); Command_t *insert_point_command_new(Object_t *obj, gint x, gint y, gint edge);
Command_t *move_down_command_new(ObjectList_t *list); Command_t *move_down_command_new(ObjectList_t *list);
Command_t *move_command_new(Preview_t *preview, Object_t *obj, gint x, gint y); Command_t *move_command_new(Preview_t *preview, Object_t *obj, gint x, gint y);
Command_t *move_sash_command_new(GtkWidget *widget, Object_t *obj, Command_t *move_sash_command_new(GtkWidget *widget, Object_t *obj,
gint x, gint y, MoveSashFunc_t sash_func); gint x, gint y, MoveSashFunc_t sash_func);
Command_t *move_selected_command_new(ObjectList_t *list, gint dx, gint dy); Command_t *move_selected_command_new(ObjectList_t *list, gint dx, gint dy);
Command_t *move_to_front_command_new(ObjectList_t *list); Command_t *move_to_front_command_new(ObjectList_t *list);
Command_t *move_up_command_new(ObjectList_t *list); Command_t *move_up_command_new(ObjectList_t *list);
@ -56,7 +56,7 @@ Command_t *select_command_new(Object_t *obj);
Command_t *select_next_command_new(ObjectList_t *list); Command_t *select_next_command_new(ObjectList_t *list);
Command_t *select_prev_command_new(ObjectList_t *list); Command_t *select_prev_command_new(ObjectList_t *list);
Command_t *select_region_command_new(GtkWidget *widget, ObjectList_t *list, Command_t *select_region_command_new(GtkWidget *widget, ObjectList_t *list,
gint x, gint y); gint x, gint y);
Command_t *send_to_back_command_new(ObjectList_t *list); Command_t *send_to_back_command_new(ObjectList_t *list);
Command_t *unselect_all_command_new(ObjectList_t *list, Object_t *exception); Command_t *unselect_all_command_new(ObjectList_t *list, Object_t *exception);
Command_t *unselect_command_new(Object_t *obj); Command_t *unselect_command_new(Object_t *obj);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -108,7 +108,7 @@ typedef union YYSTYPE
} }
/* Line 1489 of yacc.c. */ /* Line 1489 of yacc.c. */
#line 111 "y.tab.h" #line 111 "y.tab.h"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1

View File

@ -59,7 +59,7 @@ dialog_response (GtkWidget *widget,
void void
default_dialog_set_ok_cb(DefaultDialog_t *dialog, void (*ok_cb)(gpointer), default_dialog_set_ok_cb(DefaultDialog_t *dialog, void (*ok_cb)(gpointer),
gpointer ok_cb_data) gpointer ok_cb_data)
{ {
dialog->ok_cb = ok_cb; dialog->ok_cb = ok_cb;
dialog->ok_cb_data = ok_cb_data; dialog->ok_cb_data = ok_cb_data;
@ -67,8 +67,8 @@ default_dialog_set_ok_cb(DefaultDialog_t *dialog, void (*ok_cb)(gpointer),
void void
default_dialog_set_apply_cb(DefaultDialog_t *dialog, default_dialog_set_apply_cb(DefaultDialog_t *dialog,
void (*apply_cb)(gpointer), void (*apply_cb)(gpointer),
gpointer apply_cb_data) gpointer apply_cb_data)
{ {
dialog->apply_cb = apply_cb; dialog->apply_cb = apply_cb;
dialog->apply_cb_data = apply_cb_data; dialog->apply_cb_data = apply_cb_data;
@ -76,8 +76,8 @@ default_dialog_set_apply_cb(DefaultDialog_t *dialog,
void void
default_dialog_set_cancel_cb(DefaultDialog_t *dialog, default_dialog_set_cancel_cb(DefaultDialog_t *dialog,
void (*cancel_cb)(gpointer), void (*cancel_cb)(gpointer),
gpointer cancel_cb_data) gpointer cancel_cb_data)
{ {
dialog->cancel_cb = cancel_cb; dialog->cancel_cb = cancel_cb;
dialog->cancel_cb_data = cancel_cb_data; dialog->cancel_cb_data = cancel_cb_data;
@ -116,7 +116,7 @@ make_default_dialog (const gchar *title)
G_CALLBACK (dialog_response), G_CALLBACK (dialog_response),
data); data);
g_signal_connect (data->dialog, "destroy", g_signal_connect (data->dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&data->dialog); &data->dialog);
data->vbox = gtk_vbox_new (FALSE, 12); data->vbox = gtk_vbox_new (FALSE, 12);

View File

@ -25,28 +25,28 @@
typedef struct typedef struct
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *ok; GtkWidget *ok;
GtkWidget *apply; GtkWidget *apply;
GtkWidget *cancel; GtkWidget *cancel;
void (*ok_cb)(gpointer); void (*ok_cb)(gpointer);
gpointer ok_cb_data; gpointer ok_cb_data;
void (*apply_cb)(gpointer); void (*apply_cb)(gpointer);
gpointer apply_cb_data; gpointer apply_cb_data;
void (*cancel_cb)(gpointer); void (*cancel_cb)(gpointer);
gpointer cancel_cb_data; gpointer cancel_cb_data;
} DefaultDialog_t; } DefaultDialog_t;
DefaultDialog_t *make_default_dialog(const gchar *title); DefaultDialog_t *make_default_dialog(const gchar *title);
void default_dialog_set_ok_cb(DefaultDialog_t *dialog, void (*ok_cb)(gpointer), void default_dialog_set_ok_cb(DefaultDialog_t *dialog, void (*ok_cb)(gpointer),
gpointer ok_cb_data); gpointer ok_cb_data);
void default_dialog_set_apply_cb(DefaultDialog_t *dialog, void default_dialog_set_apply_cb(DefaultDialog_t *dialog,
void (*apply_cb)(gpointer), void (*apply_cb)(gpointer),
gpointer apply_cb_data); gpointer apply_cb_data);
void default_dialog_set_cancel_cb(DefaultDialog_t *dialog, void default_dialog_set_cancel_cb(DefaultDialog_t *dialog,
void (*ok_cb)(gpointer), void (*ok_cb)(gpointer),
gpointer ok_cb_data); gpointer ok_cb_data);
void default_dialog_show(DefaultDialog_t *dialog); void default_dialog_show(DefaultDialog_t *dialog);
void default_dialog_hide_cancel_button(DefaultDialog_t *dialog); void default_dialog_hide_cancel_button(DefaultDialog_t *dialog);
void default_dialog_hide_apply_button(DefaultDialog_t *dialog); void default_dialog_hide_apply_button(DefaultDialog_t *dialog);
@ -54,6 +54,6 @@ void default_dialog_hide_help_button(DefaultDialog_t *dialog);
void default_dialog_set_title(DefaultDialog_t *dialog, const gchar *title); void default_dialog_set_title(DefaultDialog_t *dialog, const gchar *title);
void default_dialog_set_label(DefaultDialog_t *dialog, const gchar *text); void default_dialog_set_label(DefaultDialog_t *dialog, const gchar *text);
GtkWidget *default_dialog_add_table(DefaultDialog_t *dialog, gint rows, GtkWidget *default_dialog_add_table(DefaultDialog_t *dialog, gint rows,
gint cols); gint cols);
#endif /* _IMAP_DEFAULT_DIALOG_H */ #endif /* _IMAP_DEFAULT_DIALOG_H */

View File

@ -100,11 +100,11 @@ set_url(GtkWidget *widget, AreaInfoDialog_t *param, const gchar *prefix)
} }
else else
{ {
p = strchr(url, ':'); /* 'mailto:' */ p = strchr(url, ':'); /* 'mailto:' */
if (p) if (p)
{ {
p++; p++;
if (*p == '/') /* 'file:/' */ if (*p == '/') /* 'file:/' */
p++; p++;
} }
else else
@ -171,7 +171,7 @@ select_email_cb(GtkWidget *widget, AreaInfoDialog_t *param)
static void static void
append_page (GtkWidget *notebook, GtkWidget *page, const gchar *icon_name, append_page (GtkWidget *notebook, GtkWidget *page, const gchar *icon_name,
const gchar *label_name) const gchar *label_name)
{ {
GtkWidget *hbox, *icon, *label; GtkWidget *hbox, *icon, *label;
@ -211,49 +211,49 @@ create_link_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
gtk_widget_show(subtable); gtk_widget_show(subtable);
dialog->web_site = create_radio_button_in_table(subtable, NULL, 0, 0, dialog->web_site = create_radio_button_in_table(subtable, NULL, 0, 0,
_("_Web Site")); _("_Web Site"));
g_signal_connect(dialog->web_site, "toggled", g_signal_connect(dialog->web_site, "toggled",
G_CALLBACK (select_web_cb), (gpointer) dialog); G_CALLBACK (select_web_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->web_site)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->web_site));
dialog->ftp_site = create_radio_button_in_table(subtable, group, 0, 1, dialog->ftp_site = create_radio_button_in_table(subtable, group, 0, 1,
_("_Ftp Site")); _("_Ftp Site"));
g_signal_connect(dialog->ftp_site, "toggled", g_signal_connect(dialog->ftp_site, "toggled",
G_CALLBACK (select_ftp_cb), (gpointer) dialog); G_CALLBACK (select_ftp_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->ftp_site)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->ftp_site));
dialog->gopher = create_radio_button_in_table(subtable, group, 0, 2, dialog->gopher = create_radio_button_in_table(subtable, group, 0, 2,
_("_Gopher")); _("_Gopher"));
g_signal_connect(dialog->gopher, "toggled", g_signal_connect(dialog->gopher, "toggled",
G_CALLBACK (select_gopher_cb), (gpointer) dialog); G_CALLBACK (select_gopher_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->gopher)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->gopher));
dialog->other = create_radio_button_in_table(subtable, group, 0, 3, dialog->other = create_radio_button_in_table(subtable, group, 0, 3,
_("Ot_her")); _("Ot_her"));
g_signal_connect(dialog->other, "toggled", g_signal_connect(dialog->other, "toggled",
G_CALLBACK (select_other_cb), (gpointer) dialog); G_CALLBACK (select_other_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->other)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->other));
dialog->file = create_radio_button_in_table(subtable, group, 1, 0, dialog->file = create_radio_button_in_table(subtable, group, 1, 0,
_("F_ile")); _("F_ile"));
g_signal_connect(dialog->file, "toggled", g_signal_connect(dialog->file, "toggled",
G_CALLBACK (select_file_cb), (gpointer) dialog); G_CALLBACK (select_file_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->file)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->file));
dialog->wais = create_radio_button_in_table(subtable, group, 1, 1, dialog->wais = create_radio_button_in_table(subtable, group, 1, 1,
_("WAI_S")); _("WAI_S"));
g_signal_connect(dialog->wais, "toggled", g_signal_connect(dialog->wais, "toggled",
G_CALLBACK (select_wais_cb), (gpointer) dialog); G_CALLBACK (select_wais_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->wais)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->wais));
dialog->telnet = create_radio_button_in_table(subtable, group, 1, 2, dialog->telnet = create_radio_button_in_table(subtable, group, 1, 2,
_("Tel_net")); _("Tel_net"));
g_signal_connect(dialog->telnet, "toggled", g_signal_connect(dialog->telnet, "toggled",
G_CALLBACK (select_telnet_cb), (gpointer) dialog); G_CALLBACK (select_telnet_cb), (gpointer) dialog);
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->telnet)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(dialog->telnet));
dialog->email = create_radio_button_in_table(subtable, group, 1, 3, dialog->email = create_radio_button_in_table(subtable, group, 1, 3,
_("e-_mail")); _("e-_mail"));
g_signal_connect(dialog->email, "toggled", g_signal_connect(dialog->email, "toggled",
G_CALLBACK (select_email_cb), (gpointer) dialog); G_CALLBACK (select_email_cb), (gpointer) dialog);
@ -266,13 +266,13 @@ create_link_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
gtk_table_attach_defaults(GTK_TABLE(table), browse->hbox, 0, 1, 3, 4); gtk_table_attach_defaults(GTK_TABLE(table), browse->hbox, 0, 1, 3, 4);
dialog->url = browse->file; dialog->url = browse->file;
g_signal_connect(dialog->url, "changed", G_CALLBACK(url_changed), g_signal_connect(dialog->url, "changed", G_CALLBACK(url_changed),
dialog); dialog);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), dialog->url); gtk_label_set_mnemonic_widget(GTK_LABEL(label), dialog->url);
dialog->relative_link = create_check_button_in_table(table, 4, 0, dialog->relative_link = create_check_button_in_table(table, 4, 0,
_("Relati_ve link")); _("Relati_ve link"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->relative_link), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->relative_link),
TRUE); TRUE);
label = create_label_in_table( label = create_label_in_table(
table, 6, 0, table, 6, 0,
@ -293,8 +293,8 @@ geometry_changed(Object_t *obj, gpointer data)
dialog->geometry_lock = FALSE; dialog->geometry_lock = FALSE;
} else { } else {
if (dialog->obj == obj) { if (dialog->obj == obj) {
object_update_info_widget(obj, dialog->infotab); object_update_info_widget(obj, dialog->infotab);
obj->class->assign(obj, dialog->clone); obj->class->assign(obj, dialog->clone);
} }
} }
} }
@ -329,7 +329,7 @@ create_info_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
dialog->infotab = obj->class->create_info_widget(frame); dialog->infotab = obj->class->create_info_widget(frame);
append_page (notebook, vbox, obj->class->get_stock_icon_name (), append_page (notebook, vbox, obj->class->get_stock_icon_name (),
gettext (obj->class->name)); gettext (obj->class->name));
} }
static void static void
@ -386,7 +386,7 @@ edit_area_apply_cb(gpointer data)
object_set_target(obj, gtk_entry_get_text(GTK_ENTRY(param->target))); object_set_target(obj, gtk_entry_get_text(GTK_ENTRY(param->target)));
object_set_comment(obj, gtk_entry_get_text(GTK_ENTRY(param->comment))); object_set_comment(obj, gtk_entry_get_text(GTK_ENTRY(param->comment)));
object_set_mouse_over(obj, object_set_mouse_over(obj,
gtk_entry_get_text(GTK_ENTRY(param->mouse_over))); gtk_entry_get_text(GTK_ENTRY(param->mouse_over)));
object_set_mouse_out(obj, gtk_entry_get_text(GTK_ENTRY(param->mouse_out))); object_set_mouse_out(obj, gtk_entry_get_text(GTK_ENTRY(param->mouse_out)));
object_set_focus(obj, gtk_entry_get_text(GTK_ENTRY(param->focus))); object_set_focus(obj, gtk_entry_get_text(GTK_ENTRY(param->focus)));
object_set_blur(obj, gtk_entry_get_text(GTK_ENTRY(param->blur))); object_set_blur(obj, gtk_entry_get_text(GTK_ENTRY(param->blur)));
@ -434,7 +434,7 @@ edit_area_cancel_cb(gpointer data)
static void static void
switch_page(GtkWidget *widget, gpointer page, gint page_num, switch_page(GtkWidget *widget, gpointer page, gint page_num,
gpointer data) gpointer data)
{ {
AreaInfoDialog_t *param = (AreaInfoDialog_t*) data; AreaInfoDialog_t *param = (AreaInfoDialog_t*) data;
if (page_num == 0) { if (page_num == 0) {
@ -477,7 +477,7 @@ create_edit_area_info_dialog(Object_t *obj)
void void
edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj, edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj,
gboolean add) gboolean add)
{ {
gchar *title; gchar *title;
@ -500,7 +500,7 @@ edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj,
object_list_add_geometry_cb(obj->list, geometry_changed, dialog); object_list_add_geometry_cb(obj->list, geometry_changed, dialog);
title = g_strdup_printf (_("Area #%d Settings"), title = g_strdup_printf (_("Area #%d Settings"),
object_get_position_in_list(obj) + 1); object_get_position_in_list(obj) + 1);
default_dialog_set_title(dialog->dialog, title); default_dialog_set_title(dialog->dialog, title);
g_free (title); g_free (title);
default_dialog_show(dialog->dialog); default_dialog_show(dialog->dialog);

View File

@ -30,37 +30,37 @@ typedef struct AreaInfoDialog_t AreaInfoDialog_t;
struct AreaInfoDialog_t { struct AreaInfoDialog_t {
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
Object_t *obj; Object_t *obj;
Object_t *clone; Object_t *clone;
gboolean add; gboolean add;
gboolean geometry_lock; gboolean geometry_lock;
gboolean preview; gboolean preview;
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *web_site; GtkWidget *web_site;
GtkWidget *ftp_site; GtkWidget *ftp_site;
GtkWidget *gopher; GtkWidget *gopher;
GtkWidget *other; GtkWidget *other;
GtkWidget *file; GtkWidget *file;
GtkWidget *wais; GtkWidget *wais;
GtkWidget *telnet; GtkWidget *telnet;
GtkWidget *email; GtkWidget *email;
GtkWidget *url; GtkWidget *url;
GtkWidget *relative_link; GtkWidget *relative_link;
GtkWidget *target; GtkWidget *target;
GtkWidget *comment; GtkWidget *comment;
GtkWidget *mouse_over; GtkWidget *mouse_over;
GtkWidget *mouse_out; GtkWidget *mouse_out;
GtkWidget *focus; GtkWidget *focus;
GtkWidget *blur; GtkWidget *blur;
GtkWidget *browse; GtkWidget *browse;
gpointer infotab; gpointer infotab;
gpointer geometry_cb_id; gpointer geometry_cb_id;
}; };
AreaInfoDialog_t *create_edit_area_info_dialog(Object_t *obj); AreaInfoDialog_t *create_edit_area_info_dialog(Object_t *obj);
void edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj, void edit_area_info_dialog_show(AreaInfoDialog_t *dialog, Object_t *obj,
gboolean add); gboolean add);
void edit_area_info_dialog_emit_geometry_signal(AreaInfoDialog_t *dialog); void edit_area_info_dialog_emit_geometry_signal(AreaInfoDialog_t *dialog);
#endif /* _IMAP_EDIT_AREA_INFO_H */ #endif /* _IMAP_EDIT_AREA_INFO_H */

View File

@ -176,7 +176,7 @@ do_file_error_dialog (const char *error,
gimp_filename_to_utf8 (filename)); gimp_filename_to_utf8 (filename));
g_signal_connect_swapped (dialog, "response", g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy), G_CALLBACK (gtk_widget_destroy),
dialog); dialog);
gtk_dialog_run (GTK_DIALOG (dialog)); gtk_dialog_run (GTK_DIALOG (dialog));
} }

View File

@ -127,7 +127,7 @@ grid_assign_value(GtkWidget *widget, gpointer data, gint *value)
GridDialog_t *dialog = (GridDialog_t*) data; GridDialog_t *dialog = (GridDialog_t*) data;
if (dialog->enable_preview) { if (dialog->enable_preview) {
*value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
redraw_preview(); /* Fix me! */ redraw_preview(); /* Fix me! */
} }
} }
@ -138,7 +138,7 @@ width_changed_cb(GtkWidget *widget, gpointer data)
grid_assign_value(widget, data, &grid_width); grid_assign_value(widget, data, &grid_width);
if (gimp_chain_button_get_active( if (gimp_chain_button_get_active(
GIMP_CHAIN_BUTTON(dialog->chain_width_height))) { GIMP_CHAIN_BUTTON(dialog->chain_width_height))) {
gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->height), value); gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->height), value);
} }
@ -151,7 +151,7 @@ height_changed_cb(GtkWidget *widget, gpointer data)
grid_assign_value(widget, data, &grid_height); grid_assign_value(widget, data, &grid_height);
if (gimp_chain_button_get_active( if (gimp_chain_button_get_active(
GIMP_CHAIN_BUTTON(dialog->chain_width_height))) { GIMP_CHAIN_BUTTON(dialog->chain_width_height))) {
gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->width), value); gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->width), value);
} }
@ -164,7 +164,7 @@ left_changed_cb(GtkWidget *widget, gpointer data)
grid_assign_value(widget, data, &grid_left); grid_assign_value(widget, data, &grid_left);
if (gimp_chain_button_get_active( if (gimp_chain_button_get_active(
GIMP_CHAIN_BUTTON(dialog->chain_left_top))) { GIMP_CHAIN_BUTTON(dialog->chain_left_top))) {
gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->top), value); gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->top), value);
} }
@ -177,7 +177,7 @@ top_changed_cb(GtkWidget *widget, gpointer data)
grid_assign_value(widget, data, &grid_top); grid_assign_value(widget, data, &grid_top);
if (gimp_chain_button_get_active( if (gimp_chain_button_get_active(
GIMP_CHAIN_BUTTON(dialog->chain_left_top))) { GIMP_CHAIN_BUTTON(dialog->chain_left_top))) {
gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); gint value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->left), value); gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->left), value);
} }
@ -286,7 +286,7 @@ create_grid_settings_dialog(void)
gtk_widget_show(chain_button); gtk_widget_show(chain_button);
data->preview = create_check_button_in_table(main_table, 3, 0, data->preview = create_check_button_in_table(main_table, 3, 0,
_("_Preview")); _("_Preview"));
g_signal_connect(data->preview, "toggled", g_signal_connect(data->preview, "toggled",
G_CALLBACK (toggle_preview_cb), (gpointer) data); G_CALLBACK (toggle_preview_cb), (gpointer) data);
gtk_widget_show(data->preview); gtk_widget_show(data->preview);
@ -343,8 +343,8 @@ draw_crosses(GdkWindow *window, GdkGC* gc, gint width, gint height)
for (x = grid_left; x < width; x += grid_width) { for (x = grid_left; x < width; x += grid_width) {
for (y = grid_top; y < height; y += grid_height) { for (y = grid_top; y < height; y += grid_height) {
draw_line(window, gc, x - 3, y, x + 3, y); draw_line(window, gc, x - 3, y, x + 3, y);
draw_line(window, gc, x, y - 3, x, y + 3); draw_line(window, gc, x, y - 3, x, y + 3);
} }
} }
} }

View File

@ -1085,28 +1085,28 @@ key_press_cb(GtkWidget *widget, GdkEventKey *event)
switch (event->keyval) { switch (event->keyval) {
case GDK_Left: case GDK_Left:
if (ctrl) if (ctrl)
move_sash_selected_objects(-1, 0, shift); move_sash_selected_objects(-1, 0, shift);
else else
move_selected_objects(-1, 0, shift); move_selected_objects(-1, 0, shift);
handled = TRUE; handled = TRUE;
break; break;
case GDK_Right: case GDK_Right:
if (ctrl) if (ctrl)
move_sash_selected_objects(1, 0, shift); move_sash_selected_objects(1, 0, shift);
else else
move_selected_objects(1, 0, shift); move_selected_objects(1, 0, shift);
handled = TRUE; handled = TRUE;
break; break;
case GDK_Up: case GDK_Up:
if (ctrl) if (ctrl)
move_sash_selected_objects(0, -1, shift); move_sash_selected_objects(0, -1, shift);
else else
move_selected_objects(0, -1, shift); move_selected_objects(0, -1, shift);
handled = TRUE; handled = TRUE;
break; break;
case GDK_Down: case GDK_Down:
if (ctrl) if (ctrl)
move_sash_selected_objects(0, 1, shift); move_sash_selected_objects(0, 1, shift);
else else
move_selected_objects(0, 1, shift); move_selected_objects(0, 1, shift);

View File

@ -41,7 +41,7 @@ typedef struct {
gchar *description; gchar *description;
gint old_image_width; gint old_image_width;
gint old_image_height; gint old_image_height;
gboolean color; /* Color (TRUE) or Gray (FALSE) */ gboolean color; /* Color (TRUE) or Gray (FALSE) */
gboolean show_gray; gboolean show_gray;
} MapInfo_t; } MapInfo_t;
@ -66,13 +66,13 @@ void main_toolbar_set_grid(gboolean active);
void set_zoom(gint zoom_factor); void set_zoom(gint zoom_factor);
gint get_real_coord(gint coord); gint get_real_coord(gint coord);
void draw_line(GdkWindow *window, GdkGC *gc, gint x1, gint y1, gint x2, void draw_line(GdkWindow *window, GdkGC *gc, gint x1, gint y1, gint x2,
gint y2); gint y2);
void draw_rectangle(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y, void draw_rectangle(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y,
gint width, gint height); gint width, gint height);
void draw_arc(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y, void draw_arc(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y,
gint width, gint height, gint angle1, gint angle2); gint width, gint height, gint angle1, gint angle2);
void draw_circle(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y, void draw_circle(GdkWindow *window, GdkGC *gc, gint filled, gint x, gint y,
gint r); gint r);
void draw_polygon(GdkWindow *window, GdkGC *gc, GList *list); void draw_polygon(GdkWindow *window, GdkGC *gc, GList *list);
const char *get_filename(void); const char *get_filename(void);

View File

@ -393,19 +393,19 @@ make_menu(GtkWidget *main_vbox, GtkWidget *window)
gtk_action_group_set_translation_domain (action_group, NULL); gtk_action_group_set_translation_domain (action_group, NULL);
gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries),
window); window);
gtk_action_group_add_toggle_actions (action_group, toggle_entries, gtk_action_group_add_toggle_actions (action_group, toggle_entries,
G_N_ELEMENTS (toggle_entries), window); G_N_ELEMENTS (toggle_entries), window);
gtk_action_group_add_radio_actions (action_group, color_entries, gtk_action_group_add_radio_actions (action_group, color_entries,
G_N_ELEMENTS (color_entries), 0, G_N_ELEMENTS (color_entries), 0,
G_CALLBACK (set_preview_color), NULL); G_CALLBACK (set_preview_color), NULL);
gtk_action_group_add_radio_actions (action_group, zoom_entries, gtk_action_group_add_radio_actions (action_group, zoom_entries,
G_N_ELEMENTS (zoom_entries), 0, G_N_ELEMENTS (zoom_entries), 0,
G_CALLBACK (set_zoom_factor), NULL); G_CALLBACK (set_zoom_factor), NULL);
gtk_action_group_add_radio_actions (action_group, mapping_entries, gtk_action_group_add_radio_actions (action_group, mapping_entries,
G_N_ELEMENTS (mapping_entries), 0, G_N_ELEMENTS (mapping_entries), 0,
G_CALLBACK (set_func), window); G_CALLBACK (set_func), window);
ui_manager = gtk_ui_manager_new (); ui_manager = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
@ -415,7 +415,7 @@ make_menu(GtkWidget *main_vbox, GtkWidget *window)
error = NULL; error = NULL;
if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1,
&error)) &error))
{ {
g_warning ("building menus failed: %s", error->message); g_warning ("building menus failed: %s", error->message);
g_error_free (error); g_error_free (error);
@ -456,7 +456,7 @@ menu_build_mru_items(MRU_t *mru)
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);
} }
g_list_free(children); g_list_free(children);
} }
@ -464,11 +464,11 @@ menu_build_mru_items(MRU_t *mru)
i = 0; i = 0;
for (p = mru->list; p; p = p->next, i++) { for (p = mru->list; p; p = p->next, i++) {
GtkWidget *item = insert_item_with_label(_menu.open_recent, position++, GtkWidget *item = insert_item_with_label(_menu.open_recent, position++,
(gchar*) p->data, (gchar*) p->data,
menu_mru, p->data); menu_mru, p->data);
if (i < 9) { if (i < 9) {
guchar accelerator_key = '1' + i; guchar accelerator_key = '1' + i;
add_accelerator(item, accelerator_key, GDK_CONTROL_MASK); add_accelerator(item, accelerator_key, GDK_CONTROL_MASK);
} }
} }
_menu.nr_off_mru_items = i; _menu.nr_off_mru_items = i;
@ -479,14 +479,14 @@ do_main_popup_menu(GdkEventButton *event)
{ {
GtkWidget *popup = gtk_ui_manager_get_widget (ui_manager, "/PopupMenu"); GtkWidget *popup = gtk_ui_manager_get_widget (ui_manager, "/PopupMenu");
gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL, gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL,
event->button, event->time); event->button, event->time);
} }
void void
menu_check_grid(gboolean check) menu_check_grid(gboolean check)
{ {
GtkAction *action = gtk_ui_manager_get_action (ui_manager, GtkAction *action = gtk_ui_manager_get_action (ui_manager,
"/MainMenu/ToolsMenu/Grid"); "/MainMenu/ToolsMenu/Grid");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), check); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), check);
} }

View File

@ -44,7 +44,7 @@ typedef struct {
GtkWidget *zoom_in; GtkWidget *zoom_in;
GtkWidget *zoom_out; GtkWidget *zoom_out;
gint nr_off_mru_items; gint nr_off_mru_items;
} Menu_t; } Menu_t;
GtkWidget *menu_get_widget(const gchar *path); GtkWidget *menu_get_widget(const gchar *path);

View File

@ -38,16 +38,16 @@ init_accel_group(GtkWidget *window)
void void
add_accelerator(GtkWidget *widget, guint accelerator_key, add_accelerator(GtkWidget *widget, guint accelerator_key,
guint8 accelerator_mods) guint8 accelerator_mods)
{ {
gtk_widget_add_accelerator(widget, "activate", accelerator_group, gtk_widget_add_accelerator(widget, "activate", accelerator_group,
accelerator_key, accelerator_mods, accelerator_key, accelerator_mods,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
} }
GtkWidget* GtkWidget*
insert_item_with_label(GtkWidget *parent, gint position, gchar *label, insert_item_with_label(GtkWidget *parent, gint position, gchar *label,
MenuCallback activate, gpointer data) MenuCallback activate, gpointer data)
{ {
GtkWidget *item = gtk_image_menu_item_new_with_mnemonic(label); GtkWidget *item = gtk_image_menu_item_new_with_mnemonic(label);
gtk_menu_shell_insert(GTK_MENU_SHELL(parent), item, position); gtk_menu_shell_insert(GTK_MENU_SHELL(parent), item, position);

View File

@ -27,13 +27,13 @@ typedef void (*MenuCallback)(GtkWidget *widget, gpointer data);
void init_accel_group(GtkWidget *window); void init_accel_group(GtkWidget *window);
GtkWidget *insert_item_with_label(GtkWidget *parent, gint position, GtkWidget *insert_item_with_label(GtkWidget *parent, gint position,
gchar *label, MenuCallback activate, gchar *label, MenuCallback activate,
gpointer data); gpointer data);
void menu_command(GtkWidget *widget, gpointer data); void menu_command(GtkWidget *widget, gpointer data);
void add_accelerator(GtkWidget *widget, guint accelerator_key, void add_accelerator(GtkWidget *widget, guint accelerator_key,
guint8 accelerator_mods); guint8 accelerator_mods);
#endif /* _IMAP_MENU_FUNCS_H */ #endif /* _IMAP_MENU_FUNCS_H */

View File

@ -41,7 +41,7 @@ void
draw_sash(GdkWindow *window, GdkGC *gc, gint x, gint y) draw_sash(GdkWindow *window, GdkGC *gc, gint x, gint y)
{ {
draw_rectangle(window, gc, TRUE, x - _sash_size / 2, y - _sash_size / 2, draw_rectangle(window, gc, TRUE, x - _sash_size / 2, y - _sash_size / 2,
_sash_size, _sash_size); _sash_size, _sash_size);
} }
gboolean gboolean

View File

@ -59,7 +59,7 @@ static GList*
mru_find_link(MRU_t *mru, const gchar *filename) mru_find_link(MRU_t *mru, const gchar *filename)
{ {
return g_list_find_custom(mru->list, (gpointer) filename, return g_list_find_custom(mru->list, (gpointer) filename,
(GCompareFunc) strcmp); (GCompareFunc) strcmp);
} }
void void
@ -82,7 +82,7 @@ mru_set_first(MRU_t *mru, const gchar *filename)
GList *link = mru_find_link(mru, filename); GList *link = mru_find_link(mru, filename);
if (link) if (link)
mru->list = g_list_prepend(g_list_remove_link(mru->list, link), mru->list = g_list_prepend(g_list_remove_link(mru->list, link),
link->data); link->data);
else else
mru_add(mru, filename); mru_add(mru, filename);
} }

View File

@ -29,7 +29,7 @@
typedef struct { typedef struct {
GList *list; GList *list;
gint max_size; gint max_size;
} MRU_t; } MRU_t;
MRU_t* mru_create(void); MRU_t* mru_create(void);

File diff suppressed because it is too large Load Diff

View File

@ -177,7 +177,7 @@ typedef union YYSTYPE
} }
/* Line 187 of yacc.c. */ /* Line 187 of yacc.c. */
#line 180 "y.tab.c" #line 180 "y.tab.c"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
@ -321,7 +321,7 @@ YYID (i)
# endif # endif
# if (defined __cplusplus && ! defined _STDLIB_H \ # if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \ && ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free))) && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H # ifndef _STDLIB_H
# define _STDLIB_H 1 # define _STDLIB_H 1
@ -347,7 +347,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \ #if (! defined yyoverflow \
&& (! defined __cplusplus \ && (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */ /* A type that is properly aligned for any stack member. */
union yyalloc union yyalloc
@ -372,13 +372,13 @@ union yyalloc
# define YYCOPY(To, From, Count) \ # define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From))) __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else # else
# define YYCOPY(To, From, Count) \ # define YYCOPY(To, From, Count) \
do \ do \
{ \ { \
YYSIZE_T yyi; \ YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \ (To)[yyi] = (From)[yyi]; \
} \ } \
while (YYID (0)) while (YYID (0))
# endif # endif
# endif # endif
@ -388,15 +388,15 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next stack. Advance YYPTR to a properly aligned location for the next
stack. */ stack. */
# define YYSTACK_RELOCATE(Stack) \ # define YYSTACK_RELOCATE(Stack) \
do \ do \
{ \ { \
YYSIZE_T yynewbytes; \ YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \ YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \ Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \ yyptr += yynewbytes / sizeof (*yyptr); \
} \ } \
while (YYID (0)) while (YYID (0))
#endif #endif
@ -419,7 +419,7 @@ union yyalloc
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 268 #define YYMAXUTOK 268
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
@ -596,44 +596,44 @@ static const yytype_uint8 yystos[] =
31, 11, 11, 14, 11, 14, 11, 14, 11, 11 31, 11, 11, 14, 11, 14, 11, 14, 11, 11
}; };
#define yyerrok (yyerrstatus = 0) #define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY) #define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2) #define YYEMPTY (-2)
#define YYEOF 0 #define YYEOF 0
#define YYACCEPT goto yyacceptlab #define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab #define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab #define YYERROR goto yyerrorlab
/* Like YYERROR except do call yyerror. This remains here temporarily /* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC. to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */ Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab #define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus) #define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \ #define YYBACKUP(Token, Value) \
do \ do \
if (yychar == YYEMPTY && yylen == 1) \ if (yychar == YYEMPTY && yylen == 1) \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \ yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \ YYPOPSTACK (1); \
goto yybackup; \ goto yybackup; \
} \ } \
else \ else \
{ \ { \
yyerror (YY_("syntax error: cannot back up")); \ yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \ YYERROR; \
} \ } \
while (YYID (0)) while (YYID (0))
#define YYTERROR 1 #define YYTERROR 1
#define YYERRCODE 256 #define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
@ -642,22 +642,22 @@ while (YYID (0))
#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
do \ do \
if (YYID (N)) \ if (YYID (N)) \
{ \ { \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \ } \
else \ else \
{ \ { \
(Current).first_line = (Current).last_line = \ (Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \ YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \ (Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \ YYRHSLOC (Rhs, 0).last_column; \
} \ } \
while (YYID (0)) while (YYID (0))
#endif #endif
@ -668,10 +668,10 @@ while (YYID (0))
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL # if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \ (Loc).first_line, (Loc).first_column, \
(Loc).last_line, (Loc).last_column) (Loc).last_line, (Loc).last_column)
# else # else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0) # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif # endif
@ -694,21 +694,21 @@ while (YYID (0))
# define YYFPRINTF fprintf # define YYFPRINTF fprintf
# endif # endif
# define YYDPRINTF(Args) \ # define YYDPRINTF(Args) \
do { \ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (YYID (0)) } while (YYID (0))
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \ do { \
if (yydebug) \ if (yydebug) \
{ \ { \
YYFPRINTF (stderr, "%s ", Title); \ YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \ yy_symbol_print (stderr, \
Type, Value); \ Type, Value); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (YYID (0)) } while (YYID (0))
@ -740,7 +740,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep)
switch (yytype) switch (yytype)
{ {
default: default:
break; break;
} }
} }
@ -792,10 +792,10 @@ yy_stack_print (bottom, top)
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
# define YY_STACK_PRINT(Bottom, Top) \ # define YY_STACK_PRINT(Bottom, Top) \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_stack_print ((Bottom), (Top)); \ yy_stack_print ((Bottom), (Top)); \
} while (YYID (0)) } while (YYID (0))
@ -818,21 +818,21 @@ yy_reduce_print (yyvsp, yyrule)
int yyi; int yyi;
unsigned long int yylno = yyrline[yyrule]; unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno); yyrule - 1, yylno);
/* The symbols being reduced. */ /* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) for (yyi = 0; yyi < yynrhs; yyi++)
{ {
fprintf (stderr, " $%d = ", yyi + 1); fprintf (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)]) &(yyvsp[(yyi + 1) - (yynrhs)])
); );
fprintf (stderr, "\n"); fprintf (stderr, "\n");
} }
} }
# define YY_REDUCE_PRINT(Rule) \ # define YY_REDUCE_PRINT(Rule) \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (yyvsp, Rule); \ yy_reduce_print (yyvsp, Rule); \
} while (YYID (0)) } while (YYID (0))
@ -848,7 +848,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */ /* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH #ifndef YYINITDEPTH
# define YYINITDEPTH 200 # define YYINITDEPTH 200
#endif #endif
@ -935,27 +935,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr; char const *yyp = yystr;
for (;;) for (;;)
switch (*++yyp) switch (*++yyp)
{ {
case '\'': case '\'':
case ',': case ',':
goto do_not_strip_quotes; goto do_not_strip_quotes;
case '\\': case '\\':
if (*++yyp != '\\') if (*++yyp != '\\')
goto do_not_strip_quotes; goto do_not_strip_quotes;
/* Fall through. */ /* Fall through. */
default: default:
if (yyres) if (yyres)
yyres[yyn] = *yyp; yyres[yyn] = *yyp;
yyn++; yyn++;
break; break;
case '"': case '"':
if (yyres) if (yyres)
yyres[yyn] = '\0'; yyres[yyn] = '\0';
return yyn; return yyn;
} }
do_not_strip_quotes: ; do_not_strip_quotes: ;
} }
@ -993,7 +993,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
# if 0 # if 0
/* This is so xgettext sees the translatable formats that are /* This is so xgettext sees the translatable formats that are
constructed on the fly. */ constructed on the fly. */
YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s");
YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s");
YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s");
@ -1006,13 +1006,13 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
static char const yyexpecting[] = ", expecting %s"; static char const yyexpecting[] = ", expecting %s";
static char const yyor[] = " or %s"; static char const yyor[] = " or %s";
char yyformat[sizeof yyunexpected char yyformat[sizeof yyunexpected
+ sizeof yyexpecting - 1 + sizeof yyexpecting - 1
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof yyor - 1))]; * (sizeof yyor - 1))];
char const *yyprefix = yyexpecting; char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in /* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */ YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0; int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */ /* Stay within bounds of both yycheck and yytname. */
@ -1024,22 +1024,22 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
yyfmt = yystpcpy (yyformat, yyunexpected); yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx) for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{ {
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{ {
yycount = 1; yycount = 1;
yysize = yysize0; yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0'; yyformat[sizeof yyunexpected - 1] = '\0';
break; break;
} }
yyarg[yycount++] = yytname[yyx]; yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= (yysize1 < yysize); yysize_overflow |= (yysize1 < yysize);
yysize = yysize1; yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix); yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor; yyprefix = yyor;
} }
yyf = YY_(yyformat); yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf); yysize1 = yysize + yystrlen (yyf);
@ -1047,29 +1047,29 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
yysize = yysize1; yysize = yysize1;
if (yysize_overflow) if (yysize_overflow)
return YYSIZE_MAXIMUM; return YYSIZE_MAXIMUM;
if (yyresult) if (yyresult)
{ {
/* Avoid sprintf, as that infringes on the user's name space. /* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */ produced a string with the wrong number of "%s"s. */
char *yyp = yyresult; char *yyp = yyresult;
int yyi = 0; int yyi = 0;
while ((*yyp = *yyf) != '\0') while ((*yyp = *yyf) != '\0')
{ {
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{ {
yyp += yytnamerr (yyp, yyarg[yyi++]); yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2; yyf += 2;
} }
else else
{ {
yyp++; yyp++;
yyf++; yyf++;
} }
} }
} }
return yysize; return yysize;
} }
} }
@ -1103,7 +1103,7 @@ yydestruct (yymsg, yytype, yyvaluep)
{ {
default: default:
break; break;
} }
} }
@ -1216,7 +1216,7 @@ yyparse ()
yystate = 0; yystate = 0;
yyerrstatus = 0; yyerrstatus = 0;
yynerrs = 0; yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers. /* Initialize stack pointers.
Waste one element of value and location stack Waste one element of value and location stack
@ -1246,25 +1246,25 @@ yyparse ()
#ifdef yyoverflow #ifdef yyoverflow
{ {
/* Give user a chance to reallocate the stack. Use copies of /* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into these so that the &'s don't force the real ones into
memory. */ memory. */
YYSTYPE *yyvs1 = yyvs; YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss; yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the /* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */ be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"), yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp), &yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp), &yyvs1, yysize * sizeof (*yyvsp),
&yystacksize); &yystacksize);
yyss = yyss1; yyss = yyss1;
yyvs = yyvs1; yyvs = yyvs1;
} }
#else /* no yyoverflow */ #else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE # ifndef YYSTACK_RELOCATE
@ -1272,23 +1272,23 @@ yyparse ()
# else # else
/* Extend the stack our own way. */ /* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize) if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab; goto yyexhaustedlab;
yystacksize *= 2; yystacksize *= 2;
if (YYMAXDEPTH < yystacksize) if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH; yystacksize = YYMAXDEPTH;
{ {
yytype_int16 *yyss1 = yyss; yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr = union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr) if (! yyptr)
goto yyexhaustedlab; goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyvs);
# undef YYSTACK_RELOCATE # undef YYSTACK_RELOCATE
if (yyss1 != yyssa) if (yyss1 != yyssa)
YYSTACK_FREE (yyss1); YYSTACK_FREE (yyss1);
} }
# endif # endif
#endif /* no yyoverflow */ #endif /* no yyoverflow */
@ -1298,10 +1298,10 @@ yyparse ()
YYDPRINTF ((stderr, "Stack size increased to %lu\n", YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize)); (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp) if (yyss + yystacksize - 1 <= yyssp)
YYABORT; YYABORT;
} }
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@ -1350,7 +1350,7 @@ yybackup:
if (yyn <= 0) if (yyn <= 0)
{ {
if (yyn == 0 || yyn == YYTABLE_NINF) if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab; goto yyerrlab;
yyn = -yyn; yyn = -yyn;
goto yyreduce; goto yyreduce;
} }
@ -1410,75 +1410,75 @@ yyreduce:
case 9: case 9:
#line 72 "imap_ncsa.y" #line 72 "imap_ncsa.y"
{ {
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 10: case 10:
#line 78 "imap_ncsa.y" #line 78 "imap_ncsa.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
g_strreplace(&info->author, (yyvsp[(2) - (2)].id)); g_strreplace(&info->author, (yyvsp[(2) - (2)].id));
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 11: case 11:
#line 86 "imap_ncsa.y" #line 86 "imap_ncsa.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
g_strreplace(&info->title, (yyvsp[(2) - (2)].id)); g_strreplace(&info->title, (yyvsp[(2) - (2)].id));
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 12: case 12:
#line 94 "imap_ncsa.y" #line 94 "imap_ncsa.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
gchar *description; gchar *description;
description = g_strconcat(info->description, (yyvsp[(2) - (2)].id), "\n", description = g_strconcat(info->description, (yyvsp[(2) - (2)].id), "\n",
NULL); NULL);
g_strreplace(&info->description, description); g_strreplace(&info->description, description);
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 20: case 20:
#line 117 "imap_ncsa.y" #line 117 "imap_ncsa.y"
{ {
MapInfo_t *info = get_map_info(); MapInfo_t *info = get_map_info();
g_strreplace(&info->default_url, (yyvsp[(2) - (2)].id)); g_strreplace(&info->default_url, (yyvsp[(2) - (2)].id));
g_free ((yyvsp[(2) - (2)].id)); g_free ((yyvsp[(2) - (2)].id));
} }
break; break;
case 21: case 21:
#line 126 "imap_ncsa.y" #line 126 "imap_ncsa.y"
{ {
gint x = (gint) (yyvsp[(3) - (8)].value); gint x = (gint) (yyvsp[(3) - (8)].value);
gint y = (gint) (yyvsp[(5) - (8)].value); gint y = (gint) (yyvsp[(5) - (8)].value);
gint width = (gint) fabs((yyvsp[(6) - (8)].value) - x); gint width = (gint) fabs((yyvsp[(6) - (8)].value) - x);
gint height = (gint) fabs((yyvsp[(8) - (8)].value) - y); gint height = (gint) fabs((yyvsp[(8) - (8)].value) - y);
current_object = create_rectangle(x, y, width, height); current_object = create_rectangle(x, y, width, height);
object_set_url(current_object, (yyvsp[(2) - (8)].id)); object_set_url(current_object, (yyvsp[(2) - (8)].id));
add_shape(current_object); add_shape(current_object);
g_free ((yyvsp[(2) - (8)].id)); g_free ((yyvsp[(2) - (8)].id));
} }
break; break;
case 22: case 22:
#line 139 "imap_ncsa.y" #line 139 "imap_ncsa.y"
{ {
gint x = (gint) (yyvsp[(3) - (8)].value); gint x = (gint) (yyvsp[(3) - (8)].value);
gint y = (gint) (yyvsp[(5) - (8)].value); gint y = (gint) (yyvsp[(5) - (8)].value);
gint r = (gint) fabs((yyvsp[(8) - (8)].value) - (yyvsp[(5) - (8)].value)); gint r = (gint) fabs((yyvsp[(8) - (8)].value) - (yyvsp[(5) - (8)].value));
current_object = create_circle(x, y, r); current_object = create_circle(x, y, r);
object_set_url(current_object, (yyvsp[(2) - (8)].id)); object_set_url(current_object, (yyvsp[(2) - (8)].id));
add_shape(current_object); add_shape(current_object);
g_free ((yyvsp[(2) - (8)].id)); g_free ((yyvsp[(2) - (8)].id));
} }
break; break;
case 23: case 23:
@ -1489,26 +1489,26 @@ yyreduce:
case 24: case 24:
#line 151 "imap_ncsa.y" #line 151 "imap_ncsa.y"
{ {
object_set_url(current_object, (yyvsp[(2) - (4)].id)); object_set_url(current_object, (yyvsp[(2) - (4)].id));
add_shape(current_object); add_shape(current_object);
g_free ((yyvsp[(2) - (4)].id)); g_free ((yyvsp[(2) - (4)].id));
} }
break; break;
case 26: case 26:
#line 160 "imap_ncsa.y" #line 160 "imap_ncsa.y"
{ {
} }
break; break;
case 27: case 27:
#line 165 "imap_ncsa.y" #line 165 "imap_ncsa.y"
{ {
Polygon_t *polygon = ObjectToPolygon(current_object); Polygon_t *polygon = ObjectToPolygon(current_object);
GdkPoint *point = new_point((gint) (yyvsp[(1) - (3)].value), (gint) (yyvsp[(3) - (3)].value)); GdkPoint *point = new_point((gint) (yyvsp[(1) - (3)].value), (gint) (yyvsp[(3) - (3)].value));
polygon->points = g_list_append(polygon->points, polygon->points = g_list_append(polygon->points,
(gpointer) point); (gpointer) point);
} }
break; break;
@ -1552,35 +1552,35 @@ yyerrlab:
yyerror (YY_("syntax error")); yyerror (YY_("syntax error"));
#else #else
{ {
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
{ {
YYSIZE_T yyalloc = 2 * yysize; YYSIZE_T yyalloc = 2 * yysize;
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
yyalloc = YYSTACK_ALLOC_MAXIMUM; yyalloc = YYSTACK_ALLOC_MAXIMUM;
if (yymsg != yymsgbuf) if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg); YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yyalloc); yymsg = (char *) YYSTACK_ALLOC (yyalloc);
if (yymsg) if (yymsg)
yymsg_alloc = yyalloc; yymsg_alloc = yyalloc;
else else
{ {
yymsg = yymsgbuf; yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf; yymsg_alloc = sizeof yymsgbuf;
} }
} }
if (0 < yysize && yysize <= yymsg_alloc) if (0 < yysize && yysize <= yymsg_alloc)
{ {
(void) yysyntax_error (yymsg, yystate, yychar); (void) yysyntax_error (yymsg, yystate, yychar);
yyerror (yymsg); yyerror (yymsg);
} }
else else
{ {
yyerror (YY_("syntax error")); yyerror (YY_("syntax error"));
if (yysize != 0) if (yysize != 0)
goto yyexhaustedlab; goto yyexhaustedlab;
} }
} }
#endif #endif
} }
@ -1590,20 +1590,20 @@ yyerrlab:
if (yyerrstatus == 3) if (yyerrstatus == 3)
{ {
/* If just tried and failed to reuse look-ahead token after an /* If just tried and failed to reuse look-ahead token after an
error, discard it. */ error, discard it. */
if (yychar <= YYEOF) if (yychar <= YYEOF)
{ {
/* Return failure if at end of input. */ /* Return failure if at end of input. */
if (yychar == YYEOF) if (yychar == YYEOF)
YYABORT; YYABORT;
} }
else else
{ {
yydestruct ("Error: discarding", yydestruct ("Error: discarding",
yytoken, &yylval); yytoken, &yylval);
yychar = YYEMPTY; yychar = YYEMPTY;
} }
} }
/* Else will try to reuse look-ahead token after shifting the error /* Else will try to reuse look-ahead token after shifting the error
@ -1635,29 +1635,29 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. | | yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/ `-------------------------------------------------------------*/
yyerrlab1: yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;) for (;;)
{ {
yyn = yypact[yystate]; yyn = yypact[yystate];
if (yyn != YYPACT_NINF) if (yyn != YYPACT_NINF)
{ {
yyn += YYTERROR; yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{ {
yyn = yytable[yyn]; yyn = yytable[yyn];
if (0 < yyn) if (0 < yyn)
break; break;
} }
} }
/* Pop the current state because it cannot handle the error token. */ /* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss) if (yyssp == yyss)
YYABORT; YYABORT;
yydestruct ("Error: popping", yydestruct ("Error: popping",
yystos[yystate], yyvsp); yystos[yystate], yyvsp);
YYPOPSTACK (1); YYPOPSTACK (1);
yystate = *yyssp; yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
@ -1703,7 +1703,7 @@ yyexhaustedlab:
yyreturn: yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY) if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead", yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval); yytoken, &yylval);
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */ this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@ -1711,7 +1711,7 @@ yyreturn:
while (yyssp != yyss) while (yyssp != yyss)
{ {
yydestruct ("Cleanup: popping", yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp); yystos[*yyssp], yyvsp);
YYPOPSTACK (1); YYPOPSTACK (1);
} }
#ifndef yyoverflow #ifndef yyoverflow

View File

@ -78,7 +78,7 @@ typedef union YYSTYPE
} }
/* Line 1489 of yacc.c. */ /* Line 1489 of yacc.c. */
#line 81 "y.tab.h" #line 81 "y.tab.h"
YYSTYPE; YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1

View File

@ -40,7 +40,7 @@ static ObjectList_t *_paste_buffer;
static gpointer static gpointer
object_list_callback_add(ObjectListCallback_t *list, object_list_callback_add(ObjectListCallback_t *list,
ObjectListCallbackFunc_t func, gpointer data) ObjectListCallbackFunc_t func, gpointer data)
{ {
ObjectListCB_t *cb = g_new(ObjectListCB_t, 1); ObjectListCB_t *cb = g_new(ObjectListCB_t, 1);
cb->func = func; cb->func = func;
@ -67,49 +67,49 @@ object_list_callback_call(ObjectListCallback_t *list, Object_t *obj)
gpointer gpointer
object_list_add_changed_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_changed_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->changed_cb, func, data); return object_list_callback_add(&list->changed_cb, func, data);
} }
gpointer gpointer
object_list_add_update_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_update_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->update_cb, func, data); return object_list_callback_add(&list->update_cb, func, data);
} }
gpointer gpointer
object_list_add_add_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_add_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->add_cb, func, data); return object_list_callback_add(&list->add_cb, func, data);
} }
gpointer gpointer
object_list_add_remove_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_remove_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->remove_cb, func, data); return object_list_callback_add(&list->remove_cb, func, data);
} }
gpointer gpointer
object_list_add_select_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_select_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->select_cb, func, data); return object_list_callback_add(&list->select_cb, func, data);
} }
gpointer gpointer
object_list_add_move_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_move_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->move_cb, func, data); return object_list_callback_add(&list->move_cb, func, data);
} }
gpointer gpointer
object_list_add_geometry_cb(ObjectList_t *list, ObjectListCallbackFunc_t func, object_list_add_geometry_cb(ObjectList_t *list, ObjectListCallbackFunc_t func,
gpointer data) gpointer data)
{ {
return object_list_callback_add(&list->geometry_cb, func, data); return object_list_callback_add(&list->geometry_cb, func, data);
} }
@ -408,9 +408,9 @@ do_object_locked_dialog(void)
default_dialog_hide_cancel_button(dialog); default_dialog_hide_cancel_button(dialog);
default_dialog_hide_apply_button(dialog); default_dialog_hide_apply_button(dialog);
default_dialog_set_label( default_dialog_set_label(
dialog, dialog,
"\n You cannot delete the selected object \n" "\n You cannot delete the selected object \n"
"since it is currently being edited.\n"); "since it is currently being edited.\n");
} }
default_dialog_show(dialog); default_dialog_show(dialog);
} }
@ -423,7 +423,7 @@ object_factory_create_object(ObjectFactory_t *factory, gint x, gint y)
static gboolean static gboolean
button_motion(GtkWidget *widget, GdkEventMotion *event, button_motion(GtkWidget *widget, GdkEventMotion *event,
ObjectFactory_t *factory) ObjectFactory_t *factory)
{ {
gint x = get_real_coord((gint) event->x); gint x = get_real_coord((gint) event->x);
gint y = get_real_coord((gint) event->y); gint y = get_real_coord((gint) event->y);
@ -452,45 +452,45 @@ object_on_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data)
if (obj) { if (obj) {
if (event->button == 1) { if (event->button == 1) {
if (!factory->finish || factory->finish(obj, x, y)) { if (!factory->finish || factory->finish(obj, x, y)) {
g_signal_handlers_disconnect_by_func(widget, g_signal_handlers_disconnect_by_func(widget,
button_motion, button_motion,
factory); factory);
if (object_is_valid(obj)) { if (object_is_valid(obj)) {
Command_t *command = create_command_new(get_shapes(), obj); Command_t *command = create_command_new(get_shapes(), obj);
command_execute(command); command_execute(command);
if (preferences->prompt_for_area_info) if (preferences->prompt_for_area_info)
object_edit(obj, FALSE); object_edit(obj, FALSE);
} else { } else {
object_draw(obj, gtk_widget_get_window (widget)); object_draw(obj, gtk_widget_get_window (widget));
object_unref(obj); object_unref(obj);
} }
gdk_gc_set_function(preferences->normal_gc, GDK_COPY); gdk_gc_set_function(preferences->normal_gc, GDK_COPY);
obj = NULL; obj = NULL;
main_clear_dimension(); main_clear_dimension();
} }
} else if (event->button == 3) { } else if (event->button == 3) {
object_draw(obj, gtk_widget_get_window (widget)); object_draw(obj, gtk_widget_get_window (widget));
if (!factory->cancel || factory->cancel(event, obj)) { if (!factory->cancel || factory->cancel(event, obj)) {
g_signal_handlers_disconnect_by_func(widget, g_signal_handlers_disconnect_by_func(widget,
button_motion, button_motion,
factory); factory);
object_unref(obj); object_unref(obj);
gdk_gc_set_function(preferences->normal_gc, GDK_COPY); gdk_gc_set_function(preferences->normal_gc, GDK_COPY);
obj = NULL; obj = NULL;
main_clear_dimension(); main_clear_dimension();
} else { } else {
object_draw(obj, gtk_widget_get_window (widget)); object_draw(obj, gtk_widget_get_window (widget));
} }
} }
} else { } else {
if (event->button == 1) { if (event->button == 1) {
factory = ((ObjectFactory_t*(*)(guint)) data)(event->state); factory = ((ObjectFactory_t*(*)(guint)) data)(event->state);
obj = object_factory_create_object(factory, x, y); obj = object_factory_create_object(factory, x, y);
gdk_gc_set_function(preferences->normal_gc, GDK_XOR); gdk_gc_set_function(preferences->normal_gc, GDK_XOR);
g_signal_connect(widget, "motion-notify-event", g_signal_connect(widget, "motion-notify-event",
G_CALLBACK(button_motion), factory); G_CALLBACK(button_motion), factory);
} }
} }
@ -596,7 +596,7 @@ object_list_draw_selected(ObjectList_t *list, GdkWindow *window)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
object_draw(obj, window); object_draw(obj, window);
} }
} }
@ -608,25 +608,25 @@ object_list_find(ObjectList_t *list, gint x, gint y)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->class->point_is_on(obj, x, y)) if (obj->class->point_is_on(obj, x, y))
found = obj; found = obj;
} }
return found; return found;
} }
Object_t* Object_t*
object_list_near_sash(ObjectList_t *list, gint x, gint y, object_list_near_sash(ObjectList_t *list, gint x, gint y,
MoveSashFunc_t *sash_func) MoveSashFunc_t *sash_func)
{ {
Object_t *found = NULL; Object_t *found = NULL;
GList *p; GList *p;
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) { if (obj->selected) {
MoveSashFunc_t func = obj->class->near_sash(obj, x, y); MoveSashFunc_t func = obj->class->near_sash(obj, x, y);
if (func) { if (func) {
found = obj; found = obj;
*sash_func = func; *sash_func = func;
} }
} }
} }
return found; return found;
@ -672,13 +672,13 @@ object_list_cut(ObjectList_t *list)
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
q = p->next; q = p->next;
if (obj->selected) { if (obj->selected) {
if (obj->locked) { if (obj->locked) {
do_object_locked_dialog(); do_object_locked_dialog();
} else { } else {
object_list_append(_paste_buffer, obj); object_list_append(_paste_buffer, obj);
object_list_remove_link(list, p); object_list_remove_link(list, p);
count++; count++;
} }
} }
} }
object_list_set_changed(list, (count) ? TRUE : FALSE); object_list_set_changed(list, (count) ? TRUE : FALSE);
@ -694,7 +694,7 @@ object_list_copy_to_paste_buffer(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
object_list_append(_paste_buffer, object_clone(obj)); object_list_append(_paste_buffer, object_clone(obj));
} }
} }
@ -712,12 +712,12 @@ object_list_delete_selected(ObjectList_t *list)
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
q = p->next; q = p->next;
if (obj->selected) { if (obj->selected) {
if (obj->locked) { if (obj->locked) {
do_object_locked_dialog(); do_object_locked_dialog();
} else { } else {
object_list_remove_link(list, p); object_list_remove_link(list, p);
object_unref(obj); object_unref(obj);
} }
} }
} }
} }
@ -729,8 +729,8 @@ object_list_edit_selected(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) { if (obj->selected) {
object_edit(obj, TRUE); object_edit(obj, TRUE);
break; break;
} }
} }
} }
@ -743,8 +743,8 @@ object_list_select_all(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (!obj->selected) { if (!obj->selected) {
object_select(obj); object_select(obj);
count++; count++;
} }
} }
return count; return count;
@ -757,15 +757,15 @@ object_list_select_next(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) { if (obj->selected) {
object_unselect(obj); object_unselect(obj);
p = (p->next) ? p->next : list->list; p = (p->next) ? p->next : list->list;
object_select((Object_t*) p->data); object_select((Object_t*) p->data);
for (p = p->next; p; p = p->next) { for (p = p->next; p; p = p->next) {
obj = (Object_t*) p->data; obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
object_unselect(obj); object_unselect(obj);
} }
break; break;
} }
} }
} }
@ -776,21 +776,21 @@ void object_list_select_prev(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) { if (obj->selected) {
GList *q = (p->prev) ? p->prev : g_list_last(list->list); GList *q = (p->prev) ? p->prev : g_list_last(list->list);
for (; p; p = p->next) { for (; p; p = p->next) {
obj = (Object_t*) p->data; obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
object_unselect(obj); object_unselect(obj);
} }
object_select((Object_t*) q->data); object_select((Object_t*) q->data);
break; break;
} }
} }
} }
gint gint
object_list_select_region(ObjectList_t *list, gint x, gint y, gint width, object_list_select_region(ObjectList_t *list, gint x, gint y, gint width,
gint height) gint height)
{ {
GList *p; GList *p;
gint count = 0; gint count = 0;
@ -800,9 +800,9 @@ object_list_select_region(ObjectList_t *list, gint x, gint y, gint width,
object_get_dimensions(obj, &obj_x, &obj_y, &obj_width, &obj_height); object_get_dimensions(obj, &obj_x, &obj_y, &obj_width, &obj_height);
if (obj_x >= x && obj_x + obj_width <= x + width && if (obj_x >= x && obj_x + obj_width <= x + width &&
obj_y >= y && obj_y + obj_height <= y + height) { obj_y >= y && obj_y + obj_height <= y + height) {
object_select(obj); object_select(obj);
count++; count++;
} }
} }
return count; return count;
@ -816,8 +816,8 @@ object_list_deselect_all(ObjectList_t *list, Object_t *exception)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected && obj != exception) { if (obj->selected && obj != exception) {
object_unselect(obj); object_unselect(obj);
count++; count++;
} }
} }
return count; return count;
@ -831,7 +831,7 @@ object_list_nr_selected(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
count++; count++;
} }
return count; return count;
} }
@ -873,7 +873,7 @@ object_list_move_selected(ObjectList_t *list, gint dx, gint dy)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
object_move(obj, dx, dy); object_move(obj, dx, dy);
} }
} }
@ -899,7 +899,7 @@ object_list_move_selected_up(ObjectList_t *list)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected && p->prev) if (obj->selected && p->prev)
object_list_swap_prev(list, p); object_list_swap_prev(list, p);
} }
} }
@ -911,7 +911,7 @@ object_list_move_selected_down(ObjectList_t *list)
for (p = g_list_last(list->list); p; p = p->prev) { for (p = g_list_last(list->list); p; p = p->prev) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected && p->next) if (obj->selected && p->next)
object_list_swap_next(list, p); object_list_swap_next(list, p);
} }
} }
@ -925,8 +925,8 @@ object_list_move_to_front(ObjectList_t *list)
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
q = p->next; q = p->next;
if (obj->selected) { if (obj->selected) {
object_list_remove_link(list, p); object_list_remove_link(list, p);
object_list_append(list, obj); object_list_append(list, obj);
} }
} }
} }
@ -941,8 +941,8 @@ object_list_send_to_back(ObjectList_t *list)
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
q = p->next; q = p->next;
if (obj->selected) { if (obj->selected) {
object_list_remove_link(list, p); object_list_remove_link(list, p);
object_list_prepend(list, obj); object_list_prepend(list, obj);
} }
} }
} }
@ -954,14 +954,14 @@ object_list_move_sash_selected(ObjectList_t *list, gint dx, gint dy)
for (p = list->list; p; p = p->next) { for (p = list->list; p; p = p->next) {
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (obj->selected) if (obj->selected)
object_move_sash(obj, dx, dy); object_move_sash(obj, dx, dy);
} }
} }
static void static void
write_xml_attrib(const gchar *attrib, const gchar *value, write_xml_attrib(const gchar *attrib, const gchar *value,
const gchar *default_text, gpointer param, const gchar *default_text, gpointer param,
OutputFunc_t output) OutputFunc_t output)
{ {
if (*value) { if (*value) {
gchar *escaped_value = g_markup_escape_text(value, -1); gchar *escaped_value = g_markup_escape_text(value, -1);
@ -1012,7 +1012,7 @@ object_list_write_ncsa(ObjectList_t *list, gpointer param, OutputFunc_t output)
Object_t *obj = (Object_t*) p->data; Object_t *obj = (Object_t*) p->data;
if (*obj->comment) if (*obj->comment)
output(param, "# %s\n", obj->comment); output(param, "# %s\n", obj->comment);
obj->class->write_ncsa(obj, param, output); obj->class->write_ncsa(obj, param, output);
output(param, "\n"); output(param, "\n");
} }

View File

@ -31,18 +31,18 @@ typedef struct ObjectList_t ObjectList_t;
#include "imap_menu_funcs.h" #include "imap_menu_funcs.h"
struct Object_t { struct Object_t {
ObjectClass_t *class; ObjectClass_t *class;
ObjectList_t *list; ObjectList_t *list;
gint refcount; gint refcount;
gboolean selected; gboolean selected;
gboolean locked; gboolean locked;
gchar *url; gchar *url;
gchar *target; gchar *target;
gchar *comment; gchar *comment;
gchar *mouse_over; gchar *mouse_over;
gchar *mouse_out; gchar *mouse_out;
gchar *focus; gchar *focus;
gchar *blur; gchar *blur;
}; };
typedef void (*MoveSashFunc_t)(Object_t*, gint, gint); typedef void (*MoveSashFunc_t)(Object_t*, gint, gint);
@ -51,10 +51,10 @@ typedef void (*OutputFunc_t)(gpointer, const char*, ...) G_GNUC_PRINTF(2,3);
struct AreaInfoDialog_t; struct AreaInfoDialog_t;
struct ObjectClass_t { struct ObjectClass_t {
const gchar *name; const gchar *name;
AreaInfoDialog_t *info_dialog; AreaInfoDialog_t *info_dialog;
GdkPixmap *icon; GdkPixmap *icon;
GdkBitmap *mask; GdkBitmap *mask;
gboolean (*is_valid)(Object_t *obj); gboolean (*is_valid)(Object_t *obj);
void (*destruct)(Object_t *obj); void (*destruct)(Object_t *obj);
@ -66,7 +66,7 @@ struct ObjectClass_t {
MoveSashFunc_t (*near_sash)(Object_t *obj, gint x, gint y); MoveSashFunc_t (*near_sash)(Object_t *obj, gint x, gint y);
gboolean (*point_is_on)(Object_t *obj, gint x, gint y); gboolean (*point_is_on)(Object_t *obj, gint x, gint y);
void (*get_dimensions)(Object_t *obj, gint *x, gint *y, gint *width, void (*get_dimensions)(Object_t *obj, gint *x, gint *y, gint *width,
gint *height); gint *height);
void (*resize)(Object_t *obj, gint percentage_x, gint percentage_y); void (*resize)(Object_t *obj, gint percentage_x, gint percentage_y);
void (*move)(Object_t *obj, gint dx, gint dy); void (*move)(Object_t *obj, gint dx, gint dy);
gpointer (*create_info_widget)(GtkWidget *frame); gpointer (*create_info_widget)(GtkWidget *frame);
@ -110,28 +110,28 @@ void object_emit_geometry_signal(Object_t *obj);
void object_emit_update_signal(Object_t *obj); void object_emit_update_signal(Object_t *obj);
#define object_is_valid(obj) \ #define object_is_valid(obj) \
((obj)->class->is_valid(obj)) ((obj)->class->is_valid(obj))
#define object_get_dimensions(obj, x, y, width, height) \ #define object_get_dimensions(obj, x, y, width, height) \
((obj)->class->get_dimensions((obj), (x), (y), (width), (height))) ((obj)->class->get_dimensions((obj), (x), (y), (width), (height)))
#define object_normalize(obj) \ #define object_normalize(obj) \
((obj)->class->normalize(obj)) ((obj)->class->normalize(obj))
#define object_resize(obj, per_x, per_y) \ #define object_resize(obj, per_x, per_y) \
((obj)->class->resize((obj), (per_x), (per_y))) ((obj)->class->resize((obj), (per_x), (per_y)))
#define object_update(obj, data) \ #define object_update(obj, data) \
((obj)->class->update((obj), (data))) ((obj)->class->update((obj), (data)))
#define object_update_info_widget(obj, data) \ #define object_update_info_widget(obj, data) \
((obj)->class->update_info_widget((obj), (data))) ((obj)->class->update_info_widget((obj), (data)))
#define object_fill_info_tab(obj, data) \ #define object_fill_info_tab(obj, data) \
((obj)->class->fill_info_tab((obj), (data))) ((obj)->class->fill_info_tab((obj), (data)))
#define object_get_stock_icon_name(obj) \ #define object_get_stock_icon_name(obj) \
((obj)->class->get_stock_icon_name()) ((obj)->class->get_stock_icon_name())
typedef struct { typedef struct {
Object_t *obj; Object_t *obj;
@ -142,7 +142,7 @@ typedef struct {
} ObjectFactory_t; } ObjectFactory_t;
gboolean object_on_button_press(GtkWidget *widget, GdkEventButton *event, gboolean object_on_button_press(GtkWidget *widget, GdkEventButton *event,
gpointer data); gpointer data);
typedef struct { typedef struct {
GList *list; GList *list;
@ -175,7 +175,7 @@ void object_list_draw(ObjectList_t *list, GdkWindow *window);
void object_list_draw_selected(ObjectList_t *list, GdkWindow *window); void object_list_draw_selected(ObjectList_t *list, GdkWindow *window);
Object_t *object_list_find(ObjectList_t *list, gint x, gint y); Object_t *object_list_find(ObjectList_t *list, gint x, gint y);
Object_t *object_list_near_sash(ObjectList_t *list, gint x, gint y, Object_t *object_list_near_sash(ObjectList_t *list, gint x, gint y,
MoveSashFunc_t *sash_func); MoveSashFunc_t *sash_func);
gint object_list_cut(ObjectList_t *list); gint object_list_cut(ObjectList_t *list);
void object_list_copy_to_paste_buffer(ObjectList_t *list); void object_list_copy_to_paste_buffer(ObjectList_t *list);
@ -188,11 +188,11 @@ gint object_list_select_all(ObjectList_t *list);
void object_list_select_next(ObjectList_t *list); void object_list_select_next(ObjectList_t *list);
void object_list_select_prev(ObjectList_t *list); void object_list_select_prev(ObjectList_t *list);
gint object_list_select_region(ObjectList_t *list, gint x, gint y, gint width, gint object_list_select_region(ObjectList_t *list, gint x, gint y, gint width,
gint height); gint height);
gint object_list_deselect_all(ObjectList_t *list, Object_t *exception); gint object_list_deselect_all(ObjectList_t *list, Object_t *exception);
gint object_list_nr_selected(ObjectList_t *list); gint object_list_nr_selected(ObjectList_t *list);
void object_list_resize(ObjectList_t *list, gint percentage_x, void object_list_resize(ObjectList_t *list, gint percentage_x,
gint percentage_y); gint percentage_y);
void object_list_move_selected(ObjectList_t *list, gint dx, gint dy); void object_list_move_selected(ObjectList_t *list, gint dx, gint dy);
void object_list_move_up(ObjectList_t *list, Object_t *obj); void object_list_move_up(ObjectList_t *list, Object_t *obj);
void object_list_move_down(ObjectList_t *list, Object_t *obj); void object_list_move_down(ObjectList_t *list, Object_t *obj);
@ -203,33 +203,33 @@ void object_list_send_to_back(ObjectList_t *list);
void object_list_move_sash_selected(ObjectList_t *list, gint dx, gint dy); void object_list_move_sash_selected(ObjectList_t *list, gint dx, gint dy);
void object_list_write_csim(ObjectList_t *list, gpointer param, void object_list_write_csim(ObjectList_t *list, gpointer param,
OutputFunc_t output); OutputFunc_t output);
void object_list_write_cern(ObjectList_t *list, gpointer param, void object_list_write_cern(ObjectList_t *list, gpointer param,
OutputFunc_t output); OutputFunc_t output);
void object_list_write_ncsa(ObjectList_t *list, gpointer param, void object_list_write_ncsa(ObjectList_t *list, gpointer param,
OutputFunc_t output); OutputFunc_t output);
typedef void (*ObjectListCallbackFunc_t)(Object_t*, gpointer); typedef void (*ObjectListCallbackFunc_t)(Object_t*, gpointer);
gpointer object_list_add_changed_cb(ObjectList_t *list, gpointer object_list_add_changed_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, ObjectListCallbackFunc_t func,
gpointer data); gpointer data);
gpointer object_list_add_update_cb(ObjectList_t *list, gpointer object_list_add_update_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, ObjectListCallbackFunc_t func,
gpointer data); gpointer data);
gpointer object_list_add_add_cb(ObjectList_t *list, gpointer object_list_add_add_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, gpointer data); ObjectListCallbackFunc_t func, gpointer data);
gpointer object_list_add_remove_cb(ObjectList_t *list, gpointer object_list_add_remove_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, ObjectListCallbackFunc_t func,
gpointer data); gpointer data);
gpointer object_list_add_select_cb(ObjectList_t *list, gpointer object_list_add_select_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, ObjectListCallbackFunc_t func,
gpointer data); gpointer data);
gpointer object_list_add_move_cb(ObjectList_t *list, gpointer object_list_add_move_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, gpointer data); ObjectListCallbackFunc_t func, gpointer data);
gpointer object_list_add_geometry_cb(ObjectList_t *list, gpointer object_list_add_geometry_cb(ObjectList_t *list,
ObjectListCallbackFunc_t func, ObjectListCallbackFunc_t func,
gpointer data); gpointer data);
void object_list_remove_add_cb(ObjectList_t *list, gpointer id); void object_list_remove_add_cb(ObjectList_t *list, gpointer id);
void object_list_remove_select_cb(ObjectList_t *list, gpointer id); void object_list_remove_select_cb(ObjectList_t *list, gpointer id);
@ -239,13 +239,13 @@ void object_list_remove_geometry_cb(ObjectList_t *list, gpointer id);
#define object_list_clear_changed(list) ((list)->changed = FALSE) #define object_list_clear_changed(list) ((list)->changed = FALSE)
#define object_list_set_changed(list, ischanged) \ #define object_list_set_changed(list, ischanged) \
((list)->changed = (ischanged)) ((list)->changed = (ischanged))
#define object_list_get_changed(list) ((list)->changed) #define object_list_get_changed(list) ((list)->changed)
void clear_paste_buffer(void); void clear_paste_buffer(void);
gpointer paste_buffer_add_add_cb(ObjectListCallbackFunc_t func, gpointer data); gpointer paste_buffer_add_add_cb(ObjectListCallbackFunc_t func, gpointer data);
gpointer paste_buffer_add_remove_cb(ObjectListCallbackFunc_t func, gpointer paste_buffer_add_remove_cb(ObjectListCallbackFunc_t func,
gpointer data); gpointer data);
ObjectList_t *get_paste_buffer(void); ObjectList_t *get_paste_buffer(void);
void do_object_locked_dialog(void); void do_object_locked_dialog(void);

View File

@ -39,11 +39,11 @@ object_handle_popup(ObjectPopup_t *popup, Object_t *obj, GdkEventButton *event)
#ifdef _TEMP_ #ifdef _TEMP_
gtk_widget_set_sensitive(popup->up, (position > 1) ? TRUE : FALSE); gtk_widget_set_sensitive(popup->up, (position > 1) ? TRUE : FALSE);
gtk_widget_set_sensitive(popup->down, gtk_widget_set_sensitive(popup->down,
(position < g_list_length(obj->list->list)) (position < g_list_length(obj->list->list))
? TRUE : FALSE); ? TRUE : FALSE);
#endif #endif
gtk_menu_popup(GTK_MENU(popup->menu), NULL, NULL, NULL, NULL, gtk_menu_popup(GTK_MENU(popup->menu), NULL, NULL, NULL, NULL,
event->button, event->time); event->button, event->time);
} }
void void

View File

@ -33,7 +33,7 @@ typedef struct {
} ObjectPopup_t; } ObjectPopup_t;
void object_handle_popup(ObjectPopup_t *popup, Object_t *obj, void object_handle_popup(ObjectPopup_t *popup, Object_t *obj,
GdkEventButton *event); GdkEventButton *event);
void object_do_popup(Object_t *obj, GdkEventButton *event); void object_do_popup(Object_t *obj, GdkEventButton *event);
#endif /* _IMAP_OBJECT_POPUP_H */ #endif /* _IMAP_OBJECT_POPUP_H */

View File

@ -49,9 +49,9 @@ static void polygon_draw_sashes(Object_t* obj, GdkWindow *window, GdkGC* gc);
static MoveSashFunc_t polygon_near_sash(Object_t *obj, gint x, gint y); static MoveSashFunc_t polygon_near_sash(Object_t *obj, gint x, gint y);
static gboolean polygon_point_is_on(Object_t *obj, gint x, gint y); static gboolean polygon_point_is_on(Object_t *obj, gint x, gint y);
static void polygon_get_dimensions(Object_t *obj, gint *x, gint *y, static void polygon_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height); gint *width, gint *height);
static void polygon_resize(Object_t *obj, gint percentage_x, static void polygon_resize(Object_t *obj, gint percentage_x,
gint percentage_y); gint percentage_y);
static void polygon_move(Object_t *obj, gint dx, gint dy); static void polygon_move(Object_t *obj, gint dx, gint dy);
static gpointer polygon_create_info_widget(GtkWidget *frame); static gpointer polygon_create_info_widget(GtkWidget *frame);
static void polygon_update_info_widget(Object_t *obj, gpointer data); static void polygon_update_info_widget(Object_t *obj, gpointer data);
@ -59,25 +59,25 @@ static void polygon_fill_info_tab(Object_t *obj, gpointer data);
static void polygon_set_initial_focus(Object_t *obj, gpointer data); static void polygon_set_initial_focus(Object_t *obj, gpointer data);
static void polygon_update(Object_t* obj, gpointer data); static void polygon_update(Object_t* obj, gpointer data);
static void polygon_write_csim(Object_t* obj, gpointer param, static void polygon_write_csim(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void polygon_write_cern(Object_t* obj, gpointer param, static void polygon_write_cern(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void polygon_write_ncsa(Object_t* obj, gpointer param, static void polygon_write_ncsa(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void polygon_do_popup(Object_t *obj, GdkEventButton *event); static void polygon_do_popup(Object_t *obj, GdkEventButton *event);
static const gchar* polygon_get_stock_icon_name(void); static const gchar* polygon_get_stock_icon_name(void);
static ObjectClass_t polygon_class = { static ObjectClass_t polygon_class = {
N_("_Polygon"), N_("_Polygon"),
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */
polygon_is_valid, polygon_is_valid,
polygon_destruct, polygon_destruct,
polygon_clone, polygon_clone,
polygon_assign, polygon_assign,
NULL, /* polygon_normalize */ NULL, /* polygon_normalize */
polygon_draw, polygon_draw,
polygon_draw_sashes, polygon_draw_sashes,
polygon_near_sash, polygon_near_sash,
@ -193,8 +193,8 @@ polygon_near_sash(Object_t *obj, gint x, gint y)
for (p = polygon->points; p; p = p->next, _sash_index++) { for (p = polygon->points; p; p = p->next, _sash_index++) {
GdkPoint *point = (GdkPoint*) p->data; GdkPoint *point = (GdkPoint*) p->data;
if (near_sash(point->x, point->y, x, y)) { if (near_sash(point->x, point->y, x, y)) {
_sash_point = point; _sash_point = point;
return move_sash; return move_sash;
} }
} }
return NULL; return NULL;
@ -229,7 +229,7 @@ polygon_point_is_on(Object_t *obj, gint x, gint y)
for (; p; p = p->next) { for (; p; p = p->next) {
GdkPoint *point = (GdkPoint*) p->data; GdkPoint *point = (GdkPoint*) p->data;
if (right_intersect(prev, point, x, y)) if (right_intersect(prev, point, x, y))
count++; count++;
prev = point; prev = point;
} }
if (right_intersect(prev, first, x, y)) if (right_intersect(prev, first, x, y))
@ -240,7 +240,7 @@ polygon_point_is_on(Object_t *obj, gint x, gint y)
static void static void
polygon_get_dimensions(Object_t *obj, gint *x, gint *y, polygon_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height) gint *width, gint *height)
{ {
Polygon_t *polygon = ObjectToPolygon(obj); Polygon_t *polygon = ObjectToPolygon(obj);
gint min_x = G_MAXINT, min_y = G_MAXINT; gint min_x = G_MAXINT, min_y = G_MAXINT;
@ -250,13 +250,13 @@ polygon_get_dimensions(Object_t *obj, gint *x, gint *y,
for (p = polygon->points; p; p = p->next) { for (p = polygon->points; p; p = p->next) {
GdkPoint *point = (GdkPoint*) p->data; GdkPoint *point = (GdkPoint*) p->data;
if (point->x < min_x) if (point->x < min_x)
min_x = point->x; min_x = point->x;
if (point->x > max_x) if (point->x > max_x)
max_x = point->x; max_x = point->x;
if (point->y < min_y) if (point->y < min_y)
min_y = point->y; min_y = point->y;
if (point->y > max_y) if (point->y > max_y)
max_y = point->y; max_y = point->y;
} }
*x = min_x; *x = min_x;
*y = min_y; *y = min_y;
@ -298,7 +298,7 @@ typedef struct {
GtkWidget *insert; GtkWidget *insert;
GtkWidget *append; GtkWidget *append;
GtkWidget *remove; GtkWidget *remove;
gint selected_row; gint selected_row;
guint timeout; guint timeout;
} PolygonProperties_t; } PolygonProperties_t;
@ -342,7 +342,7 @@ static void
set_buttons_sensitivity(PolygonProperties_t *data) set_buttons_sensitivity(PolygonProperties_t *data)
{ {
gint rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL(data->store), gint rows = gtk_tree_model_iter_n_children (GTK_TREE_MODEL(data->store),
NULL); NULL);
gtk_widget_set_sensitive(data->insert, rows != MAX_POLYGON_POINTS); gtk_widget_set_sensitive(data->insert, rows != MAX_POLYGON_POINTS);
gtk_widget_set_sensitive(data->append, rows != MAX_POLYGON_POINTS); gtk_widget_set_sensitive(data->append, rows != MAX_POLYGON_POINTS);
gtk_widget_set_sensitive(data->remove, rows > 2); gtk_widget_set_sensitive(data->remove, rows > 2);
@ -364,7 +364,7 @@ insert_button_clicked(GtkWidget *widget, PolygonProperties_t *data)
gtk_tree_model_get (model, &iter, 0, &point, -1); gtk_tree_model_get (model, &iter, 0, &point, -1);
here = g_list_find(polygon->points, point); here = g_list_find(polygon->points, point);
polygon->points = g_list_insert_before(polygon->points, here, polygon->points = g_list_insert_before(polygon->points, here,
new_point(x, y)); new_point(x, y));
polygon_fill_info_tab(data->obj, data); polygon_fill_info_tab(data->obj, data);
} }
} }
@ -417,7 +417,7 @@ y_changed_cb(GtkWidget *widget, gpointer data)
static void static void
render_x(GtkTreeViewColumn *column, GtkCellRenderer *cell, render_x(GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
GdkPoint *point; GdkPoint *point;
gchar scratch[16]; gchar scratch[16];
@ -429,7 +429,7 @@ render_x(GtkTreeViewColumn *column, GtkCellRenderer *cell,
static void static void
render_y(GtkTreeViewColumn *column, GtkCellRenderer *cell, render_y(GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
GdkPoint *point; GdkPoint *point;
gchar scratch[16]; gchar scratch[16];
@ -457,9 +457,9 @@ polygon_create_info_widget(GtkWidget *frame)
swin = gtk_scrolled_window_new(NULL, NULL); swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(swin), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(swin),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(hbox), swin, FALSE, FALSE, FALSE); gtk_box_pack_start(GTK_BOX(hbox), swin, FALSE, FALSE, FALSE);
gtk_widget_show(swin); gtk_widget_show(swin);
@ -471,19 +471,19 @@ polygon_create_info_widget(GtkWidget *frame)
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("x (pixels)"), column = gtk_tree_view_column_new_with_attributes (_("x (pixels)"),
renderer, renderer,
NULL); NULL);
gtk_tree_view_column_set_cell_data_func(column, renderer, gtk_tree_view_column_set_cell_data_func(column, renderer,
render_x, props, NULL); render_x, props, NULL);
gtk_tree_view_column_set_alignment(column, 0.5); gtk_tree_view_column_set_alignment(column, 0.5);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column); gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("y (pixels)"), column = gtk_tree_view_column_new_with_attributes (_("y (pixels)"),
renderer, renderer,
NULL); NULL);
gtk_tree_view_column_set_cell_data_func(column, renderer, gtk_tree_view_column_set_cell_data_func(column, renderer,
render_y, props, NULL); render_y, props, NULL);
gtk_tree_view_column_set_alignment(column, 0.5); gtk_tree_view_column_set_alignment(column, 0.5);
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column); gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
@ -497,41 +497,41 @@ polygon_create_info_widget(GtkWidget *frame)
label = create_label_in_table(table, 0, 0, "_x:"); label = create_label_in_table(table, 0, 0, "_x:");
props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0, props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0,
max_width - 1); max_width - 1);
g_signal_connect(props->x, "changed", g_signal_connect(props->x, "changed",
G_CALLBACK(x_changed_cb), (gpointer) props); G_CALLBACK(x_changed_cb), (gpointer) props);
gtk_widget_set_size_request(props->x, 64, -1); gtk_widget_set_size_request(props->x, 64, -1);
create_label_in_table(table, 0, 2, _("pixels")); create_label_in_table(table, 0, 2, _("pixels"));
label = create_label_in_table(table, 1, 0, "_y:"); label = create_label_in_table(table, 1, 0, "_y:");
props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0, props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0,
max_height - 1); max_height - 1);
g_signal_connect(props->y, "changed", g_signal_connect(props->y, "changed",
G_CALLBACK(y_changed_cb), (gpointer) props); G_CALLBACK(y_changed_cb), (gpointer) props);
gtk_widget_set_size_request(props->y, 64, -1); gtk_widget_set_size_request(props->y, 64, -1);
create_label_in_table(table, 1, 2, _("pixels")); create_label_in_table(table, 1, 2, _("pixels"));
props->update = gtk_button_new_with_mnemonic(_("_Update")); props->update = gtk_button_new_with_mnemonic(_("_Update"));
g_signal_connect(props->update, "clicked", g_signal_connect(props->update, "clicked",
G_CALLBACK(update_button_clicked), props); G_CALLBACK(update_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), props->update, 1, 2, 2, 3); gtk_table_attach_defaults(GTK_TABLE(table), props->update, 1, 2, 2, 3);
gtk_widget_show(props->update); gtk_widget_show(props->update);
props->insert = gtk_button_new_with_mnemonic(_("_Insert")); props->insert = gtk_button_new_with_mnemonic(_("_Insert"));
g_signal_connect(props->insert, "clicked", g_signal_connect(props->insert, "clicked",
G_CALLBACK(insert_button_clicked), props); G_CALLBACK(insert_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), props->insert, 1, 2, 3, 4); gtk_table_attach_defaults(GTK_TABLE(table), props->insert, 1, 2, 3, 4);
gtk_widget_show(props->insert); gtk_widget_show(props->insert);
props->append = gtk_button_new_with_mnemonic(_("A_ppend")); props->append = gtk_button_new_with_mnemonic(_("A_ppend"));
g_signal_connect(props->append, "clicked", g_signal_connect(props->append, "clicked",
G_CALLBACK(append_button_clicked), props); G_CALLBACK(append_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), props->append, 1, 2, 4, 5); gtk_table_attach_defaults(GTK_TABLE(table), props->append, 1, 2, 4, 5);
gtk_widget_show(props->append); gtk_widget_show(props->append);
props->remove = gtk_button_new_with_mnemonic(_("_Remove")); props->remove = gtk_button_new_with_mnemonic(_("_Remove"));
g_signal_connect(props->remove, "clicked", g_signal_connect(props->remove, "clicked",
G_CALLBACK(remove_button_clicked), props); G_CALLBACK(remove_button_clicked), props);
gtk_table_attach_defaults(GTK_TABLE(table), props->remove, 1, 2, 5, 6); gtk_table_attach_defaults(GTK_TABLE(table), props->remove, 1, 2, 5, 6);
gtk_widget_show(props->remove); gtk_widget_show(props->remove);
@ -540,7 +540,7 @@ polygon_create_info_widget(GtkWidget *frame)
props->selection = gtk_tree_view_get_selection(GTK_TREE_VIEW (view)); props->selection = gtk_tree_view_get_selection(GTK_TREE_VIEW (view));
gtk_tree_selection_set_mode(props->selection, GTK_SELECTION_SINGLE); gtk_tree_selection_set_mode(props->selection, GTK_SELECTION_SINGLE);
g_signal_connect (props->selection, "changed", g_signal_connect (props->selection, "changed",
G_CALLBACK (select_row_cb), props); G_CALLBACK (select_row_cb), props);
return props; return props;
} }
@ -563,7 +563,7 @@ polygon_update_info_widget(Object_t *obj, gpointer data)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), _sash_point->y); gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), _sash_point->y);
if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(props->store), &iter, if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(props->store), &iter,
NULL, _sash_index)) { NULL, _sash_index)) {
gtk_tree_selection_select_iter(props->selection, &iter); gtk_tree_selection_select_iter(props->selection, &iter);
} }
@ -590,7 +590,7 @@ polygon_fill_info_tab(Object_t *obj, gpointer data)
} }
if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(props->store), &iter, if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(props->store), &iter,
NULL, _sash_index)) { NULL, _sash_index)) {
gtk_tree_selection_select_iter(props->selection, &iter); gtk_tree_selection_select_iter(props->selection, &iter);
} }
set_buttons_sensitivity(props); set_buttons_sensitivity(props);
@ -704,7 +704,7 @@ polygon_near_edge(Object_t *obj, gint x, gint y)
for (p = p->next; p; p = p->next, n++) { for (p = p->next; p; p = p->next, n++) {
GdkPoint *next = (GdkPoint*) p->data; GdkPoint *next = (GdkPoint*) p->data;
if (point_near_edge(prev, next, x, y)) if (point_near_edge(prev, next, x, y))
return n; return n;
prev = next; prev = next;
} }
return (point_near_edge(prev, first, x, y)) ? n + 1 : 0; return (point_near_edge(prev, first, x, y)) ? n + 1 : 0;
@ -819,7 +819,7 @@ polygon_factory_set_xy(Object_t *obj, guint state, gint x, gint y)
} }
static ObjectFactory_t polygon_factory = { static ObjectFactory_t polygon_factory = {
NULL, /* Object pointer */ NULL, /* Object pointer */
polygon_factory_finish, polygon_factory_finish,
polygon_factory_cancel, polygon_factory_cancel,
polygon_factory_create_object, polygon_factory_create_object,

View File

@ -42,34 +42,34 @@
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
typedef struct { typedef struct {
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
GtkWidget *notebook; GtkWidget *notebook;
GtkWidget *ncsa; GtkWidget *ncsa;
GtkWidget *cern; GtkWidget *cern;
GtkWidget *csim; GtkWidget *csim;
GtkWidget *prompt_for_area_info; GtkWidget *prompt_for_area_info;
GtkWidget *require_default_url; GtkWidget *require_default_url;
GtkWidget *show_area_handle; GtkWidget *show_area_handle;
GtkWidget *keep_circles_round; GtkWidget *keep_circles_round;
GtkWidget *show_url_tip; GtkWidget *show_url_tip;
GtkWidget *use_doublesized; GtkWidget *use_doublesized;
GtkWidget *undo_levels; GtkWidget *undo_levels;
GtkWidget *mru_size; GtkWidget *mru_size;
GtkWidget *normal_fg; GtkWidget *normal_fg;
GtkWidget *normal_bg; GtkWidget *normal_bg;
GtkWidget *selected_fg; GtkWidget *selected_fg;
GtkWidget *selected_bg; GtkWidget *selected_bg;
GtkWidget *threshold; GtkWidget *threshold;
GtkWidget *auto_convert; GtkWidget *auto_convert;
PreferencesData_t *old_data; PreferencesData_t *old_data;
} PreferencesDialog_t; } PreferencesDialog_t;
static void get_button_colors (PreferencesDialog_t *dialog, static void get_button_colors (PreferencesDialog_t *dialog,
ColorSelData_t *colors); ColorSelData_t *colors);
static gint static gint
parse_map_type(void) parse_map_type(void)
@ -117,7 +117,7 @@ parse_line(PreferencesData_t *data, char *line)
char *token; char *token;
ColorSelData_t *colors = &data->colors; ColorSelData_t *colors = &data->colors;
line++; /* Skip '(' */ line++; /* Skip '(' */
token = strtok(line, " "); token = strtok(line, " ");
if (!strcmp(token, "default-map-type")) { if (!strcmp(token, "default-map-type")) {
@ -137,11 +137,11 @@ parse_line(PreferencesData_t *data, char *line)
} else if (!strcmp(token, "mru-size")) { } else if (!strcmp(token, "mru-size")) {
data->mru_size = parse_int(); data->mru_size = parse_int();
if (data->mru_size < 1) if (data->mru_size < 1)
data->mru_size = 1; data->mru_size = 1;
} else if (!strcmp(token, "undo-levels")) { } else if (!strcmp(token, "undo-levels")) {
data->undo_levels = parse_int(); data->undo_levels = parse_int();
if (data->undo_levels < 1) if (data->undo_levels < 1)
data->undo_levels = 1; data->undo_levels = 1;
} else if (!strcmp(token, "normal-fg-color")) { } else if (!strcmp(token, "normal-fg-color")) {
parse_color(&colors->normal_fg); parse_color(&colors->normal_fg);
} else if (!strcmp(token, "normal-bg-color")) { } else if (!strcmp(token, "normal-bg-color")) {
@ -170,9 +170,9 @@ preferences_load(PreferencesData_t *data)
g_free(filename); g_free(filename);
if (in) { if (in) {
while (fgets(buf, sizeof(buf), in)) { while (fgets(buf, sizeof(buf), in)) {
if (*buf != '\n' && *buf != '#') { if (*buf != '\n' && *buf != '#') {
parse_line(data, buf); parse_line(data, buf);
} }
} }
fclose(in); fclose(in);
return TRUE; return TRUE;
@ -193,40 +193,40 @@ preferences_save(PreferencesData_t *data)
if (out) { if (out) {
fprintf(out, "# Image map plug-in resource file\n\n"); fprintf(out, "# Image map plug-in resource file\n\n");
if (data->default_map_type == NCSA) if (data->default_map_type == NCSA)
fprintf(out, "(default-map-type ncsa)\n"); fprintf(out, "(default-map-type ncsa)\n");
else if (data->default_map_type == CERN) else if (data->default_map_type == CERN)
fprintf(out, "(default-map-type cern)\n"); fprintf(out, "(default-map-type cern)\n");
else else
fprintf(out, "(default-map-type csim)\n"); fprintf(out, "(default-map-type csim)\n");
fprintf(out, "(prompt-for-area-info %s)\n", fprintf(out, "(prompt-for-area-info %s)\n",
(data->prompt_for_area_info) ? "yes" : "no"); (data->prompt_for_area_info) ? "yes" : "no");
fprintf(out, "(require-default-url %s)\n", fprintf(out, "(require-default-url %s)\n",
(data->require_default_url) ? "yes" : "no"); (data->require_default_url) ? "yes" : "no");
fprintf(out, "(show-area-handle %s)\n", fprintf(out, "(show-area-handle %s)\n",
(data->show_area_handle) ? "yes" : "no"); (data->show_area_handle) ? "yes" : "no");
fprintf(out, "(keep-circles-round %s)\n", fprintf(out, "(keep-circles-round %s)\n",
(data->keep_circles_round) ? "yes" : "no"); (data->keep_circles_round) ? "yes" : "no");
fprintf(out, "(show-url-tip %s)\n", fprintf(out, "(show-url-tip %s)\n",
(data->show_url_tip) ? "yes" : "no"); (data->show_url_tip) ? "yes" : "no");
fprintf(out, "(use-doublesized %s)\n", fprintf(out, "(use-doublesized %s)\n",
(data->use_doublesized) ? "yes" : "no"); (data->use_doublesized) ? "yes" : "no");
fprintf(out, "(undo-levels %d)\n", data->undo_levels); fprintf(out, "(undo-levels %d)\n", data->undo_levels);
fprintf(out, "(mru-size %d)\n", data->mru_size); fprintf(out, "(mru-size %d)\n", data->mru_size);
fprintf(out, "(normal-fg-color %d %d %d)\n", fprintf(out, "(normal-fg-color %d %d %d)\n",
colors->normal_fg.red, colors->normal_fg.green, colors->normal_fg.red, colors->normal_fg.green,
colors->normal_fg.blue); colors->normal_fg.blue);
fprintf(out, "(normal-bg-color %d %d %d)\n", fprintf(out, "(normal-bg-color %d %d %d)\n",
colors->normal_bg.red, colors->normal_bg.green, colors->normal_bg.red, colors->normal_bg.green,
colors->normal_bg.blue); colors->normal_bg.blue);
fprintf(out, "(selected-fg-color %d %d %d)\n", fprintf(out, "(selected-fg-color %d %d %d)\n",
colors->selected_fg.red, colors->selected_fg.green, colors->selected_fg.red, colors->selected_fg.green,
colors->selected_fg.blue); colors->selected_fg.blue);
fprintf(out, "(selected-bg-color %d %d %d)\n", fprintf(out, "(selected-bg-color %d %d %d)\n",
colors->selected_bg.red, colors->selected_bg.green, colors->selected_bg.red, colors->selected_bg.green,
colors->selected_bg.blue); colors->selected_bg.blue);
mru_write(get_mru(), out); mru_write(get_mru(), out);
@ -338,7 +338,7 @@ create_tab(GtkWidget *notebook, const gchar *label, gint rows, gint cols)
gtk_widget_show(table); gtk_widget_show(table);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
gtk_label_new_with_mnemonic(label)); gtk_label_new_with_mnemonic(label));
return table; return table;
} }
@ -380,7 +380,7 @@ create_general_tab(PreferencesDialog_t *data, GtkWidget *notebook)
create_check_button_in_table(table, 5, 0, _("Show area URL _tip")); create_check_button_in_table(table, 5, 0, _("Show area URL _tip"));
data->use_doublesized = data->use_doublesized =
create_check_button_in_table(table, 6, 0, create_check_button_in_table(table, 6, 0,
_("_Use double-sized grab handles")); _("_Use double-sized grab handles"));
gtk_widget_show(frame); gtk_widget_show(frame);
} }
@ -391,25 +391,25 @@ create_menu_tab(PreferencesDialog_t *data, GtkWidget *notebook)
GtkWidget *label; GtkWidget *label;
label = create_label_in_table(table, 0, 0, label = create_label_in_table(table, 0, 0,
_("Number of _undo levels (1 - 99):")); _("Number of _undo levels (1 - 99):"));
data->undo_levels = create_spin_button_in_table(table, label, 0, 1, 1, 1, data->undo_levels = create_spin_button_in_table(table, label, 0, 1, 1, 1,
99); 99);
label = create_label_in_table(table, 1, 0, label = create_label_in_table(table, 1, 0,
_("Number of M_RU entries (1 - 16):")); _("Number of M_RU entries (1 - 16):"));
data->mru_size = create_spin_button_in_table(table, label, 1, 1, 1, 1, 16); data->mru_size = create_spin_button_in_table(table, label, 1, 1, 1, 1, 16);
} }
static GtkWidget* static GtkWidget*
create_color_field(PreferencesDialog_t *data, GtkWidget *table, gint row, create_color_field(PreferencesDialog_t *data, GtkWidget *table, gint row,
gint col) gint col)
{ {
GimpRGB color = {0.0, 0.0, 0.0, 1.0}; GimpRGB color = {0.0, 0.0, 0.0, 1.0};
GtkWidget *area = gimp_color_button_new (_("Select Color"), 16, 8, &color, GtkWidget *area = gimp_color_button_new (_("Select Color"), 16, 8, &color,
GIMP_COLOR_AREA_FLAT); GIMP_COLOR_AREA_FLAT);
gimp_color_button_set_update (GIMP_COLOR_BUTTON (area), TRUE); gimp_color_button_set_update (GIMP_COLOR_BUTTON (area), TRUE);
gtk_table_attach_defaults (GTK_TABLE (table), area, col, col + 1, row, gtk_table_attach_defaults (GTK_TABLE (table), area, col, col + 1, row,
row + 1); row + 1);
gtk_widget_show (area); gtk_widget_show (area);
return area; return area;
@ -437,7 +437,7 @@ create_contiguous_regions_tab(PreferencesDialog_t *data, GtkWidget *notebook)
GtkWidget *label; GtkWidget *label;
label = create_label_in_table(table, 0, 0, label = create_label_in_table(table, 0, 0,
_("_Threshold:")); _("_Threshold:"));
data->auto_convert = data->auto_convert =
create_check_button_in_table(table, 1, 0, _("_Automatically convert")); create_check_button_in_table(table, 1, 0, _("_Automatically convert"));
} }
@ -491,20 +491,20 @@ do_preferences_dialog(void)
GTK_TOGGLE_BUTTON(dialog->prompt_for_area_info), GTK_TOGGLE_BUTTON(dialog->prompt_for_area_info),
old_data->prompt_for_area_info); old_data->prompt_for_area_info);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->require_default_url), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->require_default_url),
old_data->require_default_url); old_data->require_default_url);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->show_area_handle), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->show_area_handle),
old_data->show_area_handle); old_data->show_area_handle);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->keep_circles_round), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->keep_circles_round),
old_data->keep_circles_round); old_data->keep_circles_round);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->show_url_tip), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->show_url_tip),
old_data->show_url_tip); old_data->show_url_tip);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->use_doublesized), gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->use_doublesized),
old_data->use_doublesized); old_data->use_doublesized);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->undo_levels), gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->undo_levels),
old_data->undo_levels); old_data->undo_levels);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->mru_size), gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->mru_size),
old_data->mru_size); old_data->mru_size);
set_button_colors(dialog, &old_data->colors); set_button_colors(dialog, &old_data->colors);

View File

@ -33,20 +33,20 @@ typedef struct {
} ColorSelData_t; } ColorSelData_t;
typedef struct { typedef struct {
gint default_map_type; gint default_map_type;
gboolean prompt_for_area_info; gboolean prompt_for_area_info;
gboolean require_default_url; gboolean require_default_url;
gboolean show_area_handle; gboolean show_area_handle;
gboolean keep_circles_round; gboolean keep_circles_round;
gboolean show_url_tip; gboolean show_url_tip;
gboolean use_doublesized; gboolean use_doublesized;
gboolean auto_convert; gboolean auto_convert;
gdouble threshold; gdouble threshold;
gint undo_levels; gint undo_levels;
gint mru_size; gint mru_size;
ColorSelData_t colors; ColorSelData_t colors;
GdkGC *normal_gc; GdkGC *normal_gc;
GdkGC *selected_gc; GdkGC *selected_gc;
} PreferencesData_t; } PreferencesData_t;
void do_preferences_dialog(void); void do_preferences_dialog(void);

View File

@ -35,26 +35,26 @@
#include "imap_preview.h" #include "imap_preview.h"
#define PREVIEW_MASK (GDK_EXPOSURE_MASK | \ #define PREVIEW_MASK (GDK_EXPOSURE_MASK | \
GDK_POINTER_MOTION_MASK | \ GDK_POINTER_MOTION_MASK | \
GDK_BUTTON_PRESS_MASK | \ GDK_BUTTON_PRESS_MASK | \
GDK_BUTTON_RELEASE_MASK | \ GDK_BUTTON_RELEASE_MASK | \
GDK_BUTTON_MOTION_MASK | \ GDK_BUTTON_MOTION_MASK | \
GDK_KEY_PRESS_MASK | \ GDK_KEY_PRESS_MASK | \
GDK_KEY_RELEASE_MASK | \ GDK_KEY_RELEASE_MASK | \
GDK_ENTER_NOTIFY_MASK | \ GDK_ENTER_NOTIFY_MASK | \
GDK_LEAVE_NOTIFY_MASK) GDK_LEAVE_NOTIFY_MASK)
#define PREVIEW_SIZE 400 #define PREVIEW_SIZE 400
/*====================================================================== /*======================================================================
Preview Rendering Util routine Preview Rendering Util routine
=======================================================================*/ =======================================================================*/
#define CHECKWIDTH 4 #define CHECKWIDTH 4
#define LIGHTCHECK 192 #define LIGHTCHECK 192
#define DARKCHECK 128 #define DARKCHECK 128
#ifndef OPAQUE #ifndef OPAQUE
#define OPAQUE 255 #define OPAQUE 255
#endif #endif
static Preview_t* static Preview_t*
@ -78,10 +78,10 @@ preview_get_height(GtkWidget *preview)
static void static void
render_gray_image(Preview_t *preview_base, GimpPixelRgn *srcrgn) render_gray_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
{ {
guchar *src_row, *dest_buffer, *src, *dest; guchar *src_row, *dest_buffer, *src, *dest;
gint row, col; gint row, col;
gint bpp, dwidth, dheight, pwidth, pheight; gint bpp, dwidth, dheight, pwidth, pheight;
gint *src_col; gint *src_col;
GtkWidget *preview = preview_base->preview; GtkWidget *preview = preview_base->preview;
dwidth = srcrgn->w; dwidth = srcrgn->w;
@ -101,13 +101,13 @@ render_gray_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
for (row = 0; row < pheight; row++) { for (row = 0; row < pheight; row++) {
gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight, gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight,
dwidth); dwidth);
src = src_row; src = src_row;
for (col = 0; col < pwidth; col++) { for (col = 0; col < pwidth; col++) {
src = &src_row[src_col[col]]; src = &src_row[src_col[col]];
*dest++ = *src; *dest++ = *src;
} }
} }
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview), gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
@ -124,14 +124,14 @@ render_gray_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
static void static void
render_indexed_image(Preview_t *preview_base, GimpPixelRgn *srcrgn) render_indexed_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
{ {
guchar *src_row, *dest_buffer, *src, *dest; guchar *src_row, *dest_buffer, *src, *dest;
gint row, col; gint row, col;
gint dwidth, dheight, pwidth, pheight; gint dwidth, dheight, pwidth, pheight;
gint *src_col; gint *src_col;
gint bpp, alpha, has_alpha; gint bpp, alpha, has_alpha;
guchar *cmap, *colour; guchar *cmap, *colour;
gint ncols; gint ncols;
gboolean gray = get_map_info()->show_gray; gboolean gray = get_map_info()->show_gray;
GtkWidget *preview = preview_base->preview; GtkWidget *preview = preview_base->preview;
dwidth = srcrgn->w; dwidth = srcrgn->w;
@ -157,23 +157,23 @@ render_indexed_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
dest = dest_buffer; dest = dest_buffer;
for (row = 0; row < pheight; row++) { for (row = 0; row < pheight; row++) {
gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight, gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight,
dwidth); dwidth);
for (col = 0; col < pwidth; col++) { for (col = 0; col < pwidth; col++) {
src = &src_row[src_col[col]]; src = &src_row[src_col[col]];
colour = cmap + 3 * (int)(*src); colour = cmap + 3 * (int)(*src);
if (gray) { if (gray) {
guchar avg = (299 * colour[0] + 587 * colour[1] + guchar avg = (299 * colour[0] + 587 * colour[1] +
114 * colour[2]) / 1000; 114 * colour[2]) / 1000;
*dest++ = avg; *dest++ = avg;
*dest++ = avg; *dest++ = avg;
*dest++ = avg; *dest++ = avg;
} else { } else {
*dest++ = colour[0]; *dest++ = colour[0];
*dest++ = colour[1]; *dest++ = colour[1];
*dest++ = colour[2]; *dest++ = colour[2];
} }
} }
} }
gimp_preview_area_draw(GIMP_PREVIEW_AREA(preview), gimp_preview_area_draw(GIMP_PREVIEW_AREA(preview),
@ -189,13 +189,13 @@ render_indexed_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
static void static void
render_rgb_image(Preview_t *preview_base, GimpPixelRgn *srcrgn) render_rgb_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
{ {
guchar *src_row, *dest_buffer, *src, *dest; guchar *src_row, *dest_buffer, *src, *dest;
gint row, col; gint row, col;
gint dwidth, dheight, pwidth, pheight; gint dwidth, dheight, pwidth, pheight;
gint *src_col; gint *src_col;
gint bpp, alpha, has_alpha, b; gint bpp, alpha, has_alpha, b;
guchar check; guchar check;
gboolean gray = get_map_info()->show_gray; gboolean gray = get_map_info()->show_gray;
GtkWidget *preview = preview_base->preview; GtkWidget *preview = preview_base->preview;
dwidth = srcrgn->w; dwidth = srcrgn->w;
@ -218,39 +218,39 @@ render_rgb_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
dest = dest_buffer; dest = dest_buffer;
for (row = 0; row < pheight; row++) { for (row = 0; row < pheight; row++) {
gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight, gimp_pixel_rgn_get_row(srcrgn, src_row, 0, row * dheight / pheight,
dwidth); dwidth);
for (col = 0; col < pwidth; col++) { for (col = 0; col < pwidth; col++) {
src = &src_row[src_col[col]]; src = &src_row[src_col[col]];
if(!has_alpha || src[alpha] == OPAQUE) { if(!has_alpha || src[alpha] == OPAQUE) {
/* no alpha channel or opaque -- simple way */ /* no alpha channel or opaque -- simple way */
for (b = 0; b < alpha; b++) for (b = 0; b < alpha; b++)
dest[b] = src[b]; dest[b] = src[b];
} else { } else {
/* more or less transparent */ /* more or less transparent */
if( ( col % (CHECKWIDTH*2) < CHECKWIDTH ) ^ if( ( col % (CHECKWIDTH*2) < CHECKWIDTH ) ^
( row % (CHECKWIDTH*2) < CHECKWIDTH ) ) ( row % (CHECKWIDTH*2) < CHECKWIDTH ) )
check = LIGHTCHECK; check = LIGHTCHECK;
else else
check = DARKCHECK; check = DARKCHECK;
if (src[alpha] == 0) { if (src[alpha] == 0) {
/* full transparent -- check */ /* full transparent -- check */
for (b = 0; b < alpha; b++) for (b = 0; b < alpha; b++)
dest[b] = check; dest[b] = check;
} else { } else {
/* middlemost transparent -- mix check and src */ /* middlemost transparent -- mix check and src */
for (b = 0; b < alpha; b++) for (b = 0; b < alpha; b++)
dest[b] = (src[b] * src[alpha] + dest[b] = (src[b] * src[alpha] +
check * (OPAQUE - src[alpha])) / OPAQUE; check * (OPAQUE - src[alpha])) / OPAQUE;
} }
} }
if (gray) { if (gray) {
guchar avg; guchar avg;
avg = (299 * dest[0] + 587 * dest[1] + 114 * dest[2]) / 1000; avg = (299 * dest[0] + 587 * dest[1] + 114 * dest[2]) / 1000;
for (b = 0; b < alpha; b++) for (b = 0; b < alpha; b++)
dest[b] = avg; dest[b] = avg;
} }
dest += alpha; dest += alpha;
} }
} }
gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview), gimp_preview_area_draw (GIMP_PREVIEW_AREA (preview),
@ -304,7 +304,7 @@ add_preview_motion_event(Preview_t *preview, GCallback func)
g_return_if_fail (func != NULL); g_return_if_fail (func != NULL);
g_signal_connect(preview->preview, "motion-notify-event", g_signal_connect(preview->preview, "motion-notify-event",
func, NULL); func, NULL);
} }
void void
@ -313,7 +313,7 @@ add_enter_notify_event(Preview_t *preview, GCallback func)
g_return_if_fail (func != NULL); g_return_if_fail (func != NULL);
g_signal_connect(preview->preview, "enter-notify-event", g_signal_connect(preview->preview, "enter-notify-event",
func, NULL); func, NULL);
} }
void void
@ -322,7 +322,7 @@ add_leave_notify_event(Preview_t *preview, GCallback func)
g_return_if_fail (func != NULL); g_return_if_fail (func != NULL);
g_signal_connect(preview->preview, "leave-notify-event", g_signal_connect(preview->preview, "leave-notify-event",
func, NULL); func, NULL);
} }
void void
@ -331,7 +331,7 @@ add_preview_button_press_event(Preview_t *preview, GCallback func)
g_return_if_fail (func != NULL); g_return_if_fail (func != NULL);
g_signal_connect(preview->preview, "button-press-event", g_signal_connect(preview->preview, "button-press-event",
func, NULL); func, NULL);
} }
void void
@ -376,7 +376,7 @@ static const GtkTargetEntry target_table[] =
static void static void
handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *data, guint info, guint time) GtkSelectionData *data, guint info, guint time)
{ {
gboolean success = FALSE; gboolean success = FALSE;
@ -441,15 +441,15 @@ make_preview (GimpDrawable *drawable)
g_object_set_data (G_OBJECT (preview), "preview", data); g_object_set_data (G_OBJECT (preview), "preview", data);
gtk_widget_set_events(GTK_WIDGET(preview), PREVIEW_MASK); gtk_widget_set_events(GTK_WIDGET(preview), PREVIEW_MASK);
g_signal_connect_after(preview, "expose-event", g_signal_connect_after(preview, "expose-event",
G_CALLBACK(preview_expose), data); G_CALLBACK(preview_expose), data);
g_signal_connect (preview, "size-allocate", g_signal_connect (preview, "size-allocate",
G_CALLBACK (preview_size_allocate), (gpointer)data); G_CALLBACK (preview_size_allocate), (gpointer)data);
/* Handle drop of links in preview widget */ /* Handle drop of links in preview widget */
gtk_drag_dest_set(preview, GTK_DEST_DEFAULT_ALL, target_table, gtk_drag_dest_set(preview, GTK_DEST_DEFAULT_ALL, target_table,
2, GDK_ACTION_COPY); 2, GDK_ACTION_COPY);
g_signal_connect(preview, "drag-data-received", g_signal_connect(preview, "drag-data-received",
G_CALLBACK(handle_drop), NULL); G_CALLBACK(handle_drop), NULL);
data->widget_width = data->width = data->widget_width = data->width =
gimp_drawable_width(drawable->drawable_id); gimp_drawable_width(drawable->drawable_id);
@ -467,11 +467,11 @@ make_preview (GimpDrawable *drawable)
button = gtk_button_new(); button = gtk_button_new();
gtk_widget_set_can_focus (button, FALSE); gtk_widget_set_can_focus (button, FALSE);
gtk_table_attach(GTK_TABLE(table), button, 0, 1, 0, 1, GTK_FILL, GTK_FILL, gtk_table_attach(GTK_TABLE(table), button, 0, 1, 0, 1, GTK_FILL, GTK_FILL,
0, 0); 0, 0);
gtk_widget_set_events(button, gtk_widget_set_events(button,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
g_signal_connect(button, "button-press-event", g_signal_connect(button, "button-press-event",
G_CALLBACK(arrow_cb), NULL); G_CALLBACK(arrow_cb), NULL);
gtk_widget_show(button); gtk_widget_show(button);
arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT); arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
@ -481,8 +481,8 @@ make_preview (GimpDrawable *drawable)
/* Create horizontal ruler */ /* Create horizontal ruler */
data->hruler = ruler = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL); data->hruler = ruler = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL);
g_signal_connect_swapped(preview, "motion-notify-event", g_signal_connect_swapped(preview, "motion-notify-event",
G_CALLBACK(GTK_WIDGET_GET_CLASS(ruler)->motion_notify_event), G_CALLBACK(GTK_WIDGET_GET_CLASS(ruler)->motion_notify_event),
ruler); ruler);
gtk_table_attach(GTK_TABLE(table), ruler, 1, 2, 0, 1, gtk_table_attach(GTK_TABLE(table), ruler, 1, 2, 0, 1,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
@ -491,20 +491,20 @@ make_preview (GimpDrawable *drawable)
/* Create vertical ruler */ /* Create vertical ruler */
data->vruler = ruler = gimp_ruler_new (GTK_ORIENTATION_VERTICAL); data->vruler = ruler = gimp_ruler_new (GTK_ORIENTATION_VERTICAL);
g_signal_connect_swapped(preview, "motion-notify-event", g_signal_connect_swapped(preview, "motion-notify-event",
G_CALLBACK(GTK_WIDGET_GET_CLASS(ruler)->motion_notify_event), G_CALLBACK(GTK_WIDGET_GET_CLASS(ruler)->motion_notify_event),
ruler); ruler);
gtk_table_attach(GTK_TABLE(table), ruler, 0, 1, 1, 2, gtk_table_attach(GTK_TABLE(table), ruler, 0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show(ruler); gtk_widget_show(ruler);
window = gtk_scrolled_window_new (NULL, NULL); window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER); GTK_POLICY_NEVER, GTK_POLICY_NEVER);
width = (data->width > 600) ? 600 : data->width; width = (data->width > 600) ? 600 : data->width;
height = (data->height > 400) ? 400 : data->height; height = (data->height > 400) ? 400 : data->height;
gtk_widget_set_size_request(window, width, height); gtk_widget_set_size_request(window, width, height);
gtk_table_attach(GTK_TABLE(table), window, 1, 2, 1, 2, GTK_FILL, GTK_FILL, gtk_table_attach(GTK_TABLE(table), window, 1, 2, 1, 2, GTK_FILL, GTK_FILL,
0, 0); 0, 0);
gtk_widget_show(window); gtk_widget_show(window);
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (window)); hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (window));
@ -540,7 +540,7 @@ make_preview (GimpDrawable *drawable)
gtk_widget_show (preview); gtk_widget_show (preview);
gimp_pixel_rgn_init(&data->src_rgn, drawable, 0, 0, data->width, gimp_pixel_rgn_init(&data->src_rgn, drawable, 0, 0, data->width,
data->height, FALSE, FALSE); data->height, FALSE, FALSE);
render_preview(data, &data->src_rgn); render_preview(data, &data->src_rgn);
gtk_widget_show(table); gtk_widget_show(table);

View File

@ -27,12 +27,12 @@
typedef struct { typedef struct {
GimpDrawable *drawable; GimpDrawable *drawable;
GtkWidget *window; GtkWidget *window;
GtkWidget *preview; GtkWidget *preview;
GtkWidget *hruler; GtkWidget *hruler;
GtkWidget *vruler; GtkWidget *vruler;
gint width; gint width;
gint height; gint height;
gint widget_width; gint widget_width;
gint widget_height; gint widget_height;
GimpPixelRgn src_rgn; GimpPixelRgn src_rgn;
@ -53,6 +53,6 @@ gint preview_get_height(GtkWidget *preview);
void preview_zoom(Preview_t *preview, gint zoom_factor); void preview_zoom(Preview_t *preview, gint zoom_factor);
GdkCursorType preview_set_cursor(Preview_t *preview, GdkCursorType preview_set_cursor(Preview_t *preview,
GdkCursorType cursor_type); GdkCursorType cursor_type);
#endif /* _IMAP_PREVIEW_H */ #endif /* _IMAP_PREVIEW_H */

View File

@ -48,30 +48,30 @@ static void rectangle_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC* gc);
static MoveSashFunc_t rectangle_near_sash(Object_t *obj, gint x, gint y); static MoveSashFunc_t rectangle_near_sash(Object_t *obj, gint x, gint y);
static gboolean rectangle_point_is_on(Object_t *obj, gint x, gint y); static gboolean rectangle_point_is_on(Object_t *obj, gint x, gint y);
static void rectangle_get_dimensions(Object_t *obj, gint *x, gint *y, static void rectangle_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height); gint *width, gint *height);
static void rectangle_resize(Object_t *obj, gint percentage_x, static void rectangle_resize(Object_t *obj, gint percentage_x,
gint percentage_y); gint percentage_y);
static void rectangle_move(Object_t *obj, gint dx, gint dy); static void rectangle_move(Object_t *obj, gint dx, gint dy);
static gpointer rectangle_create_info_widget(GtkWidget *frame); static gpointer rectangle_create_info_widget(GtkWidget *frame);
static void rectangle_fill_info_tab(Object_t *obj, gpointer data); static void rectangle_fill_info_tab(Object_t *obj, gpointer data);
static void rectangle_set_initial_focus(Object_t *obj, gpointer data); static void rectangle_set_initial_focus(Object_t *obj, gpointer data);
static void rectangle_update(Object_t *obj, gpointer data); static void rectangle_update(Object_t *obj, gpointer data);
static void rectangle_write_csim(Object_t *obj, gpointer param, static void rectangle_write_csim(Object_t *obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void rectangle_write_cern(Object_t *obj, gpointer param, static void rectangle_write_cern(Object_t *obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void rectangle_write_ncsa(Object_t *obj, gpointer param, static void rectangle_write_ncsa(Object_t *obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static const gchar* rectangle_get_stock_icon_name(void); static const gchar* rectangle_get_stock_icon_name(void);
static ObjectClass_t rectangle_class = { static ObjectClass_t rectangle_class = {
N_("_Rectangle"), N_("_Rectangle"),
NULL, /* info_dialog */ NULL, /* info_dialog */
NULL, /* icon */ NULL, /* icon */
NULL, /* mask */ NULL, /* mask */
rectangle_is_valid, rectangle_is_valid,
NULL, /* rectangle_destruct */ NULL, /* rectangle_destruct */
rectangle_clone, rectangle_clone,
rectangle_assign, rectangle_assign,
rectangle_normalize, rectangle_normalize,
@ -83,7 +83,7 @@ static ObjectClass_t rectangle_class = {
rectangle_resize, rectangle_resize,
rectangle_move, rectangle_move,
rectangle_create_info_widget, rectangle_create_info_widget,
rectangle_fill_info_tab, /* rectangle_update_info_widget */ rectangle_fill_info_tab, /* rectangle_update_info_widget */
rectangle_fill_info_tab, rectangle_fill_info_tab,
rectangle_set_initial_focus, rectangle_set_initial_focus,
rectangle_update, rectangle_update,
@ -107,7 +107,7 @@ create_rectangle(gint x, gint y, gint width, gint height)
static void static void
draw_any_rectangle(GdkWindow *window, GdkGC *gc, gint x, gint y, gint w, draw_any_rectangle(GdkWindow *window, GdkGC *gc, gint x, gint y, gint w,
gint h) gint h)
{ {
if (w < 0) { if (w < 0) {
x += w; x += w;
@ -170,7 +170,7 @@ rectangle_draw(Object_t *obj, GdkWindow *window, GdkGC *gc)
{ {
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
draw_any_rectangle(window, gc, rectangle->x, rectangle->y, draw_any_rectangle(window, gc, rectangle->x, rectangle->y,
rectangle->width, rectangle->height); rectangle->width, rectangle->height);
} }
static void static void
@ -182,12 +182,12 @@ rectangle_draw_sashes(Object_t *obj, GdkWindow *window, GdkGC *gc)
draw_sash(window, gc, rectangle->x + rectangle->width, rectangle->y); draw_sash(window, gc, rectangle->x + rectangle->width, rectangle->y);
draw_sash(window, gc, rectangle->x, rectangle->y + rectangle->height / 2); draw_sash(window, gc, rectangle->x, rectangle->y + rectangle->height / 2);
draw_sash(window, gc, rectangle->x + rectangle->width, draw_sash(window, gc, rectangle->x + rectangle->width,
rectangle->y + rectangle->height / 2); rectangle->y + rectangle->height / 2);
draw_sash(window, gc, rectangle->x, rectangle->y + rectangle->height); draw_sash(window, gc, rectangle->x, rectangle->y + rectangle->height);
draw_sash(window, gc, rectangle->x + rectangle->width / 2, draw_sash(window, gc, rectangle->x + rectangle->width / 2,
rectangle->y + rectangle->height); rectangle->y + rectangle->height);
draw_sash(window, gc, rectangle->x + rectangle->width, draw_sash(window, gc, rectangle->x + rectangle->width,
rectangle->y + rectangle->height); rectangle->y + rectangle->height);
} }
static void static void
@ -267,18 +267,18 @@ rectangle_near_sash(Object_t *obj, gint x, gint y)
else if (near_sash(rectangle->x + rectangle->width, rectangle->y, x, y)) else if (near_sash(rectangle->x + rectangle->width, rectangle->y, x, y))
return MoveUpperRightSash; return MoveUpperRightSash;
else if (near_sash(rectangle->x, rectangle->y + rectangle->height / 2, else if (near_sash(rectangle->x, rectangle->y + rectangle->height / 2,
x, y)) x, y))
return MoveLeftSash; return MoveLeftSash;
else if (near_sash(rectangle->x + rectangle->width, else if (near_sash(rectangle->x + rectangle->width,
rectangle->y + rectangle->height / 2, x, y)) rectangle->y + rectangle->height / 2, x, y))
return MoveRightSash; return MoveRightSash;
else if (near_sash(rectangle->x, rectangle->y + rectangle->height, x, y)) else if (near_sash(rectangle->x, rectangle->y + rectangle->height, x, y))
return MoveLowerLeftSash; return MoveLowerLeftSash;
else if (near_sash(rectangle->x + rectangle->width / 2, else if (near_sash(rectangle->x + rectangle->width / 2,
rectangle->y + rectangle->height, x, y)) rectangle->y + rectangle->height, x, y))
return MoveLowerSash; return MoveLowerSash;
else if (near_sash(rectangle->x + rectangle->width, else if (near_sash(rectangle->x + rectangle->width,
rectangle->y + rectangle->height, x, y)) rectangle->y + rectangle->height, x, y))
return MoveLowerRightSash; return MoveLowerRightSash;
return NULL; return NULL;
} }
@ -293,7 +293,7 @@ rectangle_point_is_on(Object_t *obj, gint x, gint y)
static void static void
rectangle_get_dimensions(Object_t *obj, gint *x, gint *y, rectangle_get_dimensions(Object_t *obj, gint *x, gint *y,
gint *width, gint *height) gint *width, gint *height)
{ {
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
*x = rectangle->x; *x = rectangle->x;
@ -387,30 +387,30 @@ rectangle_create_info_widget(GtkWidget *frame)
label = create_label_in_table(table, 0, 0, _("Upper left _x:")); label = create_label_in_table(table, 0, 0, _("Upper left _x:"));
props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0, props->x = create_spin_button_in_table(table, label, 0, 1, 1, 0,
max_width - 1); max_width - 1);
g_signal_connect(props->x, "value-changed", g_signal_connect(props->x, "value-changed",
G_CALLBACK(x_changed_cb), (gpointer) props); G_CALLBACK(x_changed_cb), (gpointer) props);
create_label_in_table(table, 0, 3, _("pixels")); create_label_in_table(table, 0, 3, _("pixels"));
label = create_label_in_table(table, 1, 0, _("Upper left _y:")); label = create_label_in_table(table, 1, 0, _("Upper left _y:"));
props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0, props->y = create_spin_button_in_table(table, label, 1, 1, 1, 0,
max_height - 1); max_height - 1);
g_signal_connect(props->y, "value-changed", g_signal_connect(props->y, "value-changed",
G_CALLBACK(y_changed_cb), (gpointer) props); G_CALLBACK(y_changed_cb), (gpointer) props);
create_label_in_table(table, 1, 3, _("pixels")); create_label_in_table(table, 1, 3, _("pixels"));
label = create_label_in_table(table, 2, 0, _("_Width:")); label = create_label_in_table(table, 2, 0, _("_Width:"));
props->width = create_spin_button_in_table(table, label, 2, 1, 1, 1, props->width = create_spin_button_in_table(table, label, 2, 1, 1, 1,
max_width); max_width);
g_signal_connect(props->width, "value-changed", g_signal_connect(props->width, "value-changed",
G_CALLBACK(width_changed_cb), (gpointer) props); G_CALLBACK(width_changed_cb), (gpointer) props);
create_label_in_table(table, 2, 3, _("pixels")); create_label_in_table(table, 2, 3, _("pixels"));
label = create_label_in_table(table, 3, 0, _("_Height:")); label = create_label_in_table(table, 3, 0, _("_Height:"));
props->height = create_spin_button_in_table(table, label, 3, 1, 1, 1, props->height = create_spin_button_in_table(table, label, 3, 1, 1, 1,
max_height); max_height);
g_signal_connect(props->height, "value-changed", g_signal_connect(props->height, "value-changed",
G_CALLBACK(height_changed_cb), (gpointer) props); G_CALLBACK(height_changed_cb), (gpointer) props);
create_label_in_table(table, 3, 3, _("pixels")); create_label_in_table(table, 3, 3, _("pixels"));
chain_button = gimp_chain_button_new(GIMP_CHAIN_RIGHT); chain_button = gimp_chain_button_new(GIMP_CHAIN_RIGHT);
@ -432,7 +432,7 @@ rectangle_fill_info_tab(Object_t *obj, gpointer data)
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), rectangle->y); gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->y), rectangle->y);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->width), rectangle->width); gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->width), rectangle->width);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->height), gtk_spin_button_set_value(GTK_SPIN_BUTTON(props->height),
rectangle->height); rectangle->height);
} }
static void static void
@ -461,7 +461,7 @@ rectangle_write_csim(Object_t *obj, gpointer param, OutputFunc_t output)
{ {
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
output(param, "\"rect\" coords=\"%d,%d,%d,%d\"", rectangle->x, rectangle->y, output(param, "\"rect\" coords=\"%d,%d,%d,%d\"", rectangle->x, rectangle->y,
rectangle->x + rectangle->width, rectangle->y + rectangle->height); rectangle->x + rectangle->width, rectangle->y + rectangle->height);
} }
static void static void
@ -469,7 +469,7 @@ rectangle_write_cern(Object_t *obj, gpointer param, OutputFunc_t output)
{ {
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
output(param, "rect (%d,%d) (%d,%d)", rectangle->x, rectangle->y, output(param, "rect (%d,%d) (%d,%d)", rectangle->x, rectangle->y,
rectangle->x + rectangle->width, rectangle->y + rectangle->height); rectangle->x + rectangle->width, rectangle->y + rectangle->height);
} }
static void static void
@ -477,8 +477,8 @@ rectangle_write_ncsa(Object_t *obj, gpointer param, OutputFunc_t output)
{ {
Rectangle_t *rectangle = ObjectToRectangle(obj); Rectangle_t *rectangle = ObjectToRectangle(obj);
output(param, "rect %s %d,%d %d,%d", obj->url, output(param, "rect %s %d,%d %d,%d", obj->url,
rectangle->x, rectangle->y, rectangle->x, rectangle->y,
rectangle->x + rectangle->width, rectangle->y + rectangle->height); rectangle->x + rectangle->width, rectangle->y + rectangle->height);
} }
static const gchar* static const gchar*
@ -518,18 +518,18 @@ rectangle_factory_set_xy(Object_t *obj, guint state, gint x, gint y)
gint width = abs(rectangle->width); gint width = abs(rectangle->width);
gint height = abs(rectangle->height); gint height = abs(rectangle->height);
if (width < height) if (width < height)
rectangle->height = (rectangle->height < 0) ? -width : width; rectangle->height = (rectangle->height < 0) ? -width : width;
else else
rectangle->width = (rectangle->width < 0) ? -height : height; rectangle->width = (rectangle->width < 0) ? -height : height;
} }
main_set_dimension(rectangle->width, rectangle->height); main_set_dimension(rectangle->width, rectangle->height);
} }
static ObjectFactory_t rectangle_factory = { static ObjectFactory_t rectangle_factory = {
NULL, /* Object pointer */ NULL, /* Object pointer */
rectangle_factory_finish, rectangle_factory_finish,
NULL, /* Cancel func */ NULL, /* Cancel func */
rectangle_factory_create_object, rectangle_factory_create_object,
rectangle_factory_set_xy rectangle_factory_set_xy
}; };

View File

@ -90,17 +90,17 @@ button_press_cb(GtkWidget *widget, GdkEventButton *event, Selection_t *data)
data->doubleclick = FALSE; data->doubleclick = FALSE;
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
(gint) event->x, (gint) event->y, (gint) event->x, (gint) event->y,
&path, NULL, NULL, NULL)) { &path, NULL, NULL, NULL)) {
GtkTreeIter iter; GtkTreeIter iter;
if (gtk_tree_model_get_iter (GTK_TREE_MODEL (data->store), &iter, if (gtk_tree_model_get_iter (GTK_TREE_MODEL (data->store), &iter,
path)) { path)) {
Object_t *obj; Object_t *obj;
gtk_tree_model_get (GTK_TREE_MODEL(data->store), &iter, 0, &obj, -1); gtk_tree_model_get (GTK_TREE_MODEL(data->store), &iter, 0, &obj, -1);
object_edit (obj, TRUE); object_edit (obj, TRUE);
} }
gtk_tree_path_free (path); gtk_tree_path_free (path);
} }
} else { } else {
data->doubleclick = TRUE; data->doubleclick = TRUE;
@ -123,7 +123,7 @@ selection_set_selected(Selection_t *selection, gint row)
GtkTreeIter iter; GtkTreeIter iter;
if (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (selection->store), &iter, if (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (selection->store), &iter,
NULL, row)) { NULL, row)) {
Object_t *obj; Object_t *obj;
gtk_tree_model_get (GTK_TREE_MODEL(selection->store), &iter, 0, &obj, -1); gtk_tree_model_get (GTK_TREE_MODEL(selection->store), &iter, 0, &obj, -1);
@ -156,20 +156,20 @@ object_added_cb(Object_t *obj, gpointer data)
static gboolean static gboolean
selection_find_object(Selection_t *selection, Object_t *lookup, selection_find_object(Selection_t *selection, Object_t *lookup,
GtkTreeIter *iter) GtkTreeIter *iter)
{ {
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selection->store), if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (selection->store),
iter)) { iter)) {
do { do {
Object_t *obj; Object_t *obj;
gtk_tree_model_get (GTK_TREE_MODEL(selection->store), iter, 0, gtk_tree_model_get (GTK_TREE_MODEL(selection->store), iter, 0,
&obj, -1); &obj, -1);
if (obj == lookup) if (obj == lookup)
return TRUE; return TRUE;
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (selection->store), } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (selection->store),
iter)); iter));
} }
return FALSE; return FALSE;
} }
@ -185,7 +185,7 @@ object_updated_cb(Object_t *obj, gpointer data)
path = gtk_tree_model_get_path (GTK_TREE_MODEL (selection->store), &iter); path = gtk_tree_model_get_path (GTK_TREE_MODEL (selection->store), &iter);
gtk_tree_model_row_changed (GTK_TREE_MODEL (selection->store), path, gtk_tree_model_row_changed (GTK_TREE_MODEL (selection->store), path,
&iter); &iter);
} }
} }
@ -231,7 +231,7 @@ selection_get_object (GtkTreeModel *tree_model, GtkTreeIter *iter)
static void static void
handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y, handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *data, guint info, guint time) GtkSelectionData *data, guint info, guint time)
{ {
gboolean success = FALSE; gboolean success = FALSE;
@ -266,7 +266,7 @@ handle_drop(GtkWidget *widget, GdkDragContext *context, gint x, gint y,
static void static void
render_image (GtkTreeViewColumn *column, GtkCellRenderer *cell, render_image (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
Object_t *obj = selection_get_object (tree_model, iter); Object_t *obj = selection_get_object (tree_model, iter);
g_object_set(cell, "stock-id", object_get_stock_icon_name(obj), NULL); g_object_set(cell, "stock-id", object_get_stock_icon_name(obj), NULL);
@ -274,7 +274,7 @@ render_image (GtkTreeViewColumn *column, GtkCellRenderer *cell,
static void static void
render_nr (GtkTreeViewColumn *column, GtkCellRenderer *cell, render_nr (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
Object_t *obj = selection_get_object (tree_model, iter); Object_t *obj = selection_get_object (tree_model, iter);
gchar *scratch; gchar *scratch;
@ -286,7 +286,7 @@ render_nr (GtkTreeViewColumn *column, GtkCellRenderer *cell,
static void static void
render_url (GtkTreeViewColumn *column, GtkCellRenderer *cell, render_url (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
Object_t *obj = selection_get_object (tree_model, iter); Object_t *obj = selection_get_object (tree_model, iter);
g_object_set (cell, "text", obj->url, NULL); g_object_set (cell, "text", obj->url, NULL);
@ -294,7 +294,7 @@ render_url (GtkTreeViewColumn *column, GtkCellRenderer *cell,
static void static void
render_target (GtkTreeViewColumn *column, GtkCellRenderer *cell, render_target (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
Object_t *obj = selection_get_object (tree_model, iter); Object_t *obj = selection_get_object (tree_model, iter);
g_object_set (cell, "text", obj->target, NULL); g_object_set (cell, "text", obj->target, NULL);
@ -302,7 +302,7 @@ render_target (GtkTreeViewColumn *column, GtkCellRenderer *cell,
static void static void
render_comment (GtkTreeViewColumn *column, GtkCellRenderer *cell, render_comment (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
Object_t *obj = selection_get_object (tree_model, iter); Object_t *obj = selection_get_object (tree_model, iter);
g_object_set (cell, "text", obj->comment, NULL); g_object_set (cell, "text", obj->comment, NULL);
@ -348,10 +348,10 @@ make_selection(ObjectList_t *object_list)
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (N_("#"), column = gtk_tree_view_column_new_with_attributes (N_("#"),
renderer, renderer,
NULL); NULL);
gtk_tree_view_column_set_cell_data_func (column, renderer, gtk_tree_view_column_set_cell_data_func (column, renderer,
render_nr, data, NULL); render_nr, data, NULL);
gtk_tree_view_column_set_min_width (column, 16); gtk_tree_view_column_set_min_width (column, 16);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
@ -363,12 +363,12 @@ make_selection(ObjectList_t *object_list)
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_pack_start(column, renderer, FALSE);
gtk_tree_view_column_set_cell_data_func (column, renderer, gtk_tree_view_column_set_cell_data_func (column, renderer,
render_image, data, NULL); render_image, data, NULL);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_pack_start (column, renderer, TRUE);
gtk_tree_view_column_set_cell_data_func (column, renderer, render_url, data, gtk_tree_view_column_set_cell_data_func (column, renderer, render_url, data,
NULL); NULL);
gtk_tree_view_column_set_min_width (column, 80); gtk_tree_view_column_set_min_width (column, 80);
gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
@ -377,9 +377,9 @@ make_selection(ObjectList_t *object_list)
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("ALT Text"), renderer, column = gtk_tree_view_column_new_with_attributes (_("ALT Text"), renderer,
NULL); NULL);
gtk_tree_view_column_set_cell_data_func (column, renderer, render_comment, gtk_tree_view_column_set_cell_data_func (column, renderer, render_comment,
data, NULL); data, NULL);
gtk_tree_view_column_set_min_width (column, 64); gtk_tree_view_column_set_min_width (column, 64);
gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
@ -387,9 +387,9 @@ make_selection(ObjectList_t *object_list)
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Target"), renderer, column = gtk_tree_view_column_new_with_attributes (_("Target"), renderer,
NULL); NULL);
gtk_tree_view_column_set_cell_data_func (column, renderer, gtk_tree_view_column_set_cell_data_func (column, renderer,
render_target, data, NULL); render_target, data, NULL);
gtk_tree_view_column_set_min_width (column, 64); gtk_tree_view_column_set_min_width (column, 64);
gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_alignment (column, 0.5); gtk_tree_view_column_set_alignment (column, 0.5);
@ -407,15 +407,15 @@ make_selection(ObjectList_t *object_list)
/* Drop support */ /* Drop support */
gtk_drag_dest_set (list, GTK_DEST_DEFAULT_ALL, target_table, 2, gtk_drag_dest_set (list, GTK_DEST_DEFAULT_ALL, target_table, 2,
GDK_ACTION_COPY); GDK_ACTION_COPY);
g_signal_connect (list, "drag-data-received", G_CALLBACK(handle_drop), NULL); g_signal_connect (list, "drag-data-received", G_CALLBACK(handle_drop), NULL);
/* For handling doubleclick */ /* For handling doubleclick */
g_signal_connect (list, "button-press-event", g_signal_connect (list, "button-press-event",
G_CALLBACK(button_press_cb), data); G_CALLBACK(button_press_cb), data);
g_signal_connect (list, "button-release-event", g_signal_connect (list, "button-release-event",
G_CALLBACK(button_release_cb), data); G_CALLBACK(button_release_cb), data);
/* Callbacks we are interested in */ /* Callbacks we are interested in */
data->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list)); data->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));

View File

@ -27,18 +27,18 @@
#include "imap_object.h" #include "imap_object.h"
typedef struct { typedef struct {
GtkListStore *store; GtkListStore *store;
GtkTreeSelection *selection; GtkTreeSelection *selection;
GtkWidget *container; GtkWidget *container;
GtkWidget *list; GtkWidget *list;
GtkWidget *selected_child; GtkWidget *selected_child;
ObjectList_t *object_list; ObjectList_t *object_list;
gint selected_row; gint selected_row;
gint nr_rows; gint nr_rows;
gboolean is_visible; gboolean is_visible;
gboolean select_lock; gboolean select_lock;
gboolean doubleclick; gboolean doubleclick;
CommandFactory_t cmd_move_up; CommandFactory_t cmd_move_up;
CommandFactory_t cmd_move_down; CommandFactory_t cmd_move_down;
@ -52,13 +52,13 @@ void selection_freeze(Selection_t *selection);
void selection_thaw(Selection_t *selection); void selection_thaw(Selection_t *selection);
#define selection_set_move_up_command(selection, command) \ #define selection_set_move_up_command(selection, command) \
((selection)->cmd_move_up = (command)) ((selection)->cmd_move_up = (command))
#define selection_set_move_down_command(selection, command) \ #define selection_set_move_down_command(selection, command) \
((selection)->cmd_move_down = (command)) ((selection)->cmd_move_down = (command))
#define selection_set_delete_command(selection, command) \ #define selection_set_delete_command(selection, command) \
((selection)->cmd_delete = (command)) ((selection)->cmd_delete = (command))
#define selection_set_edit_command(selection, command) \ #define selection_set_edit_command(selection, command) \
((selection)->cmd_edit = (command)) ((selection)->cmd_edit = (command))
#endif /* _IMAP_SELECTION_H */ #endif /* _IMAP_SELECTION_H */

View File

@ -37,13 +37,13 @@
typedef struct { typedef struct {
DefaultDialog_t *dialog; DefaultDialog_t *dialog;
BrowseWidget_t *imagename; BrowseWidget_t *imagename;
GtkWidget *filename; GtkWidget *filename;
GtkWidget *title; GtkWidget *title;
GtkWidget *author; GtkWidget *author;
GtkWidget *default_url; GtkWidget *default_url;
GtkWidget *ncsa; GtkWidget *ncsa;
GtkWidget *cern; GtkWidget *cern;
GtkWidget *csim; GtkWidget *csim;
GtkTextBuffer *description; GtkTextBuffer *description;
} SettingsDialog_t; } SettingsDialog_t;
@ -62,10 +62,10 @@ settings_ok_cb(gpointer data)
g_strreplace(&info->title, gtk_entry_get_text(GTK_ENTRY(param->title))); g_strreplace(&info->title, gtk_entry_get_text(GTK_ENTRY(param->title)));
g_strreplace(&info->author, gtk_entry_get_text(GTK_ENTRY(param->author))); g_strreplace(&info->author, gtk_entry_get_text(GTK_ENTRY(param->author)));
g_strreplace(&info->default_url, g_strreplace(&info->default_url,
gtk_entry_get_text(GTK_ENTRY(param->default_url))); gtk_entry_get_text(GTK_ENTRY(param->default_url)));
gtk_text_buffer_get_bounds(param->description, &start, &end); gtk_text_buffer_get_bounds(param->description, &start, &end);
description = gtk_text_buffer_get_text(param->description, &start, &end, description = gtk_text_buffer_get_text(param->description, &start, &end,
FALSE); FALSE);
g_strreplace(&info->description, description); g_strreplace(&info->description, description);
g_free(description); g_free(description);
@ -96,7 +96,7 @@ create_settings_dialog(void)
create_label_in_table(table, 1, 0, _("Image name:")); create_label_in_table(table, 1, 0, _("Image name:"));
data->imagename = browse_widget_new(_("Select Image File")); data->imagename = browse_widget_new(_("Select Image File"));
gtk_table_attach_defaults(GTK_TABLE(table), data->imagename->hbox, 1, 2, gtk_table_attach_defaults(GTK_TABLE(table), data->imagename->hbox, 1, 2,
1, 2); 1, 2);
label = create_label_in_table(table, 2, 0, _("_Title:")); label = create_label_in_table(table, 2, 0, _("_Title:"));
data->title = create_entry_in_table(table, label, 2, 1); data->title = create_entry_in_table(table, label, 2, 1);
@ -116,13 +116,13 @@ create_settings_dialog(void)
swin = gtk_scrolled_window_new(NULL, NULL); swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin), gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_table_attach(GTK_TABLE(table), swin, 1, 2, 5, 8, gtk_table_attach(GTK_TABLE(table), swin, 1, 2, 5, 8,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL,
GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_show(swin); gtk_widget_show(swin);
gtk_container_add(GTK_CONTAINER(swin), view); gtk_container_add(GTK_CONTAINER(swin), view);
@ -135,21 +135,21 @@ create_settings_dialog(void)
data->ncsa = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_NCSA"); data->ncsa = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_NCSA");
g_signal_connect(data->ncsa, "toggled", g_signal_connect(data->ncsa, "toggled",
G_CALLBACK(type_toggled_cb), (gpointer) NCSA); G_CALLBACK(type_toggled_cb), (gpointer) NCSA);
gtk_box_pack_start(GTK_BOX(hbox), data->ncsa, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->ncsa, FALSE, FALSE, 0);
gtk_widget_show(data->ncsa); gtk_widget_show(data->ncsa);
data->cern = gtk_radio_button_new_with_mnemonic_from_widget( data->cern = gtk_radio_button_new_with_mnemonic_from_widget(
GTK_RADIO_BUTTON(data->ncsa), "C_ERN"); GTK_RADIO_BUTTON(data->ncsa), "C_ERN");
g_signal_connect(data->cern, "toggled", g_signal_connect(data->cern, "toggled",
G_CALLBACK(type_toggled_cb), (gpointer) CERN); G_CALLBACK(type_toggled_cb), (gpointer) CERN);
gtk_box_pack_start(GTK_BOX(hbox), data->cern, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->cern, FALSE, FALSE, 0);
gtk_widget_show(data->cern); gtk_widget_show(data->cern);
data->csim = gtk_radio_button_new_with_mnemonic_from_widget( data->csim = gtk_radio_button_new_with_mnemonic_from_widget(
GTK_RADIO_BUTTON(data->cern), "C_SIM"); GTK_RADIO_BUTTON(data->cern), "C_SIM");
g_signal_connect(data->csim, "toggled", g_signal_connect(data->csim, "toggled",
G_CALLBACK(type_toggled_cb), (gpointer) CSIM); G_CALLBACK(type_toggled_cb), (gpointer) CSIM);
gtk_box_pack_start(GTK_BOX(hbox), data->csim, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), data->csim, FALSE, FALSE, 0);
gtk_widget_show(data->csim); gtk_widget_show(data->csim);

View File

@ -75,12 +75,12 @@ do_source_dialog(void)
swin = gtk_scrolled_window_new(NULL, NULL); swin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin), gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swin),
GTK_SHADOW_IN); GTK_SHADOW_IN);
gtk_widget_set_size_request(swin, 400, 300); gtk_widget_set_size_request(swin, 400, 300);
gtk_box_pack_start(GTK_BOX(dialog->vbox), swin, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(dialog->vbox), swin, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_widget_show(swin); gtk_widget_show(swin);
gtk_container_add(GTK_CONTAINER(swin), text); gtk_container_add(GTK_CONTAINER(swin), text);
} }

View File

@ -33,8 +33,8 @@
StatusBar_t* StatusBar_t*
make_statusbar(GtkWidget *main_vbox, GtkWidget *window) make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
{ {
StatusBar_t *statusbar = g_new(StatusBar_t, 1); StatusBar_t *statusbar = g_new(StatusBar_t, 1);
GtkWidget *hbox, *iconw; GtkWidget *hbox, *iconw;
hbox = gtk_hbox_new(FALSE, 1); hbox = gtk_hbox_new(FALSE, 1);
gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(main_vbox), hbox, FALSE, FALSE, 0);
@ -48,7 +48,7 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
/* (x, y) coordinate */ /* (x, y) coordinate */
iconw = gtk_image_new_from_stock(IMAP_STOCK_COORD, iconw = gtk_image_new_from_stock(IMAP_STOCK_COORD,
GTK_ICON_SIZE_SMALL_TOOLBAR); GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10);
gtk_widget_show(iconw); gtk_widget_show(iconw);
@ -62,7 +62,7 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
/* Dimension info */ /* Dimension info */
iconw = gtk_image_new_from_stock(IMAP_STOCK_DIMENSION, iconw = gtk_image_new_from_stock(IMAP_STOCK_DIMENSION,
GTK_ICON_SIZE_SMALL_TOOLBAR); GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10);
gtk_widget_show(iconw); gtk_widget_show(iconw);
@ -98,8 +98,8 @@ statusbar_set_status(StatusBar_t *statusbar, const gchar *format, ...)
statusbar_clear_status(statusbar); statusbar_clear_status(statusbar);
statusbar->message_id = statusbar->message_id =
gtk_statusbar_push(GTK_STATUSBAR(statusbar->status), gtk_statusbar_push(GTK_STATUSBAR(statusbar->status),
statusbar->status_id, scratch); statusbar->status_id, scratch);
} }
void void
@ -107,8 +107,8 @@ statusbar_clear_status(StatusBar_t *statusbar)
{ {
if (statusbar->message_id) if (statusbar->message_id)
gtk_statusbar_remove(GTK_STATUSBAR(statusbar->status), gtk_statusbar_remove(GTK_STATUSBAR(statusbar->status),
statusbar->status_id, statusbar->status_id,
statusbar->message_id); statusbar->message_id);
} }
void void
@ -147,5 +147,5 @@ statusbar_set_zoom(StatusBar_t *statusbar, gint factor)
sprintf(scratch, "1:%d", factor); sprintf(scratch, "1:%d", factor);
gtk_statusbar_push(GTK_STATUSBAR(statusbar->zoom), statusbar->zoom_id, gtk_statusbar_push(GTK_STATUSBAR(statusbar->zoom), statusbar->zoom_id,
scratch); scratch);
} }

View File

@ -32,13 +32,13 @@ static GtkIconFactory *imap_icon_factory = NULL;
static GtkStockItem imap_stock_items[] = static GtkStockItem imap_stock_items[] =
{ {
{ IMAP_STOCK_CIRCLE, NULL, 0, 0, NULL }, { IMAP_STOCK_CIRCLE, NULL, 0, 0, NULL },
{ IMAP_STOCK_COORD, NULL, 0, 0, NULL }, { IMAP_STOCK_COORD, NULL, 0, 0, NULL },
{ IMAP_STOCK_DIMENSION, NULL, 0, 0, NULL }, { IMAP_STOCK_DIMENSION, NULL, 0, 0, NULL },
{ IMAP_STOCK_JAVA, NULL, 0, 0, NULL }, { IMAP_STOCK_JAVA, NULL, 0, 0, NULL },
{ IMAP_STOCK_POLYGON, NULL, 0, 0, NULL }, { IMAP_STOCK_POLYGON, NULL, 0, 0, NULL },
{ IMAP_STOCK_RECTANGLE, NULL, 0, 0, NULL }, { IMAP_STOCK_RECTANGLE, NULL, 0, 0, NULL },
{ IMAP_STOCK_TO_BACK, NULL, 0, 0, NULL }, { IMAP_STOCK_TO_BACK, NULL, 0, 0, NULL },
{ IMAP_STOCK_TO_FRONT, NULL, 0, 0, NULL } { IMAP_STOCK_TO_FRONT, NULL, 0, 0, NULL }
}; };

View File

@ -36,7 +36,7 @@ add_widget_to_table(GtkWidget *table, int row, int col, GtkWidget *w)
GtkWidget* GtkWidget*
create_spin_button_in_table(GtkWidget *table, GtkWidget *label, create_spin_button_in_table(GtkWidget *table, GtkWidget *label,
int row, int col, int value, int min, int max) int row, int col, int value, int min, int max)
{ {
GtkObject *adj = gtk_adjustment_new(value, min, max, 1, 1, 1); GtkObject *adj = gtk_adjustment_new(value, min, max, 1, 1, 1);
GtkWidget *button = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0); GtkWidget *button = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
@ -48,7 +48,7 @@ create_spin_button_in_table(GtkWidget *table, GtkWidget *label,
GtkWidget* GtkWidget*
create_check_button_in_table(GtkWidget *table, int row, int col, create_check_button_in_table(GtkWidget *table, int row, int col,
const char *text) const char *text)
{ {
GtkWidget *button = gtk_check_button_new_with_mnemonic(text); GtkWidget *button = gtk_check_button_new_with_mnemonic(text);
return add_widget_to_table(table, row, col, button); return add_widget_to_table(table, row, col, button);
@ -56,7 +56,7 @@ create_check_button_in_table(GtkWidget *table, int row, int col,
GtkWidget* GtkWidget*
create_radio_button_in_table(GtkWidget *table, GSList *group, create_radio_button_in_table(GtkWidget *table, GSList *group,
int row, int col, const char *text) int row, int col, const char *text)
{ {
GtkWidget *button = gtk_radio_button_new_with_mnemonic(group, text); GtkWidget *button = gtk_radio_button_new_with_mnemonic(group, text);
return add_widget_to_table(table, row, col, button); return add_widget_to_table(table, row, col, button);

View File

@ -24,16 +24,16 @@
#define _IMAP_TABLE_H #define _IMAP_TABLE_H
GtkWidget *create_spin_button_in_table(GtkWidget *table, GtkWidget *label, GtkWidget *create_spin_button_in_table(GtkWidget *table, GtkWidget *label,
int row, int col, int row, int col,
int value, int min, int max); int value, int min, int max);
GtkWidget *create_check_button_in_table(GtkWidget *table, int row, int col, GtkWidget *create_check_button_in_table(GtkWidget *table, int row, int col,
const char *text); const char *text);
GtkWidget *create_radio_button_in_table(GtkWidget *table, GSList *group, GtkWidget *create_radio_button_in_table(GtkWidget *table, GSList *group,
int row, int col, const char *text); int row, int col, const char *text);
GtkWidget *create_label_in_table(GtkWidget *table, int row, int col, GtkWidget *create_label_in_table(GtkWidget *table, int row, int col,
const char *text); const char *text);
GtkWidget *create_entry_in_table(GtkWidget *table, GtkWidget *label, int row, GtkWidget *create_entry_in_table(GtkWidget *table, GtkWidget *label, int row,
int col); int col);
#endif /* _IMAP_TABLE_H */ #endif /* _IMAP_TABLE_H */

View File

@ -109,8 +109,8 @@ taglist_set(TagList_t *tlist, const gchar *name, const gchar *value)
for (p = tlist->list; p; p = p->next) { for (p = tlist->list; p; p = p->next) {
tag = (Tag_t*) p->data; tag = (Tag_t*) p->data;
if (!g_ascii_strcasecmp(tag->name, name)) { if (!g_ascii_strcasecmp(tag->name, name)) {
g_strreplace(&tag->value, value); g_strreplace(&tag->value, value);
return; return;
} }
} }
/* Tag not found, add a new tag */ /* Tag not found, add a new tag */