added the 'l=1' switch which provides a limited user-interface

This commit is contained in:
Rick Companje 2015-02-02 17:19:19 +01:00
parent 5a91fa480c
commit 4b0fdc1bc1
9 changed files with 76 additions and 60 deletions

View File

@ -49,31 +49,31 @@ function initKeyboard() {
var ch = String.fromCharCode(event.which);
switch (ch) {
case 'c': newSketch(); break;
case 'n': newSketch(); break;
case 'p': print(); break;
case 'u': oopsUndo(); break;
case 'g': settingsWindow.downloadGcode(); break;
case 'q': stopPrint(); break;
case '+': case '=': zoomShape(1.05); break;
case ',': openSettingsWindow(); break;
case 'h': previewUp(true); break;
case '-': zoomShape(.95); break;
case ';': moveShape(-5,0); break;
case '[': previewTwistLeft(); break;
case '\'': moveShape(5,0); break;
case ']': previewTwistRight(); break;
case 'c': newSketch(); break;
case 'f': showTravelLines=!showTravelLines; redrawDoodle(); break;
case 'g': settingsWindow.downloadGcode(); break;
case 'H': previewDown(true); break;
case 's': saveSketch(); break;
case 'h': previewUp(true); break;
case 'i': showShapeDialog(); break;
case 'L': nextSketch(); break;
case 'l': prevSketch(); break;
case '[': previewTwistLeft(); break;
case ']': previewTwistRight(); break;
case '|': resetTwist(); break;
case 't': showWordArtDialog(); break;
case 'i': showShapeDialog(); break;
case 'T': showScanDialog(); break;
case ';': moveShape(-5,0); break;
case '\'': moveShape(5,0); break;
case '-': zoomShape(.95); break;
case '+': zoomShape(1.05); break;
case 'r': rotateShape(.1); break;
case 'n': newSketch(); break;
case 'p': print(); break;
case 'q': stopPrint(); break;
case 'R': rotateShape(-.1); break;
case 'r': rotateShape(.1); break;
case 's': saveSketch(); break;
case 'T': showScanDialog(); break;
case 't': showWordArtDialog(); break;
case 'u': oopsUndo(); break;
case '|': resetTwist(); break;
//default: console.log("Key: '" + ch + "' (" + event.which + ")");
}

View File

@ -184,7 +184,8 @@ function Printer() {
if (completed) {
console.log("Printer:sendPrintPart:gcode sending completed");
this.gcode = [];
btnStop.css("display","block"); // hack
//btnStop.css("display","block"); // hack
btnStop.enable(); //check me
self.removeLeaveWarning();
message.set("Doodle has been sent to printer...",Message.INFO,true);
//self.targetTemperature = settings["printer.temperature"]; // slight hack

View File

@ -44,10 +44,10 @@ function initButtonBehavior() {
buttonGroupAdd = $("#buttonGroupAdd");
btnShape = new Button("#btnShape");
btnWordArt = new Button("#btnWordArt");
btnScan = new Button("#btnScan");
btnScan = new Button("#btnScan");
popupWordArt = $("#popupWordArt");
popupShape = $("#popupShape");
popupScan = $("#popupScan");
popupScan = $("#popupScan");
popupMask = $("#popupMask");
logoPanel = $("#logopanel");
btnToggleEdit = new Button("#btnToggleEdit");
@ -76,7 +76,7 @@ function initButtonBehavior() {
btnPrint.on("onButtonClick", print);
btnStop.on("onButtonClick", stopPrint);
btnSave.on("onButtonClick", saveSketch);
btnPrevious.on("onButtonClick", previousSketch);
btnPrevious.on("onButtonClick", onPreviousButtonClick);
btnNext.on("onButtonClick", nextSketch);
btnOops.on("onButtonHold", onBtnOops);
// vertical shape buttons
@ -98,6 +98,11 @@ function initButtonBehavior() {
// setSketchModified(false);
// updateSketchButtonStates();
function onPreviousButtonClick() {
if (!sketchLoaded) loadSketch(curSketch);
else previousSketch();
}
function onBtnToggleVerticalShapes() {
var btnImg;
if (buttonGroupVerticalShapes.is(":hidden")) {
@ -232,7 +237,8 @@ function print(e) {
//setState(Printer.BUFFERING_STATE,printer.hasControl);
printer.overruleState(Printer.BUFFERING_STATE);
btnStop.css("display","none"); // hack
// btnStop.css("display","none"); // hack
btnStop.disable(); //check me
// we put the gcode generation in a little delay
// so that for example the print button is disabled right away
@ -472,3 +478,22 @@ function setState(newState,newHasControl) {
state = newState;
hasControl = newHasControl;
}
function initLimitedInterface() {
btnSettings.hide();
btnPrint.hide();
btnStop.hide();
btnInfo.hide();
btnPrevious.hide();
btnNext.hide();
$("#thermometerContainer").hide();
$("#progressbarCanvasContainerParent").hide();
$("#btnSave").addClass("fake-print-button");
$("#btnSave").attr("src","img/buttons/btnPrint.png");
$("#btnSave").on("onButtonClick",function() {
setTimeout(function() {
alert('\nThank you!\n\nYour sketch has been saved on the Doodle3D WiFi-Box and is now ready for 3D-printing.\n\n');
},1000);
})
}

View File

@ -67,3 +67,4 @@ function _startOrientationAndChangeEventListening() {
// is it necessary to call these? Aren't they called by the above eventhandlers?
doOnResize();
}

View File

@ -27,6 +27,7 @@ var $drawAreaContainer, $doodleCanvas, doodleCanvas, doodleCanvasContext, $previ
var showhideInterval;
var showOrHide = false;
var limitedFeatures = false;
var clientInfo = {};
@ -41,6 +42,7 @@ $(function() {
if (getURLParameter("c") != "null") communicateWithWifibox = (getURLParameter("c") == "1");
if (getURLParameter("r") != "null") wifiboxIsRemote = (getURLParameter("r") == "1");
if (getURLParameter("u") != "null") autoUpdate = (getURLParameter("u") == "1");
if (getURLParameter("l") != "null") limitedFeatures = (getURLParameter("l") == "1");
var hostname;
if (wifiboxIsRemote) hostname = 'http://192.168.5.1';
@ -107,37 +109,11 @@ $(function() {
$("body").css("overflow", "auto");
$("#debug_textArea").css("display", "block");
//$("#preview_tmp").css("display", "block");
$("#debug_display").css("display", "block");
}
// show and hide the progressguage and thermometer
//showhideInterval = setInterval(showOrHideThermo, 2500);
// $("#debugContainer").css("display", "block");
/* TEMP CODE!! -> artificially populates the startgcode and endgcode textareas in the settings window */
// todo remove this temporary code...
/*
setTimeout(function() {
$("#startgcode").text("");
$("#startgcode").append("G21 (mm) \n");
$("#startgcode").append("G91 (relative) \n");
$("#startgcode").append("G28 X0 Y0 Z0 (physical home) \n");
$("#startgcode").append("M104 S230 (temperature) \n");
$("#startgcode").append("G1 E10 F250 (flow) \n");
$("#startgcode").append("G92 X-100 Y-100 Z0 E10 \n");
$("#startgcode").append("G1 Z3 F5000 (prevent diagonal line) \n");
$("#startgcode").append("G90 (absolute) \n");
$("#startgcode").append("M106 (fan on)");
console.log("$('#startgcode'): " + $("#startgcode").val());
$("#endgcode").text("");
$("#endgcode").append("G1 X-100 Y-100 F15000 (fast homing) \n");
$("#endgcode").append("M107 \n");
$("#endgcode").append("M84 (disable axes) \n");
console.log("$('#endgcode'): " + $("#endgcode").val());
}, 1000);
//*/
if (limitedFeatures) {
initLimitedInterface();
}
});
@ -182,4 +158,5 @@ function settingsLoaded() {
function setDebugText(text) {
$("#debug_display").text(text);
}

View File

@ -8,9 +8,10 @@
var curSketch = 0;
var sketches = []; //contains fileIDs
var sketchLoaded = false;
function previousSketch(e) {
loadSketch(curSketch-1);
loadSketch(curSketch-1);
}
function nextSketch(e) {
@ -80,6 +81,7 @@ function loadSketch(_curSketch) {
var svgData = response.data.data;
loadFromSvg(svgData);
setSketchModified(false);
sketchLoaded = true;
} else {
console.log('error loading sketch: ',response);
listSketches();

View File

@ -5,7 +5,7 @@
margin-left: -@center-panel-width/2;
width: @center-panel-width;
height: 100%;
padding-top: 1%;
padding-top: 3%;
}
#logopanel {
@ -32,12 +32,13 @@
#drawareacontainer {
position: relative;
width: 100%;
height: 79%;
// height: 79%;
height: 65%;
background-color: #fff;
border: 3px solid black;
border-radius: 15px;
box-sizing: border-box;
margin-top: 1%;
margin-top: 3%;
}
#canvasContainers {

View File

@ -29,6 +29,15 @@
float: right;
}
#btnSave.fake-print-button {
position: absolute;
top: 10px;
left: 880px;
width: 125px;
max-width: 125px;
z-index: 100;
}
#btnStop {
margin: 5% 5% 1% 5%;
float: right;
@ -55,7 +64,7 @@
}
#btnNew {
margin: 5% 0% 1% 5%;
margin: 25% 0% 1% 5%;
width: 90%;
max-width: 130px;
height: auto;

View File

@ -14,7 +14,7 @@
<link href="css/styles.min.css" rel="stylesheet" media="screen">
<link href="css/debug.min.css" rel="stylesheet" media="screen">
</head>
<body>
<div id="landscape" class="clearfix">