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!!
- [ ] Combine Arduino boards from code generator with Arduino boards offered for compilation
## 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_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_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
......@@ -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)
- [ ] 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.
- [ ] SPI spi_transfer also needs returns a byte back
## Arduino web-app
- [ ] 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;
/**
* Injects Blockly into a given HTML element. Reads the toolbox from an XMl
* file.
* @param {!Element} el Element to inject Blockly into.
* @param {!string} toolbox_path String containing the toolbox XML file path.
* @param {!Element} blocklyEl Element to inject Blockly into.
* @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
var request = ArduinoMaterial.ajaxRequest();
// If file run locally Internet explorer fails here
try {
request.open("GET", toolbox_path, true);
request.open("GET", toolboxPath, true);
} catch(e) {
$('#not_running_dialog').openModal();
}
......@@ -37,7 +37,7 @@ ArduinoMaterial.injectBlockly = function(blockly_el, toolbox_path) {
// Once file is open, inject blockly into element with the toolbox string
request.onreadystatechange = function() {
if ( (request.readyState == 4) && (request.status == 200) ) {
Blockly.inject(blockly_el, {
Blockly.inject(blocklyEl, {
collapse: true,
comments: true,
disable: true,
......@@ -111,13 +111,13 @@ ArduinoMaterial.generateXml = function() {
/**
* Parses the XML from its input to generate and replace the blocks in the
* 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.
*/
ArduinoMaterial.replaceBlocksfromXml = function(blocks_xml) {
ArduinoMaterial.replaceBlocksfromXml = function(blocksXml) {
var xmlDom = null;
try {
xmlDom = Blockly.Xml.textToDom(blocks_xml);
xmlDom = Blockly.Xml.textToDom(blocksXml);
} catch (e) {
return false;
}
......@@ -131,12 +131,12 @@ ArduinoMaterial.replaceBlocksfromXml = function(blocks_xml) {
/**
* 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.
*/
ArduinoMaterial.loadBlocksfromXmlDom = function(blocks_xml_dom) {
ArduinoMaterial.loadBlocksfromXmlDom = function(blocksXmlDom) {
try {
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, blocks_xml_dom);
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, blocksXmlDom);
} catch (e) {
return false;
}
......@@ -165,14 +165,14 @@ ArduinoMaterial.showToolbox = function(show, callback) {
* Discard all blocks from the workspace.
*/
ArduinoMaterial.discard = function() {
var block_count = Blockly.mainWorkspace.getAllBlocks().length;
if (block_count == 1) {
var blockCount = Blockly.mainWorkspace.getAllBlocks().length;
if (blockCount == 1) {
Blockly.mainWorkspace.clear();
ArduinoMaterial.renderContent();
} else if (block_count > 1) {
} else if (blockCount > 1) {
ArduinoMaterial.materialAlert(
'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?',
true,
function() {
......
......@@ -43,14 +43,14 @@ ArduinoMaterial.materializeJsInit = function() {
*/
ArduinoMaterial.runButtonSpinner = function(active) {
var spinner = document.getElementById('button_run_spinner');
var button_el = document.getElementById('button_run');
var button_class = button_el.className;
var buttonEl = document.getElementById('button_run');
var buttonClass = buttonEl.className;
if (active) {
spinner.style.display = 'block';
button_el.className = button_class.replace('arduino_orange', 'grey');
buttonEl.className = buttonClass.replace('arduino_orange', 'grey');
} else {
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) {
* Displays or hides the 'load textarea xml' button.
*/
ArduinoMaterial.buttonLoadXmlCodeDisplay = function() {
var xml_button = document.getElementById('button_load_xml');
var xml_button_body = document.getElementById('xml_collapsible_body');
//var xmlButton = document.getElementById('button_load_xml');
var xmlButtonBody = document.getElementById('xml_collapsible_body');
// Waiting to check status due to the animation delay
setTimeout(function() {
if (xml_button_body.style.display == 'none') {
if (xmlButtonBody.style.display == 'none') {
$('#button_load_xml').hide();
} else {
$('#button_load_xml').fadeIn('slow');
......@@ -72,21 +72,21 @@ ArduinoMaterial.buttonLoadXmlCodeDisplay = function() {
/**
* 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) {
var toolbox_button = document.getElementById('button_toggle_toolbox');
var toolbox_button_icon = document.getElementById('button_toggle_toolbox_icon');
ArduinoMaterial.showToolboxButtonState = function(toolboxVisible) {
var toolboxButton = document.getElementById('button_toggle_toolbox');
var toolboxButtonIcon = document.getElementById('button_toggle_toolbox_icon');
// Element conatins several classes, use replace to maintain the rest
if (toolbox_visible == true) {
toolbox_button.className = toolbox_button.className.replace(
if (toolboxVisible == true) {
toolboxButton.className = toolboxButton.className.replace(
"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');
} else {
toolbox_button.className = toolbox_button.className.replace(
toolboxButton.className = toolboxButton.className.replace(
"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');
}
};
......@@ -95,25 +95,25 @@ ArduinoMaterial.showToolboxButtonState = function(toolbox_visible) {
* Resizes the container for Blockly and forces a re-render of the SVG.
*/
ArduinoMaterial.resizeBlocklyWorkspace = function() {
var content_blocks = document.getElementById('content_blocks');
var wrapper_panel_size =
var contentBlocks = document.getElementById('content_blocks');
var wrapperPanelSize =
ArduinoMaterial.getBBox_(document.getElementById('blocks_panel'));
content_blocks.style.top = wrapper_panel_size.y + 'px';
content_blocks.style.left = wrapper_panel_size.x + 'px';
contentBlocks.style.top = wrapperPanelSize.y + 'px';
contentBlocks.style.left = wrapperPanelSize.x + 'px';
// Height and width need to be set, read back, then set again to
// compensate for scrollbars.
content_blocks.style.height = wrapper_panel_size.height + 'px';
content_blocks.style.height =
(2 * wrapper_panel_size.height - content_blocks.offsetHeight) + 'px';
content_blocks.style.width = wrapper_panel_size.width + 'px';
content_blocks.style.width =
(2 * wrapper_panel_size.width - content_blocks.offsetWidth) + 'px';
contentBlocks.style.height = wrapperPanelSize.height + 'px';
contentBlocks.style.height =
(2 * wrapperPanelSize.height - contentBlocks.offsetHeight) + 'px';
contentBlocks.style.width = wrapperPanelSize.width + 'px';
contentBlocks.style.width =
(2 * wrapperPanelSize.width - contentBlocks.offsetWidth) + 'px';
//Blockly.MsvgResize();
//Blockly.mainWorkspace.render();
//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
if ( ArduinoMaterial.isToolboxVisible() &&
......@@ -152,11 +152,11 @@ ArduinoMaterial.materialAlert = function(title, body, confirm, callback) {
/**
* 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").append(body_el);
$("#arduino_dialog_body").append(bodyEl);
$('#arduino_dialog').openModal();
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