From 9c811d92ca724165862c63708b8e5ebaf290c7d8 Mon Sep 17 00:00:00 2001
From: mgesteiro
If you want to export \
this submodule to a file, execute "Save as" command to do it.'
),
@@ -407,9 +407,9 @@ angular
alertify.confirm(
gettextCatalog.getString("Export submodule"),
gettextCatalog.getString(
- 'You are editing a submodule, if you save it, you save only \
+ 'You are editing a submodule, if you save it, you\'ll save only \
the submodule (in this situation "save as" works like \
- "export module"), Do you like to continue?'
+ "export module"). Do you want to continue?'
),
function () {
$scope.doSaveProjectAs(localCallback);
@@ -617,7 +617,7 @@ angular
}
//---------------------------------------------------------------------
- //-- CALLBACK FUNCIONTS for the EDIT MENU
+ //-- CALLBACK FUNCTIONS for the EDIT MENU
//---------------------------------------------------------------------
$scope.undoGraph = function () {
graph.undo();
@@ -657,6 +657,10 @@ angular
}
};
+ $scope.duplicateSelected = function () {
+ graph.duplicateSelected();
+ };
+
$scope.removeSelected = function () {
graph.removeSelected();
};
@@ -677,12 +681,6 @@ angular
showToolBox();
};
- /* redundant: patched via $scope - @mgesteiro
- function removeSelected() {
- project.removeSelected(); // <- this is justa a wrapper of graph.removeSelected()
- }
- */
-
$scope.fitContent = function () {
graph.fitContent();
};
@@ -711,7 +709,7 @@ angular
form.process(evt);
//-- If there were errors, the form is not closed
- //-- Return without clossing
+ //-- Return without closing
if (evt.cancel) {
return;
}
@@ -733,7 +731,7 @@ angular
newLogfile.lastIndexOf(separator) + 1
);
- //-- If the file is valid..
+ //-- If the file is valid ...
if (newLogfile === "" || hd.isValidPath(dirLFile)) {
//-- Set the new file
@@ -844,7 +842,7 @@ angular
let newPythonPath = form.values[0];
let newPipPath = form.values[1];
- //-- If there where no changes.. return
+ //-- If there where no changes ... return
if ( newPythonPath === pythonEnv.python &&
newPipPath === pythonEnv.pip) {
return;
@@ -907,7 +905,7 @@ angular
//-- Read the new path
let newExternalCollections = form.values[0];
- //-- If there where no changes.. return
+ //-- If there where no changes ... return
if (newExternalCollections === externalCollections) {
return;
}
@@ -1156,7 +1154,7 @@ angular
// View/System Info Window
//--
$scope.showSystemInfo = function () {
- //-- Write the iformation to the log file:
+ //-- Write the information to the log file:
iceConsole.log("---------------------");
iceConsole.log(" VIEW/System Info");
iceConsole.log("--------------------");
@@ -1173,8 +1171,8 @@ angular
iceConsole.log("\n\n");
//-- Build the URL with all the parameters to pass to the window
- //-- The encodeURIComponent() function the characteres so that the spaces and
- //-- other special characteres can be place on the original URL
+ //-- The encodeURIComponent() function the characters so that the spaces and
+ //-- other special characters can be place on the original URL
let URL =
`resources/viewers/system/system.html?version=${common.ICESTUDIO_VERSION}` +
`&base_dir=${encodeURIComponent(common.BASE_DIR)}---` +
@@ -1347,7 +1345,7 @@ angular
alertify.alert(
gettextCatalog.getString("Build"),
gettextCatalog.getString(
- "You can only build at top-level design. Inside submodules you only can Verify"
+ "You can only build at the top-level design. Inside submodules, you can only Verify"
),
function () { }
);
@@ -1372,7 +1370,7 @@ angular
alertify.alert(
gettextCatalog.getString("Upload"),
gettextCatalog.getString(
- "You can only upload your design at top-level design. Inside submodules you only can Verify"
+ "You can only upload at the top-level design. Inside submodules, you can only Verify"
),
function () { }
);
@@ -1521,7 +1519,7 @@ angular
'who start this project and was the main developer from 2016/Jan/28 to 2019/Oct',
"
Thanks to the rest of contributors
', - '© FPGAwars 2016-2022
', + '© FPGAwars 2016-2022
', '', " ", "", @@ -1589,6 +1587,7 @@ angular shortcuts.method("copySelected", $scope.copySelected); shortcuts.method("pasteAndCloneSelected", $scope.pasteAndCloneSelected); shortcuts.method("pasteSelected", $scope.pasteSelected); + shortcuts.method("duplicateSelected", $scope.duplicateSelected); shortcuts.method("removeSelected", $scope.removeSelected); shortcuts.method("selectAll", $scope.selectAll); shortcuts.method("fitContent", $scope.fitContent); @@ -1610,7 +1609,6 @@ angular // -- Show Floating toolbox shortcuts.method("showToolBox", $scope.showToolBox); - //shortcuts.method("removeSelected", removeSelected); // moved alongside other EDIT menu options shortcuts.method("back", function () { if (graph.isEnabled()) { graph.removeSelected(); @@ -1821,7 +1819,7 @@ angular reName = new RegExp(parsedSearch.name, 'i'); // contains + case insensitive (less restrictive) if (optionCase === true && optionExact === false) { // contains + case sensitive reName = new RegExp (parsedSearch.name); - } else if (optionCase === false && optionExact === true) { // exact + case insensitive + } else if (optionCase === false && optionExact === true) { // exact + case-insensitive reName = new RegExp ("\\b"+parsedSearch.name+"\\b", 'i'); } else if (optionCase === true && optionExact === true) { // exact + case sensitive (most restrictive) reName = new RegExp ("\\b"+parsedSearch.name+"\\b"); @@ -1944,7 +1942,7 @@ angular showToolBox(); // close toolbox }); - //-- dragabble toolbox + //-- draggable toolbox $(document).on("mousedown", "#iceToolbox .title-bar", function () { mouseDownTB = true; }); diff --git a/app/scripts/services/graph.js b/app/scripts/services/graph.js index e75dd1044..7b616f9ef 100644 --- a/app/scripts/services/graph.js +++ b/app/scripts/services/graph.js @@ -1320,6 +1320,23 @@ angular.module('icestudio') } }; + this.duplicateSelected = function() { + if (hasSelection()) { + utils.duplicateSelected(selection, graph, function (object) { + if (object.version === common.VERSION) { + self.appendDesign(object.design, object.dependencies); + } + }); + } + }; + + this.removeSelected = function () { + if (hasSelection()) { + graph.removeCells(selection.models); + selectionView.cancelSelection(); + updateWiresOnObstacles(); + } + }; this.selectAll = function () { disableSelected(); @@ -1336,14 +1353,6 @@ angular.module('icestudio') return selection && selection.length > 0; } - this.removeSelected = function () { - if (hasSelection()) { - graph.removeCells(selection.models); - selectionView.cancelSelection(); - updateWiresOnObstacles(); - } - }; - function disableSelected() { if (hasSelection()) { selectionView.cancelSelection(); diff --git a/app/scripts/services/project.js b/app/scripts/services/project.js index aa45290df..5fae127b7 100644 --- a/app/scripts/services/project.js +++ b/app/scripts/services/project.js @@ -688,10 +688,6 @@ angular.module('icestudio') return block; } - this.removeSelected = function () { - graph.removeSelected(); - }; - this.clear = function () { project = _default(); graph.clearAll(); diff --git a/app/scripts/services/shortcuts.js b/app/scripts/services/shortcuts.js index 4da843a73..564966269 100644 --- a/app/scripts/services/shortcuts.js +++ b/app/scripts/services/shortcuts.js @@ -88,7 +88,7 @@ angular.module('icestudio') }, saveProjectAs: { linux: { label: 'Ctrl+Shift+S', ctrl: true, shift: true, key: 83 }, - mac: { label: 'Shift+⌘+S', meta: true, shift: true, key: 83 }, + mac: { label: '⌘+⇧+S', meta: true, shift: true, key: 83 }, opt: { prompt: true } }, quit: { @@ -107,7 +107,7 @@ angular.module('icestudio') }, redoGraph2: { linux: { label: 'Ctrl+Shift+Z', ctrl: true, shift: true, key: 90 }, - mac: { label: 'Shift+⌘+Z', meta: true, shift: true, key: 90 }, + mac: { label: '⌘+⇧+Z', meta: true, shift: true, key: 90 }, opt: { preventDefault: true } }, cutSelected: { @@ -124,9 +124,16 @@ angular.module('icestudio') }, pasteAndCloneSelected: { linux: { label: 'Ctrl+Shift+V', ctrl: true, shift: true, key: 86 }, - mac: { label: 'Shit+⌘+V', meta: true, shift: true, key: 86 } + mac: { label: '⌘+⇧+V', meta: true, shift: true, key: 86 } + }, + duplicateSelected: { + linux: { label: 'Ctrl+D', ctrl: true, key: 68 }, + mac: { label: '⌘+D', meta: true, key: 68 } + }, + removeSelected: { + linux: { label: 'Del', key: 46 }, + mac: { label: 'Fn+⌫', key: 46 }, }, - selectAll: { linux: { label: 'Ctrl+A', ctrl: true, key: 65 }, mac: { label: '⌘+A', meta: true, key: 65 } @@ -164,13 +171,9 @@ angular.module('icestudio') linux: { label: 'Arrow right', key: 39 }, mac: { label: 'Arrow right', key: 39 } }, - removeSelected: { - linux: { label: 'Supr', key: 46 }, - mac: { label: 'Fn+Delete', key: 46 }, - }, back: { linux: { label: 'Back', key: 8 }, - mac: { label: 'Delete', key: 8 }, + mac: { label: '⌫', key: 8 }, opt: { disabled: true } }, takeSnapshot: { diff --git a/app/scripts/services/utils.js b/app/scripts/services/utils.js index 7f2b4b1fa..a53e8d3b7 100644 --- a/app/scripts/services/utils.js +++ b/app/scripts/services/utils.js @@ -231,14 +231,14 @@ angular.module('icestudio') //-- Error executing the command //-- Show the error notification if (notifyerror) { - alertify.error('Error executting command ' + command, 30); + alertify.error('Error executing command ' + command, 30); } //-- Comand finished with errors. Call the callback function callback(true, output); } else { - //-- Command finished with NO errors. Cal lthe callback function + //-- Command finished with NO errors. Call the callback function callback(false, output); } }); @@ -343,7 +343,7 @@ angular.module('icestudio') const executable = coverPath(pipExec); //-- Get the pip parameters needed for installing apio - //-- The needed apio vesion is also added + //-- The needed apio version is also added const params = this.getApioParameters(); console.log(pipExec, executable, params); //-- Run the pip command! @@ -392,7 +392,7 @@ angular.module('icestudio') const params = "install -U " + apio + extraPackagesString + versionString; - console.log("--> DEBUG: Params paased to pip: " + params); + console.log("--> DEBUG: Params passed to pip: " + params); return params; }; @@ -422,7 +422,7 @@ angular.module('icestudio') process.env.ICESTUDIO_APIO : _package.apio.external; - //-- The is an alternative apio toolchain ready + //-- There is an alternative apio toolchain ready if (nodeFs.existsSync(candidateApio)) { if (!this.toolchainDisabled) { @@ -867,7 +867,7 @@ angular.module('icestudio') //----------------------------------------------------------------------- //-- Return a text in bold HTML //-- Input: - //-- * text: String to converto to Bold + //-- * text: String to convert to Bold //-- Returns: //-- * The HTML text in bold //----------------------------------------------------------------------- @@ -886,13 +886,13 @@ angular.module('icestudio') //----------------------------------------------------------------------- this.openDialog = function (inputID, callback) { - //-- Get the filechooser element (from the DOM) + //-- Get the file chooser element (from the DOM) let chooser = $(inputID); - //-- Reove any previously event attached + //-- Remove any previously event attached chooser.unbind('change'); - //-- Atach a new callback function + //-- Attach a new callback function chooser.change(function () { //-- It is executed when the user has selected the file @@ -909,7 +909,7 @@ angular.module('icestudio') }); //-- Activate the File chooser! (The element is shown, it waits for - //-- the user to enter the file and the calblack is executed + //-- the user to enter the file, and the callback is executed) chooser.trigger('click'); }; @@ -1139,7 +1139,7 @@ angular.module('icestudio') }); } } - alertify.warning(message, 30); + alertify.warning(message, "30"); }); } } else { @@ -1152,6 +1152,14 @@ angular.module('icestudio') }); }; + this.duplicateSelected = function (selection, graph, callback) { + let cells = selectionToCells(selection, graph); + let content = this.cellsToProject(cells, graph); + if (callback && content) { + callback(content); + } + }; + function selectionToCells(selection, graph) { var cells = []; var blocksMap = {}; diff --git a/app/views/menu.html b/app/views/menu.html index 04cd204e1..a2ed55044 100644 --- a/app/views/menu.html +++ b/app/views/menu.html @@ -16,8 +16,8 @@