+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# 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,
+# 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.
+# ------------------------------------------------------------------------
+*/
+
#include "wxCDMMainFrame.h"
+#include <iostream>
+
+#include <creaWx.h>
+#include "CDMUtilities.h"
+
#include "creaDevManagerIds.h"
#include "wxCDMMainDescriptionPanel.h"
#include "wxCDMProjectActionsPanel.h"
#include "wxCDMNewProjectDialog.h"
-#include <iostream>
-
-
-
BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
//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);
panel_Properties = new wxCDMMainDescriptionPanel(
this,
ID_WINDOW_PROPERTIES,
- wxString("Description Panel"),
+ wxT("Description Panel"),
wxDefaultPosition,
wxSize(300, 400),
0
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);
}
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)