ui: moved help to main menu, changed showHelp()

This commit is contained in:
Steven Hugg 2022-09-15 10:05:54 -07:00
parent 4164ec1fcb
commit 868026c3f9
21 changed files with 80 additions and 67 deletions

View File

@ -122,14 +122,19 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
</ul>
</li>
<hr>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">Help</a>
<ul class="dropdown-menu" id="help_menu">
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/docs/docs/ide.html">IDE Help</a></li>
</ul>
</li>
<li class="dropdown dropdown-submenu">
<a tabindex="-1" href="#">About</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/">Website</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://twitter.com/8bitworkshop">Twitter</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/docs/blog.html">Latest News</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://github.com/sehugg/8bitworkshop/issues/new">Report an Issue</a></li>
<li><a class="dropdown-item" target="_8bws_about" href="https://8bitworkshop.com/docs/docs/ide.html">User Manual</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/">Website</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://twitter.com/8bitworkshop">Twitter</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://8bitworkshop.com/docs/blog.html">Latest News</a></li>
<li><a class="dropdown-item" target="_8bws_help" href="https://github.com/sehugg/8bitworkshop/issues/new">Report an Issue</a></li>
</ul>
</li>
<!--

View File

@ -127,7 +127,7 @@ export interface Platform {
setRecorder?(recorder : EmuRecorder) : void;
advance?(novideo? : boolean) : number;
advanceFrameClock?(trap:DebugCondition, step:number) : number;
showHelp?(tool:string, ident?:string) : void;
showHelp?() : string;
resize?() : void;
getRasterScanline?() : number;

View File

@ -61,6 +61,7 @@ export var platform_id : string; // platform ID string (platform)
export var store_id : string; // store ID string (repo || platform)
export var repo_id : string; // repository ID (repo)
export var platform : Platform; // emulator object
var platform_name : string; // platform name (after setPlatformUI)
var toolbar = $("#controls_top");
@ -126,12 +127,17 @@ const TOOL_TO_SOURCE_STYLE = {
}
const TOOL_TO_HELPURL = {
'dasm': 'https://github.com/dasm-assembler/dasm/blob/master/docs/dasm.pdf',
'dasm': 'https://raw.githubusercontent.com/sehugg/dasm/master/doc/dasm.txt',
'cc65': 'https://cc65.github.io/doc/cc65.html',
'ca65': 'https://cc65.github.io/doc/ca65.html',
'sdcc': 'http://sdcc.sourceforge.net/doc/sdccman.pdf',
'verilator': 'https://www.veripool.org/ftp/verilator_doc.pdf',
'fastbasic': 'https://github.com/dmsc/fastbasic/blob/master/manual.md'
'fastbasic': 'https://github.com/dmsc/fastbasic/blob/master/manual.md',
'bataribasic': "help/bataribasic/manual.html",
'wiz': "https://github.com/wiz-lang/wiz/blob/master/readme.md#wiz",
'silice': "https://github.com/sylefeb/Silice",
'zmac': "https://raw.githubusercontent.com/sehugg/zmac/master/doc.txt",
'cmoc': "http://perso.b2b2c.ca/~sarrazip/dev/cmoc.html",
}
function gaEvent(category:string, action:string, label?:string, value?:string) {
@ -264,6 +270,19 @@ function setBusyStatus(busy: boolean) {
$('#compile_spinner').css('visibility', busy ? 'visible' : 'hidden');
}
function newDropdownListItem(id, text) {
var li = document.createElement("li");
var a = document.createElement("a");
a.setAttribute("class", "dropdown-item");
a.setAttribute("href", "#");
a.setAttribute("data-wndid", id);
if (id == projectWindows.getActiveID())
$(a).addClass("dropdown-item-checked");
a.appendChild(document.createTextNode(text));
li.appendChild(a);
return {li, a};
}
function refreshWindowList() {
var ul = $("#windowMenuList").empty();
var separate = false;
@ -273,15 +292,7 @@ function refreshWindowList() {
ul.append(document.createElement("hr"));
separate = false;
}
var li = document.createElement("li");
var a = document.createElement("a");
a.setAttribute("class", "dropdown-item");
a.setAttribute("href", "#");
a.setAttribute("data-wndid", id);
if (id == projectWindows.getActiveID())
$(a).addClass("dropdown-item-checked");
a.appendChild(document.createTextNode(name));
li.appendChild(a);
let {li,a} = newDropdownListItem(id, name);
ul.append(li);
if (createfn) {
var onopen = (id, wnd) => {
@ -1813,13 +1824,6 @@ function _toggleRecording() {
}
}
function _lookupHelp() {
if (platform.showHelp) {
let tool = platform.getToolForFilename(current_project.mainPath);
platform.showHelp(tool); // TODO: tool, identifier
}
}
function addFileToProject(type, ext, linefn) {
var wnd = projectWindows.getActive();
if (wnd && wnd.insertText) {
@ -1954,10 +1958,7 @@ function setupDebugControls() {
$("#item_addfile_link").click(_addLinkFile);
$("#item_request_persist").click(() => requestPersistPermission(true, false));
updateDebugWindows();
// show help button?
if (platform.showHelp) {
uitoolbar.add('ctrl+alt+?', 'Show Help', 'glyphicon-question-sign', _lookupHelp);
}
// code analyzer?
if (platform.newCodeAnalyzer) {
uitoolbar.add(null, 'Analyze CPU Timing', 'glyphicon-time', traceTiming);
}
@ -1965,6 +1966,20 @@ function setupDebugControls() {
if (platform.setRecorder && platform.advance) {
setupReplaySlider();
}
// help menu items
if (platform.showHelp) {
let {li,a} = newDropdownListItem('help__'+platform_id, platform_name+' Help');
$("#help_menu").append(li);
$(a).click(() => window.open(platform.showHelp(), '_8bws_help'));
}
// tool help
let tool = platform.getToolForFilename(getCurrentMainFilename());
let toolhelpurl = TOOL_TO_HELPURL[tool];
if (toolhelpurl) {
let {li,a} = newDropdownListItem('help__'+tool, tool+' Help');
$("#help_menu").append(li);
$(a).click(() => window.open(toolhelpurl, '_8bws_help'));
}
}
function setupReplaySlider() {
@ -2405,7 +2420,8 @@ function setPlatformUI() {
menuitem.addClass("dropdown-item-checked");
name = name || menuitem.text() || name;
}
$(".platform_name").text(name || platform_id);
platform_name = name || platform_id;
$(".platform_name").text(platform_name);
}
export function getPlatformAndRepo() {

View File

@ -39,9 +39,7 @@ class BallyAstrocadePlatform extends BaseZ80MachinePlatform<BallyAstrocade> impl
{name:'Screen RAM',start:0x4000,size:0x1000,type:'ram'},
{name:'BIOS Variables',start:0x4fce,size:0x5000-0x4fce,type:'ram'},
] } };
showHelp(tool:string, ident:string) {
window.open("https://8bitworkshop.com/docs/platforms/astrocade/", "_help"); // TODO
}
showHelp() { return "https://8bitworkshop.com/docs/platforms/astrocade/"; }
}
class BallyAstrocadeBIOSPlatform extends BallyAstrocadePlatform implements Platform {

View File

@ -147,11 +147,8 @@ function atari8_getROMExtension(rom: Uint8Array) {
else return ".rom";
}
function atari8_showHelp(tool: string, ident: string) {
if (tool == 'fastbasic')
window.open("https://github.com/dmsc/fastbasic/blob/master/manual.md", "_help");
else
window.open("https://8bitworkshop.com/docs/platforms/atari8/", "_help");
function atari8_showHelp() {
return "https://8bitworkshop.com/docs/platforms/atari8/";
}
///

View File

@ -207,8 +207,8 @@ class BASICPlatform implements Platform {
let o = this.runtime.vars[sym];
if (o != null) return `${sym} = ${o}`;
}
showHelp(tool:string, ident:string) {
window.open("https://8bitworkshop.com/docs/platforms/basic/#basicreference", "_help");
showHelp() {
return "https://8bitworkshop.com/docs/platforms/basic/";
}
getDebugCategories() {

View File

@ -58,9 +58,7 @@ class C64WASMPlatform extends Base6502MachinePlatform<C64_WASMMachine> implement
getDefaultExtension() { return ".c"; };
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return C64_MEMORY_MAP; }
showHelp() {
window.open("https://8bitworkshop.com/docs/platforms/c64/", "_help");
}
showHelp() { return "https://8bitworkshop.com/docs/platforms/c64/" }
getROMExtension(rom:Uint8Array) {
/*
if (rom && rom[0] == 0x00 && rom[1] == 0x80 && rom[2+4] == 0xc3 && rom[2+5] == 0xc2) return ".crt";

View File

@ -33,8 +33,8 @@ class ColecoVisionPlatform extends BaseZ80MachinePlatform<ColecoVision> implemen
{name:'BIOS',start:0x0,size:0x2000,type:'rom'},
{name:'Cartridge Header',start:0x8000,size:0x100,type:'rom'},
] } };
showHelp(tool:string, ident:string) {
window.open("https://8bitworkshop.com/docs/platforms/coleco/", "_help");
showHelp() {
return "https://8bitworkshop.com/docs/platforms/coleco/";
}
}

View File

@ -31,7 +31,7 @@ class CPCWASMPlatform extends BaseZ80MachinePlatform<CPC_WASMMachine> implements
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return CPC_MEMORY_MAP; }
showHelp() {
window.open("http://lronaldo.github.io/cpctelera/files/readme-txt.html", "_help");
return "http://lronaldo.github.io/cpctelera/files/readme-txt.html"; // TODO
}
}

View File

@ -22,6 +22,7 @@ class GalaxianPlatform extends BaseZ80MachinePlatform<GalaxianMachine> implement
{name:'Sprite RAM',start:0x5800,size:0x100,type:'ram'},
{name:'I/O Registers',start:0x6000,size:0x2000,type:'io'},
] } };
showHelp() { return "https://8bitworkshop.com/docs/platforms/arcade/index.html#galaxian-scramble" }
}
class GalaxianScramblePlatform extends GalaxianPlatform implements Platform {

View File

@ -42,7 +42,7 @@ class MarkdownPlatform implements Platform {
];
}
showHelp() {
window.open("https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax", "_help");
return "https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax";
}
}

View File

@ -21,7 +21,7 @@ class Midway8080BWPlatform extends BaseZ80MachinePlatform<Midway8080> implements
getMemoryMap = function() { return { main:[
{name:'Frame Buffer',start:0x2400,size:7168,type:'ram'},
] } };
showHelp() { return "https://8bitworkshop.com/docs/platforms/arcade/index.html#midway-8080" }
}

View File

@ -487,8 +487,8 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable {
{name:'Optional Cartridge RAM',start:0x6000,size:0x2000,type:'ram'},
] } };
showHelp(tool:string, ident:string) {
window.open("https://8bitworkshop.com/docs/platforms/nes/", "_help"); // TODO
showHelp() {
return "https://8bitworkshop.com/docs/platforms/nes/";
}
getDebugSymbolFile() {

View File

@ -331,13 +331,8 @@ class VCSPlatform extends BasePlatform {
return disassemble6502(pc, read(pc), read(pc+1), read(pc+2));
}
showHelp(tool:string, ident:string) {
if (tool == 'bataribasic')
window.open("help/bataribasic/manual.html", "_help");
else if (tool == 'wiz')
window.open("https://github.com/wiz-lang/wiz/blob/master/readme.md#wiz", "_help");
else
window.open("https://8bitworkshop.com/docs/platforms/vcs/", "_help"); // TODO
showHelp() {
return "https://8bitworkshop.com/docs/platforms/vcs/";
}
getMemoryMap = function() { return {main:[

View File

@ -55,6 +55,10 @@ var AtariVectorPlatform = function(mainElement) {
this.__proto__ = new (Base6502Platform as any)();
this.showHelp = function() {
return "https://8bitworkshop.com/docs/platforms/arcade/index.html#vector-games"
}
this.getPresets = function() {
return VECTOR_PRESETS;
}

View File

@ -790,11 +790,8 @@ var VerilogPlatform = function(mainElement, options) {
getHDLModuleRunner() {
return top;
}
showHelp?(tool:string, ident?:string) : void {
if (tool == 'silice')
window.open("'https://github.com/sylefeb/Silice'", "_help");
else
window.open("https://8bitworkshop.com/docs/platforms/verilog/");
showHelp() {
return "https://8bitworkshop.com/docs/platforms/verilog/";
}
} // end of inner class

View File

@ -36,7 +36,7 @@ class VIC20WASMPlatform extends Base6502MachinePlatform<VIC20_WASMMachine> imple
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return VIC20_MEMORY_MAP; }
showHelp() {
window.open("https://8bitworkshop.com/docs/platforms/vic20/", "_help");
return "https://8bitworkshop.com/docs/platforms/vic20/";
}
getROMExtension(rom:Uint8Array) {
/*

View File

@ -25,6 +25,7 @@ class VicDualPlatform extends BaseZ80MachinePlatform<VicDual> implements Platfor
{name:'Cell RAM',start:0xe000,size:32*32,type:'ram'},
{name:'Tile RAM',start:0xe800,size:256*8,type:'ram'},
] } };
showHelp() { return "https://8bitworkshop.com/docs/platforms/arcade/index.html#vic-dual" }
}
PLATFORMS['vicdual'] = VicDualPlatform;

View File

@ -436,6 +436,9 @@ var WilliamsPlatform = function(mainElement, proto, options) {
{name:'Video RAM',start:0x0000,size:0xc000,type:'ram'},
{name:'I/O Registers',start:0xc000,size:0x1000,type:'io'},
] } };
this.showHelp = function() {
return "https://8bitworkshop.com/docs/platforms/arcade/#williams-hardware"
}
}
var Williams6809Platform = function(mainElement, options) {

View File

@ -709,10 +709,8 @@ class ZmachinePlatform implements Platform {
getDefaultExtension(): string {
return ".inf";
}
showHelp(tool: string, ident?: string) {
switch (tool) {
case 'inform6': window.open("https://www.inform-fiction.org/manual/html/contents.html"); break;
}
showHelp() {
return "https://www.inform-fiction.org/manual/html/contents.html";
}
getPresets(): Preset[] {
return ZMACHINE_PRESETS;

View File

@ -28,7 +28,7 @@ class ZXWASMPlatform extends BaseZ80MachinePlatform<ZX_WASMMachine> implements P
readAddress(a) { return this.machine.readConst(a); }
getMemoryMap() { return ZX_MEMORY_MAP; }
showHelp() {
window.open("https://worldofspectrum.org/faq/reference/reference.htm", "_help");
return "https://worldofspectrum.org/faq/reference/reference.htm"; // TODO
}
}