]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Fri, 14 Dec 2012 15:59:26 +0000 (16:59 +0100)
committerDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Fri, 14 Dec 2012 15:59:26 +0000 (16:59 +0100)
CreaDevManager application implementation

- Setting up links highlighting in Project and Package Descriptions.
- Open Folder in Lib implemented
- Open CMakeLists file in Lib implemented

lib/creaDevManagerLib/modelCDMLib.cpp
lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMMainFrame.cpp
lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.h

index 21f2167606772ec9f9487a710416ca17cd746bf6..24033518f493f43e633d253a7edf06e02eeb5ea7 100644 (file)
@@ -161,16 +161,17 @@ modelCDMLibrary* modelCDMLib::CreateLibrary(
 
 bool modelCDMLib::OpenCMakeListsFile(std::string*& result)
 {
-  //TODO: implement method
-  return true;
+  if (!CDMUtilities::openTextEditor(this->CMakeLists->GetPath()))
+    return true;
+  else
+    {
+      result = new std::string("Couldn't open CMakeLists file.");
+      return false;
+    }
 }
 
 const bool modelCDMLib::Refresh(std::string*& result)
 {
-  //TODO: implement method
-
-
-
   this->type = wxDIR_DIRS;
   this->name = "lib";
   this->level = level;
index 313a720dd569a8835729b240f2c430cde2ded02e..524e64f5ecb4ed95a03e56c6c2e6aa52816550d2 100644 (file)
@@ -179,9 +179,9 @@ void wxCDMLibDescriptionPanel::OnBtnCreateLibrary(wxCommandEvent& event)
 
 void wxCDMLibDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->lib->OpenCMakeListsFile(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
 }
 
 void wxCDMLibDescriptionPanel::OnLnkLibrarySelect(wxHyperlinkEvent& event)
@@ -219,9 +219,9 @@ void wxCDMLibDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
 
 void wxCDMLibDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->lib->OpenInFileExplorer(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
 
 void wxCDMLibDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
index b2cc0f0b197402be28b0e0080e627d3f90be2d29..1484059aa845612691491e2d0b018616b6815abf 100755 (executable)
@@ -224,7 +224,7 @@ void wxCDMMainFrame::CreateControls()
 
 
   auiManager.AddPane(panel_Properties, wxAuiPaneInfo().BestSize(600,400).CenterPane().Name(wxT("panel_Properties")).Caption(wxT("")).CloseButton(false));
-  auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Left().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
+  auiManager.AddPane(tree_Projects, wxAuiPaneInfo().Right().MinSize(300,300).BestSize(300,400).CloseButton(false).Name(wxT("tree_Projects")).Caption(wxT("Project Tree")).CloseButton(false));
 
   wxString pers = auiManager.SavePerspective();
 
index d6271ba80feda36af37263956e4ea90d49ec4934..d32ed866479aa66ec4c1c08557d9239ec89d1a82 100644 (file)
@@ -240,6 +240,17 @@ void wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
   //TODO: implement method
   std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
+
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->package->GetCMakeLists() != NULL)
+    {
+      int CMId = this->package->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+
   event.Skip();
 }
 
index e49e2899feaa4375c5264feec4bb603fd7ceeabd..4f60890fbb3c092baab61176e531fdbb52f8ca9b 100644 (file)
@@ -177,6 +177,8 @@ void wxCDMProjectDescriptionPanel::CreateControls()
     {
       wxButton* libMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_LIB_MANAGER, _T("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, 0, wxALL, 5);
     }
   // appli manager
@@ -185,11 +187,15 @@ void wxCDMProjectDescriptionPanel::CreateControls()
     {
       wxButton* appliMgrbt = new wxButton(actionsPanel, ID_BUTTON_GOTO_APPLI_MANAGER, _T("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, 0, wxALL, 5);
     }
   // edit CMakeLists file
   wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("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, 0, wxALL, 5);
 
   //SetPanel sizer and box
@@ -220,6 +226,17 @@ void wxCDMProjectDescriptionPanel::OnBtnManageLibraries(wxCommandEvent& event)
   newEvent->SetId(1);
   newEvent->SetString(wxT("manage_libraries"));
   wxPostEvent(this->GetParent(), *newEvent);
+
+  wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->project->GetLib() != NULL)
+    {
+      int CMId = this->project->GetLib()->GetId();
+      newEvent1->SetInt(CMId);
+      newEvent1->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent1);
+    }
+
   event.Skip();
 }
 
@@ -229,6 +246,17 @@ void wxCDMProjectDescriptionPanel::OnBtnManageApplications(wxCommandEvent& event
   newEvent->SetId(1);
   newEvent->SetString(wxT("manage_applications"));
   wxPostEvent(this->GetParent(), *newEvent);
+
+  wxCommandEvent* newEvent1 = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+    if(this->project->GetAppli() != NULL)
+      {
+        int CMId = this->project->GetAppli()->GetId();
+        newEvent1->SetInt(CMId);
+        newEvent1->SetId(0);
+        wxPostEvent(this->GetParent(), *newEvent1);
+      }
+
   event.Skip();
 }
 
@@ -237,6 +265,16 @@ void wxCDMProjectDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
   std::string* result;
   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);
+
+  if(this->project->GetCMakeLists() != NULL)
+    {
+      int CMId = this->project->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
 }
 
 void
@@ -257,11 +295,10 @@ wxCDMProjectDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 {
   std::string* result;
   if(!this->project->OpenInFileExplorer(result))
-    wxMessageBox(crea::std2wx(*result),_T("Open File - Error!"),wxOK | wxICON_ERROR);
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
 
-void
-wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
+void wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
 {
   //TODO: implement method
   std::cerr << "Event OnBtnSetVersion not implemented" << std::endl;
@@ -290,3 +327,87 @@ wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
   this->versionDatetc->SetLabel(crea::std2wx(this->project->GetVersionDate()));
 
 }
+
+void wxCDMProjectDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->project->GetCMakeLists() != NULL)
+    {
+      int CMId = this->project->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->project->GetCMakeLists() != NULL)
+    {
+      int CMId = this->project->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnAppliMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+  std::cout << "entra appli " << this->project->GetAppli()->GetCMakeLists();
+  if(this->project->GetAppli() != NULL)
+    {
+      int AppId = this->project->GetAppli()->GetId();
+      newEvent->SetInt(AppId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnAppliMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->project->GetAppli() != NULL)
+    {
+      int AppId = this->project->GetAppli()->GetId();
+      newEvent->SetInt(AppId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnLibMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->project->GetLib() != NULL)
+    {
+      int LbId = this->project->GetLib()->GetId();
+      newEvent->SetInt(LbId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMProjectDescriptionPanel::OnLibMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->project->GetLib() != NULL)
+    {
+      int LbId = this->project->GetLib()->GetId();
+      newEvent->SetInt(LbId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
index 0ac8771bf3e37150da75b0ba804303ef47f0306e..06c12bd3c3bc0555090236d3f3e64f8390aa223c 100644 (file)
@@ -84,6 +84,13 @@ protected:
   void OnBtnSetBuildPath(wxCommandEvent& event);
   void OnBtnOpenFolder(wxCommandEvent& event);
   void OnBtnSetVersion(wxCommandEvent& event);
+
+  void OnCMakeMouseEnter(wxMouseEvent& event);
+  void OnCMakeMouseExit(wxMouseEvent& event);
+  void OnAppliMouseEnter(wxMouseEvent& event);
+  void OnAppliMouseExit(wxMouseEvent& event);
+  void OnLibMouseEnter(wxMouseEvent& event);
+  void OnLibMouseExit(wxMouseEvent& event);
 };
 
 #endif /* WXCDMPROJECTDESCRIPTIONPANEL_H_ */