MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / savePanelAs

Method savePanelAs

Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp:203–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203const File CtrlrPanel::savePanelAs(const CommandID saveOption)
204{
205 File fileToSave;
206 File f(getProperty(Ids::panelLastSaveDir));
207
208 if (saveOption == CtrlrEditor::doExportFileText)
209 {
210 fileToSave = CtrlrPanel::askForPanelFileToSave (this, f, true, false);
211
212 if (fileToSave == File())
213 return (fileToSave);
214
215 savePanelXml (fileToSave, this);
216 setProperty (Ids::panelFilePath, fileToSave.getFullPathName());
217 setProperty (Ids::panelLastSaveDir, fileToSave.getParentDirectory().getFullPathName());
218 }
219 if (saveOption == CtrlrEditor::doExportFileZText)
220 {
221 fileToSave = CtrlrPanel::askForPanelFileToSave (this, f, true, true);
222
223 if (fileToSave == File())
224 return (fileToSave);
225
226 savePanelXml (fileToSave, this, true);
227 setProperty (Ids::panelFilePath, fileToSave.getFullPathName());
228 setProperty (Ids::panelLastSaveDir, fileToSave.getParentDirectory().getFullPathName());
229 }
230 if (saveOption == CtrlrEditor::doExportFileBin)
231 {
232 fileToSave = CtrlrPanel::askForPanelFileToSave (this, f, false, false);
233
234 if (fileToSave == File())
235 return (fileToSave);
236
237 savePanelBin (fileToSave, this, false);
238 }
239 if (saveOption == CtrlrEditor::doExportFileZBin)
240 {
241 fileToSave = CtrlrPanel::askForPanelFileToSave (this, f, false, true);
242
243 if (fileToSave == File())
244 return (fileToSave);
245
246 savePanelBin (fileToSave, this, true);
247 }
248 if (saveOption == CtrlrEditor::doExportFileZBinRes)
249 {
250 const String err = exportPanel(this, f);
251 if (err != "")
252 {
253 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Panel Export", err);
254 }
255 }
256 if (saveOption == CtrlrEditor::doExportFileInstance)
257 {
258 Result res = owner.getNativeObject().exportWithDefaultPanel(this, false, false);
259 if (res.failed())
260 {

Callers 1

performMethod · 0.80

Calls 7

FileClass · 0.85
setPropertyFunction · 0.85
generateRandomUniqueFunction · 0.85
getNativeObjectMethod · 0.80
getParentDirectoryMethod · 0.45
failedMethod · 0.45

Tested by

no test coverage detected