mirror of https://github.com/GNOME/gimp.git
Cleaned up all places which pick colors to work consistently: the concept
2003-09-26 Michael Natterer <mitch@gimp.org> Cleaned up all places which pick colors to work consistently: the concept of an "active color" has disappeared, instead <ctrl> picks the BG color all over the place (fixes bug #122931). * app/tools/tools-enums.[ch]: added enum GimpColorPickMode which can be one of { FOREGROUND, BACKGROUND }. Reordered enums so non-registered ones are at the end of the file. Removed trailing whitespace. * app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode" property and a GUI for it. Renamed the "update-active" property to "update-toolbox". * app/tools/gimpcolorpickertool.c: honor the new option. Toggle pick-mode on <ctrl>. * app/tools/gimpcolortool.[ch]: added pick_mode member and change the cursor accordingly. * app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType state" to the "selected" signal. Removed the signal's default implementation. * app/gui/dialogs-constructors.c: fixed the signal handler which lives here and set BG if <ctrl> was pressed. * app/widgets/gimppaletteeditor.c: removed weird <ctrl> <-> active_color interaction and pick BG on <ctrl>. Don't change the toolbox color when editing a color in the palette. * app/widgets/gimptoolbox-color-area.[ch]: made the whole active_color stuff private. Will remove these artefacts soon... * app/gui/colormap-editor-menu.c * app/gui/palette-editor-menu.c: added separate menu entries for adding a color from the current FG and BG. * app/gui/colormap-editor-commands.c * app/gui/palette-editor-commands.[ch]: changed callbacks accordingly. * cursors/background.xbm * cursors/background_mask.xbm * cursors/foreground.xbm * cursors/foreground_mask.xbm * cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers closer to the upper right corner. * app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots since they are not relevant and I didn't save the hotspot in the updated cursor files for that reason.
This commit is contained in:
parent
a1d495b99c
commit
e13afaf260
54
ChangeLog
54
ChangeLog
|
@ -1,3 +1,57 @@
|
|||
2003-09-26 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Cleaned up all places which pick colors to work consistently: the
|
||||
concept of an "active color" has disappeared, instead <ctrl> picks
|
||||
the BG color all over the place (fixes bug #122931).
|
||||
|
||||
* app/tools/tools-enums.[ch]: added enum GimpColorPickMode which
|
||||
can be one of { FOREGROUND, BACKGROUND }. Reordered enums so
|
||||
non-registered ones are at the end of the file. Removed trailing
|
||||
whitespace.
|
||||
|
||||
* app/tools/gimpcolorpickeroptions.[ch]: added a "pick-mode"
|
||||
property and a GUI for it. Renamed the "update-active" property to
|
||||
"update-toolbox".
|
||||
|
||||
* app/tools/gimpcolorpickertool.c: honor the new option. Toggle
|
||||
pick-mode on <ctrl>.
|
||||
|
||||
* app/tools/gimpcolortool.[ch]: added pick_mode member and change
|
||||
the cursor accordingly.
|
||||
|
||||
* app/widgets/gimpcolormapeditor.[ch]: added "GdkModifierType
|
||||
state" to the "selected" signal. Removed the signal's default
|
||||
implementation.
|
||||
|
||||
* app/gui/dialogs-constructors.c: fixed the signal handler which
|
||||
lives here and set BG if <ctrl> was pressed.
|
||||
|
||||
* app/widgets/gimppaletteeditor.c: removed weird <ctrl> <->
|
||||
active_color interaction and pick BG on <ctrl>. Don't change the
|
||||
toolbox color when editing a color in the palette.
|
||||
|
||||
* app/widgets/gimptoolbox-color-area.[ch]: made the whole
|
||||
active_color stuff private. Will remove these artefacts soon...
|
||||
|
||||
* app/gui/colormap-editor-menu.c
|
||||
* app/gui/palette-editor-menu.c: added separate menu entries
|
||||
for adding a color from the current FG and BG.
|
||||
|
||||
* app/gui/colormap-editor-commands.c
|
||||
* app/gui/palette-editor-commands.[ch]: changed callbacks
|
||||
accordingly.
|
||||
|
||||
* cursors/background.xbm
|
||||
* cursors/background_mask.xbm
|
||||
* cursors/foreground.xbm
|
||||
* cursors/foreground_mask.xbm
|
||||
* cursors/gimp-tool-cursors.xcf: moved the FG/BG cursor modifiers
|
||||
closer to the upper right corner.
|
||||
|
||||
* app/widgets/gimpcursor.c: ignore the cursor modifiers' hotspots
|
||||
since they are not relevant and I didn't save the hotspot in the
|
||||
updated cursor files for that reason.
|
||||
|
||||
2003-09-26 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/core/gimpscanconvert.[ch]: Add some parameters to
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimpcolormapeditor.h"
|
||||
|
@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
|
|||
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->add_button))
|
||||
gtk_button_clicked (GTK_BUTTON (editor->add_button));
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
|
||||
action ? GDK_CONTROL_MASK : 0);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimpcolormapeditor.h"
|
||||
|
@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
|
|||
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->add_button))
|
||||
gtk_button_clicked (GTK_BUTTON (editor->add_button));
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
|
||||
action ? GDK_CONTROL_MASK : 0);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimppaletteeditor.h"
|
||||
|
@ -29,17 +31,6 @@
|
|||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
|
||||
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
|
||||
}
|
||||
|
||||
void
|
||||
palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
@ -51,6 +42,18 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
|
||||
}
|
||||
|
||||
void
|
||||
palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->new_button))
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button),
|
||||
action ? GDK_CONTROL_MASK : 0);
|
||||
}
|
||||
|
||||
void
|
||||
palette_editor_delete_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#define __PALETTE_EDITOR_COMMANDS_H__
|
||||
|
||||
|
||||
void palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
||||
void palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-colormap.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
|
@ -65,7 +66,6 @@
|
|||
#include "widgets/gimpselectioneditor.h"
|
||||
#include "widgets/gimptemplateview.h"
|
||||
#include "widgets/gimptoolbox.h"
|
||||
#include "widgets/gimptoolbox-color-area.h"
|
||||
#include "widgets/gimpundoeditor.h"
|
||||
#include "widgets/gimpvectorstreeview.h"
|
||||
|
||||
|
@ -94,6 +94,7 @@
|
|||
/* local function prototypes */
|
||||
|
||||
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
||||
GdkModifierType state,
|
||||
GimpDockable *dockable);
|
||||
|
||||
static GtkWidget * dialogs_viewable_preview_func (GimpDockable *dockable,
|
||||
|
@ -1103,32 +1104,26 @@ dialogs_edit_palette_func (GimpData *data)
|
|||
|
||||
static void
|
||||
dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
||||
GdkModifierType state,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpImage *gimage;
|
||||
|
||||
context = (GimpContext *) g_object_get_data (G_OBJECT (editor),
|
||||
"gimp-dialogs-context");
|
||||
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
|
||||
|
||||
if (context)
|
||||
if (gimage)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpRGB color;
|
||||
gint index;
|
||||
GimpRGB color;
|
||||
gint index;
|
||||
|
||||
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
|
||||
index = gimp_colormap_editor_col_index (editor);
|
||||
index = gimp_colormap_editor_col_index (editor);
|
||||
|
||||
gimp_rgba_set_uchar (&color,
|
||||
gimage->cmap[index * 3],
|
||||
gimage->cmap[index * 3 + 1],
|
||||
gimage->cmap[index * 3 + 2],
|
||||
255);
|
||||
gimp_image_get_colormap_entry (gimage, index, &color);
|
||||
|
||||
if (active_color == FOREGROUND)
|
||||
gimp_context_set_foreground (context, &color);
|
||||
else if (active_color == BACKGROUND)
|
||||
gimp_context_set_background (context, &color);
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
gimp_context_set_background (dockable->context, &color);
|
||||
else
|
||||
gimp_context_set_foreground (dockable->context, &color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimpcolormapeditor.h"
|
||||
|
@ -48,5 +50,6 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
|
|||
GimpColormapEditor *editor = GIMP_COLORMAP_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->add_button))
|
||||
gtk_button_clicked (GTK_BUTTON (editor->add_button));
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (editor->add_button),
|
||||
action ? GDK_CONTROL_MASK : 0);
|
||||
}
|
||||
|
|
|
@ -43,10 +43,15 @@ GimpItemFactoryEntry colormap_editor_menu_entries[] =
|
|||
"<StockItem>", GIMP_STOCK_EDIT },
|
||||
NULL,
|
||||
GIMP_HELP_INDEXED_PALETTE_EDIT, NULL },
|
||||
{ { N_("/_Add Color"), "",
|
||||
{ { N_("/_Add Color from FG"), "",
|
||||
colormap_editor_add_color_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_ADD },
|
||||
NULL,
|
||||
GIMP_HELP_INDEXED_PALETTE_ADD, NULL },
|
||||
{ { N_("/_Add Color from BG"), "",
|
||||
colormap_editor_add_color_cmd_callback, TRUE,
|
||||
"<StockItem>", GTK_STOCK_ADD },
|
||||
NULL,
|
||||
GIMP_HELP_INDEXED_PALETTE_ADD, NULL }
|
||||
};
|
||||
|
||||
|
@ -74,8 +79,9 @@ colormap_editor_menu_update (GtkItemFactory *factory,
|
|||
#define SET_SENSITIVE(menu,condition) \
|
||||
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("/Edit Color...", gimage && indexed);
|
||||
SET_SENSITIVE ("/Add Color", gimage && indexed && num_colors < 256);
|
||||
SET_SENSITIVE ("/Edit Color...", gimage && indexed);
|
||||
SET_SENSITIVE ("/Add Color from FG", gimage && indexed && num_colors < 256);
|
||||
SET_SENSITIVE ("/Add Color from BG", gimage && indexed && num_colors < 256);
|
||||
|
||||
#undef SET_SENSITIVE
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-colormap.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
|
@ -65,7 +66,6 @@
|
|||
#include "widgets/gimpselectioneditor.h"
|
||||
#include "widgets/gimptemplateview.h"
|
||||
#include "widgets/gimptoolbox.h"
|
||||
#include "widgets/gimptoolbox-color-area.h"
|
||||
#include "widgets/gimpundoeditor.h"
|
||||
#include "widgets/gimpvectorstreeview.h"
|
||||
|
||||
|
@ -94,6 +94,7 @@
|
|||
/* local function prototypes */
|
||||
|
||||
static void dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
||||
GdkModifierType state,
|
||||
GimpDockable *dockable);
|
||||
|
||||
static GtkWidget * dialogs_viewable_preview_func (GimpDockable *dockable,
|
||||
|
@ -1103,32 +1104,26 @@ dialogs_edit_palette_func (GimpData *data)
|
|||
|
||||
static void
|
||||
dialogs_indexed_palette_selected (GimpColormapEditor *editor,
|
||||
GdkModifierType state,
|
||||
GimpDockable *dockable)
|
||||
{
|
||||
GimpContext *context;
|
||||
GimpImage *gimage;
|
||||
|
||||
context = (GimpContext *) g_object_get_data (G_OBJECT (editor),
|
||||
"gimp-dialogs-context");
|
||||
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
|
||||
|
||||
if (context)
|
||||
if (gimage)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
GimpRGB color;
|
||||
gint index;
|
||||
GimpRGB color;
|
||||
gint index;
|
||||
|
||||
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
|
||||
index = gimp_colormap_editor_col_index (editor);
|
||||
index = gimp_colormap_editor_col_index (editor);
|
||||
|
||||
gimp_rgba_set_uchar (&color,
|
||||
gimage->cmap[index * 3],
|
||||
gimage->cmap[index * 3 + 1],
|
||||
gimage->cmap[index * 3 + 2],
|
||||
255);
|
||||
gimp_image_get_colormap_entry (gimage, index, &color);
|
||||
|
||||
if (active_color == FOREGROUND)
|
||||
gimp_context_set_foreground (context, &color);
|
||||
else if (active_color == BACKGROUND)
|
||||
gimp_context_set_background (context, &color);
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
gimp_context_set_background (dockable->context, &color);
|
||||
else
|
||||
gimp_context_set_foreground (dockable->context, &color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimppaletteeditor.h"
|
||||
|
@ -29,17 +31,6 @@
|
|||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->edit_button))
|
||||
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
|
||||
}
|
||||
|
||||
void
|
||||
palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
@ -51,6 +42,18 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
|||
gtk_button_clicked (GTK_BUTTON (editor->edit_button));
|
||||
}
|
||||
|
||||
void
|
||||
palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data);
|
||||
|
||||
if (GTK_WIDGET_SENSITIVE (editor->new_button))
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (editor->new_button),
|
||||
action ? GDK_CONTROL_MASK : 0);
|
||||
}
|
||||
|
||||
void
|
||||
palette_editor_delete_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#define __PALETTE_EDITOR_COMMANDS_H__
|
||||
|
||||
|
||||
void palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void palette_editor_edit_color_cmd_callback (GtkWidget *widget,
|
||||
void palette_editor_new_color_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void palette_editor_delete_color_cmd_callback (GtkWidget *widget,
|
||||
|
|
|
@ -45,11 +45,16 @@ GimpItemFactoryEntry palette_editor_menu_entries[] =
|
|||
|
||||
MENU_SEPARATOR ("/---"),
|
||||
|
||||
{ { N_("/_New Color"), "",
|
||||
{ { N_("/_New Color from FG"), "",
|
||||
palette_editor_new_color_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_NEW },
|
||||
NULL,
|
||||
GIMP_HELP_PALETTE_EDITOR_NEW, NULL },
|
||||
{ { N_("/_New Color from BG"), "",
|
||||
palette_editor_new_color_cmd_callback, TRUE,
|
||||
"<StockItem>", GTK_STOCK_NEW },
|
||||
NULL,
|
||||
GIMP_HELP_PALETTE_EDITOR_NEW, NULL },
|
||||
{ { N_("/_Delete Color"), "",
|
||||
palette_editor_delete_color_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_DELETE },
|
||||
|
@ -95,9 +100,10 @@ palette_editor_menu_update (GtkItemFactory *factory,
|
|||
#define SET_SENSITIVE(menu,condition) \
|
||||
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("/Edit Color...", editable && editor->color);
|
||||
SET_SENSITIVE ("/New Color", editable);
|
||||
SET_SENSITIVE ("/Delete Color", editable && editor->color);
|
||||
SET_SENSITIVE ("/Edit Color...", editable && editor->color);
|
||||
SET_SENSITIVE ("/New Color from FG", editable);
|
||||
SET_SENSITIVE ("/New Color from BG", editable);
|
||||
SET_SENSITIVE ("/Delete Color", editable && editor->color);
|
||||
|
||||
SET_SENSITIVE ("/Zoom Out", data_editor->data);
|
||||
SET_SENSITIVE ("/Zoom In", data_editor->data);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "config/gimpconfig-params.h"
|
||||
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpwidgets-utils.h"
|
||||
|
||||
#include "gimpcolorpickeroptions.h"
|
||||
|
||||
|
@ -36,10 +37,8 @@
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_SAMPLE_MERGED,
|
||||
PROP_SAMPLE_AVERAGE,
|
||||
PROP_AVERAGE_RADIUS,
|
||||
PROP_UPDATE_ACTIVE
|
||||
PROP_UPDATE_TOOLBOX,
|
||||
PROP_PICK_MODE
|
||||
};
|
||||
|
||||
|
||||
|
@ -87,7 +86,7 @@ gimp_color_picker_options_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
@ -99,10 +98,15 @@ gimp_color_picker_options_class_init (GimpColorPickerOptionsClass *klass)
|
|||
object_class->set_property = gimp_color_picker_options_set_property;
|
||||
object_class->get_property = gimp_color_picker_options_get_property;
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_UPDATE_ACTIVE,
|
||||
"update-active", NULL,
|
||||
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_UPDATE_TOOLBOX,
|
||||
"update-toolbox", NULL,
|
||||
TRUE,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PICK_MODE,
|
||||
"pick-mode", NULL,
|
||||
GIMP_TYPE_COLOR_PICK_MODE,
|
||||
GIMP_COLOR_PICK_MODE_FOREGROUND,
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -122,8 +126,11 @@ gimp_color_picker_options_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_UPDATE_ACTIVE:
|
||||
options->update_active = g_value_get_boolean (value);
|
||||
case PROP_UPDATE_TOOLBOX:
|
||||
options->update_toolbox = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_PICK_MODE:
|
||||
options->pick_mode = g_value_get_enum (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
@ -143,8 +150,11 @@ gimp_color_picker_options_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_UPDATE_ACTIVE:
|
||||
g_value_set_boolean (value, options->update_active);
|
||||
case PROP_UPDATE_TOOLBOX:
|
||||
g_value_set_boolean (value, options->update_toolbox);
|
||||
break;
|
||||
case PROP_PICK_MODE:
|
||||
g_value_set_enum (value, options->pick_mode);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
|
@ -155,11 +165,15 @@ gimp_color_picker_options_get_property (GObject *object,
|
|||
GtkWidget *
|
||||
gimp_color_picker_options_gui (GimpToolOptions *tool_options)
|
||||
{
|
||||
GObject *config;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
GimpColorPickerOptions *options;
|
||||
GObject *config;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *frame;
|
||||
gchar *str;
|
||||
|
||||
config = G_OBJECT (tool_options);
|
||||
options = GIMP_COLOR_PICKER_OPTIONS (tool_options);
|
||||
config = G_OBJECT (tool_options);
|
||||
|
||||
vbox = gimp_color_options_gui (tool_options);
|
||||
|
||||
|
@ -169,11 +183,22 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* the update active color toggle button */
|
||||
button = gimp_prop_check_button_new (config, "update-active",
|
||||
_("Update Active Color"));
|
||||
/* the update toolbox color toggle button */
|
||||
button = gimp_prop_check_button_new (config, "update-toolbox",
|
||||
_("Update Toolbox Color"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* the pick FG/BG frame */
|
||||
str = g_strdup_printf (_("Pick Mode %s"), gimp_get_mod_name_control ());
|
||||
frame = gimp_prop_enum_radio_frame_new (config, "pick-mode", str, -1, -1);
|
||||
g_free (str);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gtk_widget_set_sensitive (frame, options->update_toolbox);
|
||||
g_object_set_data (G_OBJECT (button), "set_sensitive", frame);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ struct _GimpColorPickerOptions
|
|||
{
|
||||
GimpColorOptions parent_instance;
|
||||
|
||||
gboolean update_active;
|
||||
gboolean update_toolbox;
|
||||
GimpColorPickMode pick_mode;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimppaletteeditor.h"
|
||||
#include "widgets/gimptoolbox-color-area.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
@ -57,20 +56,30 @@
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass);
|
||||
static void gimp_color_picker_tool_init (GimpColorPickerTool *tool);
|
||||
static GObject * gimp_color_picker_tool_constructor(GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_color_picker_tool_finalize (GObject *object);
|
||||
static void gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass);
|
||||
static void gimp_color_picker_tool_init (GimpColorPickerTool *tool);
|
||||
static GObject * gimp_color_picker_tool_constructor(GType type,
|
||||
guint n_params,
|
||||
GObjectConstructParam *params);
|
||||
static void gimp_color_picker_tool_finalize (GObject *object);
|
||||
|
||||
static void gimp_color_picker_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index);
|
||||
static void gimp_color_picker_tool_control (GimpTool *tool,
|
||||
GimpToolAction action,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_color_picker_tool_modifier_key (GimpTool *tool,
|
||||
GdkModifierType key,
|
||||
gboolean press,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_color_picker_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
|
||||
static void gimp_color_picker_tool_picked (GimpColorTool *color_tool,
|
||||
GimpImageType sample_type,
|
||||
GimpRGB *color,
|
||||
gint color_index);
|
||||
|
||||
static InfoDialog * gimp_color_picker_tool_info_create (GimpTool *tool);
|
||||
static void gimp_color_picker_tool_info_close (GtkWidget *widget,
|
||||
|
@ -154,6 +163,8 @@ gimp_color_picker_tool_class_init (GimpColorPickerToolClass *klass)
|
|||
object_class->finalize = gimp_color_picker_tool_finalize;
|
||||
|
||||
tool_class->control = gimp_color_picker_tool_control;
|
||||
tool_class->modifier_key = gimp_color_picker_tool_modifier_key;
|
||||
tool_class->oper_update = gimp_color_picker_tool_oper_update;
|
||||
|
||||
color_tool_class->picked = gimp_color_picker_tool_picked;
|
||||
}
|
||||
|
@ -162,11 +173,6 @@ static void
|
|||
gimp_color_picker_tool_init (GimpColorPickerTool *tool)
|
||||
{
|
||||
gimp_tool_control_set_preserve (GIMP_TOOL (tool)->control, FALSE);
|
||||
|
||||
gimp_tool_control_set_cursor (GIMP_TOOL (tool)->control,
|
||||
GIMP_COLOR_PICKER_CURSOR);
|
||||
gimp_tool_control_set_tool_cursor (GIMP_TOOL (tool)->control,
|
||||
GIMP_COLOR_PICKER_TOOL_CURSOR);
|
||||
}
|
||||
|
||||
static GObject *
|
||||
|
@ -223,6 +229,51 @@ gimp_color_picker_tool_control (GimpTool *tool,
|
|||
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_picker_tool_modifier_key (GimpTool *tool,
|
||||
GdkModifierType key,
|
||||
gboolean press,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpColorPickerOptions *options;
|
||||
|
||||
options = GIMP_COLOR_PICKER_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
if (key == GDK_CONTROL_MASK)
|
||||
{
|
||||
switch (options->pick_mode)
|
||||
{
|
||||
case GIMP_COLOR_PICK_MODE_FOREGROUND:
|
||||
g_object_set (options, "pick-mode", GIMP_COLOR_PICK_MODE_BACKGROUND,
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case GIMP_COLOR_PICK_MODE_BACKGROUND:
|
||||
g_object_set (options, "pick-mode", GIMP_COLOR_PICK_MODE_FOREGROUND,
|
||||
NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_picker_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
GimpColorPickerOptions *options;
|
||||
|
||||
options = GIMP_COLOR_PICKER_OPTIONS (tool->tool_info->tool_options);
|
||||
|
||||
GIMP_COLOR_TOOL (tool)->pick_mode = options->pick_mode;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_picker_tool_picked (GimpColorTool *color_tool,
|
||||
GimpImageType sample_type,
|
||||
|
@ -241,7 +292,7 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
|
|||
|
||||
options = GIMP_COLOR_PICKER_OPTIONS (color_tool->options);
|
||||
|
||||
if (options->update_active)
|
||||
if (options->update_toolbox)
|
||||
{
|
||||
GimpContext *user_context;
|
||||
|
||||
|
@ -251,10 +302,16 @@ gimp_color_picker_tool_picked (GimpColorTool *color_tool,
|
|||
gimp_palette_editor_update_color (user_context, color, update_state);
|
||||
#endif
|
||||
|
||||
if (active_color == FOREGROUND)
|
||||
gimp_context_set_foreground (user_context, color);
|
||||
else if (active_color == BACKGROUND)
|
||||
gimp_context_set_background (user_context, color);
|
||||
switch (options->pick_mode)
|
||||
{
|
||||
case GIMP_COLOR_PICK_MODE_FOREGROUND:
|
||||
gimp_context_set_foreground (user_context, color);
|
||||
break;
|
||||
|
||||
case GIMP_COLOR_PICK_MODE_BACKGROUND:
|
||||
gimp_context_set_background (user_context, color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -172,10 +172,11 @@ gimp_color_tool_finalize (GObject *object)
|
|||
static void
|
||||
gimp_color_tool_init (GimpColorTool *color_tool)
|
||||
{
|
||||
color_tool->enabled = FALSE;
|
||||
color_tool->center_x = 0;
|
||||
color_tool->center_y = 0;
|
||||
color_tool->options = NULL;
|
||||
color_tool->enabled = FALSE;
|
||||
color_tool->center_x = 0;
|
||||
color_tool->center_y = 0;
|
||||
color_tool->pick_mode = GIMP_COLOR_PICK_MODE_FOREGROUND;
|
||||
color_tool->options = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -262,12 +263,8 @@ gimp_color_tool_cursor_update (GimpTool *tool,
|
|||
{
|
||||
GdkCursorType cursor = GIMP_BAD_CURSOR;
|
||||
|
||||
if (gdisp->gimage &&
|
||||
|
||||
coords->x > 0 &&
|
||||
coords->x < gdisp->gimage->width &&
|
||||
coords->y > 0 &&
|
||||
coords->y < gdisp->gimage->height &&
|
||||
if (coords->x > 0 && coords->x < gdisp->gimage->width &&
|
||||
coords->y > 0 && coords->y < gdisp->gimage->height &&
|
||||
|
||||
(color_tool->options->sample_merged ||
|
||||
gimp_display_coords_in_active_drawable (gdisp, coords)))
|
||||
|
@ -278,7 +275,10 @@ gimp_color_tool_cursor_update (GimpTool *tool,
|
|||
gimp_tool_set_cursor (tool, gdisp,
|
||||
cursor,
|
||||
GIMP_COLOR_PICKER_TOOL_CURSOR,
|
||||
GIMP_CURSOR_MODIFIER_NONE);
|
||||
color_tool->pick_mode ==
|
||||
GIMP_COLOR_PICK_MODE_FOREGROUND ?
|
||||
GIMP_CURSOR_MODIFIER_FOREGROUND :
|
||||
GIMP_CURSOR_MODIFIER_BACKGROUND);
|
||||
|
||||
return; /* don't chain up */
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ struct _GimpColorTool
|
|||
gboolean enabled;
|
||||
gint center_x;
|
||||
gint center_y;
|
||||
GimpColorPickMode pick_mode;
|
||||
|
||||
GimpColorOptions *options;
|
||||
};
|
||||
|
|
|
@ -9,6 +9,25 @@
|
|||
|
||||
/* enumerations from "./tools-enums.h" */
|
||||
|
||||
static const GEnumValue gimp_color_pick_mode_enum_values[] =
|
||||
{
|
||||
{ GIMP_COLOR_PICK_MODE_FOREGROUND, N_("Pick Foreground Color"), "foreground" },
|
||||
{ GIMP_COLOR_PICK_MODE_BACKGROUND, N_("Pick Background Color"), "background" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType
|
||||
gimp_color_pick_mode_get_type (void)
|
||||
{
|
||||
static GType enum_type = 0;
|
||||
|
||||
if (!enum_type)
|
||||
enum_type = g_enum_register_static ("GimpColorPickMode", gimp_color_pick_mode_enum_values);
|
||||
|
||||
return enum_type;
|
||||
}
|
||||
|
||||
|
||||
static const GEnumValue gimp_crop_type_enum_values[] =
|
||||
{
|
||||
{ GIMP_CROP, N_("Crop"), "crop" },
|
||||
|
|
|
@ -21,21 +21,32 @@
|
|||
|
||||
#if 0
|
||||
This file is parsed by two scripts, enumgen.pl in tools/pdbgen,
|
||||
and gimp-mkenums. All enums that are not marked with
|
||||
and gimp-mkenums. All enums that are not marked with
|
||||
/*< pdb-skip >*/ are exported to libgimp and the PDB. Enums that are
|
||||
not marked with /*< skip >*/ are registered with the GType system.
|
||||
If you want the enum to be skipped by both scripts, you have to use
|
||||
/*< pdb-skip, skip >*/.
|
||||
not marked with /*< skip >*/ are registered with the GType system.
|
||||
If you want the enum to be skipped by both scripts, you have to use
|
||||
/*< pdb-skip, skip >*/.
|
||||
|
||||
All enum values that are marked with /*< skip >*/ are skipped for
|
||||
both targets.
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* these enums that are registered with the type system
|
||||
*/
|
||||
|
||||
#define GIMP_TYPE_COLOR_PICK_MODE (gimp_color_pick_mode_get_type ())
|
||||
|
||||
GType gimp_color_pick_mode_get_type (void) G_GNUC_CONST;
|
||||
|
||||
typedef enum /*< pdb-skip >*/
|
||||
{
|
||||
GIMP_COLOR_PICK_MODE_FOREGROUND, /*< desc="Pick Foreground Color" >*/
|
||||
GIMP_COLOR_PICK_MODE_BACKGROUND /*< desc="Pick Background Color" >*/
|
||||
} GimpColorPickMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_CROP_TYPE (gimp_crop_type_get_type ())
|
||||
|
||||
GType gimp_crop_type_get_type (void) G_GNUC_CONST;
|
||||
|
@ -47,39 +58,6 @@ typedef enum /*< pdb-skip >*/
|
|||
} GimpCropType;
|
||||
|
||||
|
||||
/*
|
||||
* non-registered enums; register them if needed
|
||||
*/
|
||||
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
SELECTION_ADD = GIMP_CHANNEL_OP_ADD,
|
||||
SELECTION_SUBTRACT = GIMP_CHANNEL_OP_SUBTRACT,
|
||||
SELECTION_REPLACE = GIMP_CHANNEL_OP_REPLACE,
|
||||
SELECTION_INTERSECT = GIMP_CHANNEL_OP_INTERSECT,
|
||||
SELECTION_MOVE_MASK,
|
||||
SELECTION_MOVE,
|
||||
SELECTION_MOVE_COPY,
|
||||
SELECTION_ANCHOR
|
||||
} SelectOps;
|
||||
|
||||
/* Tool control actions */
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
PAUSE,
|
||||
RESUME,
|
||||
HALT
|
||||
} GimpToolAction;
|
||||
|
||||
/* Motion event report modes */
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
GIMP_MOTION_MODE_EXACT,
|
||||
GIMP_MOTION_MODE_HINT,
|
||||
GIMP_MOTION_MODE_COMPRESS
|
||||
} GimpMotionMode;
|
||||
|
||||
|
||||
#define GIMP_TYPE_RECT_SELECT_MODE (gimp_rect_select_mode_get_type ())
|
||||
|
||||
GType gimp_rect_select_mode_get_type (void) G_GNUC_CONST;
|
||||
|
@ -128,6 +106,38 @@ typedef enum /*< pdb-skip >*/
|
|||
} GimpTransformGridType;
|
||||
|
||||
|
||||
/*
|
||||
* non-registered enums; register them if needed
|
||||
*/
|
||||
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
SELECTION_ADD = GIMP_CHANNEL_OP_ADD,
|
||||
SELECTION_SUBTRACT = GIMP_CHANNEL_OP_SUBTRACT,
|
||||
SELECTION_REPLACE = GIMP_CHANNEL_OP_REPLACE,
|
||||
SELECTION_INTERSECT = GIMP_CHANNEL_OP_INTERSECT,
|
||||
SELECTION_MOVE_MASK,
|
||||
SELECTION_MOVE,
|
||||
SELECTION_MOVE_COPY,
|
||||
SELECTION_ANCHOR
|
||||
} SelectOps;
|
||||
|
||||
/* Tool control actions */
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
PAUSE,
|
||||
RESUME,
|
||||
HALT
|
||||
} GimpToolAction;
|
||||
|
||||
/* Motion event report modes */
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
GIMP_MOTION_MODE_EXACT,
|
||||
GIMP_MOTION_MODE_HINT,
|
||||
GIMP_MOTION_MODE_COMPRESS
|
||||
} GimpMotionMode;
|
||||
|
||||
/* Possible transform functions */
|
||||
typedef enum /*< pdb-skip, skip >*/
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "gimphelp-ids.h"
|
||||
#include "gimpitemfactory.h"
|
||||
#include "gimpmenufactory.h"
|
||||
#include "gimptoolbox-color-area.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "gui/color-notebook.h"
|
||||
|
||||
|
@ -88,7 +88,6 @@ static void gimp_colormap_editor_unmap (GtkWidget *widget);
|
|||
static void gimp_colormap_editor_set_image (GimpImageEditor *editor,
|
||||
GimpImage *gimage);
|
||||
|
||||
static void gimp_colormap_editor_real_selected (GimpColormapEditor *editor);
|
||||
static void gimp_colormap_editor_draw (GimpColormapEditor *editor);
|
||||
static void gimp_colormap_editor_draw_cell (GimpColormapEditor *editor,
|
||||
gint col);
|
||||
|
@ -124,6 +123,9 @@ static void gimp_colormap_edit_clicked (GtkWidget *widget,
|
|||
GimpColormapEditor *editor);
|
||||
static void gimp_colormap_add_clicked (GtkWidget *widget,
|
||||
GimpColormapEditor *editor);
|
||||
static void gimp_colormap_add_ext_clicked (GtkWidget *widget,
|
||||
GdkModifierType state,
|
||||
GimpColormapEditor *editor);
|
||||
|
||||
static void gimp_colormap_image_mode_changed (GimpImage *gimage,
|
||||
GimpColormapEditor *editor);
|
||||
|
@ -189,8 +191,9 @@ gimp_colormap_editor_class_init (GimpColormapEditorClass* klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GimpColormapEditorClass, selected),
|
||||
NULL, NULL,
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
gimp_marshal_VOID__ENUM,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_MODIFIER_TYPE);
|
||||
|
||||
object_class->destroy = gimp_colormap_editor_destroy;
|
||||
|
||||
|
@ -198,12 +201,14 @@ gimp_colormap_editor_class_init (GimpColormapEditorClass* klass)
|
|||
|
||||
image_editor_class->set_image = gimp_colormap_editor_set_image;
|
||||
|
||||
klass->selected = gimp_colormap_editor_real_selected;
|
||||
klass->selected = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_colormap_editor_init (GimpColormapEditor *editor)
|
||||
{
|
||||
gchar *str;
|
||||
|
||||
editor->col_index = 0;
|
||||
editor->dnd_col_index = 0;
|
||||
editor->palette = NULL;
|
||||
|
@ -223,14 +228,16 @@ gimp_colormap_editor_init (GimpColormapEditor *editor)
|
|||
NULL,
|
||||
editor);
|
||||
|
||||
str = g_strdup_printf (_("Add Color from FG\n%s from BG"),
|
||||
gimp_get_mod_name_control ());
|
||||
editor->add_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (editor),
|
||||
GTK_STOCK_ADD, _("Add Color"),
|
||||
GTK_STOCK_ADD, str,
|
||||
GIMP_HELP_INDEXED_PALETTE_ADD,
|
||||
G_CALLBACK (gimp_colormap_add_clicked),
|
||||
NULL,
|
||||
G_CALLBACK (gimp_colormap_add_ext_clicked),
|
||||
editor);
|
||||
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -411,11 +418,12 @@ gimp_colormap_editor_new (GimpImage *gimage,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_colormap_editor_selected (GimpColormapEditor *editor)
|
||||
gimp_colormap_editor_selected (GimpColormapEditor *editor,
|
||||
GdkModifierType state)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_COLORMAP_EDITOR (editor));
|
||||
|
||||
g_signal_emit (editor, editor_signals[SELECTED], 0);
|
||||
g_signal_emit (editor, editor_signals[SELECTED], 0, state);
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -429,29 +437,6 @@ gimp_colormap_editor_col_index (GimpColormapEditor *editor)
|
|||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_colormap_editor_real_selected (GimpColormapEditor *editor)
|
||||
{
|
||||
GimpContext *user_context;
|
||||
GimpImage *gimage;
|
||||
GimpRGB color;
|
||||
|
||||
gimage = GIMP_IMAGE_EDITOR (editor)->gimage;
|
||||
|
||||
if (!gimage)
|
||||
return;
|
||||
|
||||
user_context = gimp_get_user_context (gimage->gimp);
|
||||
|
||||
gimp_image_get_colormap_entry (gimage, editor->col_index, &color);
|
||||
|
||||
if (active_color == FOREGROUND)
|
||||
gimp_context_set_foreground (user_context, &color);
|
||||
else if (active_color == BACKGROUND)
|
||||
gimp_context_set_background (user_context, &color);
|
||||
}
|
||||
|
||||
|
||||
#define MIN_CELL_SIZE 4
|
||||
|
||||
static void
|
||||
|
@ -770,7 +755,7 @@ gimp_colormap_preview_button_press (GtkWidget *widget,
|
|||
{
|
||||
case 1:
|
||||
gimp_colormap_editor_set_index (editor, col);
|
||||
gimp_colormap_editor_selected (editor);
|
||||
gimp_colormap_editor_selected (editor, bevent->state);
|
||||
|
||||
if (bevent->type == GDK_2BUTTON_PRESS)
|
||||
gimp_colormap_edit_clicked (editor->edit_button, editor);
|
||||
|
@ -963,6 +948,14 @@ gimp_colormap_edit_clicked (GtkWidget *widget,
|
|||
static void
|
||||
gimp_colormap_add_clicked (GtkWidget *widget,
|
||||
GimpColormapEditor *editor)
|
||||
{
|
||||
gimp_colormap_add_ext_clicked (widget, 0, editor);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_colormap_add_ext_clicked (GtkWidget *widget,
|
||||
GdkModifierType state,
|
||||
GimpColormapEditor *editor)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
|
||||
|
@ -970,12 +963,15 @@ gimp_colormap_add_clicked (GtkWidget *widget,
|
|||
|
||||
if (gimage && gimage->num_cols < 256)
|
||||
{
|
||||
GimpRGB color;
|
||||
GimpContext *context;
|
||||
GimpRGB color;
|
||||
|
||||
gimp_rgb_set_uchar (&color,
|
||||
gimage->cmap[editor->col_index * 3],
|
||||
gimage->cmap[editor->col_index * 3 + 1],
|
||||
gimage->cmap[editor->col_index * 3 + 2]);
|
||||
context = gimp_get_user_context (gimage->gimp);
|
||||
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
gimp_context_get_background (context, &color);
|
||||
else
|
||||
gimp_context_get_foreground (context, &color);
|
||||
|
||||
gimp_image_add_colormap_entry (gimage, &color);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ struct _GimpColormapEditorClass
|
|||
{
|
||||
GimpImageEditorClass parent_class;
|
||||
|
||||
void (* selected) (GimpColormapEditor *editor);
|
||||
void (* selected) (GimpColormapEditor *editor,
|
||||
GdkModifierType state);
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,7 +70,8 @@ GType gimp_colormap_editor_get_type (void) G_GNUC_CONST;
|
|||
GtkWidget * gimp_colormap_editor_new (GimpImage *gimage,
|
||||
GimpMenuFactory *menu_factory);
|
||||
|
||||
void gimp_colormap_editor_selected (GimpColormapEditor *editor);
|
||||
void gimp_colormap_editor_selected (GimpColormapEditor *editor,
|
||||
GdkModifierType state);
|
||||
gint gimp_colormap_editor_col_index (GimpColormapEditor *editor);
|
||||
|
||||
|
||||
|
|
|
@ -353,52 +353,52 @@ static GimpBitmapCursor gimp_modifier_cursors[] =
|
|||
{
|
||||
plus_bits, plus_mask_bits,
|
||||
plus_width, plus_height,
|
||||
plus_x_hot, plus_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
minus_bits, minus_mask_bits,
|
||||
minus_width, minus_height,
|
||||
minus_x_hot, minus_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
intersect_bits, intersect_mask_bits,
|
||||
intersect_width, intersect_height,
|
||||
intersect_x_hot, intersect_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
move_bits, move_mask_bits,
|
||||
move_width, move_height,
|
||||
move_x_hot, move_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
resize_bits, resize_mask_bits,
|
||||
resize_width, resize_height,
|
||||
resize_x_hot, resize_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
control_bits, control_mask_bits,
|
||||
control_width, control_height,
|
||||
control_x_hot, control_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
anchor_bits, anchor_mask_bits,
|
||||
anchor_width, anchor_height,
|
||||
anchor_x_hot, anchor_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
foreground_bits, foreground_mask_bits,
|
||||
foreground_width, foreground_height,
|
||||
foreground_x_hot, foreground_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
background_bits, background_mask_bits,
|
||||
background_width, background_height,
|
||||
background_x_hot, background_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
},
|
||||
{
|
||||
pattern_bits, pattern_mask_bits,
|
||||
pattern_width, pattern_height,
|
||||
pattern_x_hot, pattern_y_hot, NULL, NULL
|
||||
0, 0, NULL, NULL
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "gimppaletteeditor.h"
|
||||
#include "gimppreview.h"
|
||||
#include "gimptoolbox-color-area.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "gui/color-notebook.h"
|
||||
|
||||
|
@ -96,6 +97,9 @@ static void palette_editor_columns_changed (GtkAdjustment *adj,
|
|||
|
||||
static void palette_editor_new_clicked (GtkWidget *widget,
|
||||
GimpPaletteEditor *editor);
|
||||
static void palette_editor_new_ext_clicked (GtkWidget *widget,
|
||||
GdkModifierType state,
|
||||
GimpPaletteEditor *editor);
|
||||
static void palette_editor_edit_clicked (GtkWidget *widget,
|
||||
GimpPaletteEditor *editor);
|
||||
static void palette_editor_delete_clicked (GtkWidget *widget,
|
||||
|
@ -192,6 +196,7 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
|
|||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *spinbutton;
|
||||
gchar *str;
|
||||
|
||||
editor->zoom_factor = 1.0;
|
||||
editor->columns = COLUMNS;
|
||||
|
@ -283,13 +288,16 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
|
|||
NULL,
|
||||
editor);
|
||||
|
||||
str = g_strdup_printf (_("New Color from FG\n%s from BG"),
|
||||
gimp_get_mod_name_control ());
|
||||
editor->new_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (editor),
|
||||
GTK_STOCK_NEW, _("New Color"),
|
||||
GTK_STOCK_NEW, str,
|
||||
GIMP_HELP_PALETTE_EDITOR_NEW,
|
||||
G_CALLBACK (palette_editor_new_clicked),
|
||||
NULL,
|
||||
G_CALLBACK (palette_editor_new_ext_clicked),
|
||||
editor);
|
||||
g_free (str);
|
||||
|
||||
editor->delete_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (editor),
|
||||
|
@ -548,24 +556,12 @@ palette_editor_color_area_button_press (GtkWidget *widget,
|
|||
|
||||
if (list)
|
||||
{
|
||||
if (active_color == FOREGROUND)
|
||||
{
|
||||
if (bevent->state & GDK_CONTROL_MASK)
|
||||
gimp_context_set_background (user_context,
|
||||
&editor->color->color);
|
||||
else
|
||||
gimp_context_set_foreground (user_context,
|
||||
&editor->color->color);
|
||||
}
|
||||
else if (active_color == BACKGROUND)
|
||||
{
|
||||
if (bevent->state & GDK_CONTROL_MASK)
|
||||
gimp_context_set_foreground (user_context,
|
||||
&editor->color->color);
|
||||
else
|
||||
gimp_context_set_background (user_context,
|
||||
&editor->color->color);
|
||||
}
|
||||
if (bevent->state & GDK_CONTROL_MASK)
|
||||
gimp_context_set_background (user_context,
|
||||
&editor->color->color);
|
||||
else
|
||||
gimp_context_set_foreground (user_context,
|
||||
&editor->color->color);
|
||||
|
||||
palette_editor_draw_entries (editor, row, col);
|
||||
|
||||
|
@ -1026,6 +1022,14 @@ palette_editor_edit_clicked (GtkWidget *widget,
|
|||
static void
|
||||
palette_editor_new_clicked (GtkWidget *widget,
|
||||
GimpPaletteEditor *editor)
|
||||
{
|
||||
palette_editor_new_ext_clicked (widget, 0, editor);
|
||||
}
|
||||
|
||||
static void
|
||||
palette_editor_new_ext_clicked (GtkWidget *widget,
|
||||
GdkModifierType state,
|
||||
GimpPaletteEditor *editor)
|
||||
{
|
||||
GimpDataEditor *data_editor;
|
||||
GimpPalette *palette;
|
||||
|
@ -1041,10 +1045,10 @@ palette_editor_new_clicked (GtkWidget *widget,
|
|||
|
||||
user_context = gimp_get_user_context (data_editor->gimp);
|
||||
|
||||
if (active_color == FOREGROUND)
|
||||
gimp_context_get_foreground (user_context, &color);
|
||||
else if (active_color == BACKGROUND)
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
gimp_context_get_background (user_context, &color);
|
||||
else
|
||||
gimp_context_get_foreground (user_context, &color);
|
||||
|
||||
editor->color = gimp_palette_add_entry (palette, NULL, &color);
|
||||
}
|
||||
|
@ -1229,13 +1233,6 @@ palette_editor_color_notebook_callback (ColorNotebook *color_notebook,
|
|||
if (editor->color)
|
||||
{
|
||||
editor->color->color = *color;
|
||||
|
||||
/* Update either foreground or background colors */
|
||||
if (active_color == FOREGROUND)
|
||||
gimp_context_set_foreground (user_context, color);
|
||||
else if (active_color == BACKGROUND)
|
||||
gimp_context_set_background (user_context, color);
|
||||
|
||||
gimp_data_dirty (GIMP_DATA (palette));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ typedef enum
|
|||
INVALID_AREA
|
||||
} ColorAreaTarget;
|
||||
|
||||
#define FOREGROUND 0
|
||||
#define BACKGROUND 1
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
|
@ -90,13 +93,13 @@ static gboolean color_area_events (GtkWidget *widget,
|
|||
|
||||
|
||||
/* Global variables */
|
||||
gint active_color = FOREGROUND;
|
||||
GimpDisplay *color_area_gdisp = NULL;
|
||||
|
||||
/* Static variables */
|
||||
static GtkWidget *color_area = NULL;
|
||||
static ColorNotebook *color_notebook = NULL;
|
||||
static gboolean color_notebook_active = FALSE;
|
||||
static gint active_color = FOREGROUND;
|
||||
static gint edit_color;
|
||||
static GimpRGB revert_fg;
|
||||
static GimpRGB revert_bg;
|
||||
|
|
|
@ -20,14 +20,6 @@
|
|||
#define __GIMP_TOOLBOX_COLOR_AREA_H__
|
||||
|
||||
|
||||
#define FOREGROUND 0
|
||||
#define BACKGROUND 1
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
extern gint active_color; /* foreground (= 0) or background (= 1) */
|
||||
|
||||
#ifdef DISPLAY_FILTERS
|
||||
extern GimpDisplay *color_area_gdisp; /* hack for color displays */
|
||||
#endif /* DISPLAY_FILTERS */
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/* Created with The GIMP */
|
||||
#define background_width 32
|
||||
#define background_height 32
|
||||
#define background_x_hot 0
|
||||
#define background_y_hot 0
|
||||
static unsigned char background_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x1f,
|
||||
0x00, 0x00, 0xf8, 0x11, 0x00, 0x00, 0xf8, 0x11, 0x00, 0x00, 0x40, 0x10,
|
||||
0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07,
|
||||
0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0xe0, 0x47,
|
||||
0x00, 0x00, 0xe0, 0x47, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x41,
|
||||
0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/* Created with The GIMP */
|
||||
#define background_mask_width 32
|
||||
#define background_mask_height 32
|
||||
#define background_mask_x_hot 0
|
||||
#define background_mask_y_hot 0
|
||||
static unsigned char background_mask_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03,
|
||||
0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f,
|
||||
0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x3f,
|
||||
0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x0f,
|
||||
0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0xf0, 0xff,
|
||||
0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x80, 0xff,
|
||||
0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/* Created with The GIMP */
|
||||
#define foreground_width 32
|
||||
#define foreground_height 32
|
||||
#define foreground_x_hot 0
|
||||
#define foreground_y_hot 0
|
||||
static unsigned char foreground_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01,
|
||||
0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xfc, 0x0f,
|
||||
0x00, 0x00, 0xfc, 0x09, 0x00, 0x00, 0xfc, 0x09, 0x00, 0x00, 0x40, 0x08,
|
||||
0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xf0, 0x07,
|
||||
0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf0, 0x27,
|
||||
0x00, 0x00, 0xf0, 0x27, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
/* Created with The GIMP */
|
||||
#define foreground_mask_width 32
|
||||
#define foreground_mask_height 32
|
||||
#define foreground_mask_x_hot 0
|
||||
#define foreground_mask_y_hot 0
|
||||
static unsigned char foreground_mask_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xfe, 0x03,
|
||||
0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xfe, 0x1f,
|
||||
0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xfe, 0x1f,
|
||||
0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x0f,
|
||||
0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xf8, 0x7f,
|
||||
0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x80, 0x7f,
|
||||
0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue