Browse Source

File > New attempts to load template.vcv if exists

tags/v0.5.0
Andrew Belt 7 years ago
parent
commit
5f311e7e15
4 changed files with 8 additions and 2 deletions
  1. +1
    -0
      include/app.hpp
  2. +1
    -1
      src/app/RackScene.cpp
  3. +5
    -0
      src/app/RackWidget.cpp
  4. +1
    -1
      src/app/Toolbar.cpp

+ 1
- 0
include/app.hpp View File

@@ -114,6 +114,7 @@ struct RackWidget : OpaqueWidget {
~RackWidget();

void clear();
void initialize();
void openDialog();
void saveDialog();
void saveAsDialog();


+ 1
- 1
src/app/RackScene.cpp View File

@@ -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;


+ 5
- 0
src/app/RackWidget.cpp View File

@@ -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);


+ 1
- 1
src/app/Toolbar.cpp View File

@@ -8,7 +8,7 @@ namespace rack {

struct NewItem : MenuItem {
void onAction() {
gRackWidget->clear();
gRackWidget->initialize();
}
};



Loading…
Cancel
Save