forked from mia/Aegisub
Changed behavior of commiting time
Originally committed to SVN as r71.
This commit is contained in:
parent
b8c0e2e7f8
commit
ed67b6cc6d
5 changed files with 22 additions and 10 deletions
|
@ -59,6 +59,7 @@ public:
|
|||
void Modified();
|
||||
void Commited();
|
||||
void SetValue(const wxString& value);
|
||||
bool HasBeenModified() { return isModified; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -646,10 +646,10 @@ void SubsEditBox::OnLayerChange(wxCommandEvent &event) {
|
|||
// Start time changed
|
||||
void SubsEditBox::OnStartTimeChange(wxCommandEvent &event) {
|
||||
if (StartTime->time > EndTime->time) StartTime->SetTime(EndTime->time.GetMS());
|
||||
bool join = Options.AsBool(_T("Link Time Boxes Commit"));
|
||||
bool join = Options.AsBool(_T("Link Time Boxes Commit")) && EndTime->HasBeenModified();
|
||||
StartTime->Update();
|
||||
if (join) EndTime->Update();
|
||||
CommitTimes(true,join);
|
||||
CommitTimes(true,join,true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -657,10 +657,10 @@ void SubsEditBox::OnStartTimeChange(wxCommandEvent &event) {
|
|||
// End time changed
|
||||
void SubsEditBox::OnEndTimeChange(wxCommandEvent &event) {
|
||||
if (StartTime->time > EndTime->time) EndTime->SetTime(StartTime->time.GetMS());
|
||||
bool join = Options.AsBool(_T("Link Time Boxes Commit"));
|
||||
bool join = Options.AsBool(_T("Link Time Boxes Commit")) && StartTime->HasBeenModified();
|
||||
EndTime->Update();
|
||||
if (join) StartTime->Update();
|
||||
CommitTimes(join,true);
|
||||
CommitTimes(join,true,false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -669,13 +669,13 @@ void SubsEditBox::OnEndTimeChange(wxCommandEvent &event) {
|
|||
void SubsEditBox::OnDurationChange(wxCommandEvent &event) {
|
||||
EndTime->SetTime(StartTime->time.GetMS() + Duration->time.GetMS());
|
||||
Duration->Update();
|
||||
CommitTimes(false,true);
|
||||
CommitTimes(false,true,true);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
// Commit time changes
|
||||
void SubsEditBox::CommitTimes(bool start,bool end) {
|
||||
void SubsEditBox::CommitTimes(bool start,bool end,bool fromStart) {
|
||||
// Get selection
|
||||
if (!start && !end) return;
|
||||
grid->BeginBatch();
|
||||
|
@ -689,8 +689,17 @@ void SubsEditBox::CommitTimes(bool start,bool end) {
|
|||
for (int i=0;i<n;i++) {
|
||||
cur = grid->GetDialogue(sel[i]);
|
||||
if (cur) {
|
||||
// Set times
|
||||
if (start) cur->Start = StartTime->time;
|
||||
if (end) cur->End = EndTime->time;
|
||||
|
||||
// Ensure that they have positive length
|
||||
if (cur->Start > cur->End) {
|
||||
if (fromStart) cur->End = cur->Start;
|
||||
else cur->Start = cur->End;
|
||||
}
|
||||
|
||||
// Update
|
||||
cur->UpdateData();
|
||||
grid->SetRowToLine(sel[i],cur);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
wxButton *Color4;
|
||||
|
||||
void SetControlsState(bool state);
|
||||
void CommitTimes(bool start,bool end);
|
||||
void CommitTimes(bool start,bool end,bool fromStart);
|
||||
|
||||
int BlockAtPos(int pos);
|
||||
|
||||
|
|
|
@ -79,9 +79,10 @@ void TimeEdit::OnModified(wxCommandEvent &event) {
|
|||
|
||||
// Colour
|
||||
if (showModified && !modified) {
|
||||
modified = true;
|
||||
SetBackgroundColour(Options.AsColour(_T("Edit Box Need Enter Background")));
|
||||
}
|
||||
modified = true;
|
||||
wxLogMessage(_T("Time modified!"));
|
||||
|
||||
// Done
|
||||
ready = true;
|
||||
|
@ -154,11 +155,11 @@ void TimeEdit::Update() {
|
|||
}
|
||||
|
||||
// Update modified status
|
||||
if (modified) {
|
||||
if (modified && showModified) {
|
||||
SetBackgroundColour(wxNullColour);
|
||||
Refresh();
|
||||
modified = false;
|
||||
}
|
||||
modified = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
void SetByFrame(bool enable);
|
||||
void SetTime(int ms);
|
||||
void Update();
|
||||
bool HasBeenModified() { return modified; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue