From 58222c799c36edda0af6165666c7bc2c6b676eb6 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 16 Jun 2003 17:22:31 +0000 Subject: [PATCH] don't fail on brush_spacing values < 0, but behave as documented (use the 2003-06-16 Michael Natterer * tools/pdbgen/pdb/brush_select.pdb (brush_args): don't fail on brush_spacing values < 0, but behave as documented (use the brush's own spacing). * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb: gtk_window_present() the dialog on each set_popup(). This way the dialogs can be risen via the PDB by setting the already selected object. Replaced unreadable variable names by verbose ones. * app/pdb/brush_select_cmds.c * app/pdb/font_select_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c: regenerated. --- ChangeLog | 20 ++++++++++++++++ app/pdb/brush_select_cmds.c | 35 +++++++++++++++------------- app/pdb/font_select_cmds.c | 8 ++++--- app/pdb/gradient_select_cmds.c | 20 +++++++++------- app/pdb/pattern_select_cmds.c | 20 +++++++++------- tools/pdbgen/pdb/brush_select.pdb | 33 ++++++++++++++------------ tools/pdbgen/pdb/font_select.pdb | 10 ++++---- tools/pdbgen/pdb/gradient_select.pdb | 20 +++++++++------- tools/pdbgen/pdb/pattern_select.pdb | 20 +++++++++------- 9 files changed, 116 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3521565810..f686f87110 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-06-16 Michael Natterer + + * tools/pdbgen/pdb/brush_select.pdb (brush_args): don't fail on + brush_spacing values < 0, but behave as documented (use the + brush's own spacing). + + * tools/pdbgen/pdb/brush_select.pdb + * tools/pdbgen/pdb/font_select.pdb + * tools/pdbgen/pdb/gradient_select.pdb + + * tools/pdbgen/pdb/pattern_select.pdb: gtk_window_present() the + dialog on each set_popup(). This way the dialogs can be risen via + the PDB by setting the already selected object. Replaced + unreadable variable names by verbose ones. + + * app/pdb/brush_select_cmds.c + * app/pdb/font_select_cmds.c + * app/pdb/gradient_select_cmds.c + * app/pdb/pattern_select_cmds.c: regenerated. + 2003-06-16 Sven Neumann * plug-ins/gfig/gfig.c: minor GUI cleanups. diff --git a/app/pdb/brush_select_cmds.c b/app/pdb/brush_select_cmds.c index 52aa67df21..fdf9cf204a 100644 --- a/app/pdb/brush_select_cmds.c +++ b/app/pdb/brush_select_cmds.c @@ -76,7 +76,7 @@ brushes_popup_invoker (Gimp *gimp, success = FALSE; spacing = args[4].value.pdb_int; - if (spacing < 0 || spacing > 1000) + if (spacing > 1000) success = FALSE; paint_mode = args[5].value.pdb_int; @@ -91,7 +91,7 @@ brushes_popup_invoker (Gimp *gimp, brush_select_new (gimp, popup_title, initial_brush, opacity / 100.0, - paint_mode, + paint_mode, spacing, brush_callback); } @@ -161,7 +161,7 @@ brushes_close_popup_invoker (Gimp *gimp, gboolean success = TRUE; gchar *brush_callback; ProcRecord *proc; - BrushSelect *bsp; + BrushSelect *brush_select; brush_callback = (gchar *) args[0].value.pdb_pointer; if (brush_callback == NULL) @@ -171,9 +171,9 @@ brushes_close_popup_invoker (Gimp *gimp, { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, brush_callback)) && - (bsp = brush_select_get_by_callback (brush_callback))) + (brush_select = brush_select_get_by_callback (brush_callback))) { - brush_select_free (bsp); + brush_select_free (brush_select); } else { @@ -220,7 +220,7 @@ brushes_set_popup_invoker (Gimp *gimp, gint32 spacing; gint32 paint_mode; ProcRecord *proc; - BrushSelect *bsp; + BrushSelect *brush_select; brush_callback = (gchar *) args[0].value.pdb_pointer; if (brush_callback == NULL) @@ -235,7 +235,7 @@ brushes_set_popup_invoker (Gimp *gimp, success = FALSE; spacing = args[3].value.pdb_int; - if (spacing < 0 || spacing > 1000) + if (spacing > 1000) success = FALSE; paint_mode = args[4].value.pdb_int; @@ -246,26 +246,29 @@ brushes_set_popup_invoker (Gimp *gimp, { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, brush_callback)) && - (bsp = brush_select_get_by_callback (brush_callback))) + (brush_select = brush_select_get_by_callback (brush_callback))) { GimpBrush *active = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, brush_name); - success = (active != NULL); - - if (success) + if (active) { GtkAdjustment *spacing_adj; - spacing_adj = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_adjustment; + spacing_adj = GIMP_BRUSH_FACTORY_VIEW (brush_select->view)->spacing_adjustment; - gimp_context_set_brush (bsp->context, active); - gimp_context_set_opacity (bsp->context, opacity / 100.0); - gimp_context_set_paint_mode (bsp->context, paint_mode); + gimp_context_set_brush (brush_select->context, active); + gimp_context_set_opacity (brush_select->context, opacity / 100.0); + gimp_context_set_paint_mode (brush_select->context, paint_mode); - gtk_adjustment_set_value (spacing_adj, spacing); + if (spacing >= 0) + gtk_adjustment_set_value (spacing_adj, spacing); + + gtk_window_present (GTK_WINDOW (brush_select->shell)); } + else + success = FALSE; } else success = FALSE; diff --git a/app/pdb/font_select_cmds.c b/app/pdb/font_select_cmds.c index 191af35226..b462d9d1a1 100644 --- a/app/pdb/font_select_cmds.c +++ b/app/pdb/font_select_cmds.c @@ -199,12 +199,14 @@ fonts_set_popup_invoker (Gimp *gimp, GimpFont *active = (GimpFont *) gimp_container_get_child_by_name (gimp->fonts, font_name); - success = (active != NULL); - - if (success) + if (active) { gimp_context_set_font (font_select->context, active); + + gtk_window_present (GTK_WINDOW (font_select->shell)); } + else + success = FALSE; } else success = FALSE; diff --git a/app/pdb/gradient_select_cmds.c b/app/pdb/gradient_select_cmds.c index 69e930c9e1..bee69e168e 100644 --- a/app/pdb/gradient_select_cmds.c +++ b/app/pdb/gradient_select_cmds.c @@ -139,7 +139,7 @@ gradients_close_popup_invoker (Gimp *gimp, gboolean success = TRUE; gchar *gradient_callback; ProcRecord *prec; - GradientSelect *gsp; + GradientSelect *gradient_select; gradient_callback = (gchar *) args[0].value.pdb_pointer; if (gradient_callback == NULL) @@ -149,9 +149,9 @@ gradients_close_popup_invoker (Gimp *gimp, { if (! gimp->no_interface && (prec = procedural_db_lookup (gimp, gradient_callback)) && - (gsp = gradient_select_get_by_callback (gradient_callback))) + (gradient_select = gradient_select_get_by_callback (gradient_callback))) { - gradient_select_free (gsp); + gradient_select_free (gradient_select); } else { @@ -195,7 +195,7 @@ gradients_set_popup_invoker (Gimp *gimp, gchar *gradient_callback; gchar *gradient_name; ProcRecord *prec; - GradientSelect *gsp; + GradientSelect *gradient_select; gradient_callback = (gchar *) args[0].value.pdb_pointer; if (gradient_callback == NULL) @@ -209,16 +209,20 @@ gradients_set_popup_invoker (Gimp *gimp, { if (! gimp->no_interface && (prec = procedural_db_lookup (gimp, gradient_callback)) && - (gsp = gradient_select_get_by_callback (gradient_callback))) + (gradient_select = gradient_select_get_by_callback (gradient_callback))) { GimpGradient *active = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, gradient_name); - success = (active != NULL); + if (active) + { + gimp_context_set_gradient (gradient_select->context, active); - if (success) - gimp_context_set_gradient (gsp->context, active); + gtk_window_present (GTK_WINDOW (gradient_select->shell)); + } + else + success = FALSE; } else success = FALSE; diff --git a/app/pdb/pattern_select_cmds.c b/app/pdb/pattern_select_cmds.c index 05017b6b1b..5a97d853cc 100644 --- a/app/pdb/pattern_select_cmds.c +++ b/app/pdb/pattern_select_cmds.c @@ -127,7 +127,7 @@ patterns_close_popup_invoker (Gimp *gimp, gboolean success = TRUE; gchar *pattern_callback; ProcRecord *proc; - PatternSelect *psp; + PatternSelect *pattern_select; pattern_callback = (gchar *) args[0].value.pdb_pointer; if (pattern_callback == NULL) @@ -137,9 +137,9 @@ patterns_close_popup_invoker (Gimp *gimp, { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, pattern_callback)) && - (psp = pattern_select_get_by_callback (pattern_callback))) + (pattern_select = pattern_select_get_by_callback (pattern_callback))) { - pattern_select_free (psp); + pattern_select_free (pattern_select); } else { @@ -183,7 +183,7 @@ patterns_set_popup_invoker (Gimp *gimp, gchar *pattern_callback; gchar *pattern_name; ProcRecord *proc; - PatternSelect *psp; + PatternSelect *pattern_select; pattern_callback = (gchar *) args[0].value.pdb_pointer; if (pattern_callback == NULL) @@ -197,16 +197,20 @@ patterns_set_popup_invoker (Gimp *gimp, { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, pattern_callback)) && - (psp = pattern_select_get_by_callback (pattern_callback))) + (pattern_select = pattern_select_get_by_callback (pattern_callback))) { GimpPattern *active = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, pattern_name); - success = (active != NULL); + if (active) + { + gimp_context_set_pattern (pattern_select->context, active); - if (success) - gimp_context_set_pattern (psp->context, active); + gtk_window_present (GTK_WINDOW (pattern_select->shell)); + } + else + success = FALSE; } else success = FALSE; diff --git a/tools/pdbgen/pdb/brush_select.pdb b/tools/pdbgen/pdb/brush_select.pdb index eaa1c5d908..4043f4940e 100644 --- a/tools/pdbgen/pdb/brush_select.pdb +++ b/tools/pdbgen/pdb/brush_select.pdb @@ -27,7 +27,7 @@ sub brush_args {( type => '0 <= float <= 100', desc => 'The initial opacity of the brush' }, { name => 'spacing', - type => '0 <= int32 <= 1000', + type => 'int32 <= 1000', desc => 'The initial spacing of the brush (if < 0 then use brush default spacing)' }, { name => 'paint_mode', type => 'enum GimpLayerModeEffects', @@ -63,7 +63,7 @@ sub brushes_popup { brush_select_new (gimp, popup_title, initial_brush, opacity / 100.0, - paint_mode, + paint_mode, spacing, brush_callback); } @@ -89,14 +89,14 @@ sub brushes_close_popup { ); %invoke = ( - vars => [ 'ProcRecord *proc', 'BrushSelect *bsp' ], + vars => [ 'ProcRecord *proc', 'BrushSelect *brush_select' ], code => <<'CODE' { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, brush_callback)) && - (bsp = brush_select_get_by_callback (brush_callback))) + (brush_select = brush_select_get_by_callback (brush_callback))) { - brush_select_free (bsp); + brush_select_free (brush_select); } else { @@ -124,31 +124,34 @@ sub brushes_set_popup { %invoke = ( headers => [ qw("widgets/gimpbrushfactoryview.h") ], - vars => [ 'ProcRecord *proc', 'BrushSelect *bsp' ], + vars => [ 'ProcRecord *proc', 'BrushSelect *brush_select' ], code => <<'CODE' { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, brush_callback)) && - (bsp = brush_select_get_by_callback (brush_callback))) + (brush_select = brush_select_get_by_callback (brush_callback))) { GimpBrush *active = (GimpBrush *) gimp_container_get_child_by_name (gimp->brush_factory->container, brush_name); - success = (active != NULL); - - if (success) + if (active) { GtkAdjustment *spacing_adj; - spacing_adj = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_adjustment; + spacing_adj = GIMP_BRUSH_FACTORY_VIEW (brush_select->view)->spacing_adjustment; - gimp_context_set_brush (bsp->context, active); - gimp_context_set_opacity (bsp->context, opacity / 100.0); - gimp_context_set_paint_mode (bsp->context, paint_mode); + gimp_context_set_brush (brush_select->context, active); + gimp_context_set_opacity (brush_select->context, opacity / 100.0); + gimp_context_set_paint_mode (brush_select->context, paint_mode); - gtk_adjustment_set_value (spacing_adj, spacing); + if (spacing >= 0) + gtk_adjustment_set_value (spacing_adj, spacing); + + gtk_window_present (GTK_WINDOW (brush_select->shell)); } + else + success = FALSE; } else success = FALSE; diff --git a/tools/pdbgen/pdb/font_select.pdb b/tools/pdbgen/pdb/font_select.pdb index 43884e1249..87b27ea094 100644 --- a/tools/pdbgen/pdb/font_select.pdb +++ b/tools/pdbgen/pdb/font_select.pdb @@ -115,12 +115,14 @@ sub fonts_set_popup { GimpFont *active = (GimpFont *) gimp_container_get_child_by_name (gimp->fonts, font_name); - success = (active != NULL); - - if (success) + if (active) { - gimp_context_set_font (font_select->context, active); + gimp_context_set_font (font_select->context, active); + + gtk_window_present (GTK_WINDOW (font_select->shell)); } + else + success = FALSE; } else success = FALSE; diff --git a/tools/pdbgen/pdb/gradient_select.pdb b/tools/pdbgen/pdb/gradient_select.pdb index 23073df52b..a5595ff721 100644 --- a/tools/pdbgen/pdb/gradient_select.pdb +++ b/tools/pdbgen/pdb/gradient_select.pdb @@ -84,14 +84,14 @@ sub gradients_close_popup { ); %invoke = ( - vars => [ 'ProcRecord *prec', 'GradientSelect *gsp' ], + vars => [ 'ProcRecord *prec', 'GradientSelect *gradient_select' ], code => <<'CODE' { if (! gimp->no_interface && (prec = procedural_db_lookup (gimp, gradient_callback)) && - (gsp = gradient_select_get_by_callback (gradient_callback))) + (gradient_select = gradient_select_get_by_callback (gradient_callback))) { - gradient_select_free (gsp); + gradient_select_free (gradient_select); } else { @@ -117,21 +117,25 @@ sub gradients_set_popup { ); %invoke = ( - vars => [ 'ProcRecord *prec', 'GradientSelect *gsp' ], + vars => [ 'ProcRecord *prec', 'GradientSelect *gradient_select' ], code => <<'CODE' { if (! gimp->no_interface && (prec = procedural_db_lookup (gimp, gradient_callback)) && - (gsp = gradient_select_get_by_callback (gradient_callback))) + (gradient_select = gradient_select_get_by_callback (gradient_callback))) { GimpGradient *active = (GimpGradient *) gimp_container_get_child_by_name (gimp->gradient_factory->container, gradient_name); - success = (active != NULL); + if (active) + { + gimp_context_set_gradient (gradient_select->context, active); - if (success) - gimp_context_set_gradient (gsp->context, active); + gtk_window_present (GTK_WINDOW (gradient_select->shell)); + } + else + success = FALSE; } else success = FALSE; diff --git a/tools/pdbgen/pdb/pattern_select.pdb b/tools/pdbgen/pdb/pattern_select.pdb index 3aca50a363..b1310253b6 100644 --- a/tools/pdbgen/pdb/pattern_select.pdb +++ b/tools/pdbgen/pdb/pattern_select.pdb @@ -73,14 +73,14 @@ sub patterns_close_popup { ); %invoke = ( - vars => [ 'ProcRecord *proc', 'PatternSelect *psp' ], + vars => [ 'ProcRecord *proc', 'PatternSelect *pattern_select' ], code => <<'CODE' { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, pattern_callback)) && - (psp = pattern_select_get_by_callback (pattern_callback))) + (pattern_select = pattern_select_get_by_callback (pattern_callback))) { - pattern_select_free (psp); + pattern_select_free (pattern_select); } else { @@ -106,21 +106,25 @@ sub patterns_set_popup { ); %invoke = ( - vars => [ 'ProcRecord *proc', 'PatternSelect *psp' ], + vars => [ 'ProcRecord *proc', 'PatternSelect *pattern_select' ], code => <<'CODE' { if (! gimp->no_interface && (proc = procedural_db_lookup (gimp, pattern_callback)) && - (psp = pattern_select_get_by_callback (pattern_callback))) + (pattern_select = pattern_select_get_by_callback (pattern_callback))) { GimpPattern *active = (GimpPattern *) gimp_container_get_child_by_name (gimp->pattern_factory->container, pattern_name); - success = (active != NULL); + if (active) + { + gimp_context_set_pattern (pattern_select->context, active); - if (success) - gimp_context_set_pattern (psp->context, active); + gtk_window_present (GTK_WINDOW (pattern_select->shell)); + } + else + success = FALSE; } else success = FALSE;