removed the "feature" of creating dialogs without action area by passing
2002-11-18 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpdialog.c: removed the "feature" of creating dialogs without action area by passing "_delete_event_" as button text. Also changed the delete_event() implementation: don't remember a callback and call it manually but gtk_widget_activate() the button for which "connect_delete" was passed as TRUE. * app/gui/test-commands.c: added a "Close" button to the multi view. * app/gui/brush-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: ditto. Removed the "context" parameter of the *_select_new() functions. All sorts of cleanups in all dialogs. * app/gui/convert-dialog.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/pattern_select.pdb: changed accordingly. * app/pdb/brush_select_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/palette_select_cmds.c * app/pdb/pattern_select_cmds.c: regenerated.
This commit is contained in:
committed by
Michael Natterer
parent
7476328f21
commit
009e834994
28
ChangeLog
28
ChangeLog
@ -1,3 +1,31 @@
|
||||
2002-11-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpdialog.c: removed the "feature" of creating
|
||||
dialogs without action area by passing "_delete_event_" as button
|
||||
text. Also changed the delete_event() implementation: don't
|
||||
remember a callback and call it manually but gtk_widget_activate()
|
||||
the button for which "connect_delete" was passed as TRUE.
|
||||
|
||||
* app/gui/test-commands.c: added a "Close" button to the multi view.
|
||||
|
||||
* app/gui/brush-select.[ch]
|
||||
* app/gui/gradient-select.[ch]
|
||||
* app/gui/palette-select.[ch]
|
||||
* app/gui/pattern-select.[ch]: ditto. Removed the "context"
|
||||
parameter of the *_select_new() functions. All sorts of cleanups
|
||||
in all dialogs.
|
||||
|
||||
* app/gui/convert-dialog.c
|
||||
* tools/pdbgen/pdb/brush_select.pdb
|
||||
* tools/pdbgen/pdb/gradient_select.pdb
|
||||
* tools/pdbgen/pdb/palette_select.pdb
|
||||
* tools/pdbgen/pdb/pattern_select.pdb: changed accordingly.
|
||||
|
||||
* app/pdb/brush_select_cmds.c
|
||||
* app/pdb/gradient_select_cmds.c
|
||||
* app/pdb/palette_select_cmds.c
|
||||
* app/pdb/pattern_select_cmds.c: regenerated.
|
||||
|
||||
2002-11-18 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/gimprotatetool.c (roatate_angle_changed): compare the
|
||||
|
||||
@ -526,7 +526,6 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
|
||||
{
|
||||
dialog->palette_select =
|
||||
palette_select_new (dialog->gimage->gimp,
|
||||
NULL,
|
||||
_("Select Custom Palette"),
|
||||
GIMP_OBJECT (theCustomPalette)->name,
|
||||
NULL);
|
||||
@ -541,6 +540,6 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (dialog->palette_select));
|
||||
gtk_window_present (GTK_WINDOW (dialog->palette_select->shell));
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,14 +43,12 @@
|
||||
#include "brush-select.h"
|
||||
#include "dialogs-constructors.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define MIN_CELL_SIZE 25
|
||||
#define STD_BRUSH_COLUMNS 5
|
||||
#define STD_BRUSH_ROWS 5
|
||||
#define MIN_CELL_SIZE GIMP_PREVIEW_SIZE_EXTRA_SMALL
|
||||
#define STD_BRUSH_COLUMNS 5
|
||||
#define STD_BRUSH_ROWS 5
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
@ -87,7 +85,6 @@ static GSList *brush_active_dialogs = NULL;
|
||||
|
||||
BrushSelect *
|
||||
brush_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_brush,
|
||||
gdouble initial_opacity,
|
||||
@ -96,22 +93,22 @@ brush_select_new (Gimp *gimp,
|
||||
const gchar *callback_name)
|
||||
{
|
||||
BrushSelect *bsp;
|
||||
GtkWidget *sep;
|
||||
GtkWidget *table;
|
||||
GtkWidget *slider;
|
||||
GtkAdjustment *spacing_adj;
|
||||
GimpBrush *active = NULL;
|
||||
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
|
||||
if (gimp->no_data && first_call)
|
||||
gimp_data_factory_data_init (gimp->brush_factory, FALSE);
|
||||
if (gimp->no_data)
|
||||
{
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
first_call = FALSE;
|
||||
if (first_call)
|
||||
gimp_data_factory_data_init (gimp->brush_factory, FALSE);
|
||||
|
||||
first_call = FALSE;
|
||||
}
|
||||
|
||||
if (initial_brush && strlen (initial_brush))
|
||||
{
|
||||
@ -121,12 +118,7 @@ brush_select_new (Gimp *gimp,
|
||||
}
|
||||
|
||||
if (! active)
|
||||
{
|
||||
if (context)
|
||||
active = gimp_context_get_brush (context);
|
||||
else
|
||||
active = gimp_context_get_brush (gimp_get_current_context (gimp));
|
||||
}
|
||||
active = gimp_context_get_brush (gimp_get_current_context (gimp));
|
||||
|
||||
if (! active)
|
||||
return NULL;
|
||||
@ -136,19 +128,9 @@ brush_select_new (Gimp *gimp,
|
||||
/* Add to active brush dialogs list */
|
||||
brush_active_dialogs = g_slist_append (brush_active_dialogs, bsp);
|
||||
|
||||
bsp->context = gimp_context_new (gimp, title, context);
|
||||
bsp->context = gimp_context_new (gimp, title, NULL);
|
||||
bsp->callback_name = g_strdup (callback_name);
|
||||
|
||||
if (context)
|
||||
{
|
||||
gimp_context_define_properties (bsp->context,
|
||||
GIMP_CONTEXT_OPACITY_MASK |
|
||||
GIMP_CONTEXT_PAINT_MODE_MASK |
|
||||
GIMP_CONTEXT_BRUSH_MASK,
|
||||
FALSE);
|
||||
gimp_context_set_parent (bsp->context, context);
|
||||
}
|
||||
|
||||
gimp_context_set_brush (bsp->context, active);
|
||||
gimp_context_set_paint_mode (bsp->context, initial_mode);
|
||||
gimp_context_set_opacity (bsp->context, initial_opacity);
|
||||
@ -171,51 +153,44 @@ brush_select_new (Gimp *gimp,
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
"_delete_event_", brush_select_close_callback,
|
||||
GTK_STOCK_CLOSE, brush_select_close_callback,
|
||||
bsp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (bsp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (bsp->shell)->action_area);
|
||||
|
||||
/* The Brush Grid */
|
||||
bsp->view =
|
||||
gimp_brush_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
gimp->brush_factory,
|
||||
dialogs_edit_brush_func,
|
||||
bsp->context,
|
||||
title ? FALSE : TRUE,
|
||||
FALSE,
|
||||
MIN_CELL_SIZE,
|
||||
STD_BRUSH_COLUMNS,
|
||||
STD_BRUSH_ROWS,
|
||||
gimp_item_factory_from_path ("<Brushes>"));
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bsp->view), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bsp->view), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (bsp->shell)->vbox), bsp->view);
|
||||
gtk_widget_show (bsp->view);
|
||||
|
||||
/* Create the frame and the table for the options */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
table = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_scale->parent;
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (bsp->view), table, FALSE, FALSE, 2);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Create the opacity scale widget */
|
||||
bsp->opacity_data =
|
||||
GTK_ADJUSTMENT (gtk_adjustment_new
|
||||
(gimp_context_get_opacity (bsp->context) * 100.0,
|
||||
0.0, 100.0, 1.0, 1.0, 0.0));
|
||||
slider = gtk_hscale_new (bsp->opacity_data);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (slider), GTK_POS_TOP);
|
||||
gtk_range_set_update_policy (GTK_RANGE (slider), GTK_UPDATE_DELAYED);
|
||||
GTK_ADJUSTMENT (gimp_scale_entry_new (GTK_TABLE (table), 0, 1,
|
||||
_("Opacity:"), -1, 5,
|
||||
gimp_context_get_opacity (bsp->context) * 100.0,
|
||||
0.0, 100.0, 1.0, 10.0, 1,
|
||||
TRUE, 0.0, 0.0,
|
||||
NULL, NULL));
|
||||
|
||||
g_signal_connect (G_OBJECT (bsp->opacity_data), "value_changed",
|
||||
G_CALLBACK (opacity_scale_update),
|
||||
bsp);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Opacity:"), 1.0, 1.0,
|
||||
slider, 1, FALSE);
|
||||
|
||||
/* Create the paint mode option menu */
|
||||
bsp->option_menu =
|
||||
@ -223,22 +198,15 @@ brush_select_new (Gimp *gimp,
|
||||
bsp,
|
||||
TRUE,
|
||||
gimp_context_get_paint_mode (bsp->context));
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
|
||||
_("Mode:"), 1.0, 0.5,
|
||||
bsp->option_menu, 1, TRUE);
|
||||
|
||||
/* A separator after the paint options */
|
||||
sep = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (bsp->view), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
bsp->option_menu, 2, TRUE);
|
||||
|
||||
spacing_adj = GIMP_BRUSH_FACTORY_VIEW (bsp->view)->spacing_adjustment;
|
||||
|
||||
/* Use passed spacing instead of brushes default */
|
||||
if (initial_spacing >= 0)
|
||||
{
|
||||
/* Use passed spacing instead of brushes default */
|
||||
gtk_adjustment_set_value (spacing_adj, initial_spacing);
|
||||
}
|
||||
gtk_adjustment_set_value (spacing_adj, initial_spacing);
|
||||
|
||||
g_signal_connect (G_OBJECT (spacing_adj), "value_changed",
|
||||
G_CALLBACK (spacing_scale_update),
|
||||
@ -292,7 +260,6 @@ brush_select_dialogs_check (void)
|
||||
{
|
||||
BrushSelect *bsp;
|
||||
GSList *list;
|
||||
ProcRecord *proc = NULL;
|
||||
|
||||
list = brush_active_dialogs;
|
||||
|
||||
@ -304,9 +271,7 @@ brush_select_dialogs_check (void)
|
||||
|
||||
if (bsp->callback_name)
|
||||
{
|
||||
proc = procedural_db_lookup (bsp->context->gimp, bsp->callback_name);
|
||||
|
||||
if (! proc)
|
||||
if (! procedural_db_lookup (bsp->context->gimp, bsp->callback_name))
|
||||
brush_select_close_callback (NULL, bsp);
|
||||
}
|
||||
}
|
||||
@ -351,7 +316,7 @@ brush_select_change_callbacks (BrushSelect *bsp,
|
||||
GIMP_PDB_INT32, (brush->mask->width *
|
||||
brush->mask->height),
|
||||
GIMP_PDB_INT8ARRAY, temp_buf_data (brush->mask),
|
||||
GIMP_PDB_INT32, (gint) closing,
|
||||
GIMP_PDB_INT32, closing,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
|
||||
@ -371,9 +336,7 @@ brush_select_brush_changed (GimpContext *context,
|
||||
BrushSelect *bsp)
|
||||
{
|
||||
if (brush)
|
||||
{
|
||||
brush_select_change_callbacks (bsp, FALSE);
|
||||
}
|
||||
brush_select_change_callbacks (bsp, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -36,7 +36,6 @@ struct _BrushSelect
|
||||
|
||||
|
||||
BrushSelect * brush_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_brush,
|
||||
gdouble initial_opacity,
|
||||
|
||||
@ -526,7 +526,6 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
|
||||
{
|
||||
dialog->palette_select =
|
||||
palette_select_new (dialog->gimage->gimp,
|
||||
NULL,
|
||||
_("Select Custom Palette"),
|
||||
GIMP_OBJECT (theCustomPalette)->name,
|
||||
NULL);
|
||||
@ -541,6 +540,6 @@ indexed_custom_palette_button_callback (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (dialog->palette_select));
|
||||
gtk_window_present (GTK_WINDOW (dialog->palette_select->shell));
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,6 @@ static GSList *gradient_active_dialogs = NULL;
|
||||
|
||||
GradientSelect *
|
||||
gradient_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_gradient,
|
||||
const gchar *callback_name,
|
||||
@ -72,16 +71,19 @@ gradient_select_new (Gimp *gimp,
|
||||
GradientSelect *gsp;
|
||||
GimpGradient *active = NULL;
|
||||
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
|
||||
if (gimp->no_data && first_call)
|
||||
gimp_data_factory_data_init (gimp->gradient_factory, FALSE);
|
||||
if (gimp->no_data)
|
||||
{
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
first_call = FALSE;
|
||||
if (first_call)
|
||||
gimp_data_factory_data_init (gimp->gradient_factory, FALSE);
|
||||
|
||||
first_call = FALSE;
|
||||
}
|
||||
|
||||
if (initial_gradient && strlen (initial_gradient))
|
||||
{
|
||||
@ -101,51 +103,39 @@ gradient_select_new (Gimp *gimp,
|
||||
/* Add to active gradient dialogs list */
|
||||
gradient_active_dialogs = g_slist_append (gradient_active_dialogs, gsp);
|
||||
|
||||
gsp->context = gimp_context_new (gimp, title, context);
|
||||
gsp->context = gimp_context_new (gimp, title, NULL);
|
||||
gsp->callback_name = g_strdup (callback_name);
|
||||
gsp->sample_size = sample_size;
|
||||
|
||||
if (context)
|
||||
{
|
||||
gimp_context_define_properties (gsp->context,
|
||||
GIMP_CONTEXT_GRADIENT_MASK,
|
||||
FALSE);
|
||||
gimp_context_set_parent (gsp->context, context);
|
||||
}
|
||||
|
||||
gimp_context_set_gradient (gsp->context, active);
|
||||
|
||||
g_signal_connect (G_OBJECT (gsp->context), "gradient_changed",
|
||||
G_CALLBACK (gradient_select_gradient_changed),
|
||||
(gpointer) gsp);
|
||||
gsp);
|
||||
|
||||
/* the shell */
|
||||
gsp->shell = gimp_dialog_new (title ? title : _("Gradient Selection"),
|
||||
"gradient_selection",
|
||||
gsp->shell = gimp_dialog_new (title, "gradient_selection",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_selection.html",
|
||||
title ? GTK_WIN_POS_MOUSE : GTK_WIN_POS_NONE,
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
"_delete_event_", gradient_select_close_callback,
|
||||
gsp, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CLOSE, gradient_select_close_callback,
|
||||
gsp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (gsp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (gsp->shell)->action_area);
|
||||
|
||||
/* the gradient list */
|
||||
gsp->view =
|
||||
gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
gsp->context->gimp->gradient_factory,
|
||||
dialogs_edit_gradient_func,
|
||||
gsp->context,
|
||||
16,
|
||||
10, 10,
|
||||
GIMP_PREVIEW_SIZE_EXTRA_SMALL,
|
||||
6, 6,
|
||||
gimp_item_factory_from_path ("<Gradients>"));
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (gsp->view), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (gsp->view), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (gsp->shell)->vbox), gsp->view);
|
||||
gtk_widget_show (gsp->view);
|
||||
|
||||
@ -195,7 +185,6 @@ gradient_select_dialogs_check (void)
|
||||
{
|
||||
GradientSelect *gsp;
|
||||
GSList *list;
|
||||
ProcRecord *proc = NULL;
|
||||
|
||||
list = gradient_active_dialogs;
|
||||
|
||||
@ -207,9 +196,7 @@ gradient_select_dialogs_check (void)
|
||||
|
||||
if (gsp->callback_name)
|
||||
{
|
||||
proc = procedural_db_lookup (gsp->context->gimp, gsp->callback_name);
|
||||
|
||||
if (! proc)
|
||||
if (! procedural_db_lookup (gsp->context->gimp, gsp->callback_name))
|
||||
gradient_select_close_callback (NULL, gsp);
|
||||
}
|
||||
}
|
||||
@ -229,7 +216,6 @@ gradient_select_change_callbacks (GradientSelect *gsp,
|
||||
|
||||
static gboolean busy = FALSE;
|
||||
|
||||
|
||||
if (! (gsp && gsp->callback_name) || busy)
|
||||
return;
|
||||
|
||||
@ -293,9 +279,7 @@ gradient_select_gradient_changed (GimpContext *context,
|
||||
GradientSelect *gsp)
|
||||
{
|
||||
if (gradient)
|
||||
{
|
||||
gradient_select_change_callbacks (gsp, FALSE);
|
||||
}
|
||||
gradient_select_change_callbacks (gsp, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -34,7 +34,6 @@ struct _GradientSelect
|
||||
|
||||
|
||||
GradientSelect * gradient_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_gradient,
|
||||
const gchar *callback_name,
|
||||
|
||||
@ -67,7 +67,6 @@ static GSList *palette_active_dialogs = NULL;
|
||||
|
||||
PaletteSelect *
|
||||
palette_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_palette,
|
||||
const gchar *callback_name)
|
||||
@ -75,16 +74,18 @@ palette_select_new (Gimp *gimp,
|
||||
PaletteSelect *psp;
|
||||
GimpPalette *active = NULL;
|
||||
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
|
||||
if (gimp->no_data && first_call)
|
||||
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
|
||||
if (gimp->no_data)
|
||||
{
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
first_call = FALSE;
|
||||
if (first_call)
|
||||
gimp_data_factory_data_init (gimp->palette_factory, FALSE);
|
||||
|
||||
first_call = FALSE;
|
||||
}
|
||||
|
||||
if (initial_palette && strlen (initial_palette))
|
||||
{
|
||||
@ -92,10 +93,6 @@ palette_select_new (Gimp *gimp,
|
||||
gimp_container_get_child_by_name (gimp->palette_factory->container,
|
||||
initial_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
active = gimp_context_get_palette (gimp_get_user_context (gimp));
|
||||
}
|
||||
|
||||
if (! active)
|
||||
active = gimp_context_get_palette (gimp_get_current_context (gimp));
|
||||
@ -110,14 +107,6 @@ palette_select_new (Gimp *gimp,
|
||||
|
||||
psp->context = gimp_context_new (gimp, title, NULL);
|
||||
psp->callback_name = g_strdup (callback_name);
|
||||
|
||||
if (context)
|
||||
{
|
||||
gimp_context_define_properties (psp->context,
|
||||
GIMP_CONTEXT_PALETTE_MASK,
|
||||
FALSE);
|
||||
gimp_context_set_parent (psp->context, context);
|
||||
}
|
||||
|
||||
gimp_context_set_palette (psp->context, active);
|
||||
|
||||
@ -132,14 +121,11 @@ palette_select_new (Gimp *gimp,
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
"_delete_event_", palette_select_close_callback,
|
||||
psp, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CLOSE, palette_select_close_callback,
|
||||
psp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (psp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (psp->shell)->action_area);
|
||||
|
||||
/* The Palette List */
|
||||
psp->view =
|
||||
gimp_data_factory_view_new (GIMP_VIEW_TYPE_LIST,
|
||||
@ -150,7 +136,7 @@ palette_select_new (Gimp *gimp,
|
||||
5, 3,
|
||||
gimp_item_factory_from_path ("<Palettes>"));
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (psp->view), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (psp->view), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox), psp->view);
|
||||
gtk_widget_show (psp->view);
|
||||
|
||||
@ -200,7 +186,6 @@ palette_select_dialogs_check (void)
|
||||
{
|
||||
PaletteSelect *psp;
|
||||
GSList *list;
|
||||
ProcRecord *proc = NULL;
|
||||
|
||||
list = palette_active_dialogs;
|
||||
|
||||
@ -212,9 +197,7 @@ palette_select_dialogs_check (void)
|
||||
|
||||
if (psp->callback_name)
|
||||
{
|
||||
proc = procedural_db_lookup (psp->context->gimp, psp->callback_name);
|
||||
|
||||
if (! proc)
|
||||
if (! procedural_db_lookup (psp->context->gimp, psp->callback_name))
|
||||
palette_select_close_callback (NULL, psp);
|
||||
}
|
||||
}
|
||||
@ -250,9 +233,9 @@ palette_select_change_callbacks (PaletteSelect *psp,
|
||||
procedural_db_run_proc (psp->context->gimp,
|
||||
psp->callback_name,
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_STRING, GIMP_OBJECT (palette)->name,
|
||||
GIMP_PDB_INT32, palette->n_colors,
|
||||
GIMP_PDB_INT32, closing,
|
||||
GIMP_PDB_STRING, GIMP_OBJECT (palette)->name,
|
||||
GIMP_PDB_INT32, palette->n_colors,
|
||||
GIMP_PDB_INT32, closing,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
|
||||
@ -272,9 +255,7 @@ palette_select_palette_changed (GimpContext *context,
|
||||
PaletteSelect *psp)
|
||||
{
|
||||
if (palette)
|
||||
{
|
||||
palette_select_change_callbacks (psp, FALSE);
|
||||
}
|
||||
palette_select_change_callbacks (psp, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -20,10 +20,6 @@
|
||||
#define __PALETTE_SELECT_H__
|
||||
|
||||
|
||||
#define SM_PREVIEW_WIDTH (96 + 2)
|
||||
#define SM_PREVIEW_HEIGHT (33 + 2)
|
||||
|
||||
|
||||
typedef struct _PaletteSelect PaletteSelect;
|
||||
|
||||
struct _PaletteSelect
|
||||
@ -37,7 +33,6 @@ struct _PaletteSelect
|
||||
|
||||
|
||||
PaletteSelect * palette_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_palette,
|
||||
const gchar *callback_name);
|
||||
|
||||
@ -44,20 +44,20 @@
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define MIN_CELL_SIZE 32
|
||||
#define STD_PATTERN_COLUMNS 6
|
||||
#define STD_PATTERN_ROWS 5
|
||||
#define MIN_CELL_SIZE GIMP_PREVIEW_SIZE_SMALL
|
||||
#define STD_PATTERN_COLUMNS 5
|
||||
#define STD_PATTERN_ROWS 5
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void pattern_select_change_callbacks (PatternSelect *psp,
|
||||
gboolean closing);
|
||||
static void pattern_select_pattern_changed (GimpContext *context,
|
||||
GimpPattern *pattern,
|
||||
PatternSelect *psp);
|
||||
static void pattern_select_close_callback (GtkWidget *widget,
|
||||
PatternSelect *psp);
|
||||
static void pattern_select_change_callbacks (PatternSelect *psp,
|
||||
gboolean closing);
|
||||
static void pattern_select_pattern_changed (GimpContext *context,
|
||||
GimpPattern *pattern,
|
||||
PatternSelect *psp);
|
||||
static void pattern_select_close_callback (GtkWidget *widget,
|
||||
PatternSelect *psp);
|
||||
|
||||
|
||||
/* List of active dialogs */
|
||||
@ -68,7 +68,6 @@ static GSList *pattern_active_dialogs = NULL;
|
||||
|
||||
PatternSelect *
|
||||
pattern_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_pattern,
|
||||
const gchar *callback_name)
|
||||
@ -76,16 +75,18 @@ pattern_select_new (Gimp *gimp,
|
||||
PatternSelect *psp;
|
||||
GimpPattern *active = NULL;
|
||||
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (! context || GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
|
||||
if (gimp->no_data && first_call)
|
||||
gimp_data_factory_data_init (gimp->pattern_factory, FALSE);
|
||||
if (gimp->no_data)
|
||||
{
|
||||
static gboolean first_call = TRUE;
|
||||
|
||||
first_call = FALSE;
|
||||
if (first_call)
|
||||
gimp_data_factory_data_init (gimp->pattern_factory, FALSE);
|
||||
|
||||
first_call = FALSE;
|
||||
}
|
||||
|
||||
if (initial_pattern && strlen (initial_pattern))
|
||||
{
|
||||
@ -108,14 +109,6 @@ pattern_select_new (Gimp *gimp,
|
||||
psp->context = gimp_context_new (gimp, title, NULL);
|
||||
psp->callback_name = g_strdup (callback_name);
|
||||
|
||||
if (context)
|
||||
{
|
||||
gimp_context_define_properties (psp->context,
|
||||
GIMP_CONTEXT_BRUSH_MASK,
|
||||
FALSE);
|
||||
gimp_context_set_parent (psp->context, context);
|
||||
}
|
||||
|
||||
gimp_context_set_pattern (psp->context, active);
|
||||
|
||||
g_signal_connect (G_OBJECT (psp->context), "pattern_changed",
|
||||
@ -129,14 +122,11 @@ pattern_select_new (Gimp *gimp,
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
"_delete_event_", pattern_select_close_callback,
|
||||
GTK_STOCK_CLOSE, pattern_select_close_callback,
|
||||
psp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (psp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (psp->shell)->action_area);
|
||||
|
||||
/* the pattern grid */
|
||||
psp->view =
|
||||
gimp_data_factory_view_new (GIMP_VIEW_TYPE_GRID,
|
||||
@ -148,7 +138,7 @@ pattern_select_new (Gimp *gimp,
|
||||
STD_PATTERN_ROWS,
|
||||
gimp_item_factory_from_path ("<Patterns>"));
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (psp->view), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (psp->view), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (psp->shell)->vbox), psp->view);
|
||||
gtk_widget_show (psp->view);
|
||||
|
||||
@ -198,7 +188,6 @@ pattern_select_dialogs_check (void)
|
||||
{
|
||||
PatternSelect *psp;
|
||||
GSList *list;
|
||||
ProcRecord *proc = NULL;
|
||||
|
||||
list = pattern_active_dialogs;
|
||||
|
||||
@ -210,9 +199,7 @@ pattern_select_dialogs_check (void)
|
||||
|
||||
if (psp->callback_name)
|
||||
{
|
||||
proc = procedural_db_lookup (psp->context->gimp, psp->callback_name);
|
||||
|
||||
if (! proc)
|
||||
if (! procedural_db_lookup (psp->context->gimp, psp->callback_name))
|
||||
pattern_select_close_callback (NULL, psp);
|
||||
}
|
||||
}
|
||||
@ -256,7 +243,7 @@ pattern_select_change_callbacks (PatternSelect *psp,
|
||||
pattern->mask->height *
|
||||
pattern->mask->width),
|
||||
GIMP_PDB_INT8ARRAY, temp_buf_data (pattern->mask),
|
||||
GIMP_PDB_INT32, (gint) closing,
|
||||
GIMP_PDB_INT32, closing,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (!return_vals || return_vals[0].value.pdb_int != GIMP_PDB_SUCCESS)
|
||||
@ -276,9 +263,7 @@ pattern_select_pattern_changed (GimpContext *context,
|
||||
PatternSelect *psp)
|
||||
{
|
||||
if (pattern)
|
||||
{
|
||||
pattern_select_change_callbacks (psp, FALSE);
|
||||
}
|
||||
pattern_select_change_callbacks (psp, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -33,7 +33,6 @@ struct _PatternSelect
|
||||
|
||||
|
||||
PatternSelect * pattern_select_new (Gimp *gimp,
|
||||
GimpContext *context,
|
||||
const gchar *title,
|
||||
const gchar *initial_pattern,
|
||||
const gchar *callback_name);
|
||||
|
||||
@ -155,7 +155,7 @@ container_multi_view_new (gboolean list,
|
||||
view, NULL, NULL, FALSE, FALSE,
|
||||
*/
|
||||
|
||||
"_delete_event_", gtk_widget_destroy,
|
||||
GTK_STOCK_CLOSE, gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
@ -91,20 +91,12 @@ brushes_popup_invoker (Gimp *gimp,
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, brush_callback)))
|
||||
{
|
||||
if (initial_brush && strlen (initial_brush))
|
||||
brush_select_new (gimp, NULL, popup_title,
|
||||
initial_brush,
|
||||
opacity / 100.0,
|
||||
paint_mode,
|
||||
spacing,
|
||||
brush_callback);
|
||||
else
|
||||
brush_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
brush_callback);
|
||||
brush_select_new (gimp, popup_title,
|
||||
initial_brush,
|
||||
opacity / 100.0,
|
||||
paint_mode,
|
||||
spacing,
|
||||
brush_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -79,16 +79,10 @@ gradients_popup_invoker (Gimp *gimp,
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, gradient_callback)))
|
||||
{
|
||||
if (initial_gradient && strlen (initial_gradient))
|
||||
gradient_select_new (gimp, NULL, popup_title,
|
||||
initial_gradient,
|
||||
gradient_callback,
|
||||
sample_size);
|
||||
else
|
||||
gradient_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
gradient_callback,
|
||||
sample_size);
|
||||
gradient_select_new (gimp, popup_title,
|
||||
initial_gradient,
|
||||
gradient_callback,
|
||||
sample_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -73,14 +73,9 @@ palettes_popup_invoker (Gimp *gimp,
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, palette_callback)))
|
||||
{
|
||||
if (initial_palette && strlen (initial_palette))
|
||||
palette_select_new (gimp, NULL, popup_title,
|
||||
initial_palette,
|
||||
palette_callback);
|
||||
else
|
||||
palette_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
palette_callback);
|
||||
palette_select_new (gimp, popup_title,
|
||||
initial_palette,
|
||||
palette_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -73,14 +73,9 @@ patterns_popup_invoker (Gimp *gimp,
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, pattern_callback)))
|
||||
{
|
||||
if (initial_pattern && strlen (initial_pattern))
|
||||
pattern_select_new (gimp, NULL, popup_title,
|
||||
initial_pattern,
|
||||
pattern_callback);
|
||||
else
|
||||
pattern_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
pattern_callback);
|
||||
pattern_select_new (gimp, popup_title,
|
||||
initial_pattern,
|
||||
pattern_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -32,15 +32,11 @@
|
||||
#include "gimphelpui.h"
|
||||
|
||||
|
||||
typedef void (* GimpDialogCancelCallback) (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void gimp_dialog_class_init (GimpDialogClass *klass);
|
||||
static void gimp_dialog_init (GimpDialog *dialog);
|
||||
|
||||
|
||||
static void gimp_dialog_class_init (GimpDialogClass *klass);
|
||||
static void gimp_dialog_init (GimpDialog *dialog);
|
||||
|
||||
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *event);
|
||||
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *event);
|
||||
|
||||
|
||||
static GtkDialogClass *parent_class = NULL;
|
||||
@ -95,24 +91,13 @@ static gboolean
|
||||
gimp_dialog_delete_event (GtkWidget *widget,
|
||||
GdkEventAny *event)
|
||||
{
|
||||
GimpDialogCancelCallback cancel_callback;
|
||||
GtkWidget *cancel_widget;
|
||||
gpointer cancel_data;
|
||||
|
||||
cancel_callback = (GimpDialogCancelCallback)
|
||||
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_callback");
|
||||
GtkWidget *cancel_widget;
|
||||
|
||||
cancel_widget = (GtkWidget *)
|
||||
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_widget");
|
||||
g_object_get_data (G_OBJECT (widget), "gimp-dialog-cancel-button");
|
||||
|
||||
cancel_data =
|
||||
g_object_get_data (G_OBJECT (widget), "gimp_dialog_cancel_data");
|
||||
|
||||
/* the cancel callback has to destroy the dialog */
|
||||
if (cancel_callback)
|
||||
{
|
||||
cancel_callback (cancel_widget, cancel_data);
|
||||
}
|
||||
if (GTK_IS_WIDGET (cancel_widget))
|
||||
gtk_widget_activate (cancel_widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -314,10 +299,8 @@ gimp_dialog_create_action_areav (GimpDialog *dialog,
|
||||
|
||||
g_return_if_fail (GIMP_IS_DIALOG (dialog));
|
||||
|
||||
label = va_arg (args, const gchar *);
|
||||
|
||||
/* the action_area buttons */
|
||||
while (label)
|
||||
while ((label = va_arg (args, const gchar *)))
|
||||
{
|
||||
callback = va_arg (args, GCallback);
|
||||
callback_data = va_arg (args, gpointer);
|
||||
@ -332,66 +315,33 @@ gimp_dialog_create_action_areav (GimpDialog *dialog,
|
||||
if (callback_data == NULL)
|
||||
callback_data = dialog;
|
||||
|
||||
/*
|
||||
* Dont create a button if the label is "_delete_event_" --
|
||||
* some dialogs just need to connect to the delete_event from
|
||||
* the window...
|
||||
*/
|
||||
if (connect_delete &&
|
||||
callback &&
|
||||
! delete_connected &&
|
||||
strcmp (label, "_delete_event_") == 0)
|
||||
button = gtk_dialog_add_button (GTK_DIALOG (dialog), label,
|
||||
GTK_RESPONSE_NONE);
|
||||
|
||||
if (callback)
|
||||
{
|
||||
if (widget_ptr)
|
||||
*widget_ptr = GTK_WIDGET (dialog);
|
||||
if (slot_object)
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback),
|
||||
slot_object);
|
||||
else
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback),
|
||||
callback_data);
|
||||
}
|
||||
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_callback",
|
||||
callback);
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_widget",
|
||||
slot_object ? slot_object : G_OBJECT (dialog));
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_data",
|
||||
callback_data);
|
||||
if (widget_ptr)
|
||||
*widget_ptr = button;
|
||||
|
||||
delete_connected = TRUE;
|
||||
}
|
||||
|
||||
/* otherwise just create the requested button. */
|
||||
else
|
||||
if (connect_delete && callback && ! delete_connected)
|
||||
{
|
||||
button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
label, GTK_RESPONSE_NONE);
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-cancel-button",
|
||||
button);
|
||||
|
||||
if (callback)
|
||||
{
|
||||
if (slot_object)
|
||||
g_signal_connect_swapped (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback),
|
||||
slot_object);
|
||||
else
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (callback),
|
||||
callback_data);
|
||||
}
|
||||
delete_connected = TRUE;
|
||||
}
|
||||
|
||||
if (widget_ptr)
|
||||
*widget_ptr = button;
|
||||
|
||||
if (connect_delete && callback && ! delete_connected)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_callback",
|
||||
callback);
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_widget",
|
||||
slot_object ? slot_object : G_OBJECT (button));
|
||||
g_object_set_data (G_OBJECT (dialog), "gimp_dialog_cancel_data",
|
||||
callback_data);
|
||||
|
||||
delete_connected = TRUE;
|
||||
}
|
||||
|
||||
if (default_action)
|
||||
gtk_widget_grab_default (button);
|
||||
}
|
||||
|
||||
label = va_arg (args, gchar *);
|
||||
if (default_action)
|
||||
gtk_widget_grab_default (button);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,20 +60,12 @@ sub brushes_popup {
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, brush_callback)))
|
||||
{
|
||||
if (initial_brush && strlen (initial_brush))
|
||||
brush_select_new (gimp, NULL, popup_title,
|
||||
initial_brush,
|
||||
opacity / 100.0,
|
||||
paint_mode,
|
||||
spacing,
|
||||
brush_callback);
|
||||
else
|
||||
brush_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
brush_callback);
|
||||
brush_select_new (gimp, popup_title,
|
||||
initial_brush,
|
||||
opacity / 100.0,
|
||||
paint_mode,
|
||||
spacing,
|
||||
brush_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -57,16 +57,10 @@ sub gradients_popup {
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, gradient_callback)))
|
||||
{
|
||||
if (initial_gradient && strlen (initial_gradient))
|
||||
gradient_select_new (gimp, NULL, popup_title,
|
||||
initial_gradient,
|
||||
gradient_callback,
|
||||
sample_size);
|
||||
else
|
||||
gradient_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
gradient_callback,
|
||||
sample_size);
|
||||
gradient_select_new (gimp, popup_title,
|
||||
initial_gradient,
|
||||
gradient_callback,
|
||||
sample_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -48,14 +48,9 @@ sub palettes_popup {
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, palette_callback)))
|
||||
{
|
||||
if (initial_palette && strlen (initial_palette))
|
||||
palette_select_new (gimp, NULL, popup_title,
|
||||
initial_palette,
|
||||
palette_callback);
|
||||
else
|
||||
palette_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
palette_callback);
|
||||
palette_select_new (gimp, popup_title,
|
||||
initial_palette,
|
||||
palette_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -47,14 +47,9 @@ sub patterns_popup {
|
||||
if (! gimp->no_interface &&
|
||||
(proc = procedural_db_lookup (gimp, pattern_callback)))
|
||||
{
|
||||
if (initial_pattern && strlen (initial_pattern))
|
||||
pattern_select_new (gimp, NULL, popup_title,
|
||||
initial_pattern,
|
||||
pattern_callback);
|
||||
else
|
||||
pattern_select_new (gimp, NULL, popup_title,
|
||||
NULL,
|
||||
pattern_callback);
|
||||
pattern_select_new (gimp, popup_title,
|
||||
initial_pattern,
|
||||
pattern_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user