]> Creatis software - creaContours.git/commitdiff
Some fixes for wxString vs std::string pb.
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Thu, 6 Nov 2008 19:21:28 +0000 (19:21 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Thu, 6 Nov 2008 19:21:28 +0000 (19:21 +0000)
Still a lot of errors on Linux

lib/Interface_Icons_NDimensions/interfMenuBar.h
lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.cxx
lib/Interface_Icons_NDimensions/interfToolsSpreadPanel.h
lib/Interface_ManagerContour_NDimensions/wxContourEventHandler.cxx
lib/Interface_ManagerContour_NDimensions/wxContour_ActionCommandsID.h
lib/Interface_ManagerContour_NDimensions/wxContour_ButtonsBar.cxx
lib/Interface_ManagerContour_NDimensions/wxInstantChooserPanel.cxx
lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx

index 86a011a92e5b8068bea0de562d458b54b6c08ac2..53b11f726cfed685c5337130f2b4e6e51162de82 100644 (file)
@@ -55,8 +55,11 @@ public:
                
                for(int i = 0; i < vnom.size(); i++){
                        //sizex = vectbutton[i]->GetSize().GetWidth();
-                       std::string n = vnom[i];
-                       vectbutton[i]->SetToolTip(wxString(n));
+                       //const std::string n = vnom[i];
+                       wxString newstring1(vnom[i].c_str() , wxConvUTF8);
+                       //vectbutton[i]->SetToolTip(wxString(n));
+                       vectbutton[i]->SetToolTip(newstring1);
+                       
                        //wxStaticText* statictext = getText(n, sizex, 15);
                        //flexsizer->Add(statictext, wxEXPAND |wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTRE_HORIZONTAL|wxSHAPED);
                }
@@ -73,12 +76,13 @@ public:
        virtual wxBitmapButton* getButton(std::string imgpath, int sizex, int sizey){
                vectimgpath.push_back(imgpath);
                                
+               wxString newstring1( imgpath.c_str() , wxConvUTF8);
+               //wxBitmap* bitmap = new wxBitmap(imgpath,  wxBITMAP_TYPE_PNG);
+                wxBitmap* bitmap = new wxBitmap(newstring1,  wxBITMAP_TYPE_PNG);
                
-               wxBitmap* bitmap = new wxBitmap(imgpath, wxBITMAP_TYPE_PNG);
-
                //wxSize(sizex,sizey)
                wxBitmapButton* bitmapbutton = new wxBitmapButton(this, -1, *bitmap, wxDefaultPosition, wxDefaultSize,
-                                                                                       wxBU_AUTODRAW, wxDefaultValidator, wxString(""));
+                                                                                       wxBU_AUTODRAW, wxDefaultValidator, _T(""));
 
                vectbutton.push_back(bitmapbutton);
                return bitmapbutton;
@@ -93,8 +97,10 @@ public:
        **/
        virtual wxStaticText* getText(std::string nom, int sizex, int sizey){
                vectnom.push_back(nom);
-               return new wxStaticText(this, -1, wxString(nom), wxDefaultPosition, 
-                                                               wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom));
+               wxString newstring1(nom.c_str() , wxConvUTF8);
+               return new wxStaticText(this, -1, newstring1 /*wxString(nom)*/, wxDefaultPosition, 
+                                                               //wxSize(sizex,sizey), wxALIGN_CENTRE, wxString(nom));
+                                                               wxSize(sizex,sizey), wxALIGN_CENTRE, newstring1);
        }
     /**
        **      Sets the vector funcion, this vector must contain a function for each button created
index 73e94efeb83e7f40e6880d0e14037fb6a0b775e2..20d6c8cda2beda7bb7ebcc8b7eaf493aaee5874b 100644 (file)
@@ -31,12 +31,12 @@ interfToolsSpreadPanel::~interfToolsSpreadPanel()
 }
 
 wxPanel* interfToolsSpreadPanel::initializeRadioBox(){
-       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, _T(""));
        wxString lstOptions[3];
-       lstOptions[0]="A";
-       lstOptions[1]="B";
-       lstOptions[2]="C";
-       wxRadioBox* _spreadMethodRadiobox       = new wxRadioBox(panel, -1, "Method", wxDefaultPosition, wxSize(45,80), 3 , lstOptions,  3, wxRA_SPECIFY_ROWS);
+       lstOptions[0]=_T("A");
+       lstOptions[1]=_T("B");
+       lstOptions[2]=_T("C");
+       wxRadioBox* _spreadMethodRadiobox       = new wxRadioBox(panel, -1, _T("Method"), wxDefaultPosition, wxSize(45,80), 3 , lstOptions,  3, wxRA_SPECIFY_ROWS);
        _spreadMethodRadiobox->SetSelection(2);
        return panel;
 }
@@ -44,7 +44,7 @@ wxPanel* interfToolsSpreadPanel::initializeRadioBox(){
 wxPanel* interfToolsSpreadPanel::initializeButton(std::string path, std::string nom){
                        
 
-       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, wxString(""));
+       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE, _T(""));
 
        wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1,2,2,2);      
        panel->SetSizer(flexsizer, true);
@@ -53,7 +53,7 @@ wxPanel* interfToolsSpreadPanel::initializeButton(std::string path, std::string
        wxBitmap* bitmap = new wxBitmap(path, wxBITMAP_TYPE_PNG);
 
        wxBitmapButton* bitmapbutton = new wxBitmapButton(panel, -1, *bitmap, wxDefaultPosition, wxDefaultSize,
-                                                                               wxBU_AUTODRAW, wxDefaultValidator, wxString(""));
+                                                                               wxBU_AUTODRAW, wxDefaultValidator, _T(""));
 
        
        wxStaticText* statictext = new wxStaticText(panel, -1, wxString(nom), wxDefaultPosition, 
@@ -70,9 +70,9 @@ wxPanel* interfToolsSpreadPanel::initializeButton(std::string path, std::string
 
 wxPanel* interfToolsSpreadPanel::initializeAddRemoveContour(){
        
-       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE |wxVSCROLL , wxString(""));
+       wxPanel* panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE |wxVSCROLL , _T(""));
 
-       scrollwin = new wxScrolledWindow(panel, -1, wxDefaultPosition, wxSize(80,50), wxVSCROLL, wxString(""));
+       scrollwin = new wxScrolledWindow(panel, -1, wxDefaultPosition, wxSize(80,50), wxVSCROLL, _T(""));
 
        checkboxsizer = new wxFlexGridSizer(0,1,2,2);   
 
index a0ffdb76d4221f944b486e331e124048df146587..afd5ca1eed5edbe9120aaab00ee85e66fca8157a 100644 (file)
@@ -71,4 +71,6 @@ private:
 
 };
 
-#endif
\ No newline at end of file
+#endif
index 5ae91cac3a569b6fd9b1af9b3761078ca3967a6b..ace7008429f3afb300c918ad02c90dc04b527e5c 100644 (file)
@@ -3534,7 +3534,7 @@ void wxContourEventHandler :: onREDO()
                {
 
                        porcent = 100.0* (z-minZ)/totalZ;
-                       tmpString.Printf("Saving Values  %d %c            %d/%d             %d", (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
+                       tmpString.Printf(_T("Saving Values  %d %c            %d/%d             %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
                        _staticTextInformation->SetLabel(tmpString);
 
                        //Extraction data from contours of each slice
index 61686040774b265e4e490d02a398f599661f8e3a..5319432142635b6d7a6399b429af5eabbdead99c 100644 (file)
@@ -42,7 +42,7 @@ class wxContour_ActionCommandsID {
        const static char INTERFACECONFIGURATION_TOOL     = 'U';
        const static char TEST_TOOL                       = 'V';
 
-       
+       const static char * TOOL_CODES[];
 };
 #endif // __wxContour_ActionCommandsID_HEADER_FILE__
  
index a305d1dc206e74f38bf393d67334ccc59e122ddf..5e98af661c3a22ad090c13434c39079373e3c286 100644 (file)
        :wxPanel( parent, id)//, pos, size, style, name)
        {
                //SetToolBitmapSize(wxSize(16,16));
+       
+       
+       wxString string_create(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::CREATE_TOOL] , wxConvUTF8);
                
         _createContour_Button = new wxButton( this, 
-       -1, 
-       _T("+ New Contour"), 
-       wxDefaultPosition, 
-       wxDefaultSize, 
-       0, 
-       wxDefaultValidator, 
-       wxContour_ActionCommandsID::CREATE_TOOL );
+          -1, 
+          _T("+ New Contour"), 
+          wxDefaultPosition, 
+          wxDefaultSize, 
+          0, 
+          wxDefaultValidator, 
+          string_create );
        
 //             _createContour_Button->SetToolTip(_T("CTRL-N"));
                Connect( _createContour_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-               _delete_Button = new wxButton( this, -1, _T("+ Delete"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxContour_ActionCommandsID::DELETE_TOOL );
+
+       wxString string_delete(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::DELETE_TOOL] , wxConvUTF8);
+               _delete_Button = new wxButton( this, -1, _T("+ Delete"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, string_delete );
                _delete_Button->SetToolTip(_T("BACK SPACE or DELETE key"));
                Connect( _delete_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
                _show_Button = new wxButton( this, -1, _T("Show"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::SHOW_TOOL );
                Connect( _show_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 */
-               _copy_Button = new wxButton( this, -1, _T("Copy"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::COPY_TOOL );
+       wxString string_copy(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::COPY_TOOL] , wxConvUTF8);
+
+               _copy_Button = new wxButton( this, -1, _T("Copy"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, string_copy );
                _copy_Button->SetToolTip(_T("CTRL-C"));
-               Connect( _copy_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
+               Connect( _copy_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed );
+               
+       wxString string_paste(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::PASTE_TOOL] , wxConvUTF8);              
 
-               _paste_Button = new wxButton( this, -1, _T("Paste"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxContour_ActionCommandsID::PASTE_TOOL );
+               _paste_Button = new wxButton( this, -1, _T("Paste"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, string_paste );
                _paste_Button->SetToolTip(_T("CTRL-V"));
                Connect( _paste_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-               _change_Button = new wxButton( this, -1, _T("    <-->  "), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxContour_ActionCommandsID::CHANGE_TOOL );
+       wxString string_change(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::CHANGE_TOOL] , wxConvUTF8);
+               _change_Button = new wxButton( this, -1, _T("    <-->  "), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, string_change );
                _change_Button->SetToolTip(_T("CTRL-K"));
                Connect( _change_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-               _save_Button = new wxButton( this, -1, _T("Save"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxContour_ActionCommandsID::SAVE_TOOL );
+       wxString string_save(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::SAVE_TOOL] , wxConvUTF8);
+               _save_Button = new wxButton( this, -1, _T("Save"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, string_save );
                _save_Button->SetToolTip(_T("CTRL-S"));
-               Connect( _save_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
-
-               _open_Button = new wxButton( this, -1, _T("Open"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxContour_ActionCommandsID::OPEN_TOOL );
+               Connect( _save_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed );
+               
+               
+       wxString string_open(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::OPEN_TOOL] , wxConvUTF8);
+               _open_Button = new wxButton( this, -1, _T("Open"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, string_open );
                _open_Button->SetToolTip(_T("CTRL-O"));
                Connect( _open_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-
-               _spread_Button = new wxButton( this, -1, _T("+ Spread"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::SPREAD_TOOL );
+       wxString string_spread(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::SPREAD_TOOL] , wxConvUTF8);
+               _spread_Button = new wxButton( this, -1, _T("+ Spread"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, string_spread );
 //             _spread_Button->SetToolTip(_T("CTRL-XXXXXXX"));
                Connect( _spread_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-               _automatiqueSegmentation_Button = new wxButton( this, -1, _T("+ Segmentation"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::AUTOMATIQUESEGMENTATION_TOOL );
+       wxString string_automatiqueSegmentation(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::AUTOMATIQUESEGMENTATION_TOOL] , wxConvUTF8);
+               _automatiqueSegmentation_Button = new wxButton( this, -1, _T("+ Segmentation"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, string_automatiqueSegmentation );
 //             _automatiqueSegmentation_Button->SetToolTip(_T("CTRL-XXXXXXX"));
                Connect( _automatiqueSegmentation_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-
-               _informationContour_Button = new wxButton( this, -1, _T("+ Information"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::INFORMATIONCONTOUR_TOOL );
+       wxString string_informationcontour(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::INFORMATIONCONTOUR_TOOL] , wxConvUTF8);
+               _informationContour_Button = new wxButton( this, -1, _T("+ Information"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, string_informationcontour );
 //             _informationContour_Button->SetToolTip(_T("CTRL-XXXXXXX"));
                Connect( _informationContour_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-               _interfaceConfiguration_Button = new wxButton( this, -1, _T("+ Configuration"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::INTERFACECONFIGURATION_TOOL );
+       wxString string_interfaceconfiguration(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::INTERFACECONFIGURATION_TOOL] , wxConvUTF8);
+               _interfaceConfiguration_Button = new wxButton( this, -1, _T("+ Configuration"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, string_interfaceconfiguration );
 //             _informationContour_Button->SetToolTip(_T("CTRL-XXXXXXX"));
                Connect( _interfaceConfiguration_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
-
+       wxString string_test(wxContour_ActionCommandsID::TOOL_CODES[wxContour_ActionCommandsID::TEST_TOOL] , wxConvUTF8);
 //Test button Methods A-B-C in  Juan Carlos Prieto 22-09-08
-               _interfaceTest_Button = new wxButton( this, -1, _T("+ Test"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, wxContour_ActionCommandsID::TEST_TOOL );
+               _interfaceTest_Button = new wxButton( this, -1, _T("+ Test"), wxDefaultPosition, wxDefaultSize, 0,wxDefaultValidator, string_test );
 //             _informationContour_Button->SetToolTip(_T("CTRL-XXXXXXX"));
                Connect( _interfaceTest_Button->GetId(),   wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContour_ButtonsBar:: onActionButtonPressed ); 
 
index 96e77abc2e5096ed547fa829149059fdbd8b8fa1..3184c942ac9dbcbc994e441c860f94685f6d0ae2 100644 (file)
@@ -442,4 +442,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHOOSER_CHANGE )
                }
 
                return isChecked;
-       }
\ No newline at end of file
+       }
+        
+        
index 6f0ff37384dca4a28095563667b012464d18d99f..c765d330a68f4fcaac7da7258c8ca735f394aac0 100644 (file)
@@ -332,7 +332,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                        setControlActiveStateOf( _workingGroup, false );
                        _workingGroup->clear();
                }
-        std::map <std::string, ContourWrap_ViewControl *>::iterator iter = NULL; 
+        std::map <std::string, ContourWrap_ViewControl *>::iterator iter; //  = NULL; 
 
 //EED Borrame
 // FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
@@ -1092,7 +1092,8 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
        {
                FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
                long int start = clock();
-               double sg = (double)(start) / (double)CLK_TCK;
+               //double sg = (double)(start) / (double)CLK_TCK;  // CLK_TCK not ANSI C.
+               double sg = (double)(start) / (double)CLOCKS_PER_SEC;
                int tmpPx,tmpPy;
                wxVTKRenderWindowInteractor *wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
                wxVTKiren->GetEventPosition( tmpPx , tmpPy );