From d209561c0b0ab22fd5b060dc0529c9a316b504d9 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 19 Jan 2022 08:32:11 +0100 Subject: [PATCH] #3249 Change FontSize - Box graphic scale --- .../bbsWxGUIEditorGraphic/InterpreterBBS.cxx | 11 ++-- .../bbtkwxGUIEditorGraphicBBS.cxx | 6 +- .../wxVtkSceneManager.cxx | 59 ++++++++++--------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx index e32a02a..7365e98 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx @@ -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 ); } //========================================================================= diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index fb4a8a2..dda5bce 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -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) { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 07b4305..960cdad 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -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 objectsMap) { - +void wxVtkSceneManager::DuplicateObjects(std::map objectsMap) +{ std::map oldIdNewIdBoxes; std::vector connections; - std::vector newBoxesID; - std::map::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 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 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 } -- 2.47.1