forked from mia/Aegisub
Eliminate pointless (and slow) setting of the edit box to its current text
Originally committed to SVN as r5594.
This commit is contained in:
parent
5b3b821696
commit
d022d2ae56
2 changed files with 7 additions and 1 deletions
|
@ -329,7 +329,7 @@ SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context)
|
||||||
OnSize(evt);
|
OnSize(evt);
|
||||||
|
|
||||||
c->subsGrid->AddSelectionListener(this);
|
c->subsGrid->AddSelectionListener(this);
|
||||||
c->ass->AddCommitListener(&SubsEditBox::Update, this);
|
file_changed_slot = c->ass->AddCommitListener(&SubsEditBox::Update, this);
|
||||||
context->videoController->AddTimecodesListener(&SubsEditBox::UpdateFrameTiming, this);
|
context->videoController->AddTimecodesListener(&SubsEditBox::UpdateFrameTiming, this);
|
||||||
}
|
}
|
||||||
SubsEditBox::~SubsEditBox() {
|
SubsEditBox::~SubsEditBox() {
|
||||||
|
@ -465,12 +465,14 @@ void SubsEditBox::NextLine() {
|
||||||
|
|
||||||
void SubsEditBox::OnChange(wxStyledTextEvent &event) {
|
void SubsEditBox::OnChange(wxStyledTextEvent &event) {
|
||||||
if (line && TextEdit->GetText() != line->Text) {
|
if (line && TextEdit->GetText() != line->Text) {
|
||||||
|
file_changed_slot.Block();
|
||||||
if (event.GetModificationType() & wxSTC_MOD_INSERTTEXT) {
|
if (event.GetModificationType() & wxSTC_MOD_INSERTTEXT) {
|
||||||
CommitText(_("insert text"));
|
CommitText(_("insert text"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CommitText(_("delete text"));
|
CommitText(_("delete text"));
|
||||||
}
|
}
|
||||||
|
file_changed_slot.Unblock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <libaegisub/signal.h>
|
||||||
|
|
||||||
#include "selection_controller.h"
|
#include "selection_controller.h"
|
||||||
|
|
||||||
namespace agi { struct Context; }
|
namespace agi { struct Context; }
|
||||||
|
@ -85,6 +87,8 @@ class SubsEditBox : public wxPanel, protected SelectionListener<AssDialogue> {
|
||||||
|
|
||||||
agi::Context *c;
|
agi::Context *c;
|
||||||
|
|
||||||
|
agi::signal::Connection file_changed_slot;
|
||||||
|
|
||||||
// Box controls
|
// Box controls
|
||||||
wxCheckBox *CommentBox;
|
wxCheckBox *CommentBox;
|
||||||
wxComboBox *StyleBox;
|
wxComboBox *StyleBox;
|
||||||
|
|
Loading…
Reference in a new issue