From ba5f644f1d2b60601e8b4f41d02382afaa010c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Sat, 1 Apr 2017 23:16:23 +0200 Subject: [PATCH 01/48] Bugfix: install v,vh,list files from the collection blocks --- app/scripts/services/tools.js | 42 +++++++++++++++-------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/app/scripts/services/tools.js b/app/scripts/services/tools.js index 0d698e21d..6b4206fe6 100644 --- a/app/scripts/services/tools.js +++ b/app/scripts/services/tools.js @@ -804,30 +804,17 @@ angular.module('icestudio') origName: data[1], blocks: [], examples: [], locale: [], package: '' }; } - data = zipEntry.entryName.match(/^([^\/]+)\/blocks\/.*\.ice$/); - if (data) { - _collections[data[1]].blocks.push(zipEntry.entryName); - } - data = zipEntry.entryName.match(/^([^\/]+)\/examples\/.*\.ice$/); - if (data) { - _collections[data[1]].examples.push(zipEntry.entryName); - } - data = zipEntry.entryName.match(/^([^\/]+)\/examples\/.*\.v$/); - if (data) { - _collections[data[1]].examples.push(zipEntry.entryName); - } - data = zipEntry.entryName.match(/^([^\/]+)\/examples\/.*\.vh$/); - if (data) { - _collections[data[1]].examples.push(zipEntry.entryName); - } - data = zipEntry.entryName.match(/^([^\/]+)\/examples\/.*\.list$/); - if (data) { - _collections[data[1]].examples.push(zipEntry.entryName); - } - data = zipEntry.entryName.match(/^([^\/]+)\/locale\/.*\.po$/); - if (data) { - _collections[data[1]].locale.push(zipEntry.entryName); - } + + addCollectionItem('blocks', 'ice', _collections, zipEntry); + addCollectionItem('blocks', 'v', _collections, zipEntry); + addCollectionItem('blocks', 'vh', _collections, zipEntry); + addCollectionItem('blocks', 'list', _collections, zipEntry); + addCollectionItem('examples', 'ice', _collections, zipEntry); + addCollectionItem('examples', 'v', _collections, zipEntry); + addCollectionItem('examples', 'vh', _collections, zipEntry); + addCollectionItem('examples', 'list', _collections, zipEntry); + addCollectionItem('locale', 'po', _collections, zipEntry); + data = zipEntry.entryName.match(/^([^\/]+)\/package\.json$/); if (data) { _collections[data[1]].package = zipEntry.entryName; @@ -841,6 +828,13 @@ angular.module('icestudio') return _collections; } + function addCollectionItem(key, ext, collections, zipEntry) { + var data = zipEntry.entryName.match(RegExp('^([^\/]+)\/' + key + '\/.*\.' + ext + '$')); + if (data) { + collections[data[1]][key].push(zipEntry.entryName); + } + } + function installCollection(collection, zip) { var i, dest = ''; var pattern = RegExp('^' + collection.origName); From e80c2f5f7c8ca69fe2f8ac519f7095fa501f7634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Sun, 2 Apr 2017 00:00:59 +0200 Subject: [PATCH 02/48] Bugfix: add Python32.msi in the win32 installer --- gruntfile.js | 15 +++++++++++---- scripts/windows_installer.nsi | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index 762cb94da..9714a8bac 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -16,7 +16,7 @@ module.exports = function(grunt) { platforms = ['linux32', 'linux64', 'win32', 'win64']; options = { scope: ['devDependencies'] }; distCommands = ['compress:linux32', 'compress:linux64', 'appimage:linux32', 'appimage:linux64', - 'compress:win32', 'compress:win64', 'wget:python', 'exec:nsis32', 'exec:nsis64']; + 'compress:win32', 'compress:win64', 'wget:python32', 'wget:python64', 'exec:nsis32', 'exec:nsis64']; } function all(dir) { @@ -56,8 +56,8 @@ module.exports = function(grunt) { exec: { nw: 'nw app' + (WIN32 ? '' : ' 2>/dev/null'), stopNW: (WIN32 ? 'taskkill /F /IM nw.exe >NUL 2>&1' : 'killall nw 2>/dev/null || killall nwjs 2>/dev/null') + ' || (exit 0)', - nsis32: 'makensis -DARCH=win32 -DVERSION=<%=pkg.version%> -V3 scripts/windows_installer.nsi', - nsis64: 'makensis -DARCH=win64 -DVERSION=<%=pkg.version%> -V3 scripts/windows_installer.nsi' + nsis32: 'makensis -DARCH=win32 -DPYTHON="python-2.7.13.msi" -DVERSION=<%=pkg.version%> -V3 scripts/windows_installer.nsi', + nsis64: 'makensis -DARCH=win64 -DPYTHON="python-2.7.13.amd64.msi" -DVERSION=<%=pkg.version%> -V3 scripts/windows_installer.nsi' }, // Reads HTML for usemin blocks to enable smart builds that automatically @@ -315,7 +315,14 @@ module.exports = function(grunt) { // Wget: Python installer and Default collection wget: { - python: { + python32: { + options: { + overwrite: false + }, + src: 'https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi', + dest: 'cache/python/python-2.7.13.msi' + }, + python64: { options: { overwrite: false }, diff --git a/scripts/windows_installer.nsi b/scripts/windows_installer.nsi index cf9158898..81cb7344c 100755 --- a/scripts/windows_installer.nsi +++ b/scripts/windows_installer.nsi @@ -8,7 +8,9 @@ !define DIST "..\dist" !define CACHE "..\cache" !define APP "${DIST}\icestudio\${ARCH}" -!define PYTHON "python-2.7.13.amd64.msi" +!ifndef PYTHON + !define PYTHON "python-2.7.13.amd64.msi" +!endif !define PYPATH "${CACHE}\python\${PYTHON}" !define ICON "${APP}\resources\images\icestudio-logo.ico" From 402536f61f1c418aff9160b5d9d0074da6815089 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Sun, 2 Apr 2017 04:45:19 +0200 Subject: [PATCH 03/48] Update eu_ES.po --- app/resources/locale/eu_ES/eu_ES.po | 31 ++++++++++++----------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/app/resources/locale/eu_ES/eu_ES.po b/app/resources/locale/eu_ES/eu_ES.po index becd02cdb..6bbf08b85 100644 --- a/app/resources/locale/eu_ES/eu_ES.po +++ b/app/resources/locale/eu_ES/eu_ES.po @@ -133,7 +133,7 @@ msgstr "Python egiaztatu..." #: app/scripts/services/drivers.js:104 msgid "Click here to install it" -msgstr "" +msgstr "Instalatzeko hemen klik egin" #: app/views/menu.html:334 msgid "Code" @@ -145,11 +145,11 @@ msgstr "Bilduma" #: app/views/menu.html:165 msgid "Collection info" -msgstr "" +msgstr "Bildumaren informazioa" #: app/scripts/controllers/menu.js:436 msgid "Collection {{collection}} info not defined" -msgstr "" +msgstr "{{collection}} bildumaren informazioa zehaztuta gabe dago" #: app/scripts/services/tools.js:773 msgid "Collection {{name}} added" @@ -257,11 +257,11 @@ msgstr "Blokearen ezaugarriak bikoiztu dira" #: app/views/menu.html:78 msgid "Edit" -msgstr "Editatu" +msgstr "Aldatu" #: app/scripts/services/tools.js:748 msgid "Edit the collection name" -msgstr "" +msgstr "Bildumaren izena aldatu" #: app/views/menu.html:121 app/views/menu.html:247 msgid "Enable" @@ -297,8 +297,7 @@ msgstr "Parametroak sar itzazu" #: app/scripts/controllers/menu.js:328 msgid "Enter the remote hostname user@host (experimental)" -msgstr "" -"Urrutiko ostalariaren izena sar ezazu erabiltzailea@host (esperimentala)" +msgstr "Urrutiko ostalariaren izena sar ezazu erabiltzailea@host (esperimentala)" #: app/scripts/services/tools.js:504 msgid "Error: default toolchain not found in '{{dir}}'" @@ -310,7 +309,7 @@ msgstr "Errorea: {{error}}" #: app/scripts/services/tools.js:336 msgid "Errors detected in the code" -msgstr "" +msgstr "Kodean erroreak aurkitu dira" #: app/views/menu.html:39 msgid "Examples" @@ -426,14 +425,11 @@ msgstr "Pull up konexio baliogabea:
blokea dagoeneko konektatua dago" #: app/scripts/services/graph.js:193 msgid "Invalid Pull up connection:
only Input blocks allowed" -msgstr "" -"Pull up konexio baliogabea:
sarrera blokeak soilik dira " -"onargarriak" +msgstr "Pull up konexio baliogabea:
sarrera blokeak soilik dira onargarriak" #: app/scripts/services/graph.js:185 msgid "Invalid block connection:
Pull up already connected" -msgstr "" -"Bloke konexio baliogabeak:
Pull up -a dagoeneko konektatua dago" +msgstr "Bloke konexio baliogabeak:
Pull up -a dagoeneko konektatua dago" #: app/scripts/services/tools.js:779 msgid "Invalid collection {{name}}" @@ -454,7 +450,7 @@ msgstr "Sarrerako konexio anitzak baliogabeak" #: app/scripts/services/drivers.js:190 msgid "It is recommended to use USB 2.0 ports" -msgstr "" +msgstr "USB 2.0 atakak erabiltzea gomendatzen da" #: app/views/menu.html:134 msgid "Language" @@ -518,7 +514,7 @@ msgstr "Itsatsi" #: app/scripts/services/utils.js:872 msgid "Please run: {{cmd}}" -msgstr "" +msgstr "Mesedez {{cmd}} exekutatu" #: app/views/menu.html:108 msgid "Preferences" @@ -641,8 +637,7 @@ msgstr "Toolchain-a ezabatuko da. Jarraitu nahi al duzu?" #: app/scripts/services/tools.js:497 msgid "The toolchain will be restored to default. Do you want to continue?" -msgstr "" -"Toolchain-aren jatorrizko balioak berrezarriko dira. Jarraitu nahi al duzu?" +msgstr "Toolchain-aren jatorrizko balioak berrezarriko dira. Jarraitu nahi al duzu?" #: app/scripts/services/tools.js:489 msgid "" @@ -800,7 +795,7 @@ msgstr "Egiaztapena hasi ..." #: app/scripts/services/drivers.js:103 app/scripts/services/utils.js:847 msgid "{{app}} is required." -msgstr "" +msgstr "{{app}} behar da" #: app/scripts/controllers/menu.js:398 msgid "{{board}} datasheet not defined" From 79248fb853c516ce015d7947b26d88c6fa3ae57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Mon, 3 Apr 2017 11:33:34 +0200 Subject: [PATCH 04/48] Improve selected board/collection initialization --- README.md | 2 +- app/scripts/app.js | 13 +++++++++---- app/scripts/controllers/menu.js | 8 -------- app/scripts/services/utils.js | 13 +++++++++---- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 657564239..41e7a237a 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ npm run dist | English | ![Progress](http://progressed.io/bar/100) | | Spanish | ![Progress](http://progressed.io/bar/100) | | Galician | ![Progress](http://progressed.io/bar/95) | -| Basque | ![Progress](http://progressed.io/bar/95) | +| Basque | ![Progress](http://progressed.io/bar/100) | | Catalan | ![Progress](http://progressed.io/bar/95) | | French | ![Progress](http://progressed.io/bar/95) | diff --git a/app/scripts/app.js b/app/scripts/app.js index 9cc6f1dea..4c5867285 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -31,9 +31,14 @@ angular // Load collections collections.loadCollections(); // Load language - utils.loadLanguage(profile); - - setTimeout(function() { + utils.loadLanguage(profile, function() { + // Initialize selected board + var selectedBoard = boards.selectBoard(profile.get('board')).name; + profile.set('board', selectedBoard); + // Initialize selected collection + var selectedCollection = collections.selectCollection(profile.get('collection')); + profile.set('collection', selectedCollection); + // Initialize title project.updateTitle(gettextCatalog.getString('Untitled')); - }, 200); + }); }); diff --git a/app/scripts/controllers/menu.js b/app/scripts/controllers/menu.js index a46ddd979..5570d6e4f 100644 --- a/app/scripts/controllers/menu.js +++ b/app/scripts/controllers/menu.js @@ -34,10 +34,6 @@ angular.module('icestudio') var zeroProject = true; // New project without changes - // Initialize - updateSelectedBoard(); - updateSelectedCollection(); - // Window events var win = gui.Window.get(); win.on('close', function() { @@ -478,10 +474,6 @@ angular.module('icestudio') } }; - function updateSelectedBoard() { - profile.set('board', boards.selectBoard(profile.get('board')).name); - } - //-- Tools diff --git a/app/scripts/services/utils.js b/app/scripts/services/utils.js index 16e547cb9..b87e9299c 100644 --- a/app/scripts/services/utils.js +++ b/app/scripts/services/utils.js @@ -341,7 +341,7 @@ angular.module('icestudio') return fileTree; } - this.setLocale = function(locale) { + this.setLocale = function(locale, callback) { // Update current locale format locale = splitLocale(locale); // Load supported languages @@ -359,6 +359,11 @@ angular.module('icestudio') gettextCatalog.loadRemote(filepath); } } + if (callback) { + setTimeout(function() { + callback(); + }, 50); + } // Return the best language return bestLang; }; @@ -1034,18 +1039,18 @@ angular.module('icestudio') return evt.ctrlKey; }; - this.loadLanguage = function(profile) { + this.loadLanguage = function(profile, callback) { var self = this; profile.load(function() { var lang = profile.get('language'); if (lang) { - self.setLocale(lang); + self.setLocale(lang, callback); } else { // If lang is empty, use the system language nodeLangInfo(function(err, sysLang) { if (!err) { - profile.set('language', self.setLocale(sysLang)); + profile.set('language', self.setLocale(sysLang, callback)); } }); } From 2735db8afefe6da50a34823492e46eca508df78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Mon, 3 Apr 2017 12:11:43 +0200 Subject: [PATCH 05/48] Rearrange collections content when lang changes --- app/scripts/controllers/menu.js | 2 ++ app/scripts/services/collections.js | 32 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/app/scripts/controllers/menu.js b/app/scripts/controllers/menu.js index 5570d6e4f..f808b310d 100644 --- a/app/scripts/controllers/menu.js +++ b/app/scripts/controllers/menu.js @@ -349,6 +349,8 @@ angular.module('icestudio') graph.loadDesign(project.get('design'), { disabled: false }); //alertify.success(gettextCatalog.getString('Language {{name}} selected', { name: utils.bold(language) })); }); + // Rearrange the collections content + collections.sort(); } }; diff --git a/app/scripts/services/collections.js b/app/scripts/services/collections.js index 41cf266bf..579b07ca0 100644 --- a/app/scripts/services/collections.js +++ b/app/scripts/services/collections.js @@ -3,6 +3,7 @@ angular.module('icestudio') .service('collections', function(utils, common, + gettextCatalog, nodePath) { const DEFAULT = ''; @@ -85,4 +86,35 @@ angular.module('icestudio') return selectedCollection.name; }; + this.sort = function() { + for (var i in common.collections) { + var collection = common.collections[i]; + if (collection.content) { + _sort(collection.content.blocks); + _sort(collection.content.examples); + } + } + }; + + function _sort(items) { + if (items) { + items.sort(byName); + for (var i in items) { + _sort(items[i].children); + } + } + } + + function byName(a, b) { + a = gettextCatalog.getString(a.name); + b = gettextCatalog.getString(b.name); + if (a > b) { + return 1; + } + if (a < b) { + return -1; + } + return 0; + } + }); From 562646d0aa73da3627c521f4b273c5264655726d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Mon, 3 Apr 2017 18:22:28 +0200 Subject: [PATCH 06/48] Bugfix: verilog errors detection in Windows --- app/scripts/services/tools.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/scripts/services/tools.js b/app/scripts/services/tools.js index 6b4206fe6..1ae6fa88c 100644 --- a/app/scripts/services/tools.js +++ b/app/scripts/services/tools.js @@ -271,7 +271,7 @@ angular.module('icestudio') // main.v:#: error: ... // main.v:#: warning: ... // main.v:#: syntax error - re = /main.v:([0-9]+):\s(error|warning):\s(.*?)\n/g; + re = /main.v:([0-9]+):\s(error|warning):\s(.*?)[\r|\n]/g; while (matchError = re.exec(stdout)) { codeErrors.push({ line: parseInt(matchError[1]), @@ -279,7 +279,7 @@ angular.module('icestudio') type: matchError[2] }); } - re = /main.v:([0-9]+):\ssyntax\serror\n/g; + re = /main.v:([0-9]+):\ssyntax\serror[\r|\n]/g; while (matchError = re.exec(stdout)) { codeErrors.push({ line: parseInt(matchError[1]), @@ -289,9 +289,9 @@ angular.module('icestudio') } // - Yosys errors - // ERROR: ... main.v:#...\n - // Warning: ... main.v:#...\n - re = /(ERROR|Warning):\s(.*?)\smain\.v:([0-9]+)(.*?)\n/g; + // ERROR: ... main.v:#... + // Warning: ... main.v:#... + re = /(ERROR|Warning):\s(.*?)\smain\.v:([0-9]+)(.*?)[\r|\n]/g; while (matchError = re.exec(stdout)) { var msg = ''; var line = parseInt(matchError[3]); From 4a8f36c31a42cb2d9e3ab0759ec9b3c54cf23c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Thu, 6 Apr 2017 18:48:35 +0200 Subject: [PATCH 07/48] Bugfix: update rules on board change. Update svgPanZoom target --- app/scripts/services/graph.js | 48 ++++++++++++++++++++++------------- app/scripts/services/utils.js | 5 ++-- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/app/scripts/services/graph.js b/app/scripts/services/graph.js index 7704f98f1..e14ba2980 100644 --- a/app/scripts/services/graph.js +++ b/app/scripts/services/graph.js @@ -251,7 +251,6 @@ angular.module('icestudio') this.panAndZoom = svgPanZoom(targetElement.childNodes[0], { - viewportSelector: targetElement.childNodes[0].childNodes[0], fit: false, center: false, zoomEnabled: true, @@ -260,11 +259,11 @@ angular.module('icestudio') dblClickZoomEnabled: false, minZoom: ZOOM_MIN, maxZoom: ZOOM_MAX, + eventsListenerElement: targetElement, /*beforeZoom: function(oldzoom, newzoom) { },*/ onZoom: function(scale) { state.zoom = scale; // Already rendered in pan - // Close expanded combo if (document.activeElement.className === 'select2-search__field') { $('select').select2('close'); @@ -693,7 +692,7 @@ angular.module('icestudio') }; function resetBlocks() { - var data; + var data, connectedLinks; var cells = graph.getCells(); _.each(cells, function(cell) { if (cell.isLink()) { @@ -710,32 +709,47 @@ angular.module('icestudio') else if (type === 'basic.code') { // Reset rules in Code block ports data = utils.clone(cell.get('data')); + connectedLinks = graph.getConnectedLinks(cell); if (data && data.ports && data.ports.in) { - for (var j in data.ports.in) { - var port = data.ports.in[j]; - port.default = utils.hasInputRule(port.name); - } + _.each(data.ports.in, function(port) { + var connected = false; + _.each(connectedLinks, function(connectedLink) { + if (connectedLink.get('target').port === port.name) { + connected = true; + return false; + } + }); + port.default = utils.hasInputRule(port.name, !connected); + cell.set('data', data); + paper.findViewByModel(cell.id).updateBox(); + }); } - cell.set('data', data); - paper.findViewByModel(cell.id).updateBox(); } else if (type.indexOf('basic.') === -1) { // Reset rules in Generic block ports var block = common.allDependencies[type]; data = { ports: { in: [] }}; - for (var i in block.design.graph.blocks) { - var item = block.design.graph.blocks[i]; - if (item.type === 'basic.input') { - if (!item.data.range) { + connectedLinks = graph.getConnectedLinks(cell); + if (block.design.graph.blocks) { + _.each(block.design.graph.blocks, function(item) { + if (item.type === 'basic.input' && !item.data.range) { + console.log(item, connectedLinks); + var connected = false; + _.each(connectedLinks, function(connectedLink) { + if (connectedLink.get('target').port === item.id) { + connected = true; + return false; + } + }); data.ports.in.push({ name: item.id, - default: utils.hasInputRule((item.data.clock ? 'clk' : '') || item.data.name) + default: utils.hasInputRule((item.data.clock ? 'clk' : '') || item.data.name, !connected) }); } - } + cell.set('data', data); + paper.findViewByModel(cell.id).updateBox(); + }); } - cell.set('data', data); - paper.findViewByModel(cell.id).updateBox(); } }); } diff --git a/app/scripts/services/utils.js b/app/scripts/services/utils.js index b87e9299c..ca68cacf4 100644 --- a/app/scripts/services/utils.js +++ b/app/scripts/services/utils.js @@ -997,7 +997,8 @@ angular.module('icestudio') return subDependencies; }; - this.hasInputRule = function(port) { + this.hasInputRule = function(port, apply) { + apply = (apply === undefined) ? true : apply; var _default; var rules = common.selectedBoard.rules; if (rules) { @@ -1006,7 +1007,7 @@ angular.module('icestudio') for (var i in allInitPorts) { if (port === allInitPorts[i].port){ _default = allInitPorts[i]; - _default.apply = true; + _default.apply = apply; break; } } From 5bb7880444f184cf4b8ae1137d33ff3fd49700d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Fri, 7 Apr 2017 12:25:48 +0200 Subject: [PATCH 08/48] Arrange collections content on init --- app/scripts/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/scripts/app.js b/app/scripts/app.js index 4c5867285..3235dba77 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -32,6 +32,8 @@ angular collections.loadCollections(); // Load language utils.loadLanguage(profile, function() { + // Rearrange collections + collections.sort(); // Initialize selected board var selectedBoard = boards.selectBoard(profile.get('board')).name; profile.set('board', selectedBoard); From 65c2ed7e7a7b23571ceba798aea6345c7e7ba44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Fri, 7 Apr 2017 12:28:54 +0200 Subject: [PATCH 09/48] Enable code/info wheel-scroll if selected, else Zoom --- app/scripts/graphics/joint.shapes.js | 25 +++++++++++++++++++++++++ app/scripts/services/graph.js | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index b0d4a1286..23919866a 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -929,6 +929,7 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ }, undoGroupingInterval); // Reset counter self.counter = Date.now(); + self.editor.resize(); } }); this.editor.on('focus', function() { @@ -950,6 +951,17 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ e.text = ''; } }); + this.editor.on('mousewheel', function(event) { + // Stop mousewheel event propagation when target is active + if (document.activeElement.className === 'ace_text-input') { // TODO: is the same code block? + // Enable only scroll + event.stopPropagation(); + } + else { + // Enable only zoom + event.stopImmediatePropagation(); + } + }); this.setupResizer(); @@ -1122,6 +1134,7 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ ' + editorLabel + '.setTheme("ace/theme/chrome");\ ' + editorLabel + '.renderer.setShowGutter(false);\ ' + editorLabel + '.setHighlightActiveLine(false);\ + ' + editorLabel + '.setShowPrintMargin(false);\ ' + editorLabel + '.setAutoScrollEditorIntoView(true);\ \
\ @@ -1171,6 +1184,7 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ }, undoGroupingInterval); // Reset counter self.counter = Date.now(); + self.editor.resize(); } }); this.editor.on('focus', function() { @@ -1192,6 +1206,17 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ e.text = ''; } }); + this.editor.on('mousewheel', function(event) { + // Stop mousewheel event propagation when target is active + if (document.activeElement.className === 'ace_text-input') { // TODO: is the same info block? + // Enable only scroll + event.stopPropagation(); + } + else { + // Enable only zoom + event.stopImmediatePropagation(); + } + }); this.setupResizer(); diff --git a/app/scripts/services/graph.js b/app/scripts/services/graph.js index e14ba2980..953fb8595 100644 --- a/app/scripts/services/graph.js +++ b/app/scripts/services/graph.js @@ -247,7 +247,7 @@ angular.module('icestudio') } } - var targetElement= element[0]; + var targetElement = element[0]; this.panAndZoom = svgPanZoom(targetElement.childNodes[0], { From 4050e773e580502f7f0685fd1b44c958621a1160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Fri, 7 Apr 2017 12:37:36 +0200 Subject: [PATCH 10/48] Detect each code/info block when managing the scroll --- app/scripts/graphics/joint.shapes.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index 23919866a..5c9cceb58 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -894,10 +894,10 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ this.listenTo(this.model, 'process:ports', this.update); joint.dia.ElementView.prototype.initialize.apply(this, arguments); - var selector = this.$box.find('#' + editorLabel); + this.selector = this.$box.find('#' + editorLabel); // Prevent paper from handling pointerdown. - selector.on('mousedown click', function(event) { event.stopPropagation(); }); + this.selector.on('mousedown click', function(event) { event.stopPropagation(); }); this.deltas = []; this.counter = 0; @@ -905,7 +905,7 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ var undoGroupingInterval = 200; var self = this; - this.editor = ace.edit(selector[0]); + this.editor = ace.edit(this.selector[0]); this.editor.$blockScrolling = Infinity; this.editor.commands.removeCommand('undo'); this.editor.commands.removeCommand('redo'); @@ -953,7 +953,7 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ }); this.editor.on('mousewheel', function(event) { // Stop mousewheel event propagation when target is active - if (document.activeElement.className === 'ace_text-input') { // TODO: is the same code block? + if (document.activeElement.parentNode.id === self.selector.attr('id')) { // Enable only scroll event.stopPropagation(); } @@ -1208,7 +1208,7 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ }); this.editor.on('mousewheel', function(event) { // Stop mousewheel event propagation when target is active - if (document.activeElement.className === 'ace_text-input') { // TODO: is the same info block? + if (document.activeElement.parentNode.id === self.editorSelector.attr('id')) { // Enable only scroll event.stopPropagation(); } From 1c00cadd6fec0d7022558ba5e1561ba9b5a2948f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Fri, 7 Apr 2017 12:58:57 +0200 Subject: [PATCH 11/48] Improve clock render --- app/scripts/graphics/joint.shapes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index 5c9cceb58..963d02bf7 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -550,10 +550,10 @@ joint.shapes.ice.GenericView = joint.shapes.ice.ModelView.extend({ for (var i in ports) { var port = ports[i]; if (port.clock) { - var top = Math.round((parseInt(i) + 0.5) * height / n / gridsize) * gridsize - 10; + var top = Math.round((parseInt(i) + 0.5) * height / n / gridsize) * gridsize - 9; this.$box.append('\ -
\ - \ +
\ + \
'); } } From f1c0b249b063151bd56735a3fcd084980345f72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Fri, 7 Apr 2017 13:15:57 +0200 Subject: [PATCH 12/48] Use preventDefault instead of undefined stopImmediatePropagation --- app/scripts/graphics/joint.shapes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index 963d02bf7..d1e596e52 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -959,7 +959,7 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ } else { // Enable only zoom - event.stopImmediatePropagation(); + event.preventDefault(); } }); @@ -1214,7 +1214,7 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ } else { // Enable only zoom - event.stopImmediatePropagation(); + event.preventDefault(); } }); From dd455c148f62c4b5c13a2728a2a0d1d69b1e1949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 12 Apr 2017 09:46:52 +0200 Subject: [PATCH 13/48] Enable Ctrl+U (Upload) in Code/Info blocks --- app/scripts/graphics/joint.shapes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index d1e596e52..9b5efd8da 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -909,6 +909,7 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ this.editor.$blockScrolling = Infinity; this.editor.commands.removeCommand('undo'); this.editor.commands.removeCommand('redo'); + this.editor.commands.removeCommand('touppercase'); this.editor.session.on('change', function(delta) { if (!self.updating) { // Check consecutive-change interval @@ -1164,6 +1165,7 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ this.editor.$blockScrolling = Infinity; this.editor.commands.removeCommand('undo'); this.editor.commands.removeCommand('redo'); + this.editor.commands.removeCommand('touppercase'); this.editor.session.on('change', function(delta) { if (!self.updating) { // Check consecutive-change interval From d03a3cb88e16deec943b980ca94461e202358c2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 12 Apr 2017 09:59:44 +0200 Subject: [PATCH 14/48] Improve Verify errors --- app/scripts/services/tools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/services/tools.js b/app/scripts/services/tools.js index 1ae6fa88c..722e3c226 100644 --- a/app/scripts/services/tools.js +++ b/app/scripts/services/tools.js @@ -275,7 +275,7 @@ angular.module('icestudio') while (matchError = re.exec(stdout)) { codeErrors.push({ line: parseInt(matchError[1]), - msg: matchError[3], + msg: matchError[3].replace(/\sin\smain\..*$/, ''), type: matchError[2] }); } @@ -454,7 +454,7 @@ angular.module('icestudio') newCodeError = { type: codeError.type, line: codeError.line - module.begin - ((codeError.line === module.end) ? 1 : 0), - msg: (codeError.msg.length > 2) ? codeError.msg[0].toUpperCase() + codeError.msg.substring(1) : codeError.msg + msg: codeError.msg }; if (module.name.startsWith('main_')) { // Code block From c33e3d5bb8375953cca8fb5fd1b09f63b76a5a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 12 Apr 2017 10:36:52 +0200 Subject: [PATCH 15/48] Improve tooltip width --- app/scripts/graphics/joint.shapes.js | 8 +++++++- app/styles/design.css | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index 9b5efd8da..92ecbf899 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -471,10 +471,16 @@ joint.shapes.ice.GenericView = joint.shapes.ice.ModelView.extend({ if (self.enter && !self.down) { self.tooltiptext.text(self.tooltip); self.tooltiptext.css('visibility', 'visible'); - if (self.tooltip.length > 30) { + if (self.tooltip.length > 13) { + self.tooltiptext.addClass('tooltip-medium'); + self.tooltiptext.removeClass('tooltip-large'); + } + else if (self.tooltip.length > 20) { self.tooltiptext.addClass('tooltip-large'); + self.tooltiptext.removeClass('tooltip-medium'); } else { + self.tooltiptext.removeClass('tooltip-medium'); self.tooltiptext.removeClass('tooltip-large'); } } diff --git a/app/styles/design.css b/app/styles/design.css index 95c6cbb53..6322251fc 100644 --- a/app/styles/design.css +++ b/app/styles/design.css @@ -129,6 +129,11 @@ border-color: #777 transparent transparent transparent; } +.generic-block .tooltip-medium { + width: 180px; + margin-left: -90px; +} + .generic-block .tooltip-large { width: 240px; margin-left: -120px; From 79038bc5f001ad92f0c1a69adf80e5d491d192e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 12 Apr 2017 11:44:00 +0200 Subject: [PATCH 16/48] Improve Generic ports/params sort --- app/scripts/services/project.js | 9 +++++---- app/styles/design.css | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/scripts/services/project.js b/app/scripts/services/project.js index f4afee9ad..4bf253944 100644 --- a/app/scripts/services/project.js +++ b/app/scripts/services/project.js @@ -340,16 +340,17 @@ angular.module('icestudio') function sortGraph() { var cells = graph.getCells(); - // Sort cells by x-coordinate + // Sort Constant cells by x-coordinate cells = _.sortBy(cells, function(cell) { - if (!cell.isLink()) { + if (cell.get('type') === 'ice.Constant') { return cell.attributes.position.x; } }); - // Sort cells by y-coordinate + // Sort I/O cells by y-coordinate cells = _.sortBy(cells, function(cell) { - if (!cell.isLink()) { + if (cell.get('type') === 'ice.Input' || + cell.get('type') === 'ice.Output') { return cell.attributes.position.y; } }); diff --git a/app/styles/design.css b/app/styles/design.css index 6322251fc..eef9a23e7 100644 --- a/app/styles/design.css +++ b/app/styles/design.css @@ -165,6 +165,7 @@ color: #333; text-overflow: ellipsis; overflow: hidden; + white-space: nowrap; } .virtual-port { From 3fe6fa59e63fb41029fe39ec0eecea78276d6369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 12 Apr 2017 13:13:08 +0200 Subject: [PATCH 17/48] Improve wires and Zoom --- app/scripts/graphics/joint.connectors.js | 4 +-- app/scripts/graphics/joint.shapes.js | 46 ++++++++++++++++++------ app/scripts/services/graph.js | 17 ++++----- app/styles/design.css | 3 -- 4 files changed, 46 insertions(+), 24 deletions(-) diff --git a/app/scripts/graphics/joint.connectors.js b/app/scripts/graphics/joint.connectors.js index 8c141240b..5bf4871c8 100644 --- a/app/scripts/graphics/joint.connectors.js +++ b/app/scripts/graphics/joint.connectors.js @@ -28,13 +28,13 @@ joint.connectors.ice = function(sourcePoint, targetPoint, vertices) { _.each(vertices, function(vertex) { dVertices.push(vertex.x, vertex.y); }); full.push(sourcePoint.x + sx, sourcePoint.y + sy); - wrap.push(sourcePoint.x, sourcePoint.y); + wrap.push(sourcePoint.x - sx, sourcePoint.y - sy); full = full.concat(dVertices); wrap = wrap.concat(dVertices); full.push(targetPoint.x + tx, targetPoint.y + ty); - wrap.push(targetPoint.x, targetPoint.y); + wrap.push(targetPoint.x - tx, targetPoint.y - ty); return { full: full.join(' '), diff --git a/app/scripts/graphics/joint.shapes.js b/app/scripts/graphics/joint.shapes.js index 92ecbf899..85f1dc6a9 100644 --- a/app/scripts/graphics/joint.shapes.js +++ b/app/scripts/graphics/joint.shapes.js @@ -43,8 +43,7 @@ joint.shapes.ice.Model = joint.shapes.basic.Generic.extend({ '.body': { width: 1, height: 1, - stroke: 'none', - 'fill-opacity': 0 + stroke: 'none' }, '.port-body': { r: 8, @@ -936,7 +935,6 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ }, undoGroupingInterval); // Reset counter self.counter = Date.now(); - self.editor.resize(); } }); this.editor.on('focus', function() { @@ -1063,6 +1061,13 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ this.editor.resize(); } + // Update gutter + //console.log($('.ace_gutter-cell').css('padding-left'), $('.ace_scroller').css('left')); + $('.ace_scroller').css('left', Math.round(41 * state.zoom).toString() + 'px'); + $('.ace_gutter-layer').css('width', Math.round(41 * state.zoom).toString() + 'px'); + $('.ace_gutter-cell').css('padding-left', Math.round(19 * state.zoom).toString() + 'px'); + $('.ace_gutter-cell').css('padding-right', Math.round(13 * state.zoom).toString() + 'px'); + // Set ports width var width = WIRE_WIDTH * state.zoom; this.$('.port-wire').css('stroke-width', width); @@ -1192,7 +1197,6 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({ }, undoGroupingInterval); // Reset counter self.counter = Date.now(); - self.editor.resize(); } }); this.editor.on('focus', function() { @@ -1391,7 +1395,7 @@ joint.shapes.ice.Wire = joint.dia.Link.extend({ arrowheadMarkup: [ '', - '', + '', '' ].join(''), @@ -1648,6 +1652,8 @@ joint.shapes.ice.WireView = joint.dia.LinkView.extend({ } }); + var points = []; + // Update all the portWires combinations if (portWires.length > 0) { var markupTemplate = joint.util.template( @@ -1679,7 +1685,11 @@ joint.shapes.ice.WireView = joint.dia.LinkView.extend({ // Eval if intersects any segment of wire vB if (evalIntersection(vA[i], [vB[j], vB[j+1]])) { // Bifurcation found! - markersA.append(V(markupTemplate(vA[i])).node); + var point = vA[i]; + if (!contains(point, points)) { + points.push(point); + markersA.append(V(markupTemplate(point)).node); + } } } } @@ -1687,11 +1697,25 @@ joint.shapes.ice.WireView = joint.dia.LinkView.extend({ } } + function contains(point, points) { + var found = false; + _.each(points, function(p) { + if (p.x === point.x && p.y === point.y) { + found = true; + return; + } + }); + return found; + } + function v(wire) { var v = []; v.push(wire.sourcePoint); v = v.concat(wire.route); - v.push(wire.targetPoint); + v.push({ + x: wire.targetPoint.x + 9, + y: wire.targetPoint.y + }); return v; } @@ -1699,14 +1723,14 @@ joint.shapes.ice.WireView = joint.dia.LinkView.extend({ if (segment[0].x === segment[1].x) { // Vertical return ((point.x === segment[0].x) && - (point.y > Math.min(segment[0].y, segment[1].y)) && - (point.y < Math.max(segment[0].y, segment[1].y))); + (point.y > Math.min(segment[0].y, segment[1].y)) && + (point.y < Math.max(segment[0].y, segment[1].y))); } else { // Horizontal return ((point.y === segment[0].y) && - (point.x > Math.min(segment[0].x, segment[1].x)) && - (point.x < Math.max(segment[0].x, segment[1].x))); + (point.x > Math.min(segment[0].x, segment[1].x)) && + (point.x < Math.max(segment[0].x, segment[1].x))); } } } diff --git a/app/scripts/services/graph.js b/app/scripts/services/graph.js index 953fb8595..690932b1f 100644 --- a/app/scripts/services/graph.js +++ b/app/scripts/services/graph.js @@ -136,8 +136,8 @@ angular.module('icestudio') }, validateConnection: function(cellViewS, magnetS, cellViewT, magnetT, end, linkView) { // Prevent output-output links - if (magnetS.getAttribute('type') === 'output' && - magnetT.getAttribute('type') === 'output') { + if (magnetS && magnetS.getAttribute('type') === 'output' && + magnetT && magnetT.getAttribute('type') === 'output') { if (magnetS !== magnetT) { // Show warning if source and target blocks are different warning(gettextCatalog.getString('Invalid connection')); @@ -145,15 +145,15 @@ angular.module('icestudio') return false; } // Ensure right -> left connections - if (magnetS.getAttribute('pos') === 'right') { - if (magnetT.getAttribute('pos') !== 'left') { + if (magnetS && magnetS.getAttribute('pos') === 'right') { + if (magnetT && magnetT.getAttribute('pos') !== 'left') { warning(gettextCatalog.getString('Invalid connection')); return false; } } // Ensure bottom -> top connections - if (magnetS.getAttribute('pos') === 'bottom') { - if (magnetT.getAttribute('pos') !== 'top') { + if (magnetS && magnetS.getAttribute('pos') === 'bottom') { + if (magnetT && magnetT.getAttribute('pos') !== 'top') { warning(gettextCatalog.getString('Invalid connection')); return false; } @@ -263,17 +263,17 @@ angular.module('icestudio') /*beforeZoom: function(oldzoom, newzoom) { },*/ onZoom: function(scale) { - state.zoom = scale; // Already rendered in pan + state.zoom = scale; // Close expanded combo if (document.activeElement.className === 'select2-search__field') { $('select').select2('close'); } + updateCellBoxes(); }, /*beforePan: function(oldpan, newpan) { },*/ onPan: function(newPan) { state.pan = newPan; - selectionView.options.state = state; graph.trigger('state', state); updateCellBoxes(); } @@ -281,6 +281,7 @@ angular.module('icestudio') function updateCellBoxes() { var cells = graph.getCells(); + selectionView.options.state = state; _.each(cells, function(cell) { if (!cell.isLink()) { cell.attributes.state = state; diff --git a/app/styles/design.css b/app/styles/design.css index eef9a23e7..e0fed3c0f 100644 --- a/app/styles/design.css +++ b/app/styles/design.css @@ -392,9 +392,6 @@ pointer-events: auto; } -.port-body:hover { -} - .joint-highlight-stroke.joint-theme-default { display: none; } From 05caf290d805b1883b568f6b957e6edd8db02ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 19 Apr 2017 12:26:40 +0200 Subject: [PATCH 18/48] Bugfix: detect content changes --- app/scripts/graphics/joint.command.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/scripts/graphics/joint.command.js b/app/scripts/graphics/joint.command.js index abf193b96..3726f01b1 100755 --- a/app/scripts/graphics/joint.command.js +++ b/app/scripts/graphics/joint.command.js @@ -72,6 +72,7 @@ joint.dia.CommandManager = Backbone.Model.extend({ if (!cmd.batch) { this.undoStack.push(cmd); + this.changesStack.push(cmd); this.triggerChange(); this.trigger('add', cmd); } else { @@ -357,14 +358,11 @@ joint.dia.CommandManager = Backbone.Model.extend({ undo: function() { var command = this.undoStack.pop(); - if (command && command[0] && command[0].action !== 'lang') { - this.changesStack.pop(); - this.triggerChange(); - } - if (command) { this.revertCommand(command); this.redoStack.push(command); + this.changesStack.pop(); + this.triggerChange(); } }, @@ -376,8 +374,11 @@ joint.dia.CommandManager = Backbone.Model.extend({ if (command) { this.applyCommand(command); this.undoStack.push(command); - if (command && command[0] && command[0].action !== 'lang') { - this.changesStack.push(command); + if (command) { + if (!(command[0] && command[0].action === 'lang')) { + // Avoid lang changes + this.changesStack.push(command); + } this.triggerChange(); } } From b932305a7d2f9041ebbd65d578b9881250ecd7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Wed, 19 Apr 2017 12:45:41 +0200 Subject: [PATCH 19/48] Check altKey in shortcuts --- app/scripts/services/shortcuts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/scripts/services/shortcuts.js b/app/scripts/services/shortcuts.js index eff553569..013d078ed 100644 --- a/app/scripts/services/shortcuts.js +++ b/app/scripts/services/shortcuts.js @@ -18,8 +18,8 @@ angular.module('icestudio') this.execute = function(event, opt) { // Execute shortcut method // Options: - // - opt.prompt: allow shortcut when a prompt is shown - // - opt.disable: allow shortcut when the graph is disabled + // - opt.prompt: enable shortcut when a prompt is shown + // - opt.disable: enable shortcut when the graph is disabled var action = ''; var method = null; @@ -29,6 +29,7 @@ angular.module('icestudio') var options = shortcuts[action].opt || {}; var command = shortcuts[action][system]; if (event.keyCode === command.key && + event.altKey === (command.alt || false) && event.ctrlKey === (command.ctrl || false) && event.metaKey === (command.meta || false) && event.shiftKey === (command.shift || false) && From 437977cf80f3b87f1217e95c664ebeb37438be4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Tue, 9 May 2017 12:17:48 +0200 Subject: [PATCH 20/48] Update credits in Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41e7a237a..40a92d73f 100644 --- a/README.md +++ b/README.md @@ -167,9 +167,9 @@ There is a [Wishlist](https://github.com/FPGAwars/icestudio/wiki/Wishlist:-propo * v0.3, v0.2: using [JointJS](https://github.com/clientIO/joint) and [AlertifyJS](https://github.com/MohammadYounes/AlertifyJS) * v0.1: using [AngularJS-Flowchart](https://github.com/codecapers/AngularJS-FlowChart) -* [BQ](https://www.bq.com) sponsored this project from 02-2016 to 02-2017. Thanks +* [BQ](https://www.bq.com) sponsored this project from 02/2016 to 02/2017. Thanks -![](https://github.com/FPGAwars/icezum/raw/master/wiki/bq-logo.png) + ## License From b7c7ca90ac0d84a79a7bbb8863cc24a8b3fa9fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Tue, 9 May 2017 12:18:03 +0200 Subject: [PATCH 21/48] Update counter sample --- samples/counter.ice | 150 ++++++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 67 deletions(-) diff --git a/samples/counter.ice b/samples/counter.ice index 11482a286..f93d21a5e 100644 --- a/samples/counter.ice +++ b/samples/counter.ice @@ -11,31 +11,6 @@ "board": "icezum", "graph": { "blocks": [ - { - "id": "02460189-14a0-48d0-ad87-74faf9a1177e", - "type": "basic.constant", - "data": { - "name": "N", - "value": "20", - "local": false - }, - "position": { - "x": 376, - "y": 56 - } - }, - { - "id": "976c6f41-7ed1-41b5-953b-cd4a5709c701", - "type": "3e6c249e205080168c1bf4ee8dbc33b50653d5f4", - "position": { - "x": 608, - "y": 56 - }, - "size": { - "width": 96, - "height": 64 - } - }, { "id": "1a49c635-92d6-4641-bd3b-dbd7604a76bf", "type": "basic.output", @@ -74,46 +49,6 @@ "y": 136 } }, - { - "id": "e38831b6-fd92-4e35-9fea-17b439002721", - "type": "basic.code", - "data": { - "code": "// Counter 4 bits\n// @include div.v\n\nwire trig; reg out;\n\nDIV #(N) div (\n .clk(clk),\n .out(trig)\n);\n\nalways @(posedge trig) begin\n if (rst == 1)\n out <= 0;\n else if (ena == 1)\n out <= out + 1;\nend\n", - "params": [ - { - "name": "N" - } - ], - "ports": { - "in": [ - { - "name": "clk" - }, - { - "name": "ena" - }, - { - "name": "rst" - } - ], - "out": [ - { - "name": "out", - "range": "[3:0]", - "size": 4 - } - ] - } - }, - "position": { - "x": 248, - "y": 184 - }, - "size": { - "width": 352, - "height": 288 - } - }, { "id": "4c30cdb0-f1af-4af1-bb4b-12e443b84a17", "type": "basic.output", @@ -186,6 +121,87 @@ "x": 40, "y": 392 } + }, + { + "id": "02460189-14a0-48d0-ad87-74faf9a1177e", + "type": "basic.constant", + "data": { + "name": "N", + "value": "20", + "local": false + }, + "position": { + "x": 376, + "y": 56 + } + }, + { + "id": "976c6f41-7ed1-41b5-953b-cd4a5709c701", + "type": "3e6c249e205080168c1bf4ee8dbc33b50653d5f4", + "position": { + "x": 608, + "y": 56 + }, + "size": { + "width": 96, + "height": 64 + } + }, + { + "id": "e38831b6-fd92-4e35-9fea-17b439002721", + "type": "basic.code", + "data": { + "code": "// Counter 4 bits\n// @include div.v\n\nwire trig; reg out;\n\nDIV #(N) div (\n .clk(clk),\n .out(trig)\n);\n\nalways @(posedge trig) begin\n if (rst == 1)\n out <= 0;\n else if (ena == 1)\n out <= out + 1;\nend\n", + "params": [ + { + "name": "N" + } + ], + "ports": { + "in": [ + { + "name": "clk" + }, + { + "name": "ena" + }, + { + "name": "rst" + } + ], + "out": [ + { + "name": "out", + "range": "[3:0]", + "size": 4 + } + ] + } + }, + "position": { + "x": 248, + "y": 184 + }, + "size": { + "width": 352, + "height": 288 + } + }, + { + "id": "e91d0b4f-0fc5-421d-a032-e59368bc322a", + "type": "basic.info", + "data": { + "info": "Counter 4 bits\n--------------\n\nInput: Enable, Reset\nParameter: N\nOutput: LED bus", + "readonly": true + }, + "position": { + "x": 40, + "y": 56 + }, + "size": { + "width": 192, + "height": 128 + } } ], "wires": [ @@ -254,8 +270,8 @@ }, "state": { "pan": { - "x": 0, - "y": 0 + "x": 2, + "y": -0.5 }, "zoom": 1 } From 8e7216509533189f75e4b3177d4ea2479146892c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Tue, 9 May 2017 12:18:20 +0200 Subject: [PATCH 22/48] Update apio version --- app/package.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/package.json b/app/package.json index 362232782..b4a5fa461 100644 --- a/app/package.json +++ b/app/package.json @@ -18,8 +18,8 @@ "icon": "resources/images/icestudio-logo.png" }, "apio": { - "min": "0.2.2", - "max": "0.2.3" + "min": "0.2.3", + "max": "0.2.4" }, "engines": { "node": ">= 0.10.0" diff --git a/package.json b/package.json index a1fc81b9a..63cb0cf26 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "postinstall": "npmpd && cd app && npm install && bower install && cd ../tasks && npm install && cd .. && grunt getcollection" }, "apio": { - "min": "0.2.2", - "max": "0.2.3" + "min": "0.2.3", + "max": "0.2.4" }, "collection": "0.3.0-rc1", "devDependencies": { From 5831c30166815c774bd7567de451650a09978080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Tue, 9 May 2017 12:35:17 +0200 Subject: [PATCH 23/48] Using apio.external variable --- app/package.json | 5 +++-- app/scripts/services/common.js | 1 - app/scripts/services/utils.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/package.json b/app/package.json index b4a5fa461..fa3d174c3 100644 --- a/app/package.json +++ b/app/package.json @@ -12,14 +12,15 @@ "height": 620, "min_width": 800, "min_height": 200, - "toolbar": false, + "toolbar": true, "resizable": true, "position": "center", "icon": "resources/images/icestudio-logo.png" }, "apio": { "min": "0.2.3", - "max": "0.2.4" + "max": "0.2.4", + "external": "" }, "engines": { "node": ">= 0.10.0" diff --git a/app/scripts/services/common.js b/app/scripts/services/common.js index 06e2b0048..b7dbfefb8 100644 --- a/app/scripts/services/common.js +++ b/app/scripts/services/common.js @@ -55,7 +55,6 @@ angular.module('icestudio') this.ENV_PIP = nodePath.join(this.ENV_BIN_DIR, 'pip'); this.ENV_APIO = nodePath.join(this.ENV_BIN_DIR, this.WIN32 ? 'apio.exe' : 'apio'); this.APIO_CMD = (this.WIN32 ? 'set' : 'export') + ' APIO_HOME_DIR=' + this.APIO_HOME_DIR + (this.WIN32 ? '& ' : '; ') + '"' + this.ENV_APIO + '"'; - this.SYSTEM_APIO = '/usr/bin/apio'; function safeDir(_dir, self) { if (self.WIN32) { diff --git a/app/scripts/services/utils.js b/app/scripts/services/utils.js index ca68cacf4..23b7c86b4 100644 --- a/app/scripts/services/utils.js +++ b/app/scripts/services/utils.js @@ -179,11 +179,11 @@ angular.module('icestudio') this.toolchainDisabled = false; this.getApioExecutable = function() { - var candidateApio = process.env.ICESTUDIO_APIO ? process.env.ICESTUDIO_APIO : common.SYSTEM_APIO; + var candidateApio = process.env.ICESTUDIO_APIO ? process.env.ICESTUDIO_APIO : _package.apio.external; if (nodeFs.existsSync(candidateApio)) { if (!this.toolchainDisabled) { // Show message only on start - alertify.message('Using system wide apio', 5); + alertify.message('Using external apio: ' + candidateApio, 5); } this.toolchainDisabled = true; return coverPath(candidateApio); From 5931c9ae1e8065572d90749e793cff40a98ee9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Arroyo=20Torrens?= Date: Tue, 9 May 2017 12:59:08 +0200 Subject: [PATCH 24/48] Improve collections menu --- README.md | 2 ++ app/scripts/controllers/menu.js | 2 +- app/views/menu.html | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40a92d73f..4f45b6ce5 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,8 @@ There is a [Wishlist](https://github.com/FPGAwars/icestudio/wiki/Wishlist:-propo * v0.3, v0.2: using [JointJS](https://github.com/clientIO/joint) and [AlertifyJS](https://github.com/MohammadYounes/AlertifyJS) * v0.1: using [AngularJS-Flowchart](https://github.com/codecapers/AngularJS-FlowChart) + + * [BQ](https://www.bq.com) sponsored this project from 02/2016 to 02/2017. Thanks diff --git a/app/scripts/controllers/menu.js b/app/scripts/controllers/menu.js index f808b310d..c099ea3a4 100644 --- a/app/scripts/controllers/menu.js +++ b/app/scripts/controllers/menu.js @@ -421,7 +421,7 @@ angular.module('icestudio') var readme = collection.content.readme; if (readme) { gui.Window.open('resources/viewers/markdown/readme.html?readme=' + readme, { - title: collection.name + ' - Data', + title: (collection.name ? collection.name : 'Default') + ' Collection - Data', focus: true, toolbar: false, resizable: true, diff --git a/app/views/menu.html b/app/views/menu.html index 72da9f14d..e99d888bd 100644 --- a/app/views/menu.html +++ b/app/views/menu.html @@ -184,11 +184,15 @@