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

Method exportComponent

Source/UIComponents/CtrlrPanel/CtrlrPanelCanvas.cpp:1107–1133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1105}
1106
1107void CtrlrPanelCanvas::exportComponent(CtrlrComponent *componentToExport)
1108{
1109 if (componentToExport != 0)
1110 {
1111 File f(owner.getProperty (Ids::lastBrowsedComponentDir));
1112 if (f == File())
1113 {
1114 owner.setProperty (Ids::lastBrowsedComponentDir, File::getSpecialLocation(File::userDocumentsDirectory).getFullPathName());
1115 }
1116
1117 FileChooser fileChooser ("Ctrlr component file",
1118 File(owner.getProperty (Ids::lastBrowsedComponentDir)).getChildFile (componentToExport->getOwner().getName()+".component"),
1119 "*.component",
1120 owner.getOwner().getCtrlrManagerOwner().getProperty(Ids::ctrlrNativeFileDialogs));
1121 if (fileChooser.browseForFileToSave(true))
1122 {
1123 File fileToSave = fileChooser.getResult().withFileExtension(".component");
1124
1125 owner.setProperty (Ids::lastBrowsedComponentDir, fileToSave.getParentDirectory().getFullPathName());
1126 ScopedPointer <FileOutputStream> fileOutputStream(fileToSave.createOutputStream().release());
1127 if (fileOutputStream)
1128 {
1129 componentToExport->getOwner().getModulatorTree().writeToStream (*fileOutputStream);
1130 }
1131 }
1132 }
1133}
1134
1135void CtrlrPanelCanvas::importComponent (const File &componentFile, int x, int y)
1136{

Callers

nothing calls this directly

Calls 13

FileClass · 0.85
browseForFileToSaveMethod · 0.80
getNameMethod · 0.65
getPropertyMethod · 0.45
setPropertyMethod · 0.45
getChildFileMethod · 0.45
getOwnerMethod · 0.45
withFileExtensionMethod · 0.45
getResultMethod · 0.45
getParentDirectoryMethod · 0.45
releaseMethod · 0.45
createOutputStreamMethod · 0.45

Tested by

no test coverage detected