diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2015-11-21 11:57:48 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2015-11-21 11:57:48 +0000 |
| commit | 37c1a351b7db98d0d09531f811e310615abd955e (patch) | |
| tree | d3c97f40b94a9c097d9c4b4e04d74c560a237f19 /src | |
| parent | Fix CMake build (diff) | |
| download | inkscape-37c1a351b7db98d0d09531f811e310615abd955e.tar.gz inkscape-37c1a351b7db98d0d09531f811e310615abd955e.zip | |
Hide unused verbs if Potrace is not available
(bzr r14449.1.7)
Diffstat (limited to 'src')
| -rw-r--r-- | src/menus-skeleton.h | 2 | ||||
| -rw-r--r-- | src/shortcuts.cpp | 9 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 8 | ||||
| -rw-r--r-- | src/ui/tools-switch.h | 8 | ||||
| -rw-r--r-- | src/verbs.cpp | 43 | ||||
| -rw-r--r-- | src/verbs.h | 16 |
7 files changed, 85 insertions, 3 deletions
diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index b02b31bd9..da78f99f1 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -290,7 +290,9 @@ static char const menus_skeleton[] = " <verb verb-id=\"TutorialsBasic\" />\n" " <verb verb-id=\"TutorialsShapes\" />\n" " <verb verb-id=\"TutorialsAdvanced\" />\n" +#if HAVE_POTRACE " <verb verb-id=\"TutorialsTracing\" />\n" +#endif " <verb verb-id=\"TutorialsTracingPixelArt\" />\n" " <verb verb-id=\"TutorialsCalligraphy\" />\n" " <verb verb-id=\"TutorialsInterpolate\" />\n" diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index e72c16de0..194d4d2a4 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -575,7 +575,14 @@ static void read_shortcuts_file(char const *filename, bool const is_user_set) { } Inkscape::Verb *verb=Inkscape::Verb::getbyid(verb_name); - if (!verb) { + if (!verb +#if !HAVE_POTRACE + // Squash warning about disabled features + && strcmp(verb_name, "ToolPaintBucket") != 0 + && strcmp(verb_name, "SelectionTrace") != 0 + && strcmp(verb_name, "PaintBucketPrefs") != 0 +#endif + ) { g_warning("Unknown verb name: %s", verb_name); continue; } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index fec49d484..b6d7e25ec 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -478,10 +478,12 @@ void InkscapePreferences::initPageTools() this->AddPage(_page_eraser, _("Eraser"), iter_tools, PREFS_PAGE_TOOLS_ERASER); this->AddNewObjectsStyle(_page_eraser, "/tools/eraser"); +#if HAVE_POTRACE //Paint Bucket this->AddPage(_page_paintbucket, _("Paint Bucket"), iter_tools, PREFS_PAGE_TOOLS_PAINTBUCKET); this->AddSelcueCheckbox(_page_paintbucket, "/tools/paintbucket", false); this->AddNewObjectsStyle(_page_paintbucket, "/tools/paintbucket"); +#endif //Gradient this->AddPage(_page_gradient, _("Gradient"), iter_tools, PREFS_PAGE_TOOLS_GRADIENT); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 7e0184c55..b7696ab8c 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -15,6 +15,10 @@ #ifndef INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H #define INKSCAPE_UI_DIALOG_INKSCAPE_PREFERENCES_H +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include <iostream> #include <vector> #include "ui/widget/preferences-widget.h" @@ -56,7 +60,11 @@ enum { PREFS_PAGE_TOOLS_TEXT, PREFS_PAGE_TOOLS_SPRAY, PREFS_PAGE_TOOLS_ERASER, + +#if HAVE_POTRACE PREFS_PAGE_TOOLS_PAINTBUCKET, +#endif + PREFS_PAGE_TOOLS_GRADIENT, PREFS_PAGE_TOOLS_DROPPER, PREFS_PAGE_TOOLS_CONNECTOR, diff --git a/src/ui/tools-switch.h b/src/ui/tools-switch.h index 280837e87..d396597ca 100644 --- a/src/ui/tools-switch.h +++ b/src/ui/tools-switch.h @@ -12,6 +12,10 @@ #ifndef SEEN_TOOLS_SWITCH_H #define SEEN_TOOLS_SWITCH_H +#if HAVE_CONFIG_H +# include "config.h" +#endif + class SPDesktop; class SPItem; namespace Geom { @@ -40,7 +44,11 @@ enum { TOOLS_MEASURE, TOOLS_DROPPER, TOOLS_CONNECTOR, + +#if HAVE_POTRACE TOOLS_PAINTBUCKET, +#endif + TOOLS_ERASER, TOOLS_LPETOOL }; diff --git a/src/verbs.cpp b/src/verbs.cpp index e0ef27b0d..6b13eabb6 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -832,7 +832,14 @@ Verb *Verb::getbyid(gchar const *id) verb = verb_found->second; } - if (verb == NULL) + if (verb == NULL +#if !HAVE_POTRACE + // Squash warning about disabled features + && strcmp(id, "ToolPaintBucket") != 0 + && strcmp(id, "SelectionTrace") != 0 + && strcmp(id, "PaintBucketPrefs") != 0 +#endif + ) printf("Unable to find: %s\n", id); return verb; @@ -1201,10 +1208,14 @@ void SelectionVerb::perform(SPAction *action, void *data) case SP_VERB_SELECTION_REVERSE: SelectionHelper::reverse(dt); break; + +#if HAVE_POTRACE case SP_VERB_SELECTION_TRACE: INKSCAPE.dialogs_unhide(); dt->_dlg_mgr->showDialog("Trace"); break; +#endif + case SP_VERB_SELECTION_PIXEL_ART: INKSCAPE.dialogs_unhide(); dt->_dlg_mgr->showDialog("PixelArt"); @@ -1606,7 +1617,7 @@ void ContextVerb::perform(SPAction *action, void *data) /** \todo !!! hopefully this can go away soon and actions can look after * themselves */ - for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_PAINTBUCKET_PREFS; vidx++) + for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_LPETOOL_PREFS; vidx++) { SPAction *tool_action= get((sp_verb_t)vidx)->get_action(action->context); if (tool_action) { @@ -1673,9 +1684,13 @@ void ContextVerb::perform(SPAction *action, void *data) case SP_VERB_CONTEXT_CONNECTOR: tools_switch(dt, TOOLS_CONNECTOR); break; + +#if HAVE_POTRACE case SP_VERB_CONTEXT_PAINTBUCKET: tools_switch(dt, TOOLS_PAINTBUCKET); break; +#endif + case SP_VERB_CONTEXT_ERASER: tools_switch(dt, TOOLS_ERASER); break; @@ -1759,10 +1774,14 @@ void ContextVerb::perform(SPAction *action, void *data) prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_CONNECTOR); dt->_dlg_mgr->showDialog("InkscapePreferences"); break; + +#if HAVE_POTRACE case SP_VERB_CONTEXT_PAINTBUCKET_PREFS: prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_PAINTBUCKET); dt->_dlg_mgr->showDialog("InkscapePreferences"); break; +#endif + case SP_VERB_CONTEXT_ERASER_PREFS: prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_ERASER); dt->_dlg_mgr->showDialog("InkscapePreferences"); @@ -2160,10 +2179,14 @@ void TutorialVerb::perform(SPAction *action, void *data) // TRANSLATORS: See "tutorial-basic.svg" comment. sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg")); break; + +#if HAVE_POTRACE case SP_VERB_TUTORIAL_TRACING: // TRANSLATORS: See "tutorial-basic.svg" comment. sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg")); break; +#endif + case SP_VERB_TUTORIAL_TRACING_PIXELART: sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing-pixelart.svg")); break; @@ -2593,9 +2616,13 @@ Verb *Verb::_base_verbs[] = { N_("Simplify selected paths (remove extra nodes)"), INKSCAPE_ICON("path-simplify")), new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"), N_("Reverse the direction of selected paths (useful for flipping markers)"), INKSCAPE_ICON("path-reverse")), + +#if HAVE_POTRACE // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize) new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."), N_("Create one or more paths from a bitmap by tracing it"), INKSCAPE_ICON("bitmap-trace")), +#endif + new SelectionVerb(SP_VERB_SELECTION_PIXEL_ART, "SelectionPixelArt", N_("Trace Pixel Art..."), N_("Create paths using Kopf-Lischinski algorithm to vectorize pixel art"), INKSCAPE_ICON("pixelart-trace")), new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("Make a _Bitmap Copy"), @@ -2733,8 +2760,12 @@ Verb *Verb::_base_verbs[] = { N_("Pick colors from image"), INKSCAPE_ICON("color-picker")), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", NC_("ContextVerb", "Connector"), N_("Create diagram connectors"), INKSCAPE_ICON("draw-connector")), + +#if HAVE_POTRACE new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", NC_("ContextVerb", "Paint Bucket"), N_("Fill bounded areas"), INKSCAPE_ICON("color-fill")), +#endif + new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", NC_("ContextVerb", "LPE Edit"), N_("Edit Path Effect parameters"), NULL), new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", NC_("ContextVerb", "Eraser"), @@ -2780,8 +2811,12 @@ Verb *Verb::_base_verbs[] = { N_("Open Preferences for the Dropper tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"), N_("Open Preferences for the Connector tool"), NULL), + +#if HAVE_POTRACE new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"), N_("Open Preferences for the Paint Bucket tool"), NULL), +#endif + new ContextVerb(SP_VERB_CONTEXT_ERASER_PREFS, "EraserPrefs", N_("Eraser Preferences"), N_("Open Preferences for the Eraser tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_LPETOOL_PREFS, "LPEToolPrefs", N_("LPE Tool Preferences"), @@ -2937,9 +2972,13 @@ Verb *Verb::_base_verbs[] = { N_("Using shape tools to create and edit shapes"), NULL), new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"), N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/), + +#if HAVE_POTRACE // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize) new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"), N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/), +#endif + new TutorialVerb(SP_VERB_TUTORIAL_TRACING_PIXELART, "TutorialsTracingPixelArt", N_("Inkscape: Tracing Pixel Art"), N_("Using Trace Pixel Art dialog"), NULL), new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"), diff --git a/src/verbs.h b/src/verbs.h index 06fc4fb05..27aecae64 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -136,7 +136,11 @@ enum { SP_VERB_SELECTION_OUTLINE, SP_VERB_SELECTION_SIMPLIFY, SP_VERB_SELECTION_REVERSE, + +#if HAVE_POTRACE SP_VERB_SELECTION_TRACE, +#endif + SP_VERB_SELECTION_PIXEL_ART, SP_VERB_SELECTION_CREATE_BITMAP, SP_VERB_SELECTION_COMBINE, @@ -203,7 +207,11 @@ enum { SP_VERB_CONTEXT_MEASURE, SP_VERB_CONTEXT_DROPPER, SP_VERB_CONTEXT_CONNECTOR, + +#if HAVE_POTRACE SP_VERB_CONTEXT_PAINTBUCKET, +#endif + SP_VERB_CONTEXT_LPE, /* not really a tool but used for editing LPE parameters on-canvas for example */ SP_VERB_CONTEXT_ERASER, SP_VERB_CONTEXT_LPETOOL, /* note that this is very different from SP_VERB_CONTEXT_LPE above! */ @@ -227,7 +235,11 @@ enum { SP_VERB_CONTEXT_MEASURE_PREFS, SP_VERB_CONTEXT_DROPPER_PREFS, SP_VERB_CONTEXT_CONNECTOR_PREFS, + +#if HAVE_POTRACE SP_VERB_CONTEXT_PAINTBUCKET_PREFS, +#endif + SP_VERB_CONTEXT_ERASER_PREFS, SP_VERB_CONTEXT_LPETOOL_PREFS, /* Zooming and desktop settings */ @@ -311,7 +323,11 @@ enum { SP_VERB_TUTORIAL_BASIC, SP_VERB_TUTORIAL_SHAPES, SP_VERB_TUTORIAL_ADVANCED, + +#if HAVE_POTRACE SP_VERB_TUTORIAL_TRACING, +#endif + SP_VERB_TUTORIAL_TRACING_PIXELART, SP_VERB_TUTORIAL_CALLIGRAPHY, SP_VERB_TUTORIAL_INTERPOLATE, |
