Skip to content

Commit

Permalink
Merge branch 'misc' into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Feb 19, 2024
2 parents 39cbc97 + 1515c77 commit 0b8bc68
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/grid_column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ 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(max_time.GetAssFormatted());
return helper(std::to_wstring(c->videoController->FrameAtTime(max_time, agi::vfr::START)));
std::string value = by_frame ? std::to_string(c->videoController->FrameAtTime(max_time, agi::vfr::START)) : max_time.GetAssFormatted();

for (char &c : value) {
if (c >= '0' && c <= '9')
c = '0';
}

return helper(value);
}
};

Expand All @@ -223,9 +228,14 @@ 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(max_time.GetAssFormatted());
return helper(std::to_wstring(c->videoController->FrameAtTime(max_time, agi::vfr::END)));
std::string value = by_frame ? std::to_string(c->videoController->FrameAtTime(max_time, agi::vfr::END)) : max_time.GetAssFormatted();

for (char &c : value) {
if (c >= '0' && c <= '9')
c = '0';
}

return helper(value);
}
};

Expand Down

0 comments on commit 0b8bc68

Please sign in to comment.