X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMaracasIRMView.cxx;h=4242c4f20a8da4e61a0ba503d38b3e445239ae3c;hb=540c5242ac6cd8ab330f1642b0fc82e3b49d20db;hp=3355f76d85462b697083efc78e3102736f81d9c6;hpb=21c2226cf3dcad1daf3fb04818583b559694fa81;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx index 3355f76..4242c4f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMaracasIRMView.cxx,v $ Language: C++ - Date: $Date: 2009/04/09 13:58:38 $ - Version: $Revision: 1.2 $ + Date: $Date: 2009/04/14 14:48:07 $ + Version: $Revision: 1.4 $ Copyright: (c) 2002, 2003 License: @@ -36,7 +36,7 @@ wxMaracasIRMView::wxMaracasIRMView( wxWindow* parent,std::string path) _path = path; std::string iconsdir = path; - iconsdir+="/Data/Icons"; + iconsdir+="/data/Icons"; wxToolBar* toolbar = new ToolBar(this,iconsdir); wxAuiPaneInfo paneinfo; wxauimanager->AddPane(toolbar,paneinfo.ToolbarPane().Top()); @@ -94,9 +94,10 @@ void wxMaracasIRMView::changeColor(int propid, double red, double green, double }catch(char* str){ - std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str), wxString(str), wxICON_ERROR); + wxString s( str,wxConvUTF8 ); + wxMessageDialog* diag = new wxMessageDialog(this, s, s, wxICON_ERROR); diag->ShowModal(); + delete diag; } } @@ -107,7 +108,7 @@ void wxMaracasIRMView::onLoadImageFile(){ wxString stl(_T("stl")); wxFileDialog* fildial = new wxFileDialog(this, wxString(_T("Select a STL file")),wxString(_T("")), - wxString(_T("")),"STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd" ); + wxString(_T("")),wxString(_T("STL files (*.stl)|*.stl|MHD files (*.mhd)|*.mhd")) ); if(fildial->ShowModal()==wxID_OK){ wxString filename = fildial->GetFilename(); @@ -125,10 +126,11 @@ void wxMaracasIRMView::onLoadImageFile(){ } void wxMaracasIRMView::loadPropMHD(wxString filename, wxString dataname){ - - vtkImageData* img = irmmanager->getImageData(filename.c_str()); + std::string s = std::string(filename.mb_str()); + vtkImageData* img = irmmanager->getImageData(s); if(img!=NULL){ - addPropMHD(img, dataname.c_str()); + s = std::string(dataname.mb_str()); + addPropMHD(img, s); } @@ -149,17 +151,18 @@ void wxMaracasIRMView::addPropMHD(vtkImageData* imgdata, std::string dataname){ }catch(char* str){ std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str), wxString(str), wxICON_ERROR); + wxMessageDialog* diag = new wxMessageDialog(this, wxString( str,wxConvUTF8 ), wxString( str,wxConvUTF8 ), wxICON_ERROR); diag->ShowModal(); } } void wxMaracasIRMView::loadProp3D(wxString filename, wxString dataname){ - - vtkProp3D* prop3D = irmmanager->getProp3D(filename.c_str()); + std::string s = std::string(filename.mb_str()); + vtkProp3D* prop3D = irmmanager->getProp3D(s); if(prop3D != NULL){ - this->addProp3D(prop3D,dataname.c_str()); + s = std::string(dataname.mb_str() ); + this->addProp3D(prop3D,s); }else{ //TODO msj to the user indicating error in file } @@ -177,14 +180,14 @@ void wxMaracasIRMView::addProp3D(vtkProp3D* prop3D, std::string dataname){ } }catch(char* str){ std::cout << "Exception : " << str << '\n'; - wxMessageDialog* diag = new wxMessageDialog(this, wxString(str), wxString(str), wxICON_ERROR); + wxMessageDialog* diag = new wxMessageDialog(this, wxString(str,wxConvUTF8 ), wxString(str,wxConvUTF8 ), wxICON_ERROR); diag->ShowModal(); } } void wxMaracasIRMView::addIRMViewPanel(wxMaracasIRMViewPanel* irmview, std::string dataname){ - wxString s(dataname.c_str()); + wxString s(dataname.c_str(),wxConvUTF8 ); wxAuiPaneInfo paneinfo; wxauimanager->AddPane(irmview, paneinfo.DefaultPane().Centre().DestroyOnClose().Caption(s)); wxauimanager->Update(); @@ -207,38 +210,34 @@ wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){ void wxMaracasIRMViewProp3D::createControls(){ wxString choices[2]; - choices[0] = "On"; - choices[1] = "Off"; + choices[0] = wxString(_T("On")); + choices[1] = wxString(_T("Off")); checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor"))); this->addControl(checkbox); - Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onCheckBoxChange); - checkbox->SetValue(true); + Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onCheckBoxChange); + checkbox->SetValue(true); - wxBoxSizer* sizercolor = new wxBoxSizer(wxVERTICAL); std::string iconfile = wxMaracasIRMView::getInstance()->getPath(); iconfile+= "/Data/Icons/Color.png"; wxBitmap* bitmap = new wxBitmap(wxString(iconfile.c_str(),wxConvUTF8), wxBITMAP_TYPE_PNG); - _colorchoose = new wxBitmapButton(this, -1, *bitmap); - sizercolor->Add(_colorchoose,wxFIXED_MINSIZE); + _colorchoose = new wxBitmapButton(this, -1, *bitmap,wxDefaultPosition,wxSize(30,30)); Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onColorChange); + wxBoxSizer* sizercolor = new wxBoxSizer(wxVERTICAL); + sizercolor->Add(checkbox,wxFIXED_MINSIZE); + sizercolor->Add(_colorchoose,wxFIXED_MINSIZE); this->addControl(sizercolor); - + + wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity"))); + opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); + Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onOpacityRelease); wxBoxSizer* sizeropacity = new wxBoxSizer(wxVERTICAL); - wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity"))); sizeropacity->Add(label,wxFIXED_MINSIZE); - opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); sizeropacity->Add(opacity,wxFIXED_MINSIZE); - Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onOpacityRelease); - this->addControl(sizeropacity); - - /*isovalue = new wxSlider(this, -1,0,0,100); - this->addControl(isovalue); - Connect(isovalue->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onIsoValueRelease); */ } void wxMaracasIRMViewProp3D::onCheckBoxChange(wxCommandEvent& event){ wxMaracasIRMView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());