From deb54dea1afc74667cdf185accee3576d9296948 Mon Sep 17 00:00:00 2001 From: Carlos Venegas Date: Sat, 16 Nov 2024 22:34:58 +0100 Subject: [PATCH] First improvement around collection manager, hide it when read only mode navigation block is running and show it on edit mode, avoiding in this way errors imply dragging elements in locked mode --- .../Icestudio/GUI/Widgets/WafleUIWindow.js | 13 +++++++++++- .../Plugin/WaflePluginExtEmbeddedWindowed.js | 4 +++- .../Icestudio/Services/WaflePluginManager.js | 2 +- app/scripts/controllers/design.js | 20 ++++++++++++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/resources/libs/Icestudio/GUI/Widgets/WafleUIWindow.js b/app/resources/libs/Icestudio/GUI/Widgets/WafleUIWindow.js index 005f84aba..43fc7062d 100644 --- a/app/resources/libs/Icestudio/GUI/Widgets/WafleUIWindow.js +++ b/app/resources/libs/Icestudio/GUI/Widgets/WafleUIWindow.js @@ -35,9 +35,20 @@ class WafleUIWindow{ this.dom.style.right=params.right; this.dom.style.width=params.width; this.dom.style.height=params.height; + iceStudio.bus.events.subscribe(`Navigation::ReadOnly`,'hide',this); + iceStudio.bus.events.subscribe(`Navigation::ReadWrite`,'show',this); + + } + + hide(){ + this.dom.style.display='none'; + } + + show(){ + this.dom.style.display='block'; } close(){ iceStudio.gui.removeDiv(`#${this.winId}`); } -} \ No newline at end of file +} diff --git a/app/resources/libs/Icestudio/Plugin/WaflePluginExtEmbeddedWindowed.js b/app/resources/libs/Icestudio/Plugin/WaflePluginExtEmbeddedWindowed.js index ad590e262..38fe31998 100644 --- a/app/resources/libs/Icestudio/Plugin/WaflePluginExtEmbeddedWindowed.js +++ b/app/resources/libs/Icestudio/Plugin/WaflePluginExtEmbeddedWindowed.js @@ -18,6 +18,7 @@ class WaflePluginExtEmbeddedWindowed extends WaflePlugin { console.log('Plugin is running'); } else { + console.log('Windowed plugin ',this.uuid); iceStudio.bus.events.subscribe(`${this.uuid}::Terminate`,'terminate',this,this.uuid); this.running = true; let _this = this; @@ -95,6 +96,7 @@ class WaflePluginExtEmbeddedWindowed extends WaflePlugin { } }//--END run + terminate(){ iceStudio.gui.removeNode(this.dom.host); this.dom.shadow=false; @@ -102,4 +104,4 @@ class WaflePluginExtEmbeddedWindowed extends WaflePlugin { this.running=false; iceStudio.bus.events.removeById(this.uuid); } -} \ No newline at end of file +} diff --git a/app/resources/libs/Icestudio/Services/WaflePluginManager.js b/app/resources/libs/Icestudio/Services/WaflePluginManager.js index 340ea8d9a..88adfdb01 100644 --- a/app/resources/libs/Icestudio/Services/WaflePluginManager.js +++ b/app/resources/libs/Icestudio/Services/WaflePluginManager.js @@ -186,4 +186,4 @@ class WaflePluginManager { this.plugins[pluginId].run(); } } -} \ No newline at end of file +} diff --git a/app/scripts/controllers/design.js b/app/scripts/controllers/design.js index f745debad..735559500 100644 --- a/app/scripts/controllers/design.js +++ b/app/scripts/controllers/design.js @@ -63,7 +63,11 @@ angular const last=common.submoduleHeap.length - 1; common.submoduleId=common.submoduleHeap[last].id; common.submoduleUID=common.submoduleHeap[last].uid; + iceStudio.bus.events.publish('Navigation::ReadOnly'); + }else{ + iceStudio.bus.events.publish('Navigation::ReadWrite'); } + loadSelectedGraph(); } @@ -79,13 +83,16 @@ angular const last=common.submoduleHeap.length - 1; common.submoduleId=common.submoduleHeap[last].id; common.submoduleUID=common.submoduleHeap[last].uid; + iceStudio.bus.events.publish('Navigation::ReadOnly'); + }else{ + + iceStudio.bus.events.publish('Navigation::ReadWrite'); } loadSelectedGraph(); } }; $scope.editModeToggle = function ($event) { - var btn = $event.currentTarget; if (!$scope.isNavigating) { @@ -95,6 +102,7 @@ angular var lockImg = false; var lockImgSrc = false; if (common.isEditingSubmodule) { + lockImg = $('img', btn); lockImgSrc = lockImg.attr('data-lock'); lockImg[0].src = lockImgSrc; @@ -138,8 +146,10 @@ angular rw = false; common.isEditingSubmodule = true; subModuleActive = true; + } + $rootScope.$broadcast('navigateProject', { update: false, project: tmp, @@ -238,6 +248,7 @@ angular } if (args.update) { graph.resetView(); + project.update({ deps: false }, function () { graph.loadDesign(args.project.design, opt, function () { utils.endBlockingTask(); @@ -262,6 +273,13 @@ angular $scope.breadcrumbsBack(); } + if (common.isEditingSubmodule || common.submoduleHeap.length===0){ + iceStudio.bus.events.publish('Navigation::ReadWrite'); + }else{ + + iceStudio.bus.events.publish('Navigation::ReadOnly'); + } + }); $rootScope.$on('breadcrumbsBack', function (/*event*/) {