From 68eb62ca34fb936efa5bb35cddbf89f61e6912e2 Mon Sep 17 00:00:00 2001 From: Nathan Lee <2431820-nathanal@users.noreply.gitlab.com> Date: Tue, 30 Jul 2019 12:17:51 +1000 Subject: Hide spellcheck dialog if Aspell is missing Hide warnings emitted if Aspell/Potrace missing --- src/ui/dialog/dialog-manager.cpp | 14 +++++++++++++- src/ui/dialog/inkscape-preferences.cpp | 6 +++--- src/ui/dialog/inkscape-preferences.h | 3 ++- src/ui/dialog/spellcheck.cpp | 14 +++++++------- src/ui/dialog/spellcheck.h | 4 ++-- 5 files changed, 27 insertions(+), 14 deletions(-) (limited to 'src/ui/dialog') 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); registerFactory("InputDevices", &create); registerFactory("TextFont", &create); + +#if HAVE_ASPELL registerFactory("SpellCheck", &create); +#endif + registerFactory("Export", &create); registerFactory("CloneTiler", &create); registerFactory("XmlTree", &create); @@ -177,7 +185,11 @@ DialogManager::DialogManager() { registerFactory("UndoHistory", &create); registerFactory("InputDevices", &create); registerFactory("TextFont", &create); + +#if HAVE_ASPELL registerFactory("SpellCheck", &create); +#endif + registerFactory("Export", &create); registerFactory("CloneTiler", &create); registerFactory("XmlTree", &create); 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 -#ifdef HAVE_ASPELL +#if HAVE_ASPELL # include # ifdef _WIN32 # include @@ -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 languages; std::vector 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 #endif /* HAVE_ASPELL */ @@ -164,7 +164,7 @@ private: SPObject *_root; -#ifdef HAVE_ASPELL +#if HAVE_ASPELL AspellSpeller *_speller; AspellSpeller *_speller2; AspellSpeller *_speller3; -- cgit v1.2.3