Fix widths of time columns for times >10h
An unfortunate consequence of this is that the grid widths have to be computed on every change to line timing, which will probably have an impact on timing performance when autocommit is enabled. It's probably not a huge impact but it's worth keeping an eye on.
This commit is contained in:
parent
8fcb7c61e8
commit
eaf09b2850
2 changed files with 8 additions and 12 deletions
|
@ -130,14 +130,10 @@ void BaseGrid::OnSubtitlesCommit(int type) {
|
|||
if (type == AssFile::COMMIT_NEW || type & AssFile::COMMIT_ORDER || type & AssFile::COMMIT_DIAG_ADDREM)
|
||||
UpdateMaps();
|
||||
|
||||
if (type & AssFile::COMMIT_DIAG_META) {
|
||||
if (type & AssFile::COMMIT_DIAG_META || type & AssFile::COMMIT_DIAG_TIME) {
|
||||
SetColumnWidths();
|
||||
Refresh(false);
|
||||
return;
|
||||
}
|
||||
if (type & AssFile::COMMIT_DIAG_TIME)
|
||||
Refresh(false);
|
||||
else if (type & AssFile::COMMIT_DIAG_TEXT) {
|
||||
} else if (type & AssFile::COMMIT_DIAG_TEXT) {
|
||||
for (auto const& rect : text_refresh_rects)
|
||||
RefreshRect(rect, false);
|
||||
}
|
||||
|
|
|
@ -158,10 +158,10 @@ struct GridColumnStartTime final : GridColumnTime {
|
|||
}
|
||||
|
||||
int Width(const agi::Context *c, WidthHelper &helper) const override {
|
||||
agi::Time max_time = max_value(&AssDialogue::Start, c->ass->Events);
|
||||
if (!by_frame)
|
||||
return helper(wxS("0:00:00.00"));
|
||||
int frame = c->videoController->FrameAtTime(max_value(&AssDialogue::Start, c->ass->Events), agi::vfr::START);
|
||||
return helper(std::to_wstring(frame));
|
||||
return helper(max_time.GetAssFormatted());
|
||||
return helper(std::to_wstring(c->videoController->FrameAtTime(max_time, agi::vfr::START)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -176,10 +176,10 @@ struct GridColumnEndTime final : GridColumnTime {
|
|||
}
|
||||
|
||||
int Width(const agi::Context *c, WidthHelper &helper) const override {
|
||||
agi::Time max_time = max_value(&AssDialogue::End, c->ass->Events);
|
||||
if (!by_frame)
|
||||
return helper(wxS("0:00:00.00"));
|
||||
int frame = c->videoController->FrameAtTime(max_value(&AssDialogue::End, c->ass->Events), agi::vfr::END);
|
||||
return helper(std::to_wstring(frame));
|
||||
return helper(max_time.GetAssFormatted());
|
||||
return helper(std::to_wstring(c->videoController->FrameAtTime(max_time, agi::vfr::END)));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue