diff --git a/include/app.hpp b/include/app.hpp index e0fd3f53..25558904 100644 --- a/include/app.hpp +++ b/include/app.hpp @@ -114,6 +114,7 @@ struct RackWidget : OpaqueWidget { ~RackWidget(); void clear(); + void initialize(); void openDialog(); void saveDialog(); void saveAsDialog(); diff --git a/src/app/RackScene.cpp b/src/app/RackScene.cpp index b02b5caa..077136bb 100644 --- a/src/app/RackScene.cpp +++ b/src/app/RackScene.cpp @@ -86,7 +86,7 @@ Widget *RackScene::onHoverKey(Vec pos, int key) { switch (key) { case GLFW_KEY_N: if (guiIsModPressed() && !guiIsShiftPressed()) { - gRackWidget->clear(); + gRackWidget->initialize(); return this; } break; diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index 0f01a597..3326fa41 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -38,6 +38,11 @@ void RackWidget::clear() { lastPath = ""; } +void RackWidget::initialize() { + clear(); + loadPatch(assetLocal("template.vcv")); +} + void RackWidget::openDialog() { std::string dir = lastPath.empty() ? assetLocal("") : extractDirectory(lastPath); char *path = osdialog_file(OSDIALOG_OPEN, dir.c_str(), NULL, NULL); diff --git a/src/app/Toolbar.cpp b/src/app/Toolbar.cpp index 69142871..bc14ec67 100644 --- a/src/app/Toolbar.cpp +++ b/src/app/Toolbar.cpp @@ -8,7 +8,7 @@ namespace rack { struct NewItem : MenuItem { void onAction() { - gRackWidget->clear(); + gRackWidget->initialize(); } };