#include <iostream>
#include <creaWx.h>
+#include "creaSystem.h"
#include "wx/treectrl.h"
#include "wx/treebase.h"
#include "wx/tooltip.h"
+#include "wx/wxhtml.h"
+#include "wx/statline.h"
#include "CDMUtilities.h"
#include "creaDevManagerIds.h"
BEGIN_EVENT_TABLE(wxCDMMainFrame, wxFrame)
EVT_MENU(ID_MENU_NEW_PROJECT, wxCDMMainFrame::OnMenuNewProject)
EVT_MENU(ID_MENU_OPEN_PROJECT, wxCDMMainFrame::OnMenuOpenProject)
-EVT_MENU(ID_MENU_OPEN_RECENT, wxCDMMainFrame::OnMenuOpenRecent)
EVT_MENU(ID_MENU_CLOSE_PROJECT, wxCDMMainFrame::OnMenuCloseProject)
-EVT_MENU(ID_MENU_CLOSE_ALL_PROJECTS, wxCDMMainFrame::OnMenuCloseAllProjects)
EVT_MENU(ID_MENU_EXPORT_HIERARCHY, wxCDMMainFrame::OnMenuExportHierarchy)
EVT_MENU(ID_MENU_EXIT, wxCDMMainFrame::OnMenuExit)
EVT_MENU(ID_MENU_REFRESH_PROJECT, wxCDMMainFrame::OnMenuRefreshProject)
-EVT_MENU(ID_MENU_CUT, wxCDMMainFrame::OnMenuMenuCut)
-EVT_MENU(ID_MENU_COPY, wxCDMMainFrame::OnMenuMenuCopy)
-EVT_MENU(ID_MENU_PASTE, wxCDMMainFrame::OnMenuMenuPaste)
-EVT_MENU(ID_MENU_DELETE, wxCDMMainFrame::OnMenuMenuDelete)
-EVT_MENU(ID_MENU_SELECT_ALL, wxCDMMainFrame::OnMenuSelectAll)
-EVT_MENU(ID_MENU_SELECT_NONE, wxCDMMainFrame::OnMenuSelectNone)
-EVT_MENU(ID_MENU_EVENT_LOG, wxCDMMainFrame::OnMenuEventLog)
EVT_MENU(ID_MENU_BBTK_GRAPHICAL_EDITOR, wxCDMMainFrame::OnMenuBBTKGraphicalEditor)
EVT_MENU(ID_MENU_MINITOOLS, wxCDMMainFrame::OnMenuMiniTools)
EVT_MENU(ID_MENU_CODE_EDITOR, wxCDMMainFrame::OnMenuCodeEditor)
menu_File = new wxMenu();
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, 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, wxT("&Export Project Hierarchy..."));
menu_File->AppendSeparator();
//EditMenu
menu_Edit = new wxMenu();
menu_Edit->Append(ID_MENU_REFRESH_PROJECT, wxT("&Refresh Project"));
- menu_Edit->AppendSeparator();
- 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, 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, wxT("&Edit"));
//ToolsMenu
menu_Tools = new wxMenu();
- 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"));
std::cout << "building ui" << std::endl;
-
//populate tree control
tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
+
//change project's actions panel
if(this->panel_ProjectActions!= NULL)
{
auiManager.Update();
-
}
event.Skip();
}
-void wxCDMMainFrame::OnMenuOpenRecent(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuOpenRecent not implemented" << std::endl;
- event.Skip();
-}
+
void wxCDMMainFrame::OnMenuCloseProject(wxCommandEvent& event)
{
std::cout << "closing project" << std::endl;
auiManager.Update();
event.Skip();
}
-void wxCDMMainFrame::OnMenuCloseAllProjects(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuCloseAllProjects closing only one project" << std::endl;
- std::string* result;
- if(!this->model->CloseProject(result))
- {
- std::cout << "error closing project: " << *result << std::endl;
- wxMessageBox( crea::std2wx(result->c_str()), wxT("Close Project - Error"), wxICON_ERROR);
- }
- tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
-
- if(this->panel_Properties != NULL)
- {
- auiManager.DetachPane(this->panel_Properties);
- this->panel_Properties->Destroy();
- this->panel_Properties = NULL;
- }
- if(this->panel_ProjectActions != NULL)
- {
- auiManager.DetachPane(this->panel_ProjectActions);
- this->panel_ProjectActions->Destroy();
- this->panel_ProjectActions = NULL;
- }
-
- this->panel_Properties = new wxCDMMainDescriptionPanel(
- this,
- ID_WINDOW_PROPERTIES,
- wxT("Description Panel"),
- wxDefaultPosition,
- wxSize(600, 400),
- 0
- );
-
- auiManager.AddPane(panel_Properties, wxAuiPaneInfo().Center().Name(wxT("panel_Properties")).Caption(wxT("")).BestSize(600,400));
- auiManager.Update();
- event.Skip();
-}
void wxCDMMainFrame::OnMenuExportHierarchy(wxCommandEvent& event)
{
std::cerr << "Event OnMenuExportHierarchy not implemented" << std::endl;
{
wxMessageBox( crea::std2wx(result->c_str()), wxT("Refresh Project - Error"), wxICON_ERROR);
}
- this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
-
- this->auiManager.Update();
-
- this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
- this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
+ if(this->model->GetProject() != NULL)
+ {
+ this->tree_Projects->BuildTree(this->model->GetModelElements(), this->model->GetProject());
+ this->auiManager.Update();
- //TODO: Show possible problems in CMakeLists files
- event.Skip();
-}
-void wxCDMMainFrame::OnMenuMenuCut(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuMenuCut not implemented" << std::endl;
- event.Skip();
-}
-void wxCDMMainFrame::OnMenuMenuCopy(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuMenuCopy not implemented" << std::endl;
- event.Skip();
-}
-void wxCDMMainFrame::OnMenuMenuPaste(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuMenuPaste not implemented" << std::endl;
- event.Skip();
-}
-void wxCDMMainFrame::OnMenuMenuDelete(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuMenuDelete not implemented" << std::endl;
- event.Skip();
-}
-void wxCDMMainFrame::OnMenuSelectAll(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuSelectAll not implemented" << std::endl;
- event.Skip();
-}
-void wxCDMMainFrame::OnMenuSelectNone(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuSelectNone not implemented" << std::endl;
+ this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), false);
+ this->tree_Projects->SelectItem(this->model->GetProject()->GetId(), true);
+ }
event.Skip();
}
-//Tools Menu
-void wxCDMMainFrame::OnMenuEventLog(wxCommandEvent& event)
-{
- std::cerr << "Event OnMenuEventLog not implemented" << std::endl;
- event.Skip();
-}
void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
{
std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
//Help Menu
void wxCDMMainFrame::OnMenuHelp(wxCommandEvent& event)
{
- std::cerr << "Event OnMenuHelp not implemented" << std::endl;
- event.Skip();
+ wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en/CreatoolsDocumentation"), 0);
}
void wxCDMMainFrame::OnMenuReportBug(wxCommandEvent& event)
{
- std::cerr << "Event OnMenuReportBug not implemented" << std::endl;
- event.Skip();
+ wxLaunchDefaultBrowser(_T("http://vip.creatis.insa-lyon.fr:9002/projects/crea"), 0);
}
void wxCDMMainFrame::OnMenuAboutCreaDevManager(wxCommandEvent& event)
{
- std::cerr << "Event OnMenuAboutCreaDevManager not implemented" << std::endl;
- event.Skip();
+ wxBoxSizer *topsizer;
+ wxHtmlWindow *html;
+ wxDialog dlg(this, wxID_ANY, wxString(_("About")));
+
+ topsizer = new wxBoxSizer(wxVERTICAL);
+
+ html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
+ html -> SetBorders(0);
+ html -> LoadPage(wxT("about.html"));
+ html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
+ html -> GetInternalRepresentation() -> GetHeight());
+
+ topsizer -> Add(html, 1, wxALL, 10);
+
+#if wxUSE_STATLINE
+ topsizer -> Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
+#endif // wxUSE_STATLINE
+
+ wxButton *bu1 = new wxButton(&dlg, wxID_OK, _("OK"));
+ bu1 -> SetDefault();
+
+ topsizer -> Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
+
+ dlg.SetSizer(topsizer);
+ topsizer -> Fit(&dlg);
+
+ dlg.ShowModal();
}
void wxCDMMainFrame::OnMenuAboutCreatis(wxCommandEvent& event)
{
- std::cerr << "Event OnMenuAboutCreatis not implemented" << std::endl;
- event.Skip();
+ wxLaunchDefaultBrowser(_T("http://www.creatis.insa-lyon.fr/site/en"), 0);
}
void wxCDMMainFrame::OnTreeSelectionChanged(wxTreeEvent& event)