expand error line widgets on mouse over

This commit is contained in:
Steven Hugg 2018-07-26 15:47:09 -04:00
parent 24693ac6eb
commit 0e807690e8
8 changed files with 38 additions and 33 deletions

View File

@ -38,7 +38,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<a class="navbar-brand" href="./blog/">Blog</a>
<a class="navbar-brand" href="https://www.amazon.com/default/e/B01N7J10NF/ref=dp_byline_cont_pop_book_1">Books</a>
</div>
<div id="navbar">
<div id="navbar" class="hidden-sm hidden-xs">
<form class="navbar-form navbar-right">
<a class="btn btn-default" href="redir.html" role="button">Continue to 8bitworkshop IDE
<span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span>

View File

@ -21,8 +21,8 @@
"scripts": {
"build": "tsc",
"test": "npm run test-node && npm run test-browser",
"test-one": "mocha --recursive --timeout 30000",
"test-node": "mocha --recursive --timeout 30000 test/cli",
"test-one": "mocha --recursive --timeout 60000",
"test-node": "mocha --recursive --timeout 60000 test/cli",
"test-profile": "mocha --recursive --timeout 60000 --prof test/cli",
"test-browser": "mocha-phantomjs ./testemu.html"
},

View File

@ -24,6 +24,7 @@ body {
</div>
<div id="notebook">
<!-- TODO: doesn't work properly when screen isn't exactly centered -->
<div id="thumbnaildiv" style="float:right;margin-top:20%;transform:scale(2);margin-right:10%">
</div>
<div id="maineditor" style="height:100%">

View File

@ -2,6 +2,6 @@
. ./scripts/env.sh
DESTPATH=$RSYNC_PATH/dev/
git ls-files -z | rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules -ril -e "ssh -p 2222" --files-from - -0 . $DESTPATH
git ls-files -z | rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules -ril --chmod=a+rx -e "ssh -p 2222" --files-from - -0 . $DESTPATH
git archive --format tar.gz --prefix 8bitworkshop- HEAD tools/ > release/8bitworkshop-tools.tgz
rsync --stats -rilvz -e "ssh -p 2222" ./gen ./mame $DESTPATH/
rsync --stats -rpilvz --chmod=a+rx -e "ssh -p 2222" ./gen ./mame $DESTPATH/

View File

@ -20,7 +20,7 @@ rm -fr $TMPDIR
mkdir -p $TMPDIR
git archive $VERSION | tar x -C $TMPDIR
echo "Copying to $DESTPATH..."
rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules --copy-dest=$DEVPATH -rilz -e "ssh -p 2222" $TMPDIR/ $SUBMODS $DESTPATH
rsync --stats --exclude '.*' --exclude 'scripts/*' --exclude=node_modules --copy-dest=$DEVPATH -rilz --chmod=a+rx -e "ssh -p 2222" $TMPDIR/ $SUBMODS $DESTPATH
git archive --format tar.gz --prefix 8bitworkshop- HEAD tools/ > release/8bitworkshop-tools-$VERSION.tgz
#rsync --stats -arilvz -e "ssh -p 2222" ./mame $DESTPATH/
rsync --stats -rpilvz --chmod=a+rx -e "ssh -p 2222" ./gen ./mame $DESTPATH/
echo "Done."

View File

@ -1,10 +1,10 @@
"use strict";
var APPLE2_PRESETS = [
{id:'sieve.c', name:'Sieve'},
{id:'mandel.c', name:'Mandelbrot'},
{id:'tgidemo.c', name:'TGI Graphics Demo'},
{id:'siegegame.c', name:'Siege Game'},
{id:'sieve.c', name:'Sieve (C)'},
{id:'mandel.c', name:'Mandelbrot (C)'},
{id:'tgidemo.c', name:'TGI Graphics Demo (C)'},
{id:'siegegame.c', name:'Siege Game (C)'},
{id:'hgrtest.a', name:"HGR Test (asm)"},
{id:'conway.a', name:"Conway's Game of Life (asm)"},
// {id:'tb_6502.s', name:'Tom Bombem (assembler game)'},

View File

@ -14,7 +14,7 @@ export interface ProjectView {
getSourceFile?() : SourceFile;
setGutterBytes?(line:number, s:string) : void;
openBitmapEditorAtCursor?() : void;
markErrors?(errors:WorkerError[], embedlines:boolean) : void;
markErrors?(errors:WorkerError[]) : void;
clearErrors?() : void;
};
@ -55,8 +55,8 @@ export class SourceEditor implements ProjectView {
dirtylisting = true;
sourcefile : SourceFile;
currentDebugLine : number;
errormsgs = [];
errorwidgets = [];
lines2errmsg = [];
createDiv(parent:HTMLElement, text:string) {
var div = document.createElement('div');
@ -111,29 +111,33 @@ export class SourceEditor implements ProjectView {
getPath() : string { return this.path; }
addErrorMarker(line:number, msg:string, embedlines:boolean) {
// add line widget w/ error msg
if (embedlines) {
var errspan = document.createElement("span");
errspan.setAttribute("class", "tooltiperrorline");
errspan.appendChild(document.createTextNode(msg));
this.errorwidgets.push(this.editor.addLineWidget(line, errspan));
}
// concatenate error msgs for tooltip text
addErrorMarker(line:number, msg:string) {
var div = document.createElement("div");
div.setAttribute("class", "tooltipbox tooltiperror");
div.appendChild(document.createTextNode("\u24cd"));
if (this.lines2errmsg[line])
msg = this.lines2errmsg[line] + "\n" + msg;
this.lines2errmsg[line] = msg;
var tooltip = document.createElement("span");
tooltip.setAttribute("class", "tooltiptext");
tooltip.appendChild(document.createTextNode(msg));
div.appendChild(tooltip);
this.editor.setGutterMarker(line, "gutter-info", div);
this.errormsgs.push({line:line, msg:msg});
// expand line widgets when mousing over errors
$(div).mouseover((e) => {
this.expandErrors();
});
}
markErrors(errors:WorkerError[], embedlines:boolean) {
addErrorLine(line:number, msg:string) {
var errspan = document.createElement("span");
errspan.setAttribute("class", "tooltiperrorline");
errspan.appendChild(document.createTextNode(msg));
this.errorwidgets.push(this.editor.addLineWidget(line, errspan));
}
expandErrors() {
var e;
while (e = this.errormsgs.shift()) {
this.addErrorLine(e.line, e.msg);
}
}
markErrors(errors:WorkerError[]) {
// TODO: move cursor to error line if offscreen?
this.clearErrors();
var numLines = this.editor.lineCount();
@ -142,7 +146,7 @@ export class SourceEditor implements ProjectView {
if (!info.path || this.path.endsWith(info.path)) {
var line = info.line-1;
if (line < 0 || line >= numLines) line = 0;
this.addErrorMarker(line, info.msg, embedlines);
this.addErrorMarker(line, info.msg);
}
}
}
@ -150,9 +154,9 @@ export class SourceEditor implements ProjectView {
clearErrors() {
this.editor.clearGutter("gutter-info");
this.refreshDebugState();
this.lines2errmsg = [];
this.dirtylisting = true;
// clear line widgets
this.errormsgs = [];
while (this.errorwidgets.length)
this.errorwidgets.shift().clear();
}

View File

@ -74,7 +74,7 @@ export class ProjectWindows {
refreshErrors(embedlines?:boolean) {
if (this.activewnd && this.activewnd.markErrors) {
if (this.lasterrors && this.lasterrors.length)
this.activewnd.markErrors(this.lasterrors, embedlines);
this.activewnd.markErrors(this.lasterrors); // TODO?, embedlines);
else
this.activewnd.clearErrors();
}