summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2016-08-05 18:07:48 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2016-08-05 18:07:48 +0000
commita0cacd78d5d987eafa3739bb8f45587d82246780 (patch)
tree69c9a500d9553d0d99f676201a53395ff6c82f74 /src/widgets
parentbuild-x64.xml now uses GTK+ 3 (diff)
downloadinkscape-a0cacd78d5d987eafa3739bb8f45587d82246780.tar.gz
inkscape-a0cacd78d5d987eafa3739bb8f45587d82246780.zip
Split InkAction classes into separate files
(bzr r15043)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/CMakeLists.txt6
-rw-r--r--src/widgets/Makefile_insert6
-rw-r--r--src/widgets/arc-toolbar.cpp3
-rw-r--r--src/widgets/box3d-toolbar.cpp2
-rw-r--r--src/widgets/calligraphy-toolbar.cpp1
-rw-r--r--src/widgets/connector-toolbar.cpp3
-rw-r--r--src/widgets/dropper-toolbar.cpp2
-rw-r--r--src/widgets/eraser-toolbar.cpp4
-rw-r--r--src/widgets/gradient-toolbar.cpp4
-rw-r--r--src/widgets/ink-action.cpp440
-rw-r--r--src/widgets/ink-action.h124
-rw-r--r--src/widgets/ink-radio-action.cpp185
-rw-r--r--src/widgets/ink-radio-action.h52
-rw-r--r--src/widgets/ink-toggle-action.cpp221
-rw-r--r--src/widgets/ink-toggle-action.h53
-rw-r--r--src/widgets/ink-tool-menu-action.cpp49
-rw-r--r--src/widgets/ink-tool-menu-action.h52
-rw-r--r--src/widgets/lpe-toolbar.cpp3
-rw-r--r--src/widgets/measure-toolbar.cpp3
-rw-r--r--src/widgets/mesh-toolbar.cpp4
-rw-r--r--src/widgets/node-toolbar.cpp3
-rw-r--r--src/widgets/pencil-toolbar.cpp4
-rw-r--r--src/widgets/select-toolbar.cpp3
-rw-r--r--src/widgets/spray-toolbar.cpp3
-rw-r--r--src/widgets/star-toolbar.cpp3
-rw-r--r--src/widgets/text-toolbar.cpp3
-rw-r--r--src/widgets/toolbox.cpp1
-rw-r--r--src/widgets/tweak-toolbar.cpp3
28 files changed, 680 insertions, 560 deletions
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index ba71b39f4..47ffe82ac 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -36,6 +36,9 @@ set(widgets_SRC
image-menu-item.c
ink-action.cpp
ink-comboboxentry-action.cpp
+ ink-radio-action.cpp
+ ink-toggle-action.cpp
+ ink-tool-menu-action.cpp
paint-selector.cpp
ruler.cpp
select-toolbar.cpp
@@ -92,6 +95,9 @@ set(widgets_SRC
image-menu-item.h
ink-action.h
ink-comboboxentry-action.h
+ ink-radio-action.h
+ ink-toggle-action.h
+ ink-tool-menu-action.h
paint-selector.h
ruler.h
select-toolbar.h
diff --git a/src/widgets/Makefile_insert b/src/widgets/Makefile_insert
index 8f10e1d56..7434a5394 100644
--- a/src/widgets/Makefile_insert
+++ b/src/widgets/Makefile_insert
@@ -50,6 +50,12 @@ ink_common_sources += \
widgets/ink-action.h \
widgets/ink-comboboxentry-action.cpp \
widgets/ink-comboboxentry-action.h \
+ widgets/ink-radio-action.cpp \
+ widgets/ink-radio-action.h \
+ widgets/ink-toggle-action.cpp \
+ widgets/ink-toggle-action.h \
+ widgets/ink-tool-menu-action.cpp \
+ widgets/ink-tool-menu-action.h \
widgets/lpe-toolbar.cpp \
widgets/lpe-toolbar.h \
widgets/measure-toolbar.cpp \
diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp
index 35c8c0308..81cde97d4 100644
--- a/src/widgets/arc-toolbar.cpp
+++ b/src/widgets/arc-toolbar.cpp
@@ -37,7 +37,8 @@
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-output-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-radio-action.h"
#include "mod360.h"
#include "selection.h"
#include "sp-ellipse.h"
diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp
index b8c67ee76..95de28cf2 100644
--- a/src/widgets/box3d-toolbar.cpp
+++ b/src/widgets/box3d-toolbar.cpp
@@ -37,7 +37,7 @@
#include "document-undo.h"
#include "document.h"
#include "widgets/ege-adjustment-action.h"
-#include "widgets/ink-action.h"
+#include "widgets/ink-toggle-action.h"
#include "inkscape.h"
#include "persp3d.h"
#include "toolbox.h"
diff --git a/src/widgets/calligraphy-toolbar.cpp b/src/widgets/calligraphy-toolbar.cpp
index ba51499aa..031295ccd 100644
--- a/src/widgets/calligraphy-toolbar.cpp
+++ b/src/widgets/calligraphy-toolbar.cpp
@@ -37,6 +37,7 @@
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
#include "widgets/ink-action.h"
+#include "widgets/ink-toggle-action.h"
#include "toolbox.h"
#include "ui/icon-names.h"
#include "ui/uxmanager.h"
diff --git a/src/widgets/connector-toolbar.cpp b/src/widgets/connector-toolbar.cpp
index f80f49db7..46493f3ae 100644
--- a/src/widgets/connector-toolbar.cpp
+++ b/src/widgets/connector-toolbar.cpp
@@ -38,7 +38,8 @@
#include "widgets/ege-adjustment-action.h"
#include "enums.h"
#include "graphlayout.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-toggle-action.h"
#include "inkscape.h"
#include "sp-namedview.h"
#include "toolbox.h"
diff --git a/src/widgets/dropper-toolbar.cpp b/src/widgets/dropper-toolbar.cpp
index f60955da5..4e26a99a0 100644
--- a/src/widgets/dropper-toolbar.cpp
+++ b/src/widgets/dropper-toolbar.cpp
@@ -33,7 +33,7 @@
#include "dropper-toolbar.h"
#include "document-undo.h"
#include "widgets/ege-output-action.h"
-#include "widgets/ink-action.h"
+#include "ink-toggle-action.h"
#include "preferences.h"
#include "widgets/spinbutton-events.h"
diff --git a/src/widgets/eraser-toolbar.cpp b/src/widgets/eraser-toolbar.cpp
index b30d542a6..7f710a777 100644
--- a/src/widgets/eraser-toolbar.cpp
+++ b/src/widgets/eraser-toolbar.cpp
@@ -37,7 +37,9 @@
#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "toolbox.h"
#include "ui/icon-names.h"
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index 7e9223770..fd2eb7efe 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -27,7 +27,9 @@
#include "gradient-chemistry.h"
#include "gradient-drag.h"
#include "gradient-toolbar.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "macros.h"
#include "selection.h"
#include "sp-defs.h"
diff --git a/src/widgets/ink-action.cpp b/src/widgets/ink-action.cpp
index 501aeaa74..2f1bf94e4 100644
--- a/src/widgets/ink-action.cpp
+++ b/src/widgets/ink-action.cpp
@@ -205,433 +205,13 @@ static GtkWidget* ink_action_create_tool_item( GtkAction* action )
return item;
}
-
-
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-
-
-static void ink_toggle_action_finalize( GObject* obj );
-static void ink_toggle_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
-static void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
-
-static GtkWidget* ink_toggle_action_create_menu_item( GtkAction* action );
-static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action );
-
-static void ink_toggle_action_update_icon( InkToggleAction* action );
-
-struct _InkToggleActionPrivate
-{
- gchar* iconId;
- Inkscape::IconSize iconSize;
-};
-
-#define INK_TOGGLE_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_TOGGLE_ACTION_TYPE, InkToggleActionPrivate ) )
-
-G_DEFINE_TYPE(InkToggleAction, ink_toggle_action, GTK_TYPE_TOGGLE_ACTION);
-
-static void ink_toggle_action_class_init( InkToggleActionClass* klass )
-{
- if ( klass ) {
- GObjectClass * objClass = G_OBJECT_CLASS( klass );
-
- objClass->finalize = ink_toggle_action_finalize;
- objClass->get_property = ink_toggle_action_get_property;
- objClass->set_property = ink_toggle_action_set_property;
-
- klass->parent_class.parent_class.create_menu_item = ink_toggle_action_create_menu_item;
- klass->parent_class.parent_class.create_tool_item = ink_toggle_action_create_tool_item;
- /*klass->parent_class.connect_proxy = connect_proxy;*/
- /*klass->parent_class.disconnect_proxy = disconnect_proxy;*/
-
- g_object_class_install_property( objClass,
- PROP_INK_ID,
- g_param_spec_string( "iconId",
- "Icon ID",
- "The id for the icon",
- "",
- (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
-
- g_object_class_install_property( objClass,
- PROP_INK_SIZE,
- g_param_spec_int( "iconSize",
- "Icon Size",
- "The size the icon",
- (int)Inkscape::ICON_SIZE_MENU,
- (int)99,
- (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR,
- (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
-
- g_type_class_add_private( klass, sizeof(InkToggleActionClass) );
- }
-}
-
-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;
-}
-
-static void ink_toggle_action_finalize( GObject* obj )
-{
- InkToggleAction* action = INK_TOGGLE_ACTION( obj );
-
- g_free( action->private_data->iconId );
- g_free( action->private_data );
-
-}
-
-InkToggleAction* ink_toggle_action_new( const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *inkId,
- Inkscape::IconSize size,
- SPAttributeEnum attr)
-{
- GObject* obj = (GObject*)g_object_new( INK_TOGGLE_ACTION_TYPE,
- "name", name,
- "label", label,
- "tooltip", tooltip,
- "iconId", inkId,
- "iconSize", Inkscape::getRegisteredIconSize(size),
- //"SP_ATTR_INKSCAPE", attr, // Why doesn't this work and do I need to use g_object_set_data below?
- NULL );
-
- g_object_set_data(obj, "SP_ATTR_INKSCAPE", GINT_TO_POINTER(attr));
- InkToggleAction* action = INK_TOGGLE_ACTION( obj );
-
- return action;
-}
-
-static void ink_toggle_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec )
-{
- InkToggleAction* action = INK_TOGGLE_ACTION( obj );
- (void)action;
- switch ( propId ) {
- case PROP_INK_ID:
- {
- g_value_set_string( value, action->private_data->iconId );
- }
- break;
-
- case PROP_INK_SIZE:
- {
- g_value_set_int( value, action->private_data->iconSize );
- }
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
- }
-}
-
-void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec )
-{
- InkToggleAction* action = INK_TOGGLE_ACTION( obj );
- (void)action;
- switch ( propId ) {
- case PROP_INK_ID:
- {
- gchar* tmp = action->private_data->iconId;
- action->private_data->iconId = g_value_dup_string( value );
- g_free( tmp );
-
- ink_toggle_action_update_icon( action );
- }
- break;
-
- case PROP_INK_SIZE:
- {
- action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
- }
- break;
-
- default:
- {
- G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
- }
- }
-}
-
-static GtkWidget* ink_toggle_action_create_menu_item( GtkAction* action )
-{
- GtkWidget* item = GTK_TOGGLE_ACTION_CLASS(ink_toggle_action_parent_class)->parent_class.create_menu_item(action);
-
- return item;
-}
-
-static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action )
-{
- InkToggleAction* act = INK_TOGGLE_ACTION( action );
-
- GtkWidget* item = GTK_TOGGLE_ACTION_CLASS(ink_toggle_action_parent_class)->parent_class.create_tool_item(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 );
-
- gtk_widget_set_hexpand(child, FALSE);
- gtk_widget_set_vexpand(child, FALSE);
- gtk_tool_button_set_icon_widget(button, child);
- } else {
- gchar *label = 0;
- g_object_get( G_OBJECT(action), "short_label", &label, NULL );
- gtk_tool_button_set_label( button, label );
- g_free( label );
- label = 0;
- }
- } else {
- // For now trigger a warning but don't do anything else
- GtkToolButton* button = GTK_TOOL_BUTTON(item);
- (void)button;
- }
- gtk_widget_show_all( item );
-
- return item;
-}
-
-
-static void ink_toggle_action_update_icon( InkToggleAction* action )
-{
- if ( action ) {
- GSList* proxies = gtk_action_get_proxies( GTK_ACTION(action) );
- while ( proxies ) {
- if ( GTK_IS_TOOL_ITEM(proxies->data) ) {
- 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 );
- gtk_widget_set_hexpand(child, FALSE);
- gtk_widget_set_vexpand(child, FALSE);
- gtk_widget_show_all(child);
- gtk_tool_button_set_icon_widget(button, child);
- }
- }
-
- proxies = g_slist_next( proxies );
- }
- }
-}
-
-
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-
-
-static void ink_radio_action_finalize( GObject* obj );
-static void ink_radio_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
-static void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
-
-static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action );
-static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action );
-
-struct _InkRadioActionPrivate
-{
- gchar* iconId;
- Inkscape::IconSize iconSize;
-};
-
-#define INK_RADIO_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_RADIO_ACTION_TYPE, InkRadioActionPrivate ) )
-
-G_DEFINE_TYPE(InkRadioAction, ink_radio_action, GTK_TYPE_RADIO_ACTION);
-
-static void ink_radio_action_class_init( InkRadioActionClass* klass )
-{
- if ( klass ) {
- GObjectClass * objClass = G_OBJECT_CLASS( klass );
-
- objClass->finalize = ink_radio_action_finalize;
- objClass->get_property = ink_radio_action_get_property;
- objClass->set_property = ink_radio_action_set_property;
-
- klass->parent_class.parent_class.parent_class.create_menu_item = ink_radio_action_create_menu_item;
- klass->parent_class.parent_class.parent_class.create_tool_item = ink_radio_action_create_tool_item;
- /*klass->parent_class.connect_proxy = connect_proxy;*/
- /*klass->parent_class.disconnect_proxy = disconnect_proxy;*/
-
- g_object_class_install_property( objClass,
- PROP_INK_ID,
- g_param_spec_string( "iconId",
- "Icon ID",
- "The id for the icon",
- "",
- (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
-
- g_object_class_install_property( objClass,
- PROP_INK_SIZE,
- 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,
- (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
-
- g_type_class_add_private( klass, sizeof(InkRadioActionClass) );
- }
-}
-
-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;
-}
-
-static void ink_radio_action_finalize( GObject* obj )
-{
- InkRadioAction* action = INK_RADIO_ACTION( obj );
-
- g_free( action->private_data->iconId );
- g_free( action->private_data );
-
-}
-
-InkRadioAction* ink_radio_action_new( const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *inkId,
- Inkscape::IconSize size )
-{
- GObject* obj = (GObject*)g_object_new( INK_RADIO_ACTION_TYPE,
- "name", name,
- "label", label,
- "tooltip", tooltip,
- "iconId", inkId,
- "iconSize", Inkscape::getRegisteredIconSize(size),
- NULL );
-
- InkRadioAction* action = INK_RADIO_ACTION( obj );
-
- return action;
-}
-
-static void ink_radio_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec )
-{
- InkRadioAction* action = INK_RADIO_ACTION( obj );
- (void)action;
- switch ( propId ) {
- case PROP_INK_ID:
- {
- g_value_set_string( value, action->private_data->iconId );
- }
- break;
-
- case PROP_INK_SIZE:
- {
- g_value_set_int( value, action->private_data->iconSize );
- }
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
- }
-}
-
-void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec )
-{
- InkRadioAction* action = INK_RADIO_ACTION( obj );
- (void)action;
- switch ( propId ) {
- case PROP_INK_ID:
- {
- gchar* tmp = action->private_data->iconId;
- action->private_data->iconId = g_value_dup_string( value );
- g_free( tmp );
- }
- break;
-
- case PROP_INK_SIZE:
- {
- action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
- }
- break;
-
- default:
- {
- G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
- }
- }
-}
-
-static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action )
-{
- GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_menu_item(action);
-
- return item;
-}
-
-static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
-{
- InkRadioAction* act = INK_RADIO_ACTION( action );
- GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_tool_item(action);
-
- if ( act->private_data->iconId ) {
- 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 );
- gtk_widget_set_hexpand(child, FALSE);
- gtk_widget_set_vexpand(child, FALSE);
- gtk_tool_button_set_icon_widget(button, child);
- } else {
- // For now trigger a warning but don't do anything else
- GtkToolButton* button = GTK_TOOL_BUTTON(item);
- (void)button;
- }
- }
-
- // TODO investigate if needed
- gtk_widget_show_all( item );
-
- return item;
-}
-
-
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-
-// ToolMenu Action is happily derived from http://www.gtkforums.com/viewtopic.php?t=4215
-
-G_DEFINE_TYPE(InkToolMenuAction, ink_tool_menu_action, INK_ACTION_TYPE);
-
-static void
-ink_tool_menu_action_class_init (InkToolMenuActionClass *klass)
-{
- GtkActionClass *action_class = GTK_ACTION_CLASS (klass);
- action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
-}
-
-static void
-ink_tool_menu_action_init (InkToolMenuAction* /*tma*/)
-{
-}
-
-InkToolMenuAction *
-ink_tool_menu_action_new (const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *inkId,
- Inkscape::IconSize size )
-{
- g_return_val_if_fail (name != NULL, NULL);
-
- GObject* obj = (GObject*)g_object_new( INK_TOOL_MENU_ACTION_TYPE,
- "name", name,
- "label", label,
- "tooltip", tooltip,
- "iconId", inkId,
- "iconSize", size,
- NULL );
-
- InkToolMenuAction* action = INK_TOOL_MENU_ACTION( obj );
-
- return action;
-}
+/*
+ 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.h b/src/widgets/ink-action.h
index ac5cb9873..738212c61 100644
--- a/src/widgets/ink-action.h
+++ b/src/widgets/ink-action.h
@@ -1,7 +1,6 @@
#ifndef SEEN_INK_ACTION
#define SEEN_INK_ACTION
-
#include <gtk/gtk.h>
#include "icon-size.h"
#include "attributes.h"
@@ -41,119 +40,16 @@ InkAction* ink_action_new( const gchar *name,
Inkscape::IconSize size );
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-
-
-#define INK_TOGGLE_ACTION_TYPE ( ink_toggle_action_get_type() )
-#define INK_TOGGLE_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( (obj), INK_TOGGLE_ACTION_TYPE, InkToggleAction) )
-#define INK_TOGGLE_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( (klass), INK_TOGGLE_ACTION_TYPE, InkToggleActionClass) )
-#define IS_INK_TOGGLE_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( (obj), INK_TOGGLE_ACTION_TYPE) )
-#define IS_INK_TOGGLE_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( (klass), INK_TOGGLE_ACTION_TYPE) )
-#define INK_TOGGLE_ACTION_GET_CLASS( obj ) ( G_TYPE_INSTANCE_GET_CLASS( (obj), INK_TOGGLE_ACTION_TYPE, InkToggleActionClass) )
-
-typedef struct _InkToggleAction InkToggleAction;
-typedef struct _InkToggleActionClass InkToggleActionClass;
-typedef struct _InkToggleActionPrivate InkToggleActionPrivate;
-
-struct _InkToggleAction
-{
- GtkToggleAction action;
- InkToggleActionPrivate *private_data;
-};
-
-struct _InkToggleActionClass
-{
- GtkToggleActionClass parent_class;
-};
-
-GType ink_toggle_action_get_type( void );
-
-InkToggleAction* ink_toggle_action_new( const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *inkId,
- Inkscape::IconSize size,
- SPAttributeEnum attr = SP_ATTR_INVALID);
-
-
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-
-
-#define INK_RADIO_ACTION_TYPE ( ink_radio_action_get_type() )
-#define INK_RADIO_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( (obj), INK_RADIO_ACTION_TYPE, InkRadioAction) )
-#define INK_RADIO_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( (klass), INK_RADIO_ACTION_TYPE, InkRadioActionClass) )
-#define IS_INK_RADIO_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( (obj), INK_RADIO_ACTION_TYPE) )
-#define IS_INK_RADIO_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( (klass), INK_RADIO_ACTION_TYPE) )
-#define INK_RADIO_ACTION_GET_CLASS( obj ) ( G_TYPE_INSTANCE_GET_CLASS( (obj), INK_RADIO_ACTION_TYPE, InkRadioActionClass) )
-
-typedef struct _InkRadioAction InkRadioAction;
-typedef struct _InkRadioActionClass InkRadioActionClass;
-typedef struct _InkRadioActionPrivate InkRadioActionPrivate;
-
-struct _InkRadioAction
-{
- GtkRadioAction action;
- InkRadioActionPrivate *private_data;
-};
-
-struct _InkRadioActionClass
-{
- GtkRadioActionClass parent_class;
-};
-
-GType ink_radio_action_get_type( void );
-
-InkRadioAction* ink_radio_action_new( const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *inkId,
- Inkscape::IconSize size );
-
-
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-/* --------------------------------------------------------------- */
-
-// ToolMenu Action is happily derived from http://www.gtkforums.com/viewtopic.php?t=4215
-
-#define INK_TOOL_MENU_ACTION_TYPE ( ink_tool_menu_action_get_type() )
-#define INK_TOOL_MENU_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( (obj), INK_TOOL_MENU_ACTION_TYPE, InkToolMenuAction) )
-#define INK_TOOL_MENU_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( (klass), INK_TOOL_MENU_ACTION_TYPE, InkToolMenuActionClass) )
-#define IS_INK_TOOL_MENU_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( (obj), INK_TOOL_MENU_ACTION_TYPE) )
-#define IS_INK_TOOL_MENU_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( (klass), INK_TOOL_MENU_ACTION_TYPE) )
-#define INK_TOOL_MENU_ACTION_GET_CLASS( obj ) ( G_TYPE_INSTANCE_GET_CLASS( (obj), INK_TOOL_MENU_ACTION_TYPE, InkToolMenuActionClass) )
-
-typedef struct _InkToolMenuAction InkToolMenuAction;
-typedef struct _InkToolMenuActionClass InkToolMenuActionClass;
-typedef struct _InkToolMenuActionPrivate InkToolMenuActionPrivate;
-
-struct _InkToolMenuAction
-{
- InkAction action;
-};
-
-struct _InkToolMenuActionClass
-{
- InkActionClass parent_class;
-};
-
-GType ink_tool_menu_action_get_type( void );
-
-InkToolMenuAction* ink_tool_menu_action_new( const gchar *name,
- const gchar *label,
- const gchar *tooltip,
- const gchar *inkId,
- Inkscape::IconSize size );
-
-
-
G_END_DECLS
#endif /* SEEN_INK_ACTION */
+/*
+ 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-radio-action.cpp b/src/widgets/ink-radio-action.cpp
new file mode 100644
index 000000000..2113819c3
--- /dev/null
+++ b/src/widgets/ink-radio-action.cpp
@@ -0,0 +1,185 @@
+#include "ink-radio-action.h"
+
+static void ink_radio_action_finalize( GObject* obj );
+static void ink_radio_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec );
+static void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
+
+static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action );
+static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action );
+
+struct _InkRadioActionPrivate
+{
+ gchar* iconId;
+ Inkscape::IconSize iconSize;
+};
+
+#define INK_RADIO_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_RADIO_ACTION_TYPE, InkRadioActionPrivate ) )
+
+G_DEFINE_TYPE(InkRadioAction, ink_radio_action, GTK_TYPE_RADIO_ACTION);
+
+enum {
+ PROP_INK_ID = 1,
+ PROP_INK_SIZE
+};
+
+static void ink_radio_action_class_init( InkRadioActionClass* klass )
+{
+ if ( klass ) {
+ GObjectClass * objClass = G_OBJECT_CLASS( klass );
+
+ objClass->finalize = ink_radio_action_finalize;
+ objClass->get_property = ink_radio_action_get_property;
+ objClass->set_property = ink_radio_action_set_property;
+
+ klass->parent_class.parent_class.parent_class.create_menu_item = ink_radio_action_create_menu_item;
+ klass->parent_class.parent_class.parent_class.create_tool_item = ink_radio_action_create_tool_item;
+ /*klass->parent_class.connect_proxy = connect_proxy;*/
+ /*klass->parent_class.disconnect_proxy = disconnect_proxy;*/
+
+ g_object_class_install_property( objClass,
+ PROP_INK_ID,
+ g_param_spec_string( "iconId",
+ "Icon ID",
+ "The id for the icon",
+ "",
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+
+ g_object_class_install_property( objClass,
+ PROP_INK_SIZE,
+ 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,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+
+ g_type_class_add_private( klass, sizeof(InkRadioActionClass) );
+ }
+}
+
+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;
+}
+
+static void ink_radio_action_finalize( GObject* obj )
+{
+ InkRadioAction* action = INK_RADIO_ACTION( obj );
+
+ g_free( action->private_data->iconId );
+ g_free( action->private_data );
+
+}
+
+InkRadioAction* ink_radio_action_new( const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size )
+{
+ GObject* obj = (GObject*)g_object_new( INK_RADIO_ACTION_TYPE,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "iconId", inkId,
+ "iconSize", Inkscape::getRegisteredIconSize(size),
+ NULL );
+
+ InkRadioAction* action = INK_RADIO_ACTION( obj );
+
+ return action;
+}
+
+static void ink_radio_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec )
+{
+ InkRadioAction* action = INK_RADIO_ACTION( obj );
+ (void)action;
+ switch ( propId ) {
+ case PROP_INK_ID:
+ {
+ g_value_set_string( value, action->private_data->iconId );
+ }
+ break;
+
+ case PROP_INK_SIZE:
+ {
+ g_value_set_int( value, action->private_data->iconSize );
+ }
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
+ }
+}
+
+void ink_radio_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec )
+{
+ InkRadioAction* action = INK_RADIO_ACTION( obj );
+ (void)action;
+ switch ( propId ) {
+ case PROP_INK_ID:
+ {
+ gchar* tmp = action->private_data->iconId;
+ action->private_data->iconId = g_value_dup_string( value );
+ g_free( tmp );
+ }
+ break;
+
+ case PROP_INK_SIZE:
+ {
+ action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
+ }
+ }
+}
+
+static GtkWidget* ink_radio_action_create_menu_item( GtkAction* action )
+{
+ GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_menu_item(action);
+
+ return item;
+}
+
+static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
+{
+ InkRadioAction* act = INK_RADIO_ACTION( action );
+ GtkWidget* item = GTK_RADIO_ACTION_CLASS(ink_radio_action_parent_class)->parent_class.parent_class.create_tool_item(action);
+
+ if ( act->private_data->iconId ) {
+ 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 );
+ gtk_widget_set_hexpand(child, FALSE);
+ gtk_widget_set_vexpand(child, FALSE);
+ gtk_tool_button_set_icon_widget(button, child);
+ } else {
+ // For now trigger a warning but don't do anything else
+ GtkToolButton* button = GTK_TOOL_BUTTON(item);
+ (void)button;
+ }
+ }
+
+ // TODO investigate if needed
+ gtk_widget_show_all( item );
+
+ return item;
+}
+/*
+ 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-radio-action.h b/src/widgets/ink-radio-action.h
new file mode 100644
index 000000000..c1f059c4f
--- /dev/null
+++ b/src/widgets/ink-radio-action.h
@@ -0,0 +1,52 @@
+#ifndef INK_RADIO_ACTION_H
+#define INK_RADIO_ACTION_H
+
+#include <gtk/gtk.h>
+
+#include "icon.h"
+
+G_BEGIN_DECLS
+
+#define INK_RADIO_ACTION_TYPE ( ink_radio_action_get_type() )
+#define INK_RADIO_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( (obj), INK_RADIO_ACTION_TYPE, InkRadioAction) )
+#define INK_RADIO_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( (klass), INK_RADIO_ACTION_TYPE, InkRadioActionClass) )
+#define IS_INK_RADIO_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( (obj), INK_RADIO_ACTION_TYPE) )
+#define IS_INK_RADIO_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( (klass), INK_RADIO_ACTION_TYPE) )
+#define INK_RADIO_ACTION_GET_CLASS( obj ) ( G_TYPE_INSTANCE_GET_CLASS( (obj), INK_RADIO_ACTION_TYPE, InkRadioActionClass) )
+
+typedef struct _InkRadioAction InkRadioAction;
+typedef struct _InkRadioActionClass InkRadioActionClass;
+typedef struct _InkRadioActionPrivate InkRadioActionPrivate;
+
+struct _InkRadioAction
+{
+ GtkRadioAction action;
+ InkRadioActionPrivate *private_data;
+};
+
+struct _InkRadioActionClass
+{
+ GtkRadioActionClass parent_class;
+};
+
+GType ink_radio_action_get_type( void );
+
+InkRadioAction* ink_radio_action_new( const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size );
+
+G_END_DECLS
+
+#endif // INK_RADIO_ACTION_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-toggle-action.cpp b/src/widgets/ink-toggle-action.cpp
new file mode 100644
index 000000000..3eed974dc
--- /dev/null
+++ b/src/widgets/ink-toggle-action.cpp
@@ -0,0 +1,221 @@
+#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 );
+static void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec );
+
+static GtkWidget* ink_toggle_action_create_menu_item( GtkAction* action );
+static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action );
+
+static void ink_toggle_action_update_icon( InkToggleAction* action );
+
+struct _InkToggleActionPrivate
+{
+ gchar* iconId;
+ Inkscape::IconSize iconSize;
+};
+
+#define INK_TOGGLE_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), INK_TOGGLE_ACTION_TYPE, InkToggleActionPrivate ) )
+
+G_DEFINE_TYPE(InkToggleAction, ink_toggle_action, GTK_TYPE_TOGGLE_ACTION);
+
+enum {
+ PROP_INK_ID = 1,
+ PROP_INK_SIZE
+};
+
+static void ink_toggle_action_class_init( InkToggleActionClass* klass )
+{
+ if ( klass ) {
+ GObjectClass * objClass = G_OBJECT_CLASS( klass );
+
+ objClass->finalize = ink_toggle_action_finalize;
+ objClass->get_property = ink_toggle_action_get_property;
+ objClass->set_property = ink_toggle_action_set_property;
+
+ klass->parent_class.parent_class.create_menu_item = ink_toggle_action_create_menu_item;
+ klass->parent_class.parent_class.create_tool_item = ink_toggle_action_create_tool_item;
+ /*klass->parent_class.connect_proxy = connect_proxy;*/
+ /*klass->parent_class.disconnect_proxy = disconnect_proxy;*/
+
+ g_object_class_install_property( objClass,
+ PROP_INK_ID,
+ g_param_spec_string( "iconId",
+ "Icon ID",
+ "The id for the icon",
+ "",
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+
+ g_object_class_install_property( objClass,
+ PROP_INK_SIZE,
+ g_param_spec_int( "iconSize",
+ "Icon Size",
+ "The size the icon",
+ (int)Inkscape::ICON_SIZE_MENU,
+ (int)99,
+ (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+
+ g_type_class_add_private( klass, sizeof(InkToggleActionClass) );
+ }
+}
+
+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;
+}
+
+static void ink_toggle_action_finalize( GObject* obj )
+{
+ InkToggleAction* action = INK_TOGGLE_ACTION( obj );
+
+ g_free( action->private_data->iconId );
+ g_free( action->private_data );
+
+}
+
+InkToggleAction* ink_toggle_action_new( const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size,
+ SPAttributeEnum attr)
+{
+ GObject* obj = (GObject*)g_object_new( INK_TOGGLE_ACTION_TYPE,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "iconId", inkId,
+ "iconSize", Inkscape::getRegisteredIconSize(size),
+ //"SP_ATTR_INKSCAPE", attr, // Why doesn't this work and do I need to use g_object_set_data below?
+ NULL );
+
+ g_object_set_data(obj, "SP_ATTR_INKSCAPE", GINT_TO_POINTER(attr));
+ InkToggleAction* action = INK_TOGGLE_ACTION( obj );
+
+ return action;
+}
+
+static void ink_toggle_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec )
+{
+ InkToggleAction* action = INK_TOGGLE_ACTION( obj );
+ (void)action;
+ switch ( propId ) {
+ case PROP_INK_ID:
+ {
+ g_value_set_string( value, action->private_data->iconId );
+ }
+ break;
+
+ case PROP_INK_SIZE:
+ {
+ g_value_set_int( value, action->private_data->iconSize );
+ }
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
+ }
+}
+
+void ink_toggle_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec )
+{
+ InkToggleAction* action = INK_TOGGLE_ACTION( obj );
+ (void)action;
+ switch ( propId ) {
+ case PROP_INK_ID:
+ {
+ gchar* tmp = action->private_data->iconId;
+ action->private_data->iconId = g_value_dup_string( value );
+ g_free( tmp );
+
+ ink_toggle_action_update_icon( action );
+ }
+ break;
+
+ case PROP_INK_SIZE:
+ {
+ action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
+ }
+ }
+}
+
+static GtkWidget* ink_toggle_action_create_menu_item( GtkAction* action )
+{
+ GtkWidget* item = GTK_TOGGLE_ACTION_CLASS(ink_toggle_action_parent_class)->parent_class.create_menu_item(action);
+
+ return item;
+}
+
+static GtkWidget* ink_toggle_action_create_tool_item( GtkAction* action )
+{
+ InkToggleAction* act = INK_TOGGLE_ACTION( action );
+
+ GtkWidget* item = GTK_TOGGLE_ACTION_CLASS(ink_toggle_action_parent_class)->parent_class.create_tool_item(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 );
+
+ gtk_widget_set_hexpand(child, FALSE);
+ gtk_widget_set_vexpand(child, FALSE);
+ gtk_tool_button_set_icon_widget(button, child);
+ } else {
+ gchar *label = 0;
+ g_object_get( G_OBJECT(action), "short_label", &label, NULL );
+ gtk_tool_button_set_label( button, label );
+ g_free( label );
+ label = 0;
+ }
+ } else {
+ // For now trigger a warning but don't do anything else
+ GtkToolButton* button = GTK_TOOL_BUTTON(item);
+ (void)button;
+ }
+ gtk_widget_show_all( item );
+
+ return item;
+}
+
+
+static void ink_toggle_action_update_icon( InkToggleAction* action )
+{
+ if ( action ) {
+ GSList* proxies = gtk_action_get_proxies( GTK_ACTION(action) );
+ while ( proxies ) {
+ if ( GTK_IS_TOOL_ITEM(proxies->data) ) {
+ 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 );
+ gtk_widget_set_hexpand(child, FALSE);
+ gtk_widget_set_vexpand(child, FALSE);
+ gtk_widget_show_all(child);
+ gtk_tool_button_set_icon_widget(button, child);
+ }
+ }
+
+ proxies = g_slist_next( proxies );
+ }
+ }
+}
+
+/*
+ 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-toggle-action.h b/src/widgets/ink-toggle-action.h
new file mode 100644
index 000000000..8e9d5e257
--- /dev/null
+++ b/src/widgets/ink-toggle-action.h
@@ -0,0 +1,53 @@
+#ifndef INK_TOGGLE_ACTION_H
+#define INK_TOGGLE_ACTION_H
+
+#include <gtk/gtk.h>
+
+#include "attributes.h"
+#include "icon-size.h"
+
+G_BEGIN_DECLS
+#define INK_TOGGLE_ACTION_TYPE ( ink_toggle_action_get_type() )
+#define INK_TOGGLE_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( (obj), INK_TOGGLE_ACTION_TYPE, InkToggleAction) )
+#define INK_TOGGLE_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( (klass), INK_TOGGLE_ACTION_TYPE, InkToggleActionClass) )
+#define IS_INK_TOGGLE_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( (obj), INK_TOGGLE_ACTION_TYPE) )
+#define IS_INK_TOGGLE_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( (klass), INK_TOGGLE_ACTION_TYPE) )
+#define INK_TOGGLE_ACTION_GET_CLASS( obj ) ( G_TYPE_INSTANCE_GET_CLASS( (obj), INK_TOGGLE_ACTION_TYPE, InkToggleActionClass) )
+
+typedef struct _InkToggleAction InkToggleAction;
+typedef struct _InkToggleActionClass InkToggleActionClass;
+typedef struct _InkToggleActionPrivate InkToggleActionPrivate;
+
+struct _InkToggleAction
+{
+ GtkToggleAction action;
+ InkToggleActionPrivate *private_data;
+};
+
+struct _InkToggleActionClass
+{
+ GtkToggleActionClass parent_class;
+};
+
+GType ink_toggle_action_get_type( void );
+
+InkToggleAction* ink_toggle_action_new( const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size,
+ SPAttributeEnum attr = SP_ATTR_INVALID);
+
+G_END_DECLS
+
+#endif // INK_TOGGLE_ACTION_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-tool-menu-action.cpp b/src/widgets/ink-tool-menu-action.cpp
new file mode 100644
index 000000000..29d8dc92f
--- /dev/null
+++ b/src/widgets/ink-tool-menu-action.cpp
@@ -0,0 +1,49 @@
+#include "ink-tool-menu-action.h"
+
+// ToolMenu Action is happily derived from http://www.gtkforums.com/viewtopic.php?t=4215
+
+G_DEFINE_TYPE(InkToolMenuAction, ink_tool_menu_action, INK_ACTION_TYPE);
+
+static void
+ink_tool_menu_action_class_init (InkToolMenuActionClass *klass)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (klass);
+ action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
+}
+
+static void
+ink_tool_menu_action_init (InkToolMenuAction* /*tma*/)
+{
+}
+
+InkToolMenuAction *
+ink_tool_menu_action_new (const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size )
+{
+ g_return_val_if_fail (name != NULL, NULL);
+
+ GObject* obj = (GObject*)g_object_new( INK_TOOL_MENU_ACTION_TYPE,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "iconId", inkId,
+ "iconSize", size,
+ NULL );
+
+ InkToolMenuAction* action = INK_TOOL_MENU_ACTION( obj );
+
+ return action;
+}
+/*
+ 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-tool-menu-action.h b/src/widgets/ink-tool-menu-action.h
new file mode 100644
index 000000000..be04489d3
--- /dev/null
+++ b/src/widgets/ink-tool-menu-action.h
@@ -0,0 +1,52 @@
+#ifndef INK_TOOL_MENU_ACTION_H
+#define INK_TOOL_MENU_ACTION_H
+
+#include "ink-action.h"
+
+// ToolMenu Action is happily derived from http://www.gtkforums.com/viewtopic.php?t=4215
+
+G_BEGIN_DECLS
+
+#define INK_TOOL_MENU_ACTION_TYPE ( ink_tool_menu_action_get_type() )
+#define INK_TOOL_MENU_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_CAST( (obj), INK_TOOL_MENU_ACTION_TYPE, InkToolMenuAction) )
+#define INK_TOOL_MENU_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( (klass), INK_TOOL_MENU_ACTION_TYPE, InkToolMenuActionClass) )
+#define IS_INK_TOOL_MENU_ACTION( obj ) ( G_TYPE_CHECK_INSTANCE_TYPE( (obj), INK_TOOL_MENU_ACTION_TYPE) )
+#define IS_INK_TOOL_MENU_ACTION_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE( (klass), INK_TOOL_MENU_ACTION_TYPE) )
+#define INK_TOOL_MENU_ACTION_GET_CLASS( obj ) ( G_TYPE_INSTANCE_GET_CLASS( (obj), INK_TOOL_MENU_ACTION_TYPE, InkToolMenuActionClass) )
+
+typedef struct _InkToolMenuAction InkToolMenuAction;
+typedef struct _InkToolMenuActionClass InkToolMenuActionClass;
+typedef struct _InkToolMenuActionPrivate InkToolMenuActionPrivate;
+
+struct _InkToolMenuAction
+{
+ InkAction action;
+};
+
+struct _InkToolMenuActionClass
+{
+ InkActionClass parent_class;
+};
+
+GType ink_tool_menu_action_get_type( void );
+
+InkToolMenuAction* ink_tool_menu_action_new( const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size );
+
+G_END_DECLS
+
+#endif // INK_TOOL_MENU_ACTION_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/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp
index d44983a15..5df5fde70 100644
--- a/src/widgets/lpe-toolbar.cpp
+++ b/src/widgets/lpe-toolbar.cpp
@@ -34,7 +34,8 @@
#include "widgets/ege-select-one-action.h"
#include "helper/action-context.h"
#include "helper/action.h"
-#include "widgets/ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "ui/tools-switch.h"
#include "ui/tools/lpe-tool.h"
#include "ui/widget/unit-tracker.h"
diff --git a/src/widgets/measure-toolbar.cpp b/src/widgets/measure-toolbar.cpp
index 53790cfac..a8c974bbc 100644
--- a/src/widgets/measure-toolbar.cpp
+++ b/src/widgets/measure-toolbar.cpp
@@ -39,7 +39,8 @@
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-output-action.h"
#include "toolbox.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-toggle-action.h"
#include "ui/icon-names.h"
#include "ui/tools/measure-tool.h"
#include "ui/widget/unit-tracker.h"
diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp
index 1e5c12d41..3bc6cb288 100644
--- a/src/widgets/mesh-toolbar.cpp
+++ b/src/widgets/mesh-toolbar.cpp
@@ -47,7 +47,9 @@
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "sp-stop.h"
#include "svg/css-ostringstream.h"
diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp
index ed3e33acc..31efaa0b4 100644
--- a/src/widgets/node-toolbar.cpp
+++ b/src/widgets/node-toolbar.cpp
@@ -35,7 +35,8 @@
#include "desktop.h"
#include "document-undo.h"
#include "widgets/ege-adjustment-action.h"
-#include "widgets/ink-action.h"
+#include "ink-toggle-action.h"
+#include "ink-tool-menu-action.h"
#include "inkscape.h"
#include "selection-chemistry.h"
#include "sp-namedview.h"
diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp
index d402cc714..32cdb0a7d 100644
--- a/src/widgets/pencil-toolbar.cpp
+++ b/src/widgets/pencil-toolbar.cpp
@@ -35,7 +35,9 @@
#include "desktop.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "toolbox.h"
#include "ui/tools-switch.h"
#include "ui/icon-names.h"
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index fde5a95cd..81fb2371b 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -29,7 +29,8 @@
#include "widgets/ege-adjustment-action.h"
#include "helper/action-context.h"
#include "helper/action.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-toggle-action.h"
#include "inkscape.h"
#include "message-stack.h"
#include "selection-chemistry.h"
diff --git a/src/widgets/spray-toolbar.cpp b/src/widgets/spray-toolbar.cpp
index 43d00c53e..a724637e3 100644
--- a/src/widgets/spray-toolbar.cpp
+++ b/src/widgets/spray-toolbar.cpp
@@ -36,7 +36,8 @@
#include "inkscape.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "toolbox.h"
#include "ui/dialog/clonetiler.h"
#include "ui/dialog/dialog-manager.h"
diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp
index 7f4293b62..e06733740 100644
--- a/src/widgets/star-toolbar.cpp
+++ b/src/widgets/star-toolbar.cpp
@@ -37,7 +37,8 @@
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-output-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-action.h"
+#include "ink-radio-action.h"
#include "selection.h"
#include "sp-star.h"
#include "toolbox.h"
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 41199ecfe..4ab631765 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -38,7 +38,8 @@
#include "document.h"
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "widgets/ink-comboboxentry-action.h"
#include "inkscape.h"
#include "selection-chemistry.h"
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 20c3936a3..f74be4b15 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -43,6 +43,7 @@
#include "../helper/action.h"
#include "icon.h"
#include "ink-action.h"
+#include "ink-toggle-action.h"
#include "../inkscape.h"
#include "ui/interface.h"
#include "../shortcuts.h"
diff --git a/src/widgets/tweak-toolbar.cpp b/src/widgets/tweak-toolbar.cpp
index 9a021082c..a6b8ba436 100644
--- a/src/widgets/tweak-toolbar.cpp
+++ b/src/widgets/tweak-toolbar.cpp
@@ -36,7 +36,8 @@
#include "widgets/ege-adjustment-action.h"
#include "widgets/ege-output-action.h"
#include "widgets/ege-select-one-action.h"
-#include "widgets/ink-action.h"
+#include "ink-radio-action.h"
+#include "ink-toggle-action.h"
#include "toolbox.h"
#include "ui/icon-names.h"
#include "ui/tools/tweak-tool.h"