Make translation assistant skipping whitespace an explicit setting

This commit is contained in:
Ryan Lucia 2018-03-27 15:07:37 -04:00 committed by wangqr
parent 38bb1790ab
commit fc1a78aeca
4 changed files with 10 additions and 3 deletions

View file

@ -31,6 +31,7 @@
#include "format.h" #include "format.h"
#include "help_button.h" #include "help_button.h"
#include "libresrc/libresrc.h" #include "libresrc/libresrc.h"
#include "options.h"
#include "persist_location.h" #include "persist_location.h"
#include "project.h" #include "project.h"
#include "subs_edit_ctrl.h" #include "subs_edit_ctrl.h"
@ -57,7 +58,8 @@ static void add_hotkey(wxSizer *sizer, wxWindow *parent, const char *command, wx
// Skip over override blocks, comments, and whitespace between blocks // Skip over override blocks, comments, and whitespace between blocks
static bool bad_block(std::unique_ptr<AssDialogueBlock> &block) { static bool bad_block(std::unique_ptr<AssDialogueBlock> &block) {
return block->GetType() != AssBlockType::PLAIN || boost::all(block->GetText(), boost::is_space()); bool is_whitespace = boost::all(block->GetText(), boost::is_space());
return block->GetType() != AssBlockType::PLAIN || (is_whitespace && OPT_GET("Tool/Translation Assistant/Skip Whitespace")->GetBool());
} }
DialogTranslation::DialogTranslation(agi::Context *c) DialogTranslation::DialogTranslation(agi::Context *c)

View file

@ -559,7 +559,8 @@
"X" : -1, "X" : -1,
"Y" : -1 "Y" : -1
}, },
"Maximized" : false "Maximized" : false,
"Skip Whitespace" : true
}, },
"Visual" : { "Visual" : {
"Autohide": false "Autohide": false

View file

@ -559,7 +559,8 @@
"X" : -1, "X" : -1,
"Y" : -1 "Y" : -1
}, },
"Maximized" : false "Maximized" : false,
"Skip Whitespace" : true
}, },
"Visual" : { "Visual" : {
"Autohide": false "Autohide": false

View file

@ -225,6 +225,9 @@ void Interface(wxTreebook *book, Preferences *parent) {
p->OptionAdd(grid, _("Hide overrides symbol"), "Subtitle/Grid/Hide Overrides Char"); p->OptionAdd(grid, _("Hide overrides symbol"), "Subtitle/Grid/Hide Overrides Char");
p->OptionFont(grid, "Subtitle/Grid/"); p->OptionFont(grid, "Subtitle/Grid/");
auto tl_assistant = p->PageSizer(_("Translation Assistant"));
p->OptionAdd(tl_assistant, _("Skip over whitespace"), "Tool/Translation Assistant/Skip Whitespace");
p->SetSizerAndFit(p->sizer); p->SetSizerAndFit(p->sizer);
} }