mirror of https://github.com/GNOME/gimp.git
GimpViewableDialogs everywhere, cleanup:
2002-09-01 Michael Natterer <mitch@gimp.org> GimpViewableDialogs everywhere, cleanup: * libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE and CROP stock items. * app/widgets/gimpviewabledialog.c: update the title when the viewable's name changes. * app/gui/color-notebook.[ch]: added color_notebook_viewable_new() which creates a GimpViewableDialog. * app/widgets/gimpgradienteditor.[ch] * app/gui/colormap-editor-commands.c * app/gui/file-new-dialog.c * app/gui/gradient-editor-commands.c * app/gui/palette-editor-commands.c * app/undo_history.c: use GimpViewableDialogs and the new color_notebook constructor. * app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h" * app/gui/image-commands.c * app/gui/info-dialog.c * app/gui/resize-dialog.c: minor cleanups. * app/gui/info-window.c: cleaned up the whole thing, esp. the "Extended" page. Added HSV color display to the color picker frame. Set the icons as frame titles, stuff... * app/tools/gimpimagemaptool.[ch]: removed "shell_title", "shell_name" and "stock_id" from the GimpImageMapTool struct because they can be obtained from the tool's GimpToolInfo object. * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimpthresholdtool.c: changed accordingly. * app/tools/gimphistogramtool.c: same here: take values from tool->tool_info instead of hardcoding them. * app/tools/gimpcroptool.[ch]: removed the static crop dialog variables and added them to the GimpCropTool struct. Feels safer and makes the callback code much simpler. Use stock items for the dialog's "Resize" and "Crop" buttons. * app/tools/gimpmeasuretool.c * app/tools/gimprotatetool.c: for consistency don't name the tools "Blah Tool", also the dialog titles need to match the menu entries. Unrelated: * libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc comment was correct, as gtk-doc takes the parameter names from the header, not the .c file. * app/tools/gimptransformtool.c: set the transform tool's state to TRANSFORM_CREATING after changing displays, so the initial matrix components are saved correctly for the "Reset" function.
This commit is contained in:
parent
97427f3f07
commit
ce956702e5
ChangeLog
app
actions
colormap-commands.ccolormap-editor-commands.cgradient-editor-commands.cimage-commands.cpalette-editor-commands.c
dialogs
color-dialog.ccolor-dialog.hconvert-dialog.cimage-new-dialog.cinfo-dialog.cinfo-window.cresize-dialog.c
gui
color-notebook.ccolor-notebook.hcolormap-editor-commands.cconvert-dialog.cfile-new-dialog.cgradient-editor-commands.cimage-commands.cinfo-dialog.cinfo-window.cpalette-editor-commands.cresize-dialog.c
tools
gimpbrightnesscontrasttool.cgimpcolorbalancetool.cgimpcroptool.cgimpcroptool.hgimpcurvestool.cgimphistogramtool.cgimphuesaturationtool.cgimpimagemaptool.cgimpimagemaptool.hgimplevelstool.cgimpmeasuretool.cgimpposterizetool.cgimprotatetool.cgimpthresholdtool.cgimptransformtool.c
undo_history.cwidgets
libgimpwidgets
66
ChangeLog
66
ChangeLog
|
@ -1,3 +1,69 @@
|
|||
2002-09-01 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
GimpViewableDialogs everywhere, cleanup:
|
||||
|
||||
* libgimpwidgets/gimpstock.c: added texts for the RESIZE, SCALE
|
||||
and CROP stock items.
|
||||
|
||||
* app/widgets/gimpviewabledialog.c: update the title when the
|
||||
viewable's name changes.
|
||||
|
||||
* app/gui/color-notebook.[ch]: added color_notebook_viewable_new()
|
||||
which creates a GimpViewableDialog.
|
||||
|
||||
* app/widgets/gimpgradienteditor.[ch]
|
||||
* app/gui/colormap-editor-commands.c
|
||||
* app/gui/file-new-dialog.c
|
||||
* app/gui/gradient-editor-commands.c
|
||||
* app/gui/palette-editor-commands.c
|
||||
* app/undo_history.c: use GimpViewableDialogs and the new
|
||||
color_notebook constructor.
|
||||
|
||||
* app/gui/convert-dialog.c: #include "widgets/gimpviewabledialog.h"
|
||||
|
||||
* app/gui/image-commands.c
|
||||
* app/gui/info-dialog.c
|
||||
* app/gui/resize-dialog.c: minor cleanups.
|
||||
|
||||
* app/gui/info-window.c: cleaned up the whole thing, esp. the
|
||||
"Extended" page. Added HSV color display to the color picker
|
||||
frame. Set the icons as frame titles, stuff...
|
||||
|
||||
* app/tools/gimpimagemaptool.[ch]: removed "shell_title",
|
||||
"shell_name" and "stock_id" from the GimpImageMapTool struct
|
||||
because they can be obtained from the tool's GimpToolInfo object.
|
||||
|
||||
* app/tools/gimpbrightnesscontrasttool.c
|
||||
* app/tools/gimpcolorbalancetool.c
|
||||
* app/tools/gimpcurvestool.c
|
||||
* app/tools/gimphuesaturationtool.c
|
||||
* app/tools/gimplevelstool.c
|
||||
* app/tools/gimpposterizetool.c
|
||||
* app/tools/gimpthresholdtool.c: changed accordingly.
|
||||
|
||||
* app/tools/gimphistogramtool.c: same here: take values from
|
||||
tool->tool_info instead of hardcoding them.
|
||||
|
||||
* app/tools/gimpcroptool.[ch]: removed the static crop dialog
|
||||
variables and added them to the GimpCropTool struct. Feels safer
|
||||
and makes the callback code much simpler. Use stock items for the
|
||||
dialog's "Resize" and "Crop" buttons.
|
||||
|
||||
* app/tools/gimpmeasuretool.c
|
||||
* app/tools/gimprotatetool.c: for consistency don't name the tools
|
||||
"Blah Tool", also the dialog titles need to match the menu
|
||||
entries.
|
||||
|
||||
Unrelated:
|
||||
|
||||
* libgimpwidgets/gimpwidgets.c: the recently changed, gtk-doc
|
||||
comment was correct, as gtk-doc takes the parameter names from
|
||||
the header, not the .c file.
|
||||
|
||||
* app/tools/gimptransformtool.c: set the transform tool's state to
|
||||
TRANSFORM_CREATING after changing displays, so the initial matrix
|
||||
components are saved correctly for the "Reset" function.
|
||||
|
||||
2002-09-01 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* modules/Makefile.am: use AM_CPPFLAGS instead of CPPFLAGS
|
||||
|
|
|
@ -104,13 +104,19 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
if (! editor->color_notebook)
|
||||
{
|
||||
editor->color_notebook =
|
||||
color_notebook_new (_("Edit Indexed Color"),
|
||||
(const GimpRGB *) &color,
|
||||
colormap_editor_color_notebook_callback, editor,
|
||||
FALSE, FALSE);
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gimage),
|
||||
_("Edit Indexed Color"),
|
||||
GIMP_STOCK_CONVERT_INDEXED,
|
||||
_("Edit Indexed Image Palette Color"),
|
||||
(const GimpRGB *) &color,
|
||||
colormap_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
color_notebook_set_viewable (editor->color_notebook,
|
||||
GIMP_VIEWABLE (gimage));
|
||||
color_notebook_show (editor->color_notebook);
|
||||
color_notebook_set_color (editor->color_notebook, &color);
|
||||
}
|
||||
|
|
|
@ -104,13 +104,19 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
if (! editor->color_notebook)
|
||||
{
|
||||
editor->color_notebook =
|
||||
color_notebook_new (_("Edit Indexed Color"),
|
||||
(const GimpRGB *) &color,
|
||||
colormap_editor_color_notebook_callback, editor,
|
||||
FALSE, FALSE);
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gimage),
|
||||
_("Edit Indexed Color"),
|
||||
GIMP_STOCK_CONVERT_INDEXED,
|
||||
_("Edit Indexed Image Palette Color"),
|
||||
(const GimpRGB *) &color,
|
||||
colormap_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
color_notebook_set_viewable (editor->color_notebook,
|
||||
GIMP_VIEWABLE (gimage));
|
||||
color_notebook_show (editor->color_notebook);
|
||||
color_notebook_set_color (editor->color_notebook, &color);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "widgets/gimpgradienteditor.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "color-notebook.h"
|
||||
|
@ -82,12 +83,16 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
|
|||
editor->left_saved_dirty = GIMP_DATA (gradient)->dirty;
|
||||
editor->left_saved_segments = gradient_editor_save_selection (editor);
|
||||
|
||||
color_notebook_new (_("Left Endpoint Color"),
|
||||
&editor->control_sel_l->left_color,
|
||||
gradient_editor_left_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
editor->color_notebook =
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
|
||||
_("Left Endpoint Color"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Gradient Segment's Left Endpoint Color"),
|
||||
&editor->control_sel_l->left_color,
|
||||
gradient_editor_left_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
||||
}
|
||||
|
@ -205,12 +210,16 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
|
|||
editor->right_saved_dirty = GIMP_DATA (gradient)->dirty;
|
||||
editor->right_saved_segments = gradient_editor_save_selection (editor);
|
||||
|
||||
color_notebook_new (_("Right Endpoint Color"),
|
||||
&editor->control_sel_l->right_color,
|
||||
gradient_editor_right_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
editor->color_notebook =
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
|
||||
_("Right Endpoint Color"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Gradient Segment's Right Endpoint Color"),
|
||||
&editor->control_sel_l->right_color,
|
||||
gradient_editor_right_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
||||
}
|
||||
|
@ -529,29 +538,41 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
const gchar *title;
|
||||
const gchar *desc;
|
||||
|
||||
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
|
||||
|
||||
if (! editor)
|
||||
return;
|
||||
|
||||
if (editor->control_sel_l == editor->control_sel_r)
|
||||
{
|
||||
title = _("Replicate Segment");
|
||||
desc = _("Replicate Gradient Segment");
|
||||
}
|
||||
else
|
||||
{
|
||||
title = _("Replicate Selection");
|
||||
desc = _("Replicate Gradient Selection");
|
||||
}
|
||||
|
||||
dialog =
|
||||
gimp_dialog_new ((editor->control_sel_l == editor->control_sel_r) ?
|
||||
_("Replicate segment") :
|
||||
_("Replicate selection"),
|
||||
"gradient_segment_replicate",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/replicate_segment.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
|
||||
title, "gradient_segment_replicate",
|
||||
GIMP_STOCK_TOOL_BLEND, desc,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/replicate_segment.html",
|
||||
|
||||
GTK_STOCK_CANCEL, gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, TRUE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
_("Replicate"), gradient_editor_replicate_callback,
|
||||
editor, NULL, NULL, FALSE, FALSE,
|
||||
_("Replicate"),
|
||||
gradient_editor_replicate_callback,
|
||||
editor, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
|
@ -592,7 +613,7 @@ gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget,
|
|||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpGradientEditor *editor;
|
||||
GimpGradientEditor *editor;
|
||||
GimpGradient *gradient;
|
||||
GimpGradientSegment *seg, *lseg, *rseg;
|
||||
|
||||
|
@ -631,30 +652,42 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
const gchar *title;
|
||||
const gchar *desc;
|
||||
|
||||
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
|
||||
|
||||
if (! editor)
|
||||
return;
|
||||
|
||||
if (editor->control_sel_l == editor->control_sel_r)
|
||||
{
|
||||
title = _("Split Segment Uniformly");
|
||||
desc = _("Split Gradient Segment Uniformly");
|
||||
}
|
||||
else
|
||||
{
|
||||
title = _("Split Segments Uniformly");
|
||||
desc = _("Split Gradient Segments Uniformly");
|
||||
}
|
||||
|
||||
/* Create dialog window */
|
||||
dialog =
|
||||
gimp_dialog_new ((editor->control_sel_l == editor->control_sel_r) ?
|
||||
_("Split Segment Uniformly") :
|
||||
_("Split Segments Uniformly"),
|
||||
"gradient_segment_split_uniformly",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/split_segments_uniformly.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
|
||||
title, "gradient_segment_split_uniformly",
|
||||
GIMP_STOCK_TOOL_BLEND, desc,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/split_segments_uniformly.html",
|
||||
|
||||
GTK_STOCK_CANCEL, gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
_("Split"), gradient_editor_split_uniform_callback,
|
||||
editor, NULL, NULL, TRUE, FALSE,
|
||||
_("Split"),
|
||||
gradient_editor_split_uniform_callback,
|
||||
editor, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
@ -1059,24 +1092,26 @@ gradient_editor_menu_update (GtkItemFactory *factory,
|
|||
|
||||
if (! selection)
|
||||
{
|
||||
SET_LABEL ("/flip", _("Flip Segment"));
|
||||
SET_LABEL ("/replicate", _("Replicate Segment"));
|
||||
SET_LABEL ("/blendingfunction", _("Blending Function for Segment"));
|
||||
SET_LABEL ("/coloringtype", _("Coloring Type for Segment"));
|
||||
|
||||
SET_LABEL ("/flip", _("Flip Segment"));
|
||||
SET_LABEL ("/replicate", _("Replicate Segment..."));
|
||||
SET_LABEL ("/splitmidpoint", _("Split Segment at Midpoint"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segment Uniformly"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segment Uniformly..."));
|
||||
SET_LABEL ("/delete", _("Delete Segment"));
|
||||
SET_LABEL ("/recenter", _("Re-center Segment's Midpoint"));
|
||||
SET_LABEL ("/redistribute", _("Re-distribute Handles in Segment"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_LABEL ("/flip", _("Flip Selection"));
|
||||
SET_LABEL ("/replicate", _("Replicate Selection"));
|
||||
SET_LABEL ("/blendingfunction", _("Blending Function for Selection"));
|
||||
SET_LABEL ("/coloringtype", _("Coloring Type for Selection"));
|
||||
|
||||
SET_LABEL ("/flip", _("Flip Selection"));
|
||||
SET_LABEL ("/replicate", _("Replicate Selection..."));
|
||||
SET_LABEL ("/splitmidpoint", _("Split Segments at Midpoints"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segments Uniformly"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segments Uniformly..."));
|
||||
SET_LABEL ("/delete", _("Delete Selection"));
|
||||
SET_LABEL ("/recenter", _("Re-center Midpoints in Selection"));
|
||||
SET_LABEL ("/redistribute", _("Re-distribute Handles in Selection"));
|
||||
|
@ -1163,18 +1198,6 @@ gradient_editor_left_color_changed (ColorNotebook *cnb,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case COLOR_NOTEBOOK_OK:
|
||||
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
|
||||
editor->control_sel_r,
|
||||
(GimpRGB *) color,
|
||||
&editor->control_sel_r->right_color,
|
||||
TRUE, TRUE);
|
||||
gimp_gradient_segments_free (editor->left_saved_segments);
|
||||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
color_notebook_free (cnb);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
|
||||
case COLOR_NOTEBOOK_UPDATE:
|
||||
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
|
||||
editor->control_sel_r,
|
||||
|
@ -1184,11 +1207,25 @@ gradient_editor_left_color_changed (ColorNotebook *cnb,
|
|||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
break;
|
||||
|
||||
case COLOR_NOTEBOOK_OK:
|
||||
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
|
||||
editor->control_sel_r,
|
||||
(GimpRGB *) color,
|
||||
&editor->control_sel_r->right_color,
|
||||
TRUE, TRUE);
|
||||
gimp_gradient_segments_free (editor->left_saved_segments);
|
||||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
|
||||
case COLOR_NOTEBOOK_CANCEL:
|
||||
gradient_editor_replace_selection (editor, editor->left_saved_segments);
|
||||
GIMP_DATA (gradient)->dirty = editor->left_saved_dirty;
|
||||
gimp_gradient_editor_update (editor, GRAD_UPDATE_GRADIENT);
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
}
|
||||
|
@ -1229,6 +1266,7 @@ gradient_editor_right_color_changed (ColorNotebook *cnb,
|
|||
gimp_gradient_segments_free (editor->right_saved_segments);
|
||||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
|
||||
|
@ -1236,6 +1274,7 @@ gradient_editor_right_color_changed (ColorNotebook *cnb,
|
|||
gradient_editor_replace_selection (editor, editor->right_saved_segments);
|
||||
GIMP_DATA (gradient)->dirty = editor->right_saved_dirty;
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -313,22 +313,25 @@ image_layers_merge_query (GimpImage *gimage,
|
|||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
|
||||
frame = gimp_radio_group_new2 (TRUE,
|
||||
merge_visible ?
|
||||
_("Final, Merged Layer should be:") :
|
||||
_("Final, Anchored Layer should be:"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->merge_type,
|
||||
GINT_TO_POINTER (options->merge_type),
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE,
|
||||
merge_visible ?
|
||||
_("Final, Merged Layer should be:") :
|
||||
_("Final, Anchored Layer should be:"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->merge_type,
|
||||
GINT_TO_POINTER (options->merge_type),
|
||||
|
||||
_("Expanded as necessary"),
|
||||
GINT_TO_POINTER (GIMP_EXPAND_AS_NECESSARY), NULL,
|
||||
_("Clipped to image"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_IMAGE), NULL,
|
||||
_("Clipped to bottom layer"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_BOTTOM_LAYER), NULL,
|
||||
_("Expanded as necessary"),
|
||||
GINT_TO_POINTER (GIMP_EXPAND_AS_NECESSARY), NULL,
|
||||
|
||||
NULL);
|
||||
_("Clipped to image"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_IMAGE), NULL,
|
||||
|
||||
_("Clipped to bottom layer"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_BOTTOM_LAYER), NULL,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
|
|
@ -100,18 +100,22 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
if (! editor->color_notebook)
|
||||
{
|
||||
editor->color_notebook =
|
||||
color_notebook_new (_("Edit Palette Color"),
|
||||
(const GimpRGB *) &editor->color->color,
|
||||
palette_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE,
|
||||
FALSE);
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (palette),
|
||||
_("Edit Palette Color"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
_("Edit Color Palette Entry"),
|
||||
(const GimpRGB *) &editor->color->color,
|
||||
palette_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE, FALSE);
|
||||
editor->color_notebook_active = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! editor->color_notebook_active)
|
||||
{
|
||||
color_notebook_set_viewable (editor->color_notebook,
|
||||
GIMP_VIEWABLE (palette));
|
||||
color_notebook_show (editor->color_notebook);
|
||||
editor->color_notebook_active = TRUE;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "color-notebook.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -116,6 +118,18 @@ struct _ColorNotebook
|
|||
};
|
||||
|
||||
|
||||
static ColorNotebook *
|
||||
color_notebook_new_internal (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha);
|
||||
|
||||
static void color_notebook_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_cancel_callback (GtkWidget *widget,
|
||||
|
@ -177,11 +191,65 @@ static gboolean color_history_initialized = FALSE;
|
|||
|
||||
ColorNotebook *
|
||||
color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
return color_notebook_new_internal (NULL,
|
||||
title,
|
||||
"color_selection",
|
||||
NULL,
|
||||
NULL,
|
||||
color,
|
||||
callback, client_data,
|
||||
wants_updates, show_alpha);
|
||||
}
|
||||
|
||||
ColorNotebook *
|
||||
color_notebook_viewable_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
return color_notebook_new_internal (viewable,
|
||||
title,
|
||||
"color_selection",
|
||||
stock_id,
|
||||
desc,
|
||||
color,
|
||||
callback, client_data,
|
||||
wants_updates, show_alpha);
|
||||
}
|
||||
|
||||
void
|
||||
color_notebook_set_viewable (ColorNotebook *cnb,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
g_return_if_fail (cnb != NULL);
|
||||
|
||||
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
|
||||
viewable);
|
||||
}
|
||||
|
||||
static ColorNotebook *
|
||||
color_notebook_new_internal (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
ColorNotebook *cnp;
|
||||
GtkWidget *main_vbox;
|
||||
|
@ -255,37 +323,53 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
|
||||
if (desc)
|
||||
{
|
||||
cnp->shell = gimp_viewable_dialog_new (viewable,
|
||||
title, wmclass_name,
|
||||
stock_id, desc,
|
||||
color_notebook_help_func,
|
||||
(const gchar *) cnp,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (cnp->shell), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell = gimp_dialog_new (title, wmclass_name,
|
||||
color_notebook_help_func,
|
||||
(const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (wants_updates)
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
|
||||
|
||||
"_delete_event_", color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
"_delete_event_",
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (cnp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
|
||||
|
||||
GTK_STOCK_CANCEL, color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
GTK_STOCK_OK,
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
}
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
@ -420,7 +504,7 @@ color_notebook_new (const gchar *title,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_UNDO, GTK_ICON_SIZE_MENU);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (button), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
|
|
|
@ -31,27 +31,40 @@ typedef enum
|
|||
} ColorNotebookState;
|
||||
|
||||
|
||||
typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookState state,
|
||||
gpointer data);
|
||||
typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookState state,
|
||||
gpointer callback_data);
|
||||
|
||||
|
||||
ColorNotebook * color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer data,
|
||||
gboolean wants_update,
|
||||
gboolean show_aplha);
|
||||
ColorNotebook * color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer callback_data,
|
||||
gboolean wants_update,
|
||||
gboolean show_aplha);
|
||||
|
||||
void color_notebook_show (ColorNotebook *cnb);
|
||||
void color_notebook_hide (ColorNotebook *cnb);
|
||||
void color_notebook_free (ColorNotebook *cnb);
|
||||
ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer callback_data,
|
||||
gboolean wants_update,
|
||||
gboolean show_alpha);
|
||||
|
||||
void color_notebook_set_color (ColorNotebook *cnb,
|
||||
const GimpRGB *color);
|
||||
void color_notebook_get_color (ColorNotebook *cnb,
|
||||
GimpRGB *color);
|
||||
void color_notebook_set_viewable (ColorNotebook *cnb,
|
||||
GimpViewable *viewable);
|
||||
|
||||
void color_notebook_show (ColorNotebook *cnb);
|
||||
void color_notebook_hide (ColorNotebook *cnb);
|
||||
void color_notebook_free (ColorNotebook *cnb);
|
||||
|
||||
void color_notebook_set_color (ColorNotebook *cnb,
|
||||
const GimpRGB *color);
|
||||
void color_notebook_get_color (ColorNotebook *cnb,
|
||||
GimpRGB *color);
|
||||
|
||||
|
||||
/* color history functions */
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "palette-select.h"
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "core/gimpimage-new.h"
|
||||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "file-new-dialog.h"
|
||||
|
||||
|
@ -105,29 +106,29 @@ file_new_dialog_create (Gimp *gimp,
|
|||
|
||||
info = g_new0 (NewImageInfo, 1);
|
||||
|
||||
info->gimp = gimp;
|
||||
info->gimp = gimp;
|
||||
info->values = gimp_image_new_values_new (gimp, gimage);
|
||||
|
||||
info->values = gimp_image_new_values_new (gimp, gimage);
|
||||
info->dialog =
|
||||
gimp_viewable_dialog_new (NULL,
|
||||
_("New Image"), "new_image",
|
||||
GTK_STOCK_NEW,
|
||||
_("Create a New Image"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/file_new.html",
|
||||
|
||||
info->confirm_dialog = NULL;
|
||||
info->size = 0.0;
|
||||
GTK_STOCK_CANCEL, file_new_cancel_callback,
|
||||
info, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
info->dialog = gimp_dialog_new (_("New Image"), "new_image",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/file_new.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, FALSE, TRUE,
|
||||
GIMP_STOCK_RESET, file_new_reset_callback,
|
||||
info, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
GTK_STOCK_CANCEL, file_new_cancel_callback,
|
||||
info, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_OK, file_new_ok_callback,
|
||||
info, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
GIMP_STOCK_RESET, file_new_reset_callback,
|
||||
info, NULL, NULL, FALSE, FALSE,
|
||||
NULL);
|
||||
|
||||
GTK_STOCK_OK, file_new_ok_callback,
|
||||
info, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (info->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
top_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
|
|
@ -189,7 +189,7 @@ info_dialog_new_extended (GimpViewable *viewable,
|
|||
G_CALLBACK (info_dialog_delete_callback),
|
||||
idialog);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
|
||||
|
||||
|
@ -278,8 +278,7 @@ info_dialog_free (InfoDialog *idialog)
|
|||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (! idialog)
|
||||
return;
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (! GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
@ -289,8 +288,7 @@ info_dialog_popup (InfoDialog *idialog)
|
|||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (! idialog)
|
||||
return;
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
@ -37,12 +38,7 @@
|
|||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "widgets/gimppreview.h"
|
||||
|
||||
/*#include "tools/gimptool.h"*/
|
||||
#include "tools/gimpmovetool.h" /* need icon of move tool */
|
||||
#include "tools/gimpcolorpickertool.h" /* need icon of color picker tool */
|
||||
#include "tools/tool_manager.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "info-dialog.h"
|
||||
#include "info-window.h"
|
||||
|
@ -67,15 +63,18 @@ struct _InfoWinData
|
|||
gchar resolution_str[MAX_BUF];
|
||||
|
||||
const gchar *unit_str;
|
||||
|
||||
GtkWidget *pos_labels[4];
|
||||
GtkWidget *unit_labels[2];
|
||||
GtkWidget *color_labels[4];
|
||||
GtkWidget *rgb_labels[4];
|
||||
GtkWidget *hsv_labels[4];
|
||||
|
||||
gboolean showing_extended;
|
||||
};
|
||||
|
||||
|
||||
/* The different classes of visuals */
|
||||
static gchar *visual_classes[] =
|
||||
static const gchar *visual_classes[] =
|
||||
{
|
||||
N_("Static Gray"),
|
||||
N_("Grayscale"),
|
||||
|
@ -85,28 +84,6 @@ static gchar *visual_classes[] =
|
|||
N_("Direct Color"),
|
||||
};
|
||||
|
||||
static gchar * info_window_title (GimpDisplay *gdisp);
|
||||
|
||||
|
||||
static void
|
||||
info_window_image_renamed_callback (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GimpDisplay *gdisp;
|
||||
InfoWinData *iwd;
|
||||
|
||||
id = (InfoDialog *) data;
|
||||
|
||||
iwd = (InfoWinData *) id->user_data;
|
||||
|
||||
gdisp = (GimpDisplay *) iwd->gdisp;
|
||||
|
||||
title = info_window_title (gdisp);
|
||||
gtk_window_set_title (GTK_WINDOW (id->shell), title);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
info_window_close_callback (GtkWidget *widget,
|
||||
|
@ -118,24 +95,14 @@ info_window_close_callback (GtkWidget *widget,
|
|||
static void
|
||||
info_window_page_switch (GtkWidget *widget,
|
||||
GtkNotebookPage *page,
|
||||
gint page_num)
|
||||
gint page_num,
|
||||
InfoDialog *info_win)
|
||||
{
|
||||
InfoDialog *info_win;
|
||||
InfoWinData *iwd;
|
||||
|
||||
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget),
|
||||
"gimp-info-window");
|
||||
iwd = (InfoWinData *) info_win->user_data;
|
||||
|
||||
/* Only deal with the second page */
|
||||
if (page_num != 1)
|
||||
{
|
||||
iwd->showing_extended = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iwd->showing_extended = TRUE;
|
||||
}
|
||||
iwd->showing_extended = (page_num == 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,59 +114,55 @@ info_window_page_switch (GtkWidget *widget,
|
|||
*/
|
||||
|
||||
static void
|
||||
info_window_create_extended (InfoDialog *info_win,
|
||||
Gimp *gimp)
|
||||
info_window_create_extended (InfoDialog *info_win,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GtkWidget *main_table;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *image;
|
||||
GtkWidget *sep;
|
||||
InfoWinData *iwd;
|
||||
gint i;
|
||||
|
||||
iwd = (InfoWinData *) info_win->user_data;
|
||||
|
||||
main_table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (main_table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (main_table), 4);
|
||||
hbox = gtk_hbox_new (TRUE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
|
||||
|
||||
/* cursor information */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
table = gtk_table_new (5, 3, FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_MOVE, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
table = gtk_table_new (4, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_container_add (GTK_CONTAINER (abox), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (gimp, GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE);
|
||||
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
label = gtk_label_new (_("X:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (_("Y:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -207,7 +170,7 @@ info_window_create_extended (InfoDialog *info_win,
|
|||
{
|
||||
iwd->pos_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i+1, i+2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -215,99 +178,133 @@ info_window_create_extended (InfoDialog *info_win,
|
|||
{
|
||||
iwd->unit_labels[i/2] = label = gtk_label_new (NULL);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 2, 3, i+1, i+2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 2, 3, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_table_attach (GTK_TABLE (main_table), hbox, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
|
||||
/* color information */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
table = gtk_table_new (5, 2, FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_COLOR_PICKER,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), hbox2);
|
||||
gtk_widget_show (hbox2);
|
||||
|
||||
/* RGB */
|
||||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (gimp, GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE);
|
||||
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
/* Red */
|
||||
label = gtk_label_new (_("R:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Green */
|
||||
label = gtk_label_new (_("G:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Blue */
|
||||
label = gtk_label_new (_("B:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Alpha */
|
||||
label = gtk_label_new (_("A:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
iwd->color_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
iwd->rgb_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i+1, i+2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
gtk_table_attach (GTK_TABLE (main_table), hbox, 1, 2, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
/* HSV */
|
||||
|
||||
sep = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Hue */
|
||||
label = gtk_label_new (_("H:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Saturation */
|
||||
label = gtk_label_new (_("S:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Value */
|
||||
label = gtk_label_new (_("V:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Alpha */
|
||||
label = gtk_label_new (_("A:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
iwd->hsv_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (info_win->info_notebook),
|
||||
main_table, gtk_label_new (_("Extended")));
|
||||
gtk_widget_show (main_table);
|
||||
hbox, gtk_label_new (_("Extended")));
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
|
||||
/* Set back to first page */
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (info_win->info_notebook), 0);
|
||||
|
||||
g_object_set_data (G_OBJECT (info_win->info_notebook), "gimp-info-window",
|
||||
info_win);
|
||||
|
||||
g_signal_connect (G_OBJECT (info_win->info_notebook), "switch_page",
|
||||
G_CALLBACK (info_window_page_switch),
|
||||
NULL);
|
||||
info_win);
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,19 +313,16 @@ info_window_create (GimpDisplay *gdisp)
|
|||
{
|
||||
InfoDialog *info_win;
|
||||
InfoWinData *iwd;
|
||||
gchar *title;
|
||||
gint type;
|
||||
|
||||
type = gimp_image_base_type (gdisp->gimage);
|
||||
|
||||
title = info_window_title (gdisp);
|
||||
info_win = info_dialog_notebook_new (GIMP_VIEWABLE (gdisp->gimage),
|
||||
title, "image_info",
|
||||
_("Info Window"), "info_window",
|
||||
GIMP_STOCK_INFO,
|
||||
_("Image Information"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/info_window.html");
|
||||
g_free (title);
|
||||
|
||||
/* create the action area */
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (info_win->shell),
|
||||
|
@ -361,11 +355,6 @@ info_window_create (GimpDisplay *gdisp)
|
|||
/* Add extra tabs */
|
||||
info_window_create_extended (info_win, gdisp->gimage->gimp);
|
||||
|
||||
/* keep track of image name changes */
|
||||
g_signal_connect (G_OBJECT (gdisp->gimage), "name_changed",
|
||||
G_CALLBACK (info_window_image_renamed_callback),
|
||||
info_win);
|
||||
|
||||
/* update the fields */
|
||||
info_window_update (gdisp);
|
||||
|
||||
|
@ -374,24 +363,6 @@ info_window_create (GimpDisplay *gdisp)
|
|||
|
||||
static InfoDialog *info_window_auto = NULL;
|
||||
|
||||
static gchar *
|
||||
info_window_title (GimpDisplay *gdisp)
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *title;
|
||||
|
||||
basename = file_utils_uri_to_utf8_basename (gimp_image_get_uri (gdisp->gimage));
|
||||
|
||||
title = g_strdup_printf (_("Info: %s-%d.%d"),
|
||||
basename,
|
||||
gimp_image_get_ID (gdisp->gimage),
|
||||
gdisp->instance);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
static void
|
||||
info_window_change_display (GimpContext *context,
|
||||
GimpDisplay *newdisp,
|
||||
|
@ -484,13 +455,10 @@ info_window_update_extended (GimpDisplay *gdisp,
|
|||
|
||||
if (force_update)
|
||||
{
|
||||
gchar *title;
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (info_window_auto->shell),
|
||||
GIMP_VIEWABLE (gdisp->gimage));
|
||||
|
||||
info_window_update (gdisp);
|
||||
|
||||
title = info_window_title (gdisp);
|
||||
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
if (! iwd || ! iwd->showing_extended)
|
||||
|
@ -548,23 +516,50 @@ info_window_update_extended (GimpDisplay *gdisp,
|
|||
|| (tx < 0.0 && ty < 0.0))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), _("N/A"));
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (iwd->rgb_labels[i]), _("N/A"));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[i]), _("N/A"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpRGB rgb;
|
||||
GimpHSV hsv;
|
||||
|
||||
sample_type = gimp_image_projection_type (gdisp->gimage);
|
||||
|
||||
for (i = RED_PIX;
|
||||
i <= (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type) ?
|
||||
ALPHA_PIX : BLUE_PIX);
|
||||
ALPHA_PIX : BLUE_PIX);
|
||||
i++)
|
||||
{
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) color[i]);
|
||||
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), buf);
|
||||
gtk_label_set_text (GTK_LABEL (iwd->rgb_labels[i]), buf);
|
||||
|
||||
if (i == ALPHA_PIX)
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[i]), buf);
|
||||
}
|
||||
|
||||
if (i == ALPHA_PIX)
|
||||
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), _("N/A"));
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (iwd->rgb_labels[i]), _("N/A"));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[i]), _("N/A"));
|
||||
}
|
||||
|
||||
gimp_rgb_set_uchar (&rgb,
|
||||
color[RED_PIX],
|
||||
color[GREEN_PIX],
|
||||
color[BLUE_PIX]);
|
||||
gimp_rgb_to_hsv (&rgb, &hsv);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) (hsv.h * 360.999));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[0]), buf);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) (hsv.s * 100.999));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[1]), buf);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) (hsv.v * 100.999));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[2]), buf);
|
||||
|
||||
g_free (color);
|
||||
}
|
||||
|
@ -586,10 +581,6 @@ info_window_free (InfoDialog *info_win)
|
|||
|
||||
iwd = (InfoWinData *) info_win->user_data;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (iwd->gdisp->gimage),
|
||||
info_window_image_renamed_callback,
|
||||
info_win);
|
||||
|
||||
g_free (iwd);
|
||||
info_dialog_free (info_win);
|
||||
}
|
||||
|
|
|
@ -169,6 +169,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
const gchar *wmclass = NULL;
|
||||
const gchar *window_title = NULL;
|
||||
const gchar *stock_id = NULL;
|
||||
const gchar *window_desc = NULL;
|
||||
gchar *help_page = NULL;
|
||||
|
||||
switch (type)
|
||||
|
@ -181,12 +182,15 @@ resize_widget_new (GimpImage *gimage,
|
|||
case ResizeLayer:
|
||||
wmclass = "scale_layer";
|
||||
window_title = _("Scale Layer");
|
||||
window_desc = _("Scale Layer Options");
|
||||
help_page = "layers/dialogs/scale_layer.html";
|
||||
frame = gtk_frame_new (_("Size"));
|
||||
break;
|
||||
|
||||
case ResizeImage:
|
||||
wmclass = "scale_image";
|
||||
window_title = _("Scale Image");
|
||||
window_desc = _("Scale Image Options");
|
||||
help_page = "dialogs/scale_image.html";
|
||||
frame = gtk_frame_new (_("Pixel Dimensions"));
|
||||
break;
|
||||
|
@ -200,12 +204,15 @@ resize_widget_new (GimpImage *gimage,
|
|||
{
|
||||
case ResizeLayer:
|
||||
wmclass = "resize_layer";
|
||||
window_title = _("Set Layer Boundary Size");
|
||||
window_title = _("Layer Boundary Size");
|
||||
window_desc = _("Set Layer Boundary Size");
|
||||
help_page = "layers/dialogs/layer_boundary_size.html";
|
||||
break;
|
||||
|
||||
case ResizeImage:
|
||||
wmclass = "resize_image";
|
||||
window_title = _("Set Canvas Size");
|
||||
window_title = _("Canvas Size");
|
||||
window_desc = _("Set Image Canvas Size");
|
||||
help_page = "dialogs/set_canvas_size.html";
|
||||
break;
|
||||
}
|
||||
|
@ -217,7 +224,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
gimp_viewable_dialog_new (GIMP_IS_VIEWABLE (object) ?
|
||||
GIMP_VIEWABLE (object) : GIMP_VIEWABLE (gimage),
|
||||
window_title, wmclass,
|
||||
stock_id, window_title,
|
||||
stock_id, window_desc,
|
||||
gimp_standard_help_func, help_page,
|
||||
|
||||
GTK_STOCK_CANCEL,
|
||||
|
@ -426,6 +433,9 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_table_attach_defaults (GTK_TABLE (table2), private->constrain, 1, 2, 0, 2);
|
||||
gtk_widget_show (private->constrain);
|
||||
|
||||
gimp_help_set_help_data (GIMP_CHAIN_BUTTON (private->constrain)->button,
|
||||
_("Constrain aspect ratio"), NULL);
|
||||
|
||||
gtk_widget_show (table2);
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (vbox);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "color-notebook.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -116,6 +118,18 @@ struct _ColorNotebook
|
|||
};
|
||||
|
||||
|
||||
static ColorNotebook *
|
||||
color_notebook_new_internal (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha);
|
||||
|
||||
static void color_notebook_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_cancel_callback (GtkWidget *widget,
|
||||
|
@ -177,11 +191,65 @@ static gboolean color_history_initialized = FALSE;
|
|||
|
||||
ColorNotebook *
|
||||
color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
return color_notebook_new_internal (NULL,
|
||||
title,
|
||||
"color_selection",
|
||||
NULL,
|
||||
NULL,
|
||||
color,
|
||||
callback, client_data,
|
||||
wants_updates, show_alpha);
|
||||
}
|
||||
|
||||
ColorNotebook *
|
||||
color_notebook_viewable_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
return color_notebook_new_internal (viewable,
|
||||
title,
|
||||
"color_selection",
|
||||
stock_id,
|
||||
desc,
|
||||
color,
|
||||
callback, client_data,
|
||||
wants_updates, show_alpha);
|
||||
}
|
||||
|
||||
void
|
||||
color_notebook_set_viewable (ColorNotebook *cnb,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
g_return_if_fail (cnb != NULL);
|
||||
|
||||
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
|
||||
viewable);
|
||||
}
|
||||
|
||||
static ColorNotebook *
|
||||
color_notebook_new_internal (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
ColorNotebook *cnp;
|
||||
GtkWidget *main_vbox;
|
||||
|
@ -255,37 +323,53 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
|
||||
if (desc)
|
||||
{
|
||||
cnp->shell = gimp_viewable_dialog_new (viewable,
|
||||
title, wmclass_name,
|
||||
stock_id, desc,
|
||||
color_notebook_help_func,
|
||||
(const gchar *) cnp,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (cnp->shell), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell = gimp_dialog_new (title, wmclass_name,
|
||||
color_notebook_help_func,
|
||||
(const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (wants_updates)
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
|
||||
|
||||
"_delete_event_", color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
"_delete_event_",
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (cnp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
|
||||
|
||||
GTK_STOCK_CANCEL, color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
GTK_STOCK_OK,
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
}
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
@ -420,7 +504,7 @@ color_notebook_new (const gchar *title,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_UNDO, GTK_ICON_SIZE_MENU);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (button), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
|
|
|
@ -31,27 +31,40 @@ typedef enum
|
|||
} ColorNotebookState;
|
||||
|
||||
|
||||
typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookState state,
|
||||
gpointer data);
|
||||
typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookState state,
|
||||
gpointer callback_data);
|
||||
|
||||
|
||||
ColorNotebook * color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer data,
|
||||
gboolean wants_update,
|
||||
gboolean show_aplha);
|
||||
ColorNotebook * color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer callback_data,
|
||||
gboolean wants_update,
|
||||
gboolean show_aplha);
|
||||
|
||||
void color_notebook_show (ColorNotebook *cnb);
|
||||
void color_notebook_hide (ColorNotebook *cnb);
|
||||
void color_notebook_free (ColorNotebook *cnb);
|
||||
ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer callback_data,
|
||||
gboolean wants_update,
|
||||
gboolean show_alpha);
|
||||
|
||||
void color_notebook_set_color (ColorNotebook *cnb,
|
||||
const GimpRGB *color);
|
||||
void color_notebook_get_color (ColorNotebook *cnb,
|
||||
GimpRGB *color);
|
||||
void color_notebook_set_viewable (ColorNotebook *cnb,
|
||||
GimpViewable *viewable);
|
||||
|
||||
void color_notebook_show (ColorNotebook *cnb);
|
||||
void color_notebook_hide (ColorNotebook *cnb);
|
||||
void color_notebook_free (ColorNotebook *cnb);
|
||||
|
||||
void color_notebook_set_color (ColorNotebook *cnb,
|
||||
const GimpRGB *color);
|
||||
void color_notebook_get_color (ColorNotebook *cnb,
|
||||
GimpRGB *color);
|
||||
|
||||
|
||||
/* color history functions */
|
||||
|
|
|
@ -104,13 +104,19 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
if (! editor->color_notebook)
|
||||
{
|
||||
editor->color_notebook =
|
||||
color_notebook_new (_("Edit Indexed Color"),
|
||||
(const GimpRGB *) &color,
|
||||
colormap_editor_color_notebook_callback, editor,
|
||||
FALSE, FALSE);
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gimage),
|
||||
_("Edit Indexed Color"),
|
||||
GIMP_STOCK_CONVERT_INDEXED,
|
||||
_("Edit Indexed Image Palette Color"),
|
||||
(const GimpRGB *) &color,
|
||||
colormap_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
color_notebook_set_viewable (editor->color_notebook,
|
||||
GIMP_VIEWABLE (gimage));
|
||||
color_notebook_show (editor->color_notebook);
|
||||
color_notebook_set_color (editor->color_notebook, &color);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "tools/tool_manager.h"
|
||||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "palette-select.h"
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "core/gimpimage-new.h"
|
||||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "file-new-dialog.h"
|
||||
|
||||
|
@ -105,29 +106,29 @@ file_new_dialog_create (Gimp *gimp,
|
|||
|
||||
info = g_new0 (NewImageInfo, 1);
|
||||
|
||||
info->gimp = gimp;
|
||||
info->gimp = gimp;
|
||||
info->values = gimp_image_new_values_new (gimp, gimage);
|
||||
|
||||
info->values = gimp_image_new_values_new (gimp, gimage);
|
||||
info->dialog =
|
||||
gimp_viewable_dialog_new (NULL,
|
||||
_("New Image"), "new_image",
|
||||
GTK_STOCK_NEW,
|
||||
_("Create a New Image"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/file_new.html",
|
||||
|
||||
info->confirm_dialog = NULL;
|
||||
info->size = 0.0;
|
||||
GTK_STOCK_CANCEL, file_new_cancel_callback,
|
||||
info, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
info->dialog = gimp_dialog_new (_("New Image"), "new_image",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/file_new.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, FALSE, TRUE,
|
||||
GIMP_STOCK_RESET, file_new_reset_callback,
|
||||
info, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
GTK_STOCK_CANCEL, file_new_cancel_callback,
|
||||
info, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_OK, file_new_ok_callback,
|
||||
info, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
GIMP_STOCK_RESET, file_new_reset_callback,
|
||||
info, NULL, NULL, FALSE, FALSE,
|
||||
NULL);
|
||||
|
||||
GTK_STOCK_OK, file_new_ok_callback,
|
||||
info, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
gtk_window_set_resizable (GTK_WINDOW (info->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
top_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "widgets/gimpgradienteditor.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "color-notebook.h"
|
||||
|
@ -82,12 +83,16 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
|
|||
editor->left_saved_dirty = GIMP_DATA (gradient)->dirty;
|
||||
editor->left_saved_segments = gradient_editor_save_selection (editor);
|
||||
|
||||
color_notebook_new (_("Left Endpoint Color"),
|
||||
&editor->control_sel_l->left_color,
|
||||
gradient_editor_left_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
editor->color_notebook =
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
|
||||
_("Left Endpoint Color"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Gradient Segment's Left Endpoint Color"),
|
||||
&editor->control_sel_l->left_color,
|
||||
gradient_editor_left_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
||||
}
|
||||
|
@ -205,12 +210,16 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
|
|||
editor->right_saved_dirty = GIMP_DATA (gradient)->dirty;
|
||||
editor->right_saved_segments = gradient_editor_save_selection (editor);
|
||||
|
||||
color_notebook_new (_("Right Endpoint Color"),
|
||||
&editor->control_sel_l->right_color,
|
||||
gradient_editor_right_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
editor->color_notebook =
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (gradient),
|
||||
_("Right Endpoint Color"),
|
||||
GIMP_STOCK_TOOL_BLEND,
|
||||
_("Gradient Segment's Right Endpoint Color"),
|
||||
&editor->control_sel_l->right_color,
|
||||
gradient_editor_right_color_changed,
|
||||
editor,
|
||||
editor->instant_update,
|
||||
TRUE);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
||||
}
|
||||
|
@ -529,29 +538,41 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
const gchar *title;
|
||||
const gchar *desc;
|
||||
|
||||
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
|
||||
|
||||
if (! editor)
|
||||
return;
|
||||
|
||||
if (editor->control_sel_l == editor->control_sel_r)
|
||||
{
|
||||
title = _("Replicate Segment");
|
||||
desc = _("Replicate Gradient Segment");
|
||||
}
|
||||
else
|
||||
{
|
||||
title = _("Replicate Selection");
|
||||
desc = _("Replicate Gradient Selection");
|
||||
}
|
||||
|
||||
dialog =
|
||||
gimp_dialog_new ((editor->control_sel_l == editor->control_sel_r) ?
|
||||
_("Replicate segment") :
|
||||
_("Replicate selection"),
|
||||
"gradient_segment_replicate",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/replicate_segment.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
|
||||
title, "gradient_segment_replicate",
|
||||
GIMP_STOCK_TOOL_BLEND, desc,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/replicate_segment.html",
|
||||
|
||||
GTK_STOCK_CANCEL, gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, TRUE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
_("Replicate"), gradient_editor_replicate_callback,
|
||||
editor, NULL, NULL, FALSE, FALSE,
|
||||
_("Replicate"),
|
||||
gradient_editor_replicate_callback,
|
||||
editor, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
|
@ -592,7 +613,7 @@ gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget,
|
|||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpGradientEditor *editor;
|
||||
GimpGradientEditor *editor;
|
||||
GimpGradient *gradient;
|
||||
GimpGradientSegment *seg, *lseg, *rseg;
|
||||
|
||||
|
@ -631,30 +652,42 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkObject *scale_data;
|
||||
const gchar *title;
|
||||
const gchar *desc;
|
||||
|
||||
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
|
||||
|
||||
if (! editor)
|
||||
return;
|
||||
|
||||
if (editor->control_sel_l == editor->control_sel_r)
|
||||
{
|
||||
title = _("Split Segment Uniformly");
|
||||
desc = _("Split Gradient Segment Uniformly");
|
||||
}
|
||||
else
|
||||
{
|
||||
title = _("Split Segments Uniformly");
|
||||
desc = _("Split Gradient Segments Uniformly");
|
||||
}
|
||||
|
||||
/* Create dialog window */
|
||||
dialog =
|
||||
gimp_dialog_new ((editor->control_sel_l == editor->control_sel_r) ?
|
||||
_("Split Segment Uniformly") :
|
||||
_("Split Segments Uniformly"),
|
||||
"gradient_segment_split_uniformly",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/split_segments_uniformly.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
|
||||
title, "gradient_segment_split_uniformly",
|
||||
GIMP_STOCK_TOOL_BLEND, desc,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/gradient_editor/split_segments_uniformly.html",
|
||||
|
||||
GTK_STOCK_CANCEL, gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
gradient_editor_dialog_cancel_callback,
|
||||
editor, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
_("Split"), gradient_editor_split_uniform_callback,
|
||||
editor, NULL, NULL, TRUE, FALSE,
|
||||
_("Split"),
|
||||
gradient_editor_split_uniform_callback,
|
||||
editor, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
/* The main vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
@ -1059,24 +1092,26 @@ gradient_editor_menu_update (GtkItemFactory *factory,
|
|||
|
||||
if (! selection)
|
||||
{
|
||||
SET_LABEL ("/flip", _("Flip Segment"));
|
||||
SET_LABEL ("/replicate", _("Replicate Segment"));
|
||||
SET_LABEL ("/blendingfunction", _("Blending Function for Segment"));
|
||||
SET_LABEL ("/coloringtype", _("Coloring Type for Segment"));
|
||||
|
||||
SET_LABEL ("/flip", _("Flip Segment"));
|
||||
SET_LABEL ("/replicate", _("Replicate Segment..."));
|
||||
SET_LABEL ("/splitmidpoint", _("Split Segment at Midpoint"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segment Uniformly"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segment Uniformly..."));
|
||||
SET_LABEL ("/delete", _("Delete Segment"));
|
||||
SET_LABEL ("/recenter", _("Re-center Segment's Midpoint"));
|
||||
SET_LABEL ("/redistribute", _("Re-distribute Handles in Segment"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_LABEL ("/flip", _("Flip Selection"));
|
||||
SET_LABEL ("/replicate", _("Replicate Selection"));
|
||||
SET_LABEL ("/blendingfunction", _("Blending Function for Selection"));
|
||||
SET_LABEL ("/coloringtype", _("Coloring Type for Selection"));
|
||||
|
||||
SET_LABEL ("/flip", _("Flip Selection"));
|
||||
SET_LABEL ("/replicate", _("Replicate Selection..."));
|
||||
SET_LABEL ("/splitmidpoint", _("Split Segments at Midpoints"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segments Uniformly"));
|
||||
SET_LABEL ("/splituniformly", _("Split Segments Uniformly..."));
|
||||
SET_LABEL ("/delete", _("Delete Selection"));
|
||||
SET_LABEL ("/recenter", _("Re-center Midpoints in Selection"));
|
||||
SET_LABEL ("/redistribute", _("Re-distribute Handles in Selection"));
|
||||
|
@ -1163,18 +1198,6 @@ gradient_editor_left_color_changed (ColorNotebook *cnb,
|
|||
|
||||
switch (state)
|
||||
{
|
||||
case COLOR_NOTEBOOK_OK:
|
||||
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
|
||||
editor->control_sel_r,
|
||||
(GimpRGB *) color,
|
||||
&editor->control_sel_r->right_color,
|
||||
TRUE, TRUE);
|
||||
gimp_gradient_segments_free (editor->left_saved_segments);
|
||||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
color_notebook_free (cnb);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
|
||||
case COLOR_NOTEBOOK_UPDATE:
|
||||
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
|
||||
editor->control_sel_r,
|
||||
|
@ -1184,11 +1207,25 @@ gradient_editor_left_color_changed (ColorNotebook *cnb,
|
|||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
break;
|
||||
|
||||
case COLOR_NOTEBOOK_OK:
|
||||
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
|
||||
editor->control_sel_r,
|
||||
(GimpRGB *) color,
|
||||
&editor->control_sel_r->right_color,
|
||||
TRUE, TRUE);
|
||||
gimp_gradient_segments_free (editor->left_saved_segments);
|
||||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
|
||||
case COLOR_NOTEBOOK_CANCEL:
|
||||
gradient_editor_replace_selection (editor, editor->left_saved_segments);
|
||||
GIMP_DATA (gradient)->dirty = editor->left_saved_dirty;
|
||||
gimp_gradient_editor_update (editor, GRAD_UPDATE_GRADIENT);
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
}
|
||||
|
@ -1229,6 +1266,7 @@ gradient_editor_right_color_changed (ColorNotebook *cnb,
|
|||
gimp_gradient_segments_free (editor->right_saved_segments);
|
||||
gimp_data_dirty (GIMP_DATA (gradient));
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
|
||||
|
@ -1236,6 +1274,7 @@ gradient_editor_right_color_changed (ColorNotebook *cnb,
|
|||
gradient_editor_replace_selection (editor, editor->right_saved_segments);
|
||||
GIMP_DATA (gradient)->dirty = editor->right_saved_dirty;
|
||||
color_notebook_free (cnb);
|
||||
editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -313,22 +313,25 @@ image_layers_merge_query (GimpImage *gimage,
|
|||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
|
||||
vbox);
|
||||
|
||||
frame = gimp_radio_group_new2 (TRUE,
|
||||
merge_visible ?
|
||||
_("Final, Merged Layer should be:") :
|
||||
_("Final, Anchored Layer should be:"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->merge_type,
|
||||
GINT_TO_POINTER (options->merge_type),
|
||||
frame =
|
||||
gimp_radio_group_new2 (TRUE,
|
||||
merge_visible ?
|
||||
_("Final, Merged Layer should be:") :
|
||||
_("Final, Anchored Layer should be:"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&options->merge_type,
|
||||
GINT_TO_POINTER (options->merge_type),
|
||||
|
||||
_("Expanded as necessary"),
|
||||
GINT_TO_POINTER (GIMP_EXPAND_AS_NECESSARY), NULL,
|
||||
_("Clipped to image"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_IMAGE), NULL,
|
||||
_("Clipped to bottom layer"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_BOTTOM_LAYER), NULL,
|
||||
_("Expanded as necessary"),
|
||||
GINT_TO_POINTER (GIMP_EXPAND_AS_NECESSARY), NULL,
|
||||
|
||||
NULL);
|
||||
_("Clipped to image"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_IMAGE), NULL,
|
||||
|
||||
_("Clipped to bottom layer"),
|
||||
GINT_TO_POINTER (GIMP_CLIP_TO_BOTTOM_LAYER), NULL,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
|
|
@ -189,7 +189,7 @@ info_dialog_new_extended (GimpViewable *viewable,
|
|||
G_CALLBACK (info_dialog_delete_callback),
|
||||
idialog);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
|
||||
|
||||
|
@ -278,8 +278,7 @@ info_dialog_free (InfoDialog *idialog)
|
|||
void
|
||||
info_dialog_popup (InfoDialog *idialog)
|
||||
{
|
||||
if (! idialog)
|
||||
return;
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (! GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_show (idialog->shell);
|
||||
|
@ -289,8 +288,7 @@ info_dialog_popup (InfoDialog *idialog)
|
|||
void
|
||||
info_dialog_popdown (InfoDialog *idialog)
|
||||
{
|
||||
if (! idialog)
|
||||
return;
|
||||
g_return_if_fail (idialog != NULL);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (idialog->shell))
|
||||
gtk_widget_hide (idialog->shell);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
@ -37,12 +38,7 @@
|
|||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
|
||||
#include "widgets/gimppreview.h"
|
||||
|
||||
/*#include "tools/gimptool.h"*/
|
||||
#include "tools/gimpmovetool.h" /* need icon of move tool */
|
||||
#include "tools/gimpcolorpickertool.h" /* need icon of color picker tool */
|
||||
#include "tools/tool_manager.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "info-dialog.h"
|
||||
#include "info-window.h"
|
||||
|
@ -67,15 +63,18 @@ struct _InfoWinData
|
|||
gchar resolution_str[MAX_BUF];
|
||||
|
||||
const gchar *unit_str;
|
||||
|
||||
GtkWidget *pos_labels[4];
|
||||
GtkWidget *unit_labels[2];
|
||||
GtkWidget *color_labels[4];
|
||||
GtkWidget *rgb_labels[4];
|
||||
GtkWidget *hsv_labels[4];
|
||||
|
||||
gboolean showing_extended;
|
||||
};
|
||||
|
||||
|
||||
/* The different classes of visuals */
|
||||
static gchar *visual_classes[] =
|
||||
static const gchar *visual_classes[] =
|
||||
{
|
||||
N_("Static Gray"),
|
||||
N_("Grayscale"),
|
||||
|
@ -85,28 +84,6 @@ static gchar *visual_classes[] =
|
|||
N_("Direct Color"),
|
||||
};
|
||||
|
||||
static gchar * info_window_title (GimpDisplay *gdisp);
|
||||
|
||||
|
||||
static void
|
||||
info_window_image_renamed_callback (GimpImage *gimage,
|
||||
gpointer data)
|
||||
{
|
||||
InfoDialog *id;
|
||||
gchar *title;
|
||||
GimpDisplay *gdisp;
|
||||
InfoWinData *iwd;
|
||||
|
||||
id = (InfoDialog *) data;
|
||||
|
||||
iwd = (InfoWinData *) id->user_data;
|
||||
|
||||
gdisp = (GimpDisplay *) iwd->gdisp;
|
||||
|
||||
title = info_window_title (gdisp);
|
||||
gtk_window_set_title (GTK_WINDOW (id->shell), title);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
info_window_close_callback (GtkWidget *widget,
|
||||
|
@ -118,24 +95,14 @@ info_window_close_callback (GtkWidget *widget,
|
|||
static void
|
||||
info_window_page_switch (GtkWidget *widget,
|
||||
GtkNotebookPage *page,
|
||||
gint page_num)
|
||||
gint page_num,
|
||||
InfoDialog *info_win)
|
||||
{
|
||||
InfoDialog *info_win;
|
||||
InfoWinData *iwd;
|
||||
|
||||
info_win = (InfoDialog *) g_object_get_data (G_OBJECT (widget),
|
||||
"gimp-info-window");
|
||||
iwd = (InfoWinData *) info_win->user_data;
|
||||
|
||||
/* Only deal with the second page */
|
||||
if (page_num != 1)
|
||||
{
|
||||
iwd->showing_extended = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iwd->showing_extended = TRUE;
|
||||
}
|
||||
iwd->showing_extended = (page_num == 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,59 +114,55 @@ info_window_page_switch (GtkWidget *widget,
|
|||
*/
|
||||
|
||||
static void
|
||||
info_window_create_extended (InfoDialog *info_win,
|
||||
Gimp *gimp)
|
||||
info_window_create_extended (InfoDialog *info_win,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GtkWidget *main_table;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *image;
|
||||
GtkWidget *sep;
|
||||
InfoWinData *iwd;
|
||||
gint i;
|
||||
|
||||
iwd = (InfoWinData *) info_win->user_data;
|
||||
|
||||
main_table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (main_table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (main_table), 4);
|
||||
hbox = gtk_hbox_new (TRUE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
|
||||
|
||||
/* cursor information */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
table = gtk_table_new (5, 3, FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_MOVE, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
table = gtk_table_new (4, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_container_add (GTK_CONTAINER (abox), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (gimp, GIMP_TYPE_MOVE_TOOL)), 22, 0, FALSE);
|
||||
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
label = gtk_label_new (_("X:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new (_("Y:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -207,7 +170,7 @@ info_window_create_extended (InfoDialog *info_win,
|
|||
{
|
||||
iwd->pos_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i+1, i+2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -215,99 +178,133 @@ info_window_create_extended (InfoDialog *info_win,
|
|||
{
|
||||
iwd->unit_labels[i/2] = label = gtk_label_new (NULL);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 2, 3, i+1, i+2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 2, 3, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_table_attach (GTK_TABLE (main_table), hbox, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
|
||||
/* color information */
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
table = gtk_table_new (5, 2, FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_TOOL_COLOR_PICKER,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), hbox2);
|
||||
gtk_widget_show (hbox2);
|
||||
|
||||
/* RGB */
|
||||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
preview = gimp_preview_new (GIMP_VIEWABLE (tool_manager_get_info_by_type (gimp, GIMP_TYPE_COLOR_PICKER_TOOL)), 22, 0, FALSE);
|
||||
gtk_table_attach (GTK_TABLE (table), preview, 0, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 2);
|
||||
gtk_widget_show (preview);
|
||||
|
||||
/* Red */
|
||||
label = gtk_label_new (_("R:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Green */
|
||||
label = gtk_label_new (_("G:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Blue */
|
||||
label = gtk_label_new (_("B:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Alpha */
|
||||
label = gtk_label_new (_("A:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
iwd->color_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
iwd->rgb_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i+1, i+2,
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
gtk_table_attach (GTK_TABLE (main_table), hbox, 1, 2, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
/* HSV */
|
||||
|
||||
sep = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), sep, FALSE, FALSE, 0);
|
||||
gtk_widget_show (sep);
|
||||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Hue */
|
||||
label = gtk_label_new (_("H:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Saturation */
|
||||
label = gtk_label_new (_("S:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Value */
|
||||
label = gtk_label_new (_("V:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
/* Alpha */
|
||||
label = gtk_label_new (_("A:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
iwd->hsv_labels[i] = label = gtk_label_new (_("N/A"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, i, i + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (info_win->info_notebook),
|
||||
main_table, gtk_label_new (_("Extended")));
|
||||
gtk_widget_show (main_table);
|
||||
hbox, gtk_label_new (_("Extended")));
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
|
||||
/* Set back to first page */
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (info_win->info_notebook), 0);
|
||||
|
||||
g_object_set_data (G_OBJECT (info_win->info_notebook), "gimp-info-window",
|
||||
info_win);
|
||||
|
||||
g_signal_connect (G_OBJECT (info_win->info_notebook), "switch_page",
|
||||
G_CALLBACK (info_window_page_switch),
|
||||
NULL);
|
||||
info_win);
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,19 +313,16 @@ info_window_create (GimpDisplay *gdisp)
|
|||
{
|
||||
InfoDialog *info_win;
|
||||
InfoWinData *iwd;
|
||||
gchar *title;
|
||||
gint type;
|
||||
|
||||
type = gimp_image_base_type (gdisp->gimage);
|
||||
|
||||
title = info_window_title (gdisp);
|
||||
info_win = info_dialog_notebook_new (GIMP_VIEWABLE (gdisp->gimage),
|
||||
title, "image_info",
|
||||
_("Info Window"), "info_window",
|
||||
GIMP_STOCK_INFO,
|
||||
_("Image Information"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/info_window.html");
|
||||
g_free (title);
|
||||
|
||||
/* create the action area */
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (info_win->shell),
|
||||
|
@ -361,11 +355,6 @@ info_window_create (GimpDisplay *gdisp)
|
|||
/* Add extra tabs */
|
||||
info_window_create_extended (info_win, gdisp->gimage->gimp);
|
||||
|
||||
/* keep track of image name changes */
|
||||
g_signal_connect (G_OBJECT (gdisp->gimage), "name_changed",
|
||||
G_CALLBACK (info_window_image_renamed_callback),
|
||||
info_win);
|
||||
|
||||
/* update the fields */
|
||||
info_window_update (gdisp);
|
||||
|
||||
|
@ -374,24 +363,6 @@ info_window_create (GimpDisplay *gdisp)
|
|||
|
||||
static InfoDialog *info_window_auto = NULL;
|
||||
|
||||
static gchar *
|
||||
info_window_title (GimpDisplay *gdisp)
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *title;
|
||||
|
||||
basename = file_utils_uri_to_utf8_basename (gimp_image_get_uri (gdisp->gimage));
|
||||
|
||||
title = g_strdup_printf (_("Info: %s-%d.%d"),
|
||||
basename,
|
||||
gimp_image_get_ID (gdisp->gimage),
|
||||
gdisp->instance);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
static void
|
||||
info_window_change_display (GimpContext *context,
|
||||
GimpDisplay *newdisp,
|
||||
|
@ -484,13 +455,10 @@ info_window_update_extended (GimpDisplay *gdisp,
|
|||
|
||||
if (force_update)
|
||||
{
|
||||
gchar *title;
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (info_window_auto->shell),
|
||||
GIMP_VIEWABLE (gdisp->gimage));
|
||||
|
||||
info_window_update (gdisp);
|
||||
|
||||
title = info_window_title (gdisp);
|
||||
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
if (! iwd || ! iwd->showing_extended)
|
||||
|
@ -548,23 +516,50 @@ info_window_update_extended (GimpDisplay *gdisp,
|
|||
|| (tx < 0.0 && ty < 0.0))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), _("N/A"));
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (iwd->rgb_labels[i]), _("N/A"));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[i]), _("N/A"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpRGB rgb;
|
||||
GimpHSV hsv;
|
||||
|
||||
sample_type = gimp_image_projection_type (gdisp->gimage);
|
||||
|
||||
for (i = RED_PIX;
|
||||
i <= (GIMP_IMAGE_TYPE_HAS_ALPHA (sample_type) ?
|
||||
ALPHA_PIX : BLUE_PIX);
|
||||
ALPHA_PIX : BLUE_PIX);
|
||||
i++)
|
||||
{
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) color[i]);
|
||||
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), buf);
|
||||
gtk_label_set_text (GTK_LABEL (iwd->rgb_labels[i]), buf);
|
||||
|
||||
if (i == ALPHA_PIX)
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[i]), buf);
|
||||
}
|
||||
|
||||
if (i == ALPHA_PIX)
|
||||
gtk_label_set_text (GTK_LABEL (iwd->color_labels[i]), _("N/A"));
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (iwd->rgb_labels[i]), _("N/A"));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[i]), _("N/A"));
|
||||
}
|
||||
|
||||
gimp_rgb_set_uchar (&rgb,
|
||||
color[RED_PIX],
|
||||
color[GREEN_PIX],
|
||||
color[BLUE_PIX]);
|
||||
gimp_rgb_to_hsv (&rgb, &hsv);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) (hsv.h * 360.999));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[0]), buf);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) (hsv.s * 100.999));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[1]), buf);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", (gint) (hsv.v * 100.999));
|
||||
gtk_label_set_text (GTK_LABEL (iwd->hsv_labels[2]), buf);
|
||||
|
||||
g_free (color);
|
||||
}
|
||||
|
@ -586,10 +581,6 @@ info_window_free (InfoDialog *info_win)
|
|||
|
||||
iwd = (InfoWinData *) info_win->user_data;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (iwd->gdisp->gimage),
|
||||
info_window_image_renamed_callback,
|
||||
info_win);
|
||||
|
||||
g_free (iwd);
|
||||
info_dialog_free (info_win);
|
||||
}
|
||||
|
|
|
@ -100,18 +100,22 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
if (! editor->color_notebook)
|
||||
{
|
||||
editor->color_notebook =
|
||||
color_notebook_new (_("Edit Palette Color"),
|
||||
(const GimpRGB *) &editor->color->color,
|
||||
palette_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE,
|
||||
FALSE);
|
||||
color_notebook_viewable_new (GIMP_VIEWABLE (palette),
|
||||
_("Edit Palette Color"),
|
||||
GTK_STOCK_SELECT_COLOR,
|
||||
_("Edit Color Palette Entry"),
|
||||
(const GimpRGB *) &editor->color->color,
|
||||
palette_editor_color_notebook_callback,
|
||||
editor,
|
||||
FALSE, FALSE);
|
||||
editor->color_notebook_active = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! editor->color_notebook_active)
|
||||
{
|
||||
color_notebook_set_viewable (editor->color_notebook,
|
||||
GIMP_VIEWABLE (palette));
|
||||
color_notebook_show (editor->color_notebook);
|
||||
editor->color_notebook_active = TRUE;
|
||||
}
|
||||
|
|
|
@ -169,6 +169,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
const gchar *wmclass = NULL;
|
||||
const gchar *window_title = NULL;
|
||||
const gchar *stock_id = NULL;
|
||||
const gchar *window_desc = NULL;
|
||||
gchar *help_page = NULL;
|
||||
|
||||
switch (type)
|
||||
|
@ -181,12 +182,15 @@ resize_widget_new (GimpImage *gimage,
|
|||
case ResizeLayer:
|
||||
wmclass = "scale_layer";
|
||||
window_title = _("Scale Layer");
|
||||
window_desc = _("Scale Layer Options");
|
||||
help_page = "layers/dialogs/scale_layer.html";
|
||||
frame = gtk_frame_new (_("Size"));
|
||||
break;
|
||||
|
||||
case ResizeImage:
|
||||
wmclass = "scale_image";
|
||||
window_title = _("Scale Image");
|
||||
window_desc = _("Scale Image Options");
|
||||
help_page = "dialogs/scale_image.html";
|
||||
frame = gtk_frame_new (_("Pixel Dimensions"));
|
||||
break;
|
||||
|
@ -200,12 +204,15 @@ resize_widget_new (GimpImage *gimage,
|
|||
{
|
||||
case ResizeLayer:
|
||||
wmclass = "resize_layer";
|
||||
window_title = _("Set Layer Boundary Size");
|
||||
window_title = _("Layer Boundary Size");
|
||||
window_desc = _("Set Layer Boundary Size");
|
||||
help_page = "layers/dialogs/layer_boundary_size.html";
|
||||
break;
|
||||
|
||||
case ResizeImage:
|
||||
wmclass = "resize_image";
|
||||
window_title = _("Set Canvas Size");
|
||||
window_title = _("Canvas Size");
|
||||
window_desc = _("Set Image Canvas Size");
|
||||
help_page = "dialogs/set_canvas_size.html";
|
||||
break;
|
||||
}
|
||||
|
@ -217,7 +224,7 @@ resize_widget_new (GimpImage *gimage,
|
|||
gimp_viewable_dialog_new (GIMP_IS_VIEWABLE (object) ?
|
||||
GIMP_VIEWABLE (object) : GIMP_VIEWABLE (gimage),
|
||||
window_title, wmclass,
|
||||
stock_id, window_title,
|
||||
stock_id, window_desc,
|
||||
gimp_standard_help_func, help_page,
|
||||
|
||||
GTK_STOCK_CANCEL,
|
||||
|
@ -426,6 +433,9 @@ resize_widget_new (GimpImage *gimage,
|
|||
gtk_table_attach_defaults (GTK_TABLE (table2), private->constrain, 1, 2, 0, 2);
|
||||
gtk_widget_show (private->constrain);
|
||||
|
||||
gimp_help_set_help_data (GIMP_CHAIN_BUTTON (private->constrain)->button,
|
||||
_("Constrain aspect ratio"), NULL);
|
||||
|
||||
gtk_widget_show (table2);
|
||||
gtk_widget_show (table);
|
||||
gtk_widget_show (vbox);
|
||||
|
|
|
@ -145,14 +145,11 @@ gimp_brightness_contrast_tool_init (GimpBrightnessContrastTool *bc_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (bc_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Brightness-Contrast");
|
||||
image_map_tool->shell_name = "brightness_contrast";
|
||||
image_map_tool->shell_desc = _("Adjust Brightness and Contrast");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_BRIGHTNESS_CONTRAST;
|
||||
|
||||
bc_tool->brightness = 0.0;
|
||||
bc_tool->contrast = 0.0;
|
||||
bc_tool->lut = gimp_lut_new ();
|
||||
bc_tool->brightness = 0.0;
|
||||
bc_tool->contrast = 0.0;
|
||||
bc_tool->lut = gimp_lut_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -154,10 +154,7 @@ gimp_color_balance_tool_init (GimpColorBalanceTool *cb_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (cb_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Color Balance");
|
||||
image_map_tool->shell_name = "color_balance";
|
||||
image_map_tool->shell_desc = _("Adjust Color Balance");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_COLOR_BALANCE;
|
||||
|
||||
cb_tool->color_balance = g_new0 (ColorBalance, 1);
|
||||
cb_tool->transfer_mode = GIMP_MIDTONES;
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
|
||||
#include "tools-types.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME #include "gui/gui-types.h"
|
||||
#endif
|
||||
#include "gui/gui-types.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-crop.h"
|
||||
|
@ -138,43 +133,33 @@ static void crop_tool_crop_image (GimpImage *gimage,
|
|||
gboolean layer_only,
|
||||
gboolean crop_layers);
|
||||
|
||||
static void crop_recalc (GimpTool *tool,
|
||||
GimpCropTool *crop);
|
||||
static void crop_start (GimpTool *tool,
|
||||
GimpCropTool *crop);
|
||||
static void crop_recalc (GimpCropTool *crop);
|
||||
static void crop_start (GimpCropTool *crop);
|
||||
|
||||
/* Crop dialog functions */
|
||||
static void crop_info_update (GimpTool *tool);
|
||||
static void crop_info_create (GimpTool *tool);
|
||||
static void crop_info_update (GimpCropTool *crop);
|
||||
static void crop_info_create (GimpCropTool *crop);
|
||||
static void crop_crop_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
static void crop_resize_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
static void crop_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
|
||||
static void crop_selection_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
static void crop_automatic_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
|
||||
static void crop_origin_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
static void crop_size_changed (GtkWidget *widget,
|
||||
gpointer data);
|
||||
GimpCropTool *crop);
|
||||
|
||||
static GimpToolOptions * crop_options_new (GimpToolInfo *tool_info);
|
||||
static void crop_options_reset (GimpToolOptions *tool_options);
|
||||
|
||||
|
||||
static InfoDialog *crop_info = NULL;
|
||||
|
||||
static gdouble orig_vals[2];
|
||||
static gdouble size_vals[2];
|
||||
|
||||
static GtkWidget *origin_sizeentry;
|
||||
static GtkWidget *size_sizeentry;
|
||||
|
||||
static GimpDrawToolClass *parent_class = NULL;
|
||||
|
||||
|
||||
|
@ -188,9 +173,9 @@ gimp_crop_tool_register (GimpToolRegisterCallback callback,
|
|||
crop_options_new,
|
||||
FALSE,
|
||||
"gimp-crop-tool",
|
||||
_("Crop Tool"),
|
||||
_("Crop & Resize"),
|
||||
_("Crop or Resize an image"),
|
||||
N_("/Tools/Transform Tools/Crop Tool"), "<shift>C",
|
||||
N_("/Tools/Transform Tools/Crop & Resize"), "<shift>C",
|
||||
NULL, "tools/crop_tool.html",
|
||||
GIMP_STOCK_TOOL_CROP,
|
||||
data);
|
||||
|
@ -264,10 +249,14 @@ gimp_crop_tool_init (GimpCropTool *crop_tool)
|
|||
static void
|
||||
gimp_crop_tool_finalize (GObject *object)
|
||||
{
|
||||
if (crop_info)
|
||||
GimpCropTool *crop;
|
||||
|
||||
crop = GIMP_CROP_TOOL (object);
|
||||
|
||||
if (crop->crop_info)
|
||||
{
|
||||
info_dialog_free (crop_info);
|
||||
crop_info = NULL;
|
||||
info_dialog_free (crop->crop_info);
|
||||
crop->crop_info = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
|
@ -278,9 +267,9 @@ gimp_crop_tool_control (GimpTool *tool,
|
|||
GimpToolAction action,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpCropTool *crop_tool;
|
||||
GimpCropTool *crop;
|
||||
|
||||
crop_tool = GIMP_CROP_TOOL (tool);
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
|
@ -288,11 +277,11 @@ gimp_crop_tool_control (GimpTool *tool,
|
|||
break;
|
||||
|
||||
case RESUME:
|
||||
crop_recalc (tool, crop_tool);
|
||||
crop_recalc (crop);
|
||||
break;
|
||||
|
||||
case HALT:
|
||||
crop_close_callback (NULL, NULL);
|
||||
crop_close_callback (NULL, crop);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -392,7 +381,7 @@ gimp_crop_tool_button_press (GimpTool *tool,
|
|||
crop->x2 = crop->x1 = ROUND (coords->x);
|
||||
crop->y2 = crop->y1 = ROUND (coords->y);
|
||||
|
||||
crop_start (tool, crop);
|
||||
crop_start (crop);
|
||||
}
|
||||
|
||||
crop->lastx = crop->startx = ROUND (coords->x);
|
||||
|
@ -435,11 +424,11 @@ gimp_crop_tool_button_release (GimpTool *tool,
|
|||
FALSE);
|
||||
|
||||
/* Finish the tool */
|
||||
crop_close_callback (NULL, NULL);
|
||||
crop_close_callback (NULL, crop);
|
||||
}
|
||||
else
|
||||
{
|
||||
crop_info_update (tool);
|
||||
crop_info_update (crop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -564,7 +553,7 @@ gimp_crop_tool_motion (GimpTool *tool,
|
|||
crop->lasty = cury;
|
||||
|
||||
/* recalculate the coordinates for crop_draw based on the new values */
|
||||
crop_recalc (tool, crop);
|
||||
crop_recalc (crop);
|
||||
|
||||
if (crop->function == CREATING ||
|
||||
crop->function == RESIZING_LEFT ||
|
||||
|
@ -660,7 +649,7 @@ gimp_crop_tool_arrow_key (GimpTool *tool,
|
|||
crop->y2 += inc_y;
|
||||
}
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
crop_recalc (crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
@ -834,7 +823,7 @@ gimp_crop_tool_draw (GimpDrawTool *draw)
|
|||
GTK_ANCHOR_SOUTH_EAST,
|
||||
FALSE);
|
||||
|
||||
crop_info_update (tool);
|
||||
crop_info_update (crop);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -856,9 +845,12 @@ crop_tool_crop_image (GimpImage *gimage,
|
|||
}
|
||||
|
||||
static void
|
||||
crop_recalc (GimpTool *tool,
|
||||
GimpCropTool *crop)
|
||||
crop_recalc (GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
||||
tool = GIMP_TOOL (crop);
|
||||
|
||||
gimp_display_shell_transform_xy (GIMP_DISPLAY_SHELL (tool->gdisp->shell),
|
||||
crop->x1, crop->y1,
|
||||
&crop->dx1, &crop->dy1,
|
||||
|
@ -879,44 +871,47 @@ crop_recalc (GimpTool *tool,
|
|||
}
|
||||
|
||||
static void
|
||||
crop_start (GimpTool *tool,
|
||||
GimpCropTool *crop)
|
||||
crop_start (GimpCropTool *crop)
|
||||
{
|
||||
static GimpDisplay *old_gdisp = NULL;
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
GimpTool *tool;
|
||||
|
||||
if (! crop_info)
|
||||
crop_info_create (tool);
|
||||
tool = GIMP_TOOL (crop);
|
||||
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (crop_info->shell),
|
||||
crop_recalc (crop);
|
||||
|
||||
if (! crop->crop_info)
|
||||
crop_info_create (crop);
|
||||
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (crop->crop_info->shell),
|
||||
GIMP_VIEWABLE (tool->gdisp->gimage));
|
||||
|
||||
g_signal_handlers_block_by_func (G_OBJECT (origin_sizeentry),
|
||||
g_signal_handlers_block_by_func (G_OBJECT (crop->origin_sizeentry),
|
||||
crop_origin_changed,
|
||||
crop_info);
|
||||
g_signal_handlers_block_by_func (G_OBJECT (size_sizeentry),
|
||||
crop);
|
||||
g_signal_handlers_block_by_func (G_OBJECT (crop->size_sizeentry),
|
||||
crop_size_changed,
|
||||
crop_info);
|
||||
crop);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (crop->origin_sizeentry), 0,
|
||||
tool->gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (crop->origin_sizeentry), 1,
|
||||
tool->gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (crop->origin_sizeentry), 0,
|
||||
0, tool->gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (crop->origin_sizeentry), 1,
|
||||
0, tool->gdisp->gimage->height);
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (crop->size_sizeentry), 0,
|
||||
tool->gdisp->gimage->xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (crop->size_sizeentry), 1,
|
||||
tool->gdisp->gimage->yresolution, FALSE);
|
||||
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (crop->size_sizeentry), 0,
|
||||
0, tool->gdisp->gimage->width);
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (crop->size_sizeentry), 1,
|
||||
0, tool->gdisp->gimage->height);
|
||||
|
||||
if (old_gdisp != tool->gdisp)
|
||||
|
@ -925,26 +920,26 @@ crop_start (GimpTool *tool,
|
|||
|
||||
shell = GIMP_DISPLAY_SHELL (tool->gdisp->shell);
|
||||
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (crop->origin_sizeentry),
|
||||
tool->gdisp->gimage->unit) ;
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (crop->size_sizeentry),
|
||||
tool->gdisp->gimage->unit);
|
||||
|
||||
if (shell->dot_for_dot)
|
||||
{
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (crop->origin_sizeentry),
|
||||
GIMP_UNIT_PIXEL);
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
gimp_size_entry_set_unit (GIMP_SIZE_ENTRY (crop->size_sizeentry),
|
||||
GIMP_UNIT_PIXEL);
|
||||
}
|
||||
}
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (origin_sizeentry),
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (crop->origin_sizeentry),
|
||||
crop_origin_changed,
|
||||
crop_info);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (size_sizeentry),
|
||||
crop);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (crop->size_sizeentry),
|
||||
crop_size_changed,
|
||||
crop_info);
|
||||
crop);
|
||||
|
||||
old_gdisp = tool->gdisp;
|
||||
|
||||
|
@ -960,76 +955,80 @@ crop_start (GimpTool *tool,
|
|||
/***************************/
|
||||
|
||||
static void
|
||||
crop_info_create (GimpTool *tool)
|
||||
crop_info_create (GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDisplayShell *shell;
|
||||
GtkWidget *spinbutton;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *button;
|
||||
|
||||
tool = GIMP_TOOL (crop);
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
/* create the info dialog */
|
||||
crop_info = info_dialog_new (NULL,
|
||||
_("Crop & Resize"), "crop",
|
||||
GIMP_STOCK_TOOL_CROP,
|
||||
_("Crop & Resize Information"),
|
||||
tool_manager_help_func, NULL);
|
||||
crop->crop_info = info_dialog_new (NULL,
|
||||
tool->tool_info->blurb,
|
||||
GIMP_OBJECT (tool->tool_info)->name,
|
||||
tool->tool_info->stock_id,
|
||||
_("Crop & Resize Information"),
|
||||
tool_manager_help_func, NULL);
|
||||
|
||||
/* create the action area */
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (crop_info->shell),
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (crop->crop_info->shell),
|
||||
|
||||
GTK_STOCK_CLOSE, crop_close_callback,
|
||||
NULL, NULL, NULL, FALSE, FALSE,
|
||||
crop, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
_("Resize"), crop_resize_callback,
|
||||
NULL, NULL, NULL, FALSE, FALSE,
|
||||
GIMP_STOCK_RESIZE, crop_resize_callback,
|
||||
crop, NULL, NULL, FALSE, FALSE,
|
||||
|
||||
_("Crop"), crop_crop_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
GIMP_STOCK_TOOL_CROP, crop_crop_callback,
|
||||
crop, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
|
||||
/* add the information fields */
|
||||
spinbutton = info_dialog_add_spinbutton (crop_info, _("Origin X:"), NULL,
|
||||
spinbutton = info_dialog_add_spinbutton (crop->crop_info, _("Origin X:"), NULL,
|
||||
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
|
||||
origin_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Y:"), orig_vals, 1,
|
||||
crop->origin_sizeentry =
|
||||
info_dialog_add_sizeentry (crop->crop_info, _("Y:"), crop->orig_vals, 1,
|
||||
shell->dot_for_dot ?
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
G_CALLBACK (crop_origin_changed),
|
||||
crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (origin_sizeentry),
|
||||
crop);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (crop->origin_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (origin_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (crop->origin_sizeentry),
|
||||
0, -65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (crop->origin_sizeentry),
|
||||
1, -65536, 65536);
|
||||
|
||||
spinbutton = info_dialog_add_spinbutton (crop_info, _("Width:"), NULL,
|
||||
spinbutton = info_dialog_add_spinbutton (crop->crop_info, _("Width:"), NULL,
|
||||
-1, 1, 1, 10, 1, 1, 2, NULL, NULL);
|
||||
size_sizeentry =
|
||||
info_dialog_add_sizeentry (crop_info, _("Height:"), size_vals, 1,
|
||||
crop->size_sizeentry =
|
||||
info_dialog_add_sizeentry (crop->crop_info, _("Height:"), crop->size_vals, 1,
|
||||
shell->dot_for_dot ?
|
||||
GIMP_UNIT_PIXEL : gdisp->gimage->unit, "%a",
|
||||
TRUE, TRUE, FALSE, GIMP_SIZE_ENTRY_UPDATE_SIZE,
|
||||
G_CALLBACK (crop_size_changed),
|
||||
crop_info);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (size_sizeentry),
|
||||
crop);
|
||||
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (crop->size_sizeentry),
|
||||
GTK_SPIN_BUTTON (spinbutton), NULL);
|
||||
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 0,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size_sizeentry), 1,
|
||||
-65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (crop->size_sizeentry),
|
||||
0, -65536, 65536);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (crop->size_sizeentry),
|
||||
1, -65536, 65536);
|
||||
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop_info->info_table), 0, 0);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop_info->info_table), 1, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop_info->info_table), 2, 0);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop->crop_info->info_table), 0, 0);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop->crop_info->info_table), 1, 6);
|
||||
gtk_table_set_row_spacing (GTK_TABLE (crop->crop_info->info_table), 2, 0);
|
||||
|
||||
/* Create the area selection buttons */
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
|
@ -1037,310 +1036,241 @@ crop_info_create (GimpTool *tool)
|
|||
gtk_box_set_spacing (GTK_BOX (bbox), 4);
|
||||
|
||||
button = gtk_button_new_with_label (_("From Selection"));
|
||||
gtk_container_add (GTK_CONTAINER(bbox), button);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (G_OBJECT (button) , "clicked",
|
||||
G_CALLBACK (crop_selection_callback),
|
||||
NULL);
|
||||
gtk_widget_show (button);
|
||||
crop);
|
||||
|
||||
button = gtk_button_new_with_label (_("Auto Shrink"));
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
g_signal_connect (G_OBJECT (button) , "clicked",
|
||||
G_CALLBACK (crop_automatic_callback),
|
||||
NULL);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (crop_info->vbox), bbox, FALSE, FALSE, 2);
|
||||
g_signal_connect (G_OBJECT (button) , "clicked",
|
||||
G_CALLBACK (crop_automatic_callback),
|
||||
crop);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (crop->crop_info->vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
}
|
||||
|
||||
static void
|
||||
crop_info_update (GimpTool *tool)
|
||||
crop_info_update (GimpCropTool *crop)
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
crop->orig_vals[0] = crop->x1;
|
||||
crop->orig_vals[1] = crop->y1;
|
||||
crop->size_vals[0] = crop->x2 - crop->x1;
|
||||
crop->size_vals[1] = crop->y2 - crop->y1;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
orig_vals[0] = crop->x1;
|
||||
orig_vals[1] = crop->y1;
|
||||
size_vals[0] = crop->x2 - crop->x1;
|
||||
size_vals[1] = crop->y2 - crop->y1;
|
||||
|
||||
info_dialog_update (crop_info);
|
||||
info_dialog_popup (crop_info);
|
||||
info_dialog_update (crop->crop_info);
|
||||
info_dialog_popup (crop->crop_info);
|
||||
}
|
||||
|
||||
static void
|
||||
crop_crop_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
crop_crop_callback (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpTool *tool;
|
||||
CropOptions *options;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
tool = GIMP_TOOL (crop);
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
options->layer_only,
|
||||
TRUE);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
options->layer_only,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
/* Finish the tool */
|
||||
crop_close_callback (NULL, NULL);
|
||||
crop_close_callback (NULL, crop);
|
||||
}
|
||||
|
||||
static void
|
||||
crop_resize_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
crop_resize_callback (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
GimpTool *tool;
|
||||
CropOptions *options;
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
tool = GIMP_TOOL (crop);
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
options->layer_only,
|
||||
FALSE);
|
||||
|
||||
crop_tool_crop_image (tool->gdisp->gimage,
|
||||
crop->x1, crop->y1,
|
||||
crop->x2, crop->y2,
|
||||
options->layer_only,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
/* Finish the tool */
|
||||
crop_close_callback (NULL, NULL);
|
||||
crop_close_callback (NULL, crop);
|
||||
}
|
||||
|
||||
static void
|
||||
crop_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
crop_close_callback (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
if (gimp_tool_control_is_active (GIMP_TOOL (crop)->control))
|
||||
gimp_draw_tool_stop (GIMP_DRAW_TOOL (crop));
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
gimp_tool_control_halt (GIMP_TOOL (crop)->control); /* sets paused_count to 0 -- is this ok? */
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
if (gimp_tool_control_is_active (tool->control))
|
||||
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
gimp_tool_control_halt (tool->control); /* sets paused_count to 0 -- is this ok? */
|
||||
}
|
||||
|
||||
info_dialog_popdown (crop_info);
|
||||
if (crop->crop_info)
|
||||
info_dialog_popdown (crop->crop_info);
|
||||
}
|
||||
|
||||
static void
|
||||
crop_selection_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
crop_selection_callback (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
CropOptions *options;
|
||||
GimpLayer *layer;
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpLayer *layer;
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
options = (CropOptions *) GIMP_TOOL (crop)->tool_info->tool_options;
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
gdisp = GIMP_TOOL (crop)->gdisp;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (crop));
|
||||
|
||||
if (! gimp_image_mask_bounds (gdisp->gimage,
|
||||
&crop->x1, &crop->y1,
|
||||
&crop->x2, &crop->y2))
|
||||
{
|
||||
if (options->layer_only)
|
||||
{
|
||||
layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer),
|
||||
&crop->x1, &crop->y1);
|
||||
crop->x2 = gimp_drawable_width (GIMP_DRAWABLE (layer)) + crop->x1;
|
||||
crop->y2 = gimp_drawable_height (GIMP_DRAWABLE (layer)) + crop->y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
crop->x1 = crop->y1 = 0;
|
||||
crop->x2 = gdisp->gimage->width;
|
||||
crop->y2 = gdisp->gimage->height;
|
||||
}
|
||||
}
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
crop_automatic_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTool *tool;
|
||||
|
||||
/* FIXME: active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
if (! gimp_image_mask_bounds (gdisp->gimage,
|
||||
&crop->x1, &crop->y1,
|
||||
&crop->x2, &crop->y2))
|
||||
{
|
||||
GimpCropTool *crop;
|
||||
CropOptions *options;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDrawable *active_drawable;
|
||||
gint offset_x, offset_y;
|
||||
gint width, height;
|
||||
gint x1, y1, x2, y2;
|
||||
gint shrunk_x1;
|
||||
gint shrunk_y1;
|
||||
gint shrunk_x2;
|
||||
gint shrunk_y2;
|
||||
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
options = (CropOptions *) tool->tool_info->tool_options;
|
||||
|
||||
gdisp = tool->gdisp;
|
||||
|
||||
if (options->layer_only)
|
||||
{
|
||||
active_drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (! active_drawable)
|
||||
return;
|
||||
|
||||
width = gimp_drawable_width (GIMP_DRAWABLE (active_drawable));
|
||||
height = gimp_drawable_height (GIMP_DRAWABLE (active_drawable));
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable),
|
||||
&offset_x, &offset_y);
|
||||
layer = gimp_image_get_active_layer (gdisp->gimage);
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer),
|
||||
&crop->x1, &crop->y1);
|
||||
crop->x2 = gimp_drawable_width (GIMP_DRAWABLE (layer)) + crop->x1;
|
||||
crop->y2 = gimp_drawable_height (GIMP_DRAWABLE (layer)) + crop->y1;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gdisp->gimage->width;
|
||||
height = gdisp->gimage->height;
|
||||
offset_x = 0;
|
||||
offset_y = 0;
|
||||
crop->x1 = crop->y1 = 0;
|
||||
crop->x2 = gdisp->gimage->width;
|
||||
crop->y2 = gdisp->gimage->height;
|
||||
}
|
||||
}
|
||||
|
||||
x1 = crop->x1 - offset_x > 0 ? crop->x1 - offset_x : 0;
|
||||
x2 = crop->x2 - offset_x < width ? crop->x2 - offset_x : width;
|
||||
y1 = crop->y1 - offset_y > 0 ? crop->y1 - offset_y : 0;
|
||||
y2 = crop->y2 - offset_y < height ? crop->y2 - offset_y : height;
|
||||
crop_recalc (crop);
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (crop));
|
||||
}
|
||||
|
||||
if (gimp_image_crop_auto_shrink (gdisp->gimage,
|
||||
x1, y1, x2, y2,
|
||||
options->layer_only,
|
||||
&shrunk_x1,
|
||||
&shrunk_y1,
|
||||
&shrunk_x2,
|
||||
&shrunk_y2))
|
||||
{
|
||||
crop->x1 = offset_x + shrunk_x1;
|
||||
crop->x2 = offset_x + shrunk_x2;
|
||||
crop->y1 = offset_y + shrunk_y1;
|
||||
crop->y2 = offset_y + shrunk_y2;
|
||||
static void
|
||||
crop_automatic_callback (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
CropOptions *options;
|
||||
GimpDisplay *gdisp;
|
||||
GimpDrawable *active_drawable;
|
||||
gint offset_x, offset_y;
|
||||
gint width, height;
|
||||
gint x1, y1, x2, y2;
|
||||
gint shrunk_x1;
|
||||
gint shrunk_y1;
|
||||
gint shrunk_x2;
|
||||
gint shrunk_y2;
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
}
|
||||
options = (CropOptions *) GIMP_TOOL (crop)->tool_info->tool_options;
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
gdisp = GIMP_TOOL (crop)->gdisp;
|
||||
|
||||
if (options->layer_only)
|
||||
{
|
||||
active_drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
if (! active_drawable)
|
||||
return;
|
||||
|
||||
width = gimp_drawable_width (GIMP_DRAWABLE (active_drawable));
|
||||
height = gimp_drawable_height (GIMP_DRAWABLE (active_drawable));
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (active_drawable),
|
||||
&offset_x, &offset_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gdisp->gimage->width;
|
||||
height = gdisp->gimage->height;
|
||||
offset_x = 0;
|
||||
offset_y = 0;
|
||||
}
|
||||
|
||||
x1 = crop->x1 - offset_x > 0 ? crop->x1 - offset_x : 0;
|
||||
x2 = crop->x2 - offset_x < width ? crop->x2 - offset_x : width;
|
||||
y1 = crop->y1 - offset_y > 0 ? crop->y1 - offset_y : 0;
|
||||
y2 = crop->y2 - offset_y < height ? crop->y2 - offset_y : height;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (crop));
|
||||
|
||||
if (gimp_image_crop_auto_shrink (gdisp->gimage,
|
||||
x1, y1, x2, y2,
|
||||
options->layer_only,
|
||||
&shrunk_x1,
|
||||
&shrunk_y1,
|
||||
&shrunk_x2,
|
||||
&shrunk_y2))
|
||||
{
|
||||
crop->x1 = offset_x + shrunk_x1;
|
||||
crop->x2 = offset_x + shrunk_x2;
|
||||
crop->y1 = offset_y + shrunk_y1;
|
||||
crop->y2 = offset_y + shrunk_y2;
|
||||
|
||||
crop_recalc (crop);
|
||||
}
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (crop));
|
||||
}
|
||||
|
||||
static void
|
||||
crop_origin_changed (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
gint ox;
|
||||
gint oy;
|
||||
|
||||
ox = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0));
|
||||
oy = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1));
|
||||
|
||||
if ((ox != crop->x1) ||
|
||||
(oy != crop->y1))
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (crop));
|
||||
|
||||
crop->x2 = crop->x2 + (ox - crop->x1);
|
||||
crop->x1 = ox;
|
||||
crop->y2 = crop->y2 + (oy - crop->y1);
|
||||
crop->y1 = oy;
|
||||
|
||||
crop_recalc (crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (crop));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
crop_origin_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
crop_size_changed (GtkWidget *widget,
|
||||
GimpCropTool *crop)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpCropTool *crop;
|
||||
gint ox;
|
||||
gint oy;
|
||||
gint sx;
|
||||
gint sy;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
sx = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
sy = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
if ((sx != (crop->x2 - crop->x1)) ||
|
||||
(sy != (crop->y2 - crop->y1)))
|
||||
{
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
ox = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0));
|
||||
oy = RINT (gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1));
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (crop));
|
||||
|
||||
if ((ox != crop->x1) ||
|
||||
(oy != crop->y1))
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
crop->x2 = sx + crop->x1;
|
||||
crop->y2 = sy + crop->y1;
|
||||
|
||||
crop->x2 = crop->x2 + (ox - crop->x1);
|
||||
crop->x1 = ox;
|
||||
crop->y2 = crop->y2 + (oy - crop->y1);
|
||||
crop->y1 = oy;
|
||||
crop_recalc (crop);
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
crop_size_changed (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GimpTool *tool;
|
||||
GimpCropTool *crop;
|
||||
gint sx;
|
||||
gint sy;
|
||||
|
||||
/* XXX active_tool is bad */
|
||||
tool = tool_manager_get_active (the_gimp);
|
||||
|
||||
if (GIMP_IS_CROP_TOOL (tool))
|
||||
{
|
||||
crop = GIMP_CROP_TOOL (tool);
|
||||
|
||||
sx = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
sy = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if ((sx != (crop->x2 - crop->x1)) ||
|
||||
(sy != (crop->y2 - crop->y1)))
|
||||
{
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
crop->x2 = sx + crop->x1;
|
||||
crop->y2 = sy + crop->y1;
|
||||
|
||||
crop_recalc (tool, crop);
|
||||
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (crop));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
#define __GIMP_CROP_TOOL_H__
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME #include "gui/gui-types.h"
|
||||
#endif
|
||||
#include "gui/gui-types.h"
|
||||
|
||||
#include "gimpdrawtool.h"
|
||||
|
||||
|
||||
|
@ -52,6 +57,15 @@ struct _GimpCropTool
|
|||
gint dx2, dy2; /* */
|
||||
|
||||
gint dcw, dch; /* width and height of corners */
|
||||
|
||||
/* the crop dialog */
|
||||
InfoDialog *crop_info;
|
||||
|
||||
gdouble orig_vals[2];
|
||||
gdouble size_vals[2];
|
||||
|
||||
GtkWidget *origin_sizeentry;
|
||||
GtkWidget *size_sizeentry;
|
||||
};
|
||||
|
||||
struct _GimpCropToolClass
|
||||
|
|
|
@ -240,14 +240,11 @@ gimp_curves_tool_init (GimpCurvesTool *c_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (c_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Curves");
|
||||
image_map_tool->shell_name = "curves";
|
||||
image_map_tool->shell_desc = _("Adjust Color Curves");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_CURVES;
|
||||
|
||||
c_tool->curves = g_new0 (Curves, 1);
|
||||
c_tool->lut = gimp_lut_new ();
|
||||
c_tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
c_tool->curves = g_new0 (Curves, 1);
|
||||
c_tool->lut = gimp_lut_new ();
|
||||
c_tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
|
||||
curves_init (c_tool->curves);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpenummenu.h"
|
||||
#include "widgets/gimphistogramview.h"
|
||||
|
@ -90,7 +91,7 @@ static void gimp_histogram_tool_control (GimpTool *tool,
|
|||
GimpToolAction action,
|
||||
GimpDisplay *gdisp);
|
||||
|
||||
static HistogramToolDialog * histogram_tool_dialog_new (void);
|
||||
static HistogramToolDialog * histogram_tool_dialog_new (GimpToolInfo *tool_info);
|
||||
|
||||
static void histogram_tool_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
@ -196,7 +197,7 @@ gimp_histogram_tool_initialize (GimpTool *tool,
|
|||
|
||||
/* The histogram_tool dialog */
|
||||
if (! histogram_dialog)
|
||||
histogram_dialog = histogram_tool_dialog_new ();
|
||||
histogram_dialog = histogram_tool_dialog_new (tool->tool_info);
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
|
@ -332,7 +333,7 @@ histogram_tool_dialog_update (HistogramToolDialog *htd,
|
|||
/***************************/
|
||||
|
||||
static HistogramToolDialog *
|
||||
histogram_tool_dialog_new (void)
|
||||
histogram_tool_dialog_new (GimpToolInfo *tool_info)
|
||||
{
|
||||
HistogramToolDialog *htd;
|
||||
GtkWidget *hbox;
|
||||
|
@ -361,9 +362,9 @@ histogram_tool_dialog_new (void)
|
|||
/* The shell and main vbox */
|
||||
htd->shell =
|
||||
gimp_viewable_dialog_new (NULL,
|
||||
_("Histogram"),
|
||||
"histogram",
|
||||
GIMP_STOCK_TOOL_HISTOGRAM,
|
||||
tool_info->blurb,
|
||||
GIMP_OBJECT (tool_info)->name,
|
||||
tool_info->stock_id,
|
||||
_("View Image Histogram"),
|
||||
tool_manager_help_func, NULL,
|
||||
|
||||
|
|
|
@ -170,10 +170,7 @@ gimp_hue_saturation_tool_init (GimpHueSaturationTool *hs_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (hs_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Hue-Saturation");
|
||||
image_map_tool->shell_name = "hue_saturation";
|
||||
image_map_tool->shell_desc = _("Adjust Hue / Lightness / Saturation");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_HUE_SATURATION;
|
||||
|
||||
hs_tool->hue_saturation = g_new0 (HueSaturation, 1);
|
||||
hs_tool->hue_partition = GIMP_ALL_HUES;
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagemap.h"
|
||||
|
||||
#include "file/file-utils.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
|
@ -137,8 +136,7 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
|
|||
image_map_tool->image_map = NULL;
|
||||
image_map_tool->preview = TRUE;
|
||||
|
||||
image_map_tool->shell_title = NULL;
|
||||
image_map_tool->shell_name = NULL;
|
||||
image_map_tool->shell_desc = NULL;
|
||||
image_map_tool->shell = NULL;
|
||||
image_map_tool->main_vbox = NULL;
|
||||
}
|
||||
|
@ -198,16 +196,19 @@ gimp_image_map_tool_initialize (GimpTool *tool,
|
|||
|
||||
if (! image_map_tool->shell)
|
||||
{
|
||||
GtkWidget *shell;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *toggle;
|
||||
GimpToolInfo *tool_info;
|
||||
GtkWidget *shell;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *toggle;
|
||||
|
||||
tool_info = tool->tool_info;
|
||||
|
||||
image_map_tool->shell = shell =
|
||||
gimp_viewable_dialog_new (NULL,
|
||||
image_map_tool->shell_title,
|
||||
image_map_tool->shell_name,
|
||||
image_map_tool->stock_id,
|
||||
tool_info->blurb,
|
||||
GIMP_OBJECT (tool_info)->name,
|
||||
tool_info->stock_id,
|
||||
image_map_tool->shell_desc,
|
||||
tool_manager_help_func, NULL,
|
||||
|
||||
|
|
|
@ -44,10 +44,7 @@ struct _GimpImageMapTool
|
|||
gboolean preview;
|
||||
|
||||
/* the dialog */
|
||||
const gchar *shell_title;
|
||||
const gchar *shell_name;
|
||||
const gchar *shell_desc;
|
||||
const gchar *stock_id;
|
||||
|
||||
GtkWidget *shell;
|
||||
GtkWidget *main_vbox;
|
||||
|
|
|
@ -220,14 +220,11 @@ gimp_levels_tool_init (GimpLevelsTool *l_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (l_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Levels");
|
||||
image_map_tool->shell_name = "levels";
|
||||
image_map_tool->shell_desc = _("Adjust Color Levels");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_LEVELS;
|
||||
|
||||
l_tool->lut = gimp_lut_new ();
|
||||
l_tool->hist = gimp_histogram_new ();
|
||||
l_tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
l_tool->lut = gimp_lut_new ();
|
||||
l_tool->hist = gimp_histogram_new ();
|
||||
l_tool->channel = GIMP_HISTOGRAM_VALUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -138,7 +138,7 @@ gimp_measure_tool_register (GimpToolRegisterCallback callback,
|
|||
measure_tool_options_new,
|
||||
FALSE,
|
||||
"gimp-measure-tool",
|
||||
_("Measure Tool"),
|
||||
_("Measure"),
|
||||
_("Measure angles and lengths"),
|
||||
N_("/Tools/Measure"), NULL,
|
||||
NULL, "tools/measure.html",
|
||||
|
@ -391,9 +391,10 @@ gimp_measure_tool_button_press (GimpTool *tool,
|
|||
! GTK_WIDGET_VISIBLE (shell->statusbar)))
|
||||
{
|
||||
measure_tool_info = info_dialog_new (NULL,
|
||||
_("Measure Tool"), "measure",
|
||||
GIMP_STOCK_TOOL_MEASURE,
|
||||
_("Measure Tool Information"),
|
||||
tool->tool_info->blurb,
|
||||
GIMP_OBJECT (tool->tool_info)->name,
|
||||
tool->tool_info->stock_id,
|
||||
_("Measure Distances and Angles"),
|
||||
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);
|
||||
|
|
|
@ -138,13 +138,10 @@ gimp_posterize_tool_init (GimpPosterizeTool *posterize_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (posterize_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Posterize");
|
||||
image_map_tool->shell_name = "posterize";
|
||||
image_map_tool->shell_desc = _("Posterize (Reduce Number of Colors)");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_POSTERIZE;
|
||||
|
||||
posterize_tool->levels = POSTERIZE_DEFAULT_LEVELS;
|
||||
posterize_tool->lut = gimp_lut_new ();
|
||||
posterize_tool->levels = POSTERIZE_DEFAULT_LEVELS;
|
||||
posterize_tool->lut = gimp_lut_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -99,7 +99,7 @@ gimp_rotate_tool_register (GimpToolRegisterCallback callback,
|
|||
transform_options_new,
|
||||
FALSE,
|
||||
"gimp-rotate-tool",
|
||||
_("Rotate Tool"),
|
||||
_("Rotate"),
|
||||
_("Rotate the layer or selection"),
|
||||
N_("/Tools/Transform Tools/Rotate"), "<shift>R",
|
||||
NULL, "tools/rotate.html",
|
||||
|
|
|
@ -158,13 +158,10 @@ gimp_threshold_tool_init (GimpThresholdTool *t_tool)
|
|||
|
||||
image_map_tool = GIMP_IMAGE_MAP_TOOL (t_tool);
|
||||
|
||||
image_map_tool->shell_title = _("Threshold");
|
||||
image_map_tool->shell_name = "threshold";
|
||||
image_map_tool->shell_desc = _("Apply Threshold");
|
||||
image_map_tool->stock_id = GIMP_STOCK_TOOL_THRESHOLD;
|
||||
|
||||
t_tool->threshold = g_new0 (Threshold, 1);
|
||||
t_tool->hist = gimp_histogram_new ();
|
||||
t_tool->threshold = g_new0 (Threshold, 1);
|
||||
t_tool->hist = gimp_histogram_new ();
|
||||
|
||||
t_tool->threshold->low_threshold = 127;
|
||||
t_tool->threshold->high_threshold = 255;
|
||||
|
|
|
@ -353,11 +353,14 @@ gimp_transform_tool_button_press (GimpTool *tool,
|
|||
|
||||
/* find which handle we're dragging */
|
||||
gimp_transform_tool_oper_update (tool, coords, state, gdisp);
|
||||
|
||||
tr_tool->function = TRANSFORM_CREATING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tr_tool->function == TRANSFORM_CREATING && gimp_tool_control_is_active (tool->control))
|
||||
if (tr_tool->function == TRANSFORM_CREATING &&
|
||||
gimp_tool_control_is_active (tool->control))
|
||||
{
|
||||
gint i;
|
||||
|
||||
|
|
|
@ -66,6 +66,8 @@
|
|||
|
||||
#include "file/file-utils.h"
|
||||
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "gimprc.h"
|
||||
#include "undo.h"
|
||||
#include "undo_types.h"
|
||||
|
@ -814,28 +816,18 @@ undo_history_new (GimpImage *gimage)
|
|||
st);
|
||||
|
||||
/* The shell and main vbox */
|
||||
{
|
||||
gchar *basename;
|
||||
gchar *title;
|
||||
st->shell =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (gimage),
|
||||
_("Undo History"), "undo_history",
|
||||
GTK_STOCK_UNDO,
|
||||
_("Image Undo History"),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/undo_history.html",
|
||||
|
||||
basename = file_utils_uri_to_utf8_basename (gimp_image_get_uri (gimage));
|
||||
GTK_STOCK_CLOSE, undo_history_close_callback,
|
||||
st, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
title = g_strdup_printf (_("Undo History: %s"), basename);
|
||||
|
||||
g_free (basename);
|
||||
|
||||
st->shell = gimp_dialog_new (title, "undo_history",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/undo_history.html",
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
GTK_STOCK_CLOSE, undo_history_close_callback,
|
||||
st, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
g_free (title);
|
||||
}
|
||||
NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "color-notebook.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -116,6 +118,18 @@ struct _ColorNotebook
|
|||
};
|
||||
|
||||
|
||||
static ColorNotebook *
|
||||
color_notebook_new_internal (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha);
|
||||
|
||||
static void color_notebook_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_cancel_callback (GtkWidget *widget,
|
||||
|
@ -177,11 +191,65 @@ static gboolean color_history_initialized = FALSE;
|
|||
|
||||
ColorNotebook *
|
||||
color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
return color_notebook_new_internal (NULL,
|
||||
title,
|
||||
"color_selection",
|
||||
NULL,
|
||||
NULL,
|
||||
color,
|
||||
callback, client_data,
|
||||
wants_updates, show_alpha);
|
||||
}
|
||||
|
||||
ColorNotebook *
|
||||
color_notebook_viewable_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
return color_notebook_new_internal (viewable,
|
||||
title,
|
||||
"color_selection",
|
||||
stock_id,
|
||||
desc,
|
||||
color,
|
||||
callback, client_data,
|
||||
wants_updates, show_alpha);
|
||||
}
|
||||
|
||||
void
|
||||
color_notebook_set_viewable (ColorNotebook *cnb,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
g_return_if_fail (cnb != NULL);
|
||||
|
||||
if (GIMP_IS_VIEWABLE_DIALOG (cnb->shell))
|
||||
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (cnb->shell),
|
||||
viewable);
|
||||
}
|
||||
|
||||
static ColorNotebook *
|
||||
color_notebook_new_internal (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *wmclass_name,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer client_data,
|
||||
gboolean wants_updates,
|
||||
gboolean show_alpha)
|
||||
{
|
||||
ColorNotebook *cnp;
|
||||
GtkWidget *main_vbox;
|
||||
|
@ -255,37 +323,53 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
|
||||
if (desc)
|
||||
{
|
||||
cnp->shell = gimp_viewable_dialog_new (viewable,
|
||||
title, wmclass_name,
|
||||
stock_id, desc,
|
||||
color_notebook_help_func,
|
||||
(const gchar *) cnp,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (cnp->shell), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell = gimp_dialog_new (title, wmclass_name,
|
||||
color_notebook_help_func,
|
||||
(const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (wants_updates)
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
|
||||
|
||||
"_delete_event_", color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
"_delete_event_",
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (cnp->shell), FALSE);
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
|
||||
|
||||
GTK_STOCK_CANCEL, color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
GTK_STOCK_CANCEL,
|
||||
color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
GTK_STOCK_OK, color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
GTK_STOCK_OK,
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
}
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
|
@ -420,7 +504,7 @@ color_notebook_new (const gchar *title,
|
|||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_UNDO, GTK_ICON_SIZE_MENU);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (button), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
|
|
|
@ -31,27 +31,40 @@ typedef enum
|
|||
} ColorNotebookState;
|
||||
|
||||
|
||||
typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookState state,
|
||||
gpointer data);
|
||||
typedef void (* ColorNotebookCallback) (ColorNotebook *cnb,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookState state,
|
||||
gpointer callback_data);
|
||||
|
||||
|
||||
ColorNotebook * color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer data,
|
||||
gboolean wants_update,
|
||||
gboolean show_aplha);
|
||||
ColorNotebook * color_notebook_new (const gchar *title,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer callback_data,
|
||||
gboolean wants_update,
|
||||
gboolean show_aplha);
|
||||
|
||||
void color_notebook_show (ColorNotebook *cnb);
|
||||
void color_notebook_hide (ColorNotebook *cnb);
|
||||
void color_notebook_free (ColorNotebook *cnb);
|
||||
ColorNotebook * color_notebook_viewable_new (GimpViewable *viewable,
|
||||
const gchar *title,
|
||||
const gchar *stock_id,
|
||||
const gchar *desc,
|
||||
const GimpRGB *color,
|
||||
ColorNotebookCallback callback,
|
||||
gpointer callback_data,
|
||||
gboolean wants_update,
|
||||
gboolean show_alpha);
|
||||
|
||||
void color_notebook_set_color (ColorNotebook *cnb,
|
||||
const GimpRGB *color);
|
||||
void color_notebook_get_color (ColorNotebook *cnb,
|
||||
GimpRGB *color);
|
||||
void color_notebook_set_viewable (ColorNotebook *cnb,
|
||||
GimpViewable *viewable);
|
||||
|
||||
void color_notebook_show (ColorNotebook *cnb);
|
||||
void color_notebook_hide (ColorNotebook *cnb);
|
||||
void color_notebook_free (ColorNotebook *cnb);
|
||||
|
||||
void color_notebook_set_color (ColorNotebook *cnb,
|
||||
const GimpRGB *color);
|
||||
void color_notebook_get_color (ColorNotebook *cnb,
|
||||
GimpRGB *color);
|
||||
|
||||
|
||||
/* color history functions */
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
#include "gimpgradienteditor.h"
|
||||
#include "gimpitemfactory.h"
|
||||
|
||||
#include "gui/color-notebook.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
|
@ -498,6 +500,16 @@ gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
|||
|
||||
GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);
|
||||
|
||||
if (editor->data)
|
||||
{
|
||||
if (gradient_editor->color_notebook)
|
||||
{
|
||||
color_notebook_free (gradient_editor->color_notebook);
|
||||
gradient_editor->color_notebook = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (data && ! data->internal)
|
||||
gtk_widget_set_sensitive (gradient_editor->control, TRUE);
|
||||
else
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "gimpdataeditor.h"
|
||||
|
||||
#include "gui/gui-types.h" /* FIXME */
|
||||
|
||||
|
||||
#define GRAD_NUM_COLORS 10
|
||||
|
||||
|
@ -74,10 +76,13 @@ struct _GimpGradientEditor
|
|||
/* Instant update */
|
||||
gboolean instant_update;
|
||||
|
||||
/* Color notebook */
|
||||
ColorNotebook *color_notebook;
|
||||
|
||||
/* Gradient preview */
|
||||
guchar *preview_rows[2]; /* For caching redraw info */
|
||||
gint preview_last_x;
|
||||
gboolean preview_button_down;
|
||||
guchar *preview_rows[2]; /* For caching redraw info */
|
||||
gint preview_last_x;
|
||||
gboolean preview_button_down;
|
||||
|
||||
/* Gradient control */
|
||||
GdkPixmap *control_pixmap;
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
static void gimp_viewable_dialog_class_init (GimpViewableDialogClass *klass);
|
||||
static void gimp_viewable_dialog_init (GimpViewableDialog *dialog);
|
||||
|
||||
static void gimp_viewable_dialog_name_changed (GimpObject *object,
|
||||
GimpViewableDialog *dialog);
|
||||
|
||||
|
||||
static GimpDialogClass *parent_class = NULL;
|
||||
|
||||
|
@ -150,15 +153,17 @@ gimp_viewable_dialog_new (GimpViewable *viewable,
|
|||
{
|
||||
GimpViewableDialog *dialog;
|
||||
va_list args;
|
||||
gchar *escaped;
|
||||
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);
|
||||
dialog = g_object_new (GIMP_TYPE_VIEWABLE_DIALOG,
|
||||
"title", title,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), title);
|
||||
gtk_window_set_wmclass (GTK_WINDOW (dialog), wmclass_name, "Gimp");
|
||||
|
||||
if (help_func)
|
||||
|
@ -171,7 +176,10 @@ gimp_viewable_dialog_new (GimpViewable *viewable,
|
|||
gtk_image_set_from_stock (GTK_IMAGE (dialog->icon), stock_id,
|
||||
GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
|
||||
str = g_strdup_printf ("<b><big>%s</big></b>", desc);
|
||||
escaped = g_markup_escape_text (desc, -1);
|
||||
str = g_strdup_printf ("<b><big>%s</big></b>", escaped);
|
||||
g_free (escaped);
|
||||
|
||||
gtk_label_set_markup (GTK_LABEL (dialog->desc_label), str);
|
||||
g_free (str);
|
||||
|
||||
|
@ -184,34 +192,72 @@ gimp_viewable_dialog_new (GimpViewable *viewable,
|
|||
void
|
||||
gimp_viewable_dialog_set_viewable (GimpViewableDialog *dialog,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE_DIALOG (dialog));
|
||||
g_return_if_fail (! viewable || GIMP_IS_VIEWABLE (viewable));
|
||||
|
||||
if (dialog->preview)
|
||||
{
|
||||
GimpViewable *old_viewable;
|
||||
|
||||
old_viewable = GIMP_PREVIEW (dialog->preview)->viewable;
|
||||
|
||||
if (viewable == old_viewable)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (old_viewable),
|
||||
gimp_viewable_dialog_name_changed,
|
||||
dialog);
|
||||
|
||||
gtk_widget_destroy (dialog->preview);
|
||||
dialog->preview = NULL;
|
||||
}
|
||||
|
||||
if (viewable)
|
||||
{
|
||||
g_signal_connect_object (G_OBJECT (viewable),
|
||||
GIMP_VIEWABLE_GET_CLASS (viewable)->name_changed_signal,
|
||||
G_CALLBACK (gimp_viewable_dialog_name_changed),
|
||||
G_OBJECT (dialog),
|
||||
0);
|
||||
|
||||
gimp_viewable_dialog_name_changed (GIMP_OBJECT (viewable), dialog);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_viewable_dialog_name_changed (GimpObject *object,
|
||||
GimpViewableDialog *dialog)
|
||||
{
|
||||
const gchar *name;
|
||||
gchar *str;
|
||||
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE_DIALOG (dialog));
|
||||
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
|
||||
name = gimp_object_get_name (object);
|
||||
|
||||
if (dialog->preview)
|
||||
gtk_widget_destroy (dialog->preview);
|
||||
|
||||
name = gimp_object_get_name (GIMP_OBJECT (viewable));
|
||||
|
||||
if (GIMP_IS_ITEM (viewable))
|
||||
if (GIMP_IS_ITEM (object))
|
||||
{
|
||||
const gchar *uri;
|
||||
gchar *basename;
|
||||
|
||||
uri = gimp_image_get_uri (gimp_item_get_image (GIMP_ITEM (viewable)));
|
||||
uri = gimp_image_get_uri (gimp_item_get_image (GIMP_ITEM (object)));
|
||||
|
||||
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))
|
||||
else if (GIMP_IS_IMAGE (object))
|
||||
{
|
||||
const gchar *uri;
|
||||
|
||||
uri = gimp_image_get_uri (GIMP_IMAGE (viewable));
|
||||
uri = gimp_image_get_uri (GIMP_IMAGE (object));
|
||||
|
||||
str = file_utils_uri_to_utf8_basename (uri);
|
||||
}
|
||||
|
@ -222,9 +268,4 @@ gimp_viewable_dialog_set_viewable (GimpViewableDialog *dialog,
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -124,8 +124,8 @@ static GtkStockItem gimp_stock_items[] =
|
|||
{ GIMP_STOCK_ROTATE_90, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_ROTATE_180, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_ROTATE_270, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_RESIZE, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_SCALE, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_RESIZE, N_("Resize"), 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_SCALE, N_("Scale"), 0, 0, "gimp14-libgimp" },
|
||||
|
||||
{ GIMP_STOCK_NAVIGATION, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_QMASK_OFF, NULL, 0, 0, "gimp14-libgimp" },
|
||||
|
@ -146,7 +146,7 @@ static GtkStockItem gimp_stock_items[] =
|
|||
{ GIMP_STOCK_TOOL_CLONE, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_COLOR_BALANCE, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_COLOR_PICKER, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_CROP, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_CROP, N_("Crop"), 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_CURVES, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_DODGE, NULL, 0, 0, "gimp14-libgimp" },
|
||||
{ GIMP_STOCK_TOOL_ELLIPSE_SELECT, NULL, 0, 0, "gimp14-libgimp" },
|
||||
|
|
|
@ -475,7 +475,8 @@ gimp_radio_group_new (gboolean in_frame,
|
|||
* a title.
|
||||
* @radio_button_callback: The callback each button's "toggled" signal will
|
||||
* be connected with.
|
||||
* @callback_data: The data which will be passed to g_signal_connect().
|
||||
* @radio_button_callback_data:
|
||||
* The data which will be passed to g_signal_connect().
|
||||
* @initial: The @item_data of the initially pressed radio button.
|
||||
* @...: A #NULL terminated @va_list describing
|
||||
* the radio buttons.
|
||||
|
|
Loading…
Reference in New Issue