mirror of https://github.com/odrling/Aegisub
Don't repopulate the actor/effect fields when the active line changes
Speeds up switching lines on a totally arbitrary test file that doesn't even use very many actors or effects by ~20%.
This commit is contained in:
parent
8aea747b88
commit
cff3c0a3df
|
@ -302,6 +302,10 @@ void SubsEditBox::OnCommit(int type) {
|
||||||
if (!(type ^ AssFile::COMMIT_ORDER)) return;
|
if (!(type ^ AssFile::COMMIT_ORDER)) return;
|
||||||
|
|
||||||
SetControlsState(!!line);
|
SetControlsState(!!line);
|
||||||
|
UpdateFields(type, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubsEditBox::UpdateFields(int type, bool repopulate_lists) {
|
||||||
if (!line) return;
|
if (!line) return;
|
||||||
|
|
||||||
if (type & AssFile::COMMIT_DIAG_TIME) {
|
if (type & AssFile::COMMIT_DIAG_TIME) {
|
||||||
|
@ -322,11 +326,11 @@ void SubsEditBox::OnCommit(int type) {
|
||||||
comment_box->SetValue(line->Comment);
|
comment_box->SetValue(line->Comment);
|
||||||
style_box->Select(style_box->FindString(to_wx(line->Style)));
|
style_box->Select(style_box->FindString(to_wx(line->Style)));
|
||||||
|
|
||||||
PopulateList(effect_box, &AssDialogue::Effect);
|
if (repopulate_lists) PopulateList(effect_box, &AssDialogue::Effect);
|
||||||
effect_box->ChangeValue(to_wx(line->Effect));
|
effect_box->ChangeValue(to_wx(line->Effect));
|
||||||
effect_box->SetStringSelection(to_wx(line->Effect));
|
effect_box->SetStringSelection(to_wx(line->Effect));
|
||||||
|
|
||||||
PopulateList(actor_box, &AssDialogue::Actor);
|
if (repopulate_lists) PopulateList(actor_box, &AssDialogue::Actor);
|
||||||
actor_box->ChangeValue(to_wx(line->Actor));
|
actor_box->ChangeValue(to_wx(line->Actor));
|
||||||
actor_box->SetStringSelection(to_wx(line->Actor));
|
actor_box->SetStringSelection(to_wx(line->Actor));
|
||||||
edit_ctrl->SetTextTo(line->Text);
|
edit_ctrl->SetTextTo(line->Text);
|
||||||
|
@ -366,7 +370,7 @@ void SubsEditBox::OnActiveLineChanged(AssDialogue *new_line) {
|
||||||
line = new_line;
|
line = new_line;
|
||||||
commit_id = -1;
|
commit_id = -1;
|
||||||
|
|
||||||
OnCommit(AssFile::COMMIT_DIAG_FULL);
|
UpdateFields(AssFile::COMMIT_DIAG_FULL, false);
|
||||||
|
|
||||||
/// @todo VideoContext should be doing this
|
/// @todo VideoContext should be doing this
|
||||||
if (c->videoController->IsLoaded()) {
|
if (c->videoController->IsLoaded()) {
|
||||||
|
|
|
@ -182,6 +182,8 @@ class SubsEditBox final : public wxPanel {
|
||||||
/// @param type AssFile::COMMITType
|
/// @param type AssFile::COMMITType
|
||||||
void OnCommit(int type);
|
void OnCommit(int type);
|
||||||
|
|
||||||
|
void UpdateFields(int type, bool repopulate_lists);
|
||||||
|
|
||||||
/// Regenerate a dropdown list with the unique values of a dialogue field
|
/// Regenerate a dropdown list with the unique values of a dialogue field
|
||||||
void PopulateList(wxComboBox *combo, boost::flyweight<std::string> AssDialogue::*field);
|
void PopulateList(wxComboBox *combo, boost::flyweight<std::string> AssDialogue::*field);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue