MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / operator()

Function operator()

src/command/video.cpp:110–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108 }
109
110 void operator()(agi::Context *c) override {
111 c->videoController->Stop();
112
113 std::string value = from_wx(wxGetTextFromUser(
114 _("Enter aspect ratio in either:\n decimal (e.g. 2.35)\n fractional (e.g. 16:9)\n specific resolution (e.g. 853x480)"),
115 _("Enter aspect ratio"),
116 std::to_wstring(c->videoController->GetAspectRatioValue())));
117 if (value.empty()) return;
118
119 double numval = 0;
120 if (agi::util::try_parse(value, &numval)) {
121 //Nothing to see here, move along
122 }
123 else {
124 std::vector<std::string> chunks;
125 split(chunks, value, boost::is_any_of(":/xX"));
126 if (chunks.size() == 2) {
127 double num, den;
128 if (agi::util::try_parse(chunks[0], &num) && agi::util::try_parse(chunks[1], &den))
129 numval = num / den;
130 }
131 }
132
133 if (numval < 0.5 || numval > 5.0)
134 wxMessageBox(_("Invalid value! Aspect ratio must be between 0.5 and 5.0."),_("Invalid Aspect Ratio"),wxOK | wxICON_ERROR | wxCENTER);
135 else {
136 c->videoController->SetAspectRatio(numval);
137 c->frame->SetDisplayMode(1,-1);
138 }
139 }
140};
141
142struct video_aspect_default final : public validator_video_loaded {

Callers

nothing calls this directly

Calls 15

from_wxFunction · 0.85
try_parseFunction · 0.85
SetClipboardFunction · 0.85
GetClassesFunction · 0.85
beginFunction · 0.85
wxBitmapClass · 0.85
get_imageFunction · 0.85
save_snapshotFunction · 0.85
CreateDummyVideoFunction · 0.85
GetAspectRatioValueMethod · 0.80
SetAspectRatioMethod · 0.80
SetDisplayModeMethod · 0.80

Tested by

no test coverage detected