]> Creatis software - bbtkGEditor.git/commitdiff
#3249 Change FontSize - Box graphic scale
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 19 Jan 2022 07:32:11 +0000 (08:32 +0100)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Wed, 19 Jan 2022 07:32:11 +0000 (08:32 +0100)
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx

index e32a02aae21b1eac2eeaf376b78d95d1bc679660..7365e982a8bc716c865e727b989933238e9556ba 100644 (file)
@@ -109,15 +109,18 @@ namespace bbtk
        /// Creates a new black box in current complex box
     void InterpreterBBS::commandNew( const std::string& boxType, const std::string& boxName) // virtual
        {
-               _yGeneral                               = _yGeneral - 30;
                std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType);
                std::string boxType2    = _factory->GetTypeNameOfaBlackBox(boxType);
                int idBox                               = _sceneManager->createGBlackBox( 0,0, packagename ,boxType2);
                _countBoxes++;
-               double px                               = _xGeneral + (_countBoxes%2)*100;
-               double py                               = _yGeneral;
+//EED 2022-01-16
+//             double px                               = _xGeneral + (_countBoxes%2)*100;
+//        _yGeneral                = _yGeneral - 30;
+        double px                = _xGeneral + (_countBoxes%2)*70;
+        _yGeneral                = _yGeneral - 9;
 
-               _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+100, py-10 , _zGeneral );
+               double py                               = _yGeneral;
+               _sceneManager->configGBlackBox(idBox, px,py,_zGeneral,boxName, false , px+BOX_WIDTH, py-BOX_HEIGHT , _zGeneral );
        }
        //=========================================================================
 
index fb4a8a20e7494cd6cb0f8dc33fec20ef68351466..dda5bce5d86da8aae7dd4e081701721cb86b6c3f 100644 (file)
@@ -682,18 +682,16 @@ void wxGUIEditorGraphicBBS::OnEditDiagramProperties(wxCommandEvent& event)
 }
 
 //=========================================================================
-
-void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event) {
+void wxGUIEditorGraphicBBS::OnExecuteActualDiagram(wxCommandEvent& event)
+{
        std::string script1 = _tabsMgr->getActualDiagramBBS(true);
        cout << endl << "RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"
                        << endl << endl;
        cout << script1 << endl;
-
        std::string script2 = _tabsMgr->getActualDiagramBBS(false);
        executeScript(script2);
 }
 
-       
 //=========================================================================
 void wxGUIEditorGraphicBBS::OpenBBS(std::string filePathName, std::string fileName) 
 {
index 07b43058ccffe014b0bdce97850b8266b79d2c97..960cdad62c69741d83f8cc1861af317851a26dab 100644 (file)
@@ -1465,14 +1465,14 @@ std::string wxVtkSceneManager::getDiagramBBS(bool wln) {
                for (i = 0; i < (int) connections.size(); i++) {
                        //script += LineNumber(wln, lnNmbr);
                        //script += "connect ";
-                       int id = connections[i];
-                       GObjectController *control = _controllers[id];
-                       GConnectorModel *model = (GConnectorModel*) control->getModel();
+                       int                 id          = connections[i];
+                       GObjectController   *control    = _controllers[id];
+                       GConnectorModel     *model      = (GConnectorModel*) control->getModel();
 
 
                        //Connection info
-                       GPortModel *start = model->getStartPort();
-                       GBoxModel *startBox = start->getParentBox();
+                       GPortModel          *start      = model->getStartPort();
+                       GBoxModel           *startBox   = start->getParentBox();
 
                        GPortModel *end = model->getEndPort();
                        GBoxModel *endBox = end->getParentBox();
@@ -1539,7 +1539,6 @@ std::string wxVtkSceneManager::getDiagramBBS(bool wln) {
                        int id = execBoxes[i];
                        GObjectController *control = _controllers[id];
                        GBlackBoxModel *model = (GBlackBoxModel*) control->getModel();
-
                        script += model->getBBTKName();
                        script += "\n";
                }
@@ -2616,25 +2615,23 @@ int wxVtkSceneManager::addObjectController(GObjectController* objController) {
 
 //=========================================================================
 
-void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objectsMap) {
-
+void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objectsMap)
+{
         std::map<int, int> oldIdNewIdBoxes;
         std::vector<int> connections;
-
         std::vector<int> newBoxesID;
-
         std::map<int, GObjectController*>::iterator it;
-        for (it = objectsMap.begin(); it != objectsMap.end(); ++it) {
+        for (it = objectsMap.begin(); it != objectsMap.end(); ++it)
+        {
             GObjectController *cont = it->second;
             int type = cont->getGObjectType();
-
-            if (type == GBLACKBOX) {
+            if (type == GBLACKBOX)
+            {
                 // Copy black box
                 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;
@@ -2642,21 +2639,27 @@ void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objec
                 GBlackBoxModel* newbox = (GBlackBoxModel*) cont->getModel();
                 newbox->setInicPoint(xInic, yInic, zInic);
                 int num = newbox->getNumInputPorts();
-                for (int j = 0; j < num; j++) {
+                for (int j = 0; j < num; j++)
+                {
                     newbox->setValueToInputPort(j, copyBox->getValueInputPort(j));
-                }
-                newbox->move(xInic + 20, yInic + 20, zInic);
+                } // if  j
+
+// EED 2022-01-16
+//                newbox->move(xInic + 20, yInic + 20, zInic);
+                newbox->move(xInic + 14, yInic + 6, zInic);
+                
                 newbox->notifyObservers(_idManager);
                 newBoxesID.push_back(newbox->getObjectId());
 
             } else if (type == GCONNECTOR) {
                 int idCon = cont->getId();
                 connections.push_back(idCon);
-            }
+            } // if type
 
-        }
+        } // for it
 
-        for (int i = 0; i < (int) connections.size(); i++) {
+        for (int i = 0; i < (int) connections.size(); i++)
+        {
             int objId = connections[i];
             GObjectController *cont = objectsMap[objId];
             GConnectorModel* connectModel = (GConnectorModel*) cont->getModel();
@@ -2691,23 +2694,23 @@ void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objec
             tempp->endContourCreation();
             conMod->setEndPort(newEndPort);
             conView->updateStartEndPoints();
-        }
+        } // for i
 
         /// the new selected boxes are the duplicate ones
 
         UnSelectBlackBoxes();
-        for (int i = 0; i < newBoxesID.size(); i++) {
+        for (int i = 0; i < newBoxesID.size(); i++)
+        {
             _selectedObjects.push_back(newBoxesID.at(i));
-        }
+        } // for i
 
-        for (int i = 0; i < (int) _selectedObjects.size(); i++) {
+        for (int i = 0; i < (int) _selectedObjects.size(); i++)
+        {
             int id = _selectedObjects[i];
             GObjectController* cont = _controllers[id];
-
             cont->getView()->setState(SELECTED);
             cont->getModel()->notifyObservers(_idManager);
-
-        }
+        } // for i
     }