@@ -114,6 +114,7 @@ struct RackWidget : OpaqueWidget { | |||||
~RackWidget(); | ~RackWidget(); | ||||
void clear(); | void clear(); | ||||
void initialize(); | |||||
void openDialog(); | void openDialog(); | ||||
void saveDialog(); | void saveDialog(); | ||||
void saveAsDialog(); | void saveAsDialog(); | ||||
@@ -86,7 +86,7 @@ Widget *RackScene::onHoverKey(Vec pos, int key) { | |||||
switch (key) { | switch (key) { | ||||
case GLFW_KEY_N: | case GLFW_KEY_N: | ||||
if (guiIsModPressed() && !guiIsShiftPressed()) { | if (guiIsModPressed() && !guiIsShiftPressed()) { | ||||
gRackWidget->clear(); | |||||
gRackWidget->initialize(); | |||||
return this; | return this; | ||||
} | } | ||||
break; | break; | ||||
@@ -38,6 +38,11 @@ void RackWidget::clear() { | |||||
lastPath = ""; | lastPath = ""; | ||||
} | } | ||||
void RackWidget::initialize() { | |||||
clear(); | |||||
loadPatch(assetLocal("template.vcv")); | |||||
} | |||||
void RackWidget::openDialog() { | void RackWidget::openDialog() { | ||||
std::string dir = lastPath.empty() ? assetLocal("") : extractDirectory(lastPath); | std::string dir = lastPath.empty() ? assetLocal("") : extractDirectory(lastPath); | ||||
char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, NULL); | char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, NULL); | ||||
@@ -8,7 +8,7 @@ namespace rack { | |||||
struct NewItem : MenuItem { | struct NewItem : MenuItem { | ||||
void onAction() { | void onAction() { | ||||
gRackWidget->clear(); | |||||
gRackWidget->initialize(); | |||||
} | } | ||||
}; | }; | ||||