Fix crash on right click due to no spell checker

See: #131
This commit is contained in:
scx 2019-09-07 23:38:06 +02:00 committed by Thomas Goyne
parent 0418d0b5be
commit cb0af6ca35
2 changed files with 10 additions and 7 deletions

View File

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

View File

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