summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e06337d)
raw | patch | inline | side by side (parent: e06337d)
author | tavmjong-free <tavmjong@free.fr> | |
Sat, 24 Apr 2010 09:13:24 +0000 (11:13 +0200) | ||
committer | tavmjong-free <tavmjong@free.fr> | |
Sat, 24 Apr 2010 09:13:24 +0000 (11:13 +0200) |
src/ink-comboboxentry-action.cpp | patch | blob | history | |
src/ink-comboboxentry-action.h | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
index 68cbe37b0d045e91f16e58e72f30de1f30938aab..85e9378c8e214f7f195eb5cdae600fc8320e5055 100644 (file)
static GtkWidget* create_menu_item( GtkAction* action );
// Internal
-static gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, gchar* target_text );
+static gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text );
// Callbacks
static void combo_box_changed_cb( GtkComboBoxEntry* widget, gpointer data );
action->entry_completion = NULL;
action->popup = false;
action->warning = NULL;
+ action->altx_name = NULL;
}
GType ink_comboboxentry_action_get_type ()
ink_comboboxentry_action_popup_enable( ink_comboboxentry_action );
}
+ // Add altx_name if required
+ if( ink_comboboxentry_action->altx_name ) {
+ g_object_set_data( G_OBJECT( child ), ink_comboboxentry_action->altx_name, ink_comboboxentry_action->entry );
+ }
+
// Add signal for GtkEntry to check if finished typing.
g_signal_connect( G_OBJECT(child), "activate", G_CALLBACK(entry_activate_cb), action );
@@ -391,7 +397,7 @@ gchar* ink_comboboxentry_action_get_active_text( Ink_ComboBoxEntry_Action* actio
return text;
}
-gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink_comboboxentry_action, gchar* text ) {
+gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* ink_comboboxentry_action, const gchar* text ) {
g_free( ink_comboboxentry_action->text );
ink_comboboxentry_action->text = g_strdup( text );
}
}
-void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, gchar* warning ) {
+void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, const gchar* warning ) {
g_free( action->warning );
action->warning = g_strdup( warning );
}
}
+void ink_comboboxentry_action_set_altx_name( Ink_ComboBoxEntry_Action* action, const gchar* altx_name ) {
+
+ g_free( action->altx_name );
+ action->altx_name = g_strdup( altx_name );
+
+ // Widget may not have been created....
+ if( action->entry ) {
+ g_object_set_data( G_OBJECT(action->entry), action->altx_name, action->entry );
+ }
+}
+
// Internal ---------------------------------------------------
// Return row of active text or -1 if not found.
-gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, gchar* target_text ) {
+gint get_active_row_from_text( Ink_ComboBoxEntry_Action* action, const gchar* target_text ) {
// Check if text in list
gint row = 0;
index 433eb2fdc7b588d0295be898a774dbab5797a259..b1228f749c5344381c4f6b4b029ad245265eddfd 100644 (file)
gpointer cell_data_func; // drop-down menu format
- gint active; // Index of active menu item (-1 if not in list).
- gchar *text; // Text of active menu item or entry box.
- gint width; // Width of GtkComboBoxEntry in characters.
- gboolean popup; // Do we pop-up an entry-completion dialog?
- gchar *warning; // Text for warning that entry isn't in list.
+ gint active; // Index of active menu item (-1 if not in list).
+ gchar *text; // Text of active menu item or entry box.
+ gint width; // Width of GtkComboBoxEntry in characters.
+ gboolean popup; // Do we pop-up an entry-completion dialog?
+ gchar *warning; // Text for warning that entry isn't in list.
+ gchar *altx_name; // Target for Alt-X keyboard shortcut.
};
GtkComboBoxEntry *ink_comboboxentry_action_get_comboboxentry( Ink_ComboBoxEntry_Action* action );
gchar* ink_comboboxentry_action_get_active_text( Ink_ComboBoxEntry_Action* action );
-gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* action, gchar* text );
+gboolean ink_comboboxentry_action_set_active_text( Ink_ComboBoxEntry_Action* action, const gchar* text );
void ink_comboboxentry_action_set_width( Ink_ComboBoxEntry_Action* action, gint width );
void ink_comboboxentry_action_popup_enable( Ink_ComboBoxEntry_Action* action );
void ink_comboboxentry_action_popup_disable( Ink_ComboBoxEntry_Action* action );
-void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, gchar* warning );
+void ink_comboboxentry_action_set_warning( Ink_ComboBoxEntry_Action* action, const gchar* warning );
+
+void ink_comboboxentry_action_set_altx_name( Ink_ComboBoxEntry_Action* action, const gchar* altx_name );
#endif /* SEEN_INK_COMBOBOXENTRY_ACTION */
index 826fabb06ae1bc545f6081aa19060854a80a3177..493d1ecd776555155061e40a0b627f99ab687962 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -7179,6 +7179,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
ink_comboboxentry_action_popup_enable( act ); // Enable entry completion
gchar *const warning = _("Font not found on system");
ink_comboboxentry_action_set_warning( act, warning ); // Show icon with tooltip if missing font
+ ink_comboboxentry_action_set_altx_name( act, "altx-text" ); // Set Alt-X keyboard shortcut
g_signal_connect( G_OBJECT(act), "changed", G_CALLBACK(sp_text_fontfamily_value_changed), holder );
gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
g_object_set_data( holder, "TextFontFamilyAction", act );
@@ -7349,8 +7350,8 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
GTK_WIDGET(desktop->canvas), /* focusTarget */
NULL, /* unit selector */
holder, /* dataKludge */
- FALSE, /* altx? */
- NULL, /* altx_mark? */
+ FALSE, /* set alt-x keyboard shortcut? */
+ NULL, /* altx_mark */
0.0, 10.0, 0.01, 0.10, /* lower, upper, step (arrow up/down), page up/down */
labels, values, G_N_ELEMENTS(labels), /* drop down menu */
sp_text_lineheight_value_changed, /* callback */
@@ -7379,8 +7380,8 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
GTK_WIDGET(desktop->canvas), /* focusTarget */
NULL, /* unit selector */
holder, /* dataKludge */
- FALSE, /* altx? */
- NULL, /* altx_mark? */
+ FALSE, /* set alt-x keyboard shortcut? */
+ NULL, /* altx_mark */
-100.0, 100.0, 0.01, 0.10, /* lower, upper, step (arrow up/down), page up/down */
labels, values, G_N_ELEMENTS(labels), /* drop down menu */
sp_text_wordspacing_value_changed, /* callback */
@@ -7409,8 +7410,8 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
GTK_WIDGET(desktop->canvas), /* focusTarget */
NULL, /* unit selector */
holder, /* dataKludge */
- FALSE, /* altx? */
- NULL, /* altx_mark? */
+ FALSE, /* set alt-x keyboard shortcut? */
+ NULL, /* altx_mark */
-100.0, 100.0, 0.01, 0.10, /* lower, upper, step (arrow up/down), page up/down */
labels, values, G_N_ELEMENTS(labels), /* drop down menu */
sp_text_letterspacing_value_changed, /* callback */