]> Creatis software - bbtkGEditor.git/commitdiff
Setting values in a blackbox and almost setting values in the scene properties
authorcorredor <>
Wed, 28 Apr 2010 14:30:50 +0000 (14:30 +0000)
committercorredor <>
Wed, 28 Apr 2010 14:30:50 +0000 (14:30 +0000)
12 files changed:
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.cxx
lib/EditorGraphicBBS/bbsKernelEditorGraphic/wxVtkSceneManager.h
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.cxx
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBlackBoxController.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxEditionDialog.cxx [new file with mode: 0644]
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxEditionDialog.h [new file with mode: 0644]
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx
lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h

index 8107b8ec6bd48d4e10e30b8e3325b7953b9c9864..7419d39cdb0bd93c334ab3c3297d0242e703ffc2 100644 (file)
@@ -440,22 +440,7 @@ namespace bbtk
                                        cont->SetActive(true);                                                          
                                }
                        }
-                       else if(command == EDIT_BLACKBOX)
-                       {
-                               GObjectController* cont = _controllers[idController];
-
-                               for (int i=0; i<_selectedObjects.size(); i++)
-                               {
-                                       int id = _selectedObjects[i];
-                                       GObjectController* cont = _controllers[id];
-                                       cont->getView()->setState(NOTHING_HAPPENS);
-                               }
-                               _selectedObjects.clear();
-
-                               GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel();
-                               _parent->editBlackBox(bbmodel);
-
-                       }
+                       
                }
        }
 
@@ -590,6 +575,51 @@ namespace bbtk
 
        //=========================================================================
 
+       bool wxVtkSceneManager::OnLeftDClick()
+       {
+               int X,Y;
+               wxVTKRenderWindowInteractor *wxVTKiren;
+               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+               wxVTKiren->GetEventPosition(X,Y);
+
+               std::map<int, GObjectController*>::iterator it;
+
+               bool clickOnObject = false;
+
+               for(it = _controllers.begin(); it != _controllers.end() && clickOnObject==false; ++it)
+               {
+                       GObjectController *cont = it->second;
+                       int type = cont->getGObjectType();
+                       
+                       if(cont->getView()->isPointInside(X,Y))
+                       {
+                               if(type==GBLACKBOX)
+                               {
+                                       for (int i=0; i<_selectedObjects.size(); i++)
+                                       {
+                                               int id = _selectedObjects[i];
+                                               GObjectController* control = _controllers[id];
+                                               control->getView()->setState(NOTHING_HAPPENS);
+                                       }
+                                       _selectedObjects.clear();
+
+                                       GBlackBoxModel *bbmodel = (GBlackBoxModel*)cont->getModel();
+                                       _parent->editBlackBox(bbmodel);
+                               }
+                               clickOnObject = true;                   
+                       }
+               }
+
+               if(clickOnObject==false)
+               {
+                       _parent->editDiagramParameters(this);
+               }
+
+               return true;
+       }
+       
+       //=========================================================================
+
        bool wxVtkSceneManager::OnChar()
        {       
                char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
index 7efbe0038add1b853ce42f04e158abe5caea5918..a189fffddfc65168558cefd96736ed8a32a644c7 100644 (file)
@@ -108,6 +108,7 @@ namespace bbtk
                virtual bool  OnLeftButtonDown(); 
                virtual bool  OnLeftButtonUp();
                virtual bool OnRightButtonUp();
+               virtual bool OnLeftDClick();
 
                virtual void update(int idController,int command);
 
index 64092751ea809949e320afba7f9b0528253ba2b0..cfdaa31c9517f4a210637b9e4277976d13a5f2db 100644 (file)
@@ -131,26 +131,7 @@ namespace bbtk
        }
        
        //=========================================================================
-       
-       bool GBlackBoxController::OnLeftDClick()
-       {
-               int X,Y;
-               wxVTKRenderWindowInteractor *wxVTKiren;
-               wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
-               wxVTKiren->GetEventPosition(X,Y);
-
-               int state  = _view->getState();
 
-               //Evaluate new state
-               if(_view->isPointInside(X,Y))
-               {
-                       _model->notifyObservers(getId(),EDIT_BLACKBOX);
-               }
-               return true;
-       }
-       
-       //=========================================================================
-       
        bool GBlackBoxController::OnRightButtonUp()
        {
                GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
index d5e34459764819812ac0e1832c78f029708ade3c..1fc734e9caf8081d5a0d368b9ba587ec9f127a1b 100644 (file)
@@ -81,7 +81,6 @@ namespace bbtk
                virtual bool  OnLeftButtonDown(); 
                virtual bool  OnLeftButtonUp();
                virtual bool  OnMiddleButtonDown(); 
-               virtual bool  OnLeftDClick();
                virtual bool  OnRightButtonUp();
 
 
index 816e884350c2dc710aa948b777f98e1e4bf619ea..696214ccd9750aaace20cd7e26786d38fcd1b574 100644 (file)
@@ -286,6 +286,14 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxGUIEditorGraphicBBS::editDiagramParameters(wxVtkSceneManager* scene)
+       {
+               wxEditionDialog* dialog = new wxEditionDialog(this,scene);
+               dialog->Show();
+       }
+
+       //=========================================================================
+
        void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus)
        {
                SetStatusText(_T(textStatus));
index e31d87349a698061dd6c09f703a10b3460ea8494..d81251db6919c450502b8e2657a54c72b725457c 100644 (file)
@@ -47,6 +47,7 @@
 #include "wxTabPanelsManager.h"
 #include "wxPropertiesPanel.h"
 #include "wxEditionDialog.h"
+#include "wxVtkSceneManager.h"
 #include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm"
 
 //Includes creaMaracasVisu
@@ -77,6 +78,8 @@
 namespace bbtk
 {
        class wxTabPanelsManager;
+
+       class wxVtkSceneManager;
   
        class  wxGUIEditorGraphicBBS : public wxFrame
   {
@@ -97,6 +100,7 @@ namespace bbtk
                void executeActualDiagram();
 
                void editBlackBox(GBlackBoxModel *bbmodel);
+               void editDiagramParameters(wxVtkSceneManager* scene);
 
                void RegenerateAll();
                void DoRegeneratePackageDoc(const std::string& pack);   
diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxEditionDialog.cxx
new file mode 100644 (file)
index 0000000..66a8fb0
--- /dev/null
@@ -0,0 +1,159 @@
+/*=========================================================================                                                                               
+Program:   bbtk
+Module:    $RCSfile$
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+/**
+*  \file 
+*  \brief Class bbtk::wxEditionDialog . 
+*/
+
+
+#include "wxEditionDialog.h"
+
+
+namespace bbtk
+{
+       //=========================================================================
+
+       wxEditionDialog::wxEditionDialog(wxGUIEditorGraphicBBS *parent,GBlackBoxModel *model):wxDialog(parent,wxID_ANY,"", wxDefaultPosition, wxSize(480, 640))
+       {
+               _model=model;
+               std::string title = "BlackBox Editing - Name:";
+               title+=_model->getBBTKName();
+               title+=" Type:";
+               title+=_model->getBBTKType();
+               SetTitle(wxT(title));
+
+               constructBlackBoxEditionDialog();
+       }
+
+       //=========================================================================
+
+       wxEditionDialog::wxEditionDialog(wxGUIEditorGraphicBBS *parent,wxVtkSceneManager* scene):wxDialog(parent, wxID_ANY, "", wxDefaultPosition, wxSize(300, 300))
+       {
+               
+       }
+
+       //=========================================================================
+
+       wxEditionDialog::~wxEditionDialog()
+       {
+
+       }
+
+       //=========================================================================
+
+       void wxEditionDialog::constructBlackBoxEditionDialog()
+       {
+               wxBoxSizer *sizerDialog = new wxBoxSizer(wxVERTICAL);
+
+               wxStaticText *text = new wxStaticText(this, -1, wxT("Input Ports"));
+                               
+               std::vector<GPortModel*> lstInputs = _model->getInputPorts();
+               wxGridSizer *sizer = new wxGridSizer(lstInputs.size(),3,5,5);             
+               for(int i = 0;i<lstInputs.size();i++)
+               {
+                       GPortModel* port = lstInputs[i];
+                       wxStaticText *lblName = new wxStaticText(this, -1, wxT(port->getBBTKName()),wxDefaultPosition,wxSize(100,30));
+                       wxStaticText *lblType = new wxStaticText(this, -1, wxT(port->getBBTKType()),wxDefaultPosition,wxSize(150,30));
+                       wxTextCtrl *txtValue = new wxTextCtrl(this, -1, wxT(""),wxDefaultPosition,wxSize(50,15));
+
+                       if(port->getValue()!="")
+                       {
+                               txtValue->SetLabel(wxT(port->getValue()));
+                       }
+
+                       if(port->isConnected())
+                       {
+                               std::string connected = "--Port Connected--";
+                               txtValue->SetLabel(wxT(connected));
+                               txtValue->SetEditable(false);
+                       }
+
+                       _lstNames.push_back(lblName);
+                       _lstTypes.push_back(lblType);
+                       _lstValues.push_back(txtValue);
+
+                       sizer->Add(lblName,0,wxEXPAND,5);
+                       sizer->Add(lblType,0,wxCENTRE|wxEXPAND,5);
+                       sizer->Add(txtValue,0,wxEXPAND,5);
+
+               }
+               
+               wxBoxSizer *buts = new wxBoxSizer(wxHORIZONTAL);
+               wxButton *okButton = new wxButton(this, 1003, wxT("Ok"),wxDefaultPosition, wxSize(70, 30));
+               wxButton *closeButton = new wxButton(this, 1004, wxT("Close"), wxDefaultPosition, wxSize(70, 30));
+
+               // connect command event handlers
+               Connect(1003,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxEditionDialog::onClickOk));
+               Connect(1004,wxEVT_COMMAND_BUTTON_CLICKED,wxCommandEventHandler(wxEditionDialog::onClickClose));
+               
+               buts->Add(okButton,0,wxCENTRE|wxEXPAND,5);
+               buts->Add(closeButton,0,wxCENTRE|wxEXPAND,5);
+
+               sizerDialog->Add(text,0,wxALIGN_TOP,10);
+               sizerDialog->AddSpacer(5);
+               sizerDialog->Add(sizer,0,wxALIGN_CENTER,10);
+               sizerDialog->Add(buts,0,wxALIGN_CENTER | wxTOP | wxBOTTOM,10);
+
+               SetSizer(sizerDialog);
+
+               Centre();
+               ShowModal();
+               Destroy();
+
+       }
+
+       //=========================================================================
+
+       void wxEditionDialog::onClickOk(wxCommandEvent& event)
+       {
+
+               for(int i=0;i<_lstValues.size();i++)
+               {
+                       std::string text = _lstValues[i]->GetLabelText();               
+                       _model->setValueToInputPort(i,text);
+               }
+
+               Close(true);
+       }
+
+       //=========================================================================
+
+       void wxEditionDialog::onClickClose(wxCommandEvent& event)
+       {
+               Close(true);            
+       }
+
+       //=========================================================================
+
+}  // EO namespace bbtk
+
+// EOF
+
diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxEditionDialog.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxEditionDialog.h
new file mode 100644 (file)
index 0000000..95dc0ad
--- /dev/null
@@ -0,0 +1,97 @@
+/*=========================================================================                                                                               
+Program:   bbtk
+Module:    $RCSfile$
+Language:  C++
+Date:      $Date$
+Version:   $Revision$
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+
+
+/**
+*  \file 
+*  \brief Class bbtk::wxEditionDialog : abstract black-box interface. 
+*/
+
+/**
+* \class bbtk::wxEditionDialog
+* \brief 
+*/
+
+#ifndef __wxEditionDialog_h__
+#define __wxEditionDialog_h__
+
+//Includes same project
+#include "bbtkwxGUIEditorGraphicBBS.h"
+#include "GPortModel.h"
+#include "wxVtkSceneManager.h"
+
+//Includes wxWidgets
+#include <wx/wx.h>
+#include <wx/aui/aui.h>
+
+//Includes creaMaracasVisu
+
+//Includes std
+#include <iostream>
+
+
+
+
+namespace bbtk
+{
+
+       class wxGUIEditorGraphicBBS;
+
+       class wxVtkSceneManager;
+
+       class wxEditionDialog :  public wxDialog
+       {
+       public: 
+               wxEditionDialog(wxGUIEditorGraphicBBS *parent,wxVtkSceneManager* scene);
+               wxEditionDialog(wxGUIEditorGraphicBBS *parent,GBlackBoxModel *model);
+               ~wxEditionDialog();
+
+               void constructBlackBoxEditionDialog();
+               void onClickOk(wxCommandEvent& event);
+               void onClickClose(wxCommandEvent& event);
+               
+       private:
+               wxAuiManager *_dialogAUIMgr;
+               wxPanel *_panel;
+               std::vector<wxTextCtrl*> _lstValues;
+               std::vector<wxStaticText*> _lstTypes;
+               std::vector<wxStaticText*> _lstNames;
+               GBlackBoxModel *_model;
+       
+       protected:
+
+       };
+
+
+}
+// namespace bbtk
+#endif
+
index 5995ea2a9efa248796f8256b78f0b9366fe9fa4b..fc8b048bd06eda6e449d782aca9a646cd85c1104 100644 (file)
@@ -133,6 +133,13 @@ namespace bbtk
        }
 
        //=========================================================================
+       
+       void wxGEditorTabPanel::editDiagramParameters(wxVtkSceneManager* scene)
+       {
+               _panelsManager->editDiagramParameters(scene);
+       }
+
+       //=========================================================================
 
 }  // EO namespace bbtk
 
index 184714c0ec38dd29bde34aa080f1ec2b01f543a7..6d6c39a3c0730c3119814ee2f0c2924e1107f508 100644 (file)
@@ -83,6 +83,7 @@ namespace bbtk
                void updateStatusBar(std::string textStatus);
                std::string getDiagramScript();
                void editBlackBox(GBlackBoxModel *bbmodel);
+               void editDiagramParameters(wxVtkSceneManager* scene);
                
        private:
 
index 6410671cc80638dec9ba68bd06144e0ba2de7b16..1e9061e1dc7176d68addc78334b0eed71c43373e 100644 (file)
@@ -110,6 +110,13 @@ namespace bbtk
 
        //=========================================================================
 
+       void wxTabPanelsManager::editDiagramParameters(wxVtkSceneManager* scene)
+       {
+               _parent->editDiagramParameters(scene);
+       }
+
+       //=========================================================================
+
 
 
 }  // EO namespace bbtk
index 0b168a6080dc88d65f4d83c2eaa7a87f06bc99b7..556a504cfc07c6cdfde8ef6dce36dd2e63b28f98 100644 (file)
@@ -76,7 +76,7 @@ namespace bbtk
                void updateStatusBar(std::string textStatus);
                std::string getActualDiagramScript();
                void editBlackBox(GBlackBoxModel *bbmodel);
-               
+               void editDiagramParameters(wxVtkSceneManager* scene);
 
        private: