]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMProjectDescriptionPanel.cpp
index 4d7679b7afea14787dee5d13a85f60d648f3747f..76aa9bbf99016d3f1ec30f77b2f780735cf14fdd 100644 (file)
@@ -90,14 +90,22 @@ void wxCDMProjectDescriptionPanel::CreateControls()
 {
   wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
 
-  //Welcome
-  sizer->Add(new wxStaticText(this, -1, _("Project")),0, wxALIGN_CENTER, 0);
+  //Header
+  wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
+  {
+    //Image
+    headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PrIcon64)),0, wxALIGN_CENTER, 0);
+    wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
+    //Title
+    textSizer->Add(new wxStaticText(this, -1, _("Project")),0, wxALIGN_LEFT, 0);
+    //Project Name
+    textSizer->Add(new wxStaticText(this, -1, crea::std2wx(this->project->GetName())),0, wxALIGN_LEFT, 0);
+    headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
+  }
+  sizer->Add(headerSizer, 0, wxALIGN_CENTER);
+
 
-  //Image
-  sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(PrIcon64)),0, wxALIGN_CENTER, 0);
 
-  //Project Name
-  sizer->Add(new wxStaticText(this, -1, crea::std2wx(this->project->GetName())),0, wxALIGN_CENTER, 0);
 
   //----------------------------------Project Properties-----------------------------------
   //properties StaticBoxSizer
@@ -158,7 +166,7 @@ void wxCDMProjectDescriptionPanel::CreateControls()
   propertiesPanel->SetSizer(propertiesPanelSizer);
   propertiesPanelSizer->Fit(propertiesPanel);
   propertiesBox->Add(propertiesPanel, 1, wxEXPAND);
-  sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
+  sizer->Add(propertiesBox, 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
 
   //----------------------------------Project Actions--------------------------------------
   //actions StaticBoxSizer
@@ -168,38 +176,46 @@ void wxCDMProjectDescriptionPanel::CreateControls()
   wxPanel* actionsPanel = new wxPanel(this);
   //actions Sizer
   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
+
+  //actionsGrid Sizer
+  wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
   //buttons
-  // package manager
-  wxButton* packageMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_PACKAGE_MANAGER, _T("Package Manager"));
-  packageMgrbt->SetToolTip(wxT("Find the current available packages into this project. You can also create new Packages in this section."));
-  actionsPanelSizer->Add(packageMgrbt, 1, wxALL, 5);
   // lib manager
-  // show only if there is a lib folder
+  //   show only if there is a lib folder
   if(this->project->GetLib() != NULL)
     {
-      wxButton* libMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_LIB_MANAGER, _T("Library Manager"));
+      wxButton* libMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_LIB_MANAGER, _T("A. Library Manager"));
       libMgrbt->SetToolTip(wxT("Find the current available libraries into this project. You can also create new Libraries in this section as well as edit the lib folder's CMakeLists.txt file."));
       libMgrbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnLibMouseEnter,NULL,this);
       libMgrbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnLibMouseExit,NULL,this);
-      actionsPanelSizer->Add(libMgrbt, 1, wxALL, 5);
+      actionsGridSizer->Add(libMgrbt, 1, wxALL | wxEXPAND, 5);
     }
+  // package manager
+  wxButton* packageMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_PACKAGE_MANAGER, _T("B. Package Manager"));
+  packageMgrbt->SetToolTip(wxT("Find the current available packages into this project. You can also create new Packages in this section."));
+  actionsGridSizer->Add(packageMgrbt, 1, wxALL | wxEXPAND, 5);
+
   // appli manager
-  // show only if there is a appli folder
+  //   show only if there is a appli folder
   if(this->project->GetAppli() != NULL)
     {
-      wxButton* appliMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_APPLI_MANAGER, _T("Application Manager"));
+      wxButton* appliMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_APPLI_MANAGER, _T("C. Application Manager"));
       appliMgrbt->SetToolTip(wxT("Find the current available applications into this project. You can also create new Applications in this section as well as edit the appli folder's CMakeLists.txt file."));
       appliMgrbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnAppliMouseEnter,NULL,this);
       appliMgrbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnAppliMouseExit,NULL,this);
-      actionsPanelSizer->Add(appliMgrbt, 1, wxALL, 5);
+      actionsGridSizer->Add(appliMgrbt, 1, wxALL | wxEXPAND, 5);
     }
   // edit CMakeLists file
-  wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
+  wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("D. Edit CMakeLists File"));
   editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file of this project."));
   editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnCMakeMouseEnter,NULL,this);
   editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMProjectDescriptionPanel::OnCMakeMouseExit,NULL,this);
-  actionsPanelSizer->Add(editCMakebt, 1, wxALL, 5);
+  actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
 
+  actionsGridSizer->AddGrowableCol(0,1);
+  actionsGridSizer->AddGrowableCol(1,1);
+
+  actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0);
   //SetPanel sizer and box
   actionsPanel->SetSizer(actionsPanelSizer);
   actionsPanelSizer->Fit(actionsPanel);
@@ -213,7 +229,7 @@ void wxCDMProjectDescriptionPanel::CreateControls()
 
   if(((wxCDMMainFrame*)this->GetParent())->isHelp())
     {
-      wxCDMProjectHelpDialog* helpDialog = new wxCDMProjectHelpDialog(this->GetParent(), this, wxID_ANY);
+      wxCDMProjectHelpDialog* helpDialog = new wxCDMProjectHelpDialog(this->GetParent(), this->project, wxID_ANY);
       helpDialog->Show(true);
     }
 }
@@ -228,7 +244,7 @@ void wxCDMProjectDescriptionPanel::OnBtnManagePackages(wxCommandEvent& event)
   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
   newEvent->SetId(1);
   newEvent->SetString(wxT("manage_packages"));
-  newEvent->SetInt(this->project->GetId());
+  newEvent->SetClientData(this->project);
   wxPostEvent(this->GetParent(), *newEvent);
   event.Skip();
 }
@@ -240,12 +256,11 @@ void wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event)
   newEvent->SetString(wxT("manage_libraries"));
   wxPostEvent(this->GetParent(), *newEvent);
 
-  wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 
   if(this->project->GetLib() != NULL)
     {
-      int CMId = this->project->GetLib()->GetId();
-      newEvent1->SetInt(CMId);
+      newEvent1->SetClientData(this->project->GetLib());
       newEvent1->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent1);
     }
@@ -260,15 +275,14 @@ void wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event
   newEvent->SetString(wxT("manage_applications"));
   wxPostEvent(this->GetParent(), *newEvent);
 
-  wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 
-    if(this->project->GetAppli() != NULL)
-      {
-        int CMId = this->project->GetAppli()->GetId();
-        newEvent1->SetInt(CMId);
-        newEvent1->SetId(0);
-        wxPostEvent(this->GetParent(), *newEvent1);
-      }
+  if(this->project->GetAppli() != NULL)
+    {
+      newEvent1->SetClientData(this->project->GetAppli());
+      newEvent1->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent1);
+    }
 
   event.Skip();
 }
@@ -279,12 +293,11 @@ void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
   if(!this->project->OpenCMakeListsFile(result))
     wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
 
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 
   if(this->project->GetCMakeLists() != NULL)
     {
-      int CMId = this->project->GetCMakeLists()->GetId();
-      newEvent->SetInt(CMId);
+      newEvent->SetClientData(this->project->GetCMakeLists());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }
@@ -339,12 +352,11 @@ void wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
 {
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
 
   if(this->project->GetCMakeLists() != NULL)
     {
-      int CMId = this->project->GetCMakeLists()->GetId();
-      newEvent->SetInt(CMId);
+      newEvent->SetClientData(this->project->GetCMakeLists());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }
@@ -353,12 +365,11 @@ void wxCDMProjectDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
 {
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 
   if(this->project->GetCMakeLists() != NULL)
     {
-      int CMId = this->project->GetCMakeLists()->GetId();
-      newEvent->SetInt(CMId);
+      newEvent->SetClientData(this->project->GetCMakeLists());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }
@@ -367,12 +378,11 @@ void wxCDMProjectDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnAppliMouseEnter(wxMouseEvent& event)
 {
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
   std::cout << "entra appli " << this->project->GetAppli()->GetCMakeLists();
   if(this->project->GetAppli() != NULL)
     {
-      int AppId = this->project->GetAppli()->GetId();
-      newEvent->SetInt(AppId);
+      newEvent->SetClientData(this->project->GetAppli());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }
@@ -381,12 +391,11 @@ void wxCDMProjectDescriptionPanel::OnAppliMouseEnter(wxMouseEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnAppliMouseExit(wxMouseEvent& event)
 {
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 
   if(this->project->GetAppli() != NULL)
     {
-      int AppId = this->project->GetAppli()->GetId();
-      newEvent->SetInt(AppId);
+      newEvent->SetClientData(this->project->GetAppli());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }
@@ -395,12 +404,11 @@ void wxCDMProjectDescriptionPanel::OnAppliMouseExit(wxMouseEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnLibMouseEnter(wxMouseEvent& event)
 {
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
 
   if(this->project->GetLib() != NULL)
     {
-      int LbId = this->project->GetLib()->GetId();
-      newEvent->SetInt(LbId);
+      newEvent->SetClientData(this->project->GetLib());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }
@@ -409,12 +417,11 @@ void wxCDMProjectDescriptionPanel::OnLibMouseEnter(wxMouseEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnLibMouseExit(wxMouseEvent& event)
 {
-  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
 
   if(this->project->GetLib() != NULL)
     {
-      int LbId = this->project->GetLib()->GetId();
-      newEvent->SetInt(LbId);
+      newEvent->SetClientData(this->project->GetLib());
       newEvent->SetId(0);
       wxPostEvent(this->GetParent(), *newEvent);
     }