2001-11-27 23:44:02 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
#include "core/gimp.h"
|
|
|
|
#include "core/gimpcontext.h"
|
2003-10-12 00:50:35 +08:00
|
|
|
#include "core/gimpdatafactory.h"
|
2001-11-27 23:44:02 +08:00
|
|
|
#include "core/gimpgradient.h"
|
|
|
|
|
2004-09-24 04:41:40 +08:00
|
|
|
#include "widgets/gimpcolordialog.h"
|
2002-03-08 08:27:45 +08:00
|
|
|
#include "widgets/gimpgradienteditor.h"
|
2003-08-24 21:52:51 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2004-12-21 08:01:47 +08:00
|
|
|
#include "widgets/gimpuimanager.h"
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
#include "widgets/gimpviewabledialog.h"
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs/dialogs.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
|
2001-11-27 23:44:02 +08:00
|
|
|
#include "gradient-editor-commands.h"
|
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2004-09-24 04:41:40 +08:00
|
|
|
static void gradient_editor_left_color_update (GimpColorDialog *dialog,
|
|
|
|
const GimpRGB *color,
|
|
|
|
GimpColorDialogState state,
|
|
|
|
GimpGradientEditor *editor);
|
|
|
|
static void gradient_editor_right_color_update (GimpColorDialog *dialog,
|
|
|
|
const GimpRGB *color,
|
|
|
|
GimpColorDialogState state,
|
|
|
|
GimpGradientEditor *editor);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
static GimpGradientSegment *
|
2003-11-06 23:27:05 +08:00
|
|
|
gradient_editor_save_selection (GimpGradientEditor *editor);
|
|
|
|
static void gradient_editor_replace_selection (GimpGradientEditor *editor,
|
2001-11-27 23:44:02 +08:00
|
|
|
GimpGradientSegment *replace_seg);
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
static void gradient_editor_split_uniform_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
GimpGradientEditor *editor);
|
|
|
|
static void gradient_editor_replicate_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
|
|
|
GimpGradientEditor *editor);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functionss */
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_left_color_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2002-03-08 08:27:45 +08:00
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
editor->left_saved_dirty = GIMP_DATA (gradient)->dirty;
|
|
|
|
editor->left_saved_segments = gradient_editor_save_selection (editor);
|
|
|
|
|
2004-09-13 23:15:23 +08:00
|
|
|
editor->color_dialog =
|
2004-09-24 04:41:40 +08:00
|
|
|
gimp_color_dialog_new (GIMP_VIEWABLE (gradient),
|
|
|
|
_("Left Endpoint Color"),
|
|
|
|
GIMP_STOCK_GRADIENT,
|
|
|
|
_("Gradient Segment's Left Endpoint Color"),
|
|
|
|
GTK_WIDGET (editor),
|
|
|
|
global_dialog_factory,
|
|
|
|
"gimp-gradient-editor-color-dialog",
|
|
|
|
&editor->control_sel_l->left_color,
|
|
|
|
editor->instant_update, TRUE);
|
|
|
|
|
|
|
|
g_signal_connect (editor->color_dialog, "destroy",
|
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&editor->color_dialog);
|
|
|
|
|
|
|
|
g_signal_connect (editor->color_dialog, "update",
|
|
|
|
G_CALLBACK (gradient_editor_left_color_update),
|
|
|
|
editor);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2004-09-24 04:41:40 +08:00
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (editor->color_dialog));
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_load_left_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2002-03-08 08:27:45 +08:00
|
|
|
GimpGradient *gradient;
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpContext *context;
|
2001-11-27 23:44:02 +08:00
|
|
|
GimpGradientSegment *seg;
|
|
|
|
GimpRGB color;
|
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
context =
|
|
|
|
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
|
2002-03-08 08:27:45 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
switch (value)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
|
2001-11-27 23:44:02 +08:00
|
|
|
if (editor->control_sel_l->prev != NULL)
|
|
|
|
seg = editor->control_sel_l->prev;
|
|
|
|
else
|
|
|
|
seg = gimp_gradient_segment_get_last (editor->control_sel_l);
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
color = seg->right_color;
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
|
2004-05-31 06:04:16 +08:00
|
|
|
color = editor->control_sel_r->right_color;
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_FOREGROUND:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_context_get_foreground (context, &color);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_BACKGROUND:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_context_get_background (context, &color);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* Load a color */
|
2005-05-06 23:07:34 +08:00
|
|
|
color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&color,
|
|
|
|
&editor->control_sel_r->right_color,
|
|
|
|
TRUE, TRUE);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_save_left_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
|
|
|
|
|
|
|
gimp_gradient_segment_get_left_color (gradient, editor->control_sel_l,
|
|
|
|
&editor->saved_colors[value]);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_right_color_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2002-03-08 08:27:45 +08:00
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
editor->right_saved_dirty = GIMP_DATA (gradient)->dirty;
|
|
|
|
editor->right_saved_segments = gradient_editor_save_selection (editor);
|
|
|
|
|
2004-09-13 23:15:23 +08:00
|
|
|
editor->color_dialog =
|
2004-09-24 04:41:40 +08:00
|
|
|
gimp_color_dialog_new (GIMP_VIEWABLE (gradient),
|
|
|
|
_("Right Endpoint Color"),
|
|
|
|
GIMP_STOCK_GRADIENT,
|
|
|
|
_("Gradient Segment's Right Endpoint Color"),
|
|
|
|
GTK_WIDGET (editor),
|
|
|
|
global_dialog_factory,
|
|
|
|
"gimp-gradient-editor-color-dialog",
|
|
|
|
&editor->control_sel_l->right_color,
|
|
|
|
editor->instant_update, TRUE);
|
|
|
|
|
|
|
|
g_signal_connect (editor->color_dialog, "destroy",
|
|
|
|
G_CALLBACK (gtk_widget_destroyed),
|
|
|
|
&editor->color_dialog);
|
|
|
|
|
|
|
|
g_signal_connect (editor->color_dialog, "update",
|
|
|
|
G_CALLBACK (gradient_editor_right_color_update),
|
|
|
|
editor);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2004-09-24 04:41:40 +08:00
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (editor->color_dialog));
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_load_right_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2002-03-08 08:27:45 +08:00
|
|
|
GimpGradient *gradient;
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpContext *context;
|
2001-11-27 23:44:02 +08:00
|
|
|
GimpGradientSegment *seg;
|
|
|
|
GimpRGB color;
|
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
context =
|
|
|
|
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
|
2002-03-08 08:27:45 +08:00
|
|
|
|
2004-04-29 20:52:29 +08:00
|
|
|
switch (value)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
|
2001-11-27 23:44:02 +08:00
|
|
|
if (editor->control_sel_r->next != NULL)
|
|
|
|
seg = editor->control_sel_r->next;
|
|
|
|
else
|
|
|
|
seg = gimp_gradient_segment_get_first (editor->control_sel_r);
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
color = seg->left_color;
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
|
2004-05-31 06:04:16 +08:00
|
|
|
color = editor->control_sel_l->left_color;
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_FOREGROUND:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_context_get_foreground (context, &color);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2005-05-06 23:07:34 +08:00
|
|
|
case GRADIENT_EDITOR_COLOR_BACKGROUND:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_context_get_background (context, &color);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* Load a color */
|
2005-05-06 23:07:34 +08:00
|
|
|
color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_l->left_color,
|
|
|
|
&color,
|
|
|
|
TRUE, TRUE);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_save_right_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradient *gradient;
|
|
|
|
|
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_get_right_color (gradient, editor->control_sel_r,
|
|
|
|
&editor->saved_colors[value]);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_blending_func_cmd_callback (GtkAction *action,
|
|
|
|
GtkAction *current,
|
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-10-25 04:38:35 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
|
|
|
gint value;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-10-25 04:38:35 +08:00
|
|
|
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-10-25 04:38:35 +08:00
|
|
|
if (gradient && value >= 0)
|
|
|
|
{
|
|
|
|
GimpGradientSegmentType type = value;
|
|
|
|
|
|
|
|
gimp_gradient_segment_range_set_blending_function (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
type);
|
|
|
|
}
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_coloring_type_cmd_callback (GtkAction *action,
|
|
|
|
GtkAction *current,
|
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-10-25 04:38:35 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
|
|
|
gint value;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-10-25 04:38:35 +08:00
|
|
|
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
|
|
|
|
|
|
|
|
if (gradient && value >= 0)
|
|
|
|
{
|
|
|
|
GimpGradientSegmentColor color = value;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-10-25 04:38:35 +08:00
|
|
|
gimp_gradient_segment_range_set_coloring_type (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
color);
|
|
|
|
}
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_flip_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-10-25 04:38:35 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_flip (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_l,
|
|
|
|
&editor->control_sel_r);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_replicate_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2002-03-08 08:27:45 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *scale;
|
|
|
|
GtkObject *scale_data;
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
const gchar *title;
|
|
|
|
const gchar *desc;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
if (editor->control_sel_l == editor->control_sel_r)
|
|
|
|
{
|
|
|
|
title = _("Replicate Segment");
|
|
|
|
desc = _("Replicate Gradient Segment");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
title = _("Replicate Selection");
|
|
|
|
desc = _("Replicate Gradient Selection");
|
|
|
|
}
|
|
|
|
|
2001-11-27 23:44:02 +08:00
|
|
|
dialog =
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
|
2003-11-08 01:29:02 +08:00
|
|
|
title, "gimp-gradient-segment-replicate",
|
2004-03-05 00:10:57 +08:00
|
|
|
GIMP_STOCK_GRADIENT, desc,
|
2003-11-08 23:29:47 +08:00
|
|
|
GTK_WIDGET (editor),
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
gimp_standard_help_func,
|
2003-08-24 21:52:51 +08:00
|
|
|
GIMP_HELP_GRADIENT_EDITOR_REPLICATE,
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
_("Replicate"), GTK_RESPONSE_OK,
|
2001-11-27 23:44:02 +08:00
|
|
|
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
NULL);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2005-02-10 19:00:46 +08:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
G_CALLBACK (gradient_editor_replicate_response),
|
|
|
|
editor);
|
|
|
|
|
2004-05-04 22:21:13 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2001-11-27 23:44:02 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
/* Instructions */
|
2003-01-06 09:01:02 +08:00
|
|
|
if (editor->control_sel_l == editor->control_sel_r)
|
|
|
|
label = gtk_label_new (_("Select the number of times\n"
|
|
|
|
"to replicate the selected segment."));
|
|
|
|
else
|
|
|
|
label = gtk_label_new (_("Select the number of times\n"
|
|
|
|
"to replicate the selection."));
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* Scale */
|
|
|
|
editor->replicate_times = 2;
|
|
|
|
scale_data = gtk_adjustment_new (2.0, 2.0, 21.0, 1.0, 1.0, 1.0);
|
|
|
|
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 4);
|
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (scale_data, "value-changed",
|
2001-11-27 23:44:02 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&editor->replicate_times);
|
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_split_midpoint_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_split_midpoint (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_l,
|
|
|
|
&editor->control_sel_r);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_split_uniformly_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2002-03-08 08:27:45 +08:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *scale;
|
|
|
|
GtkObject *scale_data;
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
const gchar *title;
|
|
|
|
const gchar *desc;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2001-11-27 23:44:02 +08:00
|
|
|
dialog =
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
gimp_viewable_dialog_new (GIMP_VIEWABLE (GIMP_DATA_EDITOR (editor)->data),
|
2003-11-11 01:55:44 +08:00
|
|
|
title, "gimp-gradient-segment-split-uniformly",
|
2004-03-05 00:10:57 +08:00
|
|
|
GIMP_STOCK_GRADIENT, desc,
|
2003-11-08 23:29:47 +08:00
|
|
|
GTK_WIDGET (editor),
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
gimp_standard_help_func,
|
2003-08-24 21:52:51 +08:00
|
|
|
GIMP_HELP_GRADIENT_EDITOR_SPLIT_UNIFORM,
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
_("Split"), GTK_RESPONSE_OK,
|
2001-11-27 23:44:02 +08:00
|
|
|
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
NULL);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2005-07-07 21:39:33 +08:00
|
|
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
-1);
|
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
G_CALLBACK (gradient_editor_split_uniform_response),
|
|
|
|
editor);
|
|
|
|
|
2001-11-27 23:44:02 +08:00
|
|
|
/* The main vbox */
|
2004-05-04 22:21:13 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2001-11-27 23:44:02 +08:00
|
|
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
|
|
|
|
gtk_widget_show (vbox);
|
|
|
|
|
|
|
|
/* Instructions */
|
2003-01-06 09:01:02 +08:00
|
|
|
if (editor->control_sel_l == editor->control_sel_r)
|
|
|
|
label = gtk_label_new (_("Select the number of uniform parts\n"
|
|
|
|
"in which to split the selected segment."));
|
|
|
|
else
|
|
|
|
label = gtk_label_new (_("Select the number of uniform parts\n"
|
|
|
|
"in which to split the segments in the selection."));
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
|
|
|
/* Scale */
|
|
|
|
editor->split_parts = 2;
|
|
|
|
scale_data = gtk_adjustment_new (2.0, 2.0, 21.0, 1.0, 1.0, 1.0);
|
|
|
|
|
|
|
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 4);
|
|
|
|
gtk_widget_show (scale);
|
|
|
|
|
2005-05-28 00:51:39 +08:00
|
|
|
g_signal_connect (scale_data, "value-changed",
|
2001-11-27 23:44:02 +08:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
|
|
|
&editor->split_parts);
|
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
|
|
|
|
|
|
|
gtk_widget_show (dialog);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_delete_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_delete (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_l,
|
|
|
|
&editor->control_sel_r);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_recenter_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_recenter_handles (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_redistribute_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_redistribute_handles (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_blend_color_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_l->left_color,
|
|
|
|
&editor->control_sel_r->right_color,
|
|
|
|
TRUE, FALSE);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
gradient_editor_blend_opacity_cmd_callback (GtkAction *action,
|
2004-04-20 00:00:54 +08:00
|
|
|
gpointer data)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-04-29 20:52:29 +08:00
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
2004-05-31 06:04:16 +08:00
|
|
|
GimpGradient *gradient;
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_l->left_color,
|
|
|
|
&editor->control_sel_r->right_color,
|
|
|
|
FALSE, TRUE);
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
2004-10-25 04:38:35 +08:00
|
|
|
void
|
|
|
|
gradient_editor_zoom_cmd_callback (GtkAction *action,
|
|
|
|
gint value,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
|
|
|
|
|
|
|
|
gimp_gradient_editor_zoom (editor, (GimpZoomType) value);
|
|
|
|
}
|
|
|
|
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2003-01-13 22:08:10 +08:00
|
|
|
/* private functions */
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
static void
|
2004-09-24 04:41:40 +08:00
|
|
|
gradient_editor_left_color_update (GimpColorDialog *dialog,
|
|
|
|
const GimpRGB *color,
|
|
|
|
GimpColorDialogState state,
|
|
|
|
GimpGradientEditor *editor)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-09-24 04:41:40 +08:00
|
|
|
GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
2004-09-24 04:41:40 +08:00
|
|
|
case GIMP_COLOR_DIALOG_UPDATE:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
color,
|
|
|
|
&editor->control_sel_r->right_color,
|
|
|
|
TRUE, TRUE);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2004-09-24 04:41:40 +08:00
|
|
|
case GIMP_COLOR_DIALOG_OK:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
color,
|
|
|
|
&editor->control_sel_r->right_color,
|
|
|
|
TRUE, TRUE);
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
gimp_gradient_segments_free (editor->left_saved_segments);
|
2004-09-24 04:41:40 +08:00
|
|
|
gtk_widget_destroy (editor->color_dialog);
|
2004-09-13 23:15:23 +08:00
|
|
|
editor->color_dialog = NULL;
|
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.
2002-09-01 16:44:57 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2004-09-24 04:41:40 +08:00
|
|
|
case GIMP_COLOR_DIALOG_CANCEL:
|
2001-11-27 23:44:02 +08:00
|
|
|
gradient_editor_replace_selection (editor, editor->left_saved_segments);
|
|
|
|
GIMP_DATA (gradient)->dirty = editor->left_saved_dirty;
|
2003-03-10 22:07:22 +08:00
|
|
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient));
|
2004-09-24 04:41:40 +08:00
|
|
|
gtk_widget_destroy (editor->color_dialog);
|
2004-09-13 23:15:23 +08:00
|
|
|
editor->color_dialog = NULL;
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-09-24 04:41:40 +08:00
|
|
|
gradient_editor_right_color_update (GimpColorDialog *dialog,
|
|
|
|
const GimpRGB *color,
|
|
|
|
GimpColorDialogState state,
|
|
|
|
GimpGradientEditor *editor)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2004-09-24 04:41:40 +08:00
|
|
|
GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
2004-09-24 04:41:40 +08:00
|
|
|
case GIMP_COLOR_DIALOG_UPDATE:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_r->left_color,
|
|
|
|
color,
|
|
|
|
TRUE, TRUE);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2004-09-24 04:41:40 +08:00
|
|
|
case GIMP_COLOR_DIALOG_OK:
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_blend (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
&editor->control_sel_r->left_color,
|
|
|
|
color,
|
|
|
|
TRUE, TRUE);
|
2001-11-27 23:44:02 +08:00
|
|
|
gimp_gradient_segments_free (editor->right_saved_segments);
|
2004-09-24 04:41:40 +08:00
|
|
|
gtk_widget_destroy (editor->color_dialog);
|
2004-09-13 23:15:23 +08:00
|
|
|
editor->color_dialog = NULL;
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
|
2004-09-24 04:41:40 +08:00
|
|
|
case GIMP_COLOR_DIALOG_CANCEL:
|
2001-11-27 23:44:02 +08:00
|
|
|
gradient_editor_replace_selection (editor, editor->right_saved_segments);
|
|
|
|
GIMP_DATA (gradient)->dirty = editor->right_saved_dirty;
|
2003-03-10 22:07:22 +08:00
|
|
|
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (gradient));
|
2004-09-24 04:41:40 +08:00
|
|
|
gtk_widget_destroy (editor->color_dialog);
|
2004-09-13 23:15:23 +08:00
|
|
|
editor->color_dialog = NULL;
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2001-11-27 23:44:02 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpGradientSegment *
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient_editor_save_selection (GimpGradientEditor *editor)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
|
|
|
GimpGradientSegment *seg, *prev, *tmp;
|
|
|
|
GimpGradientSegment *oseg, *oaseg;
|
|
|
|
|
|
|
|
prev = NULL;
|
|
|
|
oseg = editor->control_sel_l;
|
|
|
|
tmp = NULL;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
seg = gimp_gradient_segment_new ();
|
|
|
|
|
|
|
|
*seg = *oseg; /* Copy everything */
|
|
|
|
|
|
|
|
if (prev == NULL)
|
|
|
|
tmp = seg; /* Remember first segment */
|
|
|
|
else
|
|
|
|
prev->next = seg;
|
|
|
|
|
|
|
|
seg->prev = prev;
|
|
|
|
seg->next = NULL;
|
|
|
|
|
|
|
|
prev = seg;
|
|
|
|
oaseg = oseg;
|
|
|
|
oseg = oseg->next;
|
|
|
|
}
|
|
|
|
while (oaseg != editor->control_sel_r);
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-25 20:42:23 +08:00
|
|
|
gradient_editor_replace_selection (GimpGradientEditor *editor,
|
2001-11-27 23:44:02 +08:00
|
|
|
GimpGradientSegment *replace_seg)
|
|
|
|
{
|
|
|
|
GimpGradient *gradient;
|
|
|
|
GimpGradientSegment *lseg, *rseg;
|
|
|
|
GimpGradientSegment *replace_last;
|
|
|
|
|
2002-03-08 08:27:45 +08:00
|
|
|
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
|
|
|
/* Remember left and right segments */
|
|
|
|
|
|
|
|
lseg = editor->control_sel_l->prev;
|
|
|
|
rseg = editor->control_sel_r->next;
|
|
|
|
|
|
|
|
replace_last = gimp_gradient_segment_get_last (replace_seg);
|
|
|
|
|
|
|
|
/* Free old selection */
|
|
|
|
|
|
|
|
editor->control_sel_r->next = NULL;
|
|
|
|
|
|
|
|
gimp_gradient_segments_free (editor->control_sel_l);
|
|
|
|
|
|
|
|
/* Link in new segments */
|
|
|
|
|
|
|
|
if (lseg)
|
|
|
|
lseg->next = replace_seg;
|
|
|
|
else
|
|
|
|
gradient->segments = replace_seg;
|
|
|
|
|
|
|
|
replace_seg->prev = lseg;
|
|
|
|
|
|
|
|
if (rseg)
|
|
|
|
rseg->prev = replace_last;
|
|
|
|
|
|
|
|
replace_last->next = rseg;
|
|
|
|
|
|
|
|
editor->control_sel_l = replace_seg;
|
|
|
|
editor->control_sel_r = replace_last;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-06 23:27:05 +08:00
|
|
|
gradient_editor_split_uniform_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
2002-03-08 08:27:45 +08:00
|
|
|
GimpGradientEditor *editor)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_widget_destroy (widget);
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
|
|
|
{
|
2004-10-25 20:42:23 +08:00
|
|
|
GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_split_uniform (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
editor->split_parts,
|
|
|
|
&editor->control_sel_l,
|
|
|
|
&editor->control_sel_r);
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-06 23:27:05 +08:00
|
|
|
gradient_editor_replicate_response (GtkWidget *widget,
|
|
|
|
gint response_id,
|
2002-03-08 08:27:45 +08:00
|
|
|
GimpGradientEditor *editor)
|
2001-11-27 23:44:02 +08:00
|
|
|
{
|
2003-11-06 23:27:05 +08:00
|
|
|
gtk_widget_destroy (widget);
|
2002-03-08 08:27:45 +08:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
2004-12-21 08:01:47 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
|
|
|
|
GIMP_EDITOR (editor)->popup_data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2003-11-06 23:27:05 +08:00
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
|
|
|
{
|
2004-10-25 20:42:23 +08:00
|
|
|
GimpGradient *gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
|
2001-11-27 23:44:02 +08:00
|
|
|
|
2004-05-31 06:04:16 +08:00
|
|
|
gimp_gradient_segment_range_replicate (gradient,
|
|
|
|
editor->control_sel_l,
|
|
|
|
editor->control_sel_r,
|
|
|
|
editor->replicate_times,
|
|
|
|
&editor->control_sel_l,
|
|
|
|
&editor->control_sel_r);
|
2003-11-06 23:27:05 +08:00
|
|
|
}
|
2001-11-27 23:44:02 +08:00
|
|
|
}
|