From be519f62404daf6dff2449a2eb5280d998298868 Mon Sep 17 00:00:00 2001 From: Jasper van de Gronde Date: Mon, 6 Sep 2010 19:32:05 +0200 Subject: Automatically add shortcuts to tooltips (bzr r9745) --- src/verbs.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index c2af399c5..6ba0aa562 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -63,6 +63,7 @@ #include "selection-chemistry.h" #include "seltrans.h" #include "shape-editor.h" +#include "shortcuts.h" #include "sp-flowtext.h" #include "sp-guide.h" #include "splivarot.h" @@ -334,7 +335,7 @@ Verb::VerbIDTable Verb::_verb_ids; in the \c _verbs hashtable which is indexed by the \c code. */ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) : - _actions(NULL), _id(id), _name(name), _tip(tip), _image(image) + _actions(NULL), _id(id), _name(name), _tip(tip), _full_tip(0), _image(image) { static int count = SP_VERB_LAST; @@ -358,6 +359,8 @@ Verb::~Verb(void) delete _actions; } + if (_full_tip) g_free(_full_tip); + return; } @@ -631,7 +634,20 @@ Verb::sensitive(SPDocument *in_doc, bool in_sensitive) gchar const * Verb::get_tip (void) { - return _(_tip); + if (!_tip) return 0; + unsigned int shortcut = sp_shortcut_get_primary(this); + if (shortcut!=_shortcut || !_full_tip) { + if (_full_tip) g_free(_full_tip); + _shortcut = shortcut; + gchar* shortcutString = sp_shortcut_get_label(shortcut); + if (shortcutString) { + _full_tip = g_strdup_printf("%s (%s)", _(_tip), shortcutString); + g_free(shortcutString); + } else { + _full_tip = g_strdup(_(_tip)); + } + } + return _full_tip; } void -- cgit v1.2.3 From 7f08f1569225671ff9c4ef4dc04edc405bf0d5bf Mon Sep 17 00:00:00 2001 From: Jasper van de Gronde Date: Tue, 7 Sep 2010 10:35:34 +0200 Subject: Connected two toolbar buttons with the associated verbs (bzr r9747) --- src/verbs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 6ba0aa562..67211e38e 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2312,8 +2312,8 @@ Verb *Verb::_base_verbs[] = { N_("Deselect any selected objects or nodes"), INKSCAPE_ICON_EDIT_SELECT_NONE), new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("_Guides Around Page"), N_("Create four guides aligned with the page borders"), NULL), - new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next Path Effect Parameter"), - N_("Show next Path Effect parameter for editing"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT), + new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"), + N_("Show next editable path effect parameter"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT), /* Selection */ new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"), @@ -2557,7 +2557,7 @@ Verb *Verb::_base_verbs[] = { new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), NULL), new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), INKSCAPE_ICON_SHOW_GRID), new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON_SHOW_GUIDES), - new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Toggle snapping on or off"), INKSCAPE_ICON_SNAP), + new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Enable snapping"), INKSCAPE_ICON_SNAP), new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"), INKSCAPE_ICON_ZOOM_NEXT), new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"), -- cgit v1.2.3 From d454d77da77d1ef2b5b0ccaed5698871bd5f9d3e Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 10 Sep 2010 01:34:09 -0700 Subject: Fixed valgrind-detected issue with tooltip shortcuts and profile manager on delete. (bzr r9753) --- src/verbs.cpp | 52 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 67211e38e..eaf16e93f 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -335,7 +335,15 @@ Verb::VerbIDTable Verb::_verb_ids; in the \c _verbs hashtable which is indexed by the \c code. */ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) : - _actions(NULL), _id(id), _name(name), _tip(tip), _full_tip(0), _image(image) + _actions(0), + _id(id), + _name(name), + _tip(tip), + _full_tip(0), + _shortcut(0), + _image(image), + _code(0), + _default_sensitive(false) { static int count = SP_VERB_LAST; @@ -343,8 +351,6 @@ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *im _code = count; _verbs.insert(VerbTable::value_type(count, this)); _verb_ids.insert(VerbIDTable::value_type(_id, this)); - - return; } /** \brief Destroy a verb. @@ -359,9 +365,10 @@ Verb::~Verb(void) delete _actions; } - if (_full_tip) g_free(_full_tip); - - return; + if (_full_tip) { + g_free(_full_tip); + _full_tip = 0; + } } /** \brief Verbs are no good without actions. This is a place holder @@ -631,23 +638,30 @@ Verb::sensitive(SPDocument *in_doc, bool in_sensitive) } /** \brief Accessor to get the tooltip for verb as localised string */ -gchar const * -Verb::get_tip (void) +gchar const *Verb::get_tip(void) { - if (!_tip) return 0; - unsigned int shortcut = sp_shortcut_get_primary(this); - if (shortcut!=_shortcut || !_full_tip) { - if (_full_tip) g_free(_full_tip); - _shortcut = shortcut; - gchar* shortcutString = sp_shortcut_get_label(shortcut); - if (shortcutString) { - _full_tip = g_strdup_printf("%s (%s)", _(_tip), shortcutString); - g_free(shortcutString); - } else { + gchar const *result = 0; + if (_tip) { + unsigned int shortcut = sp_shortcut_get_primary(this); + if ( (shortcut != _shortcut) || !_full_tip) { + if (_full_tip) { + g_free(_full_tip); + _full_tip = 0; + } + _shortcut = shortcut; + gchar* shortcutString = sp_shortcut_get_label(shortcut); + if (shortcutString) { + _full_tip = g_strdup_printf("%s (%s)", _(_tip), shortcutString); + g_free(shortcutString); + shortcutString = 0; + } else { _full_tip = g_strdup(_(_tip)); + } } + result = _full_tip; } - return _full_tip; + + return result; } void -- cgit v1.2.3 From 1ed113135ec38da1622a62e7afef89a7a3de7c97 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 19 Sep 2010 13:19:12 +0200 Subject: Tooltips inconsistency fix (Bug 340723) (bzr r9769) --- src/verbs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index eaf16e93f..378d81281 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2626,7 +2626,7 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON_DOCUMENT_METADATA ), new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."), - N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE), + N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE), new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("Glyphs..."), N_("Select characters from a glyphs palette"), GTK_STOCK_SELECT_FONT), // TRANSLATORS: "Swatches" means: color samples -- cgit v1.2.3 From 144819c918dc761641c3cb5a490205fb73194ee3 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Wed, 17 Nov 2010 13:12:56 +1100 Subject: Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in all 1074 Vim modelines. The reason for this is that (a) setting the encoding isn't nice, and (b) Vim 7.3 (with modeline enabled) disallows it and pops up an error whenever you open any file with it ("invalid modeline"). Also corrected five deviant modestrings: * src/ui/widget/dock.cpp and src/ui/widget/dock.h: missing colon at the end * src/ui/dialog/tile.cpp: removed gratuitous second colon at the end * src/helper/units-test.h: removed gratuitous space before a colon * share/extensions/export_gimp_palette.py: missing textwidth=99 That's my geekiest commit yet. (bzr r9900) --- src/verbs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/verbs.cpp') diff --git a/src/verbs.cpp b/src/verbs.cpp index 378d81281..8b5ec9b3b 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2768,4 +2768,4 @@ Verb::list (void) { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3