diff options
| author | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-07-30 02:17:51 +0000 |
|---|---|---|
| committer | Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> | 2019-07-31 23:59:31 +0000 |
| commit | 68eb62ca34fb936efa5bb35cddbf89f61e6912e2 (patch) | |
| tree | ba3d5125626638b7e1a247e72134fafc4c0fb76c /src/ui | |
| parent | If potrace unavailable, hide from the context menu (diff) | |
| download | inkscape-68eb62ca34fb936efa5bb35cddbf89f61e6912e2.tar.gz inkscape-68eb62ca34fb936efa5bb35cddbf89f61e6912e2.zip | |
Hide spellcheck dialog if Aspell is missing
Hide warnings emitted if Aspell/Potrace missing
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/CMakeLists.txt | 11 | ||||
| -rw-r--r-- | src/ui/contextmenu.cpp | 4 | ||||
| -rw-r--r-- | src/ui/desktop/menubar.cpp | 9 | ||||
| -rw-r--r-- | src/ui/dialog/dialog-manager.cpp | 14 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 3 | ||||
| -rw-r--r-- | src/ui/dialog/spellcheck.cpp | 14 | ||||
| -rw-r--r-- | src/ui/dialog/spellcheck.h | 4 |
8 files changed, 48 insertions, 17 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 8bd586c4b..d84ac8be4 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -135,7 +135,6 @@ set(ui_SRC dialog/print.cpp dialog/prototype.cpp dialog/selectorsdialog.cpp - dialog/spellcheck.cpp dialog/styledialog.cpp dialog/svg-fonts-dialog.cpp dialog/svg-preview.cpp @@ -303,7 +302,6 @@ set(ui_SRC dialog/print.h dialog/prototype.h dialog/selectorsdialog.h - dialog/spellcheck.h dialog/styledialog.h dialog/svg-fonts-dialog.h dialog/svg-preview.h @@ -479,3 +477,12 @@ set ( ui_flood_and_trace_SRC if ("${HAVE_POTRACE}") add_inkscape_source("${ui_flood_and_trace_SRC}") endif() + +set ( ui_spellcheck_SRC + dialog/spellcheck.cpp + dialog/spellcheck.h +) + +if ("${HAVE_ASPELL}") + add_inkscape_source("${ui_spellcheck_SRC}") +endif()
\ No newline at end of file diff --git a/src/ui/contextmenu.cpp b/src/ui/contextmenu.cpp index fb3cb7b29..b33653bfd 100644 --- a/src/ui/contextmenu.cpp +++ b/src/ui/contextmenu.cpp @@ -929,11 +929,13 @@ void ContextMenu::MakeTextMenu () mi->show(); insert(*mi,positionOfLastDialog++); +#if HAVE_ASPELL /* Spellcheck dialog */ mi = Gtk::manage(new Gtk::MenuItem(_("Check Spellin_g..."), true)); mi->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::SpellcheckSettings)); mi->show(); insert(*mi,positionOfLastDialog++); +#endif } void ContextMenu::TextSettings () @@ -947,11 +949,13 @@ void ContextMenu::TextSettings () void ContextMenu::SpellcheckSettings () { +#if HAVE_ASPELL if (_desktop->selection->isEmpty()) { _desktop->selection->set(_item); } _desktop->_dlg_mgr->showDialog("SpellCheck"); +#endif } void ContextMenu::ShiftIcons() diff --git a/src/ui/desktop/menubar.cpp b/src/ui/desktop/menubar.cpp index 9340c682a..39496afad 100644 --- a/src/ui/desktop/menubar.cpp +++ b/src/ui/desktop/menubar.cpp @@ -473,7 +473,14 @@ build_menu(Gtk::MenuShell* menu, Inkscape::XML::Node* xml, Inkscape::UI::View::V menu->append(*menuitem); } } - } else { + } else if (true +#if !HAVE_POTRACE + && !strcmp(verb_name.c_str(), "SelectionTrace") +#endif +#if !HAVE_ASPELL + && !strcmp(verb_name.c_str(), "DialogSpellcheck") +#endif + ) { std::cerr << "build_menu: no verb with id: " << verb_name << std::endl; } } diff --git a/src/ui/dialog/dialog-manager.cpp b/src/ui/dialog/dialog-manager.cpp index 66a682de6..0bcf7727c 100644 --- a/src/ui/dialog/dialog-manager.cpp +++ b/src/ui/dialog/dialog-manager.cpp @@ -52,7 +52,11 @@ #include "ui/dialog/object-properties.h" #include "ui/dialog/objects.h" #include "ui/dialog/selectorsdialog.h" -#include "ui/dialog/spellcheck.h" + +#if HAVE_ASPELL +# include "ui/dialog/spellcheck.h" +#endif + #include "ui/dialog/styledialog.h" #include "ui/dialog/svg-fonts-dialog.h" #include "ui/dialog/text-edit.h" @@ -136,7 +140,11 @@ DialogManager::DialogManager() { registerFactory("UndoHistory", &create<UndoHistory, FloatingBehavior>); registerFactory("InputDevices", &create<InputDialog, FloatingBehavior>); registerFactory("TextFont", &create<TextEdit, FloatingBehavior>); + +#if HAVE_ASPELL registerFactory("SpellCheck", &create<SpellCheck, FloatingBehavior>); +#endif + registerFactory("Export", &create<Export, FloatingBehavior>); registerFactory("CloneTiler", &create<CloneTiler, FloatingBehavior>); registerFactory("XmlTree", &create<XmlTree, FloatingBehavior>); @@ -177,7 +185,11 @@ DialogManager::DialogManager() { registerFactory("UndoHistory", &create<UndoHistory, DockBehavior>); registerFactory("InputDevices", &create<InputDialog, DockBehavior>); registerFactory("TextFont", &create<TextEdit, DockBehavior>); + +#if HAVE_ASPELL registerFactory("SpellCheck", &create<SpellCheck, DockBehavior>); +#endif + registerFactory("Export", &create<Export, DockBehavior>); registerFactory("CloneTiler", &create<CloneTiler, DockBehavior>); registerFactory("XmlTree", &create<XmlTree, DockBehavior>); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 3119b1b3b..1584a7662 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -64,7 +64,7 @@ #include "widgets/desktop-widget.h" #include <fstream> -#ifdef HAVE_ASPELL +#if HAVE_ASPELL # include <aspell.h> # ifdef _WIN32 # include <windows.h> @@ -474,7 +474,7 @@ void InkscapePreferences::initPageTools() cb->init ( _("Show font samples in the drop-down list"), "/tools/text/show_sample_in_list", true); _page_text.add_line( false, "", *cb, "", _("Show font samples alongside font names in the drop-down list in Text bar")); - _font_dialog.init(_("Show font substitution inng dialog"), "/options/font/substitutedlg", false); + _font_dialog.init(_("Show font substitution warning dialog"), "/options/font/substitutedlg", false); _page_text.add_line( false, "", _font_dialog, "", _("Show font substitution warning dialog when requested fonts are not available on the system")); cb = Gtk::manage(new PrefCheckButton); @@ -2493,7 +2493,7 @@ void InkscapePreferences::onKBListKeyboardShortcuts() void InkscapePreferences::initPageSpellcheck() { -#ifdef HAVE_ASPELL +#if HAVE_ASPELL std::vector<Glib::ustring> languages; std::vector<Glib::ustring> langValues; diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index e1dbd51c2..1c9fe1f7b 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -91,8 +91,9 @@ enum { PREFS_PAGE_SYSTEM, PREFS_PAGE_BITMAPS, PREFS_PAGE_RENDERING, +#if HAVE_ASPELL PREFS_PAGE_SPELLCHECK - +#endif }; namespace Gtk { diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 77b96c696..ab0282298 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -75,7 +75,7 @@ SpellCheck::SpellCheck () : deskTrack() { -#ifdef HAVE_ASPELL +#if HAVE_ASPELL _speller = nullptr; _speller2 = nullptr; _speller3 = nullptr; @@ -315,7 +315,7 @@ SpellCheck::init(SPDesktop *d) _adds = 0; clearRects(); -#ifdef HAVE_ASPELL +#if HAVE_ASPELL { AspellConfig *config = new_aspell_config(); aspell_config_replace(config, "lang", _lang.c_str()); @@ -375,7 +375,7 @@ SpellCheck::init(SPDesktop *d) void SpellCheck::finished () { -#ifdef HAVE_ASPELL +#if HAVE_ASPELL aspell_speller_save_all_word_lists(_speller); delete_aspell_speller(_speller); _speller = nullptr; @@ -504,7 +504,7 @@ SpellCheck::nextWord() int have = 0; -#ifdef HAVE_ASPELL +#if HAVE_ASPELL // run it by all active spellers have = aspell_speller_check(_speller, _word.c_str(), -1); if (_speller2) @@ -602,7 +602,7 @@ SpellCheck::nextWord() sp_text_context_place_cursor (SP_TEXT_CONTEXT(desktop->event_context), _text, _begin_w); } -#ifdef HAVE_ASPELL +#if HAVE_ASPELL // get suggestions { @@ -754,7 +754,7 @@ void SpellCheck::onAccept () void SpellCheck::onIgnore () { -#ifdef HAVE_ASPELL +#if HAVE_ASPELL aspell_speller_add_to_session(_speller, _word.c_str(), -1); if (_speller2) aspell_speller_add_to_session(_speller2, _word.c_str(), -1); @@ -778,7 +778,7 @@ SpellCheck::onAdd () { _adds++; -#ifdef HAVE_ASPELL +#if HAVE_ASPELL gint num = gtk_combo_box_get_active((GtkComboBox *)dictionary_combo); switch (num) { case 0: diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h index 6726cf417..22dca3640 100644 --- a/src/ui/dialog/spellcheck.h +++ b/src/ui/dialog/spellcheck.h @@ -33,7 +33,7 @@ #include "text-editing.h" -#ifdef HAVE_ASPELL +#if HAVE_ASPELL #include <aspell.h> #endif /* HAVE_ASPELL */ @@ -164,7 +164,7 @@ private: SPObject *_root; -#ifdef HAVE_ASPELL +#if HAVE_ASPELL AspellSpeller *_speller; AspellSpeller *_speller2; AspellSpeller *_speller3; |
