Allow multiple interpolation messages. Fix variable context menus.

This commit is contained in:
Neil Fraser
2015-06-27 12:49:01 -07:00
parent aa746641fa
commit e300931071
10 changed files with 112 additions and 89 deletions

View File

@@ -211,8 +211,8 @@ Blockly.Blocks['lists_repeat'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.LISTS_REPEAT_TITLE,
"args": [
"message0": Blockly.Msg.LISTS_REPEAT_TITLE,
"args0": [
{
"type": "input_value",
"name": "ITEM"
@@ -238,8 +238,8 @@ Blockly.Blocks['lists_length'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.LISTS_LENGTH_TITLE,
"args": [
"message0": Blockly.Msg.LISTS_LENGTH_TITLE,
"args0": [
{
"type": "input_value",
"name": "VALUE",
@@ -261,8 +261,8 @@ Blockly.Blocks['lists_isEmpty'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.LISTS_ISEMPTY_TITLE,
"args": [
"message0": Blockly.Msg.LISTS_ISEMPTY_TITLE,
"args0": [
{
"type": "input_value",
"name": "VALUE",

View File

@@ -371,8 +371,8 @@ Blockly.Blocks['logic_negate'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.LOGIC_NEGATE_TITLE,
"args": [
"message0": Blockly.Msg.LOGIC_NEGATE_TITLE,
"args0": [
{
"type": "input_value",
"name": "BOOL",

View File

@@ -41,8 +41,8 @@ Blockly.Blocks['controls_repeat'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.CONTROLS_REPEAT_TITLE,
"args": [
"message0": Blockly.Msg.CONTROLS_REPEAT_TITLE,
"args0": [
{
"type": "field_input",
"name": "TIMES",
@@ -69,8 +69,8 @@ Blockly.Blocks['controls_repeat_ext'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.CONTROLS_REPEAT_TITLE,
"args": [
"message0": Blockly.Msg.CONTROLS_REPEAT_TITLE,
"args0": [
{
"type": "input_value",
"name": "TIMES",
@@ -126,8 +126,8 @@ Blockly.Blocks['controls_for'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.CONTROLS_FOR_TITLE,
"args": [
"message0": Blockly.Msg.CONTROLS_FOR_TITLE,
"args0": [
{
"type": "field_variable",
"name": "VAR",
@@ -214,8 +214,8 @@ Blockly.Blocks['controls_forEach'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.CONTROLS_FOREACH_TITLE,
"args": [
"message0": Blockly.Msg.CONTROLS_FOREACH_TITLE,
"args0": [
{
"type": "field_variable",
"name": "VAR",

View File

@@ -258,8 +258,8 @@ Blockly.Blocks['math_change'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.MATH_CHANGE_TITLE,
"args": [
"message0": Blockly.Msg.MATH_CHANGE_TITLE,
"args0": [
{
"type": "field_variable",
"name": "VAR",
@@ -268,8 +268,7 @@ Blockly.Blocks['math_change'] = {
{
"type": "input_value",
"name": "DELTA",
"check": "Number",
"align": "RIGHT"
"check": "Number"
}
],
"previousStatement": null,
@@ -381,8 +380,8 @@ Blockly.Blocks['math_modulo'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.MATH_MODULO_TITLE,
"args": [
"message0": Blockly.Msg.MATH_MODULO_TITLE,
"args0": [
{
"type": "input_value",
"name": "DIVIDEND",
@@ -410,8 +409,8 @@ Blockly.Blocks['math_constrain'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.MATH_CONSTRAIN_TITLE,
"args": [
"message0": Blockly.Msg.MATH_CONSTRAIN_TITLE,
"args0": [
{
"type": "input_value",
"name": "VALUE",
@@ -444,8 +443,8 @@ Blockly.Blocks['math_random_int'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.MATH_RANDOM_INT_TITLE,
"args": [
"message0": Blockly.Msg.MATH_RANDOM_INT_TITLE,
"args0": [
{
"type": "input_value",
"name": "FROM",

View File

@@ -274,8 +274,8 @@ Blockly.Blocks['text_length'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.TEXT_LENGTH_TITLE,
"args": [
"message0": Blockly.Msg.TEXT_LENGTH_TITLE,
"args0": [
{
"type": "input_value",
"name": "VALUE",
@@ -297,8 +297,8 @@ Blockly.Blocks['text_isEmpty'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.TEXT_ISEMPTY_TITLE,
"args": [
"message0": Blockly.Msg.TEXT_ISEMPTY_TITLE,
"args0": [
{
"type": "input_value",
"name": "VALUE",
@@ -577,8 +577,8 @@ Blockly.Blocks['text_print'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.TEXT_PRINT_TITLE,
"args": [
"message0": Blockly.Msg.TEXT_PRINT_TITLE,
"args0": [
{
"type": "input_value",
"name": "TEXT"

View File

@@ -47,6 +47,7 @@ Blockly.Blocks['variables_get'] = {
Blockly.Msg.VARIABLES_DEFAULT_NAME), 'VAR');
this.setOutput(true);
this.setTooltip(Blockly.Msg.VARIABLES_GET_TOOLTIP);
this.contextMenuMsg_ = Blockly.Msg.VARIABLES_GET_CREATE_SET;
},
/**
* Return all variables referenced by this block.
@@ -68,7 +69,6 @@ Blockly.Blocks['variables_get'] = {
this.setFieldValue(newName, 'VAR');
}
},
contextMenuMsg_: Blockly.Msg.VARIABLES_GET_CREATE_SET,
contextMenuType_: 'variables_set',
/**
* Add menu option to create getter/setter block for this setter/getter.
@@ -95,8 +95,8 @@ Blockly.Blocks['variables_set'] = {
*/
init: function() {
this.jsonInit({
"message": Blockly.Msg.VARIABLES_SET,
"args": [
"message0": Blockly.Msg.VARIABLES_SET,
"args0": [
{
"type": "field_variable",
"name": "VAR",
@@ -113,6 +113,7 @@ Blockly.Blocks['variables_set'] = {
"tooltip": Blockly.Msg.VARIABLES_SET_TOOLTIP,
"helpUrl": Blockly.Msg.VARIABLES_SET_HELPURL
});
this.contextMenuMsg_ = Blockly.Msg.VARIABLES_SET_CREATE_GET;
},
/**
* Return all variables referenced by this block.
@@ -134,7 +135,6 @@ Blockly.Blocks['variables_set'] = {
this.setFieldValue(newName, 'VAR');
}
},
contextMenuMsg_: Blockly.Msg.VARIABLES_SET_CREATE_GET,
contextMenuType_: 'variables_get',
customContextMenu: Blockly.Blocks['variables_get'].customContextMenu
};