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);
-
- }
+
}
}
//=========================================================================
+ 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();
virtual bool OnLeftButtonDown();
virtual bool OnLeftButtonUp();
virtual bool OnRightButtonUp();
+ virtual bool OnLeftDClick();
virtual void update(int idController,int command);
}
//=========================================================================
-
- 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;
virtual bool OnLeftButtonDown();
virtual bool OnLeftButtonUp();
virtual bool OnMiddleButtonDown();
- virtual bool OnLeftDClick();
virtual bool OnRightButtonUp();
//=========================================================================
+ void wxGUIEditorGraphicBBS::editDiagramParameters(wxVtkSceneManager* scene)
+ {
+ wxEditionDialog* dialog = new wxEditionDialog(this,scene);
+ dialog->Show();
+ }
+
+ //=========================================================================
+
void wxGUIEditorGraphicBBS::updateStatusBar(std::string textStatus)
{
SetStatusText(_T(textStatus));
#include "wxTabPanelsManager.h"
#include "wxPropertiesPanel.h"
#include "wxEditionDialog.h"
+#include "wxVtkSceneManager.h"
#include "C:\RaC\CREATIS\bbtkGEditor\data\icons\wxart_new.xpm"
//Includes creaMaracasVisu
namespace bbtk
{
class wxTabPanelsManager;
+
+ class wxVtkSceneManager;
class wxGUIEditorGraphicBBS : public wxFrame
{
void executeActualDiagram();
void editBlackBox(GBlackBoxModel *bbmodel);
+ void editDiagramParameters(wxVtkSceneManager* scene);
void RegenerateAll();
void DoRegeneratePackageDoc(const std::string& pack);
--- /dev/null
+/*=========================================================================
+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
+
--- /dev/null
+/*=========================================================================
+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
+
}
//=========================================================================
+
+ void wxGEditorTabPanel::editDiagramParameters(wxVtkSceneManager* scene)
+ {
+ _panelsManager->editDiagramParameters(scene);
+ }
+
+ //=========================================================================
} // EO namespace bbtk
void updateStatusBar(std::string textStatus);
std::string getDiagramScript();
void editBlackBox(GBlackBoxModel *bbmodel);
+ void editDiagramParameters(wxVtkSceneManager* scene);
private:
//=========================================================================
+ void wxTabPanelsManager::editDiagramParameters(wxVtkSceneManager* scene)
+ {
+ _parent->editDiagramParameters(scene);
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
void updateStatusBar(std::string textStatus);
std::string getActualDiagramScript();
void editBlackBox(GBlackBoxModel *bbmodel);
-
+ void editDiagramParameters(wxVtkSceneManager* scene);
private: