Update the time relative to frame box when the subtitle file is changed to reflect timing changes immediately
Originally committed to SVN as r4816.
This commit is contained in:
parent
9083776b9c
commit
a278901e13
2 changed files with 27 additions and 16 deletions
|
@ -182,6 +182,27 @@ void VideoDisplay::ShowCursor(bool show) {
|
||||||
SetCursor(cursor);
|
SetCursor(cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoDisplay::UpdateRelativeTimes(int time) {
|
||||||
|
wxString startSign;
|
||||||
|
wxString endSign;
|
||||||
|
int startOff = 0;
|
||||||
|
int endOff = 0;
|
||||||
|
|
||||||
|
if (AssDialogue *curLine = VideoContext::Get()->grid->GetActiveLine()) {
|
||||||
|
startOff = time - curLine->Start.GetMS();
|
||||||
|
endOff = time - curLine->End.GetMS();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Positive signs
|
||||||
|
if (startOff > 0) startSign = L"+";
|
||||||
|
if (endOff > 0) endSign = L"+";
|
||||||
|
|
||||||
|
// Set the text box for time relative to active subtitle line
|
||||||
|
SubsPosition->SetValue(wxString::Format(L"%s%ims; %s%ims", startSign.c_str(), startOff, endSign.c_str(), endOff));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void VideoDisplay::SetFrame(int frameNumber) {
|
void VideoDisplay::SetFrame(int frameNumber) {
|
||||||
VideoContext *context = VideoContext::Get();
|
VideoContext *context = VideoContext::Get();
|
||||||
ControlSlider->SetValue(frameNumber);
|
ControlSlider->SetValue(frameNumber);
|
||||||
|
@ -208,22 +229,7 @@ void VideoDisplay::SetFrame(int frameNumber) {
|
||||||
PositionDisplay->SetForegroundColour(wxNullColour);
|
PositionDisplay->SetForegroundColour(wxNullColour);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString startSign;
|
UpdateRelativeTimes(time);
|
||||||
wxString endSign;
|
|
||||||
int startOff = 0;
|
|
||||||
int endOff = 0;
|
|
||||||
|
|
||||||
if (AssDialogue *curLine = context->grid->GetActiveLine()) {
|
|
||||||
startOff = time - curLine->Start.GetMS();
|
|
||||||
endOff = time - curLine->End.GetMS();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Positive signs
|
|
||||||
if (startOff > 0) startSign = L"+";
|
|
||||||
if (endOff > 0) endSign = L"+";
|
|
||||||
|
|
||||||
// Set the text box for time relative to active subtitle line
|
|
||||||
SubsPosition->SetValue(wxString::Format(L"%s%ims; %s%ims", startSign.c_str(), startOff, endSign.c_str(), endOff));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render the new frame
|
// Render the new frame
|
||||||
|
@ -261,6 +267,7 @@ void VideoDisplay::Refresh() {
|
||||||
if (!InitContext()) return;
|
if (!InitContext()) return;
|
||||||
VideoContext::Get()->GetFrameAsync(currentFrame);
|
VideoContext::Get()->GetFrameAsync(currentFrame);
|
||||||
tool->Refresh();
|
tool->Refresh();
|
||||||
|
UpdateRelativeTimes(VideoContext::Get()->TimeAtFrame(currentFrame, agi::vfr::EXACT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoDisplay::SetFrameRange(int from, int to) {
|
void VideoDisplay::SetFrameRange(int from, int to) {
|
||||||
|
|
|
@ -155,6 +155,10 @@ class VideoDisplay : public wxGLCanvas {
|
||||||
/// @return Could the context be set?
|
/// @return Could the context be set?
|
||||||
bool InitContext();
|
bool InitContext();
|
||||||
|
|
||||||
|
/// @brief Update the time relative to current subtitle line box
|
||||||
|
/// @param time Currently displayed frame's time
|
||||||
|
void UpdateRelativeTimes(int time);
|
||||||
|
|
||||||
|
|
||||||
void OnMode(const wxCommandEvent &event);
|
void OnMode(const wxCommandEvent &event);
|
||||||
void SetMode(int mode);
|
void SetMode(int mode);
|
||||||
|
|
Loading…
Reference in a new issue