Fix crash on right click due to no spell checker

This commit is contained in:
wangqr 2019-09-01 19:10:19 -04:00
parent 139132a964
commit 0b8b286767
3 changed files with 18 additions and 13 deletions

View file

@ -475,12 +475,6 @@ find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries (Aegisub ${OPENGL_LIBRARIES})
find_package(Hunspell REQUIRED)
include_directories(${HUNSPELL_INCLUDE_DIR})
target_link_libraries (Aegisub ${HUNSPELL_LIBRARIES})
add_definitions("-DWITH_HUNSPELL")
target_sources(Aegisub PRIVATE src/spellchecker_hunspell.cpp)
find_package(Iconv REQUIRED)
include_directories(${Iconv_INCLUDE_DIRS})
target_link_libraries (Aegisub ${Iconv_LIBRARIES})
@ -545,6 +539,14 @@ if (FFTW_FOUND)
add_definitions("-DWITH_FFTW3")
endif(FFTW_FOUND)
find_package(Hunspell)
if (HUNSPELL_FOUND)
include_directories(${HUNSPELL_INCLUDE_DIR})
target_link_libraries (Aegisub ${HUNSPELL_LIBRARIES})
add_definitions("-DWITH_HUNSPELL")
target_sources(Aegisub PRIVATE src/spellchecker_hunspell.cpp)
endif (HUNSPELL_FOUND)
#ifdef WITH_LIBPULSE
#add_definitions("-DWITH_LIBPULSE")
#target_sources(Aegisub PRIVATE src/audio_player_pulse.cpp)

View file

@ -22,10 +22,12 @@
#include <libaegisub/make_unique.h>
#include <libaegisub/spellchecker.h>
#ifdef __APPLE__
namespace agi {
class OptionValue;
std::unique_ptr<agi::SpellChecker> CreateCocoaSpellChecker(OptionValue *opt);
}
#endif
std::unique_ptr<agi::SpellChecker> SpellCheckerFactory::GetSpellChecker() {
#ifdef __APPLE__

View file

@ -388,15 +388,16 @@ void SubsTextEditCtrl::OnContextMenu(wxContextMenuEvent &event) {
currentWord = line_text.substr(currentWordPos.first, currentWordPos.second);
wxMenu menu;
if (spellchecker)
if (spellchecker) {
AddSpellCheckerEntries(menu);
// Append language list
menu.Append(-1,_("Spell checker language"), GetLanguagesMenu(
EDIT_MENU_DIC_LANGS,
to_wx(OPT_GET("Tool/Spell Checker/Language")->GetString()),
to_wx(spellchecker->GetLanguageList())));
menu.AppendSeparator();
// Append language list
menu.Append(-1, _("Spell checker language"), GetLanguagesMenu(
EDIT_MENU_DIC_LANGS,
to_wx(OPT_GET("Tool/Spell Checker/Language")->GetString()),
to_wx(spellchecker->GetLanguageList())));
menu.AppendSeparator();
}
AddThesaurusEntries(menu);