mirror of https://github.com/GNOME/gimp.git
added enum for the "load_color" actions.
2005-05-06 Michael Natterer <mitch@gimp.org> * app/actions/gradient-editor-commands.h: added enum for the "load_color" actions. * app/actions/gradient-editor-actions.c * app/actions/gradient-editor-commands.c: use the new enum instead of magic values, cleanup. * app/actions/palette-editor-commands.c: cleanup. * app/widgets/gimpbrusheditor.c * app/widgets/gimpdataeditor.c: cleanup. * app/widgets/gimpgradienteditor.c: added GtkObject::destroy() and GtkWidget::unmap() implementations which destroy the color dialog. Destroy color dialogs by cancelling them via gtk_dialog_response(), so temporarily changed colors are restored correctly. Refactored my last commit below a bit. Various cleanups. * app/widgets/gimppaletteeditor.[ch]: no need to remember the buttons in the GimpPaletteEditor struct.
This commit is contained in:
parent
f3c0a28de8
commit
b4f942055a
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
2005-05-06 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/actions/gradient-editor-commands.h: added enum for the
|
||||
"load_color" actions.
|
||||
|
||||
* app/actions/gradient-editor-actions.c
|
||||
* app/actions/gradient-editor-commands.c: use the new enum instead
|
||||
of magic values, cleanup.
|
||||
|
||||
* app/actions/palette-editor-commands.c: cleanup.
|
||||
|
||||
* app/widgets/gimpbrusheditor.c
|
||||
* app/widgets/gimpdataeditor.c: cleanup.
|
||||
|
||||
* app/widgets/gimpgradienteditor.c: added GtkObject::destroy() and
|
||||
GtkWidget::unmap() implementations which destroy the color dialog.
|
||||
Destroy color dialogs by cancelling them via gtk_dialog_response(),
|
||||
so temporarily changed colors are restored correctly. Refactored
|
||||
my last commit below a bit. Various cleanups.
|
||||
|
||||
* app/widgets/gimppaletteeditor.[ch]: no need to remember the
|
||||
buttons in the GimpPaletteEditor struct.
|
||||
|
||||
2005-05-06 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-scale.c
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "core/gimpgradient.h"
|
||||
|
||||
#include "widgets/gimpactiongroup.h"
|
||||
#include "widgets/gimpdataeditor.h"
|
||||
#include "widgets/gimpgradienteditor.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
|
@ -141,34 +140,34 @@ static GimpEnumActionEntry gradient_editor_load_left_actions[] =
|
|||
{
|
||||
{ "gradient-editor-load-left-left-neighbor", NULL,
|
||||
N_("_Left Neighbor's Right Endpoint"), NULL, NULL,
|
||||
0, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD },
|
||||
|
||||
{ "gradient-editor-load-left-right-endpoint", NULL,
|
||||
N_("_Right Endpoint"), NULL, NULL,
|
||||
1, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD },
|
||||
|
||||
{ "gradient-editor-load-left-fg", NULL,
|
||||
N_("_FG Color"), NULL, NULL,
|
||||
2, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_FOREGROUND, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD },
|
||||
|
||||
{ "gradient-editor-load-left-bg", NULL,
|
||||
N_("_BG Color"), NULL, NULL,
|
||||
3, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_BACKGROUND, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_LEFT_LOAD },
|
||||
|
||||
LOAD_LEFT_FROM ("01", 4),
|
||||
LOAD_LEFT_FROM ("02", 5),
|
||||
LOAD_LEFT_FROM ("03", 6),
|
||||
LOAD_LEFT_FROM ("04", 7),
|
||||
LOAD_LEFT_FROM ("05", 8),
|
||||
LOAD_LEFT_FROM ("06", 9),
|
||||
LOAD_LEFT_FROM ("07", 10),
|
||||
LOAD_LEFT_FROM ("08", 11),
|
||||
LOAD_LEFT_FROM ("09", 12),
|
||||
LOAD_LEFT_FROM ("10", 13)
|
||||
LOAD_LEFT_FROM ("01", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 0),
|
||||
LOAD_LEFT_FROM ("02", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 1),
|
||||
LOAD_LEFT_FROM ("03", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 2),
|
||||
LOAD_LEFT_FROM ("04", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 3),
|
||||
LOAD_LEFT_FROM ("05", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 4),
|
||||
LOAD_LEFT_FROM ("06", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 5),
|
||||
LOAD_LEFT_FROM ("07", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 6),
|
||||
LOAD_LEFT_FROM ("08", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 7),
|
||||
LOAD_LEFT_FROM ("09", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 8),
|
||||
LOAD_LEFT_FROM ("10", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 9)
|
||||
};
|
||||
|
||||
static GimpEnumActionEntry gradient_editor_save_left_actions[] =
|
||||
|
@ -189,34 +188,34 @@ static GimpEnumActionEntry gradient_editor_load_right_actions[] =
|
|||
{
|
||||
{ "gradient-editor-load-right-right-neighbor", NULL,
|
||||
N_("_Right Neighbor's Left Endpoint"), NULL, NULL,
|
||||
0, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD },
|
||||
|
||||
{ "gradient-editor-load-right-left-endpoint", NULL,
|
||||
N_("_Left Endpoint"), NULL, NULL,
|
||||
1, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD },
|
||||
|
||||
{ "gradient-editor-load-right-fg", NULL,
|
||||
N_("_FG Color"), NULL, NULL,
|
||||
2, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_FOREGROUND, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD },
|
||||
|
||||
{ "gradient-editor-load-right-bg", NULL,
|
||||
N_("_BG Color"), NULL, NULL,
|
||||
3, FALSE,
|
||||
GRADIENT_EDITOR_COLOR_BACKGROUND, FALSE,
|
||||
GIMP_HELP_GRADIENT_EDITOR_RIGHT_LOAD },
|
||||
|
||||
LOAD_RIGHT_FROM ("01", 4),
|
||||
LOAD_RIGHT_FROM ("02", 5),
|
||||
LOAD_RIGHT_FROM ("03", 6),
|
||||
LOAD_RIGHT_FROM ("04", 7),
|
||||
LOAD_RIGHT_FROM ("05", 8),
|
||||
LOAD_RIGHT_FROM ("06", 9),
|
||||
LOAD_RIGHT_FROM ("07", 10),
|
||||
LOAD_RIGHT_FROM ("08", 11),
|
||||
LOAD_RIGHT_FROM ("09", 12),
|
||||
LOAD_RIGHT_FROM ("10", 13)
|
||||
LOAD_RIGHT_FROM ("01", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 0),
|
||||
LOAD_RIGHT_FROM ("02", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 1),
|
||||
LOAD_RIGHT_FROM ("03", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 2),
|
||||
LOAD_RIGHT_FROM ("04", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 3),
|
||||
LOAD_RIGHT_FROM ("05", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 4),
|
||||
LOAD_RIGHT_FROM ("06", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 5),
|
||||
LOAD_RIGHT_FROM ("07", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 6),
|
||||
LOAD_RIGHT_FROM ("08", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 7),
|
||||
LOAD_RIGHT_FROM ("09", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 8),
|
||||
LOAD_RIGHT_FROM ("10", GRADIENT_EDITOR_COLOR_FIRST_CUSTOM + 9)
|
||||
};
|
||||
|
||||
static GimpEnumActionEntry gradient_editor_save_right_actions[] =
|
||||
|
|
|
@ -124,7 +124,7 @@ gradient_editor_load_left_cmd_callback (GtkAction *action,
|
|||
|
||||
switch (value)
|
||||
{
|
||||
case 0: /* Fetch from left neighbor's right endpoint */
|
||||
case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
|
||||
if (editor->control_sel_l->prev != NULL)
|
||||
seg = editor->control_sel_l->prev;
|
||||
else
|
||||
|
@ -133,20 +133,20 @@ gradient_editor_load_left_cmd_callback (GtkAction *action,
|
|||
color = seg->right_color;
|
||||
break;
|
||||
|
||||
case 1: /* Fetch from right endpoint */
|
||||
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
|
||||
color = editor->control_sel_r->right_color;
|
||||
break;
|
||||
|
||||
case 2: /* Fetch from FG color */
|
||||
case GRADIENT_EDITOR_COLOR_FOREGROUND:
|
||||
gimp_context_get_foreground (context, &color);
|
||||
break;
|
||||
|
||||
case 3: /* Fetch from BG color */
|
||||
case GRADIENT_EDITOR_COLOR_BACKGROUND:
|
||||
gimp_context_get_background (context, &color);
|
||||
break;
|
||||
|
||||
default: /* Load a color */
|
||||
color = editor->saved_colors[value - 4];
|
||||
color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ gradient_editor_load_right_cmd_callback (GtkAction *action,
|
|||
|
||||
switch (value)
|
||||
{
|
||||
case 0: /* Fetch from right neighbor's left endpoint */
|
||||
case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
|
||||
if (editor->control_sel_r->next != NULL)
|
||||
seg = editor->control_sel_r->next;
|
||||
else
|
||||
|
@ -237,20 +237,20 @@ gradient_editor_load_right_cmd_callback (GtkAction *action,
|
|||
color = seg->left_color;
|
||||
break;
|
||||
|
||||
case 1: /* Fetch from left endpoint */
|
||||
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
|
||||
color = editor->control_sel_l->left_color;
|
||||
break;
|
||||
|
||||
case 2: /* Fetch from FG color */
|
||||
case GRADIENT_EDITOR_COLOR_FOREGROUND:
|
||||
gimp_context_get_foreground (context, &color);
|
||||
break;
|
||||
|
||||
case 3: /* Fetch from BG color */
|
||||
case GRADIENT_EDITOR_COLOR_BACKGROUND:
|
||||
gimp_context_get_background (context, &color);
|
||||
break;
|
||||
|
||||
default: /* Load a color */
|
||||
color = editor->saved_colors[value - 4];
|
||||
color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,16 @@
|
|||
#define __GRADIENT_EDITOR_COMMANDS_H__
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT,
|
||||
GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT,
|
||||
GRADIENT_EDITOR_COLOR_FOREGROUND,
|
||||
GRADIENT_EDITOR_COLOR_BACKGROUND,
|
||||
GRADIENT_EDITOR_COLOR_FIRST_CUSTOM
|
||||
};
|
||||
|
||||
|
||||
void gradient_editor_left_color_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void gradient_editor_load_left_cmd_callback (GtkAction *action,
|
||||
|
|
|
@ -56,7 +56,7 @@ palette_editor_edit_color_cmd_callback (GtkAction *action,
|
|||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
|
||||
GimpPalette *palette;
|
||||
|
||||
if (! (data_editor->data && data_editor->data_editable && editor->color))
|
||||
if (! (data_editor->data_editable && editor->color))
|
||||
return;
|
||||
|
||||
palette = GIMP_PALETTE (data_editor->data);
|
||||
|
@ -71,7 +71,7 @@ palette_editor_edit_color_cmd_callback (GtkAction *action,
|
|||
GTK_WIDGET (editor),
|
||||
gimp_dialog_factory_from_name ("toplevel"),
|
||||
"gimp-palette-editor-color-dialog",
|
||||
(const GimpRGB *) &editor->color->color,
|
||||
&editor->color->color,
|
||||
FALSE, FALSE);
|
||||
|
||||
g_signal_connect (editor->color_dialog, "destroy",
|
||||
|
@ -101,7 +101,7 @@ palette_editor_new_color_cmd_callback (GtkAction *action,
|
|||
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
|
||||
|
||||
if (data_editor->data && data_editor->data_editable)
|
||||
if (data_editor->data_editable)
|
||||
{
|
||||
GimpPalette *palette = GIMP_PALETTE (data_editor->data);
|
||||
GimpContext *context;
|
||||
|
@ -125,7 +125,7 @@ palette_editor_delete_color_cmd_callback (GtkAction *action,
|
|||
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
|
||||
|
||||
if (data_editor->data && data_editor->data_editable && editor->color)
|
||||
if (data_editor->data_editable && editor->color)
|
||||
{
|
||||
GimpPalette *palette = GIMP_PALETTE (data_editor->data);
|
||||
|
||||
|
|
|
@ -232,16 +232,14 @@ static void
|
|||
gimp_brush_editor_set_data (GimpDataEditor *editor,
|
||||
GimpData *data)
|
||||
{
|
||||
GimpBrushEditor *brush_editor;
|
||||
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
|
||||
gdouble radius = 0.0;
|
||||
gint spikes = 2;
|
||||
gdouble hardness = 0.0;
|
||||
gdouble ratio = 0.0;
|
||||
gdouble angle = 0.0;
|
||||
gdouble spacing = 0.0;
|
||||
|
||||
brush_editor = GIMP_BRUSH_EDITOR (editor);
|
||||
GimpBrushEditor *brush_editor = GIMP_BRUSH_EDITOR (editor);
|
||||
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
|
||||
gdouble radius = 0.0;
|
||||
gint spikes = 2;
|
||||
gdouble hardness = 0.0;
|
||||
gdouble ratio = 0.0;
|
||||
gdouble angle = 0.0;
|
||||
gdouble spacing = 0.0;
|
||||
|
||||
if (editor->data)
|
||||
g_signal_handlers_disconnect_by_func (editor->data,
|
||||
|
@ -363,7 +361,6 @@ static void
|
|||
gimp_brush_editor_update_brush_shape (GtkWidget *widget,
|
||||
GimpBrushEditor *editor)
|
||||
{
|
||||
GimpBrushGeneratedShape shape;
|
||||
GimpBrushGenerated *brush;
|
||||
|
||||
if (! GIMP_IS_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data))
|
||||
|
@ -371,12 +368,16 @@ gimp_brush_editor_update_brush_shape (GtkWidget *widget,
|
|||
|
||||
brush = GIMP_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data);
|
||||
|
||||
shape = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"gimp-item-data"));
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||
{
|
||||
GimpBrushGeneratedShape shape;
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) &&
|
||||
gimp_brush_generated_get_shape (brush) != shape)
|
||||
gimp_brush_generated_set_shape (brush, shape);
|
||||
shape = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"gimp-item-data"));
|
||||
|
||||
if (gimp_brush_generated_get_shape (brush) != shape)
|
||||
gimp_brush_generated_set_shape (brush, shape);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdata.h"
|
||||
#include "core/gimpdatafactory.h"
|
||||
|
||||
|
|
|
@ -110,6 +110,8 @@ static GObject * gimp_gradient_editor_constructor (GType type,
|
|||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
|
||||
static void gimp_gradient_editor_destroy (GtkObject *object);
|
||||
static void gimp_gradient_editor_unmap (GtkWidget *widget);
|
||||
static void gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
||||
GimpData *data);
|
||||
|
||||
|
@ -210,12 +212,12 @@ static void control_draw_normal_handle (GimpGradientEditor *editor,
|
|||
GdkPixmap *pixmap,
|
||||
gdouble pos,
|
||||
gint height,
|
||||
GtkStateType state);
|
||||
gboolean selected);
|
||||
static void control_draw_middle_handle (GimpGradientEditor *editor,
|
||||
GdkPixmap *pixmap,
|
||||
gdouble pos,
|
||||
gint height,
|
||||
GtkStateType state);
|
||||
gboolean selected);
|
||||
static void control_draw_handle (GdkPixmap *pixmap,
|
||||
GdkGC *border_gc,
|
||||
GdkGC *fill_gc,
|
||||
|
@ -275,13 +277,19 @@ gimp_gradient_editor_get_type (void)
|
|||
static void
|
||||
gimp_gradient_editor_class_init (GimpGradientEditorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->constructor = gimp_gradient_editor_constructor;
|
||||
|
||||
gtk_object_class->destroy = gimp_gradient_editor_destroy;
|
||||
|
||||
widget_class->unmap = gimp_gradient_editor_unmap;
|
||||
|
||||
editor_class->set_data = gimp_gradient_editor_set_data;
|
||||
editor_class->title = _("Gradient Editor");
|
||||
}
|
||||
|
@ -450,6 +458,30 @@ gimp_gradient_editor_constructor (GType type,
|
|||
return object;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_gradient_editor_destroy (GtkObject *object)
|
||||
{
|
||||
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (object);
|
||||
|
||||
if (editor->color_dialog)
|
||||
gtk_dialog_response (GTK_DIALOG (editor->color_dialog),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_gradient_editor_unmap (GtkWidget *widget)
|
||||
{
|
||||
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (widget);
|
||||
|
||||
if (editor->color_dialog)
|
||||
gtk_dialog_response (GTK_DIALOG (editor->color_dialog),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
||||
GimpData *data)
|
||||
|
@ -457,6 +489,10 @@ gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
|||
GimpGradientEditor *gradient_editor = GIMP_GRADIENT_EDITOR (editor);
|
||||
GimpData *old_data;
|
||||
|
||||
if (gradient_editor->color_dialog)
|
||||
gtk_dialog_response (GTK_DIALOG (gradient_editor->color_dialog),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
|
||||
old_data = gimp_data_editor_get_data (editor);
|
||||
|
||||
if (old_data)
|
||||
|
@ -464,7 +500,6 @@ gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
|||
gimp_gradient_editor_gradient_dirty,
|
||||
gradient_editor);
|
||||
|
||||
|
||||
GIMP_DATA_EDITOR_CLASS (parent_class)->set_data (editor, data);
|
||||
|
||||
if (data)
|
||||
|
@ -475,13 +510,6 @@ gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
|||
gimp_view_set_viewable (GIMP_VIEW (gradient_editor->preview),
|
||||
GIMP_VIEWABLE (data));
|
||||
|
||||
if (gradient_editor->color_dialog)
|
||||
{
|
||||
gtk_widget_destroy (gradient_editor->color_dialog);
|
||||
gradient_editor->color_dialog = NULL;
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (gradient_editor->control, editor->data_editable);
|
||||
|
||||
control_update (gradient_editor, GIMP_GRADIENT (data), TRUE);
|
||||
|
@ -1721,7 +1749,7 @@ control_draw (GimpGradientEditor *editor,
|
|||
gdouble g_pos;
|
||||
GimpGradientSegment *seg;
|
||||
GradientEditorDragMode handle;
|
||||
GtkStateType handle_state;
|
||||
gboolean selected;
|
||||
|
||||
/* Clear the pixmap */
|
||||
|
||||
|
@ -1742,25 +1770,25 @@ control_draw (GimpGradientEditor *editor,
|
|||
|
||||
/* Draw handles */
|
||||
|
||||
handle_state = GTK_STATE_NORMAL;
|
||||
selected = FALSE;
|
||||
|
||||
for (seg = gradient->segments; seg; seg = seg->next)
|
||||
{
|
||||
if (seg == editor->control_sel_l)
|
||||
handle_state = GTK_STATE_SELECTED;
|
||||
selected = TRUE;
|
||||
|
||||
control_draw_normal_handle (editor, pixmap, seg->left, height,
|
||||
handle_state);
|
||||
selected);
|
||||
control_draw_middle_handle (editor, pixmap, seg->middle, height,
|
||||
handle_state);
|
||||
selected);
|
||||
|
||||
/* Draw right handle only if this is the last segment */
|
||||
if (seg->next == NULL)
|
||||
control_draw_normal_handle (editor, pixmap, seg->right, height,
|
||||
handle_state);
|
||||
selected);
|
||||
|
||||
if (seg == editor->control_sel_r)
|
||||
handle_state = GTK_STATE_NORMAL;
|
||||
selected = FALSE;
|
||||
}
|
||||
|
||||
/* Draw the handle which is closest to the mouse position */
|
||||
|
@ -1769,11 +1797,9 @@ control_draw (GimpGradientEditor *editor,
|
|||
|
||||
seg_get_closest_handle (gradient, CLAMP (g_pos, 0.0, 1.0), &seg, &handle);
|
||||
|
||||
handle_state = GTK_STATE_NORMAL;
|
||||
|
||||
if (seg && seg_in_selection (gradient, seg,
|
||||
editor->control_sel_l, editor->control_sel_r))
|
||||
handle_state = GTK_STATE_SELECTED;
|
||||
selected = (seg &&
|
||||
seg_in_selection (gradient, seg,
|
||||
editor->control_sel_l, editor->control_sel_r));
|
||||
|
||||
switch (handle)
|
||||
{
|
||||
|
@ -1781,24 +1807,23 @@ control_draw (GimpGradientEditor *editor,
|
|||
if (seg)
|
||||
{
|
||||
control_draw_normal_handle (editor, pixmap, seg->left, height,
|
||||
handle_state);
|
||||
selected);
|
||||
}
|
||||
else
|
||||
{
|
||||
seg = gimp_gradient_segment_get_last (gradient->segments);
|
||||
|
||||
if (seg == editor->control_sel_r)
|
||||
handle_state = GTK_STATE_SELECTED;
|
||||
selected = (seg == editor->control_sel_r);
|
||||
|
||||
control_draw_normal_handle (editor, pixmap, seg->right, height,
|
||||
handle_state);
|
||||
selected);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GRAD_DRAG_MIDDLE:
|
||||
control_draw_middle_handle (editor, pixmap, seg->middle, height,
|
||||
handle_state);
|
||||
selected);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1811,8 +1836,10 @@ control_draw_normal_handle (GimpGradientEditor *editor,
|
|||
GdkPixmap *pixmap,
|
||||
gdouble pos,
|
||||
gint height,
|
||||
GtkStateType state)
|
||||
gboolean selected)
|
||||
{
|
||||
GtkStateType state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
|
||||
|
||||
control_draw_handle (pixmap,
|
||||
editor->control->style->text_aa_gc[state],
|
||||
editor->control->style->black_gc,
|
||||
|
@ -1824,8 +1851,10 @@ control_draw_middle_handle (GimpGradientEditor *editor,
|
|||
GdkPixmap *pixmap,
|
||||
gdouble pos,
|
||||
gint height,
|
||||
GtkStateType state)
|
||||
gboolean selected)
|
||||
{
|
||||
GtkStateType state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
|
||||
|
||||
control_draw_handle (pixmap,
|
||||
editor->control->style->text_aa_gc[state],
|
||||
editor->control->style->white_gc,
|
||||
|
|
|
@ -309,32 +309,26 @@ gimp_palette_editor_constructor (GType type,
|
|||
|
||||
editor = GIMP_PALETTE_EDITOR (object);
|
||||
|
||||
editor->edit_button =
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-edit-color", NULL);
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-edit-color", NULL);
|
||||
|
||||
editor->new_button =
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-new-color-fg",
|
||||
"palette-editor-new-color-bg",
|
||||
GDK_CONTROL_MASK,
|
||||
NULL);
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-new-color-fg",
|
||||
"palette-editor-new-color-bg",
|
||||
GDK_CONTROL_MASK,
|
||||
NULL);
|
||||
|
||||
editor->delete_button =
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-delete-color", NULL);
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-delete-color", NULL);
|
||||
|
||||
editor->zoom_out_button =
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-zoom-out", NULL);
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-zoom-out", NULL);
|
||||
|
||||
editor->zoom_in_button =
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-zoom-in", NULL);
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-zoom-in", NULL);
|
||||
|
||||
editor->zoom_all_button =
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-zoom-all", NULL);
|
||||
gimp_editor_add_action_button (GIMP_EDITOR (editor), "palette-editor",
|
||||
"palette-editor-zoom-all", NULL);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -43,13 +43,6 @@ struct _GimpPaletteEditor
|
|||
GtkWidget *color_name;
|
||||
GtkAdjustment *columns_data;
|
||||
|
||||
GtkWidget *edit_button;
|
||||
GtkWidget *new_button;
|
||||
GtkWidget *delete_button;
|
||||
GtkWidget *zoom_out_button;
|
||||
GtkWidget *zoom_in_button;
|
||||
GtkWidget *zoom_all_button;
|
||||
|
||||
GtkWidget *color_dialog;
|
||||
|
||||
GimpPaletteEntry *color;
|
||||
|
|
Loading…
Reference in New Issue