Commit 66c5dd87 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

removed our own action_area API and use GtkDialog's one. Create all

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

	* libgimpwidgets/gimpdialog.[ch]: removed our own action_area API
	and use GtkDialog's one. Create all dialogs without separator.
	Changed almost everything else too. Fixes bug #125143.

	* libgimpwidgets/gimpquerybox.c
	* libgimpwidgets/gimpunitmenu.c: changed accordingly.

	* libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType
	to GimpExportReturn.

	* libgimp/gimpcompat.h: added a #define for the old name.

	* themes/Default/gtkrc: increased action_area border to 6 pixels.

	* app/display/gimpdisplayshell-filter-dialog.c
	* app/display/gimpdisplayshell-scale.c
	* app/display/gimpprogress.c
	* app/gui/brush-select.c
	* app/gui/channels-commands.c
	* app/gui/color-notebook.c
	* app/gui/convert-dialog.c
	* app/gui/file-new-dialog.c
	* app/gui/font-select.c
	* app/gui/gradient-editor-commands.c
	* app/gui/gradient-select.c
	* app/gui/grid-dialog.c
	* app/gui/image-commands.c
	* app/gui/info-window.c
	* app/gui/layers-commands.c
	* app/gui/module-browser.c
	* app/gui/offset-dialog.c
	* app/gui/palette-import-dialog.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c
	* app/gui/preferences-dialog.c
	* app/gui/qmask-commands.c
	* app/gui/resize-dialog.c
	* app/gui/resolution-calibrate-dialog.c
	* app/gui/stroke-dialog.c
	* app/gui/templates-commands.c
	* app/gui/user-install-dialog.c
	* app/gui/vectors-commands.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimptransformtool.c
	* app/widgets/gimptexteditor.c
	* app/widgets/gimptooldialog.[ch]
	* app/widgets/gimpviewabledialog.[ch]
	* app/widgets/gimpwidgets-utils.c: changed accordingly and increased
	the dialogs' outer borders to 6 pixels all over the place.

	* plug-ins/*/*.c: changed accordingly. The plug-ins may be
	arbitrarily broken, I tested none of them.
parent 5648130a
2003-11-06 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpdialog.[ch]: removed our own action_area API
and use GtkDialog's one. Create all dialogs without separator.
Changed almost everything else too. Fixes bug #125143.
* libgimpwidgets/gimpquerybox.c
* libgimpwidgets/gimpunitmenu.c: changed accordingly.
* libgimp/gimpexport.[ch]: ditto. Renamed enum GimpExportReturnType
to GimpExportReturn.
* libgimp/gimpcompat.h: added a #define for the old name.
* themes/Default/gtkrc: increased action_area border to 6 pixels.
* app/display/gimpdisplayshell-filter-dialog.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpprogress.c
* app/gui/brush-select.c
* app/gui/channels-commands.c
* app/gui/color-notebook.c
* app/gui/convert-dialog.c
* app/gui/file-new-dialog.c
* app/gui/font-select.c
* app/gui/gradient-editor-commands.c
* app/gui/gradient-select.c
* app/gui/grid-dialog.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/module-browser.c
* app/gui/offset-dialog.c
* app/gui/palette-import-dialog.c
* app/gui/palette-select.c
* app/gui/pattern-select.c
* app/gui/preferences-dialog.c
* app/gui/qmask-commands.c
* app/gui/resize-dialog.c
* app/gui/resolution-calibrate-dialog.c
* app/gui/stroke-dialog.c
* app/gui/templates-commands.c
* app/gui/user-install-dialog.c
* app/gui/vectors-commands.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimptransformtool.c
* app/widgets/gimptexteditor.c
* app/widgets/gimptooldialog.[ch]
* app/widgets/gimpviewabledialog.[ch]
* app/widgets/gimpwidgets-utils.c: changed accordingly and increased
the dialogs' outer borders to 6 pixels all over the place.
* plug-ins/*/*.c: changed accordingly. The plug-ins may be
arbitrarily broken, I tested none of them.
2003-11-06 Sven Neumann <sven@gimp.org>
* devel-docs/gbr.txt: documented what I found out about the GIMP
......@@ -243,33 +243,35 @@ static GimpRGB channel_color = { 0.0, 0.0, 0.0, 0.5 };
static void
new_channel_query_ok_callback (GtkWidget *widget,
gpointer data)
new_channel_query_response (GtkWidget *widget,
gint response_id,
NewChannelOptions *options)
{
NewChannelOptions *options;
GimpChannel *new_channel;
GimpImage *gimage;
options = (NewChannelOptions *) data;
if (channel_name)
g_free (channel_name);
channel_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
if ((gimage = options->gimage))
if (response_id == GTK_RESPONSE_OK)
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&channel_color);
new_channel = gimp_channel_new (gimage, gimage->width, gimage->height,
channel_name,
&channel_color);
GimpChannel *new_channel;
GimpImage *gimage;
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
gimp_get_user_context (gimage->gimp),
GIMP_TRANSPARENT_FILL);
if (channel_name)
g_free (channel_name);
channel_name =
g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gimp_image_add_channel (gimage, new_channel, -1);
gimp_image_flush (gimage);
if ((gimage = options->gimage))
{
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&channel_color);
new_channel = gimp_channel_new (gimage, gimage->width, gimage->height,
channel_name,
&channel_color);
gimp_drawable_fill_by_type (GIMP_DRAWABLE (new_channel),
gimp_get_user_context (gimage->gimp),
GIMP_TRANSPARENT_FILL);
gimp_image_add_channel (gimage, new_channel, -1);
gimp_image_flush (gimage);
}
}
gtk_widget_destroy (options->query_box);
......@@ -346,11 +348,8 @@ channels_new_channel_query (GimpImage *gimage,
gimp_standard_help_func,
GIMP_HELP_CHANNEL_NEW,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, new_channel_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
......@@ -358,9 +357,13 @@ channels_new_channel_query (GimpImage *gimage,
(GWeakNotify) g_free,
options);
g_signal_connect (options->query_box, "response",
G_CALLBACK (new_channel_query_response),
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
......@@ -426,49 +429,49 @@ struct _EditChannelOptions
};
static void
edit_channel_query_ok_callback (GtkWidget *widget,
gpointer data)
edit_channel_query_response (GtkWidget *widget,
gint response_id,
EditChannelOptions *options)
{
EditChannelOptions *options;
GimpChannel *channel;
options = (EditChannelOptions *) data;
channel = options->channel;
if (options->gimage)
if (response_id == GTK_RESPONSE_OK)
{
const gchar *new_name;
GimpRGB color;
gboolean name_changed = FALSE;
gboolean color_changed = FALSE;
GimpChannel *channel = options->channel;
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
if (options->gimage)
{
const gchar *new_name;
GimpRGB color;
gboolean name_changed = FALSE;
gboolean color_changed = FALSE;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&color);
new_name = gtk_entry_get_text (GTK_ENTRY (options->name_entry));
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (channel))))
name_changed = TRUE;
gimp_color_button_get_color (GIMP_COLOR_BUTTON (options->color_panel),
&color);
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
color_changed = TRUE;
if (strcmp (new_name, gimp_object_get_name (GIMP_OBJECT (channel))))
name_changed = TRUE;
if (name_changed && color_changed)
gimp_image_undo_group_start (options->gimage,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
_("Channel Attributes"));
if (gimp_rgba_distance (&color, &channel->color) > 0.0001)
color_changed = TRUE;
if (name_changed)
gimp_item_rename (GIMP_ITEM (channel), new_name);
if (name_changed && color_changed)
gimp_image_undo_group_start (options->gimage,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
_("Channel Attributes"));
if (color_changed)
gimp_channel_set_color (channel, &color, TRUE);
if (name_changed)
gimp_item_rename (GIMP_ITEM (channel), new_name);
if (name_changed && color_changed)
gimp_image_undo_group_end (options->gimage);
if (color_changed)
gimp_channel_set_color (channel, &color, TRUE);
if (name_changed || color_changed)
gimp_image_flush (options->gimage);
if (name_changed && color_changed)
gimp_image_undo_group_end (options->gimage);
if (name_changed || color_changed)
gimp_image_flush (options->gimage);
}
}
gtk_widget_destroy (options->query_box);
......@@ -506,11 +509,8 @@ channels_edit_channel_query (GimpChannel *channel)
gimp_standard_help_func,
GIMP_HELP_CHANNEL_EDIT,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, edit_channel_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
......@@ -518,9 +518,13 @@ channels_edit_channel_query (GimpChannel *channel)
(GWeakNotify) g_free,
options);
g_signal_connect (options->query_box, "response",
G_CALLBACK (edit_channel_query_response),
options);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
hbox = gtk_hbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
hbox);
......
......@@ -52,16 +52,16 @@ static void gradient_editor_right_color_changed (ColorNotebook *cnb,
gpointer data);
static GimpGradientSegment *
gradient_editor_save_selection (GimpGradientEditor *editor);
static void gradient_editor_replace_selection (GimpGradientEditor *editor,
gradient_editor_save_selection (GimpGradientEditor *editor);
static void gradient_editor_replace_selection (GimpGradientEditor *editor,
GimpGradientSegment *replace_seg);
static void gradient_editor_dialog_cancel_callback (GtkWidget *widget,
GimpGradientEditor *editor);
static void gradient_editor_split_uniform_callback (GtkWidget *widget,
GimpGradientEditor *editor);
static void gradient_editor_replicate_callback (GtkWidget *widget,
GimpGradientEditor *editor);
static void gradient_editor_split_uniform_response (GtkWidget *widget,
gint response_id,
GimpGradientEditor *editor);
static void gradient_editor_replicate_response (GtkWidget *widget,
gint response_id,
GimpGradientEditor *editor);
/* public functionss */
......@@ -529,17 +529,16 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget,
gimp_standard_help_func,
GIMP_HELP_GRADIENT_EDITOR_REPLICATE,
GTK_STOCK_CANCEL,
gradient_editor_dialog_cancel_callback,
editor, NULL, NULL, TRUE, TRUE,
_("Replicate"),
gradient_editor_replicate_callback,
editor, NULL, NULL, FALSE, FALSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("Replicate"), GTK_RESPONSE_OK,
NULL);
vbox = gtk_vbox_new (FALSE, 0);
g_signal_connect (dialog, "response",
G_CALLBACK (gradient_editor_replicate_response),
editor);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
gtk_widget_show (vbox);
......@@ -628,7 +627,6 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
desc = _("Split Gradient Segments Uniformly");
}
/* Create dialog window */
dialog =
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
title, "gradient_segment_split_uniformly",
......@@ -636,18 +634,17 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
gimp_standard_help_func,
GIMP_HELP_GRADIENT_EDITOR_SPLIT_UNIFORM,
GTK_STOCK_CANCEL,
gradient_editor_dialog_cancel_callback,
editor, NULL, NULL, FALSE, TRUE,
_("Split"),
gradient_editor_split_uniform_callback,
editor, NULL, NULL, TRUE, FALSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("Split"), GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (gradient_editor_split_uniform_response),
editor);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 0);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
gtk_widget_show (vbox);
......@@ -1068,162 +1065,164 @@ gradient_editor_replace_selection (GimpGradientEditor *editor,
}
static void
gradient_editor_dialog_cancel_callback (GtkWidget *widget,
gradient_editor_split_uniform_response (GtkWidget *widget,
gint response_id,
GimpGradientEditor *editor)
{
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_destroy (widget);
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
}
static void
gradient_editor_split_uniform_callback (GtkWidget *widget,
GimpGradientEditor *editor)
{
GimpGradient *gradient;
GimpGradientSegment *seg, *aseg, *lseg, *rseg, *lsel;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
if (response_id == GTK_RESPONSE_OK)
{
GimpGradient *gradient;
GimpGradientSegment *seg, *aseg, *lseg, *rseg, *lsel;
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
seg = editor->control_sel_l;
lsel = NULL;
seg = editor->control_sel_l;
lsel = NULL;
do
{
aseg = seg;
do
{
aseg = seg;
gimp_gradient_segment_split_uniform (gradient, seg,
editor->split_parts, &lseg, &rseg);
gimp_gradient_segment_split_uniform (gradient, seg,
editor->split_parts,
&lseg, &rseg);
if (seg == editor->control_sel_l)
lsel = lseg;
if (seg == editor->control_sel_l)
lsel = lseg;
seg = rseg->next;
}
while (aseg != editor->control_sel_r);
seg = rseg->next;
}
while (aseg != editor->control_sel_r);
editor->control_sel_l = lsel;
editor->control_sel_r = rseg;
editor->control_sel_l = lsel;
editor->control_sel_r = rseg;
gimp_data_dirty (GIMP_DATA (gradient));
gimp_gradient_editor_update (editor);
gimp_data_dirty (GIMP_DATA (gradient));
gimp_gradient_editor_update (editor);
}
}
static void
gradient_editor_replicate_callback (GtkWidget *widget,
gradient_editor_replicate_response (GtkWidget *widget,
gint response_id,
GimpGradientEditor *editor)
{
GimpGradient *gradient;
gdouble sel_left, sel_right, sel_len;
gdouble new_left;
gdouble factor;
GimpGradientSegment *prev, *seg, *tmp;
GimpGradientSegment *oseg, *oaseg;
GimpGradientSegment *lseg, *rseg;
gint i;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
gtk_widget_destroy (widget);
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
/* Remember original parameters */
sel_left = editor->control_sel_l->left;
sel_right = editor->control_sel_r->right;
sel_len = sel_right - sel_left;
if (response_id == GTK_RESPONSE_OK)
{
GimpGradient *gradient;
gdouble sel_left, sel_right, sel_len;
gdouble new_left;
gdouble factor;
GimpGradientSegment *prev, *seg, *tmp;
GimpGradientSegment *oseg, *oaseg;
GimpGradientSegment *lseg, *rseg;
gint i;
factor = 1.0 / editor->replicate_times;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
/* Build replicated segments */
/* Remember original parameters */
sel_left = editor->control_sel_l->left;
sel_right = editor->control_sel_r->right;
sel_len = sel_right - sel_left;
prev = NULL;
seg = NULL;
tmp = NULL;
factor = 1.0 / editor->replicate_times;
for (i = 0; i < editor->replicate_times; i++)
{
/* Build one cycle */
/* Build replicated segments */
new_left = sel_left + i * factor * sel_len;
prev = NULL;
seg = NULL;
tmp = NULL;
oseg = editor->control_sel_l;
for (i = 0; i < editor->replicate_times; i++)
{
/* Build one cycle */
do
{
seg = gimp_gradient_segment_new ();
new_left = sel_left + i * factor * sel_len;
if (prev == NULL)
{
seg->left = sel_left;
tmp = seg; /* Remember first segment */
}
else
seg->left = new_left + factor * (oseg->left - sel_left);
oseg = editor->control_sel_l;
seg->middle = new_left + factor * (oseg->middle - sel_left);
seg->right = new_left + factor * (oseg->right - sel_left);
do
{
seg = gimp_gradient_segment_new ();
seg->left_color = oseg->right_color;
if (prev == NULL)
{
seg->left = sel_left;
tmp = seg; /* Remember first segment */
}
else
{
seg->left = new_left + factor * (oseg->left - sel_left);
}
seg->right_color = oseg->right_color;
seg->middle = new_left + factor * (oseg->middle - sel_left);
seg->right = new_left + factor * (oseg->right - sel_left);
seg->type = oseg->type;
seg->color = oseg->color;
seg->left_color = oseg->right_color;
seg->right_color = oseg->right_color;
seg->prev = prev;
seg->next = NULL;
seg->type = oseg->type;
seg->color = oseg->color;
if (prev)
prev->next = seg;
seg->prev = prev;
seg->next = NULL;
prev = seg;
if (prev)
prev->next = seg;
oaseg = oseg;
oseg = oseg->next;
}
while (oaseg != editor->control_sel_r);
}
prev = seg;
seg->right = sel_right; /* Squish accumulative error */
oaseg = oseg;
oseg = oseg->next;
}
while (oaseg != editor->control_sel_r);
}
/* Free old segments */
seg->right = sel_right; /* Squish accumulative error */
lseg = editor->control_sel_l->prev;
rseg = editor->control_sel_r->next;
/* Free old segments */
oseg = editor->control_sel_l;
lseg = editor->control_sel_l->prev;
rseg = editor->control_sel_r->next;
do
{
oaseg = oseg->next;
gimp_gradient_segment_free (oseg);
oseg = oaseg;
}
while (oaseg != rseg);
oseg = editor->control_sel_l;
/* Link in new segments */
do
{
oaseg = oseg->next;
gimp_gradient_segment_free (oseg);
oseg = oaseg;
}
while (oaseg != rseg);
if (lseg)
lseg->next = tmp;
else
gradient->segments = tmp;
/* Link in new segments */
tmp->prev = lseg;
if (lseg)
lseg->next = tmp;
else
gradient->segments = tmp;
seg->next = rseg;
tmp->prev = lseg;
if (rseg)
rseg->prev = seg;
seg->next = rseg;
/* Reset selection */
if (rseg)
rseg->prev = seg;
editor->control_sel_l = tmp;
editor->control_sel_r = seg;
/* Reset selection */
/* Done */
editor->control_sel_l = tmp;
editor->control_sel_r = seg;
gimp_data_dirty (GIMP_DATA (gradient));
gimp_gradient_editor_update (editor);
/* Done */
gimp_data_dirty (GIMP_DATA (gradient));
gimp_gradient_editor_update (editor);