summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAlexander Valavanis <valavanisalex@gmail.com>2017-06-29 11:43:56 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2017-06-29 11:43:56 +0000
commit22d06152d0fabc7fe50bb6829f00b2bac4ed1796 (patch)
tree9c6a9e59aedecd67f2a5e1a83d3c6c0b8541069a /src/widgets
parentRevert "color wheel: Temp fix for Gtk+ style properties" (diff)
downloadinkscape-22d06152d0fabc7fe50bb6829f00b2bac4ed1796.tar.gz
inkscape-22d06152d0fabc7fe50bb6829f00b2bac4ed1796.zip
Remove old icon handling code
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/CMakeLists.txt2
-rw-r--r--src/widgets/arc-toolbar.cpp2
-rw-r--r--src/widgets/box3d-toolbar.cpp6
-rw-r--r--src/widgets/button.cpp12
-rw-r--r--src/widgets/button.h6
-rw-r--r--src/widgets/calligraphy-toolbar.cpp8
-rw-r--r--src/widgets/connector-toolbar.cpp8
-rw-r--r--src/widgets/desktop-widget.cpp7
-rw-r--r--src/widgets/dropper-toolbar.cpp4
-rw-r--r--src/widgets/ege-adjustment-action.cpp15
-rw-r--r--src/widgets/eraser-toolbar.cpp4
-rw-r--r--src/widgets/gradient-selector.cpp3
-rw-r--r--src/widgets/gradient-toolbar.cpp4
-rw-r--r--src/widgets/icon.cpp1651
-rw-r--r--src/widgets/icon.h71
-rw-r--r--src/widgets/ink-action.cpp45
-rw-r--r--src/widgets/ink-action.h2
-rw-r--r--src/widgets/ink-radio-action.cpp18
-rw-r--r--src/widgets/ink-radio-action.h4
-rw-r--r--src/widgets/ink-toggle-action.cpp15
-rw-r--r--src/widgets/ink-toggle-action.h2
-rw-r--r--src/widgets/ink-tool-menu-action.cpp2
-rw-r--r--src/widgets/ink-tool-menu-action.h2
-rw-r--r--src/widgets/lpe-toolbar.cpp8
-rw-r--r--src/widgets/measure-toolbar.cpp2
-rw-r--r--src/widgets/mesh-toolbar.cpp2
-rw-r--r--src/widgets/node-toolbar.cpp2
-rw-r--r--src/widgets/paint-selector.cpp7
-rw-r--r--src/widgets/paintbucket-toolbar.cpp2
-rw-r--r--src/widgets/pencil-toolbar.cpp8
-rw-r--r--src/widgets/rect-toolbar.cpp2
-rw-r--r--src/widgets/select-toolbar.cpp9
-rw-r--r--src/widgets/spiral-toolbar.cpp2
-rw-r--r--src/widgets/spray-toolbar.cpp8
-rw-r--r--src/widgets/star-toolbar.cpp4
-rw-r--r--src/widgets/stroke-marker-selector.cpp9
-rw-r--r--src/widgets/stroke-style.cpp5
-rw-r--r--src/widgets/stroke-style.h1
-rw-r--r--src/widgets/text-toolbar.cpp2
-rw-r--r--src/widgets/toolbox.cpp34
-rw-r--r--src/widgets/toolbox.h2
-rw-r--r--src/widgets/tweak-toolbar.cpp12
42 files changed, 120 insertions, 1894 deletions
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 1184291f2..089d68b4e 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -21,7 +21,6 @@ set(widgets_SRC
gradient-selector.cpp
gradient-toolbar.cpp
gradient-vector.cpp
- icon.cpp
ink-action.cpp
ink-comboboxentry-action.cpp
ink-radio-action.cpp
@@ -78,7 +77,6 @@ set(widgets_SRC
gradient-selector.h
gradient-toolbar.h
gradient-vector.h
- icon.h
ink-action.h
ink-comboboxentry-action.h
ink-radio-action.h
diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp
index 56eeb8922..23e1eba1a 100644
--- a/src/widgets/arc-toolbar.cpp
+++ b/src/widgets/arc-toolbar.cpp
@@ -318,7 +318,7 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
EgeAdjustmentAction* eact = 0;
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp
index 95de28cf2..29a447afd 100644
--- a/src/widgets/box3d-toolbar.cpp
+++ b/src/widgets/box3d-toolbar.cpp
@@ -325,7 +325,7 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject
_("State of VP in X direction"),
_("Toggle VP in X direction between 'finite' and 'infinite' (=parallel)"),
INKSCAPE_ICON("perspective-parallel"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_object_set_data( holder, "box3d_vp_x_state_action", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_x_state_changed), box3d_angle_x );
@@ -364,7 +364,7 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject
_("State of VP in Y direction"),
_("Toggle VP in Y direction between 'finite' and 'infinite' (=parallel)"),
INKSCAPE_ICON("perspective-parallel"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_object_set_data( holder, "box3d_vp_y_state_action", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_y_state_changed), box3d_angle_y );
@@ -403,7 +403,7 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject
_("State of VP in Z direction"),
_("Toggle VP in Z direction between 'finite' and 'infinite' (=parallel)"),
INKSCAPE_ICON("perspective-parallel"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_object_set_data( holder, "box3d_vp_z_state_action", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(box3d_vp_z_state_changed), box3d_angle_z );
diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp
index 485300a25..7dcfc9771 100644
--- a/src/widgets/button.cpp
+++ b/src/widgets/button.cpp
@@ -12,7 +12,6 @@
*/
#include <glibmm.h>
-#include "icon.h"
#include "button.h"
#include "helper/action-context.h"
@@ -155,12 +154,12 @@ static void sp_button_perform_action(SPButton *button, gpointer /*data*/)
}
}
-GtkWidget *sp_button_new(Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action)
+GtkWidget *sp_button_new(GtkIconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action)
{
SPButton *button = SP_BUTTON(g_object_new(SP_TYPE_BUTTON, NULL));
button->type = type;
- button->lsize = CLAMP(size, Inkscape::ICON_SIZE_MENU, Inkscape::ICON_SIZE_DECORATION);
+ button->lsize = CLAMP(size, GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_DIALOG);
sp_button_set_action(button, action);
if (doubleclick_action)
@@ -212,7 +211,7 @@ static void sp_button_set_action(SPButton *button, SPAction *action)
button->c_set_sensitive = action->signal_set_sensitive.connect(
sigc::bind<0>(sigc::ptr_fun(&gtk_widget_set_sensitive), GTK_WIDGET(button)));
if (action->image) {
- child = sp_icon_new(button->lsize, action->image);
+ child = gtk_image_new_from_icon_name(action->image, button->lsize);
gtk_widget_show(child);
gtk_container_add(GTK_CONTAINER(button), child);
}
@@ -256,12 +255,11 @@ static void sp_button_set_composed_tooltip(GtkWidget *widget, SPAction *action)
}
}
-GtkWidget *sp_button_new_from_data(Inkscape::IconSize size, SPButtonType type, Inkscape::UI::View::View *view,
+GtkWidget *sp_button_new_from_data(GtkIconSize size, SPButtonType type, Inkscape::UI::View::View *view,
const gchar *name, const gchar *tip)
{
- GtkWidget *button;
SPAction *action = sp_action_new(Inkscape::ActionContext(view), name, name, tip, name, 0);
- button = sp_button_new(size, type, action, NULL);
+ GtkWidget *button = sp_button_new(size, type, action, NULL);
g_object_unref(action);
return button;
}
diff --git a/src/widgets/button.h b/src/widgets/button.h
index 2bceb5e97..94a956de3 100644
--- a/src/widgets/button.h
+++ b/src/widgets/button.h
@@ -42,7 +42,7 @@ struct SPBChoiceData {
struct SPButton {
GtkToggleButton widget;
SPButtonType type;
- Inkscape::IconSize lsize;
+ GtkIconSize lsize;
unsigned int psize;
SPAction *action;
SPAction *doubleclick_action;
@@ -59,11 +59,11 @@ struct SPButtonClass {
GType sp_button_get_type (void);
-GtkWidget *sp_button_new (Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action);
+GtkWidget *sp_button_new (GtkIconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action);
void sp_button_toggle_set_down (SPButton *button, gboolean down);
-GtkWidget *sp_button_new_from_data (Inkscape::IconSize size,
+GtkWidget *sp_button_new_from_data (GtkIconSize size,
SPButtonType type,
Inkscape::UI::View::View *view,
const gchar *name,
diff --git a/src/widgets/calligraphy-toolbar.cpp b/src/widgets/calligraphy-toolbar.cpp
index 031295ccd..7dabee11b 100644
--- a/src/widgets/calligraphy-toolbar.cpp
+++ b/src/widgets/calligraphy-toolbar.cpp
@@ -565,7 +565,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
_("Trace Background"),
_("Trace the lightness of the background by the width of the pen (white - minimum width, black - maximum width)"),
INKSCAPE_ICON("draw-trace-background"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/tracebackground", update_presets_list, holder);
g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
@@ -578,7 +578,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
_("Pressure"),
_("Use the pressure of the input device to alter the width of the pen"),
INKSCAPE_ICON("draw-use-pressure"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/usepressure", update_presets_list, holder);
g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
@@ -591,7 +591,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
_("Tilt"),
_("Use the tilt of the input device to alter the angle of the pen's nib"),
INKSCAPE_ICON("draw-use-tilt"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/calligraphic/usetilt", update_presets_list, holder);
g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
@@ -622,7 +622,7 @@ void sp_calligraphy_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
_("Add/Edit Profile"),
_("Add or edit calligraphic profile"),
INKSCAPE_ICON("document-properties"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
g_object_set( inky, "short_label", _("Edit"), NULL );
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_ddc_edit_profile), (GObject*)holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp
index a078ecec4..9c4980f4c 100644
--- a/src/widgets/connector-toolbar.cpp
+++ b/src/widgets/connector-toolbar.cpp
@@ -299,7 +299,7 @@ static void sp_connector_toolbox_selection_changed(Inkscape::Selection *selectio
void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
InkAction* inky = ink_action_new( "ConnectorAvoidAction",
@@ -327,7 +327,7 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
_("Orthogonal"),
_("Make connector orthogonal or polyline"),
INKSCAPE_ICON("connector-orthogonal"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
bool tbuttonstate = prefs->getBool("/tools/connector/orthogonal");
@@ -388,7 +388,7 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
_("Downwards"),
_("Make connectors with end-markers (arrows) point downwards"),
INKSCAPE_ICON("distribute-graph-directed"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
bool tbuttonstate = prefs->getBool("/tools/connector/directedlayout");
@@ -404,7 +404,7 @@ void sp_connector_toolbox_prep( SPDesktop *desktop, GtkActionGroup* mainActions,
_("Remove overlaps"),
_("Do not allow overlapping shapes"),
INKSCAPE_ICON("distribute-remove-overlaps"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
bool tbuttonstate = prefs->getBool("/tools/connector/avoidoverlaplayout");
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index ce4c5936c..2479fa453 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -351,7 +351,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
ToolboxFactory::setOrientation( dtw->tool_toolbox, GTK_ORIENTATION_VERTICAL );
gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->tool_toolbox, FALSE, TRUE, 0 );
// Lock guides button
- dtw->guides_lock = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION,
+ dtw->guides_lock = sp_button_new_from_data( GTK_ICON_SIZE_MENU,
SP_BUTTON_TYPE_TOGGLE,
NULL,
INKSCAPE_ICON("object-locked"),
@@ -410,7 +410,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->vscrollbar_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
// Sticky zoom button
- dtw->sticky_zoom = sp_button_new_from_data ( Inkscape::ICON_SIZE_DECORATION,
+ dtw->sticky_zoom = sp_button_new_from_data ( GTK_ICON_SIZE_MENU,
SP_BUTTON_TYPE_TOGGLE,
NULL,
INKSCAPE_ICON("zoom-original"),
@@ -435,7 +435,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
tip = act->tip;
}
}
- dtw->cms_adjust = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION,
+ dtw->cms_adjust = sp_button_new_from_data( GTK_ICON_SIZE_MENU,
SP_BUTTON_TYPE_TOGGLE,
NULL,
INKSCAPE_ICON("color-management"),
@@ -543,7 +543,6 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->layer_selector = new Inkscape::Widgets::LayerSelector(NULL);
// FIXME: need to unreference on container destruction to avoid leak
dtw->layer_selector->reference();
- //dtw->layer_selector->set_size_request(-1, SP_ICON_SIZE_BUTTON);
gtk_box_pack_start(GTK_BOX(dtw->statusbar), GTK_WIDGET(dtw->layer_selector->gobj()), FALSE, FALSE, 1);
// Select Status
diff --git a/src/widgets/dropper-toolbar.cpp b/src/widgets/dropper-toolbar.cpp
index 4e26a99a0..7a9cf1779 100644
--- a/src/widgets/dropper-toolbar.cpp
+++ b/src/widgets/dropper-toolbar.cpp
@@ -90,7 +90,7 @@ void sp_dropper_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainAction
_("Pick opacity"),
_("Pick both the color and the alpha (transparency) under cursor; otherwise, pick only the visible color premultiplied by alpha"),
NULL,
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
g_object_set( act, "short_label", _("Pick"), NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_object_set_data( holder, "pick_action", act );
@@ -103,7 +103,7 @@ void sp_dropper_toolbox_prep(SPDesktop * /*desktop*/, GtkActionGroup* mainAction
_("Assign opacity"),
_("If alpha was picked, assign it to selection as fill or stroke transparency"),
NULL,
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
g_object_set( act, "short_label", _("Assign"), NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_object_set_data( holder, "set_action", act );
diff --git a/src/widgets/ege-adjustment-action.cpp b/src/widgets/ege-adjustment-action.cpp
index 6678d1e5a..e4f041bd1 100644
--- a/src/widgets/ege-adjustment-action.cpp
+++ b/src/widgets/ege-adjustment-action.cpp
@@ -42,7 +42,6 @@
#include <cmath>
#include <string.h>
-#include "widgets/icon.h"
#include <gdk/gdkkeysyms.h>
#include "icon-size.h"
@@ -115,7 +114,7 @@ struct _EgeAdjustmentActionPrivate
GList* descriptions;
gchar* appearance;
gchar* iconId;
- Inkscape::IconSize iconSize;
+ GtkIconSize iconSize;
Inkscape::UI::Widget::UnitTracker *unitTracker;
};
@@ -232,9 +231,9 @@ static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass )
g_param_spec_int( "iconSize",
"Icon Size",
"The size the icon",
- (int)Inkscape::ICON_SIZE_MENU,
- (int)Inkscape::ICON_SIZE_DECORATION,
- (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR,
+ (int)GTK_ICON_SIZE_MENU,
+ (int)GTK_ICON_SIZE_DIALOG,
+ (int)GTK_ICON_SIZE_SMALL_TOOLBAR,
(GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
g_object_class_install_property( objClass,
@@ -272,7 +271,7 @@ static void ege_adjustment_action_init( EgeAdjustmentAction* action )
action->private_data->descriptions = 0;
action->private_data->appearance = 0;
action->private_data->iconId = 0;
- action->private_data->iconSize = Inkscape::ICON_SIZE_SMALL_TOOLBAR;
+ action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR;
action->private_data->unitTracker = NULL;
}
@@ -463,7 +462,7 @@ void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValu
case PROP_ICON_SIZE:
{
- action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ action->private_data->iconSize = (GtkIconSize)g_value_get_int( value );
}
break;
@@ -857,7 +856,7 @@ static GtkWidget* create_tool_item( GtkAction* action )
/* Use an icon if available or use short-label */
if ( act->private_data->iconId && strcmp( act->private_data->iconId, "" ) != 0 ) {
- GtkWidget* icon = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
+ GtkWidget* icon = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize );
gtk_box_pack_start( GTK_BOX(hb), icon, FALSE, FALSE, 0 );
} else {
GtkWidget* lbl = gtk_label_new( g_value_get_string( &value ) ? g_value_get_string( &value ) : "wwww" );
diff --git a/src/widgets/eraser-toolbar.cpp b/src/widgets/eraser-toolbar.cpp
index 7377cdc00..b592b8ace 100644
--- a/src/widgets/eraser-toolbar.cpp
+++ b/src/widgets/eraser-toolbar.cpp
@@ -134,7 +134,7 @@ static void sp_toogle_break_apart( GtkToggleAction* act, gpointer data )
void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gint eraser_mode = FALSE;
{
@@ -202,7 +202,7 @@ void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
_("Eraser Pressure"),
_("Use the pressure of the input device to alter the width of the pen"),
INKSCAPE_ICON("draw-use-pressure"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/eraser/usepressure", update_presets_list, holder);
g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp
index 569f66c2b..99ef9f19b 100644
--- a/src/widgets/gradient-selector.cpp
+++ b/src/widgets/gradient-selector.cpp
@@ -29,7 +29,6 @@
#include "verbs.h"
#include "helper/action.h"
#include "preferences.h"
-#include "widgets/icon.h"
#include <glibmm/i18n.h>
@@ -98,7 +97,7 @@ static void sp_gradient_selector_class_init(SPGradientSelectorClass *klass)
static void gradsel_style_button(GtkWidget *gtkbtn, char const *iconName)
{
Gtk::Button *btn = Glib::wrap(GTK_BUTTON(gtkbtn));
- GtkWidget *child = sp_icon_new(Inkscape::ICON_SIZE_SMALL_TOOLBAR, iconName);
+ GtkWidget *child = gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_widget_show(child);
btn->add(*manage(Glib::wrap(child)));
btn->set_relief(Gtk::RELIEF_NONE);
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index 8474327ca..196264315 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -1026,7 +1026,7 @@ static void gradient_toolbox_check_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBa
*/
void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
/* New gradient linear or radial */
{
@@ -1221,7 +1221,7 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
_("Link gradients"),
_("Link gradients to change all related gradients"),
INKSCAPE_ICON("object-unlocked"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
g_object_set( itact, "short_label", "Lock", NULL );
g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(gr_linked_changed), desktop) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
deleted file mode 100644
index 885deaab7..000000000
--- a/src/widgets/icon.cpp
+++ /dev/null
@@ -1,1651 +0,0 @@
-/** \file
- * SPIcon: Generic icon widget
- */
-/*
- * Author:
- * Lauris Kaplinski <lauris@kaplinski.com>
- * Jon A. Cruz <jon@joncruz.org>
- * Abhishek Sharma
- *
- * Copyright (C) 2002 Lauris Kaplinski
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <glibmm/fileutils.h>
-#include <glibmm/miscutils.h>
-#include <gtkmm/icontheme.h>
-#include <cstring>
-#include <glib/gstdio.h>
-#include <gtk/gtk.h>
-#include <gtkmm/image.h>
-#include <2geom/transforms.h>
-
-#include "path-prefix.h"
-#include "preferences.h"
-#include "inkscape.h"
-#include "document.h"
-#include "display/cairo-utils.h"
-#include "display/drawing-context.h"
-#include "display/drawing-item.h"
-#include "display/drawing.h"
-#include "io/sys.h"
-#include "sp-root.h"
-#include "sp-namedview.h"
-#include "util/units.h"
-
-#include "icon.h"
-#include "ui/icon-names.h"
-
-struct IconImpl {
- static GtkWidget *newFull( Inkscape::IconSize lsize, gchar const *name );
-
- static void dispose(GObject *object);
-
- static void reset(SPIcon *icon);
- static void clear(SPIcon *icon);
-
- static void sizeRequest(GtkWidget *widget, GtkRequisition *requisition);
-
- static void getPreferredWidth(GtkWidget *widget,
- gint *minimal_width,
- gint *natural_width);
-
- static void getPreferredHeight(GtkWidget *widget,
- gint *minimal_height,
- gint *natural_height);
-
- static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation);
- static gboolean draw(GtkWidget *widget, cairo_t *cr);
-
- static void screenChanged( GtkWidget *widget, GdkScreen *previous_screen );
- static void styleSet( GtkWidget *widget, GtkStyle *previous_style );
- static void themeChanged( SPIcon *icon );
-
- static int getPhysSize(int size);
- static void fetchPixbuf( SPIcon *icon );
-
- static gboolean prerenderTask(gpointer data);
- static void addPreRender( GtkIconSize lsize, gchar const *name );
- static GdkPixbuf* renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize );
-
-
- static GdkPixbuf *loadPixmap(gchar const *name, unsigned lsize, unsigned psize);
- static GdkPixbuf *loadSvg(std::list<Glib::ustring> const &names, GtkIconSize lsize, unsigned psize);
-
- static void overlayPixels( guchar *px, int width, int height, int stride,
- unsigned r, unsigned g, unsigned b );
-
- static void injectCustomSize();
-
- static void imageMapCB(GtkWidget* widget, gpointer user_data);
- static void imageMapNamedCB(GtkWidget* widget, gpointer user_data);
- static bool prerenderIcon(gchar const *name, GtkIconSize lsize, unsigned psize);
-
-
- static std::list<gchar*> &icons_svg_paths();
- static guchar *load_svg_pixels(std::list<Glib::ustring> const &names,
- unsigned psize, unsigned &stride);
-
- static std::string fileEscape( std::string const & str );
-
- static void validateCache();
- static void setupLegacyNaming();
-
-private:
- static const std::string magicNumber;
- static std::map<Glib::ustring, Glib::ustring> legacyNames;
-};
-
-const std::string IconImpl::magicNumber = "1.0";
-std::map<Glib::ustring, Glib::ustring> IconImpl::legacyNames;
-
-
-static bool sizeDirty = true;
-
-static bool sizeMapDone = false;
-static GtkIconSize iconSizeLookup[] = {
- GTK_ICON_SIZE_INVALID,
- GTK_ICON_SIZE_MENU,
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- GTK_ICON_SIZE_LARGE_TOOLBAR,
- GTK_ICON_SIZE_BUTTON,
- GTK_ICON_SIZE_DND,
- GTK_ICON_SIZE_DIALOG,
- GTK_ICON_SIZE_MENU, // for Inkscape::ICON_SIZE_DECORATION
-};
-
-class IconCacheItem
-{
-public:
- IconCacheItem( GtkIconSize lsize, GdkPixbuf* pb ) :
- _lsize( lsize ),
- _pb( pb )
- {}
- GtkIconSize _lsize;
- GdkPixbuf* _pb;
-};
-
-static std::map<Glib::ustring, std::vector<IconCacheItem> > iconSetCache;
-static std::set<Glib::ustring> internalNames;
-
-G_DEFINE_TYPE(SPIcon, sp_icon, GTK_TYPE_WIDGET);
-
-static void
-sp_icon_class_init(SPIconClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
- object_class->dispose = IconImpl::dispose;
-
- widget_class->get_preferred_width = IconImpl::getPreferredWidth;
- widget_class->get_preferred_height = IconImpl::getPreferredHeight;
- widget_class->draw = IconImpl::draw;
- widget_class->size_allocate = IconImpl::sizeAllocate;
- widget_class->screen_changed = IconImpl::screenChanged;
- widget_class->style_set = IconImpl::styleSet;
-}
-
-static void
-sp_icon_init(SPIcon *icon)
-{
- gtk_widget_set_has_window (GTK_WIDGET (icon), FALSE);
- icon->lsize = Inkscape::ICON_SIZE_BUTTON;
- icon->psize = 0;
- icon->name = NULL;
- icon->pb = NULL;
-}
-
-void IconImpl::dispose(GObject *object)
-{
- SPIcon *icon = SP_ICON(object);
- clear(icon);
- if ( icon->name ) {
- g_free( icon->name );
- icon->name = NULL;
- }
-
- (G_OBJECT_CLASS(sp_icon_parent_class))->dispose(object);
-}
-
-void IconImpl::reset( SPIcon *icon )
-{
- icon->psize = 0;
- clear(icon);
-}
-
-void IconImpl::clear( SPIcon *icon )
-{
- if (icon->pb) {
- g_object_unref(G_OBJECT(icon->pb));
- icon->pb = NULL;
- }
-}
-
-void IconImpl::sizeRequest(GtkWidget *widget, GtkRequisition *requisition)
-{
- SPIcon const *icon = SP_ICON(widget);
-
- int const size = ( icon->psize
- ? icon->psize
- : getPhysSize(icon->lsize) );
- requisition->width = size;
- requisition->height = size;
-}
-
-void IconImpl::getPreferredWidth(GtkWidget *widget, gint *minimal_width, gint *natural_width)
-{
- GtkRequisition requisition;
- sizeRequest(widget, &requisition);
- *minimal_width = *natural_width = requisition.width;
-}
-
-void IconImpl::getPreferredHeight(GtkWidget *widget, gint *minimal_height, gint *natural_height)
-{
- GtkRequisition requisition;
- sizeRequest(widget, &requisition);
- *minimal_height = *natural_height = requisition.height;
-}
-
-void IconImpl::sizeAllocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- gtk_widget_set_allocation(widget, allocation);
-
- if (gtk_widget_is_drawable(widget)) {
- gtk_widget_queue_draw(widget);
- }
-}
-
-// GTK3 Only, Doesn't actually seem to be used.
-gboolean IconImpl::draw(GtkWidget *widget, cairo_t* cr)
-{
- SPIcon *icon = SP_ICON(widget);
- if ( !icon->pb ) {
- fetchPixbuf( icon );
- }
-
- GdkPixbuf *image = icon->pb;
- bool unref_image = false;
-
- /* copied from the expose function of GtkImage */
- if (gtk_widget_get_state_flags (GTK_WIDGET(icon)) != GTK_STATE_FLAG_NORMAL && image) {
- std::cerr << "IconImpl::draw: No image, creating fallback" << std::endl;
-
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
- image = gtk_icon_theme_load_icon (icon_theme,
- "gtk-image",
- 32,
- (GtkIconLookupFlags)0,
- NULL);
-
- unref_image = true;
- }
-
- if (image) {
- GtkAllocation allocation;
- GtkRequisition requisition;
- gtk_widget_get_allocation(widget, &allocation);
- gtk_widget_get_preferred_size(widget, &requisition, NULL);
-
- int x = floor(allocation.x + ((allocation.width - requisition.width) * 0.5));
- int y = floor(allocation.y + ((allocation.height - requisition.height) * 0.5));
- int width = gdk_pixbuf_get_width(image);
- int height = gdk_pixbuf_get_height(image);
- // Limit drawing to when we actually have something. Avoids some crashes.
- if ( (width > 0) && (height > 0) ) {
- gdk_cairo_set_source_pixbuf(cr, image, x, y);
- cairo_paint(cr);
- }
- }
-
- if (unref_image) {
- g_object_unref(G_OBJECT(image));
- }
-
- return TRUE;
-}
-
-// PUBLIC CALL:
-void sp_icon_fetch_pixbuf( SPIcon *icon )
-{
- return IconImpl::fetchPixbuf(icon);
-}
-
-void IconImpl::fetchPixbuf( SPIcon *icon )
-{
- if ( icon ) {
- if ( !icon->pb ) {
- icon->psize = getPhysSize(icon->lsize);
- icon->pb = renderup(icon->name, icon->lsize, icon->psize);
- }
- }
-}
-
-GdkPixbuf* IconImpl::renderup( gchar const* name, Inkscape::IconSize lsize, unsigned psize ) {
- GtkIconTheme *theme = gtk_icon_theme_get_default();
-
- GdkPixbuf *pb = NULL;
- if (gtk_icon_theme_has_icon(theme, name)) {
- pb = gtk_icon_theme_load_icon(theme, name, psize, (GtkIconLookupFlags) 0, NULL);
- }
- if (!pb) {
- std::list<Glib::ustring> names;
- names.push_back(name);
- if ( legacyNames.find(name) != legacyNames.end() ) {
- if ( Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg") ) {
- g_message("Checking fallback [%s]->[%s]", name, legacyNames[name].c_str());
- }
- names.push_back(legacyNames[name]);
- }
-
- pb = loadSvg( names, Inkscape::getRegisteredIconSize(lsize), psize );
-
- // if this was loaded from SVG, add it as a builtin icon
- if (pb) {
- gtk_icon_theme_add_builtin_icon(name, psize, pb);
- }
- }
- if (!pb) {
- pb = loadPixmap( name, lsize, psize );
- }
- if ( !pb ) {
- // TODO: We should do something more useful if we can't load the image.
- g_warning ("failed to load icon '%s'", name);
- }
- return pb;
-}
-
-void IconImpl::screenChanged( GtkWidget *widget, GdkScreen *previous_screen )
-{
- if ( GTK_WIDGET_CLASS( sp_icon_parent_class )->screen_changed ) {
- GTK_WIDGET_CLASS( sp_icon_parent_class )->screen_changed( widget, previous_screen );
- }
- SPIcon *icon = SP_ICON(widget);
- themeChanged(icon);
-}
-
-void IconImpl::styleSet( GtkWidget *widget, GtkStyle *previous_style )
-{
- if ( GTK_WIDGET_CLASS( sp_icon_parent_class )->style_set ) {
- GTK_WIDGET_CLASS( sp_icon_parent_class )->style_set( widget, previous_style );
- }
- SPIcon *icon = SP_ICON(widget);
- themeChanged(icon);
-}
-
-void IconImpl::themeChanged( SPIcon *icon )
-{
- bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg");
- if ( dump ) {
- g_message("Got a change bump for this icon");
- }
- sizeDirty = true;
- reset(icon);
- gtk_widget_queue_draw( GTK_WIDGET(icon) );
-}
-
-std::string IconImpl::fileEscape( std::string const & str )
-{
- std::string result;
- result.reserve(str.size());
- for ( size_t i = 0; i < str.size(); ++i ) {
- char ch = str[i];
- if ( (0x20 <= ch) && !(0x80 & ch) ) {
- result += ch;
- } else {
- result += "\\x";
- gchar *tmp = g_strdup_printf("%02X", (0x0ff & ch));
- result += tmp;
- g_free(tmp);
- }
- }
- return result;
-}
-
-static bool isSizedSubdir( std::string const &name )
-{
- bool isSized = false;
- if ( (name.size() > 2) && (name.size() & 1) ) { // needs to be an odd length 3 or more
- size_t mid = (name.size() - 1) / 2;
- if ( (name[mid] == 'x') && (name.substr(0, mid) == name.substr(mid + 1)) ) {
- isSized = true;
- for ( size_t i = 0; (i < mid) && isSized; ++i ) {
- isSized &= g_ascii_isdigit(name[i]);
- }
- }
- }
- return isSized;
-}
-
-void IconImpl::validateCache()
-{
- std::list<gchar *> &sources = icons_svg_paths();
- std::string iconCacheDir = Glib::build_filename(Glib::build_filename(Glib::get_user_cache_dir(), "inkscape"), "icons");
- std::string iconCacheFile = Glib::build_filename( iconCacheDir, "cache.info" );
-
- std::vector<std::string> filesFound;
-
- for (std::list<gchar*>::iterator i = sources.begin(); i != sources.end(); ++i) {
- gchar const* potentialFile = *i;
- if ( Glib::file_test(potentialFile, Glib::FILE_TEST_EXISTS) && Glib::file_test(potentialFile, Glib::FILE_TEST_IS_REGULAR) ) {
- filesFound.push_back(*i);
- }
- }
-
- unsigned long lastSeen = 0;
- std::ostringstream out;
- out << "Inkscape cache v" << std::hex << magicNumber << std::dec << std::endl;
- out << "Sourcefiles: " << filesFound.size() << std::endl;
- for ( std::vector<std::string>::iterator it = filesFound.begin(); it != filesFound.end(); ++it ) {
- GStatBuf st;
- memset(&st, 0, sizeof(st));
- if ( !g_stat(it->c_str(), &st) ) {
- unsigned long when = st.st_mtime;
- lastSeen = std::max(lastSeen, when);
- out << std::hex << when << std::dec << " " << fileEscape(*it) << std::endl;
- } else {
- out << "0 " << fileEscape(*it) << std::endl;
- }
- }
- std::string wanted = out.str();
-
- std::string present;
- {
- gchar *contents = NULL;
- if ( g_file_get_contents(iconCacheFile.c_str(), &contents, 0, 0) ) {
- if ( contents ) {
- present = contents;
- }
- g_free(contents);
- contents = NULL;
- }
- }
- bool cacheValid = (present == wanted);
-
- if ( cacheValid ) {
- // Check if any cached rasters are out of date
- Glib::Dir dir(iconCacheDir);
- for ( Glib::DirIterator it = dir.begin(); cacheValid && (it != dir.end()); ++it ) {
- if ( isSizedSubdir(*it) ) {
- std::string subdirName = Glib::build_filename( iconCacheDir, *it );
- if ( Glib::file_test(subdirName, Glib::FILE_TEST_IS_DIR) ) {
- Glib::Dir subdir(subdirName);
- for ( Glib::DirIterator subit = subdir.begin(); cacheValid && (subit != subdir.end()); ++subit ) {
- std::string fullpath = Glib::build_filename( subdirName, *subit );
- if ( Glib::file_test(fullpath, Glib::FILE_TEST_EXISTS) && !Glib::file_test(fullpath, Glib::FILE_TEST_IS_DIR) ) {
- GStatBuf st;
- memset(&st, 0, sizeof(st));
- if ( !g_stat(fullpath.c_str(), &st) ) {
- unsigned long when = st.st_mtime;
- if ( when < lastSeen ) {
- cacheValid = false;
- }
- }
- }
- }
- }
- }
- }
- }
-
- if ( !cacheValid ) {
- if ( Glib::file_test(iconCacheDir, Glib::FILE_TEST_EXISTS) ) {
- // Purge existing icons, but not possible future sub-directories.
- if ( Glib::file_test(iconCacheDir, Glib::FILE_TEST_IS_DIR) ) {
- Glib::Dir dir(iconCacheDir);
- for ( Glib::DirIterator it = dir.begin(); it != dir.end(); ++it ) {
- if ( isSizedSubdir(*it) ) {
- std::string subdirName = Glib::build_filename( iconCacheDir, *it );
- if ( Glib::file_test(subdirName, Glib::FILE_TEST_IS_DIR) ) {
- Glib::Dir subdir(subdirName);
- for ( Glib::DirIterator subit = subdir.begin(); subit != subdir.end(); ++subit ) {
- std::string fullpath = Glib::build_filename( subdirName, *subit );
- if ( Glib::file_test(fullpath, Glib::FILE_TEST_EXISTS) && !Glib::file_test(fullpath, Glib::FILE_TEST_IS_DIR) ) {
- g_remove(fullpath.c_str());
- }
- }
- g_rmdir( subdirName.c_str() );
- }
- }
- }
- }
- } else {
- g_mkdir_with_parents( iconCacheDir.c_str(), 0x1ED );
- }
-
- if ( g_file_set_contents(iconCacheFile.c_str(), wanted.c_str(), wanted.size(), 0) ) {
- // Caching may proceed
- } else {
- g_warning("Unable to write cache info file.");
- }
- }
-}
-
-static Glib::ustring icon_cache_key(Glib::ustring const &name, unsigned psize);
-static GdkPixbuf *get_cached_pixbuf(Glib::ustring const &key);
-
-void IconImpl::setupLegacyNaming() {
- legacyNames["document-import"] ="file_import";
- legacyNames["document-export"] ="file_export";
- legacyNames["document-import-ocal"] ="ocal_import";
- legacyNames["document-export-ocal"] ="ocal_export";
- legacyNames["document-metadata"] ="document_metadata";
- legacyNames["dialog-input-devices"] ="input_devices";
- legacyNames["edit-duplicate"] ="edit_duplicate";
- legacyNames["edit-clone"] ="edit_clone";
- legacyNames["edit-clone-unlink"] ="edit_unlink_clone";
- legacyNames["edit-select-original"] ="edit_select_original";
- legacyNames["edit-undo-history"] ="edit_undo_history";
- legacyNames["edit-paste-in-place"] ="selection_paste_in_place";
- legacyNames["edit-paste-style"] ="selection_paste_style";
- legacyNames["selection-make-bitmap-copy"] ="selection_bitmap";
- legacyNames["edit-select-all"] ="selection_select_all";
- legacyNames["edit-select-all-layers"] ="selection_select_all_in_all_layers";
- legacyNames["edit-select-invert"] ="selection_invert";
- legacyNames["edit-select-none"] ="selection_deselect";
- legacyNames["dialog-xml-editor"] ="xml_editor";
- legacyNames["zoom-original"] ="zoom_1_to_1";
- legacyNames["zoom-half-size"] ="zoom_1_to_2";
- legacyNames["zoom-double-size"] ="zoom_2_to_1";
- legacyNames["zoom-fit-selection"] ="zoom_select";
- legacyNames["zoom-fit-drawing"] ="zoom_draw";
- legacyNames["zoom-fit-page"] ="zoom_page";
- legacyNames["zoom-fit-width"] ="zoom_pagewidth";
- legacyNames["zoom-previous"] ="zoom_previous";
- legacyNames["zoom-next"] ="zoom_next";
- legacyNames["zoom-in"] ="zoom_in";
- legacyNames["zoom-out"] ="zoom_out";
- legacyNames["show-grid"] ="grid";
- legacyNames["show-guides"] ="guides";
- legacyNames["color-management"] ="color_management";
- legacyNames["show-dialogs"] ="dialog_toggle";
- legacyNames["dialog-messages"] ="messages";
- legacyNames["dialog-scripts"] ="scripts";
- legacyNames["window-previous"] ="window_previous";
- legacyNames["window-next"] ="window_next";
- legacyNames["dialog-icon-preview"] ="view_icon_preview";
- legacyNames["window-new"] ="view_new";
- legacyNames["view-fullscreen"] ="fullscreen";
- legacyNames["layer-new"] ="new_layer";
- legacyNames["layer-rename"] ="rename_layer";
- legacyNames["layer-previous"] ="switch_to_layer_above";
- legacyNames["layer-next"] ="switch_to_layer_below";
- legacyNames["selection-move-to-layer-above"] ="move_selection_above";
- legacyNames["selection-move-to-layer-below"] ="move_selection_below";
- legacyNames["layer-raise"] ="raise_layer";
- legacyNames["layer-lower"] ="lower_layer";
- legacyNames["layer-top"] ="layer_to_top";
- legacyNames["layer-bottom"] ="layer_to_bottom";
- legacyNames["layer-delete"] ="delete_layer";
- legacyNames["dialog-layers"] ="layers";
- legacyNames["dialog-fill-and-stroke"] ="fill_and_stroke";
- legacyNames["dialog-object-properties"] ="dialog_item_properties";
- legacyNames["object-group"] ="selection_group";
- legacyNames["object-ungroup"] ="selection_ungroup";
- legacyNames["selection-raise"] ="selection_up";
- legacyNames["selection-lower"] ="selection_down";
- legacyNames["selection-top"] ="selection_top";
- legacyNames["selection-bottom"] ="selection_bot";
- legacyNames["object-rotate-left"] ="object_rotate_90_CCW";
- legacyNames["object-rotate-right"] ="object_rotate_90_CW";
- legacyNames["object-flip-horizontal"] ="object_flip_hor";
- legacyNames["object-flip-vertical"] ="object_flip_ver";
- legacyNames["dialog-transform"] ="object_trans";
- legacyNames["dialog-align-and-distribute"] ="object_align";
- legacyNames["dialog-rows-and-columns"] ="grid_arrange";
- legacyNames["object-to-path"] ="object_tocurve";
- legacyNames["stroke-to-path"] ="stroke_tocurve";
- legacyNames["bitmap-trace"] ="selection_trace";
- legacyNames["path-union"] ="union";
- legacyNames["path-difference"] ="difference";
- legacyNames["path-intersection"] ="intersection";
- legacyNames["path-exclusion"] ="exclusion";
- legacyNames["path-division"] ="division";
- legacyNames["path-cut"] ="cut_path";
- legacyNames["path-combine"] ="selection_combine";
- legacyNames["path-break-apart"] ="selection_break";
- legacyNames["path-outset"] ="outset_path";
- legacyNames["path-inset"] ="inset_path";
- legacyNames["path-offset-dynamic"] ="dynamic_offset";
- legacyNames["path-offset-linked"] ="linked_offset";
- legacyNames["path-simplify"] ="simplify";
- legacyNames["path-reverse"] ="selection_reverse";
- legacyNames["dialog-text-and-font"] ="object_font";
- legacyNames["text-put-on-path"] ="put_on_path";
- legacyNames["text-remove-from-path"] ="remove_from_path";
- legacyNames["text-flow-into-frame"] ="flow_into_frame";
- legacyNames["text-unflow"] ="unflow";
- legacyNames["text-convert-to-regular"] ="convert_to_text";
- legacyNames["text-unkern"] ="remove_manual_kerns";
- legacyNames["help-keyboard-shortcuts"] ="help_keys";
- legacyNames["help-contents"] ="help_tutorials";
- legacyNames["inkscape-logo"] ="inkscape_options";
- legacyNames["dialog-memory"] ="about_memory";
- legacyNames["tool-pointer"] ="draw_select";
- legacyNames["tool-node-editor"] ="draw_node";
- legacyNames["tool-tweak"] ="draw_tweak";
- legacyNames["zoom"] ="draw_zoom";
- legacyNames["draw-rectangle"] ="draw_rect";
- legacyNames["draw-cuboid"] ="draw_3dbox";
- legacyNames["draw-ellipse"] ="draw_arc";
- legacyNames["draw-polygon-star"] ="draw_star";
- legacyNames["draw-spiral"] ="draw_spiral";
- legacyNames["draw-freehand"] ="draw_freehand";
- legacyNames["draw-path"] ="draw_pen";
- legacyNames["draw-calligraphic"] ="draw_calligraphic";
- legacyNames["draw-eraser"] ="draw_erase";
- legacyNames["color-fill"] ="draw_paintbucket";
- legacyNames["draw-text"] ="draw_text";
- legacyNames["draw-connector"] ="draw_connector";
- legacyNames["color-gradient"] ="draw_gradient";
- legacyNames["color-picker"] ="draw_dropper";
- legacyNames["transform-affect-stroke"] ="transform_stroke";
- legacyNames["transform-affect-rounded-corners"] ="transform_corners";
- legacyNames["transform-affect-gradient"] ="transform_gradient";
- legacyNames["transform-affect-pattern"] ="transform_pattern";
- legacyNames["node-add"] ="node_insert";
- legacyNames["node-delete"] ="node_delete";
- legacyNames["node-join"] ="node_join";
- legacyNames["node-break"] ="node_break";
- legacyNames["node-join-segment"] ="node_join_segment";
- legacyNames["node-delete-segment"] ="node_delete_segment";
- legacyNames["node-type-cusp"] ="node_cusp";
- legacyNames["node-type-smooth"] ="node_smooth";
- legacyNames["node-type-symmetric"] ="node_symmetric";
- legacyNames["node-type-auto-smooth"] ="node_auto";
- legacyNames["node-segment-curve"] ="node_curve";
- legacyNames["node-segment-line"] ="node_line";
- legacyNames["show-node-handles"] ="nodes_show_handles";
- legacyNames["path-effect-parameter-next"] ="edit_next_parameter";
- legacyNames["show-path-outline"] ="nodes_show_helperpath";
- legacyNames["path-clip-edit"] ="nodeedit-clippath";
- legacyNames["path-mask-edit"] ="nodeedit-mask";
- legacyNames["node-type-cusp"] ="node_cusp";
- legacyNames["object-tweak-push"] ="tweak_move_mode";
- legacyNames["object-tweak-attract"] ="tweak_move_mode_inout";
- legacyNames["object-tweak-randomize"] ="tweak_move_mode_jitter";
- legacyNames["object-tweak-shrink"] ="tweak_scale_mode";
- legacyNames["object-tweak-rotate"] ="tweak_rotate_mode";
- legacyNames["object-tweak-duplicate"] ="tweak_moreless_mode";
- legacyNames["object-tweak-push"] ="tweak_move_mode";
- legacyNames["path-tweak-push"] ="tweak_push_mode";
- legacyNames["path-tweak-shrink"] ="tweak_shrink_mode";
- legacyNames["path-tweak-attract"] ="tweak_attract_mode";
- legacyNames["path-tweak-roughen"] ="tweak_roughen_mode";
- legacyNames["object-tweak-paint"] ="tweak_colorpaint_mode";
- legacyNames["object-tweak-jitter-color"] ="tweak_colorjitter_mode";
- legacyNames["object-tweak-blur"] ="tweak_blur_mode";
- legacyNames["rectangle-make-corners-sharp"] ="squared_corner";
- legacyNames["perspective-parallel"] ="toggle_vp_x";
- legacyNames["draw-ellipse-whole"] ="reset_circle";
- legacyNames["draw-ellipse-segment"] ="circle_closed_arc";
- legacyNames["draw-ellipse-arc"] ="circle_open_arc";
- legacyNames["draw-polygon"] ="star_flat";
- legacyNames["draw-star"] ="star_angled";
- legacyNames["path-mode-bezier"] ="bezier_mode";
- legacyNames["path-mode-spiro"] ="spiro_splines_mode";
- legacyNames["path-mode-bspline"] ="bspline_mode";
- legacyNames["path-mode-polyline"] ="polylines_mode";
- legacyNames["path-mode-polyline-paraxial"] ="paraxial_lines_mode";
- legacyNames["draw-use-tilt"] ="guse_tilt";
- legacyNames["draw-use-pressure"] ="guse_pressure";
- legacyNames["draw-trace-background"] ="trace_background";
- legacyNames["draw-eraser-delete-objects"] ="delete_object";
- legacyNames["format-text-direction-vertical"] ="writing_mode_tb";
- legacyNames["format-text-direction-horizontal"] ="writing_mode_lr";
- legacyNames["connector-avoid"] ="connector_avoid";
- legacyNames["connector-ignore"] ="connector_ignore";
- legacyNames["object-fill"] ="controls_fill";
- legacyNames["object-stroke"] ="controls_stroke";
- legacyNames["snap"] ="toggle_snap_global";
- legacyNames["snap-bounding-box"] ="toggle_snap_bbox";
- legacyNames["snap-bounding-box-edges"] ="toggle_snap_to_bbox_path";
- legacyNames["snap-bounding-box-corners"] ="toggle_snap_to_bbox_node";
- legacyNames["snap-bounding-box-midpoints"] ="toggle_snap_to_bbox_edge_midpoints";
- legacyNames["snap-bounding-box-center"] ="toggle_snap_to_bbox_midpoints";
- legacyNames["snap-nodes"] ="toggle_snap_nodes";
- legacyNames["snap-nodes-path"] ="toggle_snap_to_paths";
- legacyNames["snap-nodes-cusp"] ="toggle_snap_to_nodes";
- legacyNames["snap-nodes-smooth"] ="toggle_snap_to_smooth_nodes";
- legacyNames["snap-nodes-midpoint"] ="toggle_snap_to_midpoints";
- legacyNames["snap-nodes-intersection"] ="toggle_snap_to_path_intersections";
- legacyNames["snap-nodes-center"] ="toggle_snap_to_bbox_midpoints-3";
- legacyNames["snap-nodes-rotation-center"] ="toggle_snap_center";
- legacyNames["snap-page"] ="toggle_snap_page_border";
- legacyNames["snap-grid-guide-intersections"] ="toggle_snap_grid_guide_intersections";
- legacyNames["align-horizontal-right-to-anchor"] ="al_left_out";
- legacyNames["align-horizontal-left"] ="al_left_in";
- legacyNames["align-horizontal-center"] ="al_center_hor";
- legacyNames["align-horizontal-right"] ="al_right_in";
- legacyNames["align-horizontal-left-to-anchor"] ="al_right_out";
- legacyNames["align-horizontal-baseline"] ="al_baselines_vert";
- legacyNames["align-vertical-bottom-to-anchor"] ="al_top_out";
- legacyNames["align-vertical-top"] ="al_top_in";
- legacyNames["align-vertical-center"] ="al_center_ver";
- legacyNames["align-vertical-bottom"] ="al_bottom_in";
- legacyNames["align-vertical-top-to-anchor"] ="al_bottom_out";
- legacyNames["align-vertical-baseline"] ="al_baselines_hor";
- legacyNames["distribute-horizontal-left"] ="distribute_left";
- legacyNames["distribute-horizontal-center"] ="distribute_hcentre";
- legacyNames["distribute-horizontal-right"] ="distribute_right";
- legacyNames["distribute-horizontal-baseline"] ="distribute_baselines_hor";
- legacyNames["distribute-vertical-bottom"] ="distribute_bottom";
- legacyNames["distribute-vertical-center"] ="distribute_vcentre";
- legacyNames["distribute-vertical-top"] ="distribute_top";
- legacyNames["distribute-vertical-baseline"] ="distribute_baselines_vert";
- legacyNames["distribute-randomize"] ="distribute_randomize";
- legacyNames["distribute-unclump"] ="unclump";
- legacyNames["distribute-graph"] ="graph_layout";
- legacyNames["distribute-graph-directed"] ="directed_graph";
- legacyNames["distribute-remove-overlaps"] ="remove_overlaps";
- legacyNames["align-horizontal-node"] ="node_valign";
- legacyNames["align-vertical-node"] ="node_halign";
- legacyNames["distribute-vertical-node"] ="node_vdistribute";
- legacyNames["distribute-horizontal-node"] ="node_hdistribute";
- legacyNames["xml-element-new"] ="add_xml_element_node";
- legacyNames["xml-text-new"] ="add_xml_text_node";
- legacyNames["xml-node-delete"] ="delete_xml_node";
- legacyNames["xml-node-duplicate"] ="duplicate_xml_node";
- legacyNames["xml-attribute-delete"] ="delete_xml_attribute";
- legacyNames["transform-move-horizontal"] ="arrows_hor";
- legacyNames["transform-move-vertical"] ="arrows_ver";
- legacyNames["transform-scale-horizontal"] ="transform_scale_hor";
- legacyNames["transform-scale-vertical"] ="transform_scale_ver";
- legacyNames["transform-skew-horizontal"] ="transform_scew_hor";
- legacyNames["transform-skew-vertical"] ="transform_scew_ver";
- legacyNames["object-fill"] ="properties_fill";
- legacyNames["object-stroke"] ="properties_stroke_paint";
- legacyNames["object-stroke-style"] ="properties_stroke";
- legacyNames["paint-none"] ="fill_none";
- legacyNames["paint-solid"] ="fill_solid";
- legacyNames["paint-gradient-linear"] ="fill_gradient";
- legacyNames["paint-gradient-radial"] ="fill_radial";
- legacyNames["paint-pattern"] ="fill_pattern";
- legacyNames["paint-unknown"] ="fill_unset";
- legacyNames["fill-rule-even-odd"] ="fillrule_evenodd";
- legacyNames["fill-rule-nonzero"] ="fillrule_nonzero";
- legacyNames["stroke-join-miter"] ="join_miter";
- legacyNames["stroke-join-bevel"] ="join_bevel";
- legacyNames["stroke-join-round"] ="join_round";
- legacyNames["stroke-cap-butt"] ="cap_butt";
- legacyNames["stroke-cap-square"] ="cap_square";
- legacyNames["stroke-cap-round"] ="cap_round";
- legacyNames["guides"] ="guide";
- legacyNames["grid-rectangular"] ="grid_xy";
- legacyNames["grid-axonometric"] ="grid_axonom";
- legacyNames["object-visible"] ="visible";
- legacyNames["object-hidden"] ="hidden";
- legacyNames["object-unlocked"] ="lock_unlocked";
- legacyNames["object-locked"] ="width_height_lock";
- legacyNames["zoom"] ="sticky_zoom";
-}
-
-GtkWidget *IconImpl::newFull( Inkscape::IconSize lsize, gchar const *name )
-{
- static bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpGtk");
-
- GtkWidget *widget = NULL;
- gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) );
- if (trySize != lsize ) {
- std::cerr << "GtkWidget *IconImple::newFull(): lsize != trySize: lsize: " << lsize
- << " try Size: " << trySize << " " << (name?name:"NULL") << std::endl;
- }
- if ( !sizeMapDone ) {
- injectCustomSize();
- }
- GtkIconSize mappedSize = iconSizeLookup[trySize];
-
- if ( legacyNames.empty() ) {
- setupLegacyNaming();
- }
-
- GtkWidget *img = gtk_image_new_from_icon_name( name, mappedSize );
- if ( dump ) {
- g_message("gtk_image_new_from_icon_name( '%s', %d ) = %p", name, mappedSize, img);
- GtkImageType thing = gtk_image_get_storage_type(GTK_IMAGE(img));
- g_message(" Type is %d %s", (int)thing, (thing == GTK_IMAGE_EMPTY ? "Empty" : "ok"));
- }
-
- if ( img ) {
- GtkImageType type = gtk_image_get_storage_type( GTK_IMAGE(img) );
- if ( type == GTK_IMAGE_ICON_NAME ) {
- widget = GTK_WIDGET(img);
- img = NULL;
-
- // Add a hook to render if set visible before prerender is done.
- g_signal_connect( G_OBJECT(widget), "map", G_CALLBACK(imageMapNamedCB), GINT_TO_POINTER(0) );
-
- if ( Inkscape::Preferences::get()->getBool("/options/iconrender/named_nodelay") ) {
- int psize = getPhysSize(lsize);
- // std::cout << " name: " << name << " size: " << psize << std::endl;
- prerenderIcon(name, mappedSize, psize);
- } else {
- addPreRender( mappedSize, name );
- }
- } else {
- if ( dump ) {
- g_message( "skipped gtk '%s' %d (not GTK_IMAGE_ICON_NAME)", name, lsize );
- }
- //g_object_unref(G_OBJECT(img));
- img = NULL;
- }
- }
-
- if ( !widget ) {
- //g_message("Creating an SPIcon instance for %s:%d", name, (int)lsize);
- SPIcon *icon = SP_ICON(g_object_new(SP_TYPE_ICON, NULL));
- icon->lsize = lsize;
- icon->name = g_strdup(name);
- icon->psize = getPhysSize(lsize);
-
- widget = GTK_WIDGET(icon);
- }
-
- return widget;
-}
-
-// PUBLIC CALL:
-GtkWidget *sp_icon_new( Inkscape::IconSize lsize, gchar const *name )
-{
- return IconImpl::newFull( lsize, name );
-}
-
-// PUBLIC CALL for when you REALLY need a pixbuf
-GdkPixbuf *sp_pixbuf_new( Inkscape::IconSize lsize, gchar const *name )
-{
- int psize = IconImpl::getPhysSize(lsize);
- return IconImpl::renderup(name, lsize, psize);
-}
-
-// PUBLIC CALL:
-Gtk::Widget *sp_icon_get_icon( Glib::ustring const &oid, Inkscape::IconSize size )
-{
- Gtk::Widget *result = NULL;
- GtkWidget *widget = IconImpl::newFull( static_cast<Inkscape::IconSize>(Inkscape::getRegisteredIconSize(size)), oid.c_str() );
-
- if ( widget ) {
- if ( GTK_IS_IMAGE(widget) ) {
- GtkImage *img = GTK_IMAGE(widget);
- result = Glib::wrap( img );
- } else {
- result = Glib::wrap( widget );
- }
- }
-
- return result;
-}
-
-void IconImpl::injectCustomSize()
-{
- // TODO - still need to handle the case of theme changes and resize, especially as we can't re-register a string.
- if ( !sizeMapDone )
- {
- bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpDefault");
- gint width = 0;
- gint height = 0;
- if ( gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height ) ) {
- gint newWidth = ((width * 3) / 4);
- gint newHeight = ((height * 3) / 4);
- GtkIconSize newSizeEnum = gtk_icon_size_register( "inkscape-decoration", newWidth, newHeight );
- if ( newSizeEnum ) {
- if ( dump ) {
- g_message("Registered (%d, %d) <= (%d, %d) as index %d", newWidth, newHeight, width, height, newSizeEnum);
- }
- guint index = static_cast<guint>(Inkscape::ICON_SIZE_DECORATION);
- if ( index < G_N_ELEMENTS(iconSizeLookup) ) {
- iconSizeLookup[index] = newSizeEnum;
- } else if ( dump ) {
- g_message("size lookup array too small to store entry");
- }
- }
- }
- sizeMapDone = true;
- }
-}
-
-GtkIconSize Inkscape::getRegisteredIconSize( Inkscape::IconSize size )
-{
- GtkIconSize other = GTK_ICON_SIZE_MENU;
- IconImpl::injectCustomSize();
- size = CLAMP( size, Inkscape::ICON_SIZE_MENU, Inkscape::ICON_SIZE_DECORATION );
- if ( size == Inkscape::ICON_SIZE_DECORATION ) {
- other = gtk_icon_size_from_name("inkscape-decoration");
- } else {
- other = static_cast<GtkIconSize>(size);
- }
-
- return other;
-}
-
-
-// PUBLIC CALL:
-int sp_icon_get_phys_size(int size)
-{
- return IconImpl::getPhysSize(size);
-}
-
-int IconImpl::getPhysSize(int size)
-{
- static bool init = false;
- static int lastSys[Inkscape::ICON_SIZE_DECORATION + 1];
- static int vals[Inkscape::ICON_SIZE_DECORATION + 1];
-
- size = CLAMP( size, static_cast<int>(GTK_ICON_SIZE_MENU), static_cast<int>(Inkscape::ICON_SIZE_DECORATION) );
-
- if ( !sizeMapDone ) {
- injectCustomSize();
- }
-
- if ( sizeDirty && init ) {
- GtkIconSize const gtkSizes[] = {
- GTK_ICON_SIZE_MENU,
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- GTK_ICON_SIZE_LARGE_TOOLBAR,
- GTK_ICON_SIZE_BUTTON,
- GTK_ICON_SIZE_DND,
- GTK_ICON_SIZE_DIALOG,
- static_cast<guint>(Inkscape::ICON_SIZE_DECORATION) < G_N_ELEMENTS(iconSizeLookup) ?
- iconSizeLookup[static_cast<int>(Inkscape::ICON_SIZE_DECORATION)] :
- GTK_ICON_SIZE_MENU
- };
- for (unsigned i = 0; i < G_N_ELEMENTS(gtkSizes) && init; ++i) {
- guint const val_ix = (gtkSizes[i] <= GTK_ICON_SIZE_DIALOG) ? (guint)gtkSizes[i] : (guint)Inkscape::ICON_SIZE_DECORATION;
-
- g_assert( val_ix < G_N_ELEMENTS(vals) );
-
- gint width = 0;
- gint height = 0;
- if ( gtk_icon_size_lookup(gtkSizes[i], &width, &height ) ) {
- init &= (lastSys[val_ix] == std::max(width, height));
- }
- }
- }
-
- if ( !init ) {
- sizeDirty = false;
- bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpDefault");
- if ( dump ) {
- g_message( "Default icon sizes:" );
- }
- memset( vals, 0, sizeof(vals) );
- memset( lastSys, 0, sizeof(lastSys) );
- GtkIconSize const gtkSizes[] = {
- GTK_ICON_SIZE_MENU,
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- GTK_ICON_SIZE_LARGE_TOOLBAR,
- GTK_ICON_SIZE_BUTTON,
- GTK_ICON_SIZE_DND,
- GTK_ICON_SIZE_DIALOG,
- static_cast<guint>(Inkscape::ICON_SIZE_DECORATION) < G_N_ELEMENTS(iconSizeLookup) ?
- iconSizeLookup[static_cast<int>(Inkscape::ICON_SIZE_DECORATION)] :
- GTK_ICON_SIZE_MENU
- };
- gchar const *const names[] = {
- "GTK_ICON_SIZE_MENU",
- "GTK_ICON_SIZE_SMALL_TOOLBAR",
- "GTK_ICON_SIZE_LARGE_TOOLBAR",
- "GTK_ICON_SIZE_BUTTON",
- "GTK_ICON_SIZE_DND",
- "GTK_ICON_SIZE_DIALOG",
- "inkscape-decoration"
- };
-
- for (unsigned i = 0; i < G_N_ELEMENTS(gtkSizes); ++i) {
- guint const val_ix = (gtkSizes[i] <= GTK_ICON_SIZE_DIALOG) ? (guint)gtkSizes[i] : (guint)Inkscape::ICON_SIZE_DECORATION;
-
- g_assert( val_ix < G_N_ELEMENTS(vals) );
-
- gint width = 0;
- gint height = 0;
- bool used = false;
- if ( gtk_icon_size_lookup(gtkSizes[i], &width, &height ) ) {
- vals[val_ix] = std::max(width, height);
- lastSys[val_ix] = vals[val_ix];
- used = true;
- }
- if (dump) {
- g_message(" =-- %u size:%d %c(%d, %d) '%s'",
- i, gtkSizes[i],
- ( used ? ' ' : 'X' ), width, height, names[i]);
- }
-
- // The following is needed due to this documented behavior of gtk_icon_size_lookup:
- // "The rendered pixbuf may not even correspond to the width/height returned by
- // gtk_icon_size_lookup(), because themes are free to render the pixbuf however
- // they like, including changing the usual size."
- gchar const *id = INKSCAPE_ICON("document-open");
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
- GdkPixbuf *pb = gtk_icon_theme_load_icon (icon_theme,
- id,
- vals[val_ix],
- (GtkIconLookupFlags)0,
- NULL);
- if (pb) {
- width = gdk_pixbuf_get_width(pb);
- height = gdk_pixbuf_get_height(pb);
- int newSize = std::max( width, height );
- // TODO perhaps check a few more stock icons to get a range on sizes.
- if ( newSize > 0 ) {
- vals[val_ix] = newSize;
- }
- if (dump) {
- g_message(" %u size:%d (%d, %d)", i, gtkSizes[i], width, height);
- }
-
- g_object_unref(G_OBJECT(pb));
- }
- }
- init = true;
- }
-
- return vals[size];
-}
-
-
-
-GdkPixbuf *IconImpl::loadPixmap(gchar const *name, unsigned /*lsize*/, unsigned psize)
-{
- gchar *path = g_strdup_printf("%s/%s.png", INKSCAPE_PIXMAPDIR, name);
- // TODO: bulia, please look over
- gsize bytesRead = 0;
- gsize bytesWritten = 0;
- GError *error = NULL;
- gchar *localFilename = g_filename_from_utf8( path,
- -1,
- &bytesRead,
- &bytesWritten,
- &error);
- GdkPixbuf *pb = gdk_pixbuf_new_from_file(localFilename, NULL);
- g_free(localFilename);
- g_free(path);
- if (!pb) {
- path = g_strdup_printf("%s/%s.xpm", INKSCAPE_PIXMAPDIR, name);
- // TODO: bulia, please look over
- gsize bytesRead = 0;
- gsize bytesWritten = 0;
- GError *error = NULL;
- gchar *localFilename = g_filename_from_utf8( path,
- -1,
- &bytesRead,
- &bytesWritten,
- &error);
- pb = gdk_pixbuf_new_from_file(localFilename, NULL);
- g_free(localFilename);
- g_free(path);
- }
-
- if (pb) {
- if (!gdk_pixbuf_get_has_alpha(pb)) {
- gdk_pixbuf_add_alpha(pb, FALSE, 0, 0, 0);
- }
-
- if ( ( static_cast<unsigned>(gdk_pixbuf_get_width(pb)) != psize )
- || ( static_cast<unsigned>(gdk_pixbuf_get_height(pb)) != psize ) ) {
- GdkPixbuf *spb = gdk_pixbuf_scale_simple(pb, psize, psize, GDK_INTERP_HYPER);
- g_object_unref(G_OBJECT(pb));
- pb = spb;
- }
- }
-
- return pb;
-}
-
-static Geom::IntRect round_rect(Geom::Rect const &r)
-{
- using Geom::X;
- using Geom::Y;
- Geom::IntPoint a, b;
- a[X] = round(r.left());
- a[Y] = round(r.top());
- b[X] = round(r.right());
- b[Y] = round(r.bottom());
- Geom::IntRect ret(a, b);
- return ret;
-}
-
-// takes doc, drawing, icon, and icon name to produce pixels
-extern "C" guchar *
-sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing,
- gchar const *name, unsigned psize,
- unsigned &stride)
-{
- bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg");
- guchar *px = NULL;
-
- if (doc) {
- SPObject *object = doc->getObjectById(name);
- if (object && SP_IS_ITEM(object)) {
- SPItem *item = SP_ITEM(object);
- // Find bbox in document
- Geom::OptRect dbox = item->documentVisualBounds();
-
- if ( object->parent == NULL )
- {
- dbox = Geom::Rect(Geom::Point(0, 0),
- Geom::Point(doc->getWidth().value("px"), doc->getHeight().value("px")));
- }
-
- /* This is in document coordinates, i.e. pixels */
- if ( dbox ) {
- /* Update to renderable state */
- double sf = 1.0;
- drawing.root()->setTransform(Geom::Scale(sf));
- drawing.update();
- /* Item integer bbox in points */
- // NOTE: previously, each rect coordinate was rounded using floor(c + 0.5)
- Geom::IntRect ibox = round_rect(*dbox);
-
- if ( dump ) {
- g_message( " box --'%s' (%f,%f)-(%f,%f)", name, (double)ibox.left(), (double)ibox.top(), (double)ibox.right(), (double)ibox.bottom() );
- }
-
- /* Find button visible area */
- int width = ibox.width();
- int height = ibox.height();
-
- if ( dump ) {
- g_message( " vis --'%s' (%d,%d)", name, width, height );
- }
-
- {
- int block = std::max(width, height);
- if (block != static_cast<int>(psize) ) {
- if ( dump ) {
- g_message(" resizing" );
- }
- sf = (double)psize / (double)block;
-
- drawing.root()->setTransform(Geom::Scale(sf));
- drawing.update();
-
- ibox = round_rect(*dbox * Geom::Scale(sf));
- if ( dump ) {
- g_message( " box2 --'%s' (%f,%f)-(%f,%f)", name, (double)ibox.left(), (double)ibox.top(), (double)ibox.right(), (double)ibox.bottom() );
- }
-
- /* Find button visible area */
- width = ibox.width();
- height = ibox.height();
- if ( dump ) {
- g_message( " vis2 --'%s' (%d,%d)", name, width, height );
- }
- }
- }
-
- Geom::IntPoint pdim(psize, psize);
- int dx, dy;
- //dx = (psize - width) / 2;
- //dy = (psize - height) / 2;
- dx=dy=psize;
- dx=(dx-width)/2; // watch out for psize, since 'unsigned'-'signed' can cause problems if the result is negative
- dy=(dy-height)/2;
- Geom::IntRect area = Geom::IntRect::from_xywh(ibox.min() - Geom::IntPoint(dx,dy), pdim);
- /* Actual renderable area */
- Geom::IntRect ua = *Geom::intersect(ibox, area);
-
- if ( dump ) {
- g_message( " area --'%s' (%f,%f)-(%f,%f)", name, (double)area.left(), (double)area.top(), (double)area.right(), (double)area.bottom() );
- g_message( " ua --'%s' (%f,%f)-(%f,%f)", name, (double)ua.left(), (double)ua.top(), (double)ua.right(), (double)ua.bottom() );
- }
-
- stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, psize);
-
- /* Set up pixblock */
- px = g_new(guchar, stride * psize);
- memset(px, 0x00, stride * psize);
-
- /* Render */
- cairo_surface_t *s = cairo_image_surface_create_for_data(px,
- CAIRO_FORMAT_ARGB32, psize, psize, stride);
- Inkscape::DrawingContext dc(s, ua.min());
-
- SPNamedView *nv = sp_document_namedview(doc, NULL);
- float bg_r = SP_RGBA32_R_F(nv->pagecolor);
- float bg_g = SP_RGBA32_G_F(nv->pagecolor);
- float bg_b = SP_RGBA32_B_F(nv->pagecolor);
- float bg_a = SP_RGBA32_A_F(nv->pagecolor);
-
- cairo_t *cr = cairo_create(s);
- cairo_set_source_rgba(cr, bg_r, bg_g, bg_b, bg_a);
- cairo_rectangle(cr, 0, 0, psize, psize);
- cairo_fill(cr);
- cairo_save(cr);
- cairo_destroy(cr);
-
- drawing.render(dc, ua);
- cairo_surface_destroy(s);
-
- // convert to GdkPixbuf format
- convert_pixels_argb32_to_pixbuf(px, psize, psize, stride);
-
- if ( Inkscape::Preferences::get()->getBool("/debug/icons/overlaySvg") ) {
- IconImpl::overlayPixels( px, psize, psize, stride, 0x00, 0x00, 0xff );
- }
- }
- }
- }
-
- return px;
-} // end of sp_icon_doc_icon()
-
-
-
-class SVGDocCache
-{
-public:
- SVGDocCache( SPDocument *doc )
- : doc(doc)
- , visionkey(SPItem::display_key_new(1))
- {
- doc->doRef();
- doc->ensureUpToDate();
- drawing.setRoot(doc->getRoot()->invoke_show(drawing, visionkey, SP_ITEM_SHOW_DISPLAY ));
- }
- ~SVGDocCache() {
- doc->getRoot()->invoke_hide(visionkey);
- doc->doUnref();
- }
- SPDocument *doc;
- Inkscape::Drawing drawing;
- unsigned visionkey;
-};
-
-static std::map<Glib::ustring, SVGDocCache *> doc_cache;
-static std::map<Glib::ustring, GdkPixbuf *> pb_cache;
-
-Glib::ustring icon_cache_key(Glib::ustring const & name, unsigned psize)
-{
- Glib::ustring key = name;
- key += ":";
- key += psize;
- return key;
-}
-
-GdkPixbuf *get_cached_pixbuf(Glib::ustring const &key) {
- GdkPixbuf* pb = NULL;
- std::map<Glib::ustring, GdkPixbuf *>::iterator found = pb_cache.find(key);
- if ( found != pb_cache.end() ) {
- pb = found->second;
- }
- return pb;
-}
-
-std::list<gchar*> &IconImpl::icons_svg_paths()
-{
- static std::list<gchar *> sources;
- static bool initialized = false;
- if (!initialized) {
- // Fall back from user prefs dir into system locations.
- gchar *userdir = Inkscape::Application::profile_path("icons");
- sources.push_back(g_build_filename(userdir,"icons.svg", NULL));
- sources.push_back(g_build_filename(INKSCAPE_PIXMAPDIR, "icons.svg", NULL));
- g_free(userdir);
- initialized = true;
- }
- return sources;
-}
-
-// this function renders icons from icons.svg and returns the pixels.
-guchar *IconImpl::load_svg_pixels(std::list<Glib::ustring> const &names,
- unsigned psize, unsigned &stride)
-{
- bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg");
- std::list<gchar *> &sources = icons_svg_paths();
-
- // Try each document in turn until we successfully load the icon from one
- guchar *px = NULL;
- for (std::list<gchar*>::iterator i = sources.begin(); (i != sources.end()) && !px; ++i) {
- gchar *doc_filename = *i;
- SVGDocCache *info = NULL;
-
- // Did we already load this doc?
- Glib::ustring key(doc_filename);
- {
- std::map<Glib::ustring, SVGDocCache *>::iterator i = doc_cache.find(key);
- if ( i != doc_cache.end() ) {
- info = i->second;
- }
- }
-
- // Try to load from document.
- if (!info && Inkscape::IO::file_test( doc_filename, G_FILE_TEST_IS_REGULAR ) ) {
- SPDocument *doc = SPDocument::createNewDoc( doc_filename, FALSE );
- if ( doc ) {
- if ( dump ) {
- g_message("Loaded icon file %s", doc_filename);
- }
- // store into the cache
- info = new SVGDocCache(doc);
- doc_cache[key] = info;
- }
- }
- if (info) {
- for (std::list<Glib::ustring>::const_iterator it = names.begin(); !px && (it != names.end()); ++it ) {
- px = sp_icon_doc_icon( info->doc, info->drawing, it->c_str(), psize, stride );
- }
- }
- }
-
- return px;
-}
-
-static void addToIconSet(GdkPixbuf* pb, gchar const* name, GtkIconSize lsize, unsigned psize) {
- Glib::RefPtr<Gtk::IconTheme> icon_theme = Gtk::IconTheme::get_default();
- bool icon_found = icon_theme->has_icon(name);
- if ( !icon_found ) {
- Gtk::IconTheme::add_builtin_icon( name, psize, Glib::wrap(pb) );
- static bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpGtk");
- if (dump) {
- g_message(" set in a builtin for %s:%d:%d", name, lsize, psize);
- }
- }
-}
-
-void Inkscape::queueIconPrerender( Glib::ustring const &name, Inkscape::IconSize lsize )
-{
- gboolean themedFound = gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name.c_str());
- if ( !themedFound ) {
- gint trySize = CLAMP( static_cast<gint>(lsize), 0, static_cast<gint>(G_N_ELEMENTS(iconSizeLookup) - 1) );
- if ( !sizeMapDone ) {
- IconImpl::injectCustomSize();
- }
- GtkIconSize mappedSize = iconSizeLookup[trySize];
-
- int psize = IconImpl::getPhysSize(lsize);
- // TODO place in a queue that is triggered by other map events
- IconImpl::prerenderIcon(name.c_str(), mappedSize, psize);
- }
-}
-
-static std::map<unsigned, Glib::ustring> sizePaths;
-
-static std::string getDestDir( unsigned psize )
-{
- if ( sizePaths.find(psize) == sizePaths.end() ) {
- gchar *tmp = g_strdup_printf("%dx%d", psize, psize);
- sizePaths[psize] = tmp;
- g_free(tmp);
- }
-
- return sizePaths[psize];
-}
-
-// returns true if icon needed preloading, false if nothing was done
-bool IconImpl::prerenderIcon(gchar const *name, GtkIconSize lsize, unsigned psize)
-{
- bool loadNeeded = false;
- static bool useCache = Inkscape::Preferences::get()->getBool("/debug/icons/useCache", true);
- static bool cacheValidated = false;
- if (!cacheValidated) {
- cacheValidated = true;
- if ( useCache ) {
- validateCache();
- }
- }
-
- Glib::ustring key = icon_cache_key(name, psize);
- if ( !get_cached_pixbuf(key) ) {
- static bool dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpGtk");
- if ((internalNames.find(name) != internalNames.end())
- || (!gtk_icon_theme_has_icon(gtk_icon_theme_get_default(), name))) {
- if (dump) {
- g_message("prerenderIcon [%s] %d:%d", name, lsize, psize);
- }
-
- std::string potentialFile;
- bool dataLoaded = false;
- if ( useCache ) {
- // In file encoding:
- std::string iconCacheDir = Glib::build_filename(Glib::build_filename(Glib::get_user_cache_dir(), "inkscape"), "icons");
- std::string subpart = getDestDir(psize);
- std::string subdir = Glib::build_filename( iconCacheDir, subpart );
- if ( !Glib::file_test(subdir, Glib::FILE_TEST_EXISTS) ) {
- g_mkdir_with_parents( subdir.c_str(), 0x1ED );
- }
- potentialFile = Glib::build_filename( subdir, name );
- potentialFile += ".png";
-
- if ( Glib::file_test(potentialFile, Glib::FILE_TEST_EXISTS) && Glib::file_test(potentialFile, Glib::FILE_TEST_IS_REGULAR) ) {
- bool badFile = false;
- try {
- Glib::RefPtr<Gdk::Pixbuf> pb = Gdk::Pixbuf::create_from_file(potentialFile);
- if (pb) {
- dataLoaded = true;
- GdkPixbuf *obj = pb->gobj();
- g_object_ref(obj);
- pb_cache[key] = obj;
- addToIconSet(obj, name, lsize, psize);
- loadNeeded = true;
- if (internalNames.find(name) == internalNames.end()) {
- internalNames.insert(name);
- }
- }
- } catch ( Glib::FileError &ex ) {
- //g_warning("FileError [%s]", ex.what().c_str());
- badFile = true;
- } catch ( Gdk::PixbufError &ex ) {
- //g_warning("PixbufError [%s]", ex.what().c_str());
- // Invalid contents. Remove cached item
- badFile = true;
- }
- if ( badFile ) {
- g_remove(potentialFile.c_str());
- }
- }
- }
-
- if (!dataLoaded) {
- std::list<Glib::ustring> names;
- names.push_back(name);
- if ( legacyNames.find(name) != legacyNames.end() ) {
- names.push_back(legacyNames[name]);
- if ( dump ) {
- g_message("load_svg_pixels([%s] = %s, %d, %d)", name, legacyNames[name].c_str(), lsize, psize);
- }
- }
- unsigned stride;
- guchar* px = load_svg_pixels(names, psize, stride);
- if (px) {
- GdkPixbuf* pb = gdk_pixbuf_new_from_data( px, GDK_COLORSPACE_RGB, TRUE, 8,
- psize, psize, stride,
- reinterpret_cast<GdkPixbufDestroyNotify>(g_free), NULL );
- pb_cache[key] = pb;
- addToIconSet(pb, name, lsize, psize);
- loadNeeded = true;
- if (internalNames.find(name) == internalNames.end()) {
- internalNames.insert(name);
- }
- if (useCache) {
- g_object_ref(pb);
- Glib::RefPtr<Gdk::Pixbuf> ppp = Glib::wrap(pb);
- try {
- ppp->save( potentialFile, "png" );
- } catch ( Glib::FileError &ex ) {
- //g_warning("FileError [%s]", ex.what().c_str());
- } catch ( Gdk::PixbufError &ex ) {
- //g_warning("PixbufError [%s]", ex.what().c_str());
- }
- }
- } else if (dump) {
- g_message("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX error!!! pixels not found for '%s'", name);
- }
- }
- }
- else if (dump) {
- g_message("prerenderIcon [%s] %d NOT!!!!!!", name, psize);
- }
- }
- return loadNeeded;
-}
-
-GdkPixbuf *IconImpl::loadSvg(std::list<Glib::ustring> const &names, GtkIconSize lsize, unsigned psize)
-{
- Glib::ustring key = icon_cache_key(*names.begin(), psize);
-
- // did we already load this icon at this scale/size?
- GdkPixbuf* pb = get_cached_pixbuf(key);
- if (!pb) {
- unsigned stride;
- guchar *px = load_svg_pixels(names, psize, stride);
- if (px) {
- pb = gdk_pixbuf_new_from_data(px, GDK_COLORSPACE_RGB, TRUE, 8,
- psize, psize, stride,
- (GdkPixbufDestroyNotify)g_free, NULL);
- pb_cache[key] = pb;
- addToIconSet(pb, names.begin()->c_str(), lsize, psize);
- }
- }
-
- if ( pb ) {
- // increase refcount since we're handing out ownership
- g_object_ref(G_OBJECT(pb));
- }
- return pb;
-}
-
-void IconImpl::overlayPixels(guchar *px, int width, int height, int stride,
- unsigned r, unsigned g, unsigned b)
-{
- int bytesPerPixel = 4;
- int spacing = 4;
- for ( int y = 0; y < height; y += spacing ) {
- guchar *ptr = px + y * stride;
- for ( int x = 0; x < width; x += spacing ) {
- *(ptr++) = r;
- *(ptr++) = g;
- *(ptr++) = b;
- *(ptr++) = 0xff;
-
- ptr += bytesPerPixel * (spacing - 1);
- }
- }
-
- if ( width > 1 && height > 1 ) {
- // point at the last pixel
- guchar *ptr = px + ((height-1) * stride) + ((width - 1) * bytesPerPixel);
-
- if ( width > 2 ) {
- px[4] = r;
- px[5] = g;
- px[6] = b;
- px[7] = 0xff;
-
- ptr[-12] = r;
- ptr[-11] = g;
- ptr[-10] = b;
- ptr[-9] = 0xff;
- }
-
- ptr[-4] = r;
- ptr[-3] = g;
- ptr[-2] = b;
- ptr[-1] = 0xff;
-
- px[0 + stride] = r;
- px[1 + stride] = g;
- px[2 + stride] = b;
- px[3 + stride] = 0xff;
-
- ptr[0 - stride] = r;
- ptr[1 - stride] = g;
- ptr[2 - stride] = b;
- ptr[3 - stride] = 0xff;
-
- if ( height > 2 ) {
- ptr[0 - stride * 3] = r;
- ptr[1 - stride * 3] = g;
- ptr[2 - stride * 3] = b;
- ptr[3 - stride * 3] = 0xff;
- }
- }
-}
-
-class preRenderItem
-{
-public:
- preRenderItem( GtkIconSize lsize, gchar const *name ) :
- _lsize( lsize ),
- _name( name )
- {}
- GtkIconSize _lsize;
- Glib::ustring _name;
-};
-
-
-static std::vector<preRenderItem> pendingRenders;
-static bool callbackHooked = false;
-
-void IconImpl::addPreRender( GtkIconSize lsize, gchar const *name )
-{
- if ( !callbackHooked )
- {
- callbackHooked = true;
- g_idle_add_full( G_PRIORITY_LOW, &prerenderTask, NULL, NULL );
- }
-
- pendingRenders.push_back(preRenderItem(lsize, name));
-}
-
-gboolean IconImpl::prerenderTask(gpointer /*data*/) {
- if ( Inkscape::Application::isCrashing() ) {
- // stop
- } else if (!pendingRenders.empty()) {
- bool workDone = false;
- do {
- preRenderItem single = pendingRenders.front();
- pendingRenders.erase(pendingRenders.begin());
- int psize = getPhysSize(single._lsize);
- workDone = prerenderIcon(single._name.c_str(), single._lsize, psize);
- } while (!pendingRenders.empty() && !workDone);
- }
-
- if (!Inkscape::Application::isCrashing() && !pendingRenders.empty()) {
- return TRUE;
- } else {
- callbackHooked = false;
- return FALSE;
- }
-}
-
-
-void IconImpl::imageMapCB(GtkWidget* widget, gpointer user_data)
-{
- gchar const* id = NULL;
- GtkIconSize size = GTK_ICON_SIZE_INVALID;
- gtk_image_get_icon_name(GTK_IMAGE(widget), &id, &size);
- GtkIconSize lsize = static_cast<GtkIconSize>(GPOINTER_TO_INT(user_data));
- if ( id ) {
- int psize = getPhysSize(lsize);
- g_message("imageMapCB(%p) for [%s]:%d:%d", widget, id, lsize, psize);
- for ( std::vector<preRenderItem>::iterator it = pendingRenders.begin(); it != pendingRenders.end(); ++it ) {
- if ( (it->_name == id) && (it->_lsize == lsize) ) {
- prerenderIcon(id, lsize, psize);
- pendingRenders.erase(it);
- g_message(" prerender for %s:%d:%d", id, lsize, psize);
- if (lsize != size) {
- int psize = getPhysSize(size);
- prerenderIcon(id, size, psize);
- }
- break;
- }
- }
- }
-
- g_signal_handlers_disconnect_by_func(widget, (gpointer)imageMapCB, user_data);
-}
-
-void IconImpl::imageMapNamedCB(GtkWidget* widget, gpointer user_data)
-{
- GtkImage* img = GTK_IMAGE(widget);
- gchar const* iconName = NULL;
- GtkIconSize size = GTK_ICON_SIZE_INVALID;
- gtk_image_get_icon_name(img, &iconName, &size);
- if ( iconName ) {
- GtkImageType type = gtk_image_get_storage_type( GTK_IMAGE(img) );
- if ( type == GTK_IMAGE_ICON_NAME ) {
-
- GtkIconSize iconSize = GTK_ICON_SIZE_INVALID;
- gchar const* iconName_two = NULL;
- {
- g_object_get(G_OBJECT(widget),
- "icon-name", &iconName_two,
- "icon-size", &iconSize,
- NULL);
- }
-
- for ( std::vector<preRenderItem>::iterator it = pendingRenders.begin(); it != pendingRenders.end(); ++it ) {
- /// @todo fix pointer string comparison here!!! "it->_name == iconName_two", that seems very bug-prone
- if ( (it->_name == iconName_two) && (it->_lsize == iconSize) ) {
- int psize = getPhysSize(iconSize);
- prerenderIcon(iconName_two, iconSize, psize);
- pendingRenders.erase(it);
- break;
- }
- }
-
- gtk_image_set_from_icon_name(img, "", iconSize);
- gtk_image_set_from_icon_name(img, iconName_two, iconSize);
- } else {
- g_warning("UNEXPECTED TYPE of %d", (int)type);
- }
- }
-
- g_signal_handlers_disconnect_by_func(widget, (gpointer)imageMapNamedCB, user_data);
-}
-
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/widgets/icon.h b/src/widgets/icon.h
deleted file mode 100644
index 5838d8de4..000000000
--- a/src/widgets/icon.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef SEEN_SP_ICON_H
-#define SEEN_SP_ICON_H
-
-/*
- * Generic icon widget
- *
- * Author:
- * Lauris Kaplinski <lauris@kaplinski.com>
- * Jon A. Cruz <jon@joncruz.org>
- *
- * Copyright (C) 2002 Lauris Kaplinski
- * Copyright (C) 2010 Authors
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include <gtkmm/widget.h>
-#include "icon-size.h"
-
-#define SP_TYPE_ICON sp_icon_get_type()
-#define SP_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SP_TYPE_ICON, SPIcon))
-#define SP_IS_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SP_TYPE_ICON))
-
-namespace Glib {
-class ustring;
-}
-
-struct SPIconClass {
- GtkWidgetClass parent_class;
-};
-
-GType sp_icon_get_type() G_GNUC_CONST;
-
-struct SPIcon {
- GtkWidget widget;
-
- Inkscape::IconSize lsize;
- int psize;
- gchar *name;
-
- GdkPixbuf *pb;
-
- friend class SPIconImpl;
-};
-
-
-GtkWidget *sp_icon_new( Inkscape::IconSize size, const gchar *name );
-GdkPixbuf *sp_pixbuf_new( Inkscape::IconSize size, const gchar *name );
-
-// Might return a wrapped SPIcon, or Gtk::Image
-Gtk::Widget *sp_icon_get_icon( const Glib::ustring &oid, Inkscape::IconSize size = Inkscape::ICON_SIZE_BUTTON );
-
-void sp_icon_fetch_pixbuf( SPIcon *icon );
-int sp_icon_get_phys_size(int size);
-
-namespace Inkscape {
- void queueIconPrerender( Glib::ustring const &oid, Inkscape::IconSize size = Inkscape::ICON_SIZE_BUTTON );
-}
-
-#endif // SEEN_SP_ICON_H
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/widgets/ink-action.cpp b/src/widgets/ink-action.cpp
index 8859306f1..dae214656 100644
--- a/src/widgets/ink-action.cpp
+++ b/src/widgets/ink-action.cpp
@@ -1,5 +1,4 @@
#include "ink-action.h"
-#include "widgets/icon.h"
#include <gtk/gtk.h>
@@ -13,7 +12,7 @@ static GtkWidget* ink_action_create_tool_item( GtkAction* action );
struct _InkActionPrivate
{
gchar* iconId;
- Inkscape::IconSize iconSize;
+ GtkIconSize iconSize;
};
#define INK_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_ACTION_TYPE, InkActionPrivate ) )
@@ -52,9 +51,9 @@ static void ink_action_class_init( InkActionClass* klass )
g_param_spec_int( "iconSize",
"Icon Size",
"The size the icon",
- (int)Inkscape::ICON_SIZE_MENU,
- (int)Inkscape::ICON_SIZE_DECORATION,
- (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR,
+ (int)GTK_ICON_SIZE_MENU,
+ (int)GTK_ICON_SIZE_DIALOG,
+ (int)GTK_ICON_SIZE_SMALL_TOOLBAR,
(GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
g_type_class_add_private( klass, sizeof(InkActionClass) );
@@ -65,7 +64,7 @@ static void ink_action_init( InkAction* action )
{
action->private_data = INK_ACTION_GET_PRIVATE( action );
action->private_data->iconId = 0;
- action->private_data->iconSize = Inkscape::ICON_SIZE_SMALL_TOOLBAR;
+ action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR;
}
static void ink_action_finalize( GObject* obj )
@@ -82,7 +81,7 @@ InkAction* ink_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size )
+ GtkIconSize size )
{
GObject* obj = (GObject*)g_object_new( INK_ACTION_TYPE,
"name", name,
@@ -134,7 +133,7 @@ void ink_action_set_property( GObject* obj, guint propId, const GValue *value, G
case PROP_INK_SIZE:
{
- action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ action->private_data->iconSize = (GtkIconSize)g_value_get_int( value );
}
break;
@@ -148,33 +147,7 @@ void ink_action_set_property( GObject* obj, guint propId, const GValue *value, G
static GtkWidget* ink_action_create_menu_item( GtkAction* action )
{
InkAction* act = INK_ACTION( action );
- GtkWidget* item = 0;
-
- if ( act->private_data->iconId ) {
- gchar* label = 0;
- g_object_get( G_OBJECT(act), "label", &label, NULL );
- item = gtk_image_menu_item_new_with_mnemonic( label );
-
- GtkWidget* child = sp_icon_new( Inkscape::ICON_SIZE_MENU, act->private_data->iconId );
- // TODO this work-around is until SPIcon will live properly inside of a popup menu
- if ( SP_IS_ICON(child) ) {
- SPIcon* icon = SP_ICON(child);
- sp_icon_fetch_pixbuf( icon );
- GdkPixbuf* target = icon->pb;
- if ( target ) {
- child = gtk_image_new_from_pixbuf( target );
- gtk_widget_set_sensitive(child, gtk_action_is_sensitive(action));
- gtk_widget_destroy( GTK_WIDGET(icon) );
- }
- }
- gtk_widget_show_all( child );
- gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM(item), child );
-
- g_free( label );
- label = 0;
- } else {
- item = GTK_ACTION_CLASS(ink_action_parent_class)->create_menu_item( action );
- }
+ GtkWidget* item = GTK_ACTION_CLASS(ink_action_parent_class)->create_menu_item( action );
return item;
}
@@ -188,7 +161,7 @@ static GtkWidget* ink_action_create_tool_item( GtkAction* action )
if ( GTK_IS_TOOL_BUTTON(item) ) {
GtkToolButton* button = GTK_TOOL_BUTTON(item);
- GtkWidget* child = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
+ GtkWidget* child = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize );
gtk_tool_button_set_icon_widget( button, child );
} else {
// For now trigger a warning but don't do anything else
diff --git a/src/widgets/ink-action.h b/src/widgets/ink-action.h
index 738212c61..99786c878 100644
--- a/src/widgets/ink-action.h
+++ b/src/widgets/ink-action.h
@@ -37,7 +37,7 @@ InkAction* ink_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size );
+ GtkIconSize size );
G_END_DECLS
diff --git a/src/widgets/ink-radio-action.cpp b/src/widgets/ink-radio-action.cpp
index 2113819c3..e2bf828ce 100644
--- a/src/widgets/ink-radio-action.cpp
+++ b/src/widgets/ink-radio-action.cpp
@@ -10,7 +10,7 @@ static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action );
struct _InkRadioActionPrivate
{
gchar* iconId;
- Inkscape::IconSize iconSize;
+ GtkIconSize iconSize;
};
#define INK_RADIO_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_RADIO_ACTION_TYPE, InkRadioActionPrivate ) )
@@ -49,9 +49,9 @@ static void ink_radio_action_class_init( InkRadioActionClass* klass )
g_param_spec_int( "iconSize",
"Icon Size",
"The size the icon",
- (int)Inkscape::ICON_SIZE_MENU,
- (int)Inkscape::ICON_SIZE_DECORATION,
- (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR,
+ (int)GTK_ICON_SIZE_MENU,
+ (int)GTK_ICON_SIZE_DIALOG,
+ (int)GTK_ICON_SIZE_SMALL_TOOLBAR,
(GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
g_type_class_add_private( klass, sizeof(InkRadioActionClass) );
@@ -62,7 +62,7 @@ static void ink_radio_action_init( InkRadioAction* action )
{
action->private_data = INK_RADIO_ACTION_GET_PRIVATE( action );
action->private_data->iconId = 0;
- action->private_data->iconSize = Inkscape::ICON_SIZE_SMALL_TOOLBAR;
+ action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR;
}
static void ink_radio_action_finalize( GObject* obj )
@@ -78,14 +78,14 @@ InkRadioAction* ink_radio_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size )
+ GtkIconSize size )
{
GObject* obj = (GObject*)g_object_new( INK_RADIO_ACTION_TYPE,
"name", name,
"label", label,
"tooltip", tooltip,
"iconId", inkId,
- "iconSize", Inkscape::getRegisteredIconSize(size),
+ "iconSize", size,
NULL );
InkRadioAction* action = INK_RADIO_ACTION( obj );
@@ -130,7 +130,7 @@ void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *va
case PROP_INK_SIZE:
{
- action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ action->private_data->iconSize = (GtkIconSize)g_value_get_int( value );
}
break;
@@ -157,7 +157,7 @@ static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
if ( GTK_IS_TOOL_BUTTON(item) ) {
GtkToolButton* button = GTK_TOOL_BUTTON(item);
- GtkWidget* child = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
+ GtkWidget* child = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize );
gtk_widget_set_hexpand(child, FALSE);
gtk_widget_set_vexpand(child, FALSE);
gtk_tool_button_set_icon_widget(button, child);
diff --git a/src/widgets/ink-radio-action.h b/src/widgets/ink-radio-action.h
index c1f059c4f..52afa0cb8 100644
--- a/src/widgets/ink-radio-action.h
+++ b/src/widgets/ink-radio-action.h
@@ -3,8 +3,6 @@
#include <gtk/gtk.h>
-#include "icon.h"
-
G_BEGIN_DECLS
#define INK_RADIO_ACTION_TYPE ( ink_radio_action_get_type() )
@@ -35,7 +33,7 @@ InkRadioAction* ink_radio_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size );
+ GtkIconSize size );
G_END_DECLS
diff --git a/src/widgets/ink-toggle-action.cpp b/src/widgets/ink-toggle-action.cpp
index 3eed974dc..c091a2e0d 100644
--- a/src/widgets/ink-toggle-action.cpp
+++ b/src/widgets/ink-toggle-action.cpp
@@ -1,5 +1,4 @@
#include "ink-toggle-action.h"
-#include "icon.h"
static void ink_toggle_action_finalize( GObject* obj );
static void ink_toggle_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
@@ -13,7 +12,7 @@ static void ink_toggle_action_update_icon( InkToggleAction* action );
struct _InkToggleActionPrivate
{
gchar* iconId;
- Inkscape::IconSize iconSize;
+ GtkIconSize iconSize;
};
#define INK_TOGGLE_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_TOGGLE_ACTION_TYPE, InkToggleActionPrivate ) )
@@ -65,7 +64,7 @@ static void ink_toggle_action_init( InkToggleAction* action )
{
action->private_data = INK_TOGGLE_ACTION_GET_PRIVATE( action );
action->private_data->iconId = 0;
- action->private_data->iconSize = Inkscape::ICON_SIZE_SMALL_TOOLBAR;
+ action->private_data->iconSize = GTK_ICON_SIZE_SMALL_TOOLBAR;
}
static void ink_toggle_action_finalize( GObject* obj )
@@ -81,7 +80,7 @@ InkToggleAction* ink_toggle_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size,
+ GtkIconSize size,
SPAttributeEnum attr)
{
GObject* obj = (GObject*)g_object_new( INK_TOGGLE_ACTION_TYPE,
@@ -89,7 +88,7 @@ InkToggleAction* ink_toggle_action_new( const gchar *name,
"label", label,
"tooltip", tooltip,
"iconId", inkId,
- "iconSize", Inkscape::getRegisteredIconSize(size),
+ "iconSize", size,
//"SP_ATTR_INKSCAPE", attr, // Why doesn't this work and do I need to use g_object_set_data below?
NULL );
@@ -138,7 +137,7 @@ void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *v
case PROP_INK_SIZE:
{
- action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ action->private_data->iconSize = (GtkIconSize)g_value_get_int( value );
}
break;
@@ -164,7 +163,7 @@ static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action )
if ( GTK_IS_TOOL_BUTTON(item) ) {
GtkToolButton* button = GTK_TOOL_BUTTON(item);
if ( act->private_data->iconId ) {
- GtkWidget* child = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
+ GtkWidget* child = gtk_image_new_from_icon_name( act->private_data->iconId, act->private_data->iconSize );
gtk_widget_set_hexpand(child, FALSE);
gtk_widget_set_vexpand(child, FALSE);
@@ -196,7 +195,7 @@ static void ink_toggle_action_update_icon( InkToggleAction* action )
if ( GTK_IS_TOOL_BUTTON(proxies->data) ) {
GtkToolButton* button = GTK_TOOL_BUTTON(proxies->data);
- GtkWidget* child = sp_icon_new( action->private_data->iconSize, action->private_data->iconId );
+ GtkWidget* child = gtk_image_new_from_icon_name( action->private_data->iconId, action->private_data->iconSize );
gtk_widget_set_hexpand(child, FALSE);
gtk_widget_set_vexpand(child, FALSE);
gtk_widget_show_all(child);
diff --git a/src/widgets/ink-toggle-action.h b/src/widgets/ink-toggle-action.h
index 8e9d5e257..9130b9f9f 100644
--- a/src/widgets/ink-toggle-action.h
+++ b/src/widgets/ink-toggle-action.h
@@ -35,7 +35,7 @@ InkToggleAction* ink_toggle_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size,
+ GtkIconSize size,
SPAttributeEnum attr = SP_ATTR_INVALID);
G_END_DECLS
diff --git a/src/widgets/ink-tool-menu-action.cpp b/src/widgets/ink-tool-menu-action.cpp
index 29d8dc92f..44c09147b 100644
--- a/src/widgets/ink-tool-menu-action.cpp
+++ b/src/widgets/ink-tool-menu-action.cpp
@@ -21,7 +21,7 @@ ink_tool_menu_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size )
+ GtkIconSize size )
{
g_return_val_if_fail (name != NULL, NULL);
diff --git a/src/widgets/ink-tool-menu-action.h b/src/widgets/ink-tool-menu-action.h
index be04489d3..c34aa1322 100644
--- a/src/widgets/ink-tool-menu-action.h
+++ b/src/widgets/ink-tool-menu-action.h
@@ -34,7 +34,7 @@ InkToolMenuAction* ink_tool_menu_action_new( const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *inkId,
- Inkscape::IconSize size );
+ GtkIconSize size );
G_END_DECLS
diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp
index c714aba10..d03be1b44 100644
--- a/src/widgets/lpe-toolbar.cpp
+++ b/src/widgets/lpe-toolbar.cpp
@@ -328,7 +328,7 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO
_("Show limiting bounding box"),
_("Show bounding box (used to cut infinite lines)"),
"show-bounding-box",
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(lpetool_toggle_show_bbox), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool( "/tools/lpetool/show_bbox", true ) );
@@ -340,7 +340,7 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO
_("Get limiting bounding box from selection"),
_("Set limiting bounding box (used to cut infinite lines) to the bounding box of current selection"),
"draw-geometry-set-bounding-box",
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(lpetool_toggle_set_bbox), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), FALSE );
@@ -369,7 +369,7 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO
_("Display measuring info"),
_("Display measuring info for selected items"),
"draw-geometry-show-measuring-info",
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(lpetool_toggle_show_measuring_info), holder );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool( "/tools/lpetool/show_measuring_info", true ) );
@@ -390,7 +390,7 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO
_("Open LPE dialog"),
_("Open LPE dialog (to adapt parameters numerically)"),
"dialog-geometry",
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(lpetool_open_lpe_dialog), desktop );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), FALSE );
diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp
index 066c3fbfa..fc6cfdb11 100644
--- a/src/widgets/measure-toolbar.cpp
+++ b/src/widgets/measure-toolbar.cpp
@@ -266,7 +266,7 @@ void sp_measure_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, G
g_object_set_data( holder, "tracker", tracker );
EgeAdjustmentAction *eact = 0;
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
/* Font Size */
{
diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp
index 0ca1cc027..666d29fc4 100644
--- a/src/widgets/mesh-toolbar.cpp
+++ b/src/widgets/mesh-toolbar.cpp
@@ -375,7 +375,7 @@ static void mesh_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase*
*/
void sp_mesh_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
EgeAdjustmentAction* eact = 0;
diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp
index 31efaa0b4..b1346ed89 100644
--- a/src/widgets/node-toolbar.cpp
+++ b/src/widgets/node-toolbar.cpp
@@ -332,7 +332,7 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
tracker->setActiveUnit(&doc_units);
g_object_set_data( holder, "tracker", tracker );
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
InkToolMenuAction* inky = ink_tool_menu_action_new( "NodeInsertAction",
diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp
index 855371ddd..27fe4b63a 100644
--- a/src/widgets/paint-selector.cpp
+++ b/src/widgets/paint-selector.cpp
@@ -27,7 +27,6 @@
#include "widgets/swatch-selector.h"
#include "sp-pattern.h"
#include <glibmm/i18n.h>
-#include "widgets/icon.h"
#include "widgets/widget-sizes.h"
#include "xml/repr.h"
@@ -236,7 +235,7 @@ sp_paint_selector_init(SPPaintSelector *psel)
// TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty
gtk_widget_set_tooltip_text(psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)"));
g_object_set_data(G_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_EVENODD));
- w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("fill-rule-even-odd"));
+ w = gtk_image_new_from_icon_name("fill-rule-even-odd", GTK_ICON_SIZE_MENU);
gtk_container_add(GTK_CONTAINER(psel->evenodd), w);
gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->evenodd, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(psel->evenodd), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel);
@@ -247,7 +246,7 @@ sp_paint_selector_init(SPPaintSelector *psel)
// TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/painting.html#FillRuleProperty
gtk_widget_set_tooltip_text(psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)"));
g_object_set_data(G_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_NONZERO));
- w = sp_icon_new(Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("fill-rule-nonzero"));
+ w = gtk_image_new_from_icon_name("fill-rule-nonzero", GTK_ICON_SIZE_MENU);
gtk_container_add(GTK_CONTAINER(psel->nonzero), w);
gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->nonzero, FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(psel->nonzero), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel);
@@ -316,7 +315,7 @@ static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel,
gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(b), FALSE);
g_object_set_data(G_OBJECT(b), "mode", GUINT_TO_POINTER(mode));
- w = sp_icon_new(Inkscape::ICON_SIZE_BUTTON, pixmap);
+ w = gtk_image_new_from_icon_name(pixmap, GTK_ICON_SIZE_BUTTON);
gtk_widget_show(w);
gtk_container_add(GTK_CONTAINER(b), w);
diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp
index e2212b64f..1d5fb81e1 100644
--- a/src/widgets/paintbucket-toolbar.cpp
+++ b/src/widgets/paintbucket-toolbar.cpp
@@ -210,7 +210,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
_("Defaults"),
_("Reset paint bucket parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
INKSCAPE_ICON("edit-clear"),
- Inkscape::ICON_SIZE_SMALL_TOOLBAR);
+ GTK_ICON_SIZE_SMALL_TOOLBAR);
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(paintbucket_defaults), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
gtk_action_set_sensitive( GTK_ACTION(inky), TRUE );
diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp
index 96733cb22..918a54991 100644
--- a/src/widgets/pencil-toolbar.cpp
+++ b/src/widgets/pencil-toolbar.cpp
@@ -91,7 +91,7 @@ static void sp_add_freehand_mode_toggle(GtkActionGroup* mainActions, GObject* ho
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint freehandMode = prefs->getInt(( tool_is_pencil ? "/tools/freehand/pencil/freehand-mode" : "/tools/freehand/pen/freehand-mode" ), 0);
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
@@ -398,7 +398,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
_("Defaults"),
_("Reset pencil parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
INKSCAPE_ICON("edit-clear"),
- Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+ GTK_ICON_SIZE_SMALL_TOOLBAR );
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_pencil_tb_defaults), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
}
@@ -409,7 +409,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
_("LPE based interactive simplify"),
_("LPE based interactive simplify"),
INKSCAPE_ICON("interactive_simplify"),
- Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+ GTK_ICON_SIZE_SMALL_TOOLBAR );
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(itact), prefs->getInt("/tools/freehand/pencil/simplify", 0) );
g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(freehand_simplify_lpe), holder) ;
gtk_action_group_add_action( mainActions, GTK_ACTION(itact) );
@@ -420,7 +420,7 @@ void sp_pencil_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
_("LPE simplify flatten"),
_("LPE simplify flatten"),
INKSCAPE_ICON("flatten_simplify"),
- Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+ GTK_ICON_SIZE_SMALL_TOOLBAR );
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_simplify_flatten), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
g_object_set_data( holder, "flatten_simplify", inky );
diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp
index 67947c1fd..de599cbfb 100644
--- a/src/widgets/rect-toolbar.cpp
+++ b/src/widgets/rect-toolbar.cpp
@@ -289,7 +289,7 @@ static void rect_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase*
void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
EgeAdjustmentAction* eact = 0;
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
EgeOutputAction* act = ege_output_action_new( "RectStateAction", _("<b>New:</b>"), "", 0 );
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index 2ac7447dd..0932589d2 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -40,7 +40,6 @@
#include "ui/icon-names.h"
#include "ui/widget/unit-tracker.h"
#include "verbs.h"
-#include "widgets/icon.h"
#include "widgets/sp-widget.h"
#include "widgets/widget-sizes.h"
@@ -345,7 +344,7 @@ static void trigger_sp_action( GtkAction* /*act*/, gpointer user_data )
}
}
-static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
+static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, GtkIconSize size )
{
GtkAction* act = 0;
@@ -355,15 +354,13 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi
g_signal_connect( G_OBJECT(inky), "activate", G_CALLBACK(trigger_sp_action), targetAction );
- Inkscape::queueIconPrerender( verb->get_image(), size );
-
return act;
}
void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
Inkscape::UI::View::View *view = desktop;
- Inkscape::IconSize secondarySize = Inkscape::UI::ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = Inkscape::UI::ToolboxFactory::prefToSize("/toolbox/secondary", 1);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
GtkAction* act = 0;
@@ -492,7 +489,7 @@ void sp_select_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GOb
_("Lock width and height"),
_("When locked, change both width and height by the same proportion"),
INKSCAPE_ICON("object-unlocked"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
g_object_set( itact, "short_label", "Lock", NULL );
g_object_set_data( G_OBJECT(spw), "lock", itact );
g_signal_connect_after( G_OBJECT(itact), "toggled", G_CALLBACK(toggle_lock), desktop) ;
diff --git a/src/widgets/spiral-toolbar.cpp b/src/widgets/spiral-toolbar.cpp
index 98d21c84d..ef9f5bce8 100644
--- a/src/widgets/spiral-toolbar.cpp
+++ b/src/widgets/spiral-toolbar.cpp
@@ -225,7 +225,7 @@ static void sp_spiral_toolbox_selection_changed(Inkscape::Selection *selection,
void sp_spiral_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
EgeAdjustmentAction* eact = 0;
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
EgeOutputAction* act = ege_output_action_new( "SpiralStateAction", _("<b>New:</b>"), "", 0 );
diff --git a/src/widgets/spray-toolbar.cpp b/src/widgets/spray-toolbar.cpp
index f456bc763..2a56d81cb 100644
--- a/src/widgets/spray-toolbar.cpp
+++ b/src/widgets/spray-toolbar.cpp
@@ -287,7 +287,7 @@ static void sp_toggle_pick_inverse_value( GtkToggleAction* act, gpointer data )
void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
{
/* Width */
@@ -311,7 +311,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Pressure"),
_("Use the pressure of the input device to alter the width of spray area"),
INKSCAPE_ICON("draw-use-pressure"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurewidth");
g_signal_connect(holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
@@ -427,7 +427,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Pressure"),
_("Use the pressure of the input device to alter the amount of sprayed objects"),
INKSCAPE_ICON("draw-use-pressure"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
PrefPusher *pusher = new PrefPusher(GTK_TOGGLE_ACTION(act), "/tools/spray/usepressurepopulation");
g_signal_connect(holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
@@ -476,7 +476,7 @@ void sp_spray_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Pressure"),
_("Use the pressure of the input device to alter the scale of new items"),
INKSCAPE_ICON("draw-use-pressure"),
- Inkscape::ICON_SIZE_DECORATION);
+ GTK_ICON_SIZE_MENU);
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/spray/usepressurescale", false) );
g_object_set_data( holder, "usepressurescale", act );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_toggle_pressure_scale), holder) ;
diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp
index 8f667a656..657b38f18 100644
--- a/src/widgets/star-toolbar.cpp
+++ b/src/widgets/star-toolbar.cpp
@@ -436,7 +436,7 @@ static void star_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase*
void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
EgeOutputAction* act = ege_output_action_new( "StarStateAction", _("<b>New:</b>"), "", 0 );
@@ -562,7 +562,7 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
_("Defaults"),
_("Reset shape parameters to defaults (use Inkscape Preferences > Tools to change defaults)"),
INKSCAPE_ICON("edit-clear"),
- Inkscape::ICON_SIZE_SMALL_TOOLBAR);
+ GTK_ICON_SIZE_SMALL_TOOLBAR);
g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(sp_stb_defaults), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(inky) );
gtk_action_set_sensitive( GTK_ACTION(inky), TRUE );
diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp
index 3f81bef5c..96994741c 100644
--- a/src/widgets/stroke-marker-selector.cpp
+++ b/src/widgets/stroke-marker-selector.cpp
@@ -54,13 +54,8 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) :
set_cell_data_func(image_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareImageRenderer));
gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, NULL, NULL);
- Glib::ustring no_marker("no-marker");
- Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default();
- if (!iconTheme->has_icon(no_marker)) {
- Inkscape::queueIconPrerender( INKSCAPE_ICON(no_marker.data()), Inkscape::ICON_SIZE_SMALL_TOOLBAR );
- }
- empty_image = new Gtk::Image( Glib::wrap(
- sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON(no_marker.data()) ) ) );
+ empty_image = new Gtk::Image();
+ empty_image->set_from_icon_name("no-marker", Gtk::ICON_SIZE_SMALL_TOOLBAR);
sandbox = ink_markers_preview_doc ();
desktop = SP_ACTIVE_DESKTOP;
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index de3e98297..3115a32db 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -111,8 +111,9 @@ StrokeStyle::StrokeStyleButton::StrokeStyleButton(Gtk::RadioButtonGroup &grp,
{
show();
set_mode(false);
-
- Gtk::Widget *px = Gtk::manage(Glib::wrap(sp_icon_new(Inkscape::ICON_SIZE_LARGE_TOOLBAR, icon)));
+
+ auto px = Gtk::manage(new Gtk::Image());
+ px->set_from_icon_name(icon, Gtk::ICON_SIZE_LARGE_TOOLBAR);
g_assert(px != NULL);
px->show();
add(*px);
diff --git a/src/widgets/stroke-style.h b/src/widgets/stroke-style.h
index cdd825c7d..b8eaec8e8 100644
--- a/src/widgets/stroke-style.h
+++ b/src/widgets/stroke-style.h
@@ -52,7 +52,6 @@
#include "svg/css-ostringstream.h"
#include "ui/cache/svg_preview_cache.h"
#include "ui/icon-names.h"
-#include "widgets/icon.h"
#include "widgets/paint-selector.h"
#include "widgets/sp-widget.h"
#include "widgets/spw-utilities.h"
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index efa5527e4..bf05448eb 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -1706,7 +1706,7 @@ static void text_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase*
void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
/* Font family */
{
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 65c54f0ce..09550a2e6 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -41,7 +41,6 @@
#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
#include "../helper/action.h"
-#include "icon.h"
#include "ink-action.h"
#include "ink-toggle-action.h"
#include "../inkscape.h"
@@ -120,12 +119,12 @@ enum BarId {
static GtkWidget *sp_empty_toolbox_new(SPDesktop *desktop);
-Inkscape::IconSize ToolboxFactory::prefToSize( Glib::ustring const &path, int base ) {
- static Inkscape::IconSize sizeChoices[] = {
- Inkscape::ICON_SIZE_LARGE_TOOLBAR,
- Inkscape::ICON_SIZE_SMALL_TOOLBAR,
- Inkscape::ICON_SIZE_MENU,
- Inkscape::ICON_SIZE_DIALOG
+GtkIconSize ToolboxFactory::prefToSize( Glib::ustring const &path, int base ) {
+ static GtkIconSize sizeChoices[] = {
+ GTK_ICON_SIZE_LARGE_TOOLBAR,
+ GTK_ICON_SIZE_SMALL_TOOLBAR,
+ GTK_ICON_SIZE_MENU,
+ GTK_ICON_SIZE_DIALOG
};
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int index = prefs->getIntLimited( path, base, 0, G_N_ELEMENTS(sizeChoices) );
@@ -244,7 +243,7 @@ static void update_aux_toolbox(SPDesktop *desktop, ToolBase *eventcontext, GtkWi
static void setup_commands_toolbox(GtkWidget *toolbox, SPDesktop *desktop);
static void update_commands_toolbox(SPDesktop *desktop, ToolBase *eventcontext, GtkWidget *toolbox);
-static GtkToolItem * sp_toolbox_button_item_new_from_verb_with_doubleclick( GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
+static GtkToolItem * sp_toolbox_button_item_new_from_verb_with_doubleclick( GtkWidget *t, GtkIconSize size, SPButtonType type,
Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb,
Inkscape::UI::View::View *view);
@@ -301,11 +300,6 @@ VerbAction::~VerbAction()
Gtk::Widget* VerbAction::create_menu_item_vfunc()
{
-// First call in to get the icon rendered if present in SVG
- Gtk::Widget *widget = sp_icon_get_icon( get_icon_name(), Inkscape::ICON_SIZE_MENU );
- delete widget;
- widget = 0;
-
Gtk::Widget* widg = Gtk::Action::create_menu_item_vfunc();
// g_message("create_menu_item_vfunc() = %p for '%s'", widg, verb->get_id());
return widg;
@@ -314,7 +308,7 @@ Gtk::Widget* VerbAction::create_menu_item_vfunc()
Gtk::Widget* VerbAction::create_tool_item_vfunc()
{
// Gtk::Widget* widg = Gtk::Action::create_tool_item_vfunc();
- Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/tools/small");
+ GtkIconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/tools/small");
GtkWidget* toolbox = 0;
GtkToolItem *button_toolitem = sp_toolbox_button_item_new_from_verb_with_doubleclick( toolbox, toolboxSize,
SP_BUTTON_TYPE_TOGGLE,
@@ -452,7 +446,7 @@ void delete_prefspusher(GObject * /*obj*/, PrefPusher *watcher )
// ------------------------------------------------------
-GtkToolItem * sp_toolbox_button_item_new_from_verb_with_doubleclick(GtkWidget *t, Inkscape::IconSize size, SPButtonType type,
+GtkToolItem * sp_toolbox_button_item_new_from_verb_with_doubleclick(GtkWidget *t, GtkIconSize size, SPButtonType type,
Inkscape::Verb *verb, Inkscape::Verb *doubleclick_verb,
Inkscape::UI::View::View *view)
{
@@ -504,7 +498,7 @@ static void trigger_sp_action( GtkAction* /*act*/, gpointer user_data )
}
}
-static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, Inkscape::IconSize size )
+static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::View::View* view, GtkIconSize size )
{
GtkAction* act = 0;
@@ -584,7 +578,7 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto
SP_VERB_ZOOM_SELECTION
};
- Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small");
+ GtkIconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small");
Glib::RefPtr<Gtk::ActionGroup> mainActions;
if (desktop == NULL)
{
@@ -853,7 +847,7 @@ static void setupToolboxCommon( GtkWidget *toolbox,
gtk_toolbar_set_style( GTK_TOOLBAR(toolBar), GTK_TOOLBAR_ICONS );
}
- Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize(sizePref);
+ GtkIconSize toolboxSize = ToolboxFactory::prefToSize(sizePref);
gtk_toolbar_set_icon_size( GTK_TOOLBAR(toolBar), static_cast<GtkIconSize>(toolboxSize) );
GtkPositionType pos = static_cast<GtkPositionType>(GPOINTER_TO_INT(g_object_get_data( G_OBJECT(toolbox), HANDLE_POS_MARK )));
@@ -1039,7 +1033,7 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
gtk_toolbar_set_style( GTK_TOOLBAR(toolBar), GTK_TOOLBAR_ICONS );
}
- Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small");
+ GtkIconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small");
gtk_toolbar_set_icon_size( GTK_TOOLBAR(toolBar), static_cast<GtkIconSize>(toolboxSize) );
gtk_widget_set_hexpand(toolBar, TRUE);
gtk_grid_attach( GTK_GRID(holder), toolBar, 0, 0, 1, 1);
@@ -1230,7 +1224,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
{
Glib::RefPtr<Gtk::ActionGroup> mainActions = create_or_fetch_actions(desktop);
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
{
// TODO: This is a cludge. On the one hand we have verbs+actions,
diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h
index db9130034..09178ec2f 100644
--- a/src/widgets/toolbox.h
+++ b/src/widgets/toolbox.h
@@ -61,7 +61,7 @@ public:
static void updateSnapToolbox(SPDesktop *desktop, Inkscape::UI::Tools::ToolBase *eventcontext, GtkWidget *toolbox);
- static Inkscape::IconSize prefToSize(Glib::ustring const &path, int base = 0 );
+ static GtkIconSize prefToSize(Glib::ustring const &path, int base = 0 );
private:
ToolboxFactory();
diff --git a/src/widgets/tweak-toolbar.cpp b/src/widgets/tweak-toolbar.cpp
index a6b8ba436..6a2847c68 100644
--- a/src/widgets/tweak-toolbar.cpp
+++ b/src/widgets/tweak-toolbar.cpp
@@ -117,7 +117,7 @@ static void tweak_toggle_doo(GtkToggleAction *act, gpointer /*data*/) {
void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
- Inkscape::IconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
+ GtkIconSize secondarySize = ToolboxFactory::prefToSize("/toolbox/secondary", 1);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
{
@@ -286,7 +286,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Hue"),
_("In color mode, act on objects' hue"),
NULL,
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
//TRANSLATORS: "H" here stands for hue
g_object_set( act, "short_label", C_("Hue", "H"), NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
@@ -302,7 +302,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Saturation"),
_("In color mode, act on objects' saturation"),
NULL,
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
//TRANSLATORS: "S" here stands for Saturation
g_object_set( act, "short_label", C_("Saturation", "S"), NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
@@ -318,7 +318,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Lightness"),
_("In color mode, act on objects' lightness"),
NULL,
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
//TRANSLATORS: "L" here stands for Lightness
g_object_set( act, "short_label", C_("Lightness", "L"), NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
@@ -334,7 +334,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Opacity"),
_("In color mode, act on objects' opacity"),
NULL,
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
//TRANSLATORS: "O" here stands for Opacity
g_object_set( act, "short_label", C_("Opacity", "O"), NULL );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
@@ -372,7 +372,7 @@ void sp_tweak_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObj
_("Pressure"),
_("Use the pressure of the input device to alter the force of tweak action"),
INKSCAPE_ICON("draw-use-pressure"),
- Inkscape::ICON_SIZE_DECORATION );
+ GTK_ICON_SIZE_MENU );
gtk_action_group_add_action( mainActions, GTK_ACTION( act ) );
g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(sp_tweak_pressure_state_changed), NULL);
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/tweak/usepressure", true) );