Manual commit

This commit is contained in:
ellen.spertus
2013-12-20 16:25:26 -08:00
parent 7e1b5612ae
commit ea211c5080
466 changed files with 6463 additions and 3458 deletions

View File

@@ -34,7 +34,7 @@ Blockly.Blocks['colour_picker'] = {
this.setHelpUrl(Blockly.Msg.COLOUR_PICKER_HELPURL);
this.setColour(20);
this.appendDummyInput()
.appendTitle(new Blockly.FieldColour('#ff0000'), 'COLOUR');
.appendField(new Blockly.FieldColour('#ff0000'), 'COLOUR');
this.setOutput(true, 'Colour');
this.setTooltip(Blockly.Msg.COLOUR_PICKER_TOOLTIP);
}
@@ -46,7 +46,7 @@ Blockly.Blocks['colour_random'] = {
this.setHelpUrl(Blockly.Msg.COLOUR_RANDOM_HELPURL);
this.setColour(20);
this.appendDummyInput()
.appendTitle(Blockly.Msg.COLOUR_RANDOM_TITLE);
.appendField(Blockly.Msg.COLOUR_RANDOM_TITLE);
this.setOutput(true, 'Colour');
this.setTooltip(Blockly.Msg.COLOUR_RANDOM_TOOLTIP);
}
@@ -60,16 +60,16 @@ Blockly.Blocks['colour_rgb'] = {
this.appendValueInput('RED')
.setCheck('Number')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.COLOUR_RGB_TITLE)
.appendTitle(Blockly.Msg.COLOUR_RGB_RED);
.appendField(Blockly.Msg.COLOUR_RGB_TITLE)
.appendField(Blockly.Msg.COLOUR_RGB_RED);
this.appendValueInput('GREEN')
.setCheck('Number')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.COLOUR_RGB_GREEN);
.appendField(Blockly.Msg.COLOUR_RGB_GREEN);
this.appendValueInput('BLUE')
.setCheck('Number')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.COLOUR_RGB_BLUE);
.appendField(Blockly.Msg.COLOUR_RGB_BLUE);
this.setOutput(true, 'Colour');
this.setTooltip(Blockly.Msg.COLOUR_RGB_TOOLTIP);
}
@@ -83,16 +83,16 @@ Blockly.Blocks['colour_blend'] = {
this.appendValueInput('COLOUR1')
.setCheck('Colour')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.COLOUR_BLEND_TITLE)
.appendTitle(Blockly.Msg.COLOUR_BLEND_COLOUR1);
.appendField(Blockly.Msg.COLOUR_BLEND_TITLE)
.appendField(Blockly.Msg.COLOUR_BLEND_COLOUR1);
this.appendValueInput('COLOUR2')
.setCheck('Colour')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.COLOUR_BLEND_COLOUR2);
.appendField(Blockly.Msg.COLOUR_BLEND_COLOUR2);
this.appendValueInput('RATIO')
.setCheck('Number')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.COLOUR_BLEND_RATIO);
.appendField(Blockly.Msg.COLOUR_BLEND_RATIO);
this.setOutput(true, 'Colour');
this.setTooltip(Blockly.Msg.COLOUR_BLEND_TOOLTIP);
}

View File

@@ -35,7 +35,7 @@ Blockly.Blocks['lists_create_empty'] = {
this.setColour(260);
this.setOutput(true, 'Array');
this.appendDummyInput()
.appendTitle(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
.appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
this.setTooltip(Blockly.Msg.LISTS_CREATE_EMPTY_TOOLTIP);
}
};
@@ -45,7 +45,7 @@ Blockly.Blocks['lists_create_with'] = {
init: function() {
this.setColour(260);
this.appendValueInput('ADD0')
.appendTitle(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
this.appendValueInput('ADD1');
this.appendValueInput('ADD2');
this.setOutput(true, 'Array');
@@ -66,12 +66,12 @@ Blockly.Blocks['lists_create_with'] = {
for (var x = 0; x < this.itemCount_; x++) {
var input = this.appendValueInput('ADD' + x);
if (x == 0) {
input.appendTitle(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
input.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
}
}
if (this.itemCount_ == 0) {
this.appendDummyInput('EMPTY')
.appendTitle(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
.appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
}
},
decompose: function(workspace) {
@@ -102,7 +102,7 @@ Blockly.Blocks['lists_create_with'] = {
while (itemBlock) {
var input = this.appendValueInput('ADD' + this.itemCount_);
if (this.itemCount_ == 0) {
input.appendTitle(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
input.appendField(Blockly.Msg.LISTS_CREATE_WITH_INPUT_WITH);
}
// Reconnect any child blocks.
if (itemBlock.valueConnection_) {
@@ -114,7 +114,7 @@ Blockly.Blocks['lists_create_with'] = {
}
if (this.itemCount_ == 0) {
this.appendDummyInput('EMPTY')
.appendTitle(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
.appendField(Blockly.Msg.LISTS_CREATE_EMPTY_TITLE);
}
},
saveConnections: function(containerBlock) {
@@ -136,7 +136,7 @@ Blockly.Blocks['lists_create_with_container'] = {
init: function() {
this.setColour(260);
this.appendDummyInput()
.appendTitle(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);
.appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);
this.appendStatementInput('STACK');
this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);
this.contextMenu = false;
@@ -148,7 +148,7 @@ Blockly.Blocks['lists_create_with_item'] = {
init: function() {
this.setColour(260);
this.appendDummyInput()
.appendTitle(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);
.appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);
@@ -208,9 +208,9 @@ Blockly.Blocks['lists_indexOf'] = {
this.setOutput(true, 'Number');
this.appendValueInput('VALUE')
.setCheck('Array')
.appendTitle(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);
.appendField(Blockly.Msg.LISTS_INDEX_OF_INPUT_IN_LIST);
this.appendValueInput('FIND')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'END');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'END');
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.LISTS_INDEX_OF_TOOLTIP);
}
@@ -237,14 +237,14 @@ Blockly.Blocks['lists_getIndex'] = {
});
this.appendValueInput('VALUE')
.setCheck('Array')
.appendTitle(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);
.appendField(Blockly.Msg.LISTS_GET_INDEX_INPUT_IN_LIST);
this.appendDummyInput()
.appendTitle(modeMenu, 'MODE')
.appendTitle('', 'SPACE');
.appendField(modeMenu, 'MODE')
.appendField('', 'SPACE');
this.appendDummyInput('AT');
if (Blockly.Msg.LISTS_GET_INDEX_TAIL) {
this.appendDummyInput('TAIL')
.appendTitle(Blockly.Msg.LISTS_GET_INDEX_TAIL);
.appendField(Blockly.Msg.LISTS_GET_INDEX_TAIL);
}
this.setInputsInline(true);
this.setOutput(true);
@@ -252,8 +252,8 @@ Blockly.Blocks['lists_getIndex'] = {
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var combo = thisBlock.getTitleValue('MODE') + '_' +
thisBlock.getTitleValue('WHERE');
var combo = thisBlock.getFieldValue('MODE') + '_' +
thisBlock.getFieldValue('WHERE');
return Blockly.Msg['LISTS_GET_INDEX_TOOLTIP_' + combo];
});
},
@@ -302,7 +302,7 @@ Blockly.Blocks['lists_getIndex'] = {
this.appendValueInput('AT').setCheck('Number');
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
this.appendDummyInput('ORDINAL')
.appendTitle(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
}
} else {
this.appendDummyInput('AT');
@@ -314,12 +314,12 @@ Blockly.Blocks['lists_getIndex'] = {
var block = this.sourceBlock_;
block.updateAt(newAt);
// This menu has been destroyed and replaced. Update the replacement.
block.setTitleValue(value, 'WHERE');
block.setFieldValue(value, 'WHERE');
return null;
}
return undefined;
});
this.getInput('AT').appendTitle(menu, 'WHERE');
this.getInput('AT').appendField(menu, 'WHERE');
if (Blockly.Msg.LISTS_GET_INDEX_TAIL) {
this.moveInputBefore('TAIL', null);
}
@@ -342,13 +342,13 @@ Blockly.Blocks['lists_setIndex'] = {
this.setColour(260);
this.appendValueInput('LIST')
.setCheck('Array')
.appendTitle(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
.appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_IN_LIST);
this.appendDummyInput()
.appendTitle(new Blockly.FieldDropdown(MODE), 'MODE')
.appendTitle('', 'SPACE');
.appendField(new Blockly.FieldDropdown(MODE), 'MODE')
.appendField('', 'SPACE');
this.appendDummyInput('AT');
this.appendValueInput('TO')
.appendTitle(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);
.appendField(Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
@@ -357,8 +357,8 @@ Blockly.Blocks['lists_setIndex'] = {
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var combo = thisBlock.getTitleValue('MODE') + '_' +
thisBlock.getTitleValue('WHERE');
var combo = thisBlock.getFieldValue('MODE') + '_' +
thisBlock.getFieldValue('WHERE');
return Blockly.Msg['LISTS_SET_INDEX_TOOLTIP_' + combo];
});
},
@@ -386,7 +386,7 @@ Blockly.Blocks['lists_setIndex'] = {
this.appendValueInput('AT').setCheck('Number');
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
this.appendDummyInput('ORDINAL')
.appendTitle(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
}
} else {
this.appendDummyInput('AT');
@@ -398,7 +398,7 @@ Blockly.Blocks['lists_setIndex'] = {
var block = this.sourceBlock_;
block.updateAt(newAt);
// This menu has been destroyed and replaced. Update the replacement.
block.setTitleValue(value, 'WHERE');
block.setFieldValue(value, 'WHERE');
return null;
}
return undefined;
@@ -408,7 +408,7 @@ Blockly.Blocks['lists_setIndex'] = {
this.moveInputBefore('ORDINAL', 'TO');
}
this.getInput('AT').appendTitle(menu, 'WHERE');
this.getInput('AT').appendField(menu, 'WHERE');
}
};
@@ -427,12 +427,12 @@ Blockly.Blocks['lists_getSublist'] = {
this.setColour(260);
this.appendValueInput('LIST')
.setCheck('Array')
.appendTitle(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);
.appendField(Blockly.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);
this.appendDummyInput('AT1');
this.appendDummyInput('AT2');
if (Blockly.Msg.LISTS_GET_SUBLIST_TAIL) {
this.appendDummyInput('TAIL')
.appendTitle(Blockly.Msg.LISTS_GET_SUBLIST_TAIL);
.appendField(Blockly.Msg.LISTS_GET_SUBLIST_TAIL);
}
this.setInputsInline(true);
this.setOutput(true, 'Array');
@@ -466,7 +466,7 @@ Blockly.Blocks['lists_getSublist'] = {
this.appendValueInput('AT' + n).setCheck('Number');
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
this.appendDummyInput('ORDINAL' + n)
.appendTitle(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
}
} else {
this.appendDummyInput('AT' + n);
@@ -479,13 +479,13 @@ Blockly.Blocks['lists_getSublist'] = {
var block = this.sourceBlock_;
block.updateAt(n, newAt);
// This menu has been destroyed and replaced. Update the replacement.
block.setTitleValue(value, 'WHERE' + n);
block.setFieldValue(value, 'WHERE' + n);
return null;
}
return undefined;
});
this.getInput('AT' + n)
.appendTitle(menu, 'WHERE' + n);
.appendField(menu, 'WHERE' + n);
if (n == 1) {
this.moveInputBefore('AT1', 'AT2');
if (this.getInput('ORDINAL1')) {

View File

@@ -35,9 +35,9 @@ Blockly.Blocks['controls_if'] = {
this.setColour(210);
this.appendValueInput('IF0')
.setCheck('Boolean')
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_IF);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
this.appendStatementInput('DO0')
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_THEN);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setMutator(new Blockly.Mutator(['controls_if_elseif',
@@ -78,13 +78,13 @@ Blockly.Blocks['controls_if'] = {
for (var x = 1; x <= this.elseifCount_; x++) {
this.appendValueInput('IF' + x)
.setCheck('Boolean')
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
this.appendStatementInput('DO' + x)
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_THEN);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
}
if (this.elseCount_) {
this.appendStatementInput('ELSE')
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
}
},
decompose: function(workspace) {
@@ -124,9 +124,9 @@ Blockly.Blocks['controls_if'] = {
this.elseifCount_++;
var ifInput = this.appendValueInput('IF' + this.elseifCount_)
.setCheck('Boolean')
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSEIF);
var doInput = this.appendStatementInput('DO' + this.elseifCount_);
doInput.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_THEN);
doInput.appendField(Blockly.Msg.CONTROLS_IF_MSG_THEN);
// Reconnect any child blocks.
if (clauseBlock.valueConnection_) {
ifInput.connection.connect(clauseBlock.valueConnection_);
@@ -138,7 +138,7 @@ Blockly.Blocks['controls_if'] = {
case 'controls_if_else':
this.elseCount_++;
var elseInput = this.appendStatementInput('ELSE');
elseInput.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
elseInput.appendField(Blockly.Msg.CONTROLS_IF_MSG_ELSE);
// Reconnect any child blocks.
if (clauseBlock.statementConnection_) {
elseInput.connection.connect(clauseBlock.statementConnection_);
@@ -185,7 +185,7 @@ Blockly.Blocks['controls_if_if'] = {
init: function() {
this.setColour(210);
this.appendDummyInput()
.appendTitle(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);
.appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);
this.appendStatementInput('STACK');
this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);
this.contextMenu = false;
@@ -197,7 +197,7 @@ Blockly.Blocks['controls_if_elseif'] = {
init: function() {
this.setColour(210);
this.appendDummyInput()
.appendTitle(Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF);
.appendField(Blockly.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSEIF_TOOLTIP);
@@ -210,7 +210,7 @@ Blockly.Blocks['controls_if_else'] = {
init: function() {
this.setColour(210);
this.appendDummyInput()
.appendTitle(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);
.appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);
this.setPreviousStatement(true);
this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);
this.contextMenu = false;
@@ -244,12 +244,12 @@ Blockly.Blocks['logic_compare'] = {
this.setOutput(true, 'Boolean');
this.appendValueInput('A');
this.appendValueInput('B')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'OP');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
this.setInputsInline(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var op = thisBlock.getTitleValue('OP');
var op = thisBlock.getFieldValue('OP');
var TOOLTIPS = {
EQ: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_EQ,
NEQ: Blockly.Msg.LOGIC_COMPARE_TOOLTIP_NEQ,
@@ -276,12 +276,12 @@ Blockly.Blocks['logic_operation'] = {
.setCheck('Boolean');
this.appendValueInput('B')
.setCheck('Boolean')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'OP');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
this.setInputsInline(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var op = thisBlock.getTitleValue('OP');
var op = thisBlock.getFieldValue('OP');
var TOOLTIPS = {
AND: Blockly.Msg.LOGIC_OPERATION_TOOLTIP_AND,
OR: Blockly.Msg.LOGIC_OPERATION_TOOLTIP_OR
@@ -315,7 +315,7 @@ Blockly.Blocks['logic_boolean'] = {
this.setColour(210);
this.setOutput(true, 'Boolean');
this.appendDummyInput()
.appendTitle(new Blockly.FieldDropdown(BOOLEANS), 'BOOL');
.appendField(new Blockly.FieldDropdown(BOOLEANS), 'BOOL');
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
}
};
@@ -327,7 +327,7 @@ Blockly.Blocks['logic_null'] = {
this.setColour(210);
this.setOutput(true);
this.appendDummyInput()
.appendTitle(Blockly.Msg.LOGIC_NULL);
.appendField(Blockly.Msg.LOGIC_NULL);
this.setTooltip(Blockly.Msg.LOGIC_NULL_TOOLTIP);
}
};
@@ -339,11 +339,11 @@ Blockly.Blocks['logic_ternary'] = {
this.setColour(210);
this.appendValueInput('IF')
.setCheck('Boolean')
.appendTitle(Blockly.Msg.LOGIC_TERNARY_CONDITION);
.appendField(Blockly.Msg.LOGIC_TERNARY_CONDITION);
this.appendValueInput('THEN')
.appendTitle(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);
.appendField(Blockly.Msg.LOGIC_TERNARY_IF_TRUE);
this.appendValueInput('ELSE')
.appendTitle(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);
.appendField(Blockly.Msg.LOGIC_TERNARY_IF_FALSE);
this.setOutput(true);
this.setTooltip(Blockly.Msg.LOGIC_TERNARY_TOOLTIP);
}

View File

@@ -34,12 +34,12 @@ Blockly.Blocks['controls_repeat'] = {
this.setHelpUrl(Blockly.Msg.CONTROLS_REPEAT_HELPURL);
this.setColour(120);
this.appendDummyInput()
.appendTitle(Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT)
.appendTitle(new Blockly.FieldTextInput('10',
.appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_REPEAT)
.appendField(new Blockly.FieldTextInput('10',
Blockly.FieldTextInput.nonnegativeIntegerValidator), 'TIMES')
.appendTitle(Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES);
.appendField(Blockly.Msg.CONTROLS_REPEAT_TITLE_TIMES);
this.appendStatementInput('DO')
.appendTitle(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
.appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.CONTROLS_REPEAT_TOOLTIP);
@@ -55,7 +55,7 @@ Blockly.Blocks['controls_repeat_ext'] = {
['TIMES', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.appendStatementInput('DO')
.appendTitle(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
.appendField(Blockly.Msg.CONTROLS_REPEAT_INPUT_DO);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
@@ -73,15 +73,15 @@ Blockly.Blocks['controls_whileUntil'] = {
this.setColour(120);
this.appendValueInput('BOOL')
.setCheck('Boolean')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'MODE');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
this.appendStatementInput('DO')
.appendTitle(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO);
.appendField(Blockly.Msg.CONTROLS_WHILEUNTIL_INPUT_DO);
this.setPreviousStatement(true);
this.setNextStatement(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var op = thisBlock.getTitleValue('MODE');
var op = thisBlock.getFieldValue('MODE');
var TOOLTIPS = {
WHILE: Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,
UNTIL: Blockly.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL
@@ -97,15 +97,15 @@ Blockly.Blocks['controls_for'] = {
this.setHelpUrl(Blockly.Msg.CONTROLS_FOR_HELPURL);
this.setColour(120);
this.appendDummyInput()
.appendTitle(Blockly.Msg.CONTROLS_FOR_INPUT_WITH)
.appendTitle(new Blockly.FieldVariable(null), 'VAR');
.appendField(Blockly.Msg.CONTROLS_FOR_INPUT_WITH)
.appendField(new Blockly.FieldVariable(null), 'VAR');
this.interpolateMsg(Blockly.Msg.CONTROLS_FOR_INPUT_FROM_TO_BY,
['FROM', 'Number', Blockly.ALIGN_RIGHT],
['TO', 'Number', Blockly.ALIGN_RIGHT],
['BY', 'Number', Blockly.ALIGN_RIGHT],
Blockly.ALIGN_RIGHT);
this.appendStatementInput('DO')
.appendTitle(Blockly.Msg.CONTROLS_FOR_INPUT_DO);
.appendField(Blockly.Msg.CONTROLS_FOR_INPUT_DO);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
@@ -113,24 +113,24 @@ Blockly.Blocks['controls_for'] = {
var thisBlock = this;
this.setTooltip(function() {
return Blockly.Msg.CONTROLS_FOR_TOOLTIP.replace('%1',
thisBlock.getTitleValue('VAR'));
thisBlock.getFieldValue('VAR'));
});
},
getVars: function() {
return [this.getTitleValue('VAR')];
return [this.getFieldValue('VAR')];
},
renameVar: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('VAR'))) {
this.setTitleValue(newName, 'VAR');
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
},
customContextMenu: function(options) {
var option = {enabled: true};
var name = this.getTitleValue('VAR');
var name = this.getFieldValue('VAR');
option.text = Blockly.Msg.VARIABLES_SET_CREATE_GET.replace('%1', name);
var xmlTitle = goog.dom.createDom('title', null, name);
xmlTitle.setAttribute('name', 'VAR');
var xmlBlock = goog.dom.createDom('block', null, xmlTitle);
var xmlField = goog.dom.createDom('field', null, name);
xmlField.setAttribute('name', 'VAR');
var xmlBlock = goog.dom.createDom('block', null, xmlField);
xmlBlock.setAttribute('type', 'variables_get');
option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock);
options.push(option);
@@ -144,31 +144,31 @@ Blockly.Blocks['controls_forEach'] = {
this.setColour(120);
this.appendValueInput('LIST')
.setCheck('Array')
.appendTitle(Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM)
.appendTitle(new Blockly.FieldVariable(null), 'VAR')
.appendTitle(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST);
.appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_ITEM)
.appendField(new Blockly.FieldVariable(null), 'VAR')
.appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST);
if (Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL) {
this.appendDummyInput()
.appendTitle(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL);
.appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_INLIST_TAIL);
this.setInputsInline(true);
}
this.appendStatementInput('DO')
.appendTitle(Blockly.Msg.CONTROLS_FOREACH_INPUT_DO);
.appendField(Blockly.Msg.CONTROLS_FOREACH_INPUT_DO);
this.setPreviousStatement(true);
this.setNextStatement(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
return Blockly.Msg.CONTROLS_FOREACH_TOOLTIP.replace('%1',
thisBlock.getTitleValue('VAR'));
thisBlock.getFieldValue('VAR'));
});
},
getVars: function() {
return [this.getTitleValue('VAR')];
return [this.getFieldValue('VAR')];
},
renameVar: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('VAR'))) {
this.setTitleValue(newName, 'VAR');
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
},
customContextMenu: Blockly.Blocks['controls_for'].customContextMenu
@@ -183,12 +183,12 @@ Blockly.Blocks['controls_flow_statements'] = {
this.setHelpUrl(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL);
this.setColour(120);
this.appendDummyInput()
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'FLOW');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'FLOW');
this.setPreviousStatement(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var op = thisBlock.getTitleValue('FLOW');
var op = thisBlock.getFieldValue('FLOW');
var TOOLTIPS = {
BREAK: Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK,
CONTINUE: Blockly.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE

View File

@@ -34,7 +34,7 @@ Blockly.Blocks['math_number'] = {
this.setHelpUrl(Blockly.Msg.MATH_NUMBER_HELPURL);
this.setColour(230);
this.appendDummyInput()
.appendTitle(new Blockly.FieldTextInput('0',
.appendField(new Blockly.FieldTextInput('0',
Blockly.FieldTextInput.numberValidator), 'NUM');
this.setOutput(true, 'Number');
this.setTooltip(Blockly.Msg.MATH_NUMBER_TOOLTIP);
@@ -57,12 +57,12 @@ Blockly.Blocks['math_arithmetic'] = {
.setCheck('Number');
this.appendValueInput('B')
.setCheck('Number')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'OP');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
this.setInputsInline(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var mode = thisBlock.getTitleValue('OP');
var mode = thisBlock.getFieldValue('OP');
var TOOLTIPS = {
ADD: Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_ADD,
MINUS: Blockly.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS,
@@ -91,11 +91,11 @@ Blockly.Blocks['math_single'] = {
this.setOutput(true, 'Number');
this.appendValueInput('NUM')
.setCheck('Number')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'OP');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var mode = thisBlock.getTitleValue('OP');
var mode = thisBlock.getFieldValue('OP');
var TOOLTIPS = {
ROOT: Blockly.Msg.MATH_SINGLE_TOOLTIP_ROOT,
ABS: Blockly.Msg.MATH_SINGLE_TOOLTIP_ABS,
@@ -125,11 +125,11 @@ Blockly.Blocks['math_trig'] = {
this.setOutput(true, 'Number');
this.appendValueInput('NUM')
.setCheck('Number')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'OP');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
var mode = thisBlock.getTitleValue('OP');
var mode = thisBlock.getFieldValue('OP');
var TOOLTIPS = {
SIN: Blockly.Msg.MATH_TRIG_TOOLTIP_SIN,
COS: Blockly.Msg.MATH_TRIG_TOOLTIP_COS,
@@ -157,7 +157,7 @@ Blockly.Blocks['math_constant'] = {
this.setColour(230);
this.setOutput(true, 'Number');
this.appendDummyInput()
.appendTitle(new Blockly.FieldDropdown(CONSTANTS), 'CONSTANT');
.appendField(new Blockly.FieldDropdown(CONSTANTS), 'CONSTANT');
this.setTooltip(Blockly.Msg.MATH_CONSTANT_TOOLTIP);
}
};
@@ -182,7 +182,7 @@ Blockly.Blocks['math_number_property'] = {
this.sourceBlock_.updateShape(divisorInput);
});
this.appendDummyInput()
.appendTitle(dropdown, 'PROPERTY');
.appendField(dropdown, 'PROPERTY');
this.setInputsInline(true);
this.setOutput(true, 'Boolean');
this.setTooltip(Blockly.Msg.MATH_IS_TOOLTIP);
@@ -190,7 +190,7 @@ Blockly.Blocks['math_number_property'] = {
mutationToDom: function() {
// Save whether the 'divisorInput' should be true of false (present or not).
var container = document.createElement('mutation');
var divisorInput = (this.getTitleValue('PROPERTY') == 'DIVISIBLE_BY');
var divisorInput = (this.getFieldValue('PROPERTY') == 'DIVISIBLE_BY');
container.setAttribute('divisor_input', divisorInput);
return container;
},
@@ -220,25 +220,25 @@ Blockly.Blocks['math_change'] = {
this.setColour(230);
this.appendValueInput('DELTA')
.setCheck('Number')
.appendTitle(Blockly.Msg.MATH_CHANGE_TITLE_CHANGE)
.appendTitle(new Blockly.FieldVariable(
.appendField(Blockly.Msg.MATH_CHANGE_TITLE_CHANGE)
.appendField(new Blockly.FieldVariable(
Blockly.Msg.MATH_CHANGE_TITLE_ITEM), 'VAR')
.appendTitle(Blockly.Msg.MATH_CHANGE_INPUT_BY);
.appendField(Blockly.Msg.MATH_CHANGE_INPUT_BY);
this.setPreviousStatement(true);
this.setNextStatement(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
return Blockly.Msg.MATH_CHANGE_TOOLTIP.replace('%1',
thisBlock.getTitleValue('VAR'));
thisBlock.getFieldValue('VAR'));
});
},
getVars: function() {
return [this.getTitleValue('VAR')];
return [this.getFieldValue('VAR')];
},
renameVar: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('VAR'))) {
this.setTitleValue(newName, 'VAR');
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
}
};
@@ -255,7 +255,7 @@ Blockly.Blocks['math_round'] = {
this.setOutput(true, 'Number');
this.appendValueInput('NUM')
.setCheck('Number')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'OP');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
this.setTooltip(Blockly.Msg.MATH_ROUND_TOOLTIP);
}
};
@@ -287,9 +287,9 @@ Blockly.Blocks['math_on_list'] = {
});
this.appendValueInput('LIST')
.setCheck('Array')
.appendTitle(dropdown, 'OP');
.appendField(dropdown, 'OP');
this.setTooltip(function() {
var mode = thisBlock.getTitleValue('OP');
var mode = thisBlock.getFieldValue('OP');
var TOOLTIPS = {
SUM: Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM,
MIN: Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN,
@@ -358,7 +358,7 @@ Blockly.Blocks['math_random_float'] = {
this.setColour(230);
this.setOutput(true, 'Number');
this.appendDummyInput()
.appendTitle(Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM);
.appendField(Blockly.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM);
this.setTooltip(Blockly.Msg.MATH_RANDOM_FLOAT_TOOLTIP);
}
};

View File

@@ -36,12 +36,12 @@ Blockly.Blocks['procedures_defnoreturn'] = {
var name = Blockly.Procedures.findLegalName(
Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE, this);
this.appendDummyInput()
.appendTitle(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE)
.appendTitle(new Blockly.FieldTextInput(name,
.appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE)
.appendField(new Blockly.FieldTextInput(name,
Blockly.Procedures.rename), 'NAME')
.appendTitle('', 'PARAMS');
.appendField('', 'PARAMS');
this.appendStatementInput('STACK')
.appendTitle(Blockly.Msg.PROCEDURES_DEFNORETURN_DO);
.appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO);
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);
this.arguments_ = [];
@@ -68,7 +68,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
paramString = Blockly.Msg.PROCEDURES_BEFORE_PARAMS +
' ' + this.arguments_.join(', ');
}
this.setTitleValue(paramString, 'PARAMS');
this.setFieldValue(paramString, 'PARAMS');
},
mutationToDom: function() {
var container = document.createElement('mutation');
@@ -96,14 +96,14 @@ Blockly.Blocks['procedures_defnoreturn'] = {
for (var x = 0; x < this.arguments_.length; x++) {
var paramBlock = new Blockly.Block(workspace, 'procedures_mutatorarg');
paramBlock.initSvg();
paramBlock.setTitleValue(this.arguments_[x], 'NAME');
paramBlock.setFieldValue(this.arguments_[x], 'NAME');
// Store the old location.
paramBlock.oldLocation = x;
connection.connect(paramBlock.previousConnection);
connection = paramBlock.nextConnection;
}
// Initialize procedure's callers with blank IDs.
Blockly.Procedures.mutateCallers(this.getTitleValue('NAME'),
Blockly.Procedures.mutateCallers(this.getFieldValue('NAME'),
this.workspace, this.arguments_, null);
return containerBlock;
},
@@ -112,18 +112,18 @@ Blockly.Blocks['procedures_defnoreturn'] = {
this.paramIds_ = [];
var paramBlock = containerBlock.getInputTargetBlock('STACK');
while (paramBlock) {
this.arguments_.push(paramBlock.getTitleValue('NAME'));
this.arguments_.push(paramBlock.getFieldValue('NAME'));
this.paramIds_.push(paramBlock.id);
paramBlock = paramBlock.nextConnection &&
paramBlock.nextConnection.targetBlock();
}
this.updateParams_();
Blockly.Procedures.mutateCallers(this.getTitleValue('NAME'),
Blockly.Procedures.mutateCallers(this.getFieldValue('NAME'),
this.workspace, this.arguments_, this.paramIds_);
},
dispose: function() {
// Dispose of any callers.
var name = this.getTitleValue('NAME');
var name = this.getFieldValue('NAME');
Blockly.Procedures.disposeCallers(name, this.workspace);
// Call parent's destructor.
Blockly.Block.prototype.dispose.apply(this, arguments);
@@ -132,7 +132,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
// Return the name of the defined procedure,
// a list of all its arguments,
// and that it DOES NOT have a return value.
return [this.getTitleValue('NAME'), this.arguments_, false];
return [this.getFieldValue('NAME'), this.arguments_, false];
},
getVars: function() {
return this.arguments_;
@@ -152,8 +152,8 @@ Blockly.Blocks['procedures_defnoreturn'] = {
var blocks = this.mutator.workspace_.getAllBlocks();
for (var x = 0, block; block = blocks[x]; x++) {
if (block.type == 'procedures_mutatorarg' &&
Blockly.Names.equals(oldName, block.getTitleValue('NAME'))) {
block.setTitleValue(newName, 'NAME');
Blockly.Names.equals(oldName, block.getFieldValue('NAME'))) {
block.setFieldValue(newName, 'NAME');
}
}
}
@@ -162,7 +162,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
customContextMenu: function(options) {
// Add option to create caller.
var option = {enabled: true};
var name = this.getTitleValue('NAME');
var name = this.getFieldValue('NAME');
option.text = Blockly.Msg.PROCEDURES_CREATE_DO.replace('%1', name);
var xmlMutation = goog.dom.createDom('mutation');
@@ -182,9 +182,9 @@ Blockly.Blocks['procedures_defnoreturn'] = {
var option = {enabled: true};
var name = this.arguments_[x];
option.text = Blockly.Msg.VARIABLES_SET_CREATE_GET.replace('%1', name);
var xmlTitle = goog.dom.createDom('title', null, name);
xmlTitle.setAttribute('name', 'VAR');
var xmlBlock = goog.dom.createDom('block', null, xmlTitle);
var xmlField = goog.dom.createDom('field', null, name);
xmlField.setAttribute('name', 'VAR');
var xmlBlock = goog.dom.createDom('block', null, xmlField);
xmlBlock.setAttribute('type', 'variables_get');
option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock);
options.push(option);
@@ -201,15 +201,15 @@ Blockly.Blocks['procedures_defreturn'] = {
var name = Blockly.Procedures.findLegalName(
Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE, this);
this.appendDummyInput()
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE)
.appendTitle(new Blockly.FieldTextInput(name,
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE)
.appendField(new Blockly.FieldTextInput(name,
Blockly.Procedures.rename), 'NAME')
.appendTitle('', 'PARAMS');
.appendField('', 'PARAMS');
this.appendStatementInput('STACK')
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_DO);
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_DO);
this.appendValueInput('RETURN')
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);
this.arguments_ = [];
@@ -224,7 +224,7 @@ Blockly.Blocks['procedures_defreturn'] = {
// Return the name of the defined procedure,
// a list of all its arguments,
// and that it DOES have a return value.
return [this.getTitleValue('NAME'), this.arguments_, true];
return [this.getFieldValue('NAME'), this.arguments_, true];
},
getVars: Blockly.Blocks['procedures_defnoreturn'].getVars,
renameVar: Blockly.Blocks['procedures_defnoreturn'].renameVar,
@@ -237,7 +237,7 @@ Blockly.Blocks['procedures_mutatorcontainer'] = {
init: function() {
this.setColour(290);
this.appendDummyInput()
.appendTitle(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);
.appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);
this.appendStatementInput('STACK');
this.setTooltip('');
this.contextMenu = false;
@@ -249,8 +249,8 @@ Blockly.Blocks['procedures_mutatorarg'] = {
init: function() {
this.setColour(290);
this.appendDummyInput()
.appendTitle(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE)
.appendTitle(new Blockly.FieldTextInput('x', this.validator), 'NAME');
.appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE)
.appendField(new Blockly.FieldTextInput('x', this.validator), 'NAME');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip('');
@@ -270,8 +270,8 @@ Blockly.Blocks['procedures_callnoreturn'] = {
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);
this.setColour(290);
this.appendDummyInput()
.appendTitle(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL)
.appendTitle('', 'NAME');
.appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL)
.appendField('', 'NAME');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP);
@@ -280,11 +280,11 @@ Blockly.Blocks['procedures_callnoreturn'] = {
this.quarkArguments_ = null;
},
getProcedureCall: function() {
return this.getTitleValue('NAME');
return this.getFieldValue('NAME');
},
renameProcedure: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('NAME'))) {
this.setTitleValue(newName, 'NAME');
if (Blockly.Names.equals(oldName, this.getFieldValue('NAME'))) {
this.setFieldValue(newName, 'NAME');
this.setTooltip(
(this.outputConnection ? Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP
: Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP)
@@ -345,7 +345,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
for (var x = 0; x < this.arguments_.length; x++) {
var input = this.appendValueInput('ARG' + x)
.setAlign(Blockly.ALIGN_RIGHT)
.appendTitle(this.arguments_[x]);
.appendField(this.arguments_[x]);
if (this.quarkArguments_) {
// Reconnect any child blocks.
var quarkName = this.quarkArguments_[x];
@@ -370,7 +370,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
mutationToDom: function() {
// Save the name and arguments (none of which are editable).
var container = document.createElement('mutation');
container.setAttribute('name', this.getTitleValue('NAME'));
container.setAttribute('name', this.getFieldValue('NAME'));
for (var x = 0; x < this.arguments_.length; x++) {
var parameter = document.createElement('arg');
parameter.setAttribute('name', this.arguments_[x]);
@@ -381,7 +381,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
domToMutation: function(xmlElement) {
// Restore the name and parameters.
var name = xmlElement.getAttribute('name');
this.setTitleValue(name, 'NAME');
this.setFieldValue(name, 'NAME');
this.setTooltip(
(this.outputConnection ? Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP
: Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace('%1', name));
@@ -405,7 +405,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
for (var x = 0; x < this.arguments_.length; x++) {
if (Blockly.Names.equals(oldName, this.arguments_[x])) {
this.arguments_[x] = newName;
this.getInput('ARG' + x).titleRow[0].setText(newName);
this.getInput('ARG' + x).fieldRow[0].setText(newName);
}
}
},
@@ -413,7 +413,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
// Add option to find caller.
var option = {enabled: true};
option.text = Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;
var name = this.getTitleValue('NAME');
var name = this.getFieldValue('NAME');
var workspace = this.workspace;
option.callback = function() {
var def = Blockly.Procedures.getDefinition(name, workspace);
@@ -429,8 +429,8 @@ Blockly.Blocks['procedures_callreturn'] = {
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);
this.setColour(290);
this.appendDummyInput()
.appendTitle(Blockly.Msg.PROCEDURES_CALLRETURN_CALL)
.appendTitle('', 'NAME');
.appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL)
.appendField('', 'NAME');
this.setOutput(true);
this.setTooltip(Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP);
this.arguments_ = [];
@@ -454,9 +454,9 @@ Blockly.Blocks['procedures_ifreturn'] = {
this.setColour(290);
this.appendValueInput('CONDITION')
.setCheck('Boolean')
.appendTitle(Blockly.Msg.CONTROLS_IF_MSG_IF);
.appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
this.appendValueInput('VALUE')
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
@@ -476,7 +476,7 @@ Blockly.Blocks['procedures_ifreturn'] = {
if (!this.hasReturnValue_) {
this.removeInput('VALUE');
this.appendDummyInput('VALUE')
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
}
},
onchange: function() {
@@ -500,13 +500,13 @@ Blockly.Blocks['procedures_ifreturn'] = {
if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) {
this.removeInput('VALUE');
this.appendDummyInput('VALUE')
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
this.hasReturnValue_ = false;
} else if (block.type == 'procedures_defreturn' &&
!this.hasReturnValue_) {
this.removeInput('VALUE');
this.appendValueInput('VALUE')
.appendTitle(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
.appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
this.hasReturnValue_ = true;
}
this.setWarningText(null);

View File

@@ -34,10 +34,10 @@ Blockly.Blocks['text'] = {
this.setHelpUrl(Blockly.Msg.TEXT_TEXT_HELPURL);
this.setColour(160);
this.appendDummyInput()
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote0.png', 12, 12))
.appendTitle(new Blockly.FieldTextInput(''), 'TEXT')
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldTextInput(''), 'TEXT')
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote1.png', 12, 12));
this.setOutput(true, 'String');
this.setTooltip(Blockly.Msg.TEXT_TEXT_TOOLTIP);
@@ -50,7 +50,7 @@ Blockly.Blocks['text_join'] = {
this.setHelpUrl(Blockly.Msg.TEXT_JOIN_HELPURL);
this.setColour(160);
this.appendValueInput('ADD0')
.appendTitle(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
this.appendValueInput('ADD1');
this.setOutput(true, 'String');
this.setMutator(new Blockly.Mutator(['text_create_join_item']));
@@ -70,14 +70,14 @@ Blockly.Blocks['text_join'] = {
for (var x = 0; x < this.itemCount_; x++) {
var input = this.appendValueInput('ADD' + x);
if (x == 0) {
input.appendTitle(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
input.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
}
}
if (this.itemCount_ == 0) {
this.appendDummyInput('EMPTY')
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote0.png', 12, 12))
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote1.png', 12, 12));
}
},
@@ -109,7 +109,7 @@ Blockly.Blocks['text_join'] = {
while (itemBlock) {
var input = this.appendValueInput('ADD' + this.itemCount_);
if (this.itemCount_ == 0) {
input.appendTitle(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
input.appendField(Blockly.Msg.TEXT_JOIN_TITLE_CREATEWITH);
}
// Reconnect any child blocks.
if (itemBlock.valueConnection_) {
@@ -121,9 +121,9 @@ Blockly.Blocks['text_join'] = {
}
if (this.itemCount_ == 0) {
this.appendDummyInput('EMPTY')
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote0.png', 12, 12))
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote1.png', 12, 12));
}
},
@@ -146,7 +146,7 @@ Blockly.Blocks['text_create_join_container'] = {
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendTitle(Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN);
.appendField(Blockly.Msg.TEXT_CREATE_JOIN_TITLE_JOIN);
this.appendStatementInput('STACK');
this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_TOOLTIP);
this.contextMenu = false;
@@ -158,7 +158,7 @@ Blockly.Blocks['text_create_join_item'] = {
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendTitle(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM);
.appendField(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP);
@@ -172,25 +172,25 @@ Blockly.Blocks['text_append'] = {
this.setHelpUrl(Blockly.Msg.TEXT_APPEND_HELPURL);
this.setColour(160);
this.appendValueInput('TEXT')
.appendTitle(Blockly.Msg.TEXT_APPEND_TO)
.appendTitle(new Blockly.FieldVariable(
.appendField(Blockly.Msg.TEXT_APPEND_TO)
.appendField(new Blockly.FieldVariable(
Blockly.Msg.TEXT_APPEND_VARIABLE), 'VAR')
.appendTitle(Blockly.Msg.TEXT_APPEND_APPENDTEXT);
.appendField(Blockly.Msg.TEXT_APPEND_APPENDTEXT);
this.setPreviousStatement(true);
this.setNextStatement(true);
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
return Blockly.Msg.TEXT_APPEND_TOOLTIP.replace('%1',
thisBlock.getTitleValue('VAR'));
thisBlock.getFieldValue('VAR'));
});
},
getVars: function() {
return [this.getTitleValue('VAR')];
return [this.getFieldValue('VAR')];
},
renameVar: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('VAR'))) {
this.setTitleValue(newName, 'VAR');
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
}
};
@@ -232,12 +232,12 @@ Blockly.Blocks['text_indexOf'] = {
this.setOutput(true, 'Number');
this.appendValueInput('VALUE')
.setCheck('String')
.appendTitle(Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT);
.appendField(Blockly.Msg.TEXT_INDEXOF_INPUT_INTEXT);
this.appendValueInput('FIND')
.setCheck('String')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'END');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'END');
if (Blockly.Msg.TEXT_INDEXOF_TAIL) {
this.appendDummyInput().appendTitle(Blockly.Msg.TEXT_INDEXOF_TAIL);
this.appendDummyInput().appendField(Blockly.Msg.TEXT_INDEXOF_TAIL);
}
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.TEXT_INDEXOF_TOOLTIP);
@@ -258,7 +258,7 @@ Blockly.Blocks['text_charAt'] = {
this.setOutput(true, 'String');
this.appendValueInput('VALUE')
.setCheck('String')
.appendTitle(Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT);
.appendField(Blockly.Msg.TEXT_CHARAT_INPUT_INTEXT);
this.appendDummyInput('AT');
this.setInputsInline(true);
this.updateAt(true);
@@ -288,7 +288,7 @@ Blockly.Blocks['text_charAt'] = {
this.appendValueInput('AT').setCheck('Number');
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
this.appendDummyInput('ORDINAL')
.appendTitle(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
}
} else {
this.appendDummyInput('AT');
@@ -296,7 +296,7 @@ Blockly.Blocks['text_charAt'] = {
if (Blockly.Msg.TEXT_CHARAT_TAIL) {
this.removeInput('TAIL', true);
this.appendDummyInput('TAIL')
.appendTitle(Blockly.Msg.TEXT_CHARAT_TAIL);
.appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
}
var menu = new Blockly.FieldDropdown(this.WHERE_OPTIONS, function(value) {
var newAt = (value == 'FROM_START') || (value == 'FROM_END');
@@ -305,12 +305,12 @@ Blockly.Blocks['text_charAt'] = {
var block = this.sourceBlock_;
block.updateAt(newAt);
// This menu has been destroyed and replaced. Update the replacement.
block.setTitleValue(value, 'WHERE');
block.setFieldValue(value, 'WHERE');
return null;
}
return undefined;
});
this.getInput('AT').appendTitle(menu, 'WHERE');
this.getInput('AT').appendField(menu, 'WHERE');
}
};
@@ -329,12 +329,12 @@ Blockly.Blocks['text_getSubstring'] = {
this.setColour(160);
this.appendValueInput('STRING')
.setCheck('String')
.appendTitle(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);
this.appendDummyInput('AT1');
this.appendDummyInput('AT2');
if (Blockly.Msg.TEXT_GET_SUBSTRING_TAIL) {
this.appendDummyInput('TAIL')
.appendTitle(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);
}
this.setInputsInline(true);
this.setOutput(true, 'String');
@@ -368,7 +368,7 @@ Blockly.Blocks['text_getSubstring'] = {
this.appendValueInput('AT' + n).setCheck('Number');
if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
this.appendDummyInput('ORDINAL' + n)
.appendTitle(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
.appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
}
} else {
this.appendDummyInput('AT' + n);
@@ -377,7 +377,7 @@ Blockly.Blocks['text_getSubstring'] = {
if (n == 2 && Blockly.Msg.TEXT_GET_SUBSTRING_TAIL) {
this.removeInput('TAIL', true);
this.appendDummyInput('TAIL')
.appendTitle(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_TAIL);
}
var menu = new Blockly.FieldDropdown(this['WHERE_OPTIONS_' + n],
function(value) {
@@ -387,13 +387,13 @@ Blockly.Blocks['text_getSubstring'] = {
var block = this.sourceBlock_;
block.updateAt(n, newAt);
// This menu has been destroyed and replaced. Update the replacement.
block.setTitleValue(value, 'WHERE' + n);
block.setFieldValue(value, 'WHERE' + n);
return null;
}
return undefined;
});
this.getInput('AT' + n)
.appendTitle(menu, 'WHERE' + n);
.appendField(menu, 'WHERE' + n);
if (n == 1) {
this.moveInputBefore('AT1', 'AT2');
}
@@ -411,7 +411,7 @@ Blockly.Blocks['text_changeCase'] = {
this.setColour(160);
this.appendValueInput('TEXT')
.setCheck('String')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'CASE');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'CASE');
this.setOutput(true, 'String');
this.setTooltip(Blockly.Msg.TEXT_CHANGECASE_TOOLTIP);
}
@@ -428,7 +428,7 @@ Blockly.Blocks['text_trim'] = {
this.setColour(160);
this.appendValueInput('TEXT')
.setCheck('String')
.appendTitle(new Blockly.FieldDropdown(OPERATORS), 'MODE');
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
this.setOutput(true, 'String');
this.setTooltip(Blockly.Msg.TEXT_TRIM_TOOLTIP);
}
@@ -466,17 +466,17 @@ Blockly.Blocks['text_prompt'] = {
}
});
this.appendDummyInput()
.appendTitle(dropdown, 'TYPE')
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(dropdown, 'TYPE')
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote0.png', 12, 12))
.appendTitle(new Blockly.FieldTextInput(''), 'TEXT')
.appendTitle(new Blockly.FieldImage(Blockly.pathToBlockly +
.appendField(new Blockly.FieldTextInput(''), 'TEXT')
.appendField(new Blockly.FieldImage(Blockly.pathToBlockly +
'media/quote1.png', 12, 12));
this.setOutput(true, 'String');
// Assign 'this' to a variable for use in the tooltip closure below.
var thisBlock = this;
this.setTooltip(function() {
return (thisBlock.getTitleValue('TYPE') == 'TEXT') ?
return (thisBlock.getFieldValue('TYPE') == 'TEXT') ?
Blockly.Msg.TEXT_PROMPT_TOOLTIP_TEXT :
Blockly.Msg.TEXT_PROMPT_TOOLTIP_NUMBER;
});

View File

@@ -34,30 +34,30 @@ Blockly.Blocks['variables_get'] = {
this.setHelpUrl(Blockly.Msg.VARIABLES_GET_HELPURL);
this.setColour(330);
this.appendDummyInput()
.appendTitle(Blockly.Msg.VARIABLES_GET_TITLE)
.appendTitle(new Blockly.FieldVariable(
.appendField(Blockly.Msg.VARIABLES_GET_TITLE)
.appendField(new Blockly.FieldVariable(
Blockly.Msg.VARIABLES_GET_ITEM), 'VAR')
.appendTitle(Blockly.Msg.VARIABLES_GET_TAIL);
.appendField(Blockly.Msg.VARIABLES_GET_TAIL);
this.setOutput(true);
this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);
this.contextMenuMsg_ = Blockly.Msg.VARIABLES_GET_CREATE_SET;
this.contextMenuType_ = 'variables_set';
},
getVars: function() {
return [this.getTitleValue('VAR')];
return [this.getFieldValue('VAR')];
},
renameVar: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('VAR'))) {
this.setTitleValue(newName, 'VAR');
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
},
customContextMenu: function(options) {
var option = {enabled: true};
var name = this.getTitleValue('VAR');
var name = this.getFieldValue('VAR');
option.text = this.contextMenuMsg_.replace('%1', name);
var xmlTitle = goog.dom.createDom('title', null, name);
xmlTitle.setAttribute('name', 'VAR');
var xmlBlock = goog.dom.createDom('block', null, xmlTitle);
var xmlField = goog.dom.createDom('field', null, name);
xmlField.setAttribute('name', 'VAR');
var xmlBlock = goog.dom.createDom('block', null, xmlField);
xmlBlock.setAttribute('type', this.contextMenuType_);
option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock);
options.push(option);
@@ -70,10 +70,10 @@ Blockly.Blocks['variables_set'] = {
this.setHelpUrl(Blockly.Msg.VARIABLES_SET_HELPURL);
this.setColour(330);
this.appendValueInput('VALUE')
.appendTitle(Blockly.Msg.VARIABLES_SET_TITLE)
.appendTitle(new Blockly.FieldVariable(
.appendField(Blockly.Msg.VARIABLES_SET_TITLE)
.appendField(new Blockly.FieldVariable(
Blockly.Msg.VARIABLES_SET_ITEM), 'VAR')
.appendTitle(Blockly.Msg.VARIABLES_SET_TAIL);
.appendField(Blockly.Msg.VARIABLES_SET_TAIL);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setTooltip(Blockly.Msg.VARIABLES_SET_TOOLTIP);
@@ -81,11 +81,11 @@ Blockly.Blocks['variables_set'] = {
this.contextMenuType_ = 'variables_get';
},
getVars: function() {
return [this.getTitleValue('VAR')];
return [this.getFieldValue('VAR')];
},
renameVar: function(oldName, newName) {
if (Blockly.Names.equals(oldName, this.getTitleValue('VAR'))) {
this.setTitleValue(newName, 'VAR');
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
this.setFieldValue(newName, 'VAR');
}
},
customContextMenu: Blockly.Blocks['variables_get'].customContextMenu