@@ -99,6 +99,17 @@ function HANDLE_FileDrop(e){ | |||
} | |||
function HANDLE_NewProject(){ | |||
GlobalEvents.emit("modal-close"); | |||
CTRLNameTablesStore.clear(); | |||
CTRLBanksStore.clear(); | |||
CTRLPalettesStore.clear(); | |||
CTRLPalettesStore.createPalette("Palette 1"); | |||
CTRLBanksStore.createBank("Bank 1"); | |||
} | |||
function HANDLE_SaveProject(e){ | |||
//var a = document.createElement("a"); | |||
var file = new Blob([JSONFromProject()], {type: "text/plain"}); | |||
@@ -246,6 +257,7 @@ class CTRLIO{ | |||
GlobalEvents.listen("load-project", HANDLE_LoadProjectRequest); | |||
GlobalEvents.listen("export-pal-asm", HANDLE_ExportPalASM); | |||
GlobalEvents.listen("export-nametable", HANDLE_ExportNameTableASM); | |||
GlobalEvents.listen("new-project", HANDLE_NewProject); | |||
var input = document.querySelectorAll("input.project-loader"); | |||
if (input.length > 0){ |
@@ -9,6 +9,12 @@ | |||
<form> | |||
<input type="file" class="project-loader" accept="text/plain" style="display:none;"></input> | |||
</form> | |||
<li class="pure-menu-item" emit="modal-open" emit-args='{"cls":".new-project-modal"}'> | |||
<a href="#" class="pure-menu-link"> | |||
<i class="fa fa-file-alt"></i> | |||
New Project | |||
</a> | |||
</li> | |||
<li class="pure-menu-item" emit="load-project"> | |||
<a href="#" class="pure-menu-link"> | |||
<i class="fa fa-folder-open"></i> |
@@ -18,3 +18,5 @@ | |||
<%- include("modals/export_CHR.html"); %> | |||
<%- include("modals/export_NT.html"); %> | |||
<%- include("modals/new_project.html"); %> |
@@ -0,0 +1,11 @@ | |||
<div class="modal new-project-modal"> | |||
<div class="modal-content"> | |||
Clicking <b>"Yes"</b> will destroy all work in the current project.<br> | |||
If this is <i>not</i> what you, click <b>"No"</b><br><br> | |||
Start a new project? | |||
<form class="pure-form new-project-form"> | |||
<button type="submit" class="pure-button" emit="new-project">Yes</button> | |||
<button type="submit" class="pure-button" emit="modal-close">No</button> | |||
</form> | |||
</div> | |||
</div> |