diff --git a/ChangeLog b/ChangeLog index f86c5222717f25669bed37c421725e25e64c9ff4..144e958e7c1473f975b053e1f6f9b424038e7cbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2002-08-30 Michael Natterer + + * 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 * libgimp/gimp.c (gimp_run_procedure): handle GIMP_PDB_COLOR diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c index ec3c684e69a7eefdcefa6ffb405fb0c013ee168a..4954e43a67685710c6f5c184e2450199b2dd23d3 100644 --- a/app/actions/channels-commands.c +++ b/app/actions/channels-commands.c @@ -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, diff --git a/app/actions/gradient-editor-commands.c b/app/actions/gradient-editor-commands.c index 15e2e7944e4d5c8ebf4e358a257450677fab40fc..7374c0e7cbccaee3f54de2a48689598b2cc4b621 100644 --- a/app/actions/gradient-editor-commands.c +++ b/app/actions/gradient-editor-commands.c @@ -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); } diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index 112b486e4ece6f172492b3f6146dce022b1c7163..3150741edbc6bf2fb1e8fd8b51975164842d01e7 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -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, diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c index d407a75bc393ea8611098bc1cff66b3d0c7aa5f4..9c2d2f85eaabf4a8be8549e936488fc34d1e2466 100644 --- a/app/actions/layers-commands.c +++ b/app/actions/layers-commands.c @@ -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, diff --git a/app/actions/qmask-commands.c b/app/actions/qmask-commands.c index ec75b35532633520f79c4442d752ddc50bf3a027..5762e355f294eeaafb7e0d7157959dce3227f9d4 100644 --- a/app/actions/qmask-commands.c +++ b/app/actions/qmask-commands.c @@ -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); diff --git a/app/actions/quick-mask-commands.c b/app/actions/quick-mask-commands.c index ec75b35532633520f79c4442d752ddc50bf3a027..5762e355f294eeaafb7e0d7157959dce3227f9d4 100644 --- a/app/actions/quick-mask-commands.c +++ b/app/actions/quick-mask-commands.c @@ -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); diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c index 93b613a5db2113dfbd571eaa5ee2f422e7bd81c7..0adf4c65fe775ddf305c69eebf784cc0b4a50fba 100644 --- a/app/actions/vectors-commands.c +++ b/app/actions/vectors-commands.c @@ -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, diff --git a/app/dialogs/convert-dialog.c b/app/dialogs/convert-dialog.c index ef940486d473f5237502aea4b2b4aa9cbce3ac2d..c549d35757a58582b69d56310debfefc31aabaf1 100644 --- a/app/dialogs/convert-dialog.c +++ b/app/dialogs/convert-dialog.c @@ -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); diff --git a/app/dialogs/info-dialog.c b/app/dialogs/info-dialog.c index dd9fffe1fb8dbaf3f31f0e454de96a883b94d801..6b886b626d71cd943a419d81df47255a77815d7e 100644 --- a/app/dialogs/info-dialog.c +++ b/app/dialogs/info-dialog.c @@ -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 diff --git a/app/dialogs/info-dialog.h b/app/dialogs/info-dialog.h index 735dbc2b56de9702efaf5613fbc20eeec5adbecf..ec96edd77b32d9e66f39a8f3605bcef76268db8f 100644 --- a/app/dialogs/info-dialog.h +++ b/app/dialogs/info-dialog.h @@ -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); diff --git a/app/dialogs/info-window.c b/app/dialogs/info-window.c index 909e5af35cacac0cc0ff9a115aa7a859ed4147dc..ef5f68758cde7652882dd4cbd88d451c1c14668a 100644 --- a/app/dialogs/info-window.c +++ b/app/dialogs/info-window.c @@ -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); diff --git a/app/dialogs/offset-dialog.c b/app/dialogs/offset-dialog.c index 48747b064a7c49516f893db1d3d9b5693f5d5f69..9522de023490fdf5e7d42ce40cefa161e0497845 100644 --- a/app/dialogs/offset-dialog.c +++ b/app/dialogs/offset-dialog.c @@ -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 g_warning ("%s: unexpected drawable type", G_STRLOC); - off_d->dlg = gimp_dialog_new (title, "offset", - gimp_standard_help_func, - "dialogs/offset.html", - GTK_WIN_POS_NONE, - FALSE, TRUE, FALSE, + off_d->dlg = + gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable), + _("Offset"), "offset", + GIMP_STOCK_TOOL_MOVE, + title, + gimp_standard_help_func, + "dialogs/offset.html", - GTK_STOCK_CANCEL, offset_cancel_callback, - off_d, NULL, NULL, FALSE, TRUE, + GTK_STOCK_CANCEL, offset_cancel_callback, + off_d, NULL, NULL, FALSE, TRUE, - GTK_STOCK_OK, offset_ok_callback, - off_d, NULL, NULL, TRUE, FALSE, + GTK_STOCK_OK, offset_ok_callback, + off_d, NULL, NULL, TRUE, FALSE, - NULL); + NULL); /* The vbox for first column of options */ vbox = gtk_vbox_new (FALSE, 2); diff --git a/app/dialogs/resize-dialog.c b/app/dialogs/resize-dialog.c index 47999b92bd5163f95c139d06f8e2bab19489bd02..a26423c9e5eb331d75d1ef45c859228deefebbc6 100644 --- a/app/dialogs/resize-dialog.c +++ b/app/dialogs/resize-dialog.c @@ -32,6 +32,7 @@ #include "core/gimplayer.h" #include "widgets/gimpenummenu.h" +#include "widgets/gimpviewabledialog.h" #include "resize-dialog.h" @@ -167,11 +168,14 @@ resize_widget_new (GimpImage *gimage, { const gchar *wmclass = NULL; const gchar *window_title = NULL; + const gchar *stock_id = NULL; gchar *help_page = NULL; switch (type) { case ScaleWidget: + stock_id = GIMP_STOCK_SCALE; + switch (target) { case ResizeLayer: @@ -190,6 +194,8 @@ resize_widget_new (GimpImage *gimage, break; case ResizeWidget: + stock_id = GIMP_STOCK_RESIZE; + switch (target) { case ResizeLayer: @@ -208,24 +214,25 @@ resize_widget_new (GimpImage *gimage, } resize->resize_shell = - gimp_dialog_new (window_title, wmclass, - gimp_standard_help_func, help_page, - GTK_WIN_POS_MOUSE, - FALSE, FALSE, TRUE, + gimp_viewable_dialog_new (GIMP_IS_VIEWABLE (object) ? + GIMP_VIEWABLE (object) : GIMP_VIEWABLE (gimage), + window_title, wmclass, + stock_id, window_title, + gimp_standard_help_func, help_page, - GTK_STOCK_CANCEL, - cancel_cb ? cancel_cb : G_CALLBACK (gtk_widget_destroy), - cancel_cb ? user_data : NULL, - cancel_cb ? NULL : (gpointer) 1, - NULL, FALSE, TRUE, + GTK_STOCK_CANCEL, + cancel_cb ? cancel_cb : G_CALLBACK (gtk_widget_destroy), + cancel_cb ? user_data : NULL, + cancel_cb ? NULL : (gpointer) 1, + NULL, FALSE, TRUE, - GIMP_STOCK_RESET, reset_callback, - resize, NULL, NULL, FALSE, FALSE, + GIMP_STOCK_RESET, reset_callback, + resize, NULL, NULL, FALSE, FALSE, - GTK_STOCK_OK, ok_cb, - user_data, NULL, NULL, TRUE, FALSE, + GTK_STOCK_OK, ok_cb, + user_data, NULL, NULL, TRUE, FALSE, - NULL); + NULL); g_object_weak_ref (G_OBJECT (resize->resize_shell), (GWeakNotify) g_free, diff --git a/app/gui/channels-commands.c b/app/gui/channels-commands.c index ec3c684e69a7eefdcefa6ffb405fb0c013ee168a..4954e43a67685710c6f5c184e2450199b2dd23d3 100644 --- a/app/gui/channels-commands.c +++ b/app/gui/channels-commands.c @@ -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, diff --git a/app/gui/convert-dialog.c b/app/gui/convert-dialog.c index ef940486d473f5237502aea4b2b4aa9cbce3ac2d..c549d35757a58582b69d56310debfefc31aabaf1 100644 --- a/app/gui/convert-dialog.c +++ b/app/gui/convert-dialog.c @@ -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); diff --git a/app/gui/gradient-editor-commands.c b/app/gui/gradient-editor-commands.c index 15e2e7944e4d5c8ebf4e358a257450677fab40fc..7374c0e7cbccaee3f54de2a48689598b2cc4b621 100644 --- a/app/gui/gradient-editor-commands.c +++ b/app/gui/gradient-editor-commands.c @@ -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); } diff --git a/app/gui/image-commands.c b/app/gui/image-commands.c index 112b486e4ece6f172492b3f6146dce022b1c7163..3150741edbc6bf2fb1e8fd8b51975164842d01e7 100644 --- a/app/gui/image-commands.c +++ b/app/gui/image-commands.c @@ -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, diff --git a/app/gui/info-dialog.c b/app/gui/info-dialog.c index dd9fffe1fb8dbaf3f31f0e454de96a883b94d801..6b886b626d71cd943a419d81df47255a77815d7e 100644 --- a/app/gui/info-dialog.c +++ b/app/gui/info-dialog.c @@ -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 diff --git a/app/gui/info-dialog.h b/app/gui/info-dialog.h index 735dbc2b56de9702efaf5613fbc20eeec5adbecf..ec96edd77b32d9e66f39a8f3605bcef76268db8f 100644 --- a/app/gui/info-dialog.h +++ b/app/gui/info-dialog.h @@ -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); diff --git a/app/gui/info-window.c b/app/gui/info-window.c index 909e5af35cacac0cc0ff9a115aa7a859ed4147dc..ef5f68758cde7652882dd4cbd88d451c1c14668a 100644 --- a/app/gui/info-window.c +++ b/app/gui/info-window.c @@ -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); diff --git a/app/gui/layers-commands.c b/app/gui/layers-commands.c index d407a75bc393ea8611098bc1cff66b3d0c7aa5f4..9c2d2f85eaabf4a8be8549e936488fc34d1e2466 100644 --- a/app/gui/layers-commands.c +++ b/app/gui/layers-commands.c @@ -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, diff --git a/app/gui/offset-dialog.c b/app/gui/offset-dialog.c index 48747b064a7c49516f893db1d3d9b5693f5d5f69..9522de023490fdf5e7d42ce40cefa161e0497845 100644 --- a/app/gui/offset-dialog.c +++ b/app/gui/offset-dialog.c @@ -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 g_warning ("%s: unexpected drawable type", G_STRLOC); - off_d->dlg = gimp_dialog_new (title, "offset", - gimp_standard_help_func, - "dialogs/offset.html", - GTK_WIN_POS_NONE, - FALSE, TRUE, FALSE, + off_d->dlg = + gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable), + _("Offset"), "offset", + GIMP_STOCK_TOOL_MOVE, + title, + gimp_standard_help_func, + "dialogs/offset.html", - GTK_STOCK_CANCEL, offset_cancel_callback, - off_d, NULL, NULL, FALSE, TRUE, + GTK_STOCK_CANCEL, offset_cancel_callback, + off_d, NULL, NULL, FALSE, TRUE, - GTK_STOCK_OK, offset_ok_callback, - off_d, NULL, NULL, TRUE, FALSE, + GTK_STOCK_OK, offset_ok_callback, + off_d, NULL, NULL, TRUE, FALSE, - NULL); + NULL); /* The vbox for first column of options */ vbox = gtk_vbox_new (FALSE, 2); diff --git a/app/gui/qmask-commands.c b/app/gui/qmask-commands.c index ec75b35532633520f79c4442d752ddc50bf3a027..5762e355f294eeaafb7e0d7157959dce3227f9d4 100644 --- a/app/gui/qmask-commands.c +++ b/app/gui/qmask-commands.c @@ -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); diff --git a/app/gui/resize-dialog.c b/app/gui/resize-dialog.c index 47999b92bd5163f95c139d06f8e2bab19489bd02..a26423c9e5eb331d75d1ef45c859228deefebbc6 100644 --- a/app/gui/resize-dialog.c +++ b/app/gui/resize-dialog.c @@ -32,6 +32,7 @@ #include "core/gimplayer.h" #include "widgets/gimpenummenu.h" +#include "widgets/gimpviewabledialog.h" #include "resize-dialog.h" @@ -167,11 +168,14 @@ resize_widget_new (GimpImage *gimage, { const gchar *wmclass = NULL; const gchar *window_title = NULL; + const gchar *stock_id = NULL; gchar *help_page = NULL; switch (type) { case ScaleWidget: + stock_id = GIMP_STOCK_SCALE; + switch (target) { case ResizeLayer: @@ -190,6 +194,8 @@ resize_widget_new (GimpImage *gimage, break; case ResizeWidget: + stock_id = GIMP_STOCK_RESIZE; + switch (target) { case ResizeLayer: @@ -208,24 +214,25 @@ resize_widget_new (GimpImage *gimage, } resize->resize_shell = - gimp_dialog_new (window_title, wmclass, - gimp_standard_help_func, help_page, - GTK_WIN_POS_MOUSE, - FALSE, FALSE, TRUE, + gimp_viewable_dialog_new (GIMP_IS_VIEWABLE (object) ? + GIMP_VIEWABLE (object) : GIMP_VIEWABLE (gimage), + window_title, wmclass, + stock_id, window_title, + gimp_standard_help_func, help_page, - GTK_STOCK_CANCEL, - cancel_cb ? cancel_cb : G_CALLBACK (gtk_widget_destroy), - cancel_cb ? user_data : NULL, - cancel_cb ? NULL : (gpointer) 1, - NULL, FALSE, TRUE, + GTK_STOCK_CANCEL, + cancel_cb ? cancel_cb : G_CALLBACK (gtk_widget_destroy), + cancel_cb ? user_data : NULL, + cancel_cb ? NULL : (gpointer) 1, + NULL, FALSE, TRUE, - GIMP_STOCK_RESET, reset_callback, - resize, NULL, NULL, FALSE, FALSE, + GIMP_STOCK_RESET, reset_callback, + resize, NULL, NULL, FALSE, FALSE, - GTK_STOCK_OK, ok_cb, - user_data, NULL, NULL, TRUE, FALSE, + GTK_STOCK_OK, ok_cb, + user_data, NULL, NULL, TRUE, FALSE, - NULL); + NULL); g_object_weak_ref (G_OBJECT (resize->resize_shell), (GWeakNotify) g_free, diff --git a/app/gui/vectors-commands.c b/app/gui/vectors-commands.c index 93b613a5db2113dfbd571eaa5ee2f422e7bd81c7..0adf4c65fe775ddf305c69eebf784cc0b4a50fba 100644 --- a/app/gui/vectors-commands.c +++ b/app/gui/vectors-commands.c @@ -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, diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c index 7b4bbbc723fb3a723f95727adc090ac16e80ac6a..f767245f8464db22e0b62f03e4801706f543afc5 100644 --- a/app/tools/gimpcolorpickertool.c +++ b/app/tools/gimpcolorpickertool.c @@ -41,6 +41,7 @@ #include "widgets/gimppaletteeditor.h" #include "widgets/gimptoolbox-color-area.h" +#include "widgets/gimpviewabledialog.h" #include "gui/info-dialog.h" @@ -269,9 +270,12 @@ gimp_color_picker_tool_button_press (GimpTool *tool, GtkWidget *frame; GimpRGB color; - gimp_color_picker_tool_info = info_dialog_new (_("Color Picker"), - tool_manager_help_func, - NULL); + gimp_color_picker_tool_info = + info_dialog_new (NULL, + _("Color Picker"), "color_picker", + GIMP_STOCK_TOOL_COLOR_PICKER, + _("Color Picker Information"), + tool_manager_help_func, NULL); /* if the gdisplay is for a color image, the dialog must have RGB */ switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (tool->drawable))) @@ -352,6 +356,9 @@ gimp_color_picker_tool_button_press (GimpTool *tool, NULL); } + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (gimp_color_picker_tool_info->shell), + GIMP_VIEWABLE (gimp_image_active_drawable (gdisp->gimage))); + /* Keep the coordinates of the target */ gimp_drawable_offsets (gimp_image_active_drawable (gdisp->gimage), &off_x, &off_y); diff --git a/app/tools/gimpcroptool.c b/app/tools/gimpcroptool.c index 7b2c54fa08435d538fe18c7e1de1e3d825146015..cc15e1f27e8961c575aebce07083ea60b6db41ed 100644 --- a/app/tools/gimpcroptool.c +++ b/app/tools/gimpcroptool.c @@ -45,6 +45,7 @@ #include "gui/info-dialog.h" #include "widgets/gimpenummenu.h" +#include "widgets/gimpviewabledialog.h" #include "gimpcroptool.h" #include "tool_manager.h" @@ -888,6 +889,9 @@ crop_start (GimpTool *tool, if (! crop_info) crop_info_create (tool); + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (crop_info->shell), + GIMP_VIEWABLE (tool->gdisp->gimage)); + g_signal_handlers_block_by_func (G_OBJECT (origin_sizeentry), crop_origin_changed, crop_info); @@ -968,7 +972,10 @@ crop_info_create (GimpTool *tool) shell = GIMP_DISPLAY_SHELL (gdisp->shell); /* create the info dialog */ - crop_info = info_dialog_new (_("Crop & Resize Information"), + crop_info = info_dialog_new (NULL, + _("Crop & Resize"), "crop", + GIMP_STOCK_TOOL_CROP, + _("Crop & Resize Information"), tool_manager_help_func, NULL); /* create the action area */ diff --git a/app/tools/gimphistogramtool.c b/app/tools/gimphistogramtool.c index d5f9b1fcdb6efca52bb09da48025a62920181eb4..b7d74a1fc4678bec9649190c8389be4292f7d3f5 100644 --- a/app/tools/gimphistogramtool.c +++ b/app/tools/gimphistogramtool.c @@ -38,6 +38,7 @@ #include "widgets/gimpenummenu.h" #include "widgets/gimphistogramview.h" +#include "widgets/gimpviewabledialog.h" #include "display/gimpdisplay.h" @@ -184,7 +185,8 @@ static void gimp_histogram_tool_initialize (GimpTool *tool, GimpDisplay *gdisp) { - PixelRegion PR; + GimpDrawable *drawable; + PixelRegion PR; if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage))) { @@ -196,10 +198,15 @@ gimp_histogram_tool_initialize (GimpTool *tool, if (! histogram_dialog) histogram_dialog = histogram_tool_dialog_new (); + drawable = gimp_image_active_drawable (gdisp->gimage); + + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (histogram_dialog->shell), + GIMP_VIEWABLE (drawable)); + gtk_widget_show (histogram_dialog->shell); - histogram_dialog->drawable = gimp_image_active_drawable (gdisp->gimage); - histogram_dialog->color = gimp_drawable_is_rgb (histogram_dialog->drawable); + histogram_dialog->drawable = drawable; + histogram_dialog->color = gimp_drawable_is_rgb (drawable); gimp_option_menu_set_sensitive (GTK_OPTION_MENU (histogram_dialog->channel_menu), (GimpOptionMenuSensitivityCallback) histogram_set_sensitive_callback, @@ -208,10 +215,10 @@ gimp_histogram_tool_initialize (GimpTool *tool, GINT_TO_POINTER (histogram_dialog->channel)); /* calculate the histogram */ - pixel_region_init (&PR, gimp_drawable_data (histogram_dialog->drawable), + pixel_region_init (&PR, gimp_drawable_data (drawable), 0, 0, - gimp_drawable_width (histogram_dialog->drawable), - gimp_drawable_height (histogram_dialog->drawable), + gimp_drawable_width (drawable), + gimp_drawable_height (drawable), FALSE); gimp_histogram_calculate (histogram_dialog->hist, &PR, NULL); @@ -352,15 +359,18 @@ histogram_tool_dialog_new (void) htd->hist = gimp_histogram_new (); /* The shell and main vbox */ - htd->shell = gimp_dialog_new (_("Histogram"), "histogram", - tool_manager_help_func, NULL, - GTK_WIN_POS_NONE, - FALSE, TRUE, FALSE, - - GTK_STOCK_CLOSE, histogram_tool_close_callback, - htd, NULL, NULL, TRUE, TRUE, - - NULL); + htd->shell = + gimp_viewable_dialog_new (NULL, + _("Histogram"), + "histogram", + GIMP_STOCK_TOOL_HISTOGRAM, + _("View Image Histogram"), + tool_manager_help_func, NULL, + + GTK_STOCK_CLOSE, histogram_tool_close_callback, + htd, NULL, NULL, TRUE, TRUE, + + NULL); hbox = gtk_hbox_new (TRUE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (htd->shell)->vbox), hbox); diff --git a/app/tools/gimpimagemaptool.c b/app/tools/gimpimagemaptool.c index 1a2db4792f1266722959e29d9149c015d03ac0ce..9b5db57c89d0991a992ee5b136682766b2f9fad5 100644 --- a/app/tools/gimpimagemaptool.c +++ b/app/tools/gimpimagemaptool.c @@ -30,7 +30,7 @@ #include "file/file-utils.h" -#include "widgets/gimppreview.h" +#include "widgets/gimpviewabledialog.h" #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" @@ -185,8 +185,6 @@ gimp_image_map_tool_initialize (GimpTool *tool, { GimpImageMapTool *image_map_tool; GimpDrawable *drawable; - gchar *basename; - gchar *str; image_map_tool = GIMP_IMAGE_MAP_TOOL (tool); @@ -201,67 +199,31 @@ gimp_image_map_tool_initialize (GimpTool *tool, if (! image_map_tool->shell) { GtkWidget *shell; - GtkWidget *frame; GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *image; - GtkWidget *preview; - GtkWidget *label; GtkWidget *toggle; image_map_tool->shell = shell = - gimp_dialog_new (image_map_tool->shell_title, - image_map_tool->shell_name, - tool_manager_help_func, NULL, - GTK_WIN_POS_NONE, - FALSE, TRUE, FALSE, + gimp_viewable_dialog_new (NULL, + image_map_tool->shell_title, + image_map_tool->shell_name, + image_map_tool->stock_id, + image_map_tool->shell_desc, + tool_manager_help_func, NULL, - GTK_STOCK_CANCEL, gimp_image_map_tool_cancel_clicked, - image_map_tool, NULL, NULL, FALSE, TRUE, + GTK_STOCK_CANCEL, + gimp_image_map_tool_cancel_clicked, + image_map_tool, NULL, NULL, FALSE, TRUE, - GIMP_STOCK_RESET, gimp_image_map_tool_reset_clicked, - image_map_tool, NULL, NULL, TRUE, FALSE, + GIMP_STOCK_RESET, + gimp_image_map_tool_reset_clicked, + image_map_tool, NULL, NULL, TRUE, FALSE, - GTK_STOCK_OK, gimp_image_map_tool_ok_clicked, - image_map_tool, NULL, NULL, TRUE, FALSE, + GTK_STOCK_OK, + gimp_image_map_tool_ok_clicked, + image_map_tool, NULL, NULL, TRUE, FALSE, - NULL); - - frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (shell)->vbox), frame, - FALSE, FALSE, 0); - gtk_widget_show (frame); - - hbox = gtk_hbox_new (FALSE, 4); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); - gtk_container_add (GTK_CONTAINER (frame), hbox); - gtk_widget_show (hbox); - - image = gtk_image_new_from_stock (image_map_tool->stock_id, - GTK_ICON_SIZE_BUTTON); - gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); - gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); - gtk_widget_show (image); - - image_map_tool->title_preview = preview = - gimp_preview_new_by_type (GIMP_TYPE_DRAWABLE, 32, 1, TRUE); - gtk_box_pack_end (GTK_BOX (hbox), preview, FALSE, FALSE, 0); - gtk_widget_show (preview); - - vbox = gtk_vbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (hbox), vbox); - gtk_widget_show (vbox); - - label = gtk_label_new (image_map_tool->shell_desc); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - gtk_widget_show (label); - - image_map_tool->title_label = label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); - gtk_box_pack_end (GTK_BOX (vbox), label, FALSE, FALSE, 0); - gtk_widget_show (label); + NULL); image_map_tool->main_vbox = vbox = gtk_vbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); @@ -290,20 +252,8 @@ gimp_image_map_tool_initialize (GimpTool *tool, drawable = gimp_image_active_drawable (gdisp->gimage); - basename = - file_utils_uri_to_utf8_basename (gimp_image_get_uri (gdisp->gimage)); - - str = g_strdup_printf ("%s (%s)", - basename, - gimp_object_get_name (GIMP_OBJECT (drawable))); - - g_free (basename); - - gimp_preview_set_viewable (GIMP_PREVIEW (image_map_tool->title_preview), - GIMP_VIEWABLE (drawable)); - gtk_label_set_text (GTK_LABEL (image_map_tool->title_label), str); - - g_free (str); + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (image_map_tool->shell), + GIMP_VIEWABLE (drawable)); gtk_widget_show (image_map_tool->shell); diff --git a/app/tools/gimpimagemaptool.h b/app/tools/gimpimagemaptool.h index 4a8831be80d0e6b90c3d1f75697b4e33e25e68f8..c5697cd376726b76e0c4873802b5b1d300f82c99 100644 --- a/app/tools/gimpimagemaptool.h +++ b/app/tools/gimpimagemaptool.h @@ -50,8 +50,6 @@ struct _GimpImageMapTool const gchar *stock_id; GtkWidget *shell; - GtkWidget *title_preview; - GtkWidget *title_label; GtkWidget *main_vbox; }; diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c index 7ea726d9ee5659993c01fc1cbc916ef440d73c11..d0d077d11b996b15325d42cd2f715e2377734af0 100644 --- a/app/tools/gimpmeasuretool.c +++ b/app/tools/gimpmeasuretool.c @@ -40,6 +40,8 @@ #include "core/gimpimage-guides.h" #include "core/gimptoolinfo.h" +#include "widgets/gimpviewabledialog.h" + #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" @@ -377,7 +379,7 @@ gimp_measure_tool_button_press (GimpTool *tool, if (gimp_tool_control_is_active (tool->control)) { gimp_tool_pop_status (tool); - gimp_tool_push_status (tool, ""); + gimp_tool_push_status (tool, " "); } /* start drawing the measure tool */ @@ -388,7 +390,10 @@ gimp_measure_tool_button_press (GimpTool *tool, if (! measure_tool_info && (options->use_info_window || ! GTK_WIDGET_VISIBLE (shell->statusbar))) { - measure_tool_info = info_dialog_new (_("Measure Tool"), + measure_tool_info = info_dialog_new (NULL, + _("Measure Tool"), "measure", + GIMP_STOCK_TOOL_MEASURE, + _("Measure Tool Information"), tool_manager_help_func, NULL); info_dialog_add_label (measure_tool_info, _("Distance:"), distance_buf); info_dialog_add_label (measure_tool_info, _("Angle:"), angle_buf); @@ -402,6 +407,10 @@ gimp_measure_tool_button_press (GimpTool *tool, NULL); } + if (measure_tool_info) + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (measure_tool_info->shell), + GIMP_VIEWABLE (tool->gdisp->gimage)); + gimp_tool_control_activate (tool->control); } diff --git a/app/tools/gimpperspectivetool.c b/app/tools/gimpperspectivetool.c index cb4c66cab51465622e769ffff3fc1f70a9059edb..5d905c11a87f84cf3476cfe5af6bef0738162724 100644 --- a/app/tools/gimpperspectivetool.c +++ b/app/tools/gimpperspectivetool.c @@ -35,6 +35,8 @@ #include "core/gimpdrawable-transform-utils.h" #include "core/gimptoolinfo.h" +#include "widgets/gimpviewabledialog.h" + #include "display/gimpdisplay.h" #include "gui/info-dialog.h" @@ -147,7 +149,10 @@ gimp_perspective_tool_transform (GimpTransformTool *transform_tool, if (! transform_tool->info_dialog) { transform_tool->info_dialog = - info_dialog_new (_("Perspective Transform Information"), + info_dialog_new (NULL, + _("Perspective Transform"), "perspective", + GIMP_STOCK_TOOL_PERSPECTIVE, + _("Perspective Transform Information"), gimp_standard_help_func, "tools/transform_perspective.html"); @@ -162,6 +167,9 @@ gimp_perspective_tool_transform (GimpTransformTool *transform_tool, matrix_row_buf[2]); } + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (transform_tool->info_dialog->shell), + GIMP_VIEWABLE (gimp_image_active_drawable (gdisp->gimage))); + gtk_widget_set_sensitive (GTK_WIDGET (transform_tool->info_dialog->shell), TRUE); diff --git a/app/tools/gimprotatetool.c b/app/tools/gimprotatetool.c index 9cb0d0eceb22f0f718643f8a8dfea0bbac71d148..a3924ce11417661d26cda77e6b132bc6b2e31acc 100644 --- a/app/tools/gimprotatetool.c +++ b/app/tools/gimprotatetool.c @@ -35,6 +35,8 @@ #include "core/gimpdrawable-transform-utils.h" #include "core/gimptoolinfo.h" +#include "widgets/gimpviewabledialog.h" + #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" @@ -176,7 +178,10 @@ gimp_rotate_tool_transform (GimpTransformTool *transform_tool, GtkWidget *spinbutton2; transform_tool->info_dialog = - info_dialog_new (_("Rotation Information"), + info_dialog_new (NULL, + _("Rotate"), "rotate", + GIMP_STOCK_TOOL_ROTATE, + _("Rotation Information"), gimp_standard_help_func, "tools/transform_rotate.html"); @@ -222,6 +227,9 @@ gimp_rotate_tool_transform (GimpTransformTool *transform_tool, 2, 0); } + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (transform_tool->info_dialog->shell), + GIMP_VIEWABLE (gimp_image_active_drawable (gdisp->gimage))); + g_signal_handlers_block_by_func (G_OBJECT (sizeentry), rotate_center_changed, transform_tool); diff --git a/app/tools/gimpscaletool.c b/app/tools/gimpscaletool.c index c402500e3ad3436690e334c98f8e1563af5f7402..551e833592610e93a61ac1f6b49ce58095e57938 100644 --- a/app/tools/gimpscaletool.c +++ b/app/tools/gimpscaletool.c @@ -36,6 +36,8 @@ #include "core/gimpdrawable-transform-utils.h" #include "core/gimptoolinfo.h" +#include "widgets/gimpviewabledialog.h" + #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" @@ -173,7 +175,10 @@ gimp_scale_tool_transform (GimpTransformTool *transform_tool, GtkWidget *spinbutton; transform_tool->info_dialog = - info_dialog_new (_("Scaling Information"), + info_dialog_new (NULL, + _("Scale"), "scale", + GIMP_STOCK_TOOL_SCALE, + _("Scaling Information"), gimp_standard_help_func, "tools/transform_scale.html"); @@ -220,6 +225,9 @@ gimp_scale_tool_transform (GimpTransformTool *transform_tool, (GTK_TABLE (transform_tool->info_dialog->info_table), 2, 0); } + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (transform_tool->info_dialog->shell), + GIMP_VIEWABLE (gimp_image_active_drawable (gdisp->gimage))); + g_signal_handlers_block_by_func (G_OBJECT (sizeentry), gimp_scale_tool_size_changed, transform_tool); diff --git a/app/tools/gimpsheartool.c b/app/tools/gimpsheartool.c index 485db67b54fe469c69257a57ea8dfa5fc1939876..d5359c2f7e3d32d1ec61d69b64cf0ab80352f41d 100644 --- a/app/tools/gimpsheartool.c +++ b/app/tools/gimpsheartool.c @@ -37,6 +37,8 @@ #include "core/gimpdrawable-transform-utils.h" #include "core/gimptoolinfo.h" +#include "widgets/gimpviewabledialog.h" + #include "display/gimpdisplay.h" #include "gui/info-dialog.h" @@ -167,7 +169,10 @@ gimp_shear_tool_transform (GimpTransformTool *transform_tool, if (! transform_tool->info_dialog) { transform_tool->info_dialog = - info_dialog_new (_("Shear Information"), + info_dialog_new (NULL, + _("Shear"), "shear", + GIMP_STOCK_TOOL_SHEAR, + _("Shearing Information"), gimp_standard_help_func, "tools/transform_shear.html"); @@ -189,6 +194,9 @@ gimp_shear_tool_transform (GimpTransformTool *transform_tool, transform_tool); } + gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (transform_tool->info_dialog->shell), + GIMP_VIEWABLE (gimp_image_active_drawable (gdisp->gimage))); + gtk_widget_set_sensitive (GTK_WIDGET (transform_tool->info_dialog->shell), TRUE); diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am index ad621ce73c1bd62af38589ea0a6a4757a130f23b..0f836aaa5f05c12e1533f09997869d9fb958abbf 100644 --- a/app/widgets/Makefile.am +++ b/app/widgets/Makefile.am @@ -143,6 +143,8 @@ libappwidgets_a_sources = \ gimptoolinfopreview.h \ gimpvectorslistview.c \ gimpvectorslistview.h \ + gimpviewabledialog.c \ + gimpviewabledialog.h \ gimpwidgets-constructors.c \ gimpwidgets-constructors.h \ gimpwidgets-utils.c \ diff --git a/app/widgets/gimpviewabledialog.c b/app/widgets/gimpviewabledialog.c new file mode 100644 index 0000000000000000000000000000000000000000..288d1b8df62e226b61c42dc678278d0af80e8346 --- /dev/null +++ b/app/widgets/gimpviewabledialog.c @@ -0,0 +1,230 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpviewabledialog.c + * Copyright (C) 2000 Michael Natterer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include "libgimpwidgets/gimpwidgets.h" + +#include "widgets-types.h" + +#include "core/gimpimage.h" +#include "core/gimpitem.h" + +#include "file/file-utils.h" + +#include "gimppreview.h" +#include "gimpviewabledialog.h" + + +static void gimp_viewable_dialog_class_init (GimpViewableDialogClass *klass); +static void gimp_viewable_dialog_init (GimpViewableDialog *dialog); + + +static GimpDialogClass *parent_class = NULL; + + +GType +gimp_viewable_dialog_get_type (void) +{ + static GType dialog_type = 0; + + if (! dialog_type) + { + static const GTypeInfo dialog_info = + { + sizeof (GimpViewableDialogClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gimp_viewable_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GimpViewableDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gimp_viewable_dialog_init, + }; + + dialog_type = g_type_register_static (GIMP_TYPE_DIALOG, + "GimpViewableDialog", + &dialog_info, 0); + } + + return dialog_type; +} + +static void +gimp_viewable_dialog_class_init (GimpViewableDialogClass *klass) +{ + parent_class = g_type_class_peek_parent (klass); +} + +static void +gimp_viewable_dialog_init (GimpViewableDialog *dialog) +{ + GtkWidget *ebox; + GtkWidget *frame; + GtkWidget *hbox; + GtkWidget *vbox; + GtkWidget *sep; + + ebox = gtk_event_box_new (); + gtk_widget_set_state (ebox, GTK_STATE_PRELIGHT); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), ebox, + FALSE, FALSE, 0); + gtk_widget_show (ebox); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); + gtk_container_add (GTK_CONTAINER (ebox), frame); + gtk_widget_show (frame); + + hbox = gtk_hbox_new (FALSE, 4); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); + gtk_container_add (GTK_CONTAINER (frame), hbox); + gtk_widget_show (hbox); + + dialog->icon = gtk_image_new (); + gtk_misc_set_alignment (GTK_MISC (dialog->icon), 0.5, 0.0); + gtk_box_pack_start (GTK_BOX (hbox), dialog->icon, FALSE, FALSE, 0); + gtk_widget_show (dialog->icon); + + sep = gtk_vseparator_new (); + gtk_box_pack_start (GTK_BOX (hbox), sep, FALSE, FALSE, 0); + gtk_widget_show (sep); + + vbox = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (hbox), vbox); + gtk_widget_show (vbox); + + dialog->desc_label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (dialog->desc_label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (vbox), dialog->desc_label, FALSE, FALSE, 0); + gtk_widget_show (dialog->desc_label); + + dialog->viewable_label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (dialog->viewable_label), 0.0, 0.5); + gtk_box_pack_start (GTK_BOX (vbox), dialog->viewable_label, FALSE, FALSE, 0); + gtk_widget_show (dialog->viewable_label); +} + +GtkWidget * +gimp_viewable_dialog_new (GimpViewable *viewable, + const gchar *title, + const gchar *wmclass_name, + const gchar *stock_id, + const gchar *desc, + GimpHelpFunc help_func, + const gchar *help_data, + + /* specify action area buttons + * as va_list: + * const gchar *label, + * GCallback callback, + * gpointer callback_data, + * GObject *slot_object, + * GtkWidget **widget_ptr, + * gboolean default_action, + * gboolean connect_delete, + */ + + ...) +{ + GimpViewableDialog *dialog; + va_list args; + gchar *str; + + g_return_val_if_fail (! viewable || GIMP_IS_VIEWABLE (viewable), NULL); + g_return_val_if_fail (title != NULL, NULL); + g_return_val_if_fail (wmclass_name != NULL, NULL); + + dialog = g_object_new (GIMP_TYPE_VIEWABLE_DIALOG, NULL); + + gtk_window_set_title (GTK_WINDOW (dialog), title); + gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp"); + + if (help_func) + gimp_help_connect (GTK_WIDGET (dialog), help_func, help_data); + + va_start (args, help_data); + gimp_dialog_create_action_areav (GIMP_DIALOG (dialog), args); + va_end (args); + + gtk_image_set_from_stock (GTK_IMAGE (dialog->icon), stock_id, + GTK_ICON_SIZE_LARGE_TOOLBAR); + + str = g_strdup_printf ("%s", desc); + gtk_label_set_markup (GTK_LABEL (dialog->desc_label), str); + g_free (str); + + if (viewable) + gimp_viewable_dialog_set_viewable (dialog, viewable); + + return GTK_WIDGET (dialog); +} + +void +gimp_viewable_dialog_set_viewable (GimpViewableDialog *dialog, + GimpViewable *viewable) +{ + const gchar *name; + gchar *str; + + g_return_if_fail (GIMP_IS_VIEWABLE_DIALOG (dialog)); + g_return_if_fail (GIMP_IS_VIEWABLE (viewable)); + + if (dialog->preview) + gtk_widget_destroy (dialog->preview); + + name = gimp_object_get_name (GIMP_OBJECT (viewable)); + + if (GIMP_IS_ITEM (viewable)) + { + const gchar *uri; + gchar *basename; + + uri = gimp_image_get_uri (gimp_item_get_image (GIMP_ITEM (viewable))); + + basename = file_utils_uri_to_utf8_basename (uri); + str = g_strdup_printf ("%s (%s)", name, basename); + g_free (basename); + } + else if (GIMP_IS_IMAGE (viewable)) + { + const gchar *uri; + + uri = gimp_image_get_uri (GIMP_IMAGE (viewable)); + + str = file_utils_uri_to_utf8_basename (uri); + } + else + { + str = g_strdup (name); + } + + gtk_label_set_text (GTK_LABEL (dialog->viewable_label), str); + g_free (str); + + dialog->preview = gimp_preview_new (viewable, 32, 1, TRUE); + gtk_box_pack_end (GTK_BOX (dialog->icon->parent), dialog->preview, + FALSE, FALSE, 2); + gtk_widget_show (dialog->preview); +} diff --git a/app/widgets/gimpviewabledialog.h b/app/widgets/gimpviewabledialog.h new file mode 100644 index 0000000000000000000000000000000000000000..d8483ead33c240dd4b604c2bfeb3aada66f95022 --- /dev/null +++ b/app/widgets/gimpviewabledialog.h @@ -0,0 +1,85 @@ +/* The GIMP -- an image manipulation program + * Copyright (C) 1995 Spencer Kimball and Peter Mattis + * + * gimpviewabledialog.h + * Copyright (C) 2000 Michael Natterer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __GIMP_VIEWABLE_DIALOG_H__ +#define __GIMP_VIEWABLE_DIALOG_H__ + +#include "libgimpwidgets/gimpdialog.h" + +G_BEGIN_DECLS + + +#define GIMP_TYPE_VIEWABLE_DIALOG (gimp_viewable_dialog_get_type ()) +#define GIMP_VIEWABLE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEWABLE_DIALOG, GimpViewableDialog)) +#define GIMP_VIEWABLE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEWABLE_DIALOG, GimpViewableDialogClass)) +#define GIMP_IS_VIEWABLE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_VIEWABLE_DIALOG)) +#define GIMP_IS_VIEWABLE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEWABLE_DIALOG)) +#define GIMP_VIEWABLE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEWABLE_DIALOG, GimpViewableDialogClass)) + + +typedef struct _GimpViewableDialogClass GimpViewableDialogClass; + +struct _GimpViewableDialog +{ + GimpDialog parent_instance; + + GtkWidget *icon; + GtkWidget *preview; + GtkWidget *desc_label; + GtkWidget *viewable_label; +}; + +struct _GimpViewableDialogClass +{ + GimpDialogClass parent_class; +}; + + +GType gimp_viewable_dialog_get_type (void) G_GNUC_CONST; + +GtkWidget * gimp_viewable_dialog_new (GimpViewable *viewable, + const gchar *title, + const gchar *wmclass_name, + const gchar *stock_id, + const gchar *desc, + GimpHelpFunc help_func, + const gchar *help_data, + + /* specify action area buttons + * as va_list: + * const gchar *label, + * GCallback callback, + * gpointer callback_data, + * GObject *slot_object, + * GtkWidget **widget_ptr, + * gboolean default_action, + * gboolean connect_delete, + */ + + ...); + +void gimp_viewable_dialog_set_viewable (GimpViewableDialog *dialog, + GimpViewable *viewable); + + +G_END_DECLS + +#endif /* __GIMP_VIEWABLE_DIALOG_H__ */ diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h index 06ac75a38ae065762e5188d9c3aba7d1ef235027..6fa8a5bf3b19fa393aa4a3b03b04f13b96bc9580 100644 --- a/app/widgets/widgets-types.h +++ b/app/widgets/widgets-types.h @@ -92,6 +92,8 @@ typedef struct _GimpImageDock GimpImageDock; typedef struct _GimpDockable GimpDockable; typedef struct _GimpDockbook GimpDockbook; +typedef struct _GimpViewableDialog GimpViewableDialog; + typedef struct _GimpFontSelection GimpFontSelection; typedef struct _GimpFontSelectionDialog GimpFontSelectionDialog; diff --git a/themes/Default/gtkrc b/themes/Default/gtkrc index e08185c2739820af2bf00b869399481f21ba50a2..701ecedfe09888197b63562892a5df4fca9b314d 100644 --- a/themes/Default/gtkrc +++ b/themes/Default/gtkrc @@ -102,7 +102,7 @@ style "gimp-dialog-style" GtkDialog::action_area_border = 4 } -widget "*GimpDialog*" style "gimp-dialog-style" +widget "*Gimp*Dialog*" style "gimp-dialog-style" style "gimp-hscale-style"