| 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 | |
| 142 | struct video_aspect_default final : public validator_video_loaded { |
nothing calls this directly
no test coverage detected