Making all blocks use the MSG colour values. (#1749)

* Making all blocks use the MSG colour values.
 * Deprecating Blockly.Constants.Lists.HUE and similar constants.
 * Removing deprecated Blockly.Blocks.lists.HUE constants.
 * Allowing message references in the Block.setColour() parameter.
 * Adding checking of older constants, ensuring they are not overwritten.
This commit is contained in:
Andrew n marshall
2018-04-09 17:37:47 -07:00
committed by GitHub
parent d3a9d96841
commit e9d8e00a55
12 changed files with 134 additions and 79 deletions

View File

@@ -32,13 +32,10 @@ goog.require('Blockly');
/**
* Common HSV hue for all blocks in this category.
* Should be the same as Blockly.Msg.TEXTS_HUE
* @readonly
* Unused constant for the common HSV hue for all blocks in this category.
* @deprecated Use Blockly.Msg.TEXTS_HUE. (2018 April 5)
*/
Blockly.Constants.Text.HUE = 160;
/** @deprecated Use Blockly.Constants.Text.HUE */
Blockly.Blocks.texts.HUE = Blockly.Constants.Text.HUE;
Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
// Block for text value
@@ -224,7 +221,7 @@ Blockly.Blocks['text_getSubstring'] = {
[Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST, 'LAST']
];
this.setHelpUrl(Blockly.Msg.TEXT_GET_SUBSTRING_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.setColour(Blockly.Msg.TEXTS_HUE);
this.appendValueInput('STRING')
.setCheck('String')
.appendField(Blockly.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT);
@@ -332,7 +329,7 @@ Blockly.Blocks['text_changeCase'] = {
[Blockly.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE, 'TITLECASE']
];
this.setHelpUrl(Blockly.Msg.TEXT_CHANGECASE_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.setColour(Blockly.Msg.TEXTS_HUE);
this.appendValueInput('TEXT')
.setCheck('String')
.appendField(new Blockly.FieldDropdown(OPERATORS), 'CASE');
@@ -353,7 +350,7 @@ Blockly.Blocks['text_trim'] = {
[Blockly.Msg.TEXT_TRIM_OPERATOR_RIGHT, 'RIGHT']
];
this.setHelpUrl(Blockly.Msg.TEXT_TRIM_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.setColour(Blockly.Msg.TEXTS_HUE);
this.appendValueInput('TEXT')
.setCheck('String')
.appendField(new Blockly.FieldDropdown(OPERATORS), 'MODE');
@@ -378,7 +375,7 @@ Blockly.Blocks['text_print'] = {
],
"previousStatement": null,
"nextStatement": null,
"colour": Blockly.Blocks.texts.HUE,
"colour": Blockly.Msg.TEXTS_HUE,
"tooltip": Blockly.Msg.TEXT_PRINT_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_PRINT_HELPURL
});
@@ -396,7 +393,7 @@ Blockly.Blocks['text_prompt_ext'] = {
[Blockly.Msg.TEXT_PROMPT_TYPE_NUMBER, 'NUMBER']
];
this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.setColour(Blockly.Msg.TEXTS_HUE);
// Assign 'this' to a variable for use in the closures below.
var thisBlock = this;
var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
@@ -456,7 +453,7 @@ Blockly.Blocks['text_prompt'] = {
// Assign 'this' to a variable for use in the closures below.
var thisBlock = this;
this.setHelpUrl(Blockly.Msg.TEXT_PROMPT_HELPURL);
this.setColour(Blockly.Blocks.texts.HUE);
this.setColour(Blockly.Msg.TEXTS_HUE);
var dropdown = new Blockly.FieldDropdown(TYPES, function(newOp) {
thisBlock.updateType_(newOp);
});
@@ -499,7 +496,7 @@ Blockly.Blocks['text_count'] = {
],
"output": "Number",
"inputsInline": true,
"colour": Blockly.Blocks.texts.HUE,
"colour": Blockly.Msg.TEXTS_HUE,
"tooltip": Blockly.Msg.TEXT_COUNT_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_COUNT_HELPURL
});
@@ -533,7 +530,7 @@ Blockly.Blocks['text_replace'] = {
],
"output": "String",
"inputsInline": true,
"colour": Blockly.Blocks.texts.HUE,
"colour": Blockly.Msg.TEXTS_HUE,
"tooltip": Blockly.Msg.TEXT_REPLACE_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_REPLACE_HELPURL
});
@@ -557,7 +554,7 @@ Blockly.Blocks['text_reverse'] = {
],
"output": "String",
"inputsInline": true,
"colour": Blockly.Blocks.texts.HUE,
"colour": Blockly.Msg.TEXTS_HUE,
"tooltip": Blockly.Msg.TEXT_REVERSE_TOOLTIP,
"helpUrl": Blockly.Msg.TEXT_REVERSE_HELPURL
});