Add an option to skip over commented lines in the spell checker. Closes #1428.

Originally committed to SVN as r6368.
This commit is contained in:
Thomas Goyne 2012-01-26 20:51:08 +00:00
parent 92ae4a616e
commit 0aec0a9d59
3 changed files with 17 additions and 2 deletions

View File

@ -47,6 +47,10 @@
#include "subs_edit_ctrl.h"
#include "utils.h"
static void save_skip_comments(wxCommandEvent &evt) {
OPT_SET("Tool/Spell Checker/Skip Comments")->SetBool(!!evt.GetInt());
}
DialogSpellChecker::DialogSpellChecker(agi::Context *context)
: wxDialog(context->parent, -1, _("Spell Checker"))
, context(context)
@ -115,9 +119,15 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context)
}
{
wxButton *button;
wxSizerFlags button_flags = wxSizerFlags().Expand().Bottom().Border(wxBOTTOM, 5);
skip_comments = new wxCheckBox(this, -1, _("&Skip Comments"));
actions_sizer->Add(skip_comments, button_flags);
skip_comments->SetValue(OPT_GET("Tool/Spell Checker/Skip Comments")->GetBool());
skip_comments->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, save_skip_comments);
wxButton *button;
actions_sizer->Add(button = new wxButton(this, -1, _("&Replace")), button_flags);
button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogSpellChecker::OnReplace, this);
@ -233,6 +243,8 @@ bool DialogSpellChecker::FindNext() {
}
bool DialogSpellChecker::CheckLine(AssDialogue *active_line, int start_pos, int *commit_id) {
if (active_line->Comment && skip_comments->GetValue()) return false;
IntPairVector results;
GetWordBoundaries(active_line->Text, results);

View File

@ -34,6 +34,7 @@ namespace agi { struct Context; }
class AssDialogue;
class SpellChecker;
class wxButton;
class wxCheckBox;
class wxComboBox;
class wxListBox;
class wxTextCtrl;
@ -65,6 +66,7 @@ class DialogSpellChecker : public wxDialog {
wxComboBox *language; ///< The list of available languages
wxButton *add_button; ///< Add word to currently active dictionary
wxCheckBox *skip_comments; ///< Skip over commented lines
/// Find the next misspelled word and close the dialog if there are none
/// @return Are there any more misspelled words?

View File

@ -456,7 +456,8 @@
},
"Spell Checker" : {
"Backend" : "hunspell",
"Language" : "en_US"
"Language" : "en_US",
"Skip Comments" : false
},
"Style Editor" : {
"Last" : {