MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / OnSaveImageButton

Method OnSaveImageButton

src/gui/imagerpanel.cc:238–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 5

errorFunction · 0.85
setImageWriterMethod · 0.80
GetImageWriterMethod · 0.80
emptyMethod · 0.45
writeImageMethod · 0.45

Tested by

no test coverage detected