| 236 | } |
| 237 | |
| 238 | void OnSaveImageButton(wxCommandEvent&) override |
| 239 | { |
| 240 | try |
| 241 | { |
| 242 | if (!globalConfig()->has_image_writer()) |
| 243 | error("This format cannot be saved."); |
| 244 | |
| 245 | auto filename = |
| 246 | wxFileSelector("Choose the name of the image file to write", |
| 247 | /* default_path= */ wxEmptyString, |
| 248 | /* default_filename= */ |
| 249 | globalConfig()->image_writer().filename(), |
| 250 | /* default_extension= */ wxEmptyString, |
| 251 | /* wildcard= */ wxEmptyString, |
| 252 | /* flags= */ wxFD_SAVE | wxFD_OVERWRITE_PROMPT); |
| 253 | if (filename.empty()) |
| 254 | return; |
| 255 | |
| 256 | globalConfig().setImageWriter(filename.ToStdString()); |
| 257 | |
| 258 | auto image = _currentDisk->image; |
| 259 | |
| 260 | QueueJob( |
| 261 | [image, this]() |
| 262 | { |
| 263 | GetContext().GetImageWriter()->writeImage(*image); |
| 264 | }); |
| 265 | } |
| 266 | catch (const ErrorException& e) |
| 267 | { |
| 268 | wxMessageBox(e.message, "Error", wxOK | wxICON_ERROR); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | void OnSaveFluxButton(wxCommandEvent&) override |
| 273 | { |
nothing calls this directly
no test coverage detected