From 148148d87a5ed486b321de977e8bb64f39e1e49c Mon Sep 17 00:00:00 2001 From: corredor <> Date: Mon, 26 Apr 2010 14:26:11 +0000 Subject: [PATCH] It is possible to execute the simplest diagram :) Perfect !!! --- .../bbsKernelEditorGraphic/GPortModel.cxx | 7 ++ .../bbsKernelEditorGraphic/GPortModel.h | 1 + .../wxVtkSceneManager.cxx | 116 ++++++++++++++++++ .../wxVtkSceneManager.h | 2 + .../bbtkwxGUIEditorGraphicBBS.cxx | 60 ++++++++- .../bbtkwxGUIEditorGraphicBBS.h | 3 + .../wxGEditorTabPanel.cxx | 7 ++ .../bbsWxGUIEditorGraphic/wxGEditorTabPanel.h | 1 + .../wxTabPanelsManager.cxx | 7 ++ .../wxTabPanelsManager.h | 1 + 10 files changed, 200 insertions(+), 5 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx index acef109..5a31568 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.cxx @@ -126,6 +126,13 @@ namespace bbtk //========================================================================= + GBlackBoxModel* GPortModel::getParentBox() + { + return _parentBox; + } + + //========================================================================= + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h index c18e225..fd45571 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GPortModel.h @@ -72,6 +72,7 @@ namespace bbtk void registerInBox(GBlackBoxModel *blackBox,int portType, int pos); void updatePortPosition(); int getPortType(); + GBlackBoxModel* getParentBox(); virtual std::string getStatusText(); private: diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx index 22d8977..0420aa3 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx @@ -576,6 +576,122 @@ namespace bbtk //========================================================================= + std::string wxVtkSceneManager::getDiagramScript() + { + bool existsExec=false; + + std::vector packages; + std::vector boxes; + std::vector connections; + std::vector execBoxes; + + std::map::iterator it; + + for(it = _controllers.begin(); it != _controllers.end(); ++it) + { + GObjectController *desc = it->second; + int type = desc->getGObjectType(); + + if(type==GBLACKBOX) + { + GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel(); + + std::string pkg = mod->getBBTKPackage(); + bool existsPkg = false; + for(int t = 0;tfirst); + if(mod->isExecutable()) + { + execBoxes.push_back(it->first); + existsExec=true; + } + } + else if(type==GCONNECTOR) + { + connections.push_back(it->first); + } + } + + std::string script = ""; + script+="# BBTK GEditor Script\n"; + script+="# ----------------------\n"; + if(existsExec) + { + int i; + for(i = 0; igetModel(); + + script+=model->getBBTKType(); + script+=" "; + script+=model->getBBTKName(); + script+="\n"; + } + + for(i = 0; igetModel(); + + //Start Connection info + GPortModel *start = model->getStartPort(); + script+=start->getParentBox()->getBBTKName(); + script+="."; + script+=start->getBBTKName(); + + script+=" "; + + //End Connection info + GPortModel *end = model->getEndPort(); + script+=end->getParentBox()->getBBTKName(); + script+="."; + script+=end->getBBTKName(); + + script+="\n"; + } + + for(i = 0; igetModel(); + + script+=model->getBBTKName(); + script+="\n"; + } + + } + + return script; + } + + //========================================================================= + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h index 5f1fcc5..3c8c061 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h @@ -111,6 +111,8 @@ namespace bbtk void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); + std::string getDiagramScript(); + private: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index bafa007..9c63350 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -91,14 +91,16 @@ namespace bbtk wxToolBar *_toolbar = new wxToolBar(this, wxID_ANY); //Adds a tool btn to the toolbar - _toolbar->AddTool(wxID_NEW,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab")); + _toolbar->AddTool(1000,_T("New"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("New tab"), _T("Create a new panel tab")); + _toolbar->AddTool(1001,_T("Execute"),bmp_new, wxNullBitmap, wxITEM_NORMAL,_T("Execute actual diagram"), _T("Execute actual diagram")); _toolbar->SetMargins( 2, 2 ); _toolbar->Realize(); SetToolBar(_toolbar); // connect command event handlers - Connect(wxID_NEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick)); + Connect(1000,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick)); + Connect(1001,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnToolLeftClick)); } //========================================================================= @@ -283,6 +285,50 @@ namespace bbtk //========================================================================= + void wxGUIEditorGraphicBBS::executeActualDiagram() + { + std::string script = _tabsMgr->getActualDiagramScript(); + cout<<"RaC wxGUIEditorGraphicBBS::executeActualDiagram SCRIPT"<addNewTab(); - break; + case 1000 : + _tabsMgr->addNewTab(); + break; + + case 1001 : + executeActualDiagram(); + break; } } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 997f4d3..d0044ff 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -70,6 +70,8 @@ #include //Includes std +#include +#include namespace bbtk { @@ -91,6 +93,7 @@ namespace bbtk wxAuiNotebook* getAuiNotebook(); void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); + void executeActualDiagram(); void RegenerateAll(); void DoRegeneratePackageDoc(const std::string& pack); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index 3171eb2..494aa2a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -120,6 +120,13 @@ namespace bbtk //========================================================================= + std::string wxGEditorTabPanel::getDiagramScript() + { + return _sceneManager->getDiagramScript(); + } + + //========================================================================= + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index e3affc5..5074084 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -81,6 +81,7 @@ namespace bbtk void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); + std::string getDiagramScript(); private: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index c9e748d..a8d966a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -96,6 +96,13 @@ namespace bbtk //========================================================================= + std::string wxTabPanelsManager::getActualDiagramScript() + { + return _actual->getDiagramScript(); + } + + //========================================================================= + } // EO namespace bbtk diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index edf4ca1..4b5c3be 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -74,6 +74,7 @@ namespace bbtk void displayBlackBoxInfo(std::string packageName, std::string boxName); void updateStatusBar(std::string textStatus); + std::string getActualDiagramScript(); private: -- 2.45.1