]> Creatis software - bbtkGEditor.git/commitdiff
#3264 Copy Paste boxes option between diagrams vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Mon, 21 Sep 2026 09:54:15 +0000 (11:54 +0200)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Mon, 21 Sep 2026 09:54:15 +0000 (11:54 +0200)
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.h

index f0e1bdfabfdc0a81ee662be38b76ca571d8d1893..34fb38df1b5427a31102320d762192372f0395d7 100644 (file)
@@ -246,6 +246,7 @@ namespace bbtk
     void wxTabPanelsManager::pasteBoxes()
     {
         _actual -> DuplicateObjects( _mapSelectedObjCopyPaste );
+        _mapSelectedObjCopyPaste = _actual->getSelectedObjects();
     }
 
        //=========================================================================
@@ -255,7 +256,6 @@ namespace bbtk
        }
 
        //=========================================================================
-
        void wxTabPanelsManager::VerifyLastTabPanel()
        {
             if (this->_notebook->GetPageCount()==0)
@@ -265,7 +265,6 @@ namespace bbtk
        }
 
        //=========================================================================
-
        void wxTabPanelsManager::OnTabChanged(wxAuiNotebookEvent& event)
        {
                int index                   = event.GetSelection();
@@ -273,36 +272,28 @@ namespace bbtk
                int id                      = tab->getPanelId();
                _actual                     = _panels[id];
                _parent->refreshGUIControls();
-
        }
 
        //=========================================================================
-
        void wxTabPanelsManager::OnTabClose(wxAuiNotebookEvent& event)
        {
-
                std::cout<<"RaC wxTabPanelsManager::OnTabClose Start... "<<_panels.size()<<std::endl;
                int index = event.GetSelection();
-
                if(_panels.size()>0)
                {
                        wxGEditorTabPanel* tab      = (wxGEditorTabPanel*)_notebook->GetPage(index);
                        int id                      = tab->getPanelId();
                        tab->deleteAllBoxes();
                        _panels.erase(id);
-
                        _notebook->RemovePage(index);
-
                        std::cout<<"RaC wxTabPanelsManager::OnTabClose  IMPORTANT. The complete tab is not erased from memory... "<<std::endl;
                        //////////////////////////////
                        // TO FIX . RaC May 2012 - IMPORTANT. The complete tab is not erased from memory.
                        // Only the objects are deleted and the tab is hidden
                        // Execution problems when a tab is deleted using delete or DeletePage
                        // delete tab;
-
                        map<int, wxGEditorTabPanel*>::iterator it = _panels.begin() ;
                        _actual=(*it).second;
-
                        std::cout<<"RaC wxTabPanelsManager::OnTabClose End..."<< std::endl;
                }
        }
@@ -337,7 +328,6 @@ namespace bbtk
        }
 
        //=========================================================================
-
        int  wxTabPanelsManager::FindTab(std::string filename)
        {
                std::map<int, wxGEditorTabPanel*>::iterator it;
@@ -369,7 +359,6 @@ namespace bbtk
         return _actual->GetExportFormat();
     }
 
-
        //=========================================================================
     std::string wxTabPanelsManager::GetDescription()
        {
@@ -383,16 +372,16 @@ namespace bbtk
        }
 
        //=========================================================================
-               std::string wxTabPanelsManager::GetMessageKind()
-               {
-                       return _actual->GetMessageKind();
-               }
+    std::string wxTabPanelsManager::GetMessageKind()
+    {
+        return _actual->GetMessageKind();
+    }
 
        //=========================================================================
-               std::string wxTabPanelsManager::GetMessageLevel()
-               {
-                       return _actual->GetMessageLevel();
-               }
+    std::string wxTabPanelsManager::GetMessageLevel()
+    {
+        return _actual->GetMessageLevel();
+    }
 
        //=========================================================================
     void wxTabPanelsManager::SetCbName(std::string cbName)
@@ -430,17 +419,15 @@ namespace bbtk
         _actual->SetDescription( description );
     }
 
-
        //=========================================================================
-               void wxTabPanelsManager::SetMessageKind(std::string kind){
-                               _actual->SetMessageKind(kind);          
-               }
-
+    void wxTabPanelsManager::SetMessageKind(std::string kind){
+        _actual->SetMessageKind(kind);
+    }
 
        //=========================================================================
-               void wxTabPanelsManager::SetMessageLevel(std::string level){
-                               _actual->SetMessageLevel(level);        
-               }
+    void wxTabPanelsManager::SetMessageLevel(std::string level){
+        _actual->SetMessageLevel(level);
+    }
 
        //=========================================================================
        bool wxTabPanelsManager::TryToOpenScriptApplication(std::string packageName ,std::string boxType)
@@ -454,7 +441,6 @@ namespace bbtk
     {
        _actual->SelectBoxWithPossibleName( nameFilter );
     }
-
 }  // EO namespace bbtk
 
 // EOF
index 58e0f4d0f40d6f903ac1379aaff71f89c345a98d..7a743a2eb7c33aa84a310599eeea5793312f27f7 100644 (file)
@@ -94,7 +94,8 @@ wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView
        
        _startDragging                  = false;
        _isComplexBox                   = false;
-
+    _deltaPxDuplicateBox    = 14;
+    
        if (_baseView != NULL) {
                //EED02JUIN2010
                printf(
@@ -2784,14 +2785,14 @@ void wxVtkSceneManager::DuplicateObjects( std::map<int,GObjectController*> objec
                 double xInic, yInic, zInic;
                 GBlackBoxModel* copyBox = (GBlackBoxModel*) cont->getModel();
                 copyBox->getInicPoint(xInic, yInic, zInic);
-                int idBox = createGBlackBox(0, 0, copyBox->getBBTKPackage(), copyBox->getBBTKType());
+                int idBox               = createGBlackBox(0, 0, copyBox->getBBTKPackage(), copyBox->getBBTKType());
 
-                int idcB = copyBox->getObjectId();
-                oldIdNewIdBoxes[idcB] = idBox;
-                cont = _controllers[idBox];
-                GBlackBoxModel* newbox = (GBlackBoxModel*) cont->getModel();
+                int idcB                = copyBox->getObjectId();
+                oldIdNewIdBoxes[idcB]   = idBox;
+                cont                    = _controllers[idBox];
+                GBlackBoxModel* newbox  = (GBlackBoxModel*) cont->getModel();
                 newbox->setInicPoint(xInic, yInic, zInic);
-                int num = newbox->getNumInputPorts();
+                int num                 = newbox->getNumInputPorts();
                 for (int j = 0; j < num; j++)
                 {
                     newbox->setValueToInputPort(j, copyBox->getValueInputPort(j));
@@ -2799,7 +2800,7 @@ void wxVtkSceneManager::DuplicateObjects( std::map<int,GObjectController*> objec
 
 // EED 2022-01-16
 //                newbox->move(xInic + 20, yInic + 20, zInic);
-                newbox->move(xInic + 14, yInic + 6, zInic);
+                newbox->move(xInic + _deltaPxDuplicateBox, yInic + _deltaPxDuplicateBox/2, zInic);
                 
                 newbox->notifyObservers(_idManager);
                 newBoxesID.push_back(newbox->getObjectId());
index fa1fb02a45e378a8a501dd6d4d4d5c73091a372d..ad8c05dc0973c2cb1b8f829cee84cb518b05d5ce 100644 (file)
@@ -292,6 +292,10 @@ namespace bbtk
                vtkActor                                                        *_fillObjectActor;
                vtkDataSetMapper                                        *_aPolygonMapper;
                Factory::Pointer                                        _bbtkfactory;
+        
+        // 2026-09-21
+        int                                 _deltaPxDuplicateBox;
+
         std::string LineNumber(bool withLineNumber, int &value);
         int GetIndexInSelected(int idControler);
         void UnSelectBlackBoxes();