From 9abd33133650d77714fccf09d0c9ff27c9b75a78 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 5 Jul 2012 22:39:08 +0100 Subject: Drop GTK+ 2.20 support. Fixed bugs: - https://launchpad.net/bugs/1020494 (bzr r11529) --- src/ege-adjustment-action.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 858b129b8..8ee240b30 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -48,10 +48,6 @@ #include "icon-size.h" #include "ege-adjustment-action.h" -#if !GTK_CHECK_VERSION(2,22,0) -#include "compat-key-syms.h" -#endif - static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ); static void ege_adjustment_action_init( EgeAdjustmentAction* action ); -- cgit v1.2.3 From 035938733c3d0754dfa2250cda1af5b04cdf43c4 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 15 Jul 2012 16:11:36 +0900 Subject: Fix for 167846 : Focus issue between spinbuttons when using Tab (bzr r11550) --- src/ege-adjustment-action.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 8ee240b30..398eb9d33 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -780,6 +780,13 @@ static GtkWidget* create_menu_item( GtkAction* action ) void value_changed_cb( GtkSpinButton* spin, EgeAdjustmentAction* act ) { if ( gtk_widget_has_focus( GTK_WIDGET(spin) ) ) { + gint start = 0, end = 0; + if (gtk_editable_get_selection_bounds (GTK_EDITABLE(spin), &start, &end) + && start != end) { + // #167846, #363000 If the spin button has a selection, its probably + // because we got here from a Tab key from another spin, if so dont defocus + return; + } ege_adjustment_action_defocus( act ); } } -- cgit v1.2.3 From 3ea5c4679f829e91cc01fac6504639eb31244cbe Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 2 Aug 2012 21:56:07 +0900 Subject: Fix for 167846 : GtkHScale regression (bzr r11584) --- src/ege-adjustment-action.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 398eb9d33..7881498b9 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -781,7 +781,7 @@ void value_changed_cb( GtkSpinButton* spin, EgeAdjustmentAction* act ) { if ( gtk_widget_has_focus( GTK_WIDGET(spin) ) ) { gint start = 0, end = 0; - if (gtk_editable_get_selection_bounds (GTK_EDITABLE(spin), &start, &end) + if (GTK_IS_EDITABLE(spin) && gtk_editable_get_selection_bounds (GTK_EDITABLE(spin), &start, &end) && start != end) { // #167846, #363000 If the spin button has a selection, its probably // because we got here from a Tab key from another spin, if so dont defocus -- cgit v1.2.3 From 7c0506c103c881790a2e347e2a68aecdf8935d5c Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 22 Sep 2012 12:27:14 +0900 Subject: Fix for 1014988 : Converts slide widgets to new spin-scale widget (bzr r11691) --- src/ege-adjustment-action.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 7881498b9..cf179478d 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -47,6 +47,7 @@ #include "icon-size.h" #include "ege-adjustment-action.h" +#include "ui/widget/gimpspinscale.h" static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ); @@ -835,15 +836,8 @@ static GtkWidget* create_tool_item( GtkAction* action ) if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { /* Slider */ - gchar *leakyForNow = g_value_dup_string( &value ); -#if GTK_CHECK_VERSION(3,0,0) - spinbutton = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, act->private_data->adj); -#else - spinbutton = gtk_hscale_new( act->private_data->adj); -#endif + spinbutton = gimp_spin_scale_new (act->private_data->adj, g_value_get_string( &value ), 0); gtk_widget_set_size_request(spinbutton, 100, -1); - gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 ); - g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow ); } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); -- cgit v1.2.3 From 370a3f5cc9e39352a081e5d5dd8c43676547a6e6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Oct 2012 11:45:44 +1000 Subject: code cleanup: add own includes to cpp files or make the functions static if they are not used elsewhere. (bzr r11735) --- src/ege-adjustment-action.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index cf179478d..78f3f48d6 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -778,7 +778,7 @@ static GtkWidget* create_menu_item( GtkAction* action ) return item; } -void value_changed_cb( GtkSpinButton* spin, EgeAdjustmentAction* act ) +static void value_changed_cb( GtkSpinButton* spin, EgeAdjustmentAction* act ) { if ( gtk_widget_has_focus( GTK_WIDGET(spin) ) ) { gint start = 0, end = 0; -- cgit v1.2.3 From cfe9c94712a2ff6849b123672e51b603f20e76ae Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 10 Jan 2013 23:30:09 -0800 Subject: Warning and dead code cleanup. (bzr r12014) --- src/ege-adjustment-action.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 78f3f48d6..8253818d2 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -810,12 +810,6 @@ static gboolean event_cb( EgeAdjustmentAction* act, GdkEvent* evt ) return handled; } -static gchar *slider_format_falue( GtkScale* scale, gdouble value, gchar *label ) -{ - (void)scale; - return g_strdup_printf("%s %d", label, (int) round(value)); -} - static GtkWidget* create_tool_item( GtkAction* action ) { GtkWidget* item = 0; -- cgit v1.2.3 From 1615436543169f305d1df4d830ed8f5ec5dc75ed Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 26 Jan 2013 19:33:04 +0000 Subject: More GObject boilerplate reduction (bzr r12065) --- src/ege-adjustment-action.cpp | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 8253818d2..5a827096f 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -50,8 +50,6 @@ #include "ui/widget/gimpspinscale.h" -static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ); -static void ege_adjustment_action_init( EgeAdjustmentAction* action ); static void ege_adjustment_action_finalize( GObject* object ); static void ege_adjustment_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec ); static void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec ); @@ -70,8 +68,6 @@ static void ege_adjustment_action_defocus( EgeAdjustmentAction* action ); static void egeAct_free_description( gpointer data, gpointer user_data ); static void egeAct_free_all_descriptions( EgeAdjustmentAction* action ); - -static GtkActionClass* gParentClass = 0; static EgeCreateAdjWidgetCB gFactoryCb = 0; static GQuark gDataName = 0; @@ -146,34 +142,11 @@ enum { BUMP_CUSTOM = 100 }; -GType ege_adjustment_action_get_type( void ) -{ - static GType myType = 0; - if ( !myType ) { - static const GTypeInfo myInfo = { - sizeof( EgeAdjustmentActionClass ), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)ege_adjustment_action_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof( EgeAdjustmentAction ), - 0, /* n_preallocs */ - (GInstanceInitFunc)ege_adjustment_action_init, - NULL - }; - - myType = g_type_register_static( GTK_TYPE_ACTION, "EgeAdjustmentAction", &myInfo, (GTypeFlags)0 ); - } - - return myType; -} - +G_DEFINE_TYPE(EgeAdjustmentAction, ege_adjustment_action, GTK_TYPE_ACTION); static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ) { if ( klass ) { - gParentClass = GTK_ACTION_CLASS( g_type_class_peek_parent( klass ) ); GObjectClass * objClass = G_OBJECT_CLASS( klass ); gDataName = g_quark_from_string("ege-adj-action"); @@ -308,8 +281,8 @@ static void ege_adjustment_action_finalize( GObject* object ) egeAct_free_all_descriptions( action ); - if ( G_OBJECT_CLASS(gParentClass)->finalize ) { - (*G_OBJECT_CLASS(gParentClass)->finalize)(object); + if ( G_OBJECT_CLASS(ege_adjustment_action_parent_class)->finalize ) { + (*G_OBJECT_CLASS(ege_adjustment_action_parent_class)->finalize)(object); } } @@ -772,7 +745,7 @@ static GtkWidget* create_menu_item( GtkAction* action ) gtk_widget_show_all( subby ); g_value_unset( &value ); } else { - item = gParentClass->create_menu_item( action ); + item = GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->create_menu_item( action ); } return item; @@ -910,7 +883,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_value_unset( &value ); } else { - item = gParentClass->create_tool_item( action ); + item = GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->create_tool_item( action ); } return item; @@ -918,12 +891,12 @@ static GtkWidget* create_tool_item( GtkAction* action ) static void connect_proxy( GtkAction *action, GtkWidget *proxy ) { - gParentClass->connect_proxy( action, proxy ); + GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->connect_proxy( action, proxy ); } static void disconnect_proxy( GtkAction *action, GtkWidget *proxy ) { - gParentClass->disconnect_proxy( action, proxy ); + GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->disconnect_proxy( action, proxy ); } void ege_adjustment_action_defocus( EgeAdjustmentAction* action ) -- cgit v1.2.3 From 5614df9770b985070122b3c08b45902317c9bd15 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Sun, 15 Sep 2013 19:07:21 -0400 Subject: Enable unit evaluation in toolbars. (bzr r12475.1.22) --- src/ege-adjustment-action.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 5a827096f..7f844ec4b 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -115,6 +115,7 @@ struct _EgeAdjustmentActionPrivate gchar* appearance; gchar* iconId; Inkscape::IconSize iconSize; + Inkscape::UI::Widget::UnitTracker *unitTracker; }; #define EGE_ADJUSTMENT_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), EGE_ADJUSTMENT_ACTION_TYPE, EgeAdjustmentActionPrivate ) ) @@ -128,7 +129,8 @@ enum { PROP_TOOL_POST, PROP_APPEARANCE, PROP_ICON_ID, - PROP_ICON_SIZE + PROP_ICON_SIZE, + PROP_UNIT_TRACKER }; enum { @@ -234,6 +236,13 @@ static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ) (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR, (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) ); + g_object_class_install_property( objClass, + PROP_UNIT_TRACKER, + g_param_spec_pointer( "unit_tracker", + "Unit Tracker", + "The widget that keeps track of the unit", + (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) ); + g_type_class_add_private( klass, sizeof(EgeAdjustmentActionClass) ); } } @@ -263,6 +272,7 @@ static void ege_adjustment_action_init( EgeAdjustmentAction* action ) action->private_data->appearance = 0; action->private_data->iconId = 0; action->private_data->iconSize = Inkscape::ICON_SIZE_SMALL_TOOLBAR; + action->private_data->unitTracker = NULL; } static void ege_adjustment_action_finalize( GObject* object ) @@ -292,7 +302,8 @@ EgeAdjustmentAction* ege_adjustment_action_new( GtkAdjustment* adjustment, const gchar *tooltip, const gchar *stock_id, gdouble climb_rate, - guint digits ) + guint digits, + Inkscape::UI::Widget::UnitTracker *unit_tracker ) { GObject* obj = (GObject*)g_object_new( EGE_ADJUSTMENT_ACTION_TYPE, "name", name, @@ -302,6 +313,7 @@ EgeAdjustmentAction* ege_adjustment_action_new( GtkAdjustment* adjustment, "adjustment", adjustment, "climb-rate", climb_rate, "digits", digits, + "unit_tracker", unit_tracker, NULL ); EgeAdjustmentAction* action = EGE_ADJUSTMENT_ACTION( obj ); @@ -349,6 +361,10 @@ static void ege_adjustment_action_get_property( GObject* obj, guint propId, GVal g_value_set_int( value, action->private_data->iconSize ); break; + case PROP_UNIT_TRACKER: + g_value_set_pointer( value, action->private_data->unitTracker ); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec ); } @@ -450,6 +466,12 @@ void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValu } break; + case PROP_UNIT_TRACKER: + { + action->private_data->unitTracker = (Inkscape::UI::Widget::UnitTracker*)g_value_get_pointer( value ); + } + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec ); } @@ -812,7 +834,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) gtk_scale_button_set_icons( GTK_SCALE_BUTTON(spinbutton), floogles ); } else { if ( gFactoryCb ) { - spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); + spinbutton = gFactoryCb( act->private_data->adj, act->private_data->climbRate, act->private_data->digits, act->private_data->unitTracker ); } else { spinbutton = gtk_spin_button_new( act->private_data->adj, act->private_data->climbRate, act->private_data->digits ); } -- cgit v1.2.3 From c862d2996b29dcace346d6c2e746672fd9d1949d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 2 Jan 2014 17:34:58 +0000 Subject: Fix Gtk+ 3.10 warnings: GtkStockItem is deprecated (bzr r12868) --- src/ege-adjustment-action.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 7f844ec4b..7e92c1bec 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -48,6 +48,7 @@ #include "icon-size.h" #include "ege-adjustment-action.h" #include "ui/widget/gimpspinscale.h" +#include "ui/icon-names.h" static void ege_adjustment_action_finalize( GObject* object ); @@ -81,11 +82,11 @@ enum { /* TODO need to have appropriate icons setup for these: */ static const gchar *floogles[] = { - GTK_STOCK_REMOVE, - GTK_STOCK_ADD, - GTK_STOCK_GO_DOWN, - GTK_STOCK_ABOUT, - GTK_STOCK_GO_UP, + INKSCAPE_ICON("list-remove"), + INKSCAPE_ICON("list-add"), + INKSCAPE_ICON("go-down"), + INKSCAPE_ICON("help-about"), + INKSCAPE_ICON("go-up"), 0}; typedef struct _EgeAdjustmentDescr EgeAdjustmentDescr; @@ -1100,3 +1101,13 @@ gboolean keypress_cb( GtkWidget *widget, GdkEventKey *event, gpointer data ) return wasConsumed; } +/* + 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 : -- cgit v1.2.3 From 25bea5005bdd07e3807c04ce7942786571344ac2 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 3 Jan 2014 10:33:30 +0000 Subject: Stop using GTK_IS_HBOX: Deprecated in Gtk+ 3 (bzr r12872) --- src/ege-adjustment-action.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ege-adjustment-action.cpp') diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 7e92c1bec..9491468dc 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -983,7 +983,7 @@ static gboolean process_tab( GtkWidget* widget, int direction ) if ( mid && GTK_IS_TOOL_ITEM(mid->data) ) { /* potential target */ GtkWidget* child = gtk_bin_get_child( GTK_BIN(mid->data) ); - if ( child && GTK_IS_HBOX(child) ) { /* could be ours */ + if ( child && GTK_IS_BOX(child) ) { /* could be ours */ GList* subChildren = gtk_container_get_children( GTK_CONTAINER(child) ); if ( subChildren ) { GList* last = g_list_last(subChildren); -- cgit v1.2.3