Commit 30ae6e47 authored by carlosperate's avatar carlosperate

Change variables naming convention in arduino app to comply to Google's js coding style.

Changed from current 'snake_case' to 'lower camel case'.
parent 8c6adf0f
...@@ -25,13 +25,13 @@ There was an error manipulating the sketch data!! ...@@ -25,13 +25,13 @@ There was an error manipulating the sketch data!!
- [ ] Combine Arduino boards from code generator with Arduino boards offered for compilation - [ ] Combine Arduino boards from code generator with Arduino boards offered for compilation
## Static typing ## Static typing
- [x] Warnings for setting variables to a different type than first instance
- [x] Type finding for the get variable block
- [ ] math_number block 'errornumber' type
- [ ] remove getVarType types that are use for debugging
- [ ] math_arithmetic getType to check types of given inputs to decide between int or float
- [ ] math_number getType to use regular expressions more efficiently
- [ ] logic_ternary block getType to defines type as that of its inputs - [ ] logic_ternary block getType to defines type as that of its inputs
- [ ] logic_null block right now does not return a type, this might change
- [ ] math_number block 'errornumber' type used for debugging, remove
- [ ] math_arithmetic getType to check types of given inputs to decide between int or float . Right now first block within sets the type.
- [ ] math_constrain getType to check types of given inputs to decide between int or float . Right now first block within sets the type.
- [ ] math_number getType to use regular expressions more efficiently
- [ ] math_on_list to add static type if lists get implemented
- [ ] controls_for getVarType function - [ ] controls_for getVarType function
- [ ] controls_forEach block uses lists, these are not implemented in the Arduino generator (possible arrays), when implemented this block needs a getVarType, varType, and getType functions. - [ ] controls_forEach block uses lists, these are not implemented in the Arduino generator (possible arrays), when implemented this block needs a getVarType, varType, and getType functions.
- [ ] add getVarType to the procedures blocks - [ ] add getVarType to the procedures blocks
...@@ -43,6 +43,7 @@ There was an error manipulating the sketch data!! ...@@ -43,6 +43,7 @@ There was an error manipulating the sketch data!!
- [ ] Add a way to select different Arduino boards (settings menu should trigger arduino generator board change) - [ ] Add a way to select different Arduino boards (settings menu should trigger arduino generator board change)
- [ ] Code generator for lists into arrays. - [ ] Code generator for lists into arrays.
- [ ] A lot of blocks go through the entire block tree, which end ups being terribly inefficient. Maybe create a general pass through in the arduino.js file to check everything that needs to be checked in one pass. - [ ] A lot of blocks go through the entire block tree, which end ups being terribly inefficient. Maybe create a general pass through in the arduino.js file to check everything that needs to be checked in one pass.
- [ ] SPI spi_transfer also needs returns a byte back
## Arduino web-app ## Arduino web-app
- [ ] Edit toolbox fade out + visibility button fade in with a CSS animated change in height with overflow hidden. - [ ] Edit toolbox fade out + visibility button fade in with a CSS animated change in height with overflow hidden.
......
...@@ -156,17 +156,17 @@ ArduinoMaterial.loadUserXmlFile = function() { ...@@ -156,17 +156,17 @@ ArduinoMaterial.loadUserXmlFile = function() {
reader.readAsText(files[0]); reader.readAsText(files[0]);
} }
// Create once invisible browse button with event listener, and click it // Create once invisible browse button with event listener, and click it
var select_file = document.getElementById("select_file"); var selectFile = document.getElementById("select_file");
if (select_file == null) { if (selectFile == null) {
var select_file_dom = document.createElement('INPUT'); var selectFileDom = document.createElement('INPUT');
select_file_dom.type = 'file'; selectFileDom.type = 'file';
select_file_dom.id = 'select_file'; selectFileDom.id = 'select_file';
select_file_dom.style = 'display: none'; selectFileDom.style = 'display: none';
document.body.appendChild(select_file_dom); document.body.appendChild(select_file_dom);
select_file = document.getElementById("select_file"); selectFile = document.getElementById("select_file");
select_file.addEventListener('change', parseInputXMLfile, false); selectFile.addEventListener('change', parseInputXMLfile, false);
} }
select_file.click(); selectFile.click();
}; };
/** /**
...@@ -205,14 +205,14 @@ ArduinoMaterial.populateSettings = function() { ...@@ -205,14 +205,14 @@ ArduinoMaterial.populateSettings = function() {
/** /**
* Sets the compiler location form data retrieve from an updated element. * Sets the compiler location form data retrieve from an updated element.
* @param {element} new_el New HTML element to replace the one in the current * @param {element} newEl New HTML element to replace the one in the current
* DOM. Should contain a complete input text element. * DOM. Should contain a complete input text element.
*/ */
ArduinoMaterial.setCompilerLocationHtml = function(new_el) { ArduinoMaterial.setCompilerLocationHtml = function(newEl) {
if (new_el != null) { if (newEl != null) {
var comp_loc_ip = document.getElementById('settings_compiler_location') var compLocIp = document.getElementById('settings_compiler_location')
if (comp_loc_ip != null) { if (compLocIp != null) {
comp_loc_ip.value = new_el.value; compLocIp.value = newEl.value;
} }
} else { } else {
// If the element is Null, then Ardublockly server is not running // If the element is Null, then Ardublockly server is not running
...@@ -222,14 +222,14 @@ ArduinoMaterial.setCompilerLocationHtml = function(new_el) { ...@@ -222,14 +222,14 @@ ArduinoMaterial.setCompilerLocationHtml = function(new_el) {
/** /**
* Sets the sketch location form data retrieve from an updated element. * Sets the sketch location form data retrieve from an updated element.
* @param {element} new_el New HTML element to replace the one in the current * @param {element} newEl New HTML element to replace the one in the current
* DOM. Should contain a complete input text element. * DOM. Should contain a complete input text element.
*/ */
ArduinoMaterial.setSketchLocationHtml = function(new_el) { ArduinoMaterial.setSketchLocationHtml = function(newEl) {
if (new_el != null) { if (newEl != null) {
var sketch_loc_ip = document.getElementById('settings_sketch_location'); var sketchLocIp = document.getElementById('settings_sketch_location');
if (sketch_loc_ip != null) { if (sketchLocIp != null) {
sketch_loc_ip.value = new_el.value; sketchLocIp.value = newEl.value;
} }
} else { } else {
// If the element is Null, then Ardublockly server is not running // If the element is Null, then Ardublockly server is not running
...@@ -240,16 +240,16 @@ ArduinoMaterial.setSketchLocationHtml = function(new_el) { ...@@ -240,16 +240,16 @@ ArduinoMaterial.setSketchLocationHtml = function(new_el) {
/** /**
* Replaces the Arduino Boards form data with a new HTMl element. * Replaces the Arduino Boards form data with a new HTMl element.
* Ensures there is a change listener to call 'setSerialPort' function * Ensures there is a change listener to call 'setSerialPort' function
* @param {element} new_el New HTML element to replace the one in the current * @param {element} newEl New HTML element to replace the one in the current
* DOM. Should contain a complete select element. * DOM. Should contain a complete select element.
*/ */
ArduinoMaterial.setArduinoBoardsHtml = function(new_el) { ArduinoMaterial.setArduinoBoardsHtml = function(newEl) {
if (new_el != null) { if (newEl != null) {
var board_dropdown = document.getElementById('board'); var boardDropdown = document.getElementById('board');
if (board_dropdown != null) { if (boardDropdown != null) {
new_el.id = 'board'; newEl.id = 'board';
new_el.onchange = ArduinoMaterial.setBoard; newEl.onchange = ArduinoMaterial.setBoard;
board_dropdown.parentNode.replaceChild(new_el, board_dropdown); boardDropdown.parentNode.replaceChild(newEl, boardDropdown);
// Refresh the materialize select menus // Refresh the materialize select menus
// TODO: Currently a reported bug from Materialize // TODO: Currently a reported bug from Materialize
$('select').material_select(); $('select').material_select();
...@@ -265,25 +265,25 @@ ArduinoMaterial.setArduinoBoardsHtml = function(new_el) { ...@@ -265,25 +265,25 @@ ArduinoMaterial.setArduinoBoardsHtml = function(new_el) {
*/ */
ArduinoMaterial.setBoard = function() { ArduinoMaterial.setBoard = function() {
var el = document.getElementById("board"); var el = document.getElementById("board");
var board_value = el.options[el.selectedIndex].value; var boardValue = el.options[el.selectedIndex].value;
//TODO: check how ArduServerCompiler deals with invalid data and sanitise //TODO: check how ArduServerCompiler deals with invalid data and sanitise
ArduServerCompiler.setArduinoBoard( ArduServerCompiler.setArduinoBoard(
board_value, ArduinoMaterial.setArduinoBoardsHtml); boardValue, ArduinoMaterial.setArduinoBoardsHtml);
}; };
/** /**
* Replaces the Serial Port form data with a new HTMl element. * Replaces the Serial Port form data with a new HTMl element.
* Ensures there is a change listener to call 'setSerialPort' function * Ensures there is a change listener to call 'setSerialPort' function
* @param {element} new_el New HTML element to replace the one in the current * @param {element} newEl New HTML element to replace the one in the current
* DOM. Should contain a complete select element. * DOM. Should contain a complete select element.
*/ */
ArduinoMaterial.setSerialPortsHtml = function(new_el) { ArduinoMaterial.setSerialPortsHtml = function(newEl) {
if (new_el != null) { if (newEl != null) {
var serial_dropdown = document.getElementById('serial_port'); var serialDropdown = document.getElementById('serial_port');
if (serial_dropdown != null) { if (serialDropdown != null) {
new_el.id = 'serial_port'; newEl.id = 'serial_port';
new_el.onchange = ArduinoMaterial.setSerial; newEl.onchange = ArduinoMaterial.setSerial;
serial_dropdown.parentNode.replaceChild(new_el, serial_dropdown); serialDropdown.parentNode.replaceChild(newEl, serialDropdown);
// Refresh the materialize select menus // Refresh the materialize select menus
// TODO: Currently a reported bug from Materialize // TODO: Currently a reported bug from Materialize
$('select').material_select(); $('select').material_select();
...@@ -299,25 +299,25 @@ ArduinoMaterial.setSerialPortsHtml = function(new_el) { ...@@ -299,25 +299,25 @@ ArduinoMaterial.setSerialPortsHtml = function(new_el) {
*/ */
ArduinoMaterial.setSerial = function() { ArduinoMaterial.setSerial = function() {
var el = document.getElementById("serial_port"); var el = document.getElementById("serial_port");
var serial_value = el.options[el.selectedIndex].value; var serialValue = el.options[el.selectedIndex].value;
//TODO: check how ArduServerCompiler deals with invalid data and sanitise //TODO: check how ArduServerCompiler deals with invalid data and sanitise
ArduServerCompiler.setSerialPort( ArduServerCompiler.setSerialPort(
serial_value, ArduinoMaterial.setSerialPortsHtml); serialValue, ArduinoMaterial.setSerialPortsHtml);
}; };
/** /**
* Replaces IDE options form data with a new HTMl element. * Replaces IDE options form data with a new HTMl element.
* Ensures there is a change listener to call 'setIdeSettings' function * Ensures there is a change listener to call 'setIdeSettings' function
* @param {element} new_el New HTML element to replace the one in the current * @param {element} newEl New HTML element to replace the one in the current
* DOM. Should contain a complete select element. * DOM. Should contain a complete select element.
*/ */
ArduinoMaterial.setIdeHtml = function(new_el) { ArduinoMaterial.setIdeHtml = function(newEl) {
if (new_el != null) { if (newEl != null) {
var ide_dropdown = document.getElementById('ide_settings'); var ideDropdown = document.getElementById('ide_settings');
if (ide_dropdown != null) { if (ideDropdown != null) {
new_el.id = 'ide_settings'; newEl.id = 'ide_settings';
new_el.onchange = ArduinoMaterial.setIdeSettings; newEl.onchange = ArduinoMaterial.setIdeSettings;
ide_dropdown.parentNode.replaceChild(new_el, ide_dropdown); ideDropdown.parentNode.replaceChild(newEl, ideDropdown);
// Refresh the materialize select menus // Refresh the materialize select menus
// TODO: Currently a reported bug from Materialize // TODO: Currently a reported bug from Materialize
$('select').material_select(); $('select').material_select();
...@@ -333,9 +333,9 @@ ArduinoMaterial.setIdeHtml = function(new_el) { ...@@ -333,9 +333,9 @@ ArduinoMaterial.setIdeHtml = function(new_el) {
*/ */
ArduinoMaterial.setIdeSettings = function() { ArduinoMaterial.setIdeSettings = function() {
var el = document.getElementById("ide_settings"); var el = document.getElementById("ide_settings");
var ide_value = el.options[el.selectedIndex].value; var ideValue = el.options[el.selectedIndex].value;
//TODO: check how ArduServerCompiler deals with invalid data and sanitise here //TODO: check how ArduServerCompiler deals with invalid data and sanitise here
ArduServerCompiler.setIdeOptions(ide_value, ArduinoMaterial.setIdeHtml); ArduServerCompiler.setIdeOptions(ideValue, ArduinoMaterial.setIdeHtml);
}; };
/** /**
...@@ -352,13 +352,13 @@ ArduinoMaterial.sendCode = function() { ...@@ -352,13 +352,13 @@ ArduinoMaterial.sendCode = function() {
/** /**
* Receives the IDE data back to be displayed and stops spinner. * Receives the IDE data back to be displayed and stops spinner.
* @param {element} new_el New HTML element to replace the one in the current * @param {element} dataBack New HTML elements to include in the modal to
* DOM. Should contain a complete select element. * display the data back from the compiler.
*/ */
ArduinoMaterial.sendCodeReturn = function(data_back) { ArduinoMaterial.sendCodeReturn = function(dataBack) {
ArduinoMaterial.runButtonSpinner(false); ArduinoMaterial.runButtonSpinner(false);
if (data_back != null) { if (dataBack != null) {
ArduinoMaterial.arduinoIdeModal(data_back); ArduinoMaterial.arduinoIdeModal(dataBack);
} else { } else {
// If the element is Null, then Ardublockly server is not running // If the element is Null, then Ardublockly server is not running
$('#not_running_dialog').openModal(); $('#not_running_dialog').openModal();
...@@ -387,15 +387,15 @@ ArduinoMaterial.XmlTextareaToBlocks = function() { ...@@ -387,15 +387,15 @@ ArduinoMaterial.XmlTextareaToBlocks = function() {
*/ */
ArduinoMaterial.renderContent = function() { ArduinoMaterial.renderContent = function() {
// Render Arduino Code syntax highlighted into element // Render Arduino Code syntax highlighted into element
var arduino_content = document.getElementById('content_arduino'); var arduinoContent = document.getElementById('content_arduino');
arduino_content.textContent = ArduinoMaterial.generateArduino();; arduinoContent.textContent = ArduinoMaterial.generateArduino();;
if (typeof prettyPrintOne == 'function') { if (typeof prettyPrintOne == 'function') {
var code_html = prettyPrintOne(arduino_content.innerHTML, 'cpp'); var codeHtml = prettyPrintOne(arduinoContent.innerHTML, 'cpp');
arduino_content.innerHTML = code_html; arduinoContent.innerHTML = codeHtml;
} }
// Generate plain XML into element // Generate plain XML into element
var xml_content = document.getElementById('content_xml'); var xmlContent = document.getElementById('content_xml');
xml_content.value = ArduinoMaterial.generateXml(); xmlContent.value = ArduinoMaterial.generateXml();
}; };
/** /**
...@@ -403,13 +403,13 @@ ArduinoMaterial.renderContent = function() { ...@@ -403,13 +403,13 @@ ArduinoMaterial.renderContent = function() {
* @type {!boolean} * @type {!boolean}
* @private * @private
*/ */
ArduinoMaterial.toolbar_showing_ = true; ArduinoMaterial.TOOLBAR_SHOWING_ = true;
/** /**
* Toggles the toolbox and respective button On and Off * Toggles the toolbox and respective button On and Off
*/ */
ArduinoMaterial.toogleToolbox = function() { ArduinoMaterial.toogleToolbox = function() {
if (ArduinoMaterial.toolbar_showing_ == true ) { if (ArduinoMaterial.TOOLBAR_SHOWING_ == true ) {
// showToolbox() takes a callback function as its second argument // showToolbox() takes a callback function as its second argument
ArduinoMaterial.showToolbox(false, ArduinoMaterial.showToolbox(false,
function() { ArduinoMaterial.showToolboxButtonState(false); }); function() { ArduinoMaterial.showToolboxButtonState(false); });
...@@ -418,7 +418,7 @@ ArduinoMaterial.toogleToolbox = function() { ...@@ -418,7 +418,7 @@ ArduinoMaterial.toogleToolbox = function() {
ArduinoMaterial.showToolboxButtonState(true); ArduinoMaterial.showToolboxButtonState(true);
ArduinoMaterial.showToolbox(true); ArduinoMaterial.showToolbox(true);
} }
ArduinoMaterial.toolbar_showing_ = !ArduinoMaterial.toolbar_showing_; ArduinoMaterial.TOOLBAR_SHOWING_ = !ArduinoMaterial.TOOLBAR_SHOWING_;
}; };
/** /**
...@@ -426,7 +426,7 @@ ArduinoMaterial.toogleToolbox = function() { ...@@ -426,7 +426,7 @@ ArduinoMaterial.toogleToolbox = function() {
* @return {boolean} Indicates if the toolbox is currently visible. * @return {boolean} Indicates if the toolbox is currently visible.
*/ */
ArduinoMaterial.isToolboxVisible = function() { ArduinoMaterial.isToolboxVisible = function() {
return ArduinoMaterial.toolbar_showing_; return ArduinoMaterial.TOOLBAR_SHOWING_;
}; };
/** /**
......
...@@ -20,16 +20,16 @@ ArduinoMaterial.BLOCKLY_INJECTED = false; ...@@ -20,16 +20,16 @@ ArduinoMaterial.BLOCKLY_INJECTED = false;
/** /**
* Injects Blockly into a given HTML element. Reads the toolbox from an XMl * Injects Blockly into a given HTML element. Reads the toolbox from an XMl
* file. * file.
* @param {!Element} el Element to inject Blockly into. * @param {!Element} blocklyEl Element to inject Blockly into.
* @param {!string} toolbox_path String containing the toolbox XML file path. * @param {!string} toolboxPath String containing the toolbox XML file path.
*/ */
ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) { ArduinoMaterial.injectBlockly = function(blocklyEl, toolboxPath) {
// Create a an XML HTTP request // Create a an XML HTTP request
var request = ArduinoMaterial.ajaxRequest(); var request = ArduinoMaterial.ajaxRequest();
// If file run locally Internet explorer fails here // If file run locally Internet explorer fails here
try { try {
request.open("GET", toolbox_path, true); request.open("GET", toolboxPath, true);
} catch(e) { } catch(e) {
$('#not_running_dialog').openModal(); $('#not_running_dialog').openModal();
} }
...@@ -37,7 +37,7 @@ ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) { ...@@ -37,7 +37,7 @@ ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) {
// Once file is open, inject blockly into element with the toolbox string // Once file is open, inject blockly into element with the toolbox string
request.onreadystatechange = function() { request.onreadystatechange = function() {
if ( (request.readyState == 4) && (request.status == 200) ) { if ( (request.readyState == 4) && (request.status == 200) ) {
Blockly.inject(blockly_el, { Blockly.inject(blocklyEl, {
collapse: true, collapse: true,
comments: true, comments: true,
disable: true, disable: true,
...@@ -111,13 +111,13 @@ ArduinoMaterial.generateXml = function() { ...@@ -111,13 +111,13 @@ ArduinoMaterial.generateXml = function() {
/** /**
* Parses the XML from its input to generate and replace the blocks in the * Parses the XML from its input to generate and replace the blocks in the
* Blockly workspace. * Blockly workspace.
* @param {!string} blocks_xml String of XML code for the blocks. * @param {!string} blocksXml String of XML code for the blocks.
* @return {!boolean} Indicates if the XML into blocks parse was successful. * @return {!boolean} Indicates if the XML into blocks parse was successful.
*/ */
ArduinoMaterial.replaceBlocksfromXml = function(blocks_xml) { ArduinoMaterial.replaceBlocksfromXml = function(blocksXml) {
var xmlDom = null; var xmlDom = null;
try { try {
xmlDom = Blockly.Xml.textToDom(blocks_xml); xmlDom = Blockly.Xml.textToDom(blocksXml);
} catch (e) { } catch (e) {
return false; return false;
} }
...@@ -131,12 +131,12 @@ ArduinoMaterial.replaceBlocksfromXml = function(blocks_xml) { ...@@ -131,12 +131,12 @@ ArduinoMaterial.replaceBlocksfromXml = function(blocks_xml) {
/** /**
* Parses the XML from its input to generate and add blocks to the workspace. * Parses the XML from its input to generate and add blocks to the workspace.
* @param {!string} blocks_xml_dom String of XML DOM code for the blocks. * @param {!string} blocksXmlDom String of XML DOM code for the blocks.
* @return {!boolean} Indicates if the XML into blocks parse was successful. * @return {!boolean} Indicates if the XML into blocks parse was successful.
*/ */
ArduinoMaterial.loadBlocksfromXmlDom = function(blocks_xml_dom) { ArduinoMaterial.loadBlocksfromXmlDom = function(blocksXmlDom) {
try { try {
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, blocks_xml_dom); Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, blocksXmlDom);
} catch (e) { } catch (e) {
return false; return false;
} }
...@@ -165,14 +165,14 @@ ArduinoMaterial.showToolbox = function(show, callback) { ...@@ -165,14 +165,14 @@ ArduinoMaterial.showToolbox = function(show, callback) {
* Discard all blocks from the workspace. * Discard all blocks from the workspace.
*/ */
ArduinoMaterial.discard = function() { ArduinoMaterial.discard = function() {
var block_count = Blockly.mainWorkspace.getAllBlocks().length; var blockCount = Blockly.mainWorkspace.getAllBlocks().length;
if (block_count == 1) { if (blockCount == 1) {
Blockly.mainWorkspace.clear(); Blockly.mainWorkspace.clear();
ArduinoMaterial.renderContent(); ArduinoMaterial.renderContent();
} else if (block_count > 1) { } else if (blockCount > 1) {
ArduinoMaterial.materialAlert( ArduinoMaterial.materialAlert(
'Delete blocks?', 'Delete blocks?',
'There are ' + block_count + ' blocks on the workspace. Are you \ 'There are ' + blockCount + ' blocks on the workspace. Are you \
sure you want to delete them?', sure you want to delete them?',
true, true,
function() { function() {
......
...@@ -43,14 +43,14 @@ ArduinoMaterial.materializeJsInit = function() { ...@@ -43,14 +43,14 @@ ArduinoMaterial.materializeJsInit = function() {
*/ */
ArduinoMaterial.runButtonSpinner = function(active) { ArduinoMaterial.runButtonSpinner = function(active) {
var spinner = document.getElementById('button_run_spinner'); var spinner = document.getElementById('button_run_spinner');
var button_el = document.getElementById('button_run'); var buttonEl = document.getElementById('button_run');
var button_class = button_el.className; var buttonClass = buttonEl.className;
if (active) { if (active) {
spinner.style.display = 'block'; spinner.style.display = 'block';
button_el.className = button_class.replace('arduino_orange', 'grey'); buttonEl.className = buttonClass.replace('arduino_orange', 'grey');
} else { } else {
spinner.style.display = 'none'; spinner.style.display = 'none';
button_el.className = button_class.replace('grey', 'arduino_orange'); buttonEl.className = buttonClass.replace('grey', 'arduino_orange');
} }
}; };
...@@ -58,11 +58,11 @@ ArduinoMaterial.runButtonSpinner = function(active) { ...@@ -58,11 +58,11 @@ ArduinoMaterial.runButtonSpinner = function(active) {
* Displays or hides the 'load textarea xml' button. * Displays or hides the 'load textarea xml' button.
*/ */
ArduinoMaterial.buttonLoadXmlCodeDisplay = function() { ArduinoMaterial.buttonLoadXmlCodeDisplay = function() {
var xml_button = document.getElementById('button_load_xml'); //var xmlButton = document.getElementById('button_load_xml');
var xml_button_body = document.getElementById('xml_collapsible_body'); var xmlButtonBody = document.getElementById('xml_collapsible_body');
// Waiting to check status due to the animation delay // Waiting to check status due to the animation delay
setTimeout(function() { setTimeout(function() {
if (xml_button_body.style.display == 'none') { if (xmlButtonBody.style.display == 'none') {
$('#button_load_xml').hide(); $('#button_load_xml').hide();
} else { } else {
$('#button_load_xml').fadeIn('slow'); $('#button_load_xml').fadeIn('slow');
...@@ -72,21 +72,21 @@ ArduinoMaterial.buttonLoadXmlCodeDisplay = function() { ...@@ -72,21 +72,21 @@ ArduinoMaterial.buttonLoadXmlCodeDisplay = function() {
/** /**
* Sets the class and content of the toolbox On and Off button. * Sets the class and content of the toolbox On and Off button.
* @param {!boolean} toolbox_visible Indicates if the toolbox visibility. * @param {!boolean} toolboxVisible Indicates if the toolbox visibility.
*/ */
ArduinoMaterial.showToolboxButtonState = function(toolbox_visible) { ArduinoMaterial.showToolboxButtonState = function(toolboxVisible) {
var toolbox_button = document.getElementById('button_toggle_toolbox'); var toolboxButton = document.getElementById('button_toggle_toolbox');
var toolbox_button_icon = document.getElementById('button_toggle_toolbox_icon'); var toolboxButtonIcon = document.getElementById('button_toggle_toolbox_icon');
// Element conatins several classes, use replace to maintain the rest // Element conatins several classes, use replace to maintain the rest
if (toolbox_visible == true) { if (toolboxVisible == true) {
toolbox_button.className = toolbox_button.className.replace( toolboxButton.className = toolboxButton.className.replace(
"button_toggle_toolbox_on", "button_toggle_toolbox_off"); "button_toggle_toolbox_on", "button_toggle_toolbox_off");
toolbox_button_icon.className = toolbox_button_icon.className.replace( toolboxButtonIcon.className = toolboxButtonIcon.className.replace(
'mdi-action-visibility', 'mdi-action-visibility-off'); 'mdi-action-visibility', 'mdi-action-visibility-off');
} else { } else {
toolbox_button.className = toolbox_button.className.replace( toolboxButton.className = toolboxButton.className.replace(
"button_toggle_toolbox_off", "button_toggle_toolbox_on"); "button_toggle_toolbox_off", "button_toggle_toolbox_on");
toolbox_button_icon.className = toolbox_button_icon.className.replace( toolboxButtonIcon.className = toolboxButtonIcon.className.replace(
'mdi-action-visibility-off', 'mdi-action-visibility'); 'mdi-action-visibility-off', 'mdi-action-visibility');
} }
}; };
...@@ -95,25 +95,25 @@ ArduinoMaterial.showToolboxButtonState = function(toolbox_visible) { ...@@ -95,25 +95,25 @@ ArduinoMaterial.showToolboxButtonState = function(toolbox_visible) {
* Resizes the container for Blockly and forces a re-render of the SVG. * Resizes the container for Blockly and forces a re-render of the SVG.
*/ */
ArduinoMaterial.resizeBlocklyWorkspace = function() { ArduinoMaterial.resizeBlocklyWorkspace = function() {
var content_blocks = document.getElementById('content_blocks'); var contentBlocks = document.getElementById('content_blocks');
var wrapper_panel_size = var wrapperPanelSize =
ArduinoMaterial.getBBox_(document.getElementById('blocks_panel')); ArduinoMaterial.getBBox_(document.getElementById('blocks_panel'));
content_blocks.style.top = wrapper_panel_size.y + 'px'; contentBlocks.style.top = wrapperPanelSize.y + 'px';
content_blocks.style.left = wrapper_panel_size.x + 'px'; contentBlocks.style.left = wrapperPanelSize.x + 'px';
// Height and width need to be set, read back, then set again to // Height and width need to be set, read back, then set again to
// compensate for scrollbars. // compensate for scrollbars.
content_blocks.style.height = wrapper_panel_size.height + 'px'; contentBlocks.style.height = wrapperPanelSize.height + 'px';
content_blocks.style.height = contentBlocks.style.height =
(2 * wrapper_panel_size.height - content_blocks.offsetHeight) + 'px'; (2 * wrapperPanelSize.height - contentBlocks.offsetHeight) + 'px';
content_blocks.style.width = wrapper_panel_size.width + 'px'; contentBlocks.style.width = wrapperPanelSize.width + 'px';
content_blocks.style.width = contentBlocks.style.width =
(2 * wrapper_panel_size.width - content_blocks.offsetWidth) + 'px'; (2 * wrapperPanelSize.width - contentBlocks.offsetWidth) + 'px';
//Blockly.MsvgResize(); //Blockly.MsvgResize();
//Blockly.mainWorkspace.render(); //Blockly.mainWorkspace.render();
//alert( //alert(
// "resized " + wrapper_panel_size.width + " " + content_blocks.style.width); // "resized " + wrapperPanelSize.width + " " + contentBlocks.style.width);
// Sets the toolbox toggle button width to that of the toolbox // Sets the toolbox toggle button width to that of the toolbox
if ( ArduinoMaterial.isToolboxVisible() && if ( ArduinoMaterial.isToolboxVisible() &&
...@@ -152,11 +152,11 @@ ArduinoMaterial.materialAlert = function(title, body, confirm, callback) { ...@@ -152,11 +152,11 @@ ArduinoMaterial.materialAlert = function(title, body, confirm, callback) {
/** /**
* Populates the Arduino output data modal and opens it. * Populates the Arduino output data modal and opens it.
* @param {!element} body_el HTML to include into dialog content. * @param {!element} bodyEl HTML to include into dialog content.
*/ */
ArduinoMaterial.arduinoIdeModal = function(body_el) { ArduinoMaterial.arduinoIdeModal = function(bodyEl) {
$("#arduino_dialog_body").text(''); $("#arduino_dialog_body").text('');
$("#arduino_dialog_body").append(body_el); $("#arduino_dialog_body").append(bodyEl);
$('#arduino_dialog').openModal(); $('#arduino_dialog').openModal();
window.location.hash = ''; window.location.hash = '';
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment