summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-10-11 08:03:21 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-10-11 08:03:21 +0000
commit3ca2c298a152f092b99d0c9978a47deec787ed8c (patch)
tree1be8947ba4e6cc71109abf631fb1ebb700919599 /src
parentFix for 426763 : Cancelling import leads to error message (diff)
downloadinkscape-3ca2c298a152f092b99d0c9978a47deec787ed8c.tar.gz
inkscape-3ca2c298a152f092b99d0c9978a47deec787ed8c.zip
Fix for 171904 : toggleToolbox verb
(bzr r11778)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp13
-rw-r--r--src/desktop.h1
-rw-r--r--src/interface.cpp39
-rw-r--r--src/interface.h1
-rw-r--r--src/verbs.cpp25
-rw-r--r--src/verbs.h7
6 files changed, 64 insertions, 22 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index b01bf5d64..bfec523db 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -55,6 +55,7 @@
#include "document.h"
#include "event-log.h"
#include "helper/units.h"
+#include "interface.h"
#include "inkscape-private.h"
#include "layer-fns.h"
#include "layer-manager.h"
@@ -1318,6 +1319,17 @@ SPDesktop::toggleScrollbars()
_widget->toggleScrollbars();
}
+
+void SPDesktop::toggleToolbar(gchar const *toolbar_name)
+{
+ Glib::ustring pref_path = getLayoutPrefPath(this) + toolbar_name + "/state";
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ gboolean visible = prefs->getBool(pref_path, true);
+ prefs->setBool(pref_path, !visible);
+
+ layoutWidget();
+}
+
void
SPDesktop::layoutWidget()
{
@@ -1474,7 +1486,6 @@ void SPDesktop::toggleSnapGlobal()
namedview->setSnapGlobal(!v);
}
-
//----------------------------------------------------------------------
// Callback implementations. The virtual ones are connected by the view.
diff --git a/src/desktop.h b/src/desktop.h
index 3eb0294e7..958e881ed 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -365,6 +365,7 @@ public:
void toggleSnapGlobal();
bool gridsEnabled() const { return grids_visible; };
void showGrids(bool show, bool dirty_document = true);
+ void toggleToolbar(gchar const *toolbar_name);
bool is_iconified();
bool is_maximized();
diff --git a/src/interface.cpp b/src/interface.cpp
index 2ee188ef7..bad95adc6 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -527,7 +527,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb
} // end of sp_ui_menu_append_item_from_verb
-static Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view )
+Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view )
{
Glib::ustring prefPath;
@@ -554,7 +554,7 @@ checkitem_toggled(GtkCheckMenuItem *menuitem, gpointer user_data)
sp_ui_menu_activate(menuitem, action);
} else if (pref) {
- // The Show/Hide menu items without actions
+ // All check menu items should have actions now, but just in case
Glib::ustring pref_path = getLayoutPrefPath( view );
pref_path += pref;
pref_path += "/state";
@@ -596,19 +596,16 @@ static gboolean checkitem_update(GtkWidget *widget, GdkEventExpose * /*event*/,
if (!strcmp(action->id, "ToggleGrid")) {
ison = dt->gridsEnabled();
}
- if (!strcmp(action->id, "ToggleGuides")) {
+ else if (!strcmp(action->id, "ToggleGuides")) {
ison = dt->namedview->getGuides();
}
- if (!strcmp(action->id, "ToggleSnapGlobal")) {
+ else if (!strcmp(action->id, "ToggleSnapGlobal")) {
ison = dt->namedview->getSnapGlobal();
}
- if (!strcmp(action->id, "ViewCmsToggle")) {
+ else if (!strcmp(action->id, "ViewCmsToggle")) {
ison = dt->colorProfAdjustEnabled();
}
- if (!strcmp(action->id, "ToggleRulers")) {
- ison = getViewStateFromPref(view, pref);
- }
- if (!strcmp(action->id, "ToggleScrollbars")) {
+ else {
ison = getViewStateFromPref(view, pref);
}
} else if (pref) {
@@ -896,22 +893,22 @@ sp_ui_checkboxes_menus(GtkMenu *m, Inkscape::UI::View::View *view)
{
//sp_ui_menu_append_check_item_from_verb(m, view, _("_Menu"), _("Show or hide the menu bar"), "menu",
// checkitem_toggled, checkitem_update, 0);
- sp_ui_menu_append_check_item_from_verb(m, view, _("_Commands Bar"), _("Show or hide the Commands bar (under the menu)"), "commands",
- checkitem_toggled, checkitem_update, 0);
- sp_ui_menu_append_check_item_from_verb(m, view, _("Sn_ap Controls Bar"), _("Show or hide the snapping controls"), "snaptoolbox",
- checkitem_toggled, checkitem_update, 0);
- sp_ui_menu_append_check_item_from_verb(m, view, _("T_ool Controls Bar"), _("Show or hide the Tool Controls bar"), "toppanel",
- checkitem_toggled, checkitem_update, 0);
- sp_ui_menu_append_check_item_from_verb(m, view, _("_Toolbox"), _("Show or hide the main toolbox (on the left)"), "toolbox",
- checkitem_toggled, checkitem_update, 0);
+ sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "commands",
+ checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_COMMANDS_TOOLBAR));
+ sp_ui_menu_append_check_item_from_verb(m, view,NULL, NULL, "snaptoolbox",
+ checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_SNAP_TOOLBAR));
+ sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "toppanel",
+ checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_TOOL_TOOLBAR));
+ sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "toolbox",
+ checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_TOOLBOX));
sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "rulers",
checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_RULERS));
sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "scrollbars",
checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_SCROLLBARS));
- sp_ui_menu_append_check_item_from_verb(m, view, _("_Palette"), _("Show or hide the color palette"), "panels",
- checkitem_toggled, checkitem_update, 0);
- sp_ui_menu_append_check_item_from_verb(m, view, _("_Statusbar"), _("Show or hide the statusbar (at the bottom of the window)"), "statusbar",
- checkitem_toggled, checkitem_update, 0);
+ sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "panels",
+ checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_PALETTE));
+ sp_ui_menu_append_check_item_from_verb(m, view, NULL, NULL, "statusbar",
+ checkitem_toggled, checkitem_update, Inkscape::Verb::get(SP_VERB_TOGGLE_STATUSBAR));
}
diff --git a/src/interface.h b/src/interface.h
index 891e39957..2e9e7fc2e 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -81,6 +81,7 @@ GtkWidget *sp_ui_main_menubar (Inkscape::UI::View::View *view);
void sp_menu_append_recent_documents (GtkWidget *menu);
void sp_ui_dialog_title_string (Inkscape::Verb * verb, gchar* c);
+Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view );
/**
*
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 591280d47..55d114e9d 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -1785,6 +1785,24 @@ void ZoomVerb::perform(SPAction *action, void *data)
case SP_VERB_TOGGLE_SCROLLBARS:
dt->toggleScrollbars();
break;
+ case SP_VERB_TOGGLE_COMMANDS_TOOLBAR:
+ dt->toggleToolbar("commands");
+ break;
+ case SP_VERB_TOGGLE_SNAP_TOOLBAR:
+ dt->toggleToolbar("snaptoolbox");
+ break;
+ case SP_VERB_TOGGLE_TOOL_TOOLBAR:
+ dt->toggleToolbar("toppanel");
+ break;
+ case SP_VERB_TOGGLE_TOOLBOX:
+ dt->toggleToolbar("toolbox");
+ break;
+ case SP_VERB_TOGGLE_PALETTE:
+ dt->toggleToolbar("panels");
+ break;
+ case SP_VERB_TOGGLE_STATUSBAR:
+ dt->toggleToolbar("statusbar");
+ break;
case SP_VERB_TOGGLE_GUIDES:
sp_namedview_toggle_guides(doc, repr);
break;
@@ -1843,6 +1861,7 @@ void ZoomVerb::perform(SPAction *action, void *data)
inkscape_dialogs_unhide();
dt->_dlg_mgr->showDialog("IconPreviewPanel");
break;
+
default:
break;
}
@@ -2646,6 +2665,12 @@ Verb *Verb::_base_verbs[] = {
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_("Enable snapping"), INKSCAPE_ICON("snap")),
+ new ZoomVerb(SP_VERB_TOGGLE_COMMANDS_TOOLBAR, "ToggleCommandsToolbar", N_("_Commands Bar"), N_("Show or hide the Commands bar (under the menu)"), NULL),
+ new ZoomVerb(SP_VERB_TOGGLE_SNAP_TOOLBAR, "ToggleSnapToolbar", N_("Sn_ap Controls Bar"), N_("Show or hide the snapping controls"), NULL),
+ new ZoomVerb(SP_VERB_TOGGLE_TOOL_TOOLBAR, "ToggleToolToolbar", N_("T_ool Controls Bar"), N_("Show or hide the Tool Controls bar"), NULL),
+ new ZoomVerb(SP_VERB_TOGGLE_TOOLBOX, "ToggleToolbox", N_("_Toolbox"), N_("Show or hide the main toolbox (on the left)"), NULL),
+ new ZoomVerb(SP_VERB_TOGGLE_PALETTE, "TogglePalette", N_("_Palette"), N_("Show or hide the color palette"), NULL),
+ new ZoomVerb(SP_VERB_TOGGLE_STATUSBAR, "ToggleStatusbar", N_("_Statusbar"), N_("Show or hide the statusbar (at the bottom of the window)"), NULL),
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)"),
diff --git a/src/verbs.h b/src/verbs.h
index e8b271a18..5a707ade3 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -224,6 +224,12 @@ enum {
SP_VERB_TOGGLE_GRID,
SP_VERB_TOGGLE_GUIDES,
SP_VERB_TOGGLE_SNAPPING,
+ SP_VERB_TOGGLE_COMMANDS_TOOLBAR,
+ SP_VERB_TOGGLE_SNAP_TOOLBAR,
+ SP_VERB_TOGGLE_TOOL_TOOLBAR,
+ SP_VERB_TOGGLE_TOOLBOX,
+ SP_VERB_TOGGLE_PALETTE,
+ SP_VERB_TOGGLE_STATUSBAR,
SP_VERB_ZOOM_NEXT,
SP_VERB_ZOOM_PREV,
SP_VERB_ZOOM_1_1,
@@ -330,6 +336,7 @@ enum {
SP_VERB_ALIGN_VERTICAL_BOTTOM,
SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR,
SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER,
+
/* Footer */
SP_VERB_LAST
};