1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-15 21:29:28 +00:00

converted more to bootbox

This commit is contained in:
Steven Hugg 2019-05-22 23:23:55 -04:00
parent d9de3981c9
commit 03d85db4d0

View File

@ -774,9 +774,12 @@ function _renameFile(e) {
var wnd = projectWindows.getActive();
if (wnd && wnd.getPath && current_project.getFile(wnd.getPath())) {
var fn = projectWindows.getActiveID();
var newfn = prompt("Rename '" + fn + "' to?", fn);
bootbox.prompt({
title: "Rename '" + fn + "' to?",
value: fn,
callback: (newfn) => {
var data = current_project.getFile(wnd.getPath());
if (newfn && data) {
if (newfn && newfn != fn && data) {
if (!checkEnteredFilename(newfn)) return;
store.removeItem(fn).then( () => {
return store.setItem(newfn, data);
@ -788,6 +791,8 @@ function _renameFile(e) {
}
});
}
}
});
} else {
alertError("Cannot rename the active window.");
}
@ -1363,7 +1368,10 @@ function _lookupHelp() {
function addFileToProject(type, ext, linefn) {
var wnd = projectWindows.getActive();
if (wnd && wnd.insertText) {
var filename = prompt("Add "+type+" File to Project", "filename"+ext);
bootbox.prompt({
title:"Add "+type+" File to Project",
value:"filename"+ext,
callback:(filename:string) => {
if (filename && filename.trim().length > 0) {
if (!checkEnteredFilename(filename)) return;
var path = filename;
@ -1378,6 +1386,8 @@ function addFileToProject(type, ext, linefn) {
refreshWindowList();
});
}
}
});
} else {
alertError("Can't insert text in this window -- switch back to main file");
}
@ -1403,6 +1413,8 @@ function _addLinkFile() {
var tool = platform.getToolForFilename(fn);
if (fn.endsWith(".c") || tool == 'sdcc' || tool == 'cc65')
addFileToProject("Linked C", ".c", (s) => { return '//#link "'+s+'"' });
else if (fn.endsWith("asm") || fn.endsWith(".s") || tool == 'ca65')
addFileToProject("Linked ASM", ".inc", (s) => { return ';#link "'+s+'"' });
else
alertError("Can't add linked file to this project type (" + tool + ")");
}