From 020cac64b183ba0edc07d3e3d624390d056f542d Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 4 Oct 2013 16:54:16 +0200 Subject: [PATCH] "plain block prototype labels" preference setting hide / show the (+) symbols in the block editor --- byob.js | 11 ++++++++++- gui.js | 29 ++++++++++++++++++++++++++--- history.txt | 1 + lang-de.js | 8 +++++++- locale.js | 4 ++-- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/byob.js b/byob.js index 004ef87c..82b795da 100644 --- a/byob.js +++ b/byob.js @@ -105,7 +105,7 @@ CommentMorph, localize, CSlotMorph, SpeechBubbleMorph, MorphicPreferences*/ // Global stuff //////////////////////////////////////////////////////// -modules.byob = '2013-September-18'; +modules.byob = '2013-October-04'; // Declarations @@ -2081,6 +2081,10 @@ BlockLabelPlaceHolderMorph.prototype = new StringMorph(); BlockLabelPlaceHolderMorph.prototype.constructor = BlockLabelPlaceHolderMorph; BlockLabelPlaceHolderMorph.uber = StringMorph.prototype; +// BlockLabelPlaceHolderMorph preferences settings + +BlockLabelPlaceHolderMorph.prototype.plainLabel = false; // always show (+) + // BlockLabelPlaceHolderMorph instance creation: function BlockLabelPlaceHolderMorph() { @@ -2101,6 +2105,11 @@ BlockLabelPlaceHolderMorph.prototype.init = function () { BlockLabelPlaceHolderMorph.prototype.drawNew = function () { var context, width, x, y, cx, cy; + // set my text contents depending on the "plainLabel" flag + if (this.plainLabel) { + this.text = this.isHighlighted ? ' + ' : ''; + } + // initialize my surface property this.image = newCanvas(); context = this.image.getContext('2d'); diff --git a/gui.js b/gui.js index b9971f22..debb0b7c 100644 --- a/gui.js +++ b/gui.js @@ -64,11 +64,11 @@ standardSettings, Sound, BlockMorph, ToggleMorph, InputSlotDialogMorph, ScriptsMorph, isNil, SymbolMorph, BlockExportDialogMorph, BlockImportDialogMorph, SnapTranslator, localize, List, InputSlotMorph, SnapCloud, Uint8Array, HandleMorph, SVG_Costume, fontHeight, hex_sha512, -sb, CommentMorph, CommandBlockMorph*/ +sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.gui = '2013-September-19'; +modules.gui = '2013-October-04'; // Declarations @@ -1701,7 +1701,8 @@ IDE_Morph.prototype.applySavedSettings = function () { zoom = this.getSetting('zoom'), language = this.getSetting('language'), click = this.getSetting('click'), - longform = this.getSetting('longform'); + longform = this.getSetting('longform'), + plainprototype = this.getSetting('plainprototype'); // design if (design === 'flat') { @@ -1733,6 +1734,11 @@ IDE_Morph.prototype.applySavedSettings = function () { if (longform) { InputSlotDialogMorph.prototype.isLaunchingExpanded = true; } + + // plain prototype labels + if (plainprototype) { + BlockLabelPlaceHolderMorph.prototype.plainLabel = true; + } }; IDE_Morph.prototype.saveSetting = function (key, value) { @@ -2095,6 +2101,13 @@ IDE_Morph.prototype.settingsMenu = function () { 'uncheck to use the input\ndialog in short form', 'check to always show slot\ntypes in the input dialog' ); + addPreference( + 'Plain prototype labels', + 'togglePlainPrototypeLabels', + BlockLabelPlaceHolderMorph.prototype.plainLabel, + 'uncheck to always show (+) symbols\nin block prototype labels', + 'check to hide (+) symbols\nin block prototype labels' + ); addPreference( 'Virtual keyboard', 'toggleVirtualKeyboard', @@ -3043,6 +3056,16 @@ IDE_Morph.prototype.toggleLongFormInputDialog = function () { } }; +IDE_Morph.prototype.togglePlainPrototypeLabels = function () { + BlockLabelPlaceHolderMorph.prototype.plainLabel = + !BlockLabelPlaceHolderMorph.prototype.plainLabel; + if (BlockLabelPlaceHolderMorph.prototype.plainLabel) { + this.saveSetting('plainprototype', true); + } else { + this.removeSetting('plainprototype'); + } +}; + IDE_Morph.prototype.togglePreferEmptySlotDrops = function () { ScriptsMorph.prototype.isPreferringEmptySlots = !ScriptsMorph.prototype.isPreferringEmptySlots; diff --git a/history.txt b/history.txt index d3b210b7..00fa2c77 100755 --- a/history.txt +++ b/history.txt @@ -1939,3 +1939,4 @@ ______ * Threads: Type-check the SPLIT block's input before eval'ing it * Objects: Prevent watcher cells from growing wider as their contents becomes taller * Objects: Keep watchers onstage when hiding/showing them, fixes #195 +* BYOB, GUI, locale: New preference setting for plain block prototype labels diff --git a/lang-de.js b/lang-de.js index 07f0b004..dec6092f 100644 --- a/lang-de.js +++ b/lang-de.js @@ -185,7 +185,7 @@ SnapTranslator.dict.de = { 'translator_e-mail': 'jens@moenig.org', // optional 'last_changed': - '2013-09-16', // this, too, will appear in the Translators tab + '2013-10-04', // this, too, will appear in the Translators tab // GUI // control bar: @@ -705,6 +705,12 @@ SnapTranslator.dict.de = { + 'zu erm\u00f6glichen', 'Long form input dialog': 'Ausf\u00fchrlicher Input-Dialog', + 'Plain prototype labels': + 'Einfache Prototyp-Beschriftung', + 'uncheck to always show (+) symbols\nin block prototype labels': + 'ausschalten, um (+) Zeichen\nim Blockeditor zu verbergen', + 'check to hide (+) symbols\nin block prototype labels': + 'einschalten, um (+) Zeichen\nim Blockeditor immer anzuzeigen', 'check to always show slot\ntypes in the input dialog': 'einschalten, um immer die Datentypen\nim Input-Dialog zu sehen', 'uncheck to use the input\ndialog in short form': diff --git a/locale.js b/locale.js index 921f6781..2b032e28 100644 --- a/locale.js +++ b/locale.js @@ -42,7 +42,7 @@ /*global modules, contains*/ -modules.locale = '2013-August-17'; +modules.locale = '2013-October-04'; // Global stuff @@ -149,7 +149,7 @@ SnapTranslator.dict.de = { 'translator_e-mail': 'jens@moenig.org', 'last_changed': - '2013-09-16' + '2013-10-04' }; SnapTranslator.dict.it = {