X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FwxCDMMainFrame.cpp;h=e1578f94db44b5f5e95723a688da7b8a0dbcc39d;hb=c2943a0172ac4e3f6e2d7352913faa793887370a;hp=630c1f85c8712072b2f40888aa29396d028e3804;hpb=17824854619941a12697fea8524f4218f9a14ef9;p=crea.git diff --git a/lib/creaDevManagerLib/wxCDMMainFrame.cpp b/lib/creaDevManagerLib/wxCDMMainFrame.cpp index 630c1f8..e1578f9 100755 --- a/lib/creaDevManagerLib/wxCDMMainFrame.cpp +++ b/lib/creaDevManagerLib/wxCDMMainFrame.cpp @@ -2,8 +2,10 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé) +# pour la Sant�) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # 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, @@ -20,21 +22,23 @@ # # 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. -# ------------------------------------------------------------------------ */ +# ------------------------------------------------------------------------ +*/ #include "wxCDMMainFrame.h" +#include + +#include +#include "CDMUtilities.h" + #include "creaDevManagerIds.h" #include "wxCDMMainDescriptionPanel.h" #include "wxCDMProjectActionsPanel.h" #include "wxCDMNewProjectDialog.h" -#include - - - BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame) EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject) EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject) @@ -102,51 +106,51 @@ void wxCDMMainFrame::CreateMenus() //FileMenu menu_File = new wxMenu(); - menu_File->Append(ID_MENU_NEW_PROJECT, wxString("&New Project...")); - menu_File->Append(ID_MENU_OPEN_PROJECT, wxString("&Open Project...")); - menu_File->Append(ID_MENU_OPEN_RECENT, wxString("Open &Recent")); + menu_File->Append(ID_MENU_NEW_PROJECT, wxT("&New Project...")); + menu_File->Append(ID_MENU_OPEN_PROJECT, wxT("&Open Project...")); + menu_File->Append(ID_MENU_OPEN_RECENT, wxT("Open &Recent")); menu_File->AppendSeparator(); - menu_File->Append(ID_MENU_CLOSE_PROJECT, wxString("&Close Project")); - menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxString("C&lose All Projects")); + menu_File->Append(ID_MENU_CLOSE_PROJECT, wxT("&Close Project")); + menu_File->Append(ID_MENU_CLOSE_ALL_PROJECTS, wxT("C&lose All Projects")); menu_File->AppendSeparator(); - menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxString("&Export Project Hierarchy...")); + menu_File->Append(ID_MENU_EXPORT_HIERARCHY, wxT("&Export Project Hierarchy...")); menu_File->AppendSeparator(); - menu_File->Append(ID_MENU_EXIT, wxString("E&xit")); + menu_File->Append(ID_MENU_EXIT, wxT("E&xit")); - menuBar->Append(menu_File, wxString("&File")); + menuBar->Append(menu_File, wxT("&File")); //EditMenu menu_Edit = new wxMenu(); - menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxString("&Refresh Project")); + menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project")); menu_Edit->AppendSeparator(); - menu_Edit->Append(ID_MENU_CUT, wxString("Cu&t")); - menu_Edit->Append(ID_MENU_COPY, wxString("&Copy")); - menu_Edit->Append(ID_MENU_PASTE, wxString("&Paste")); + menu_Edit->Append(ID_MENU_CUT, wxT("Cu&t")); + menu_Edit->Append(ID_MENU_COPY, wxT("&Copy")); + menu_Edit->Append(ID_MENU_PASTE, wxT("&Paste")); menu_Edit->AppendSeparator(); - menu_Edit->Append(ID_MENU_DELETE, wxString("&Delete")); - menu_Edit->Append(ID_MENU_SELECT_ALL, wxString("Select &All")); - menu_Edit->Append(ID_MENU_SELECT_NONE, wxString("Ca&ncel Selection")); + menu_Edit->Append(ID_MENU_DELETE, wxT("&Delete")); + menu_Edit->Append(ID_MENU_SELECT_ALL, wxT("Select &All")); + menu_Edit->Append(ID_MENU_SELECT_NONE, wxT("Ca&ncel Selection")); - menuBar->Append(menu_Edit, wxString("&Edit")); + menuBar->Append(menu_Edit, wxT("&Edit")); //ToolsMenu menu_Tools = new wxMenu(); - menu_Tools->Append(ID_MENU_EVENT_LOG, wxString("Event &Log")); - menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxString("BBTK &Graphical Editor")); - menu_Tools->Append(ID_MENU_MINITOOLS, wxString("&MiniTools")); - menu_Tools->Append(ID_MENU_CODE_EDITOR, wxString("&Code Editor")); - menu_Tools->Append(ID_MENU_COMMAND_LINE, wxString("&Command Line")); + menu_Tools->Append(ID_MENU_EVENT_LOG, wxT("Event &Log")); + menu_Tools->Append(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxT("BBTK &Graphical Editor")); + menu_Tools->Append(ID_MENU_MINITOOLS, wxT("&MiniTools")); + menu_Tools->Append(ID_MENU_CODE_EDITOR, wxT("&Code Editor")); + menu_Tools->Append(ID_MENU_COMMAND_LINE, wxT("&Command Line")); - menuBar->Append(menu_Tools, wxString("&Tools")); + menuBar->Append(menu_Tools, wxT("&Tools")); //HelpMenu menu_Help = new wxMenu(); - menu_Help->Append(ID_MENU_HELP, wxString("&Help")); - menu_Help->Append(ID_MENU_REPORT_BUG, wxString("Report &Bug")); - menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxString("&About CreaDevManager")); - menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxString("A&bout CREATIS")); + menu_Help->Append(ID_MENU_HELP, wxT("&Help")); + menu_Help->Append(ID_MENU_REPORT_BUG, wxT("Report &Bug")); + menu_Help->Append(ID_MENU_ABOUT_CREADEVMANAGER, wxT("&About CreaDevManager")); + menu_Help->Append(ID_MENU_ABOUT_CREATIS, wxT("A&bout CREATIS")); - menuBar->Append(menu_Help, wxString("&Help")); + menuBar->Append(menu_Help, wxT("&Help")); //Set Bar SetMenuBar(menuBar); @@ -175,7 +179,7 @@ void wxCDMMainFrame::CreateControls() panel_Properties = new wxCDMMainDescriptionPanel( this, ID_WINDOW_PROPERTIES, - wxString("Description Panel"), + wxT("Description Panel"), wxDefaultPosition, wxSize(300, 400), 0 @@ -186,16 +190,16 @@ void wxCDMMainFrame::CreateControls() panel_ProjectActions = new wxCDMProjectActionsPanel( this, ID_WINDOW_PROJ_ACTIONS, - wxString("Project Actions Panel"), + wxT("Project Actions Panel"), wxDefaultPosition, wxSize(600,200), 0 ); panel_ProjectActions->SetMinSize(wxSize(500, 100)); - auiManager.AddPane(tree_Projects, wxLEFT, wxString("Projects Tree")); - auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxString("Project Actions")); - auiManager.AddPane(panel_Properties, wxCENTER, wxString("Properties")); + auiManager.AddPane(tree_Projects, wxLEFT, wxT("Projects Tree")); + auiManager.AddPane(panel_ProjectActions, wxBOTTOM, wxT("Project Actions")); + auiManager.AddPane(panel_Properties, wxCENTER, wxT("Properties")); auiManager.Update(); auiManager.GetPane(tree_Projects).CloseButton(false).MaximizeButton(true); @@ -221,32 +225,27 @@ void wxCDMMainFrame::OnMenuNewProject(wxCommandEvent& event) } void wxCDMMainFrame::OnMenuOpenProject(wxCommandEvent& event) { - /* long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST; - wxDirDialog* FD = new wxDirDialog(this, wxString("Select the project directory"), wxString(""), style); + wxDirDialog* FD = new wxDirDialog(this, wxT("Select the project directory"), wxT(""), style); long userResponse; userResponse = FD->ShowModal(); if(userResponse == wxID_OK) { - switch(this->controller->OpenProject(crea::wx2std (FD->GetPath()))) + std::cout << "selection: " << crea::wx2std (FD->GetPath()) << std::endl; + std::string path = CDMUtilities::fixPath(crea::wx2std (FD->GetPath())); + std::cout << "fixed selection: " << path << std::endl; + std::string* result; + if (!this->model->OpenProject(path, result)) { - case 1: - wxMessageBox( wxT("No project selected."), wxT("Open Project - Error"), wxICON_ERROR); - event.Skip(); - break; - case 2: - wxMessageBox( wxString("Sources not found."), wxString("Open Project - Error"), wxICON_ERROR); + wxMessageBox( crea::std2wx(result->c_str()), wxT("Open Project - Error"), wxICON_ERROR); event.Skip(); - break; - case 0: - break; }; - - ((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects()); + //TODO: Create tree control + //((wxCreaDevManagerTreeCtrl*)tree_Projects)->BuildTree(controller->GetActiveProjects()); auiManager.Update(); } - */ + event.Skip(); } void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)