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

- Package functions implemented. Creating Black Boxes still not working.
- All CMake files open implemented.
- All Open in File explorer implemented.
- Implemented Open BBEditor, Text Editor, Minitools and command line.
- Properties rezise bug fixed.

27 files changed:
lib/creaDevManagerLib/CDMUtilities.cpp
lib/creaDevManagerLib/CDMUtilities.h
lib/creaDevManagerLib/creaDevManagerIds.h
lib/creaDevManagerLib/modelCDMApplication.cpp
lib/creaDevManagerLib/modelCDMApplication.h
lib/creaDevManagerLib/modelCDMCMakeListsFile.cpp
lib/creaDevManagerLib/modelCDMFile.cpp
lib/creaDevManagerLib/modelCDMFile.h
lib/creaDevManagerLib/modelCDMLibrary.cpp
lib/creaDevManagerLib/modelCDMLibrary.h
lib/creaDevManagerLib/modelCDMPackage.cpp
lib/creaDevManagerLib/modelCDMPackage.h
lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.h
lib/creaDevManagerLib/wxCDMCMakeListsDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMFileDescriptionPanel.h
lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h
lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.h
lib/creaDevManagerLib/wxCDMMainFrame.cpp
lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.h
lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp
lib/creaDevManagerLib/wxCDMPackageManagerPanel.h
lib/creaDevManagerLib/wxCDMProjectDescriptionPanel.cpp

index d9ef9b7fff10d5504245a47aa2c825575e2fb3ad..29a277fa2646cabfea5264d4323012e1295dbec2 100644 (file)
@@ -105,13 +105,40 @@ namespace CDMUtilities
   }
 
   int openFileExplorer(const std::string& file)
-    {
-      std::string command = FILE_EXPLORER;
+  {
+    std::string command = FILE_EXPLORER;
+
+    if(file != "")
+      command += " \"" + file + "\" &";
+
+    return system(command.c_str());
+  }
 
-      if(file != "")
-        command += " \"" + file + "\" &";
+  int openFileWithCommand(const std::string& file, const std::string& command)
+  {
+    std::string comm = command;
+    if(file != "")
+      comm += " \"" + file + "\" &";
 
-      return system(command.c_str());
-    }
+    return system(comm.c_str());
+  }
+
+  int openBBEditor()
+  {
+    std::string comm = "bbEditor &";
+    return system(comm.c_str());
+  }
+
+  int openCreaToolsTools()
+  {
+    std::string comm = "creaTools.sh &";
+    return system(comm.c_str());
+  }
+
+  int openTerminal()
+  {
+    std::string comm = TERMINAL + "&";
+    return system(comm.c_str());
+  }
 
 }
index 16630d29e3e64793d2e5ac3897531ef68f8773d0..bed8ed9de7192eac91f73bfdc3bc15d3c69b7ece 100644 (file)
@@ -62,6 +62,17 @@ namespace CDMUtilities
   static std::string FILE_EXPLORER = "nautilus";
 #endif
 
+  //terminal program
+  #ifdef _WIN32
+    // ------ Windows
+    //TODO: implementation for windows
+  #elif __APPLE__
+    // ------ Apple
+    //TODO: implementation for apple
+  #else
+    static std::string TERMINAL = "gnome-terminal";
+  #endif
+
 
   struct splitter
   {
@@ -80,6 +91,10 @@ namespace CDMUtilities
 
   int openTextEditor(const std::string& file = "");
   int openFileExplorer(const std::string& file = "");
+  int openFileWithCommand(const std::string& file, const std::string& command);
+  int openBBEditor();
+  int openCreaToolsTools();
+  int openTerminal();
 };
 
 #endif /* CDMUTILITIES_H_ */
index 0e4b78807872f8e5cd31c4095d141eda0e46c569..49193d9fde964ccf67dd648bf2d9b37a1cad2f35 100644 (file)
 #define ID_BUTTON_OPEN_COMMAND          10317
 #define ID_BUTTON_SET_VERSION           10318
 #define ID_BUTTON_SET_BUILD_PATH        10319
+#define ID_BUTTON_SET_AUTHOR            10320
+#define ID_BUTTON_SET_DESCRIPTION       10321
 
-#define ID_BUTTON_BUILD_PROJECT         10320
-#define ID_BUTTON_CONFIGURE_BUILD       10321
-#define ID_BUTTON_CONNECT_PROJECT       10322
 
-#define ID_BUTTON_GOTO_PACKAGE_MANAGER  10323
-#define ID_BUTTON_GOTO_APPLI_MANAGER    10324
-#define ID_BUTTON_GOTO_LIB_MANAGER      10325
+#define ID_BUTTON_BUILD_PROJECT         10322
+#define ID_BUTTON_CONFIGURE_BUILD       10323
+#define ID_BUTTON_CONNECT_PROJECT       10324
 
-#define ID_LINK_SELECT_PACKAGE          10326
-#define ID_LINK_SELECT_LIBRARY          10327
-#define ID_LINK_SELECT_APPLICATION      10328
-#define ID_LINK_SELECT_BLACKBOX         10329
+#define ID_BUTTON_GOTO_PACKAGE_MANAGER  10325
+#define ID_BUTTON_GOTO_APPLI_MANAGER    10326
+#define ID_BUTTON_GOTO_LIB_MANAGER      10327
+
+#define ID_LINK_SELECT_PACKAGE          10328
+#define ID_LINK_SELECT_LIBRARY          10329
+#define ID_LINK_SELECT_APPLICATION      10330
+#define ID_LINK_SELECT_BLACKBOX         10331
 
 #endif /* CREADEVMANAGERIDS_H_ */
index 17a660a4c6aa8e6d6a60f58249a2153ed68dc464..35a731cd129c23133c28b822c5ad112639552dfc 100644 (file)
@@ -68,9 +68,9 @@ const std::string& modelCDMApplication::GetNameApplication() const
   return this->nameApplication;
 }
 
-const std::string& modelCDMApplication::GetMainFile() const
+const std::string& modelCDMApplication::GetExecutableName() const
 {
-  return this->mainFile;
+  return this->executableName;
 }
 
 void modelCDMApplication::SetMainFile(const std::string& fileName)
@@ -87,12 +87,6 @@ bool modelCDMApplication::CreateFolder(
   return true;
 }
 
-bool modelCDMApplication::OpenCMakeListsFile(std::string*& result)
-{
-  //TODO: implement method
-  return true;
-}
-
 const bool modelCDMApplication::Refresh(std::string*& result)
 {
   //TODO: implement method
index 2f8834bb4a9ea92e1aac6b1a841bb9288805ca1c..97d3a79e8f4ea69bc1128175d5d5348209ad91c7 100644 (file)
@@ -48,7 +48,7 @@ public:
   ~modelCDMApplication();
 
   const std::string& GetNameApplication() const;
-  const std::string& GetMainFile() const;
+  const std::string& GetExecutableName() const;
 
   void SetMainFile(const std::string& fileName);
 
@@ -57,12 +57,11 @@ public:
       std::string*& result,
       const std::string& path = "/"
   );
-  bool OpenCMakeListsFile(std::string* & result);
   virtual const bool Refresh(std::string*& result);
 
 private:
   std::string nameApplication;
-  std::string mainFile;
+  std::string executableName;
   std::vector<modelCDMApplication*> applications;
 };
 
index 768ce80cdd2fb6bf2d1b4d6f81ed57df0c56c1c0..2b9cb2af8817fcf03bbef22ec0a6b78d797a5c27 100644 (file)
@@ -37,6 +37,8 @@
 #include<creaWx.h>
 #include<wx/dir.h>
 
+#include "CDMUtilities.h"
+
 modelCDMCMakeListsFile::modelCDMCMakeListsFile()
 {
 }
@@ -57,8 +59,14 @@ modelCDMCMakeListsFile::~modelCDMCMakeListsFile()
 
 bool modelCDMCMakeListsFile::OpenFile(std::string*& result)
 {
-  //TODO: implement method
-  return true;
+
+  if (!CDMUtilities::openTextEditor(this->path))
+    return true;
+  else
+    {
+      result = new std::string("Couldn't open CMakeLists file.");
+      return false;
+    }
 }
 
 const bool modelCDMCMakeListsFile::Refresh(std::string*& result)
index 8e8a40faa5966dfb828dc6a157db3071399cfcfb..6767b98e8895a5f87dc5edb7e2153de58a7360b9 100644 (file)
@@ -69,14 +69,36 @@ modelCDMFile::~modelCDMFile()
 {
 }
 
-bool modelCDMFile::OpenFile(std::string*& result)
+bool modelCDMFile::OpenFile(std::string*& result, const std::string& command)
 {
-  //TODO: implement method
+  if (!CDMUtilities::openFileWithCommand(path, command))
     return true;
+  else
+    {
+      result = new std::string("Couldn't open file with command " + command + ".");
+      return false;
+    }
 }
 
 const bool modelCDMFile::Refresh(std::string*& result)
 {
-  //TODO: implement method
+  std::ifstream in((this->path).c_str());
+  if(!in.is_open())
+    {
+      in.close();
+      return false;
+    }
+  return true;
+}
+
+const bool modelCDMFile::OpenInFileExplorer(std::string*& result) const
+{
+  std::string pth = this->path.substr(0, path.size() - name.size() - 1);
+  if (!CDMUtilities::openFileExplorer(pth))
     return true;
+  else
+    {
+      result = new std::string("Couldn't open file.");
+      return false;
+    }
 }
index a74990a8c51a8931fd62440b4da55562b1622602..228447f661a09aa42e3b7f39a4981908ec86b49e 100644 (file)
@@ -47,8 +47,9 @@ public:
   modelCDMFile(const std::string& path, const int& level = 3);
   ~modelCDMFile();
 
-  bool OpenFile(std::string* & result);
+  bool OpenFile(std::string* & result, const std::string& command = "");
   virtual const bool Refresh(std::string*& result);
+  const bool OpenInFileExplorer(std::string*& result) const;
 };
 
 #endif /* MODELCDMFILE_H_ */
index 66f8ee45b5c822aa9647dc3c6e5ef82ea0fa006f..d5b4efb8cd76e2df1f632e156e4652b2a3498139 100644 (file)
@@ -77,12 +77,6 @@ bool modelCDMLibrary::CreateFolder(
   return true;
 }
 
-bool modelCDMLibrary::OpenCMakeListsFile(std::string*& result)
-{
-  //TODO: implement method
-  return true;
-}
-
 const bool modelCDMLibrary::Refresh(std::string*& result)
 {
   //TODO: implement method
index 2e5adce2ad097572e378b5375c3c3c618c1a7cad..9f19defbcf01f41b462ebf8816ecb2eaa1d00859 100644 (file)
@@ -54,7 +54,6 @@ public:
       std::string*& result,
       const std::string& path = "/"
   );
-  bool OpenCMakeListsFile(std::string*& result);
   virtual const bool Refresh(std::string*& result);
 
 private:
index d2d6e125e2d30ecbcd21265e8dd6d1f890b371e9..9ec218a6817fd7fa3e59fc144d1bc8d71059d61e 100644 (file)
@@ -34,6 +34,8 @@
 
 #include "modelCDMPackage.h"
 
+#include <fstream>
+
 #include "creaWx.h"
 #include "wx/dir.h"
 #include "CDMUtilities.h"
@@ -46,13 +48,83 @@ modelCDMPackage::modelCDMPackage(const std::string& path, const int& level)
 {
   this->type = wxDIR_DIRS;
   //Get Package Name
+
+  //TODO: set pathMakeLists for windows
+  std::string pathMakeLists = path + "/CMakeLists.txt";
+
+  std::ifstream confFile;
+  confFile.open((pathMakeLists).c_str());
+
+  std::string word;
+  while(confFile.is_open() && !confFile.eof())
+    {
+      //get sets
+      std::getline(confFile,word,'(');
+      std::vector<std::string> wordBits;
+      CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties);
+
+      if(wordBits[wordBits.size()-1] == "SET")
+        {
+          //get package name
+          std::getline(confFile,word,')');
+          CDMUtilities::splitter::split(wordBits, word, " ", CDMUtilities::splitter::no_empties);
+          if(wordBits[0] == "BBTK_PACKAGE_NAME")
+            {
+              word = wordBits[1];
+              for (int i = 2; i < wordBits.size(); i++)
+                {
+                  word += " " + wordBits[i];
+                }
+              wordBits.clear();
+              CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties);
+
+              this->namePackage = wordBits[0];
+            }
+          else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR")
+            {
+              word = wordBits[1];
+              for (int i = 2; i < wordBits.size(); i++)
+                {
+                  word += " " + wordBits[i];
+                }
+              wordBits.clear();
+              CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties);
+
+              this->authors = wordBits[0];
+            }
+          else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION")
+            {
+              word = wordBits[1];
+              for (int i = 2; i < wordBits.size(); i++)
+                {
+                  word += " " + wordBits[i];
+                }
+              wordBits.clear();
+              CDMUtilities::splitter::split(wordBits, word, "\"", CDMUtilities::splitter::no_empties);
+
+              this->description = wordBits[0];
+            }
+          else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_MAJOR_VERSION")
+            {
+              this->version = wordBits[1];
+            }
+          else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_MINOR_VERSION")
+            {
+              this->version += "." + wordBits[1];
+            }
+          else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_BUILD_VERSION")
+            {
+              this->version += "." + wordBits[1];
+            }
+        }
+    }
+
   std::vector<std::string> words;
   std::string delimiters;
   //TODO::fix for windows
   delimiters = "/";
   CDMUtilities::splitter::split(words, path, delimiters, CDMUtilities::splitter::no_empties);
   this->name = words[words.size()-1];
-  this->namePackage = this->name;
   this->level = level;
   this->path = path;
 
@@ -154,7 +226,47 @@ const std::vector<modelCDMBlackBox*>& modelCDMPackage::GetBlackBoxes() const
 
 bool modelCDMPackage::SetAuthors(const std::string& authors, std::string*& result)
 {
-  //TODO: implement method
+  std::vector<std::string> words;
+  CDMUtilities::splitter::split(words, authors, ",\n", CDMUtilities::splitter::no_empties);
+  std::string authorsReal = words[0];
+  for (int i = 1; i < words.size(); i++)
+    {
+      authorsReal += "/" + words[i];
+    }
+
+  std::string line;
+  //opening original cmakelists
+  std::ifstream in((this->path + "/CMakeLists.txt").c_str());
+  if( !in.is_open())
+    {
+      result = new std::string("CMakeLists.txt file failed to open.");
+      return false;
+    }
+  //opening temporal cmakelists
+  std::ofstream out((this->path + "/CMakeLists.txt.tmp").c_str());
+  if( !out.is_open())
+    {
+      result = new std::string("CMakeLists.txt.tmp file failed to open.");
+      return false;
+    }
+  //copying contents from original to temporal and making changes
+  while (getline(in, line))
+    {
+      if(line.find("SET(${BBTK_PACKAGE_NAME}_AUTHOR") != std::string::npos)
+        line = "SET(${BBTK_PACKAGE_NAME}_AUTHOR \"" + authorsReal + "\")";
+      out << line << std::endl;
+    }
+  in.close();
+  out.close();
+  //delete old file and rename new file
+  std::string renameCommand = "mv " + this->path + "/CMakeLists.txt.tmp " + this->path + "/CMakeLists.txt";
+  if(system(renameCommand.c_str()))
+    {
+      result = new std::string("An error occurred while running '" + renameCommand + "'.");
+      return false;
+    }
+
+  this->authors = authorsReal;
   return true;
 }
 
@@ -166,13 +278,93 @@ bool modelCDMPackage::SetAuthorsEmail(const std::string& email, std::string*& re
 
 bool modelCDMPackage::SetVersion(const std::string& version, std::string*& result)
 {
-  //TODO: implement method
+  std::vector<std::string> vers;
+  CDMUtilities::splitter::split(vers, version, " .", CDMUtilities::splitter::no_empties);
+
+
+  std::string line;
+  //opening original cmakelists
+  std::ifstream in((this->path + "/CMakeLists.txt").c_str());
+  if( !in.is_open())
+    {
+      result = new std::string("CMakeLists.txt file failed to open.");
+      return false;
+    }
+  //opening temporal cmakelists
+  std::ofstream out((this->path + "/CMakeLists.txt.tmp").c_str());
+  if( !out.is_open())
+    {
+      result = new std::string("CMakeLists.txt.tmp file failed to open.");
+      return false;
+    }
+  //copying contents from original to temporal and making changes
+  while (getline(in, line))
+    {
+      if(line.find("SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION") != std::string::npos)
+        line = "SET(${BBTK_PACKAGE_NAME}_MAJOR_VERSION " + vers[0] + ")";
+      else if(line.find("SET(${BBTK_PACKAGE_NAME}_VERSION") != std::string::npos)
+        line = "SET(${BBTK_PACKAGE_NAME}_MINOR_VERSION " + vers[1] + ")";
+      else if(line.find("SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION") != std::string::npos)
+        line = "SET(${BBTK_PACKAGE_NAME}_BUILD_VERSION " + vers[2] + ")";
+      out << line << std::endl;
+    }
+  in.close();
+  out.close();
+  //delete old file and rename new file
+  std::string renameCommand = "mv " + this->path + "/CMakeLists.txt.tmp " + this->path + "/CMakeLists.txt";
+  if(system(renameCommand.c_str()))
+    {
+      result = new std::string("An error occurred while running '" + renameCommand + "'.");
+      return false;
+    }
+
+  this->version = vers[0] + "." + vers[1] + "." + vers[2];
   return true;
 }
 
 bool modelCDMPackage::SetDescription(const std::string& description, std::string*& result)
 {
-  //TODO: implement method
+  std::vector<std::string> words;
+  CDMUtilities::splitter::split(words, description, " \n", CDMUtilities::splitter::no_empties);
+  std::string descriptionReal = words[0];
+  for (int i = 1; i < words.size(); i++)
+    {
+      descriptionReal += " " + words[i];
+    }
+
+  std::string line;
+  //opening original cmakelists
+  std::ifstream in((this->path + "/CMakeLists.txt").c_str());
+  if( !in.is_open())
+    {
+      result = new std::string("CMakeLists.txt file failed to open.");
+      return false;
+    }
+  //opening temporal cmakelists
+  std::ofstream out((this->path + "/CMakeLists.txt.tmp").c_str());
+  if( !out.is_open())
+    {
+      result = new std::string("CMakeLists.txt.tmp file failed to open.");
+      return false;
+    }
+  //copying contents from original to temporal and making changes
+  while (getline(in, line))
+    {
+      if(line.find("SET(${BBTK_PACKAGE_NAME}_DESCRIPTION") != std::string::npos)
+        line = "SET(${BBTK_PACKAGE_NAME}_DESCRIPTION \"" + descriptionReal + "\")";
+      out << line << std::endl;
+    }
+  in.close();
+  out.close();
+  //delete old file and rename new file
+  std::string renameCommand = "mv " + this->path + "/CMakeLists.txt.tmp " + this->path + "/CMakeLists.txt";
+  if(system(renameCommand.c_str()))
+    {
+      result = new std::string("An error occurred while running '" + renameCommand + "'.");
+      return false;
+    }
+
+  this->description = descriptionReal;
   return true;
 }
 
@@ -188,12 +380,6 @@ bool modelCDMPackage::CreateBlackBox(
   return true;
 }
 
-bool modelCDMPackage::OpenCMakeListsFile(std::string*& result)
-{
-  //TODO: implement method
-  return true;
-}
-
 const bool modelCDMPackage::Refresh(std::string*& result)
 {
   //TODO: implement method
index 66d86c75da091fe5bdfd8e889800612d5e3ba01f..632b2ef768e88d000eca07b3949b9a896d52edc5 100644 (file)
@@ -68,7 +68,6 @@ public:
       const std::string& categories = "empty",
       const std::string& description = "no description"
   );
-  bool OpenCMakeListsFile(std::string*& result);
   virtual const bool Refresh(std::string*& result);
 
 private:
index 03142d089ed3f8605605aad3eea653a8442443e6..44ee9b10a49b74095b82bc165fc2bf9d81da7999 100644 (file)
@@ -105,11 +105,11 @@ void wxCDMApplicationDescriptionPanel::CreateControls()
 
   wxFlexGridSizer* propertiesGridSizer = new wxFlexGridSizer(4, 2, 9, 15);
 
-  wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Main File"));
+  wxStaticText *pMainFile = new wxStaticText(propertiesPanel, -1, wxT("Executable Name"));
   wxBoxSizer* pMainFilesz = new wxBoxSizer(wxHORIZONTAL);
-  wxStaticText* pMainFiletc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->application->GetMainFile()));
-  wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Choose"));
-  pMainFilebt->SetToolTip(wxT("Choose the main file for the application."));
+  wxStaticText* pMainFiletc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->application->GetExecutableName()));
+  wxButton* pMainFilebt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
+  pMainFilebt->SetToolTip(wxT("Set the name of the executable file for the application."));
   pMainFilesz->Add(pMainFiletc, 0, wxALIGN_CENTER_VERTICAL, 0);
   pMainFilesz->Add(pMainFilebt, 0, wxALIGN_CENTER | wxLEFT, 10);
 
@@ -139,6 +139,8 @@ void wxCDMApplicationDescriptionPanel::CreateControls()
   createFolderbt->SetToolTip(wxT("Create a new Folder inside the application folder."));
   wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
   editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt file inside this application."));
+  editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnCMakeMouseEnter,NULL,this);
+  editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnCMakeMouseExit,NULL,this);
   wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Application Folder"));
   openFolderbt->SetToolTip(wxT("Open the application folder in the file explorer."));
 
@@ -183,14 +185,54 @@ void wxCDMApplicationDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
 
 void wxCDMApplicationDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
+  std::string* result;
+  if(!this->application->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->application->GetCMakeLists() != NULL)
+    {
+      int CMId = this->application->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+
   event.Skip();
 }
 
 void wxCDMApplicationDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
+  std::string* result;
+  if(!this->application->OpenInFileExplorer(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
+}
+
+void wxCDMApplicationDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->application->GetCMakeLists() != NULL)
+    {
+      int CMId = this->application->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMApplicationDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->application->GetCMakeLists() != NULL)
+    {
+      int CMId = this->application->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
index 7611d5b192979e7a383b0ef81ab3a8f2abb3295c..fbb0a24675a1295b9be1c70e3ec107a5c43d6e4e 100644 (file)
@@ -78,6 +78,8 @@ protected:
   void OnBtnCreateFolder(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
   void OnBtnOpenFolder(wxCommandEvent& event);
+  void OnCMakeMouseEnter(wxMouseEvent& event);
+  void OnCMakeMouseExit(wxMouseEvent& event);
 
 };
 
index 719426ad5a778e3c51eddc237281e76edf3c1942..ac7172d77584091beccf661cf21477e8e4048e74 100644 (file)
@@ -128,14 +128,14 @@ void wxCDMCMakeListsDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
 
 void wxCDMCMakeListsDescriptionPanel::OnBtnOpenInEditor(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenInEditor not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->cMakeLists->OpenFile(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
 }
 
 void wxCDMCMakeListsDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->cMakeLists->OpenInFileExplorer(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
index 4f48a4f8ba57ee828dbcf71b41407ef0d4371cc4..001bb2a2a5f549f7a9f41c878074dfbf8e6881c6 100644 (file)
@@ -43,8 +43,8 @@
 
 BEGIN_EVENT_TABLE(wxCDMFileDescriptionPanel, wxPanel)
 EVT_BUTTON(ID_BUTTON_PREV, wxCDMFileDescriptionPanel::OnBtnReturn)
-EVT_MENU(ID_BUTTON_OPEN_FOLDER, wxCDMFileDescriptionPanel::OnBtnOpenFolder)
-EVT_MENU(ID_BUTTON_OPEN_COMMAND, wxCDMFileDescriptionPanel::OnBtnOpenWithCommand)
+EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFileDescriptionPanel::OnBtnOpenFolder)
+EVT_BUTTON(ID_BUTTON_OPEN_COMMAND, wxCDMFileDescriptionPanel::OnBtnOpenWithCommand)
 END_EVENT_TABLE()
 
 wxCDMFileDescriptionPanel::wxCDMFileDescriptionPanel(
@@ -162,14 +162,24 @@ void wxCDMFileDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
 
 void wxCDMFileDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenContainingFolder not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->file->OpenInFileExplorer(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
 
 void wxCDMFileDescriptionPanel::OnBtnOpenWithCommand(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenWithCommand not implemented" << std::endl;
-  event.Skip();
+  //get command
+  wxString commandEx = wxGetTextFromUser(
+      _T("Enter the command to execute file"),
+      _T("Execute File - creaDevManager"),
+      _T("")
+  );
+  //check name
+  if(commandEx.Len() > 0)
+    {
+      std::string* result;
+      if(!this->file->OpenFile(result, crea::wx2std(commandEx)))
+        wxMessageBox(crea::std2wx(*result),_T("Execute File - Error!"),wxOK | wxICON_ERROR);
+    }
 }
index 38f50da76f55be359a34593fc86eb111feac234b..dd4e3664930710c7d637a80c8a93daf3c47497cb 100644 (file)
@@ -68,6 +68,7 @@ public:
 
   void CreateControls();
 
+
 private:
   modelCDMFile* file;
 
index d27bca0afc60ed4be7b8266add082839c5957a88..7ac3841eaaea595c32c52fe6485a2fd981a5a5ab 100644 (file)
@@ -41,8 +41,8 @@
 
 BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel)
 EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn)
-EVT_MENU(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
-EVT_MENU(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
+EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
+EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
 END_EVENT_TABLE()
 
 wxCDMFolderDescriptionPanel::wxCDMFolderDescriptionPanel(
@@ -109,6 +109,8 @@ void wxCDMFolderDescriptionPanel::CreateControls()
     {
       wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
       editCMakebt->SetToolTip(wxT("Open the CMakeLists.txt file in this folder with the default text editor."));
+      editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMFolderDescriptionPanel::OnCMakeMouseEnter,NULL,this);
+      editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMFolderDescriptionPanel::OnCMakeMouseExit,NULL,this);
       actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
     }
 
@@ -132,14 +134,52 @@ void wxCDMFolderDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
 
 void wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenInExplorer not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+    if(!this->folder->OpenInFileExplorer(result))
+      wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
 
 void wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
+  std::string* result;
+  if(!this->folder->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->folder->GetCMakeLists() != NULL)
+    {
+      int CMId = this->folder->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+}
+
+void wxCDMFolderDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->folder->GetCMakeLists() != NULL)
+    {
+      int CMId = this->folder->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
+  event.Skip();
+}
+
+void wxCDMFolderDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->folder->GetCMakeLists() != NULL)
+    {
+      int CMId = this->folder->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
index d5c568504c0bbf3124d26902f2d32f6d78839539..514984e3258e02db41a75ddc92960a4caf4dcd09 100644 (file)
@@ -77,6 +77,9 @@ protected:
   void OnBtnEditCMakeLists(wxCommandEvent& event);
   void OnBtnOpenInExplorer(wxCommandEvent& event);
 
+  void OnCMakeMouseEnter(wxMouseEvent& event);
+  void OnCMakeMouseExit(wxMouseEvent& event);
+
 };
 
 #endif /* WXCDMLIBDESCRIPTIONPANEL_H_ */
index 38c67cc91d6d24fe7fc9f38a862ba06884f59dd2..61cec4d23a81460d13fd152cdcee4518460c4516 100644 (file)
@@ -111,6 +111,8 @@ void wxCDMLibraryDescriptionPanel::CreateControls()
   actionsPanelSizer->Add(createFolderbt, 0, wxALL, 5);
   wxButton* editCMakebt = new wxButton(actionsPanel, ID_BUTTON_EDIT_CMAKELISTSFILE, _T("Edit CMakeLists File"));
   editCMakebt->SetToolTip(wxT("Edit the CMakeLists.txt of this library in the default text editor."));
+  editCMakebt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryDescriptionPanel::OnCMakeMouseEnter,NULL,this);
+  editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMLibraryDescriptionPanel::OnCMakeMouseExit,NULL,this);
   actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
   wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("Open Library Folder"));
   openFolderbt->SetToolTip(wxT("Open the library folder in the file explorer."));
@@ -150,15 +152,54 @@ void wxCDMLibraryDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
 
 void wxCDMLibraryDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
+  std::string* result;
+    if(!this->library->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->library->GetCMakeLists() != NULL)
+      {
+        int CMId = this->library->GetCMakeLists()->GetId();
+        newEvent->SetInt(CMId);
+        newEvent->SetId(0);
+        wxPostEvent(this->GetParent(), *newEvent);
+      }
+
+    event.Skip();
+}
+
+void wxCDMLibraryDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
+{
+  std::string* result;
+  if(!this->library->OpenInFileExplorer(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
+}
+
+void wxCDMLibraryDescriptionPanel::OnCMakeMouseEnter(wxMouseEvent& event)
+{
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_SELECTED);
+
+  if(this->library->GetCMakeLists() != NULL)
+    {
+      int CMId = this->library->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
 
-void
-wxCDMLibraryDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
+void wxCDMLibraryDescriptionPanel::OnCMakeMouseExit(wxMouseEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
+  wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
+
+  if(this->library->GetCMakeLists() != NULL)
+    {
+      int CMId = this->library->GetCMakeLists()->GetId();
+      newEvent->SetInt(CMId);
+      newEvent->SetId(0);
+      wxPostEvent(this->GetParent(), *newEvent);
+    }
   event.Skip();
 }
index 8ae6abd3e234550010f47d34ef491190275b5938..37c0ff241bb0aa3c163a137c5bec682a9a8e19b5 100644 (file)
@@ -78,6 +78,8 @@ protected:
   void OnBtnCreateFolder(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
   void OnBtnOpenFolder(wxCommandEvent& event);
+  void OnCMakeMouseEnter(wxMouseEvent& event);
+  void OnCMakeMouseExit(wxMouseEvent& event);
 
 };
 
index 1484059aa845612691491e2d0b018616b6815abf..dc2843edbed71b79d5c1465ac4ce1dc099358041 100755 (executable)
@@ -579,21 +579,31 @@ void wxCDMMainFrame::OnMenuBBTKGraphicalEditor(wxCommandEvent& event)
 {
   std::cerr << "Event OnMenuBBTKGraphicalEditor not implemented" << std::endl;
   event.Skip();
+  if(CDMUtilities::openBBEditor())
+    {
+      wxMessageBox( wxT("Can't open the BB Graphical Editor. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
+    }
 }
 void wxCDMMainFrame::OnMenuMiniTools(wxCommandEvent& event)
 {
-  std::cerr << "Event OnMenuMiniTools not implemented" << std::endl;
-  event.Skip();
+  if(CDMUtilities::openCreaToolsTools())
+    {
+      wxMessageBox( wxT("Can't open the Minitools. Please check your Crea Tools installation."), wxT("Refresh Project - Error"), wxICON_ERROR);
+    }
 }
 void wxCDMMainFrame::OnMenuCodeEditor(wxCommandEvent& event)
 {
-  std::cerr << "Event OnMenuCodeEditor not implemented" << std::endl;
-  event.Skip();
+  if(CDMUtilities::openTextEditor())
+    {
+      wxMessageBox( wxT("Can't open the Text Editor. Please check the default text editor command in the Crea Development Manager settings (Edit -> Settings)."), wxT("Refresh Project - Error"), wxICON_ERROR);
+    }
 }
 void wxCDMMainFrame::OnMenuCommandLine(wxCommandEvent& event)
 {
-  std::cerr << "Event OnMenuCommandLine not implemented" << std::endl;
-  event.Skip();
+  if(CDMUtilities::openTerminal())
+    {
+      wxMessageBox( wxT("Can't open Terminal. Please check the default terminal command in the Crea Development Manager settings (Edit -> Settings)."), wxT("Refresh Project - Error"), wxICON_ERROR);
+    }
 }
 
 //Help Menu
index d32ed866479aa66ec4c1c08557d9239ec89d1a82..99367d7eeb3487a1392295d71317439538e2d2d0 100644 (file)
 #include "creaDevManagerIds.h"
 #include "images/PkIcon64.xpm"
 
+#include <wx/textdlg.h>
+#include "CDMUtilities.h"
+
 BEGIN_EVENT_TABLE(wxCDMPackageDescriptionPanel, wxPanel)
 EVT_BUTTON(ID_BUTTON_PREV, wxCDMPackageDescriptionPanel::OnBtnReturn)
+EVT_BUTTON(ID_BUTTON_SET_AUTHOR, wxCDMPackageDescriptionPanel::OnBtnSetAuthor)
+EVT_BUTTON(ID_BUTTON_SET_VERSION, wxCDMPackageDescriptionPanel::OnBtnSetVersion)
+EVT_BUTTON(ID_BUTTON_SET_DESCRIPTION, wxCDMPackageDescriptionPanel::OnBtnSetDescription)
 EVT_HYPERLINK(ID_LINK_SELECT_BLACKBOX, wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect)
 EVT_BUTTON(ID_BUTTON_CREATE_BLACKBOX, wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox)
 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists)
@@ -110,26 +116,26 @@ void wxCDMPackageDescriptionPanel::CreateControls()
 
   // author
   wxBoxSizer* pAuthorsz = new wxBoxSizer(wxHORIZONTAL);
-  wxStaticText* pAuthortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetAuthors()));
-  wxButton* pAuthorbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Change"));
+  this->authortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetAuthors()));
+  wxButton* pAuthorbt = new wxButton(propertiesPanel, ID_BUTTON_SET_AUTHOR, wxT("Change"));
   pAuthorbt->SetToolTip(wxT("Update the author/s of the package."));
-  pAuthorsz->Add(pAuthortc, 0, wxALIGN_CENTER_VERTICAL, 0);
+  pAuthorsz->Add(this->authortc, 1, wxALIGN_CENTER_VERTICAL);
   pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER | wxLEFT, 10);
 
   // version
   wxBoxSizer* pVersionsz = new wxBoxSizer(wxHORIZONTAL);
-  wxStaticText* pVersiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetVersion()));
+  this->versiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetVersion()));
   wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
   pVersionbt->SetToolTip(wxT("Update the version of the package."));
-  pVersionsz->Add(pVersiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
+  pVersionsz->Add(this->versiontc, 1, wxALIGN_CENTER_VERTICAL);
   pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
 
   // description
   wxBoxSizer* pDescriptionsz = new wxBoxSizer(wxHORIZONTAL);
-  wxStaticText* pDescriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetDescription()));
-  wxButton* pDescriptionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Change"));
+  this->descriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->package->GetDescription()));
+  wxButton* pDescriptionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_DESCRIPTION, wxT("Change"));
   pDescriptionbt->SetToolTip(wxT("Update the description of the project."));
-  pDescriptionsz->Add(pDescriptiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
+  pDescriptionsz->Add(this->descriptiontc, 1, wxALIGN_CENTER_VERTICAL);
   pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
 
   propertiesGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
@@ -139,10 +145,12 @@ void wxCDMPackageDescriptionPanel::CreateControls()
   propertiesGridSizer->Add(pDescription, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   propertiesGridSizer->Add(pDescriptionsz, 1, wxEXPAND);
 
+  propertiesGridSizer->AddGrowableCol(1,1);
+
   propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
   propertiesPanel->SetSizer(propertiesPanelSizer);
   propertiesPanelSizer->Fit(propertiesPanel);
-  propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+  propertiesBox->Add(propertiesPanel, 0, wxEXPAND | wxALL, 5);
 
   sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
@@ -204,6 +212,83 @@ void wxCDMPackageDescriptionPanel::OnBtnReturn(wxCommandEvent& event)
   wxPostEvent(this->GetParent(), *newEvent);
 }
 
+void wxCDMPackageDescriptionPanel::OnBtnSetAuthor(wxCommandEvent& event)
+{
+  //get author from user
+  wxTextEntryDialog* authDlg = new wxTextEntryDialog(
+      this,
+      wxT("Enter the new authors name. Separate each author with a '/'."),
+      wxT("Change Package Author - creaDevManager"),
+      crea::std2wx(this->package->GetAuthors()),
+      wxTE_MULTILINE | wxOK | wxCANCEL
+  );
+
+  if (authDlg->ShowModal() == wxID_OK)
+    {
+      std::string authorsStr = crea::wx2std(authDlg->GetValue());
+      //check name
+      if(authorsStr.size() > 0)
+        {
+          std::string* result;
+          if(!this->package->SetAuthors(authorsStr, result))
+            wxMessageBox(crea::std2wx(*result),_T("Change Package Author - Error!"),wxOK | wxICON_ERROR);
+        }
+      this->authortc->SetLabel(crea::std2wx(this->package->GetAuthors()));
+      this->authortc->GetParent()->GetSizer()->RecalcSizes();
+    }
+
+}
+
+void wxCDMPackageDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
+{
+  //get version
+  wxString versionWx = wxGetTextFromUser(
+      wxT("Enter the new version name"),
+      wxT("Change Package Version - creaDevManager"),
+      crea::std2wx(this->package->GetVersion())
+  );
+  //check name
+  std::vector<std::string> parts;
+  CDMUtilities::splitter::split(parts, crea::wx2std(versionWx), " .", CDMUtilities::splitter::no_empties);
+  if(parts.size() == 3)
+    {
+      std::string* result;
+      if(!this->package->SetVersion(crea::wx2std(versionWx), result))
+        wxMessageBox(crea::std2wx(*result),_T("Change Package Version - Error!"),wxOK | wxICON_ERROR);
+    }
+  else
+    {
+      wxMessageBox(crea::std2wx("The version format is incorrect, please follow the following format:\nX.Y.Z\nX: Major Version\nY: Minor Version\nZ: Build Version"),_T("Set Project Version - Error!"),wxOK | wxICON_ERROR);
+    }
+  this->versiontc->SetLabel(crea::std2wx(this->package->GetVersion()));
+}
+
+void wxCDMPackageDescriptionPanel::OnBtnSetDescription(wxCommandEvent& event)
+{
+  //get author from user
+  wxTextEntryDialog* descDlg = new wxTextEntryDialog(
+      this,
+      wxT("Edit the package description."),
+      wxT("Change Package Description - creaDevManager"),
+      crea::std2wx(this->package->GetDescription()),
+      wxTE_MULTILINE | wxOK | wxCANCEL
+  );
+
+  if (descDlg->ShowModal() == wxID_OK)
+    {
+      std::string descriptionStr = crea::wx2std(descDlg->GetValue());
+      //check name
+      if(descriptionStr.size() > 0)
+        {
+          std::string* result;
+          if(!this->package->SetDescription(descriptionStr, result))
+            wxMessageBox(crea::std2wx(*result),_T("Change Package Description - Error!"),wxOK | wxICON_ERROR);
+        }
+      this->descriptiontc->SetLabel(crea::std2wx(this->package->GetDescription()));
+      this->descriptiontc->GetParent()->GetSizer()->RecalcSizes();
+    }
+}
+
 void wxCDMPackageDescriptionPanel::OnLnkBlackBoxSelect(wxHyperlinkEvent& event)
 {
   int bbId = 0;
@@ -238,8 +323,9 @@ void wxCDMPackageDescriptionPanel::OnBtnCreateBlackBox(wxCommandEvent& event)
 
 void wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnEditCMakeLists not implemented" << std::endl;
+  std::string* result;
+  if(!this->package->OpenCMakeListsFile(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open CMakeLists File - Error!"),wxOK | wxICON_ERROR);
 
   wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED);
 
@@ -256,9 +342,9 @@ void wxCDMPackageDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 
 void wxCDMPackageDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnOpenFolder not implemented" << std::endl;
-  event.Skip();
+  std::string* result;
+  if(!this->package->OpenInFileExplorer(result))
+    wxMessageBox(crea::std2wx(*result),_T("Open Folder - Error!"),wxOK | wxICON_ERROR);
 }
 
 void wxCDMPackageDescriptionPanel::OnMouseEnter(wxMouseEvent& event)
index 41c2ba5d16db8f9775294d59c3a0502ecae2daad..2f9d9377ce7e3f2943a9ba0abe5b4836d277c672 100644 (file)
@@ -71,18 +71,25 @@ public:
 
 private:
   modelCDMPackage* package;
+  wxStaticText* authortc;
+  wxStaticText* versiontc;
+  wxStaticText* descriptiontc;
 
   //handlers
 protected:
   void OnBtnReturn(wxCommandEvent& event);
+
+  void OnBtnSetAuthor(wxCommandEvent& event);
+  void OnBtnSetVersion(wxCommandEvent& event);
+  void OnBtnSetDescription(wxCommandEvent& event);
+
   void OnLnkBlackBoxSelect(wxHyperlinkEvent& event);
+
   void OnBtnCreateBlackBox(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
   void OnBtnOpenFolder(wxCommandEvent& event);
-
   void OnMouseEnter(wxMouseEvent& event);
   void OnMouseExit(wxMouseEvent& event);
-
   void OnCMakeMouseEnter(wxMouseEvent& event);
   void OnCMakeMouseExit(wxMouseEvent& event);
 
index 28b2fe110db2fdc8b3aa5756f03a297b6b26e289..683d4ec4d09f7951897b662895e682a42c9fc63d 100644 (file)
@@ -128,6 +128,8 @@ void wxCDMPackageManagerPanel::CreateControls()
   actionsPanelSizer->Add(createPkgbt, 0, wxALL, 5);
   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)&wxCDMPackageManagerPanel::OnCMakeMouseEnter,NULL,this);
+  editCMakebt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnCMakeMouseExit,NULL,this);
   actionsPanelSizer->Add(editCMakebt, 0, wxALL, 5);
 
   actionsPanel->SetSizer(actionsPanelSizer);
@@ -216,9 +218,19 @@ void wxCDMPackageManagerPanel::OnBtnCreatePackage(wxCommandEvent& event)
 
 void wxCDMPackageManagerPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnCreatePackage not implemented" << std::endl;
-  event.Skip();
+  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 wxCDMPackageManagerPanel::OnMouseEnter(wxMouseEvent& event)
@@ -262,4 +274,32 @@ void wxCDMPackageManagerPanel::OnMouseExit(wxMouseEvent& event)
   event.Skip();
 }
 
+void wxCDMPackageManagerPanel::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 wxCDMPackageManagerPanel::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();
+}
+
 
index 349e0d80665b1901cdc10f3624c99ebdbb95a040..3ce319f1b39b0405bf178f5c03871230167d0fb4 100644 (file)
@@ -83,6 +83,8 @@ protected:
 
   void OnMouseEnter(wxMouseEvent& event);
   void OnMouseExit(wxMouseEvent& event);
+  void OnCMakeMouseEnter(wxMouseEvent& event);
+  void OnCMakeMouseExit(wxMouseEvent& event);
 };
 
 #endif /* WXCDMPACKAGEMANAGERPANEL_H_ */
index 4f60890fbb3c092baab61176e531fdbb52f8ca9b..1bc58e291b3f1abcec70838f946873a9ee655d88 100644 (file)
@@ -118,25 +118,25 @@ void wxCDMProjectDescriptionPanel::CreateControls()
   this->versiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->project->GetVersion()));
   wxButton* pVersionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_VERSION, wxT("Set"));
   pVersionbt->SetToolTip(wxT("Update the version of the project."));
-  pVersionsz->Add(this->versiontc, 0, wxALIGN_CENTER_VERTICAL, 0);
-  pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+  pVersionsz->Add(this->versiontc, 1, wxALIGN_CENTER, 1);
+  pVersionsz->Add(pVersionbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
   // versionDate
   this->versionDatetc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetVersionDate()));
   // sourceLocation
   wxBoxSizer* pSourceLocationsz = new wxBoxSizer(wxHORIZONTAL);
   wxStaticText* pSourceLocationtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetPath()));
-  pSourceLocationtc->SetMaxSize(wxSize(350,-1));
+  //pSourceLocationtc->SetMaxSize(wxSize(350,-1));
   wxButton* pSourceLocationbt = new wxButton(propertiesPanel, ID_BUTTON_OPEN_FOLDER, wxT("Open"));
   pSourceLocationbt->SetToolTip(wxT("Open the source folder in the file explorer."));
-  pSourceLocationsz->Add(pSourceLocationtc, 0, wxALIGN_CENTER, 0);
+  pSourceLocationsz->Add(pSourceLocationtc, 1, wxALIGN_CENTER, 1);
   pSourceLocationsz->Add(pSourceLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
   // buildLocation
   wxBoxSizer* pBuildLocationsz = new wxBoxSizer(wxHORIZONTAL);
   this->buildPathtc = new wxStaticText(propertiesPanel, -1, crea::std2wx(this->project->GetBuildPath()));
-  this->buildPathtc->SetMaxSize(wxSize(350,-1));
+  //this->buildPathtc->SetMaxSize(wxSize(350,-1));
   wxButton* pBuildLocationbt = new wxButton(propertiesPanel, ID_BUTTON_SET_BUILD_PATH, wxT("Choose"));
   pBuildLocationbt->SetToolTip(wxT("Select a new location for compiling the project."));
-  pBuildLocationsz->Add(this->buildPathtc, 0, wxALIGN_CENTER, 0);
+  pBuildLocationsz->Add(this->buildPathtc, 1, wxALIGN_CENTER, 1);
   pBuildLocationsz->Add(pBuildLocationbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
 
   propertiesGridSizer->Add(pVersion, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
@@ -150,12 +150,12 @@ void wxCDMProjectDescriptionPanel::CreateControls()
 
   propertiesGridSizer->AddGrowableCol(1,1);
 
-  propertiesPanelSizer-> Add(propertiesGridSizer, 0, wxALL | wxEXPAND, 5);
+  propertiesPanelSizer-> Add(propertiesGridSizer, 1, wxALL | wxEXPAND, 5);
 
   //SetPanel sizer and box
   propertiesPanel->SetSizer(propertiesPanelSizer);
   propertiesPanelSizer->Fit(propertiesPanel);
-  propertiesBox->Add(propertiesPanel, 0, wxEXPAND);
+  propertiesBox->Add(propertiesPanel, 1, wxEXPAND);
   sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
   //----------------------------------Project Actions--------------------------------------
@@ -170,7 +170,7 @@ void wxCDMProjectDescriptionPanel::CreateControls()
   // 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, 0, wxALL, 5);
+  actionsPanelSizer->Add(packageMgrbt, 1, wxALL, 5);
   // lib manager
   // show only if there is a lib folder
   if(this->project->GetLib() != NULL)
@@ -179,7 +179,7 @@ void wxCDMProjectDescriptionPanel::CreateControls()
       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);
+      actionsPanelSizer->Add(libMgrbt, 1, wxALL, 5);
     }
   // appli manager
   // show only if there is a appli folder
@@ -189,19 +189,19 @@ void wxCDMProjectDescriptionPanel::CreateControls()
       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);
+      actionsPanelSizer->Add(appliMgrbt, 1, 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);
+  actionsPanelSizer->Add(editCMakebt, 1, wxALL, 5);
 
   //SetPanel sizer and box
   actionsPanel->SetSizer(actionsPanelSizer);
   actionsPanelSizer->Fit(actionsPanel);
-  actionsBox->Add(actionsPanel, 0, wxALL, 5);
+  actionsBox->Add(actionsPanel, 1, wxALL | wxEXPAND, 5);
   sizer->Add(actionsBox, 0, wxEXPAND | wxALL, 10);
 
 
@@ -300,14 +300,10 @@ wxCDMProjectDescriptionPanel::OnBtnOpenFolder(wxCommandEvent& event)
 
 void wxCDMProjectDescriptionPanel::OnBtnSetVersion(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnSetVersion not implemented" << std::endl;
-  event.Skip();
-
-  //get name
+  //get version
   wxString libraryName = wxGetTextFromUser(
       wxT("Enter the new version name"),
-      wxT("New Library - creaDevManager"),
+      wxT("Change Project Version - creaDevManager"),
       crea::std2wx(this->project->GetVersion())
   );
   //check name