summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blocks.js20
-rw-r--r--gui.js6
-rwxr-xr-xhistory.txt4
-rw-r--r--lang-cs.js8
-rw-r--r--lang-de.js8
-rw-r--r--lang-eo.js8
-rw-r--r--lang-es.js8
-rw-r--r--lang-fr.js6
-rw-r--r--lang-it.js8
-rwxr-xr-xlang-ja.js8
-rwxr-xr-xlang-ja_HIRA.js8
-rw-r--r--lang-ko.js4
-rwxr-xr-xlang-pt.js8
-rw-r--r--lang-ru.js8
-rw-r--r--lang-si.js4
-rw-r--r--lang-zh.js8
-rw-r--r--lists.js13
-rw-r--r--objects.js43
18 files changed, 108 insertions, 72 deletions
diff --git a/blocks.js b/blocks.js
index 44ffdb5..588b4a6 100644
--- a/blocks.js
+++ b/blocks.js
@@ -558,8 +558,7 @@ SyntaxElementMorph.prototype.reactToGrabOf = function (grabbedMorph) {
comment.align(topBlock);
});
if (topBlock.getHighlight()) {
- topBlock.removeHighlight();
- topBlock.addHighlight();
+ topBlock.addHighlight(topBlock.removeHighlight());
}
}
};
@@ -1377,8 +1376,7 @@ SyntaxElementMorph.prototype.fixLayout = function () {
SyntaxElementMorph.prototype.fixHighlight = function () {
var top = this.topBlock();
if (top.getHighlight && top.getHighlight()) {
- top.removeHighlight();
- top.addHighlight();
+ top.addHighlight(top.removeHighlight());
}
};
@@ -2127,13 +2125,13 @@ BlockMorph.prototype.eraseHoles = function (context) {
// BlockMorph highlighting
-BlockMorph.prototype.addHighlight = function () {
+BlockMorph.prototype.addHighlight = function (oldHighlight) {
var isHidden = !this.isVisible,
highlight;
if (isHidden) {this.show(); }
highlight = this.highlight(
- this.activeHighlight,
+ oldHighlight ? oldHighlight.color : this.activeHighlight,
this.activeBlur,
this.activeBorder
);
@@ -2166,6 +2164,7 @@ BlockMorph.prototype.removeHighlight = function () {
this.fullChanged();
this.removeChild(highlight);
}
+ return highlight;
};
BlockMorph.prototype.toggleHighlight = function () {
@@ -2181,6 +2180,7 @@ BlockMorph.prototype.highlight = function (color, blur, border) {
fb = this.fullBounds(),
edge = useBlurredShadows ? blur : border;
highlight.setExtent(fb.extent().add(edge * 2));
+ highlight.color = color;
highlight.image = useBlurredShadows ?
this.highlightImageBlurred(color, blur)
: this.highlightImage(color, border);
@@ -2533,8 +2533,7 @@ BlockMorph.prototype.snap = function () {
this.removeHighlight();
}
if (top.getHighlight()) {
- top.removeHighlight();
- top.addHighlight();
+ top.addHighlight(top.removeHighlight());
}
};
@@ -3444,16 +3443,19 @@ ReporterBlockMorph.prototype.getSlotSpec = function () {
// ReporterBlockMorph events
ReporterBlockMorph.prototype.mouseClickLeft = function (pos) {
+ var isRing;
if (this.parent instanceof BlockInputFragmentMorph) {
return this.parent.mouseClickLeft();
}
if (this.parent instanceof TemplateSlotMorph) {
+ isRing = this.parent.parent && this.parent.parent.parent &&
+ this.parent.parent.parent instanceof RingMorph;
new DialogBoxMorph(
this,
this.setSpec,
this
).prompt(
- "Input name",
+ isRing ? "Input name" : "Script variable name",
this.blockSpec,
this.world()
);
diff --git a/gui.js b/gui.js
index 186716e..6314d85 100644
--- a/gui.js
+++ b/gui.js
@@ -1989,7 +1989,7 @@ IDE_Morph.prototype.projectMenu = function () {
menu.addItem(
shiftClicked ?
- 'Export project as plain text ...' : 'Export project...',
+ 'Export project as plain text...' : 'Export project...',
function () {
if (myself.projectName) {
myself.exportProject(myself.projectName, shiftClicked);
@@ -2004,14 +2004,14 @@ IDE_Morph.prototype.projectMenu = function () {
);
menu.addItem(
- 'Export blocks ...',
+ 'Export blocks...',
function () {myself.exportGlobalBlocks(); },
'show global custom block definitions as XML\nin a new browser window'
);
menu.addLine();
menu.addItem(
- 'Import tools...',
+ 'Import tools',
function () {
var url = 'http://snap.berkeley.edu/snapsource/tools.xml',
diff --git a/history.txt b/history.txt
index 2faa12b..76dbc16 100755
--- a/history.txt
+++ b/history.txt
@@ -1653,3 +1653,7 @@ ______
130422
------
* GUI: Double clicking support for cloud side of project dialog
+
+130423
+------
+* Lists, Objects: Circularity no longer breaks watchers
diff --git a/lang-cs.js b/lang-cs.js
index 6bd9697..727fd68 100644
--- a/lang-cs.js
+++ b/lang-cs.js
@@ -633,18 +633,18 @@ SnapTranslator.dict.cs = {
'file menu import hint':
'Načíst exportovaný projekt, '
+ 'knihovnu bloků, kostýmy nebo zvuky',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Exportovat projekt jako prostý text...',
'Export project...':
'Exportovat projekt...',
'show project data as XML\nin a new browser window':
'zobrazit data projektu jako xml XML\n v novém okně prohlížeče',
- 'Export blocks ...':
+ 'Export blocks...':
'Exportovat bloky...',
'show global custom block definitions as XML\nin a new browser window':
'Zobrazit definici vlastních bloků jako\nXML v novém okně prohlížeče',
- 'Import tools...':
- 'Importovat nástroje...',
+ 'Import tools':
+ 'Importovat nástroje',
'load the official library of\npowerful blocks':
'nahraje oficialní knihovnu\npokročilých bloků',
diff --git a/lang-de.js b/lang-de.js
index 09bce41..85dacc8 100644
--- a/lang-de.js
+++ b/lang-de.js
@@ -637,18 +637,18 @@ SnapTranslator.dict.de = {
'l\u00e4dt ein exportiertes Projekt,\neine Bibliothek mit '
+ 'Bl\u00f6cken\n'
+ 'ein Kost\u00fcm oder einen Klang',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Projekt als normalen Text exportieren...',
'Export project...':
'Projekt exportieren...',
'show project data as XML\nin a new browser window':
'zeigt das Projekt als XML\nin einem neuen Browserfenster an',
- 'Export blocks ...':
+ 'Export blocks...':
'Bl\u00f6cke exportieren...',
'show global custom block definitions as XML\nin a new browser window':
'zeigt globale Benutzerblockdefinitionen\nals XML im Browser an',
- 'Import tools...':
- 'Tools laden...',
+ 'Import tools':
+ 'Tools laden',
'load the official library of\npowerful blocks':
'das offizielle Modul mit\nm\u00e4chtigen Bl\u00f6cken laden',
diff --git a/lang-eo.js b/lang-eo.js
index c8d07d1..36eb72a 100644
--- a/lang-eo.js
+++ b/lang-eo.js
@@ -606,14 +606,14 @@ SnapTranslator.dict.eo = {
'Importi...',
'file menu import hint':
'elŝutu dosieron kun blokoj sonoj aŭ kostumoj',
- 'Export project as plain text ...':
- 'Eksporti projekton en plata teksta formo ...',
+ 'Export project as plain text...':
+ 'Eksporti projekton en plata teksta formo...',
'Export project...':
'Eksporti projekton...',
'show project data as XML\nin a new browser window':
'prezenti projekton kiel XML\nen nova fenestro de retumilo',
- 'Export blocks ...':
- 'Eksporti blokojn ...',
+ 'Export blocks...':
+ 'Eksporti blokojn...',
'show global custom block definitions as XML\nin a new browser window':
'prezenti mallokajn difinojn de propraj blokoj kiel XML\nen nova fenestro de retumilo',
'Delete Project':
diff --git a/lang-es.js b/lang-es.js
index fec4cfe..120d519 100644
--- a/lang-es.js
+++ b/lang-es.js
@@ -619,18 +619,18 @@ SnapTranslator.dict.es = {
'Importar...',
'file menu import hint':
'men\u00FA de archivo de importaci\u00F3n indirecta',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Exportar proyecto como texto...',
'Export project...':
'Exportar proyecto...',
'show project data as XML\nin a new browser window':
'mostrar informaci\u00F3n de proyecto como XML\nen una nueva ventana',
- 'Export blocks ...':
+ 'Export blocks...':
'Exportar bloques...',
'show global custom block definitions as XML\nin a new browser window':
'mostrar definiciones de bloques globales personalizados como XML\nen una nueva ventana',
- 'Import tools...':
- 'Herramientas de importaci\u00F3n...',
+ 'Import tools':
+ 'Herramientas de importaci\u00F3n',
'load the official library of\npowerful blocks':
'cargar la biblioteca oficial de\nbloques poderosos',
diff --git a/lang-fr.js b/lang-fr.js
index d554965..b545185 100644
--- a/lang-fr.js
+++ b/lang-fr.js
@@ -587,7 +587,7 @@ SnapTranslator.dict.fr = {
// menus
// snap menu
'About...':
- 'A propos de Snap! ...',
+ 'A propos de Snap!...',
'Snap! website':
'Snap! le site web',
'Download source':
@@ -618,13 +618,13 @@ SnapTranslator.dict.fr = {
'importer un projet export\u00E9,\nune biblioth\u00E8que de '
+ 'blocs\n'
+ 'un costume ou un son',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Exporter le projet comme texte...',
'Export project...':
'Exporter le projet...',
'show project data as XML\nin a new browser window':
'ouvrir le projet au format XML\ndans une nouvelle fen\u00EAtre de votre navigateur',
- 'Export blocks ...':
+ 'Export blocks...':
'Exporter les blocs ',
'show global custom block definitions as XML\nin a new browser window':
'montrer les d\u00E9finitions de bloc global personnalis\u00E9 au format XML \ndans une nouvelle fen\u00EAtre de navigateur',
diff --git a/lang-it.js b/lang-it.js
index c86a7cc..44111aa 100644
--- a/lang-it.js
+++ b/lang-it.js
@@ -634,18 +634,18 @@ SnapTranslator.dict.it = {
'carica un file di progetto,\nuna libreria di blocchi,'
+ '\nun costume o un suono esportati'
+ '\n\nNon supportato da tutti i browser',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Esporta il progetto come un file di testo...',
'Export project...':
'Esporta il progetto...',
'show project data as XML\nin a new browser window':
'mostra i dati del progetto in formato XML\nin una nuova finestra del browser',
- 'Export blocks ...':
+ 'Export blocks...':
'Esporta blocchi...',
'show global custom block definitions as XML\nin a new browser window':
'mostra in formato XML le definizione dei nuovi blocchi\nin una nuova finestra del browser',
- 'Import tools...':
- 'Importa tools...',
+ 'Import tools':
+ 'Importa tools',
'load the official library of\npowerful blocks':
'carica la libreria ufficiale di\nblocchi Snap',
diff --git a/lang-ja.js b/lang-ja.js
index 56e1f3b..ad80e91 100755
--- a/lang-ja.js
+++ b/lang-ja.js
@@ -632,18 +632,18 @@ SnapTranslator.dict.ja = {
'チェックするとレポーターをドラッグ&ドロップするとき\n'
+ '空のレポーターにフォーカスします\n\n'
+ 'いくつかのブラウザーではサポートされません',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'テキストファイルとしてプロジェクトを書き出す...',
'Export project...':
'プロジェクトを書き出す...',
'show project data as XML\nin a new browser window':
'プロジェクトのデータをXMLとして\nブラウザの新しいウインドウに表示する',
- 'Export blocks ...':
+ 'Export blocks...':
'ブロックを書き出す...',
'show global custom block definitions as XML\nin a new browser window':
'グローバルカスタムブロックの定義をXMLとして\nブラウザの新しいウインドウに表示する',
- 'Import tools...':
- 'ツールを読み込む...',
+ 'Import tools':
+ 'ツールを読み込む',
'load the official library of\npowerful blocks':
'強力なブロックの公式\nライブラリを読み込む',
diff --git a/lang-ja_HIRA.js b/lang-ja_HIRA.js
index d42ecfb..f017f93 100755
--- a/lang-ja_HIRA.js
+++ b/lang-ja_HIRA.js
@@ -632,18 +632,18 @@ SnapTranslator.dict.ja_HIRA = {
'チェックするとレポーターをドラッグ&ドロップするとき\n'
+ 'そらのレポーターにフォーカスします\n\n'
+ 'いくつかのブラウザーではサポートされません',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'テキストファイルとしてプロジェクトをかきだす...',
'Export project...':
'プロジェクトをかきだす...',
'show project data as XML\nin a new browser window':
'プロジェクトのデータをXMLとして\nブラウザのあたらしいウインドウにひょうじする',
- 'Export blocks ...':
+ 'Export blocks...':
'ブロックをかきだす...',
'show global custom block definitions as XML\nin a new browser window':
'グローバルカスタムブロックのていぎをXMLとして\nブラウザのあたらしいウインドウにひょうじする',
- 'Import tools...':
- 'ツールをよみこむ...',
+ 'Import tools':
+ 'ツールをよみこむ',
'load the official library of\npowerful blocks':
'きょうりょくなブロックのこうしき\nライブラリをよみこむ',
diff --git a/lang-ko.js b/lang-ko.js
index 955d30b..a1e50eb 100644
--- a/lang-ko.js
+++ b/lang-ko.js
@@ -618,13 +618,13 @@ SnapTranslator.dict.ko = {
'내보낸 프로젝트 파일, 블록 라이브러리\n'
+ '스프라이트 모양 또는 소리를 가져옵니다.\n\n'
+ '일부 웹브라우저에서는 지원되지 않습니다.',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'프로젝트를 텍스트 파일로 내보내기...',
'Export project...':
'프로젝트 내보내기...',
'show project data as XML\nin a new browser window':
'프로젝트 데이터를\n새로운 윈도우에 XML 형태로 보여주기',
- 'Export blocks ...':
+ 'Export blocks...':
'블록 내보내기...',
'show global custom block definitions as XML\nin a new browser window':
'새롭게 정의한 전역 블록 데이터를\n새로운 윈도우에 XML 형태로 보여주기',
diff --git a/lang-pt.js b/lang-pt.js
index b964a7c..679a0bf 100755
--- a/lang-pt.js
+++ b/lang-pt.js
@@ -639,18 +639,18 @@ SnapTranslator.dict.pt = {
'Importar para este projecto\num projecto exportado,\n'
+ 'uma biblioteca de blocos,\n'
+ 'um traje ou um som.',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Exportar este projecto como texto simples…',
'Export project...':
'Exportar este projecto…',
'show project data as XML\nin a new browser window':
'Mostrar os dados do projecto no\nformato XML numa nova janela do navegador.',
- 'Export blocks ...':
+ 'Export blocks...':
'Exportar blocos deste projecto…',
'show global custom block definitions as XML\nin a new browser window':
'Mostrar as definições de blocos\npersonalizados globais no formato\nXML numa nova janela do navegador.',
- 'Import tools...':
- 'Importar as ferramentas oficiais para este projecto…',
+ 'Import tools':
+ 'Importar as ferramentas oficiais para este projecto',
'load the official library of\npowerful blocks':
'Importar para este projecto\na biblioteca oficial de blocos.',
diff --git a/lang-ru.js b/lang-ru.js
index fc334b6..45a0870 100644
--- a/lang-ru.js
+++ b/lang-ru.js
@@ -613,18 +613,18 @@ SnapTranslator.dict.ru = {
'Импорт...',
'file menu import hint':
'загрузить экспортированный проект\nили библиотеку блоков, маску или звук',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Экспорт проект как текстовый файл...',
'Export project...':
'Экспорт проект...',
'show project data as XML\nin a new browser window':
'представить проектные данные как XML\nв новом окне браузера',
- 'Export blocks ...':
+ 'Export blocks...':
'Экспорт блоки...',
'show global custom block definitions as XML\nin a new browser window':
'представить определения глобальных пользовательских блоков как XML\nв новом окне браузера',
- 'Import tools...':
- 'Импорт сервисные ср-ва...',
+ 'Import tools':
+ 'Импорт сервисные ср-ва',
'load the official library of\npowerful blocks':
'загрузить служебную библиотеку блоков',
diff --git a/lang-si.js b/lang-si.js
index d5fa36f..8985286 100644
--- a/lang-si.js
+++ b/lang-si.js
@@ -610,13 +610,13 @@ SnapTranslator.dict.si = {
'Nalaganje izvo\u017Eenega projekta,\nknji\u017Enice z '
+ 'bloki\n'
+ 'obleko ali zvokom',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'Izvozi projekt kot navadno besedilo...',
'Export project...':
'Izvozi projekt...',
'show project data as XML\nin a new browser window':
'Prikaz projekta kot XML\nv novem oknu brkljalnika',
- 'Export blocks ...':
+ 'Export blocks...':
'Izvozi bloke',
'show global custom block definitions as XML\nin a new browser window':
'Prikaz definicij globalnih lastnih blokov kot XML\nv novem oknu brkljalnika',
diff --git a/lang-zh.js b/lang-zh.js
index b4d75b8..71bff59 100644
--- a/lang-zh.js
+++ b/lang-zh.js
@@ -636,18 +636,18 @@ SnapTranslator.dict.zh = {
'当你拖动到系统,注意查看检查报告\n'
+ '要注意检查报告为空\n\n'
+ '有一些浏览器不支持这一功能',
- 'Export project as plain text ...':
+ 'Export project as plain text...':
'纯文本格式导出项目...',
'Export project...':
'导出项目...',
'show project data as XML\nin a new browser window':
'新浏览窗以XML格式显示项目',
- 'Export blocks ...':
+ 'Export blocks...':
'导出程序块...',
'show global custom block definitions as XML\nin a new browser window':
'新浏览窗以XML格式显示全局自定义程序块',
- 'Import tools...':
- '导入工具包...',
+ 'Import tools':
+ '导入工具包',
'load the official library of\npowerful blocks':
'载入官方库和强大的程序块',
diff --git a/lists.js b/lists.js
index 7382840..ac85b25 100644
--- a/lists.js
+++ b/lists.js
@@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph,
StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph,
MenuMorph, snapEquals, Morph, isNil, localize*/
-modules.lists = '2013-April-12';
+modules.lists = '2013-April-23';
var List;
var ListWatcherMorph;
@@ -345,11 +345,11 @@ ListWatcherMorph.prototype.cellColor =
// ListWatcherMorph instance creation:
-function ListWatcherMorph(list) {
- this.init(list);
+function ListWatcherMorph(list, parentCell) {
+ this.init(list, parentCell);
}
-ListWatcherMorph.prototype.init = function (list) {
+ListWatcherMorph.prototype.init = function (list, parentCell) {
var myself = this;
this.list = list || new List();
@@ -357,6 +357,7 @@ ListWatcherMorph.prototype.init = function (list) {
this.range = 100;
this.lastUpdated = Date.now();
this.lastCell = null;
+ this.parentCell = parentCell || null; // for circularity detection
// elements declarations
this.label = new StringMorph(
@@ -434,6 +435,7 @@ ListWatcherMorph.prototype.update = function (anyway) {
starttime, maxtime = 1000;
this.frame.contents.children.forEach(function (m) {
+
if (m instanceof CellMorph
&& m.contentsMorph instanceof ListWatcherMorph) {
m.contentsMorph.update();
@@ -529,7 +531,8 @@ ListWatcherMorph.prototype.update = function (anyway) {
cell = new CellMorph(
this.list.at(idx),
this.cellColor,
- idx
+ idx,
+ this.parentCell
);
button = new PushButtonMorph(
this.list.remove,
diff --git a/objects.js b/objects.js
index dc47375..1b7027f 100644
--- a/objects.js
+++ b/objects.js
@@ -120,7 +120,7 @@ PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
-modules.objects = '2013-April-19';
+modules.objects = '2013-April-23';
var SpriteMorph;
var StageMorph;
@@ -1675,7 +1675,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
new VariableDialogMorph(
null,
function (pair) {
- if (pair) {
+ if (pair && !myself.variables.silentFind(pair[0])) {
myself.addVariable(pair[0], pair[1]);
myself.toggleVariableWatcher(pair[0], pair[1]);
myself.blocksCache[cat] = null;
@@ -3796,7 +3796,7 @@ StageMorph.prototype.blockTemplates = function (category) {
new VariableDialogMorph(
null,
function (pair) {
- if (pair) {
+ if (pair && !myself.variables.silentFind(pair[0])) {
myself.addVariable(pair[0], pair[1]);
myself.toggleVariableWatcher(pair[0], pair[1]);
myself.blocksCache[cat] = null;
@@ -4805,16 +4805,17 @@ CellMorph.uber = BoxMorph.prototype;
// CellMorph instance creation:
-function CellMorph(contents, color, idx) {
- this.init(contents, color, idx);
+function CellMorph(contents, color, idx, parentCell) {
+ this.init(contents, color, idx, parentCell);
}
-CellMorph.prototype.init = function (contents, color, idx) {
+CellMorph.prototype.init = function (contents, color, idx, parentCell) {
this.contents = (contents === 0 ? 0
: contents === false ? false
: contents || '');
this.isEditable = isNil(idx) ? false : true;
this.idx = idx || null; // for list watchers
+ this.parentCell = parentCell || null; // for list circularity detection
CellMorph.uber.init.call(
this,
SyntaxElementMorph.prototype.corner,
@@ -4842,6 +4843,17 @@ CellMorph.prototype.normal = function () {
this.changed();
};
+// CellMorph circularity testing:
+
+
+CellMorph.prototype.isCircular = function (list) {
+ if (!this.parentCell) {return false; }
+ if (list instanceof List) {
+ return this.contents === list || this.parentCell.isCircular(list);
+ }
+ return this.parentCell.isCircular(this.contents);
+};
+
// CellMorph layout:
CellMorph.prototype.fixLayout = function () {
@@ -4914,8 +4926,23 @@ CellMorph.prototype.drawNew = function () {
this.contentsMorph.silentSetHeight(img.height);
this.contentsMorph.image = img;
} else if (this.contents instanceof List) {
- this.contentsMorph = new ListWatcherMorph(this.contents);
- this.contentsMorph.isDraggable = false;
+ if (this.isCircular()) {
+ this.contentsMorph = new TextMorph(
+ '(...)',
+ fontSize,
+ null,
+ false, // bold
+ true, // italic
+ 'center'
+ );
+ this.contentsMorph.setColor(new Color(255, 255, 255));
+ } else {
+ this.contentsMorph = new ListWatcherMorph(
+ this.contents,
+ this
+ );
+ this.contentsMorph.isDraggable = false;
+ }
} else {
this.contentsMorph = new TextMorph(
!isNil(this.contents) ? this.contents.toString() : '',