don't fail on brush_spacing values < 0, but behave as documented (use the

2003-06-16  Michael Natterer  <mitch@gimp.org>

	* 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.
This commit is contained in:
Michael Natterer 2003-06-16 17:22:31 +00:00 committed by Michael Natterer
parent 02a015bc6c
commit 58222c799c
9 changed files with 116 additions and 70 deletions

View File

@ -1,3 +1,23 @@
2003-06-16 Michael Natterer <mitch@gimp.org>
* 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 <sven@gimp.org>
* plug-ins/gfig/gfig.c: minor GUI cleanups.

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;