Commit cc3bdec2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/widgets/Makefile.am app/widgets/widgets-types.h new dialog widget

2002-08-30  Michael Natterer  <mitch@gimp.org>

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpviewabledialog.[ch]: new dialog widget featuring
	a title bar containing a stock icon, a description, the viewable's
	name and a preview. Will be used for all viewable related dialogs
	and serves as a common place to control their look & feel.

	* app/tools/gimpimagemaptool.[ch]: removed the code which did
	almost the same and use GimpViewableDialog.

	* app/gui/info-dialog.[ch]: extended the API so it has enough
	information to create a GimpViewableDialog.

	* app/gui/channels-commands.c
	* app/gui/convert-dialog.c
	* app/gui/gradient-editor-commands.c
	* app/gui/image-commands.c
	* app/gui/info-window.c
	* app/gui/layers-commands.c
	* app/gui/offset-dialog.c
	* app/gui/qmask-commands.c
	* app/gui/resize-dialog.c
	* app/gui/vectors-commands.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpperspectivetool.c
	* app/tools/gimprotatetool.c
	* app/tools/gimpscaletool.c
	* app/tools/gimpsheartool.c: use GimpViewableDialogs

	* themes/Default/gtkrc: apply the dialog style to "*Gimp*Dialog*",
	not only "*GimpDialog*" so it covers GimpViewableDialog.
parent 77934d68
2002-08-30 Michael Natterer <mitch@gimp.org>
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpviewabledialog.[ch]: new dialog widget featuring
a title bar containing a stock icon, a description, the viewable's
name and a preview. Will be used for all viewable related dialogs
and serves as a common place to control their look & feel.
* app/tools/gimpimagemaptool.[ch]: removed the code which did
almost the same and use GimpViewableDialog.
* app/gui/info-dialog.[ch]: extended the API so it has enough
information to create a GimpViewableDialog.
* app/gui/channels-commands.c
* app/gui/convert-dialog.c
* app/gui/gradient-editor-commands.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/offset-dialog.c
* app/gui/qmask-commands.c
* app/gui/resize-dialog.c
* app/gui/vectors-commands.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimphistogramtool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpperspectivetool.c
* app/tools/gimprotatetool.c
* app/tools/gimpscaletool.c
* app/tools/gimpsheartool.c: use GimpViewableDialogs
* themes/Default/gtkrc: apply the dialog style to "*Gimp*Dialog*",
not only "*GimpDialog*" so it covers GimpViewableDialog.
2002-08-31 James Henstridge <james@daa.com.au>
* libgimp/gimp.c (gimp_run_procedure): handle GIMP_PDB_COLOR
......
......@@ -37,6 +37,7 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "channels-commands.h"
......@@ -293,19 +294,20 @@ channels_new_channel_query (GimpImage *gimage,
/* The dialog */
options->query_box =
gimp_dialog_new (_("New Channel Options"), "new_channel_options",
gimp_standard_help_func,
"dialogs/channels/new_channel.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Channel"), "new_channel_options",
GTK_STOCK_NEW,
_("New Channel Options"),
gimp_standard_help_func,
"dialogs/channels/new_channel.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
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_OK, new_channel_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......@@ -441,19 +443,20 @@ channels_edit_channel_query (GimpChannel *channel)
/* The dialog */
options->query_box =
gimp_dialog_new (_("Edit Channel Attributes"), "edit_channel_attributes",
gimp_standard_help_func,
"dialogs/channels/edit_channel_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (channel),
_("Channel Attributes"), "edit_channel_attributes",
GIMP_STOCK_EDIT,
_("Edit Channel Attributes"),
gimp_standard_help_func,
"dialogs/channels/edit_channel_attributes.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
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_OK, edit_channel_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......
......@@ -535,7 +535,6 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget,
if (! editor)
return;
/* Create dialog window */
dialog =
gimp_dialog_new ((editor->control_sel_l == editor->control_sel_r) ?
_("Replicate segment") :
......@@ -584,7 +583,6 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget,
G_CALLBACK (gimp_int_adjustment_update),
&editor->replicate_times);
/* Show! */
gtk_widget_show (dialog);
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
}
......
......@@ -34,6 +34,8 @@
#include "core/gimpimage-resize.h"
#include "core/gimpimage-scale.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpprogress.h"
......@@ -286,19 +288,20 @@ image_layers_merge_query (GimpImage *gimage,
/* The dialog */
options->query_box =
gimp_dialog_new (_("Layers Merge Options"), "layers_merge_options",
gimp_standard_help_func,
"dialogs/layers/merge_visible_layers.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("Merge Layers"), "layers_merge_options",
GIMP_STOCK_MERGE_DOWN,
_("Layers Merge Options"),
gimp_standard_help_func,
"dialogs/layers/merge_visible_layers.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, image_layers_merge_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, image_layers_merge_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......
......@@ -42,6 +42,7 @@
#include "widgets/gimpenummenu.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "layers-commands.h"
......@@ -577,19 +578,20 @@ layers_new_layer_query (GimpImage *gimage,
/* The dialog */
options->query_box =
gimp_dialog_new (_("New Layer Options"), "new_layer_options",
gimp_standard_help_func,
"dialogs/layers/new_layer.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Layer"), "new_layer_options",
GTK_STOCK_NEW,
_("New Layer Options"),
gimp_standard_help_func,
"dialogs/layers/new_layer.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, new_layer_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, new_layer_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......@@ -766,19 +768,21 @@ layers_edit_layer_query (GimpLayer *layer)
/* The dialog */
options->query_box =
gimp_dialog_new (_("Edit Layer Attributes"), "edit_layer_attributes",
gimp_standard_help_func,
"dialogs/layers/edit_layer_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Layer Attributes"),
"edit_layer_attributes",
GIMP_STOCK_EDIT,
_("Edit Layer Attributes"),
gimp_standard_help_func,
"dialogs/layers/edit_layer_attributes.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, edit_layer_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, edit_layer_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......@@ -871,19 +875,20 @@ layers_add_mask_query (GimpLayer *layer)
/* The dialog */
options->query_box =
gimp_dialog_new (_("Add Mask Options"), "add_mask_options",
gimp_standard_help_func,
"dialogs/layers/add_layer_mask.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (layer),
_("Add Mask"), "add_mask_options",
GTK_STOCK_ADD,
_("Add Layer Mask Options"),
gimp_standard_help_func,
"dialogs/layers/add_layer_mask.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, add_mask_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, add_mask_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......
......@@ -31,6 +31,7 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
......@@ -173,19 +174,20 @@ qmask_channel_query (GimpDisplayShell *shell)
/* The dialog */
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->gdisp->gimage),
_("Qmask Attributes"), "edit_qmask_attributes",
GIMP_STOCK_QMASK_ON,
_("Edit QuickMask Attributes"),
gimp_standard_help_func,
"dialogs/edit_qmask_attributes.html",
GTK_STOCK_CANCEL, qmask_query_cancel_callback,
options, NULL, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, qmask_query_cancel_callback,
options, NULL, NULL, FALSE, TRUE,
GTK_STOCK_OK, qmask_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, qmask_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
......
......@@ -31,6 +31,7 @@
#include "widgets/gimpcolorpanel.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpdisplay.h"
......@@ -173,19 +174,20 @@ qmask_channel_query (GimpDisplayShell *shell)
/* The dialog */
options->query_box =
gimp_dialog_new (_("Edit Qmask Attributes"), "edit_qmask_attributes",
gimp_standard_help_func,
"dialogs/edit_qmask_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (shell->gdisp->gimage),
_("Qmask Attributes"), "edit_qmask_attributes",
GIMP_STOCK_QMASK_ON,
_("Edit QuickMask Attributes"),
gimp_standard_help_func,
"dialogs/edit_qmask_attributes.html",
GTK_STOCK_CANCEL, qmask_query_cancel_callback,
options, NULL, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, qmask_query_cancel_callback,
options, NULL, NULL, FALSE, TRUE,
GTK_STOCK_OK, qmask_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, qmask_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
/* The main hbox */
hbox = gtk_hbox_new (FALSE, 4);
......
......@@ -42,6 +42,7 @@
#include "vectors/gimpvectors.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "tools/gimppainttool.h"
......@@ -435,19 +436,20 @@ vectors_new_vectors_query (GimpImage *gimage,
/* The dialog */
options->query_box =
gimp_dialog_new (_("New Path Options"), "new_path_options",
gimp_standard_help_func,
"dialogs/vectors/new_vectors.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("New Path"), "new_path_options",
GTK_STOCK_NEW,
_("New Path Options"),
gimp_standard_help_func,
"dialogs/vectors/new_vectors.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, new_vectors_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, new_vectors_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......@@ -550,19 +552,20 @@ vectors_edit_vectors_query (GimpVectors *vectors)
/* The dialog */
options->query_box =
gimp_dialog_new (_("Edit Path Attributes"), "edit_path_attributes",
gimp_standard_help_func,
"dialogs/paths/edit_path_attributes.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (vectors),
_("Path Attributes"), "edit_path_attributes",
GIMP_STOCK_EDIT,
_("Edit Path Attributes"),
gimp_standard_help_func,
"dialogs/paths/edit_path_attributes.html",
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, gtk_widget_destroy,
NULL, 1, NULL, FALSE, TRUE,
GTK_STOCK_OK, edit_vectors_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, edit_vectors_query_ok_callback,
options, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
g_object_weak_ref (G_OBJECT (options->query_box),
(GWeakNotify) g_free,
......
......@@ -83,6 +83,8 @@ static GimpConvertPaletteType spalette_type = GIMP_MAKE_PALETTE;
void
convert_to_rgb (GimpImage *gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_image_convert (gimage, GIMP_RGB, 0, 0, 0, 0, 0, NULL);
gimp_image_flush (gimage);
}
......@@ -90,6 +92,8 @@ convert_to_rgb (GimpImage *gimage)
void
convert_to_grayscale (GimpImage* gimage)
{
g_return_if_fail (GIMP_IS_IMAGE (gimage));
gimp_image_convert (gimage, GIMP_GRAY, 0, 0, 0, 0, 0, NULL);
gimp_image_flush (gimage);
}
......@@ -108,6 +112,8 @@ convert_to_indexed (GimpImage *gimage)
GtkWidget *toggle;
GSList *group = NULL;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
dialog = g_new0 (IndexedDialog, 1);
dialog->gimage = gimage;
......@@ -120,19 +126,21 @@ convert_to_indexed (GimpImage *gimage)
dialog->palette_type = spalette_type;
dialog->shell =
gimp_dialog_new (_("Indexed Color Conversion"), "indexed_color_conversion",
gimp_standard_help_func,
"dialogs/convert_to_indexed.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
_("Indexed Color Conversion"),
"indexed_color_conversion",
GIMP_STOCK_CONVERT_INDEXED,
_("Convert Image to Indexed Colors"),
gimp_standard_help_func,
"dialogs/convert_to_indexed.html",
GTK_STOCK_CANCEL, indexed_cancel_callback,
dialog, NULL, NULL, FALSE, TRUE,
GTK_STOCK_CANCEL, indexed_cancel_callback,
dialog, NULL, NULL, FALSE, TRUE,
GTK_STOCK_OK, indexed_ok_callback,
dialog, NULL, NULL, TRUE, FALSE,
GTK_STOCK_OK, indexed_ok_callback,
dialog, NULL, NULL, TRUE, FALSE,
NULL);
NULL);
main_vbox = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
......
......@@ -26,6 +26,8 @@
#include "gui-types.h"
#include "widgets/gimpviewabledialog.h"
#include "info-dialog.h"
#include "gimprc.h"
......@@ -158,7 +160,11 @@ info_dialog_delete_callback (GtkWidget *widget,
}
static InfoDialog *
info_dialog_new_extended (gchar *title,
info_dialog_new_extended (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data,
gboolean in_notebook)
......@@ -173,9 +179,11 @@ info_dialog_new_extended (gchar *title,
idialog->field_list = NULL;
idialog->nfields = 0;
shell = g_object_new (GIMP_TYPE_DIALOG, NULL);
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (shell), title);
shell = gimp_viewable_dialog_new (viewable,
title, wmclass_name,
stock_id, desc,
help_func, help_data,
NULL);
g_signal_connect (G_OBJECT (shell), "delete_event",
G_CALLBACK (info_dialog_delete_callback),
......@@ -213,28 +221,37 @@ info_dialog_new_extended (gchar *title,
gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->vbox);
/* Connect the "F1" help key */
gimp_help_connect (idialog->shell, help_func, help_data);
return idialog;
}
/* public functions */
InfoDialog *
info_dialog_notebook_new (gchar *title,
GimpHelpFunc help_func,
info_dialog_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (title, help_func, help_data, TRUE);
return info_dialog_new_extended (viewable, title, wmclass_name,
stock_id, desc,
help_func, help_data, TRUE);
}
InfoDialog *
info_dialog_new (gchar *title,
info_dialog_new (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (title, help_func, help_data, FALSE);
return info_dialog_new_extended (viewable, title, wmclass_name,
stock_id, desc,
help_func, help_data, FALSE);
}
void
......
......@@ -57,10 +57,18 @@ struct _InfoDialog
/* Info Dialog functions */
InfoDialog *info_dialog_new (gchar *title,
InfoDialog *info_dialog_new (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data);
InfoDialog *info_dialog_notebook_new (gchar *title,
InfoDialog *info_dialog_notebook_new (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data);
void info_dialog_free (InfoDialog *idialog);
......
......@@ -322,7 +322,10 @@ info_window_create (GimpDisplay *gdisp)
type = gimp_image_base_type (gdisp->gimage);
title = info_window_title (gdisp);
info_win = info_dialog_notebook_new (title,
info_win = info_dialog_notebook_new (GIMP_VIEWABLE (gdisp->gimage),
title, "image_info",
GIMP_STOCK_INFO,
_("Image Information"),
gimp_standard_help_func,
"dialogs/info_window.html");
g_free (title);
......
......@@ -32,6 +32,8 @@
#include "core/gimplayermask.h"
#include "core/gimpimage.h"
#include "widgets/gimpviewabledialog.h"
#include "offset-dialog.h"
#include "libgimp/gimpintl.h"
......@@ -79,6 +81,8 @@ offset_dialog_create (GimpDrawable *drawable)
GtkWidget *radio_button;
const gchar *title = NULL;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
off_d = g_new0 (OffsetDialog, 1);
off_d->wrap_around = TRUE;
......@@ -94,19 +98,21 @@ offset_dialog_create (GimpDrawable *drawable)
else