Merge branch 'misc' into feature

This commit is contained in:
arch1t3cht 2024-02-08 21:26:04 +01:00
commit ba9f48a0e5
2 changed files with 8 additions and 12 deletions

View File

@ -134,14 +134,10 @@ void BaseGrid::OnSubtitlesCommit(int type) {
if (type == AssFile::COMMIT_NEW || type & AssFile::COMMIT_ORDER || type & AssFile::COMMIT_DIAG_ADDREM || type & AssFile::COMMIT_FOLD) if (type == AssFile::COMMIT_NEW || type & AssFile::COMMIT_ORDER || type & AssFile::COMMIT_DIAG_ADDREM || type & AssFile::COMMIT_FOLD)
UpdateMaps(); UpdateMaps();
if (type & AssFile::COMMIT_DIAG_META) { if (type & AssFile::COMMIT_DIAG_META || type & AssFile::COMMIT_DIAG_TIME) {
SetColumnWidths(); SetColumnWidths();
Refresh(false); Refresh(false);
return; } else if (type & AssFile::COMMIT_DIAG_TEXT) {
}
if (type & AssFile::COMMIT_DIAG_TIME)
Refresh(false);
else if (type & AssFile::COMMIT_DIAG_TEXT) {
for (auto const& rect : text_refresh_rects) for (auto const& rect : text_refresh_rects)
RefreshRect(rect, false); RefreshRect(rect, false);
} }

View File

@ -204,10 +204,10 @@ struct GridColumnStartTime final : GridColumnTime {
} }
int Width(const agi::Context *c, WidthHelper &helper) const override { int Width(const agi::Context *c, WidthHelper &helper) const override {
agi::Time max_time = max_value(&AssDialogue::Start, c->ass->Events);
if (!by_frame) if (!by_frame)
return helper(wxS("0:00:00.00")); return helper(max_time.GetAssFormatted());
int frame = c->videoController->FrameAtTime(max_value(&AssDialogue::Start, c->ass->Events), agi::vfr::START); return helper(std::to_wstring(c->videoController->FrameAtTime(max_time, agi::vfr::START)));
return helper(std::to_wstring(frame));
} }
}; };
@ -222,10 +222,10 @@ struct GridColumnEndTime final : GridColumnTime {
} }
int Width(const agi::Context *c, WidthHelper &helper) const override { int Width(const agi::Context *c, WidthHelper &helper) const override {
agi::Time max_time = max_value(&AssDialogue::End, c->ass->Events);
if (!by_frame) if (!by_frame)
return helper(wxS("0:00:00.00")); return helper(max_time.GetAssFormatted());
int frame = c->videoController->FrameAtTime(max_value(&AssDialogue::End, c->ass->Events), agi::vfr::END); return helper(std::to_wstring(c->videoController->FrameAtTime(max_time, agi::vfr::END)));
return helper(std::to_wstring(frame));
} }
}; };