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.
......
This diff is collapsed.
...@@ -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