/* # --------------------------------------------------------------------- # # 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. # ------------------------------------------------------------------------ */ /* * wxCDMProjectReadyDialog.cpp * * Created on: 3/1/2013 * Author: Daniel Felipe Gonzalez Obando */ #include "wxCDMProjectHelpDialog.h" #include "wxCDMProjectDescriptionPanel.h" #include "creaDevManagerIds.h" BEGIN_EVENT_TABLE(wxCDMProjectHelpDialog, wxDialog) EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectHelpDialog::OnFinish) EVT_BUTTON(ID_BUTTON_GOTO_PACKAGE_MANAGER, wxCDMProjectHelpDialog::OnManagePackages) EVT_BUTTON(ID_BUTTON_GOTO_LIB_MANAGER, wxCDMProjectHelpDialog::OnManageLibraries) EVT_BUTTON(ID_BUTTON_GOTO_APPLI_MANAGER, wxCDMProjectHelpDialog::OnManageApplications) EVT_CHECKBOX(ID_CHECKBOX_DISABLE_HELP, wxCDMProjectHelpDialog::OnDisableHelp) END_EVENT_TABLE() wxCDMProjectHelpDialog::wxCDMProjectHelpDialog( wxWindow* parent, wxCDMProjectDescriptionPanel* projectDescription, wxWindowID id, const wxString& caption, const wxPoint& position, const wxSize& size, long style ) { wxCDMProjectHelpDialog::Create(parent, id, caption, position, size, style); this->projectDescription = projectDescription; } wxCDMProjectHelpDialog::~wxCDMProjectHelpDialog() { } bool wxCDMProjectHelpDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& position, const wxSize& size, long int style ) { wxDialog::Create(parent, id, caption, position, size, style); this->CreateControls(); return TRUE; } void wxCDMProjectHelpDialog::CreateControls() { wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Your project is ready!"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY); v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 5); wxStaticText* instruction = new wxStaticText( this, wxID_ANY, crea::std2wx("When you create a project it comes with a default package. If you need to work in it or you want to create more " "packages you can do it by clicking the \"Manage Packages\" button bellow. You can also work with Libraries and " "Applications, just click in the \"Manage Libraries\" button or \"Manage Applications\" button to start working " "with them.\n" "\n" "Select an action or click Close to continue working on the project."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); v_sizer1->Add(instruction, 0,wxEXPAND | wxALL, 5); wxFlexGridSizer* formItems = new wxFlexGridSizer(2,2,9,15); wxButton* managePackagesBtn = new wxButton(this, ID_BUTTON_GOTO_PACKAGE_MANAGER, wxT("Manage Packages")); wxButton* manageLibrariesBtn = new wxButton(this, ID_BUTTON_GOTO_LIB_MANAGER, wxT("Manage Libraries")); manageLibrariesBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseEnter,NULL,this); manageLibrariesBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnLibMouseExit,NULL,this); wxButton* manageApplicationsBtn = new wxButton(this, ID_BUTTON_GOTO_APPLI_MANAGER, wxT("Manage Applications")); manageApplicationsBtn->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseEnter,NULL,this); manageApplicationsBtn->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectHelpDialog::OnAppliMouseExit,NULL,this); formItems->Add(managePackagesBtn, 1, wxALIGN_CENTER_VERTICAL); formItems->Add(manageLibrariesBtn, 1, wxALIGN_CENTER_VERTICAL); formItems->Add(manageApplicationsBtn, 1, wxALIGN_CENTER_VERTICAL); formItems->AddGrowableCol(0,1); formItems->AddGrowableCol(1,1); v_sizer1->Add(formItems, 1, wxEXPAND | wxALL, 15); v_sizer1->Add(new wxCheckBox(this, ID_CHECKBOX_DISABLE_HELP, wxT("&Disable help")), 0, wxALIGN_RIGHT | wxRIGHT, 10); v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")), 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM | wxALIGN_CENTER_VERTICAL, 30); SetSizer(v_sizer1); //v_sizer1->RecalcSizes(); } void wxCDMProjectHelpDialog::OnFinish(wxCommandEvent& event) { this->EndDialog(wxID_CANCEL); } void wxCDMProjectHelpDialog::OnManagePackages(wxCommandEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); newEvent->SetId(1); newEvent->SetString(wxT("manage_packages")); newEvent->SetInt(this->projectDescription->GetProject()->GetId()); wxPostEvent(this->GetParent(), *newEvent); event.Skip(); this->EndDialog(wxID_OK); } void wxCDMProjectHelpDialog::OnManageLibraries(wxCommandEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); newEvent->SetId(1); newEvent->SetString(wxT("manage_libraries")); wxPostEvent(this->GetParent(), *newEvent); wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); if(this->projectDescription->GetProject()->GetLib() != NULL) { int CMId = this->projectDescription->GetProject()->GetLib()->GetId(); newEvent1->SetInt(CMId); newEvent1->SetId(0); wxPostEvent(this->GetParent(), *newEvent1); } event.Skip(); this->EndDialog(wxID_OK); } void wxCDMProjectHelpDialog::OnManageApplications(wxCommandEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED); newEvent->SetId(1); newEvent->SetString(wxT("manage_applications")); wxPostEvent(this->GetParent(), *newEvent); wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); if(this->projectDescription->GetProject()->GetAppli() != NULL) { int CMId = this->projectDescription->GetProject()->GetAppli()->GetId(); newEvent1->SetInt(CMId); newEvent1->SetId(0); wxPostEvent(this->GetParent(), *newEvent1); } event.Skip(); this->EndDialog(wxID_OK); } void wxCDMProjectHelpDialog::OnAppliMouseEnter(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); if(this->projectDescription->GetProject()->GetAppli() != NULL) { int AppId = this->projectDescription->GetProject()->GetAppli()->GetId(); newEvent->SetInt(AppId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); } event.Skip(); } void wxCDMProjectHelpDialog::OnAppliMouseExit(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); if(this->projectDescription->GetProject()->GetAppli() != NULL) { int AppId = this->projectDescription->GetProject()->GetAppli()->GetId(); newEvent->SetInt(AppId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); } event.Skip(); } void wxCDMProjectHelpDialog::OnLibMouseEnter(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED); if(this->projectDescription->GetProject()->GetLib() != NULL) { int LbId = this->projectDescription->GetProject()->GetLib()->GetId(); newEvent->SetInt(LbId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); } event.Skip(); } void wxCDMProjectHelpDialog::OnLibMouseExit(wxMouseEvent& event) { wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED); if(this->projectDescription->GetProject()->GetLib() != NULL) { int LbId = this->projectDescription->GetProject()->GetLib()->GetId(); newEvent->SetInt(LbId); newEvent->SetId(0); wxPostEvent(this->GetParent(), *newEvent); } event.Skip(); } void wxCDMProjectHelpDialog::OnDisableHelp(wxCommandEvent& event) { wxPostEvent(this->GetParent(), event); }