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