mirror of https://github.com/GNOME/gimp.git
more carefull when the active brush changes white_space() was ungetch'ing
* app/brush_generated.c: more carefull when the active brush changes * app/docindexif.c: white_space() was ungetch'ing the eof marker which can clear the eof flag on some systems. * app/docindex.c: check for ferror()s * app/brush_select[ch]: sensitize the edit button iff the active brush is a generated brush.
This commit is contained in:
parent
6825ca8bd9
commit
21c343913a
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Sep 8 18:28:44 1998 Jay Cox (jaycox@earthlink.net)
|
||||||
|
|
||||||
|
* app/brush_generated.c: more carefull when the active brush
|
||||||
|
changes
|
||||||
|
* app/docindexif.c: white_space() was ungetch'ing the eof
|
||||||
|
marker which can clear the eof flag on some systems.
|
||||||
|
* app/docindex.c: check for ferror()s
|
||||||
|
* app/brush_select[ch]: sensitize the edit button iff the
|
||||||
|
active brush is a generated brush.
|
||||||
|
|
||||||
Mon Sep 7 22:30:53 PDT 1998 Manish Singh <yosh@gimp.org>
|
Mon Sep 7 22:30:53 PDT 1998 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* app/main.c: s/ATEXIT/g_atexit/ to sync with gtk changes
|
* app/main.c: s/ATEXIT/g_atexit/ to sync with gtk changes
|
||||||
|
|
|
@ -141,18 +141,22 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
|
||||||
GimpBrush *gbrush)
|
GimpBrush *gbrush)
|
||||||
{
|
{
|
||||||
GimpBrushGenerated *brush = 0;
|
GimpBrushGenerated *brush = 0;
|
||||||
if (!GIMP_IS_BRUSH_GENERATED(gbrush))
|
if (begw->brush == (GimpBrushGenerated*)gbrush)
|
||||||
|
return;
|
||||||
|
if (begw->brush)
|
||||||
{
|
{
|
||||||
|
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
|
||||||
|
gtk_object_unref(GTK_OBJECT(begw->brush));
|
||||||
|
begw->brush = NULL;
|
||||||
|
}
|
||||||
|
if (!gbrush || !GIMP_IS_BRUSH_GENERATED(gbrush))
|
||||||
|
{
|
||||||
|
begw->brush = NULL;
|
||||||
if (GTK_WIDGET_VISIBLE (begw->shell))
|
if (GTK_WIDGET_VISIBLE (begw->shell))
|
||||||
gtk_widget_hide (begw->shell);
|
gtk_widget_hide (begw->shell);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
brush = GIMP_BRUSH_GENERATED(gbrush);
|
brush = GIMP_BRUSH_GENERATED(gbrush);
|
||||||
if (begw->brush)
|
|
||||||
{
|
|
||||||
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
|
|
||||||
gtk_object_unref(GTK_OBJECT(begw->brush));
|
|
||||||
}
|
|
||||||
if (begw)
|
if (begw)
|
||||||
{
|
{
|
||||||
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
|
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
|
||||||
|
|
|
@ -153,7 +153,7 @@ brush_select_new ()
|
||||||
GtkWidget *option_menu;
|
GtkWidget *option_menu;
|
||||||
GtkWidget *slider;
|
GtkWidget *slider;
|
||||||
GimpBrushP active;
|
GimpBrushP active;
|
||||||
GtkWidget *button1, *button2;
|
GtkWidget *button2;
|
||||||
|
|
||||||
bsp = g_malloc (sizeof (_BrushSelect));
|
bsp = g_malloc (sizeof (_BrushSelect));
|
||||||
bsp->redraw = TRUE;
|
bsp->redraw = TRUE;
|
||||||
|
@ -287,11 +287,11 @@ brush_select_new ()
|
||||||
/* Create the edit/new buttons */
|
/* Create the edit/new buttons */
|
||||||
util_box = gtk_hbox_new (FALSE, 2);
|
util_box = gtk_hbox_new (FALSE, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||||
button1 = gtk_button_new_with_label ("Edit Brush");
|
bsp->edit_button = gtk_button_new_with_label ("Edit Brush");
|
||||||
gtk_signal_connect (GTK_OBJECT (button1), "clicked",
|
gtk_signal_connect (GTK_OBJECT (bsp->edit_button), "clicked",
|
||||||
(GtkSignalFunc) edit_brush_callback,
|
(GtkSignalFunc) edit_brush_callback,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (util_box), button1, TRUE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (util_box), bsp->edit_button, TRUE, TRUE, 5);
|
||||||
|
|
||||||
button2 = gtk_button_new_with_label ("New Brush");
|
button2 = gtk_button_new_with_label ("New Brush");
|
||||||
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
|
||||||
|
@ -299,7 +299,7 @@ brush_select_new ()
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 5);
|
||||||
|
|
||||||
gtk_widget_show (button1);
|
gtk_widget_show (bsp->edit_button);
|
||||||
gtk_widget_show (button2);
|
gtk_widget_show (button2);
|
||||||
gtk_widget_show (util_box);
|
gtk_widget_show (util_box);
|
||||||
|
|
||||||
|
@ -342,6 +342,10 @@ brush_select_new ()
|
||||||
brush_select_select (bsp, gimp_brush_list_get_brush_index(brush_list,
|
brush_select_select (bsp, gimp_brush_list_get_brush_index(brush_list,
|
||||||
active));
|
active));
|
||||||
bsp->redraw = old_value;
|
bsp->redraw = old_value;
|
||||||
|
if (GIMP_IS_BRUSH_GENERATED(active))
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 1);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bsp;
|
return bsp;
|
||||||
|
@ -803,6 +807,12 @@ brush_select_events (GtkWidget *widget,
|
||||||
|
|
||||||
/* Make this brush the active brush */
|
/* Make this brush the active brush */
|
||||||
select_brush (brush);
|
select_brush (brush);
|
||||||
|
|
||||||
|
if (GIMP_IS_BRUSH_GENERATED(brush))
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 1);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||||
|
|
||||||
if (brush_edit_generated_dialog)
|
if (brush_edit_generated_dialog)
|
||||||
brush_edit_generated_set_brush(brush_edit_generated_dialog,
|
brush_edit_generated_set_brush(brush_edit_generated_dialog,
|
||||||
get_active_brush());
|
get_active_brush());
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct _BrushSelect {
|
||||||
/* Brush preview */
|
/* Brush preview */
|
||||||
GtkWidget *brush_popup;
|
GtkWidget *brush_popup;
|
||||||
GtkWidget *brush_preview;
|
GtkWidget *brush_preview;
|
||||||
|
GtkWidget *edit_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
BrushSelectP brush_select_new (void);
|
BrushSelectP brush_select_new (void);
|
||||||
|
|
|
@ -233,7 +233,7 @@ load_idea_manager( idea_manager *ideas )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( idea_list || fp )
|
if ( idea_list || fp)
|
||||||
{
|
{
|
||||||
gtk_widget_set_usize( ideas->window, width, height );
|
gtk_widget_set_usize( ideas->window, width, height );
|
||||||
gtk_widget_show( ideas->window );
|
gtk_widget_show( ideas->window );
|
||||||
|
@ -245,7 +245,7 @@ load_idea_manager( idea_manager *ideas )
|
||||||
gint length;
|
gint length;
|
||||||
clear_white( fp );
|
clear_white( fp );
|
||||||
|
|
||||||
while ( ! feof( fp ) )
|
while ( ! feof( fp ) && !ferror(fp))
|
||||||
{
|
{
|
||||||
length = getinteger( fp );
|
length = getinteger( fp );
|
||||||
title = g_malloc0( length + 1 );
|
title = g_malloc0( length + 1 );
|
||||||
|
@ -460,7 +460,7 @@ static void idea_add_in_position_with_select( gchar *title, gint position, gbool
|
||||||
|
|
||||||
clear_white( fp );
|
clear_white( fp );
|
||||||
|
|
||||||
while ( ! feof( fp ) )
|
while ( ! feof( fp ) && !ferror(fp))
|
||||||
{
|
{
|
||||||
length = getinteger( fp );
|
length = getinteger( fp );
|
||||||
title = g_malloc0( length + 1 );
|
title = g_malloc0( length + 1 );
|
||||||
|
|
|
@ -139,11 +139,12 @@ int getinteger( FILE *fp )
|
||||||
|
|
||||||
void clear_white( FILE *fp )
|
void clear_white( FILE *fp )
|
||||||
{
|
{
|
||||||
gchar nextchar;
|
int nextchar;
|
||||||
|
|
||||||
while ( isspace( nextchar = fgetc( fp ) ) )
|
while ( isspace( nextchar = fgetc( fp ) ) )
|
||||||
/* empty statement */ ;
|
/* empty statement */ ;
|
||||||
ungetc( nextchar, fp );
|
if (nextchar != EOF)
|
||||||
|
ungetc( nextchar, fp );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset_usize
|
/* reset_usize
|
||||||
|
|
|
@ -141,18 +141,22 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
|
||||||
GimpBrush *gbrush)
|
GimpBrush *gbrush)
|
||||||
{
|
{
|
||||||
GimpBrushGenerated *brush = 0;
|
GimpBrushGenerated *brush = 0;
|
||||||
if (!GIMP_IS_BRUSH_GENERATED(gbrush))
|
if (begw->brush == (GimpBrushGenerated*)gbrush)
|
||||||
|
return;
|
||||||
|
if (begw->brush)
|
||||||
{
|
{
|
||||||
|
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
|
||||||
|
gtk_object_unref(GTK_OBJECT(begw->brush));
|
||||||
|
begw->brush = NULL;
|
||||||
|
}
|
||||||
|
if (!gbrush || !GIMP_IS_BRUSH_GENERATED(gbrush))
|
||||||
|
{
|
||||||
|
begw->brush = NULL;
|
||||||
if (GTK_WIDGET_VISIBLE (begw->shell))
|
if (GTK_WIDGET_VISIBLE (begw->shell))
|
||||||
gtk_widget_hide (begw->shell);
|
gtk_widget_hide (begw->shell);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
brush = GIMP_BRUSH_GENERATED(gbrush);
|
brush = GIMP_BRUSH_GENERATED(gbrush);
|
||||||
if (begw->brush)
|
|
||||||
{
|
|
||||||
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
|
|
||||||
gtk_object_unref(GTK_OBJECT(begw->brush));
|
|
||||||
}
|
|
||||||
if (begw)
|
if (begw)
|
||||||
{
|
{
|
||||||
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
|
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
|
||||||
|
|
|
@ -153,7 +153,7 @@ brush_select_new ()
|
||||||
GtkWidget *option_menu;
|
GtkWidget *option_menu;
|
||||||
GtkWidget *slider;
|
GtkWidget *slider;
|
||||||
GimpBrushP active;
|
GimpBrushP active;
|
||||||
GtkWidget *button1, *button2;
|
GtkWidget *button2;
|
||||||
|
|
||||||
bsp = g_malloc (sizeof (_BrushSelect));
|
bsp = g_malloc (sizeof (_BrushSelect));
|
||||||
bsp->redraw = TRUE;
|
bsp->redraw = TRUE;
|
||||||
|
@ -287,11 +287,11 @@ brush_select_new ()
|
||||||
/* Create the edit/new buttons */
|
/* Create the edit/new buttons */
|
||||||
util_box = gtk_hbox_new (FALSE, 2);
|
util_box = gtk_hbox_new (FALSE, 2);
|
||||||
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (bsp->options_box), util_box, FALSE, FALSE, 0);
|
||||||
button1 = gtk_button_new_with_label ("Edit Brush");
|
bsp->edit_button = gtk_button_new_with_label ("Edit Brush");
|
||||||
gtk_signal_connect (GTK_OBJECT (button1), "clicked",
|
gtk_signal_connect (GTK_OBJECT (bsp->edit_button), "clicked",
|
||||||
(GtkSignalFunc) edit_brush_callback,
|
(GtkSignalFunc) edit_brush_callback,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (util_box), button1, TRUE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (util_box), bsp->edit_button, TRUE, TRUE, 5);
|
||||||
|
|
||||||
button2 = gtk_button_new_with_label ("New Brush");
|
button2 = gtk_button_new_with_label ("New Brush");
|
||||||
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button2), "clicked",
|
||||||
|
@ -299,7 +299,7 @@ brush_select_new ()
|
||||||
NULL);
|
NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 5);
|
gtk_box_pack_start (GTK_BOX (util_box), button2, TRUE, TRUE, 5);
|
||||||
|
|
||||||
gtk_widget_show (button1);
|
gtk_widget_show (bsp->edit_button);
|
||||||
gtk_widget_show (button2);
|
gtk_widget_show (button2);
|
||||||
gtk_widget_show (util_box);
|
gtk_widget_show (util_box);
|
||||||
|
|
||||||
|
@ -342,6 +342,10 @@ brush_select_new ()
|
||||||
brush_select_select (bsp, gimp_brush_list_get_brush_index(brush_list,
|
brush_select_select (bsp, gimp_brush_list_get_brush_index(brush_list,
|
||||||
active));
|
active));
|
||||||
bsp->redraw = old_value;
|
bsp->redraw = old_value;
|
||||||
|
if (GIMP_IS_BRUSH_GENERATED(active))
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 1);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bsp;
|
return bsp;
|
||||||
|
@ -803,6 +807,12 @@ brush_select_events (GtkWidget *widget,
|
||||||
|
|
||||||
/* Make this brush the active brush */
|
/* Make this brush the active brush */
|
||||||
select_brush (brush);
|
select_brush (brush);
|
||||||
|
|
||||||
|
if (GIMP_IS_BRUSH_GENERATED(brush))
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 1);
|
||||||
|
else
|
||||||
|
gtk_widget_set_sensitive (bsp->edit_button, 0);
|
||||||
|
|
||||||
if (brush_edit_generated_dialog)
|
if (brush_edit_generated_dialog)
|
||||||
brush_edit_generated_set_brush(brush_edit_generated_dialog,
|
brush_edit_generated_set_brush(brush_edit_generated_dialog,
|
||||||
get_active_brush());
|
get_active_brush());
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct _BrushSelect {
|
||||||
/* Brush preview */
|
/* Brush preview */
|
||||||
GtkWidget *brush_popup;
|
GtkWidget *brush_popup;
|
||||||
GtkWidget *brush_preview;
|
GtkWidget *brush_preview;
|
||||||
|
GtkWidget *edit_button;
|
||||||
};
|
};
|
||||||
|
|
||||||
BrushSelectP brush_select_new (void);
|
BrushSelectP brush_select_new (void);
|
||||||
|
|
|
@ -141,18 +141,22 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
|
||||||
GimpBrush *gbrush)
|
GimpBrush *gbrush)
|
||||||
{
|
{
|
||||||
GimpBrushGenerated *brush = 0;
|
GimpBrushGenerated *brush = 0;
|
||||||
if (!GIMP_IS_BRUSH_GENERATED(gbrush))
|
if (begw->brush == (GimpBrushGenerated*)gbrush)
|
||||||
|
return;
|
||||||
|
if (begw->brush)
|
||||||
{
|
{
|
||||||
|
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
|
||||||
|
gtk_object_unref(GTK_OBJECT(begw->brush));
|
||||||
|
begw->brush = NULL;
|
||||||
|
}
|
||||||
|
if (!gbrush || !GIMP_IS_BRUSH_GENERATED(gbrush))
|
||||||
|
{
|
||||||
|
begw->brush = NULL;
|
||||||
if (GTK_WIDGET_VISIBLE (begw->shell))
|
if (GTK_WIDGET_VISIBLE (begw->shell))
|
||||||
gtk_widget_hide (begw->shell);
|
gtk_widget_hide (begw->shell);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
brush = GIMP_BRUSH_GENERATED(gbrush);
|
brush = GIMP_BRUSH_GENERATED(gbrush);
|
||||||
if (begw->brush)
|
|
||||||
{
|
|
||||||
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
|
|
||||||
gtk_object_unref(GTK_OBJECT(begw->brush));
|
|
||||||
}
|
|
||||||
if (begw)
|
if (begw)
|
||||||
{
|
{
|
||||||
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
|
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
|
||||||
|
|
Loading…
Reference in New Issue