revert files, not presets

This commit is contained in:
Steven Hugg 2018-08-21 10:16:47 -04:00
parent 0b67f94187
commit 75ea169720
5 changed files with 26 additions and 18 deletions

View File

@ -43,17 +43,17 @@ TODO:
- compile stuck when errors unchanged - compile stuck when errors unchanged
- sound mute? - sound mute?
- $error updates source editor - $error updates source editor
- Revert loads cached files?
- Verilog compile spins forever? - Verilog compile spins forever?
- how to revert included files?
- go to error in include files - go to error in include files
- BOM in upload/download? - BOM in upload/download?
- stack view for Z80 platforms using memory map - stack view for Z80 platforms using memory map
- online tools for music etc - online tools for music etc
- tools (memory, disasm) use debugging state - tools (memory, disasm) use debugging state
- loadROM needs to stop debugging before loading
- text log debugging script - text log debugging script
- update listing when recompiling - NES crt should mark raster pos when debugging
- make sure we don't store files in local storage unnecc.
- state buffer/replay
- intro/help text for each platform
FYI: Image links for the books on http://8bitworkshop.com/ are broken FYI: Image links for the books on http://8bitworkshop.com/ are broken
On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional? On the website the additional grey spacing next to the program line numbers is not dynamically resized when the web browser window size is changed. Intentional?

View File

@ -72,11 +72,17 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<a tabindex="-1" href="#">Platform</a> <a tabindex="-1" href="#">Platform</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li class="dropdown dropdown-submenu"> <li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Consoles</a> <a tabindex="-1" href="#">Game Consoles</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=vcs" id="item_platform_vcs">Atari 2600/VCS</a></li> <li><a class="dropdown-item" href="?platform=vcs" id="item_platform_vcs">Atari 2600/VCS</a></li>
</ul> </ul>
</li> </li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Computers</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="?platform=apple2" id="item_platform_apple2">Apple ][+</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu"> <li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Arcade Systems</a> <a tabindex="-1" href="#">Arcade Systems</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">

View File

@ -110,7 +110,6 @@ export class CodeProject {
updateFileInStore(path:string, text:FileData) { updateFileInStore(path:string, text:FileData) {
// protect against accidential whole-file deletion // protect against accidential whole-file deletion
if ((<string>text).trim && (<string>text).trim().length) { if ((<string>text).trim && (<string>text).trim().length) {
// TODO? (originalFileID != path || text != originalText)) {
this.store.setItem(path, text); this.store.setItem(path, text);
} }
} }
@ -170,7 +169,7 @@ export class CodeProject {
if (err) { // err fetching from store if (err) { // err fetching from store
callback(err, result); callback(err, result);
} else if (value) { // found in store? } else if (value) { // found in store?
this.filedata[path] = value; this.filedata[path] = value; // do not update store, just cache
addResult(path, value); addResult(path, value);
loadNext(); loadNext();
} else if (!path.startsWith("local/")) { } else if (!path.startsWith("local/")) {
@ -183,7 +182,7 @@ export class CodeProject {
webpath += ".a"; // legacy stuff webpath += ".a"; // legacy stuff
this.callbackGetRemote( webpath, (text:string) => { this.callbackGetRemote( webpath, (text:string) => {
console.log("GET",webpath,text.length,'bytes'); console.log("GET",webpath,text.length,'bytes');
this.filedata[path] = text; this.filedata[path] = text; // do not update store, just cache
addResult(path, text); addResult(path, text);
loadNext(); loadNext();
}, 'text') }, 'text')
@ -191,7 +190,7 @@ export class CodeProject {
console.log("Could not load preset", path, err.status); console.log("Could not load preset", path, err.status);
// only cache result if status is 404 (not found) // only cache result if status is 404 (not found)
if (err.status && err.status == 404) if (err.status && err.status == 404)
this.filedata[path] = null; this.filedata[path] = null; // mark cache entry as invalid
loadNext(); loadNext();
}); });
} else { } else {

View File

@ -310,14 +310,16 @@ function _shareFile(e) {
return true; return true;
} }
// TODO: reset file, not project function _revertFile(e) {
function _resetPreset(e) { var fn = getCurrentEditorFilename();
if (!current_preset_entry) { $.get( "presets/"+platform_id+"/"+fn, function(text) {
alert("Can only reset built-in file examples.") if (confirm("Reset '" + fn + "' to default?")) {
} else if (confirm("Reset '" + current_preset_entry.name + "' to default?")) { projectWindows.getActive().setText(text);
qs['reset'] = '1'; }
gotoNewLocation(); }, 'text')
} .fail(function() {
alert("Can only revert built-in files.");
});
return true; return true;
} }
@ -712,7 +714,7 @@ function setupDebugControls(){
$("#item_new_file").click(_createNewFile); $("#item_new_file").click(_createNewFile);
$("#item_upload_file").click(_uploadNewFile); $("#item_upload_file").click(_uploadNewFile);
$("#item_share_file").click(_shareFile); $("#item_share_file").click(_shareFile);
$("#item_reset_file").click(_resetPreset); $("#item_reset_file").click(_revertFile);
if (platform.runEval) if (platform.runEval)
$("#item_debug_expr").click(_breakExpression).show(); $("#item_debug_expr").click(_breakExpression).show();
else else

View File

@ -12,6 +12,7 @@ export interface ProjectView {
refresh(moveCursor:boolean) : void; refresh(moveCursor:boolean) : void;
tick?() : void; tick?() : void;
getValue?() : string; getValue?() : string;
setText?(text : string) : void;
getCursorPC?() : number; getCursorPC?() : number;
getSourceFile?() : SourceFile; getSourceFile?() : SourceFile;
setGutterBytes?(line:number, s:string) : void; setGutterBytes?(line:number, s:string) : void;