summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-07-30 02:17:51 +0000
committerNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-07-31 23:59:31 +0000
commit68eb62ca34fb936efa5bb35cddbf89f61e6912e2 (patch)
treeba3d5125626638b7e1a247e72134fafc4c0fb76c /src/ui/dialog
parentIf potrace unavailable, hide from the context menu (diff)
downloadinkscape-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/dialog')
-rw-r--r--src/ui/dialog/dialog-manager.cpp14
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp6
-rw-r--r--src/ui/dialog/inkscape-preferences.h3
-rw-r--r--src/ui/dialog/spellcheck.cpp14
-rw-r--r--src/ui/dialog/spellcheck.h4
5 files changed, 27 insertions, 14 deletions
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;