closed the bug Xach reported on the list and made the previews correctly

update itself if brush/gradient changes.


--Sven
This commit is contained in:
Sven Neumann 1999-09-02 14:46:58 +00:00
parent 2b5130f08a
commit c73db058f3
4 changed files with 49 additions and 4 deletions

View File

@ -1,3 +1,12 @@
Thu Sep 2 16:46:35 MEST 1999 Sven Neumann <sven@gimp.org>
* app/gimpcontextpreview.c: grab the pointer so that the popups don't
get stuck and connect to the brush signals so the preview follows if
the brush is edited or renamed.
* app/gradient_select.c: update the gradient_preview in the toolbox
when editing a gradient.
Thu Sep 2 02:12:20 1999 Jay Cox (jaycox@earthlink.net) Thu Sep 2 02:12:20 1999 Jay Cox (jaycox@earthlink.net)
* app/app_procs.c: free the brush dialog before freeing the brushes. * app/app_procs.c: free the brush dialog before freeing the brushes.

View File

@ -88,6 +88,9 @@ static void gimp_context_preview_draw_pattern_popup (GimpContextPreview *)
static void gimp_context_preview_draw_gradient (GimpContextPreview *); static void gimp_context_preview_draw_gradient (GimpContextPreview *);
static void gimp_context_preview_draw_gradient_popup (GimpContextPreview *); static void gimp_context_preview_draw_gradient_popup (GimpContextPreview *);
static gint brush_dirty_callback (GimpBrush *, GimpContextPreview *);
static gint brush_rename_callback (GimpBrush *, GimpContextPreview *);
static void static void
gimp_context_preview_destroy (GtkObject *object) gimp_context_preview_destroy (GtkObject *object)
@ -196,6 +199,9 @@ gimp_context_preview_update (GimpContextPreview *gcp,
g_return_if_fail (GIMP_IS_CONTEXT_PREVIEW (gcp)); g_return_if_fail (GIMP_IS_CONTEXT_PREVIEW (gcp));
g_return_if_fail (gimp_context_preview_data_matches_type (gcp, data)); g_return_if_fail (gimp_context_preview_data_matches_type (gcp, data));
if (gcp->data && gcp->type == GCP_BRUSH)
gtk_signal_disconnect_by_data (GTK_OBJECT (gcp->data), gcp);
gcp->data = data; gcp->data = data;
if (GTK_IS_OBJECT (gcp->data)) if (GTK_IS_OBJECT (gcp->data))
gtk_signal_connect (GTK_OBJECT (gcp->data), "destroy", gtk_signal_connect (GTK_OBJECT (gcp->data), "destroy",
@ -204,6 +210,10 @@ gimp_context_preview_update (GimpContextPreview *gcp,
{ {
case GCP_BRUSH: case GCP_BRUSH:
gimp_context_preview_draw_brush (gcp); gimp_context_preview_draw_brush (gcp);
gtk_signal_connect (GTK_OBJECT (gcp->data), "dirty",
GTK_SIGNAL_FUNC (brush_dirty_callback), gcp);
gtk_signal_connect (GTK_OBJECT (gcp->data), "rename",
GTK_SIGNAL_FUNC (brush_rename_callback), gcp);
break; break;
case GCP_PATTERN: case GCP_PATTERN:
gimp_context_preview_draw_pattern (gcp); gimp_context_preview_draw_pattern (gcp);
@ -253,9 +263,11 @@ gimp_context_preview_button_press_event (GtkWidget *widget,
{ {
if (bevent->button == 1) if (bevent->button == 1)
{ {
gtk_signal_emit_by_name (GTK_OBJECT (widget), "clicked"); gdk_pointer_grab (widget->window, FALSE, GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
gimp_context_preview_popup_open (GIMP_CONTEXT_PREVIEW (widget), gimp_context_preview_popup_open (GIMP_CONTEXT_PREVIEW (widget),
bevent->x, bevent->y); bevent->x, bevent->y);
gtk_signal_emit_by_name (GTK_OBJECT (widget), "clicked");
} }
return TRUE; return TRUE;
} }
@ -265,8 +277,10 @@ gimp_context_preview_button_release_event (GtkWidget *widget,
GdkEventButton *bevent) GdkEventButton *bevent)
{ {
if (bevent->button == 1) if (bevent->button == 1)
{
gdk_pointer_ungrab (bevent->time);
gimp_context_preview_popup_close (); gimp_context_preview_popup_close ();
}
return TRUE; return TRUE;
} }
@ -395,7 +409,6 @@ gimp_context_preview_data_matches_type (GimpContextPreview *gcp,
} }
/* brush draw functions */ /* brush draw functions */
static void static void
@ -560,6 +573,27 @@ gimp_context_preview_draw_brush (GimpContextPreview *gcp)
g_free (buf); g_free (buf);
} }
/* brush callbacks */
static gint
brush_dirty_callback (GimpBrush *brush,
GimpContextPreview *gcp)
{
gimp_context_preview_draw_brush (gcp);
gtk_widget_queue_draw (GTK_WIDGET (gcp));
return TRUE;
}
static gint
brush_rename_callback (GimpBrush *brush,
GimpContextPreview *gcp)
{
if (gcp->show_tooltips)
gtk_tooltips_set_tip (tool_tips, GTK_WIDGET (gcp), brush->name, NULL);
return TRUE;
}
/* pattern draw functions */ /* pattern draw functions */

View File

@ -243,6 +243,7 @@ sel_update_dialogs(gint row, gradient_t *grad)
if(gradient_select_dialog) if(gradient_select_dialog)
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name); gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name);
gradient_area_update (); /* update the indicator_area */
import_palette_grad_update(grad); import_palette_grad_update(grad);
} }

View File

@ -243,6 +243,7 @@ sel_update_dialogs(gint row, gradient_t *grad)
if(gradient_select_dialog) if(gradient_select_dialog)
gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name); gtk_clist_set_text(GTK_CLIST(gradient_select_dialog->clist),row,1,grad->name);
gradient_area_update (); /* update the indicator_area */
import_palette_grad_update(grad); import_palette_grad_update(grad);
} }