mirror of https://github.com/GNOME/gimp.git
app: remove gimp_paint_mode_menu_new() and use GimpLayerModeBox
I know this looks absolutely horrible, please spare me comments about that. This commit has the purpose to let everybody experiment with the new modes, and suggest improvements of the GimpLayerModeBox widget; we need *some* way of controlling the new layer mode madness.
This commit is contained in:
parent
6e522d735f
commit
c58d471af7
|
@ -151,8 +151,8 @@ fade_dialog_new (GimpImage *image,
|
|||
gtk_widget_show (table);
|
||||
|
||||
/* the paint mode menu */
|
||||
menu = gimp_prop_paint_mode_menu_new (G_OBJECT (private->context),
|
||||
"paint-mode", TRUE, TRUE);
|
||||
menu = gimp_prop_layer_mode_box_new (G_OBJECT (private->context),
|
||||
"paint-mode", TRUE, TRUE);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
|
||||
_("_Mode:"), 0.0, 0.5,
|
||||
menu, 2, FALSE);
|
||||
|
|
|
@ -35,9 +35,9 @@
|
|||
#include "text/gimptextlayer.h"
|
||||
|
||||
#include "widgets/gimpcontainertreeview.h"
|
||||
#include "widgets/gimplayermodebox.h"
|
||||
#include "widgets/gimpspinscale.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
#include "widgets/gimpwidgets-constructors.h"
|
||||
|
||||
#include "item-options-dialog.h"
|
||||
#include "layer-options-dialog.h"
|
||||
|
@ -58,6 +58,7 @@ struct _LayerOptionsDialog
|
|||
GimpLayerOptionsCallback callback;
|
||||
gpointer user_data;
|
||||
|
||||
GtkWidget *mode_box;
|
||||
GtkWidget *size_se;
|
||||
GtkWidget *offset_se;
|
||||
};
|
||||
|
@ -157,12 +158,10 @@ layer_options_dialog_new (GimpImage *image,
|
|||
g_object_weak_ref (G_OBJECT (dialog),
|
||||
(GWeakNotify) layer_options_dialog_free, private);
|
||||
|
||||
combo = gimp_paint_mode_menu_new (FALSE, FALSE);
|
||||
item_options_dialog_add_widget (dialog, _("_Mode:"), combo);
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||
private->mode,
|
||||
G_CALLBACK (gimp_int_combo_box_get_active),
|
||||
&private->mode);
|
||||
private->mode_box = gimp_layer_mode_box_new (FALSE, FALSE);
|
||||
item_options_dialog_add_widget (dialog, _("_Mode:"), private->mode_box);
|
||||
gimp_layer_mode_box_set_mode (GIMP_LAYER_MODE_BOX (private->mode_box),
|
||||
private->mode);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (private->opacity, 0.0, 100.0,
|
||||
1.0, 10.0, 0.0));
|
||||
|
@ -421,6 +420,9 @@ layer_options_dialog_callback (GtkWidget *dialog,
|
|||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
private->mode =
|
||||
gimp_layer_mode_box_get_mode (GIMP_LAYER_MODE_BOX (private->mode_box));
|
||||
|
||||
if (private->size_se)
|
||||
{
|
||||
width =
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "paint/gimppaintoptions.h"
|
||||
|
||||
#include "widgets/gimplayermodebox.h"
|
||||
#include "widgets/gimppropwidgets.h"
|
||||
#include "widgets/gimpspinscale.h"
|
||||
#include "widgets/gimpviewablebox.h"
|
||||
|
@ -113,9 +114,10 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
tool_type = tool_options->tool_info->tool_type;
|
||||
|
||||
/* the paint mode menu */
|
||||
menu = gimp_prop_paint_mode_menu_new (config, "paint-mode", TRUE, FALSE);
|
||||
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (menu), _("Mode"));
|
||||
g_object_set (menu, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
|
||||
menu = gimp_prop_layer_mode_box_new (config, "paint-mode", TRUE, FALSE);
|
||||
gimp_layer_mode_box_set_label (GIMP_LAYER_MODE_BOX (menu), _("Mode"));
|
||||
gimp_layer_mode_box_set_ellipsize (GIMP_LAYER_MODE_BOX (menu),
|
||||
PANGO_ELLIPSIZE_END);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), menu, FALSE, FALSE, 0);
|
||||
gtk_widget_show (menu);
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
#include "gimpbrushfactoryview.h"
|
||||
#include "gimpbrushselect.h"
|
||||
#include "gimpcontainerbox.h"
|
||||
#include "gimplayermodebox.h"
|
||||
#include "gimpspinscale.h"
|
||||
#include "gimpwidgets-constructors.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
@ -74,8 +74,6 @@ static void gimp_brush_select_mode_changed (GimpContext *context
|
|||
|
||||
static void gimp_brush_select_opacity_update (GtkAdjustment *adj,
|
||||
GimpBrushSelect *select);
|
||||
static void gimp_brush_select_mode_update (GtkWidget *widget,
|
||||
GimpBrushSelect *select);
|
||||
static void gimp_brush_select_spacing_update (GtkAdjustment *adj,
|
||||
GimpBrushSelect *select);
|
||||
|
||||
|
@ -191,14 +189,14 @@ gimp_brush_select_constructed (GObject *object)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
select->paint_mode_menu = gimp_paint_mode_menu_new (TRUE, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), select->paint_mode_menu, TRUE, TRUE, 0);
|
||||
gtk_widget_show (select->paint_mode_menu);
|
||||
select->layer_mode_box = gimp_layer_mode_box_new (TRUE, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), select->layer_mode_box, TRUE, TRUE, 0);
|
||||
gtk_widget_show (select->layer_mode_box);
|
||||
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (select->paint_mode_menu),
|
||||
gimp_context_get_paint_mode (dialog->context),
|
||||
G_CALLBACK (gimp_brush_select_mode_update),
|
||||
select);
|
||||
g_object_bind_property (G_OBJECT (dialog->context), "paint-mode",
|
||||
G_OBJECT (select->layer_mode_box), "layer-mode",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
spacing_adj = GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_adjustment;
|
||||
|
||||
|
@ -311,17 +309,6 @@ gimp_brush_select_mode_changed (GimpContext *context,
|
|||
GimpLayerMode paint_mode,
|
||||
GimpBrushSelect *select)
|
||||
{
|
||||
g_signal_handlers_block_by_func (select->paint_mode_menu,
|
||||
gimp_brush_select_mode_update,
|
||||
select);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (select->paint_mode_menu),
|
||||
paint_mode);
|
||||
|
||||
g_signal_handlers_unblock_by_func (select->paint_mode_menu,
|
||||
gimp_brush_select_mode_update,
|
||||
select);
|
||||
|
||||
gimp_pdb_dialog_run_callback (GIMP_PDB_DIALOG (select), FALSE);
|
||||
}
|
||||
|
||||
|
@ -333,20 +320,6 @@ gimp_brush_select_opacity_update (GtkAdjustment *adjustment,
|
|||
gtk_adjustment_get_value (adjustment) / 100.0);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_brush_select_mode_update (GtkWidget *widget,
|
||||
GimpBrushSelect *select)
|
||||
{
|
||||
gint paint_mode;
|
||||
|
||||
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
|
||||
&paint_mode))
|
||||
{
|
||||
gimp_context_set_paint_mode (GIMP_PDB_DIALOG (select)->context,
|
||||
(GimpLayerMode) paint_mode);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_brush_select_spacing_update (GtkAdjustment *adjustment,
|
||||
GimpBrushSelect *select)
|
||||
|
|
|
@ -45,7 +45,7 @@ struct _GimpBrushSelect
|
|||
|
||||
gint spacing;
|
||||
GtkAdjustment *opacity_data;
|
||||
GtkWidget *paint_mode_menu;
|
||||
GtkWidget *layer_mode_box;
|
||||
};
|
||||
|
||||
struct _GimpBrushSelectClass
|
||||
|
|
|
@ -51,11 +51,11 @@
|
|||
#include "gimpcontainerview.h"
|
||||
#include "gimpdnd.h"
|
||||
#include "gimphelp-ids.h"
|
||||
#include "gimplayermodebox.h"
|
||||
#include "gimplayertreeview.h"
|
||||
#include "gimpspinscale.h"
|
||||
#include "gimpuimanager.h"
|
||||
#include "gimpviewrenderer.h"
|
||||
#include "gimpwidgets-constructors.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
struct _GimpLayerTreeViewPriv
|
||||
{
|
||||
GtkWidget *paint_mode_menu;
|
||||
GtkWidget *layer_mode_box;
|
||||
GtkAdjustment *opacity_adjustment;
|
||||
GtkWidget *lock_alpha_toggle;
|
||||
|
||||
|
@ -130,7 +130,8 @@ static void gimp_layer_tree_view_set_image (GimpItemTreeV
|
|||
static GimpItem * gimp_layer_tree_view_item_new (GimpImage *image);
|
||||
static void gimp_layer_tree_view_floating_selection_changed (GimpImage *image,
|
||||
GimpLayerTreeView *view);
|
||||
static void gimp_layer_tree_view_paint_mode_menu_callback (GtkWidget *widget,
|
||||
static void gimp_layer_tree_view_layer_mode_box_callback (GtkWidget *widget,
|
||||
const GParamSpec *pspec,
|
||||
GimpLayerTreeView *view);
|
||||
static void gimp_layer_tree_view_opacity_scale_changed (GtkAdjustment *adj,
|
||||
GimpLayerTreeView *view);
|
||||
|
@ -264,18 +265,17 @@ gimp_layer_tree_view_init (GimpLayerTreeView *view)
|
|||
|
||||
/* Paint mode menu */
|
||||
|
||||
view->priv->paint_mode_menu = gimp_paint_mode_menu_new (FALSE, FALSE);
|
||||
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (view->priv->paint_mode_menu),
|
||||
_("Mode"));
|
||||
gimp_item_tree_view_add_options (GIMP_ITEM_TREE_VIEW (view),
|
||||
NULL, view->priv->paint_mode_menu);
|
||||
view->priv->layer_mode_box = gimp_layer_mode_box_new (FALSE, FALSE);
|
||||
gimp_layer_mode_box_set_label (GIMP_LAYER_MODE_BOX (view->priv->layer_mode_box),
|
||||
_("Mode"));
|
||||
gimp_item_tree_view_add_options (GIMP_ITEM_TREE_VIEW (view), NULL,
|
||||
view->priv->layer_mode_box);
|
||||
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (view->priv->paint_mode_menu),
|
||||
GIMP_LAYER_MODE_NORMAL,
|
||||
G_CALLBACK (gimp_layer_tree_view_paint_mode_menu_callback),
|
||||
view);
|
||||
g_signal_connect (view->priv->layer_mode_box, "notify::layer-mode",
|
||||
G_CALLBACK (gimp_layer_tree_view_layer_mode_box_callback),
|
||||
view);
|
||||
|
||||
gimp_help_set_help_data (view->priv->paint_mode_menu, NULL,
|
||||
gimp_help_set_help_data (view->priv->layer_mode_box, NULL,
|
||||
GIMP_HELP_LAYER_DIALOG_PAINT_MODE_MENU);
|
||||
|
||||
/* Opacity scale */
|
||||
|
@ -923,8 +923,9 @@ gimp_layer_tree_view_floating_selection_changed (GimpImage *image,
|
|||
|
||||
|
||||
static void
|
||||
gimp_layer_tree_view_paint_mode_menu_callback (GtkWidget *widget,
|
||||
GimpLayerTreeView *view)
|
||||
gimp_layer_tree_view_layer_mode_box_callback (GtkWidget *widget,
|
||||
const GParamSpec *pspec,
|
||||
GimpLayerTreeView *view)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer = NULL;
|
||||
|
@ -937,11 +938,10 @@ gimp_layer_tree_view_paint_mode_menu_callback (GtkWidget *widget,
|
|||
|
||||
if (layer)
|
||||
{
|
||||
gint mode;
|
||||
GimpLayerMode mode =
|
||||
gimp_layer_mode_box_get_mode (GIMP_LAYER_MODE_BOX (widget));
|
||||
|
||||
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
|
||||
&mode) &&
|
||||
gimp_layer_get_mode (layer) != (GimpLayerMode) mode)
|
||||
if (gimp_layer_get_mode (layer) != mode)
|
||||
{
|
||||
GimpUndo *undo;
|
||||
gboolean push_undo = TRUE;
|
||||
|
@ -1073,14 +1073,14 @@ static void
|
|||
gimp_layer_tree_view_update_options (GimpLayerTreeView *view,
|
||||
GimpLayer *layer)
|
||||
{
|
||||
BLOCK (view->priv->paint_mode_menu,
|
||||
gimp_layer_tree_view_paint_mode_menu_callback);
|
||||
BLOCK (view->priv->layer_mode_box,
|
||||
gimp_layer_tree_view_layer_mode_box_callback);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (view->priv->paint_mode_menu),
|
||||
gimp_layer_get_mode (layer));
|
||||
gimp_layer_mode_box_set_mode (GIMP_LAYER_MODE_BOX (view->priv->layer_mode_box),
|
||||
gimp_layer_get_mode (layer));
|
||||
|
||||
UNBLOCK (view->priv->paint_mode_menu,
|
||||
gimp_layer_tree_view_paint_mode_menu_callback);
|
||||
UNBLOCK (view->priv->layer_mode_box,
|
||||
gimp_layer_tree_view_layer_mode_box_callback);
|
||||
|
||||
if (gimp_layer_get_lock_alpha (layer) !=
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view->priv->lock_alpha_toggle)))
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
#include "gimpiconpicker.h"
|
||||
#include "gimplanguagecombobox.h"
|
||||
#include "gimplanguageentry.h"
|
||||
#include "gimplayermodebox.h"
|
||||
#include "gimpscalebutton.h"
|
||||
#include "gimpspinscale.h"
|
||||
#include "gimpview.h"
|
||||
#include "gimppolar.h"
|
||||
#include "gimppropwidgets.h"
|
||||
#include "gimpwidgets-constructors.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
@ -142,106 +142,47 @@ gimp_prop_expanding_frame_new (GObject *config,
|
|||
}
|
||||
|
||||
|
||||
/*********************/
|
||||
/* paint mode menu */
|
||||
/*********************/
|
||||
|
||||
static void gimp_prop_paint_menu_callback (GtkWidget *widget,
|
||||
GObject *config);
|
||||
static void gimp_prop_paint_menu_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *menu);
|
||||
/********************/
|
||||
/* layer mode box */
|
||||
/********************/
|
||||
|
||||
/**
|
||||
* gimp_prop_paint_mode_menu_new:
|
||||
* gimp_prop_layer_mode_box_new:
|
||||
* @config: #GimpConfig object to which property is attached.
|
||||
* @property_name: Name of Enum property.
|
||||
* @with_behind_mode: Whether to include "Behind" mode in the menu.
|
||||
* @with_replace_modes: Whether to include the "Replace", "Erase" and
|
||||
* "Anti Erase" modes in the menu.
|
||||
*
|
||||
* Creates a #GimpPaintModeMenu widget to display and set the specified
|
||||
* Enum property, for which the enum must be #GimpLayerModeEffects.
|
||||
* Creates a #GimpLayerModeBox widget to display and set the specified
|
||||
* Enum property, for which the enum must be #GimpLayerMode.
|
||||
*
|
||||
* Return value: The newly created #GimpPaintModeMenu widget.
|
||||
* Return value: The newly created #GimpLayerModeBox widget.
|
||||
*
|
||||
* Since GIMP 2.4
|
||||
*/
|
||||
GtkWidget *
|
||||
gimp_prop_paint_mode_menu_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gboolean with_behind_mode,
|
||||
gboolean with_replace_modes)
|
||||
gimp_prop_layer_mode_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gboolean with_behind_mode,
|
||||
gboolean with_replace_modes)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *menu;
|
||||
gint value;
|
||||
GtkWidget *box;
|
||||
|
||||
param_spec = check_param_spec_w (config, property_name,
|
||||
G_TYPE_PARAM_ENUM, G_STRFUNC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
box = gimp_layer_mode_box_new (with_behind_mode, with_replace_modes);
|
||||
|
||||
menu = gimp_paint_mode_menu_new (with_behind_mode, with_replace_modes);
|
||||
|
||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (menu),
|
||||
value,
|
||||
G_CALLBACK (gimp_prop_paint_menu_callback),
|
||||
config);
|
||||
|
||||
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_paint_menu_notify),
|
||||
menu);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_paint_menu_callback (GtkWidget *widget,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
gint value;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (widget));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value))
|
||||
{
|
||||
g_object_set (config,
|
||||
param_spec->name, value,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_paint_menu_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *menu)
|
||||
{
|
||||
gint value;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (menu,
|
||||
gimp_prop_paint_menu_callback,
|
||||
config);
|
||||
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (menu), value);
|
||||
|
||||
g_signal_handlers_unblock_by_func (menu,
|
||||
gimp_prop_paint_menu_callback,
|
||||
config);
|
||||
g_object_bind_property (config, property_name,
|
||||
G_OBJECT (box), "layer-mode",
|
||||
G_BINDING_BIDIRECTIONAL |
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ GtkWidget * gimp_prop_expanding_frame_new (GObject *config,
|
|||
|
||||
/* GParamEnum */
|
||||
|
||||
GtkWidget * gimp_prop_paint_mode_menu_new (GObject *config,
|
||||
GtkWidget * gimp_prop_layer_mode_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gboolean with_behind_mode,
|
||||
gboolean with_replace_modes);
|
||||
|
|
|
@ -31,188 +31,8 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static gboolean gimp_paint_mode_menu_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
static void
|
||||
gimp_enum_store_insert_value_after (GimpEnumStore *store,
|
||||
gint after,
|
||||
gint insert_value)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ENUM_STORE (store));
|
||||
|
||||
if (gimp_int_store_lookup_by_value (GTK_TREE_MODEL (store),
|
||||
after, &iter))
|
||||
{
|
||||
GEnumValue *enum_value;
|
||||
|
||||
enum_value = g_enum_get_value (store->enum_class, insert_value);
|
||||
|
||||
if (enum_value)
|
||||
{
|
||||
GtkTreeIter value_iter;
|
||||
const gchar *desc;
|
||||
|
||||
gtk_list_store_insert_after (GTK_LIST_STORE (store),
|
||||
&value_iter, &iter);
|
||||
|
||||
desc = gimp_enum_value_get_desc (store->enum_class, enum_value);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (store), &value_iter,
|
||||
GIMP_INT_STORE_VALUE, enum_value->value,
|
||||
GIMP_INT_STORE_LABEL, desc,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_int_store_insert_separator_after (GimpIntStore *store,
|
||||
gint after,
|
||||
gint separator_value)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
g_return_if_fail (GIMP_IS_INT_STORE (store));
|
||||
|
||||
if (gimp_int_store_lookup_by_value (GTK_TREE_MODEL (store),
|
||||
after, &iter))
|
||||
{
|
||||
GtkTreeIter sep_iter;
|
||||
|
||||
gtk_list_store_insert_after (GTK_LIST_STORE (store),
|
||||
&sep_iter, &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (store), &sep_iter,
|
||||
GIMP_INT_STORE_VALUE, separator_value,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_paint_mode_menu_new (gboolean with_behind_mode,
|
||||
gboolean with_replace_modes)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkWidget *combo;
|
||||
|
||||
store = gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_MODE,
|
||||
47,
|
||||
GIMP_LAYER_MODE_NORMAL,
|
||||
GIMP_LAYER_MODE_NORMAL_LINEAR,
|
||||
GIMP_LAYER_MODE_DISSOLVE,
|
||||
GIMP_LAYER_MODE_LIGHTEN_ONLY,
|
||||
GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,
|
||||
GIMP_LAYER_MODE_LUMINANCE_LIGHTEN_ONLY,
|
||||
GIMP_LAYER_MODE_SCREEN,
|
||||
GIMP_LAYER_MODE_SCREEN_LEGACY,
|
||||
GIMP_LAYER_MODE_DODGE,
|
||||
GIMP_LAYER_MODE_DODGE_LEGACY,
|
||||
GIMP_LAYER_MODE_ADDITION,
|
||||
GIMP_LAYER_MODE_ADDITION_LEGACY,
|
||||
GIMP_LAYER_MODE_DARKEN_ONLY,
|
||||
GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,
|
||||
GIMP_LAYER_MODE_LUMINANCE_DARKEN_ONLY,
|
||||
GIMP_LAYER_MODE_MULTIPLY,
|
||||
GIMP_LAYER_MODE_MULTIPLY_LINEAR,
|
||||
GIMP_LAYER_MODE_MULTIPLY_LEGACY,
|
||||
GIMP_LAYER_MODE_BURN,
|
||||
GIMP_LAYER_MODE_BURN_LEGACY,
|
||||
GIMP_LAYER_MODE_LINEAR_BURN,
|
||||
GIMP_LAYER_MODE_OVERLAY,
|
||||
GIMP_LAYER_MODE_SOFTLIGHT,
|
||||
GIMP_LAYER_MODE_SOFTLIGHT_LEGACY,
|
||||
GIMP_LAYER_MODE_HARDLIGHT,
|
||||
GIMP_LAYER_MODE_HARDLIGHT_LEGACY,
|
||||
GIMP_LAYER_MODE_VIVID_LIGHT,
|
||||
GIMP_LAYER_MODE_PIN_LIGHT,
|
||||
GIMP_LAYER_MODE_LINEAR_LIGHT,
|
||||
GIMP_LAYER_MODE_DIFFERENCE,
|
||||
GIMP_LAYER_MODE_DIFFERENCE_LEGACY,
|
||||
GIMP_LAYER_MODE_SUBTRACT,
|
||||
GIMP_LAYER_MODE_SUBTRACT_LEGACY,
|
||||
GIMP_LAYER_MODE_EXCLUSION,
|
||||
GIMP_LAYER_MODE_GRAIN_EXTRACT,
|
||||
GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY,
|
||||
GIMP_LAYER_MODE_GRAIN_MERGE,
|
||||
GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY,
|
||||
GIMP_LAYER_MODE_DIVIDE,
|
||||
GIMP_LAYER_MODE_DIVIDE_LEGACY,
|
||||
GIMP_LAYER_MODE_HSV_HUE,
|
||||
GIMP_LAYER_MODE_HSV_SATURATION,
|
||||
GIMP_LAYER_MODE_HSV_COLOR,
|
||||
GIMP_LAYER_MODE_HSV_VALUE,
|
||||
GIMP_LAYER_MODE_HSV_HUE_LEGACY,
|
||||
GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,
|
||||
GIMP_LAYER_MODE_HSV_COLOR_LEGACY,
|
||||
GIMP_LAYER_MODE_HSV_VALUE_LEGACY,
|
||||
GIMP_LAYER_MODE_LCH_HUE,
|
||||
GIMP_LAYER_MODE_LCH_CHROMA,
|
||||
GIMP_LAYER_MODE_LCH_COLOR,
|
||||
GIMP_LAYER_MODE_LCH_LIGHTNESS);
|
||||
|
||||
gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),
|
||||
GIMP_LAYER_MODE_DISSOLVE, -1);
|
||||
|
||||
gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),
|
||||
GIMP_LAYER_MODE_ADDITION_LEGACY, -1);
|
||||
|
||||
gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),
|
||||
GIMP_LAYER_MODE_LINEAR_BURN, -1);
|
||||
|
||||
gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),
|
||||
GIMP_LAYER_MODE_LINEAR_LIGHT, -1);
|
||||
|
||||
gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),
|
||||
GIMP_LAYER_MODE_DIVIDE_LEGACY, -1);
|
||||
|
||||
gimp_int_store_insert_separator_after (GIMP_INT_STORE (store),
|
||||
GIMP_LAYER_MODE_HSV_VALUE_LEGACY, -1);
|
||||
|
||||
if (with_behind_mode)
|
||||
{
|
||||
gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
|
||||
GIMP_LAYER_MODE_DISSOLVE,
|
||||
GIMP_LAYER_MODE_BEHIND);
|
||||
gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
|
||||
GIMP_LAYER_MODE_BEHIND,
|
||||
GIMP_LAYER_MODE_BEHIND_LINEAR);
|
||||
gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
|
||||
GIMP_LAYER_MODE_BEHIND_LINEAR,
|
||||
GIMP_LAYER_MODE_COLOR_ERASE);
|
||||
}
|
||||
|
||||
if (with_replace_modes)
|
||||
{
|
||||
gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
|
||||
GIMP_LAYER_MODE_NORMAL_LINEAR,
|
||||
GIMP_LAYER_MODE_REPLACE);
|
||||
gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
|
||||
GIMP_LAYER_MODE_COLOR_ERASE,
|
||||
GIMP_LAYER_MODE_ERASE);
|
||||
gimp_enum_store_insert_value_after (GIMP_ENUM_STORE (store),
|
||||
GIMP_LAYER_MODE_ERASE,
|
||||
GIMP_LAYER_MODE_ANTI_ERASE);
|
||||
}
|
||||
|
||||
combo = gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
|
||||
g_object_unref (store);
|
||||
|
||||
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
|
||||
gimp_paint_mode_menu_separator_func,
|
||||
GINT_TO_POINTER (-1),
|
||||
NULL);
|
||||
|
||||
return combo;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_icon_button_new (const gchar *icon_name,
|
||||
const gchar *label)
|
||||
|
@ -281,18 +101,3 @@ gimp_color_profile_label_new (GimpColorProfile *profile)
|
|||
|
||||
return expander;
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
gimp_paint_mode_menu_separator_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
gint value;
|
||||
|
||||
gtk_tree_model_get (model, iter, GIMP_INT_STORE_VALUE, &value, -1);
|
||||
|
||||
return value == GPOINTER_TO_INT (data);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
#define __GIMP_WIDGETS_CONSTRUCTORS_H__
|
||||
|
||||
|
||||
GtkWidget * gimp_paint_mode_menu_new (gboolean with_behind_mode,
|
||||
gboolean with_replace_modes);
|
||||
|
||||
GtkWidget * gimp_icon_button_new (const gchar *icon_name,
|
||||
const gchar *label);
|
||||
|
||||
|
|
Loading…
Reference in New Issue