]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / wxCDMLibDescriptionPanel.cpp
index d31f2b2ba51f399fdd306e3d6e8588085510ecfd..6167c17ac1fa2a17253d453e531ae2dae3bc25c7 100644 (file)
@@ -36,6 +36,8 @@
 
 #include "wxCDMMainFrame.h"
 
+#include "wxCDMLibHelpDialog.h"
+
 #include "creaDevManagerIds.h"
 #include "images/LbIcon64.xpm"
 
@@ -88,12 +90,17 @@ void wxCDMLibDescriptionPanel::CreateControls()
   wxButton* returnbt = new wxButton(this, ID_BUTTON_PREV, wxT("Return to project"));
   returnbt->SetToolTip(wxT("Return to the active project description."));
   sizer->Add(returnbt, 0, wxALIGN_CENTER | wxALL, 5);
-
-  //Title
-  sizer->Add(new wxStaticText(this, -1, _("Library Management")),0, wxALIGN_CENTER, 0);
-
-  //Image
-  sizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LbIcon64)),0, wxALIGN_CENTER, 0);
+  //Header
+  wxBoxSizer* headerSizer = new wxBoxSizer(wxHORIZONTAL);
+  {
+    //Image
+    headerSizer->Add(new wxStaticBitmap(this, -1, wxBitmap(LbIcon64)),0, wxALIGN_CENTER, 0);
+    wxBoxSizer* textSizer = new wxBoxSizer(wxVERTICAL);
+    //Title
+    textSizer->Add(new wxStaticText(this, -1, _("Library Management")),0, wxALIGN_LEFT, 0);
+    headerSizer->Add(textSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
+  }
+  sizer->Add(headerSizer, 0, wxALIGN_CENTER);
 
   //Libraries
   wxStaticBoxSizer* propertiesBox = new wxStaticBoxSizer(wxVERTICAL, this, wxT("A&vailable Libraries"));
@@ -105,17 +112,18 @@ void wxCDMLibDescriptionPanel::CreateControls()
   for (int i = 0; i < libraries.size(); i++)
     {
       wxHyperlinkCtrl* pLibrarylk = new wxHyperlinkCtrl(propertiesPanel, ID_LINK_SELECT_LIBRARY, crea::std2wx(libraries[i]->GetName().c_str()), crea::std2wx(libraries[i]->GetName().c_str()));
+      pLibrarylk->SetWindowStyle(wxALIGN_LEFT);
       std::string tt = "Name: " + libraries[i]->GetName() + "\n";
       tt += "Location: " + libraries[i]->GetPath();
       pLibrarylk->SetToolTip(crea::std2wx(tt.c_str()));
       pLibrarylk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseEnter,NULL,this);
       pLibrarylk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnMouseExit,NULL,this);
-      propertiesPanelSizer -> Add(pLibrarylk, 0, wxALIGN_LEFT | wxALL, 5);
+      propertiesPanelSizer -> Add(pLibrarylk, 0, wxEXPAND | wxALL, 5);
     }
 
   propertiesPanel->SetSizer(propertiesPanelSizer);
   propertiesPanelSizer->Fit(propertiesPanel);
-  propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+  propertiesBox->Add(propertiesPanel, 1, wxALL | wxEXPAND, 5);
   sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
   //Actions
@@ -124,17 +132,25 @@ void wxCDMLibDescriptionPanel::CreateControls()
   wxPanel* actionsPanel = new wxPanel(this);
   wxBoxSizer* actionsPanelSizer = new wxBoxSizer(wxHORIZONTAL);
 
-  wxButton* createLibrarybt = new wxButton(actionsPanel, ID_BUTTON_CREATE_LIBRARY, _T("Create Library"));
+  //actionsGrid Sizer
+  wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
+
+  wxButton* createLibrarybt = new wxButton(actionsPanel, ID_BUTTON_CREATE_LIBRARY, _T("A. Create Library"));
   createLibrarybt->SetToolTip(wxT("Create a new library for this project."));
-  actionsPanelSizer->Add(createLibrarybt, 0, wxALL, 5);
-  wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
+  actionsGridSizer->Add(createLibrarybt, 1, wxALL | wxEXPAND, 5);
+  wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("B. Edit CMakeLists File"));
   editCMakebt->SetToolTip(wxT("Open the system default text editor to edit the Lib's CMakeLists.txt file."));
   editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseEnter,NULL,this);
   editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibDescriptionPanel::OnCMakeMouseExit,NULL,this);
-  actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
-  wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Libraries Folder"));
+  actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
+  wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("C. Open Libraries Folder"));
   openFolderbt->SetToolTip(wxT("Open the lib folder in the file explorer."));
-  actionsPanelSizer->Add(openFolderbt, 0, wxALL, 5);
+  actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
+
+  actionsGridSizer->AddGrowableCol(0,1);
+  actionsGridSizer->AddGrowableCol(1,1);
+
+  actionsPanelSizer->Add(actionsGridSizer, 1, wxEXPAND, 0);
 
   actionsPanel->SetSizer(actionsPanelSizer);
   actionsPanelSizer->Fit(actionsPanel);
@@ -144,6 +160,12 @@ void wxCDMLibDescriptionPanel::CreateControls()
   //Assign sizer
   SetSizer(sizer);
   sizer->SetSizeHints(this);
+
+  if (((wxCDMMainFrame*)this->GetParent())->isHelp())
+    {
+      wxCDMLibHelpDialog* helpDialog = new wxCDMLibHelpDialog(this->GetParent(), this->lib, wxID_ANY);
+      helpDialog->Show(true);
+    }
 }
 
 void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event)