]> Creatis software - crea.git/commitdiff
Feature #1711
authorDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Mon, 14 Jan 2013 14:34:33 +0000 (15:34 +0100)
committerDaniel Gonzalez <daniel.gonzalez@creatis.insa-lyon.fr>
Mon, 14 Jan 2013 14:34:33 +0000 (15:34 +0100)
CreaDevManager application implementation

-Tree Highlight is now darker
-Template libraries and applications are not shown as such (because they are templates)
-Buttons are ordered in they way they are supposed to be used
-Create class implemented in folder and library
-Properties distribution fixed in black box view

18 files changed:
appli/creaDevManager/creaDevManager.cpp
lib/creaDevManagerLib/CDMUtilities.cpp
lib/creaDevManagerLib/CDMUtilities.h
lib/creaDevManagerLib/modelCDMAppli.cpp
lib/creaDevManagerLib/modelCDMFolder.cpp
lib/creaDevManagerLib/modelCDMFolder.h
lib/creaDevManagerLib/modelCDMLib.cpp
lib/creaDevManagerLib/wxCDMAppliDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMBlackBoxDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMFileDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMFolderDescriptionPanel.h
lib/creaDevManagerLib/wxCDMLibDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMLibraryDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMMainFrame.cpp
lib/creaDevManagerLib/wxCDMPackageDescriptionPanel.cpp
lib/creaDevManagerLib/wxCDMPackageManagerPanel.cpp

index a4903d2b92fa0ae1f626a8240c7e8b8b63d9d059..10eef03b1246185a7b67c780504771a9d0c34ed2 100644 (file)
@@ -42,7 +42,7 @@ bool wxCreaDevManagerApp::OnInit()
   
   wxCDMMainFrame* mainWindow = new wxCDMMainFrame(NULL);
   SetTopWindow(mainWindow);
-  mainWindow->SetSize(900, 700);
+  mainWindow->SetSize(750, 700);
   mainWindow->Show(true);
 
   std::cout << "Crea DevManager opened." << std::endl;
index 431ebef21c7477ab7564fb035103960661705b33..defe3f82d8a4229b73f97faf434f6c64ad8ce74f 100644 (file)
 
 #include<vector>
 #include<string>
-#include <cstdlib>
+#include<iostream>
+#include<fstream>
+#include<algorithm>
+#include<cstdlib>
 
 namespace CDMUtilities
 {
@@ -144,4 +147,152 @@ namespace CDMUtilities
     return system(comm.c_str());
   }
 
+  bool createEmptyClass(const std::string& name, const std::string& path)
+  {
+    std::vector<std::string> words;
+    splitter::split(words,name," \\/\",.'`",splitter::no_empties);
+    std::string fixedName = "";
+    for (int i = 0; i < words.size(); i++)
+      {
+        fixedName += words[i];
+      }
+
+    if(fixedName == "" || path == "")
+      {
+        return false;
+      }
+
+    std::string nameupper = fixedName;
+    std::transform(nameupper.begin(), nameupper.end(),nameupper.begin(),::toupper);
+
+    std::ofstream out((path + SLASH + fixedName + ".h").c_str());
+    if( !out.is_open())
+      {
+        return false;
+      }
+
+    out << "/*" << std::endl;
+    out << "# ---------------------------------------------------------------------" << std::endl;
+    out << "#" << std::endl;
+    out << "# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image" << std::endl;
+    out << "#                        pour la Sante)" << std::endl;
+    out << "# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton" << std::endl;
+    out << "# Previous Authors : Laurent Guigues, Jean-Pierre Roux" << std::endl;
+    out << "# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil" << std::endl;
+    out << "#" << std::endl;
+    out << "#  This software is governed by the CeCILL-B license under French law and" << std::endl;
+    out << "#  abiding by the rules of distribution of free software. You can  use," << std::endl;
+    out << "#  modify and/ or redistribute the software under the terms of the CeCILL-B" << std::endl;
+    out << "#  license as circulated by CEA, CNRS and INRIA at the following URL" << std::endl;
+    out << "#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html" << std::endl;
+    out << "#  or in the file LICENSE.txt." << std::endl;
+    out << "#" << std::endl;
+    out << "#  As a counterpart to the access to the source code and  rights to copy," << std::endl;
+    out << "#  modify and redistribute granted by the license, users are provided only" << std::endl;
+    out << "#  with a limited warranty  and the software's author,  the holder of the" << std::endl;
+    out << "#  economic rights,  and the successive licensors  have only  limited" << std::endl;
+    out << "#  liability." << std::endl;
+    out << "#" << std::endl;
+    out << "#  The fact that you are presently reading this means that you have had" << std::endl;
+    out << "#  knowledge of the CeCILL-B license and that you accept its terms." << std::endl;
+    out << "# ------------------------------------------------------------------------" << std::endl;
+    out << "*/" << std::endl;
+    out << "" << std::endl;
+    out << "#ifndef _" << nameupper << "_H_" << std::endl;
+    out << "#define _" << nameupper << "_H_" << std::endl;
+    out << "" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "// Class Name: " << fixedName << "" << std::endl;
+    out << "// [classdescription]" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "" << std::endl;
+    out << "class " << fixedName << "" << std::endl;
+    out << "{" << std::endl;
+    out << "" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "//Methods and attributes exposed to other classes" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "public :" << std::endl;
+    out << "  " << fixedName << "();" << std::endl;
+    out << "  ~" << fixedName << "();" << std::endl;
+    out << "" << std::endl;
+    out << "//--Method template----------------------------" << std::endl;
+    out << "//  void FunctionName(int& parameterA);" << std::endl;
+    out << "" << std::endl;
+    out << "" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "//Methods and attributes exposed only to classes" << std::endl;
+    out << "//that are derived from this class" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "protected:" << std::endl;
+    out << "" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "//Methods and attributes only visible by this class" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "private:" << std::endl;
+    out << "" << std::endl;
+    out << "};" << std::endl;
+    out << "" << std::endl;
+    out << "//-end of _" << nameupper << "_H_------------------------------------------------------" << std::endl;
+    out << "#endif" << std::endl;
+
+    out.close();
+
+    out.open((path + CDMUtilities::SLASH + fixedName + ".cpp").c_str());
+    if( !out.is_open())
+      {
+        return false;
+      }
+
+    out << "/*" << std::endl;
+    out << "# ---------------------------------------------------------------------" << std::endl;
+    out << "#" << std::endl;
+    out << "# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image" << std::endl;
+    out << "#                        pour la Sante)" << std::endl;
+    out << "# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton" << std::endl;
+    out << "# Previous Authors : Laurent Guigues, Jean-Pierre Roux" << std::endl;
+    out << "# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil" << std::endl;
+    out << "#" << std::endl;
+    out << "#  This software is governed by the CeCILL-B license under French law and" << std::endl;
+    out << "#  abiding by the rules of distribution of free software. You can  use," << std::endl;
+    out << "#  modify and/ or redistribute the software under the terms of the CeCILL-B" << std::endl;
+    out << "#  license as circulated by CEA, CNRS and INRIA at the following URL" << std::endl;
+    out << "#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html" << std::endl;
+    out << "#  or in the file LICENSE.txt." << std::endl;
+    out << "#" << std::endl;
+    out << "#  As a counterpart to the access to the source code and  rights to copy," << std::endl;
+    out << "#  modify and redistribute granted by the license, users are provided only" << std::endl;
+    out << "#  with a limited warranty  and the software's author,  the holder of the" << std::endl;
+    out << "#  economic rights,  and the successive licensors  have only  limited" << std::endl;
+    out << "#  liability." << std::endl;
+    out << "#" << std::endl;
+    out << "#  The fact that you are presently reading this means that you have had" << std::endl;
+    out << "#  knowledge of the CeCILL-B license and that you accept its terms." << std::endl;
+    out << "# ------------------------------------------------------------------------" << std::endl;
+    out << "*/" << std::endl;
+    out << "" << std::endl;
+    out << "#include \"" << fixedName << ".h\"" << std::endl;
+    out << "" << std::endl;
+    out << "" << fixedName << "::" << fixedName << "()" << std::endl;
+    out << "{" << std::endl;
+    out << "}" << std::endl;
+    out << "" << std::endl;
+    out << "" << fixedName << "::~" << fixedName << "()" << std::endl;
+    out << "{" << std::endl;
+    out << "}" << std::endl;
+    out << "" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "//Method template" << std::endl;
+    out << "//---------------------------------------------" << std::endl;
+    out << "/*" << std::endl;
+    out << "void " << fixedName << "::FunctionName(int& parameterA)" << std::endl;
+    out << "{" << std::endl;
+    out << "  parameterA = 2 * parameterA;" << std::endl;
+    out << "  return;" << std::endl;
+    out << "}" << std::endl;
+    out << "*/" << std::endl;
+
+    return true;
+  }
+
 }
index 10509896178dc2cd00e1240313a0b0e612fe9194..21f66d8d32ef1b7f5f88d9c9d2e4bd07495d5aaf 100644 (file)
@@ -106,6 +106,7 @@ namespace CDMUtilities
   int openBBEditor();
   int openCreaToolsTools();
   int openTerminal(const std::string& command = "");
+  bool createEmptyClass(const std::string& name, const std::string& path);
 };
 
 #endif /* CDMUTILITIES_H_ */
index c92932a1c5583de3c0a9f6795d926fefe26cc13d..417392792399e8024b7eed70ae5b7101c762f655 100644 (file)
@@ -69,9 +69,17 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const std::string& name, c
         {
           std::string stdfileName = crea::wx2std(fileName);
 
-          modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-          this->applications.push_back(application);
-          this->children.push_back(application);
+          if(stdfileName != "template_appli" && stdfileName != "template_wx_appli")
+            {
+              modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->applications.push_back(application);
+              this->children.push_back(application);
+            }
+          else
+            {
+              modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->children.push_back(folder);
+            }
 
           cont = dir.GetNext(&fileName);
         }
@@ -175,26 +183,51 @@ const bool modelCDMAppli::Refresh(std::string*& result)
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
-          std::string applicationName = stdfileName;
-          //check if they already exist
-          bool found = false;
-          for (int i = 0; !found && i < this->applications.size(); i++)
+
+          if(stdfileName != "template_appli" && stdfileName != "template_wx_appli")
             {
-              if (this->applications[i]->GetName() == applicationName)
+              std::string applicationName = stdfileName;
+              //check if application already exist
+              bool found = false;
+              for (int i = 0; !found && i < this->applications.size(); i++)
                 {
-                  found = true;
-                  int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin();
-                  checked[pos] = true;
-                  checkedApplications[i] = true;
-                  if(!this->applications[i]->Refresh(result))
-                    return false;
+                  if (this->applications[i]->GetName() == applicationName)
+                    {
+                      found = true;
+                      int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin();
+                      checked[pos] = true;
+                      checkedApplications[i] = true;
+                      if(!this->applications[i]->Refresh(result))
+                        return false;
+                    }
+                }
+              if(!found)
+                {
+                  modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->applications.push_back(application);
+                  this->children.push_back(application);
                 }
             }
-          if(!found)
+          else
             {
-              modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-              this->applications.push_back(application);
-              this->children.push_back(application);
+              //check if folder already exist
+              bool found = false;
+              for (int i = 0; !found && i < this->children.size(); i++)
+                {
+                  if (this->children[i]->GetName() == stdfileName)
+                    {
+                      found = true;
+                      checked[i] = true;
+
+                      if(!this->children[i]->Refresh(result))
+                        return false;
+                    }
+                }
+              if(!found)
+                {
+                  modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->children.push_back(folder);
+                }
             }
           cont = dir.GetNext(&fileName);
         }
index 3365c099b9adfd64c246ff7b7f04a92636a6df02..c97b129d005da0033615ff9221ed2040899788e5 100644 (file)
@@ -117,6 +117,21 @@ modelCDMFolder::~modelCDMFolder()
   this->children.clear();
 }
 
+bool modelCDMFolder::CreateClass(const std::string& name)
+{
+  if (!CDMUtilities::createEmptyClass(name, this->path))
+      {
+        return false;
+      }
+    else
+      {
+        this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".h", name + ".h", this->level + 1));
+        this->children.push_back(new modelCDMFile(this->path + CDMUtilities::SLASH + name + ".cpp", name + ".cpp", this->level + 1));
+        this->SortChildren();
+        return true;
+      }
+}
+
 modelCDMFolder* modelCDMFolder::CreateFolder(const std::string& name, std::string*& result)
 {
   //TODO:: mkdir depending on OS
index a4ea6e721197be8cc7515830fee21a58226adb8f..07565009b1e5b3bf01bb0ba14b4d1da608312dfd 100644 (file)
@@ -51,6 +51,8 @@ public:
   modelCDMCMakeListsFile* GetCMakeLists() const;
   std::vector<modelCDMFolder*> GetFolders() const;
 
+  bool CreateClass(const std::string& name);
+
   modelCDMFolder* CreateFolder(
       const std::string& name,
       std::string*& result
index 8ebd9ae100555df4211fdc2149729e3b7081062e..16211eed4ade6c269d87e23b93971cda679d397a 100644 (file)
@@ -70,9 +70,17 @@ modelCDMLib::modelCDMLib(const std::string& path, const std::string& name, const
         {
           std::string stdfileName = crea::wx2std(fileName);
 
-          modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-          this->libraries.push_back(library);
-          this->children.push_back(library);
+          if(stdfileName != "template_lib")
+            {
+              modelCDMLibrary* library = new modelCDMLibrary(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->libraries.push_back(library);
+              this->children.push_back(library);
+            }
+          else
+            {
+              modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->children.push_back(folder);
+            }
 
           cont = dir.GetNext(&fileName);
         }
@@ -177,26 +185,50 @@ const bool modelCDMLib::Refresh(std::string*& result)
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
-          std::string libraryName = stdfileName;
-          //check if they already exist
-          bool found = false;
-          for (int i = 0; !found && i < this->libraries.size(); i++)
+
+          if(stdfileName != "template_lib")
             {
-              if (this->libraries[i]->GetName() == libraryName)
+              std::string libraryName = stdfileName;
+              //check if library already exist
+              bool found = false;
+              for (int i = 0; !found && i < this->libraries.size(); i++)
                 {
-                  found = true;
-                  int pos = std::find(this->children.begin(), this->children.end(), this->libraries[i]) - this->children.begin();
-                  checked[pos] = true;
-                  checkedLibraries[i] = true;
-                  if(!this->libraries[i]->Refresh(result))
-                    return false;
+                  if (this->libraries[i]->GetName() == libraryName)
+                    {
+                      found = true;
+                      int pos = std::find(this->children.begin(), this->children.end(), this->libraries[i]) - this->children.begin();
+                      checked[pos] = true;
+                      checkedLibraries[i] = true;
+                      if(!this->libraries[i]->Refresh(result))
+                        return false;
+                    }
+                }
+              if(!found)
+                {
+                  modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->libraries.push_back(library);
+                  this->children.push_back(library);
                 }
             }
-          if(!found)
+          else
             {
-              modelCDMLibrary* library = new modelCDMLibrary(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-              this->libraries.push_back(library);
-              this->children.push_back(library);
+              //check if folder already exist
+              bool found = false;
+              for (int i = 0; !found && i < this->children.size(); i++)
+                {
+                  if (this->children[i]->GetName() == stdfileName)
+                    {
+                      found = true;
+                      checked[i] = true;
+                      if(!this->children[i]->Refresh(result))
+                        return false;
+                    }
+                }
+              if(!found)
+                {
+                  modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->children.push_back(folder);
+                }
             }
           cont = dir.GetNext(&fileName);
         }
index e99bc1334d0d233530c5465ef17b20ab088c87d5..ec0dc0486fdca8d3e9a4d5766a53fa5e40565d11 100644 (file)
@@ -115,17 +115,18 @@ void wxCDMAppliDescriptionPanel::CreateControls()
   for (int i = 0; i < applications.size(); i++)
     {
       wxHyperlinkCtrl* pApplicationlk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_APPLICATION, crea::std2wx(applications[i]->GetName().c_str()), crea::std2wx(applications[i]->GetName().c_str()));
+      pApplicationlk->SetWindowStyle(wxALIGN_LEFT);
       std::string tt = "Name: " + applications[i]->GetName() + "\n";
       tt += "Location: " + applications[i]->GetPath();
       pApplicationlk->SetToolTip(crea::std2wx(tt.c_str()));
       pApplicationlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnMouseEnter,NULL,this);
       pApplicationlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMAppliDescriptionPanel::OnMouseExit,NULL,this);
-      propertiesPanelSizer -> Add(pApplicationlk, 0, wxALIGN_LEFT | wxALL, 5);
+      propertiesPanelSizer -> Add(pApplicationlk, 1, wxEXPAND | wxALL, 5);
     }
 
   propertiesPanel->SetSizer(propertiesPanelSizer);
   propertiesPanelSizer->Fit(propertiesPanel);
-  propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+  propertiesBox->Add(propertiesPanel, 1, wxEXPAND | wxALL, 5);
   sizer -> Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
   //Actions
index d791376db70b076a03d123846c8942e90b282452..079a0932b9da01f6794595416c1980c22e1274f0 100644 (file)
@@ -144,7 +144,7 @@ void wxCDMApplicationDescriptionPanel::CreateControls()
   //actionsGrid Sizer
   wxFlexGridSizer* actionsGridSizer = new wxFlexGridSizer(2, 2, 9, 15);
 
-  wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("A. Create Class"));
+  wxButton* createClassbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_CLASS, _T("Create Class (Optional)"));
   createClassbt->SetToolTip(wxT("Create a new Class (.h and .cxx files)."));
   wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder (Optional)"));
   createFolderbt->SetToolTip(wxT("Create a new Folder inside the application folder."));
@@ -152,13 +152,13 @@ void wxCDMApplicationDescriptionPanel::CreateControls()
   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("C. Open Application Folder"));
+  wxButton* openFolderbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_FOLDER, _T("A. Open Application Folder"));
   openFolderbt->SetToolTip(wxT("Open the application folder in the file explorer."));
 
 
-  actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5);
-  actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
   actionsGridSizer->Add(openFolderbt, 1, wxALL | wxEXPAND, 5);
+  actionsGridSizer->Add(editCMakebt, 1, wxALL | wxEXPAND, 5);
+  actionsGridSizer->Add(createClassbt, 1, wxALL | wxEXPAND, 5);
   actionsGridSizer->Add(createFolderbt, 1, wxALL | wxEXPAND, 5);
 
   //SetPanel sizer and box
index 065eb8fea2bffc1e922ef880047b9584f76bc7d0..006ca3d195dab5669122aa07fa6a8169eadf0181 100644 (file)
@@ -122,24 +122,24 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls()
   this->authortc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetAuthors()));
   wxButton* pAuthorbt = new wxButton(propertiesPanel, ID_BUTTON_SET_AUTHOR, wxT("Change"));
   pAuthorbt->SetToolTip(wxT("Update the author/s of the package."));
-  pAuthorsz->Add(this->authortc, 1, wxALIGN_CENTER_VERTICAL, 0);
-  pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+  pAuthorsz->Add(this->authortc, 1, wxALIGN_CENTER, 0);
+  pAuthorsz->Add(pAuthorbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
 
   // description
   wxBoxSizer* pDescriptionsz = new wxBoxSizer(wxHORIZONTAL);
   this->descriptiontc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetDescription()));
   wxButton* pDescriptionbt = new wxButton(propertiesPanel, ID_BUTTON_SET_DESCRIPTION, wxT("Change"));
   pDescriptionbt->SetToolTip(wxT("Update the description of the project."));
-  pDescriptionsz->Add(this->descriptiontc, 1, wxALIGN_CENTER_VERTICAL, 0);
-  pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+  pDescriptionsz->Add(this->descriptiontc, 1, wxALIGN_CENTER, 1);
+  pDescriptionsz->Add(pDescriptionbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
 
   // categories
   wxBoxSizer* pCategoriessz = new wxBoxSizer(wxHORIZONTAL);
   this->categoriestc = new wxStaticText(propertiesPanel, wxID_ANY, crea::std2wx(this->blackBox->GetCategories()));
   wxButton* pCategoriesbt = new wxButton(propertiesPanel, ID_BUTTON_SET_CATEGORY, wxT("Change"));
   pCategoriesbt->SetToolTip(wxT("Update the categories of the project."));
-  pCategoriessz->Add(this->categoriestc, 1, wxALIGN_CENTER_VERTICAL, 0);
-  pCategoriessz->Add(pCategoriesbt, 0, wxALIGN_CENTER | wxLEFT, 10);
+  pCategoriessz->Add(this->categoriestc, 1, wxALIGN_CENTER, 0);
+  pCategoriessz->Add(pCategoriesbt, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 10);
 
   propertiesGridSizer->Add(pAuthor, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
   propertiesGridSizer->Add(pAuthorsz, 1, wxEXPAND);
@@ -150,10 +150,10 @@ void wxCDMBlackBoxDescriptionPanel::CreateControls()
 
   propertiesGridSizer->AddGrowableCol(1,1);
 
-  propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
+  propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND | wxALL, 5);
   propertiesPanel->SetSizer(propertiesPanelSizer);
   propertiesPanelSizer->Fit(propertiesPanel);
-  propertiesBox->Add(propertiesPanel, 0, wxALL, 5);
+  propertiesBox->Add(propertiesPanel, 1, wxEXPAND, 5);
 
   sizer->Add(propertiesBox, 0, wxEXPAND | wxALL, 10);
 
index efbc396135cb1cabe1000ed549668f7d6aa4ab2d..9e01585cc2083c27431bffc9b5f25f835dc6617e 100644 (file)
@@ -130,7 +130,7 @@ void wxCDMFileDescriptionPanel::CreateControls()
   propertiesPanelSizer -> Add(propertiesGridSizer, 1, wxEXPAND);
   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);
 
index d3ca77b579bf59a7bad12108ac63ba2784b5c968..e0669cfc00718a79804cce55a63022a16188f2de 100644 (file)
@@ -44,6 +44,7 @@ BEGIN_EVENT_TABLE(wxCDMFolderDescriptionPanel, wxPanel)
 EVT_BUTTON(ID_BUTTON_PREV, wxCDMFolderDescriptionPanel::OnBtnReturn)
 EVT_BUTTON(ID_BUTTON_OPEN_FOLDER, wxCDMFolderDescriptionPanel::OnBtnOpenInExplorer)
 EVT_BUTTON(ID_BUTTON_EDIT_CMAKELISTSFILE, wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists)
+EVT_BUTTON(ID_BUTTON_CREATE_CLASS, wxCDMFolderDescriptionPanel::OnBtnCreateClass)
 EVT_BUTTON(ID_BUTTON_CREATE_FOLDER, wxCDMFolderDescriptionPanel::OnBtnCreateFolder)
 END_EVENT_TABLE()
 
@@ -177,6 +178,42 @@ void wxCDMFolderDescriptionPanel::OnBtnEditCMakeLists(wxCommandEvent& event)
     }
 }
 
+void wxCDMFolderDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
+{
+  //get class name from user
+  wxTextEntryDialog* newClassDlg = new wxTextEntryDialog(
+      this,
+      wxT("Please enter the new class name."),
+      wxT("New Class - creaDevManager"),
+      wxT(""),
+      wxOK | wxCANCEL
+  );
+
+  if (newClassDlg->ShowModal() == wxID_OK)
+    {
+      std::string className = crea::wx2std(newClassDlg->GetValue());
+      //check class name
+      if(className.size() > 0)
+        {
+          if(!this->folder->CreateClass(className))
+            wxMessageBox(crea::std2wx("Something has gone wrong with the creation of the class."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+
+          ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+          newEvent->SetId(0);
+          newEvent->SetInt(folder->GetId());
+          wxPostEvent(this->GetParent(), *newEvent);
+
+          wxMessageBox(crea::std2wx("The class has been created successfully."),_T("New Class - Success"),wxOK | wxICON_INFORMATION);
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("The new class name cannot be empty."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
+}
+
 void wxCDMFolderDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
 {
   //get name
index ecf47ff12a3718d802259600269d8e264840feb7..e273114db8d0aa726b95f915d70cf46bb68f8a73 100644 (file)
@@ -75,6 +75,7 @@ private:
 protected:
   void OnBtnReturn(wxCommandEvent& event);
   void OnBtnEditCMakeLists(wxCommandEvent& event);
+  void OnBtnCreateClass(wxCommandEvent& event);
   void OnBtnCreateFolder(wxCommandEvent& event);
   void OnBtnOpenInExplorer(wxCommandEvent& event);
 
index 79287395c6ca1d53d2a698ec5a3273a3bbe87633..6167c17ac1fa2a17253d453e531ae2dae3bc25c7 100644 (file)
@@ -112,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
index 62b5b930da28c8b3803447d01a45ed2002a8dad6..4bee166f5b2c922d69225b6b73c6306653df3b6c 100644 (file)
@@ -209,9 +209,38 @@ void wxCDMLibraryDescriptionPanel::OnBtnSetExeName(wxCommandEvent& event)
 
 void wxCDMLibraryDescriptionPanel::OnBtnCreateClass(wxCommandEvent& event)
 {
-  //TODO: implement method
-  std::cerr << "Event OnBtnCreateClass not implemented" << std::endl;
-  event.Skip();
+  //get class name from user
+  wxTextEntryDialog* newClassDlg = new wxTextEntryDialog(
+      this,
+      wxT("Please enter the new class name."),
+      wxT("New Class - creaDevManager"),
+      wxT(""),
+      wxOK | wxCANCEL
+  );
+
+  if (newClassDlg->ShowModal() == wxID_OK)
+    {
+      std::string className = crea::wx2std(newClassDlg->GetValue());
+      //check class name
+      if(className.size() > 0)
+        {
+          if(!this->library->CreateClass(className))
+            wxMessageBox(crea::std2wx("Something has gone wrong with the creation of the class."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+
+          ((wxCDMMainFrame*)this->GetParent())->RefreshProject();
+
+          wxCommandEvent* newEvent = new wxCommandEvent(wxEVT_DISPLAY_CHANGED);
+          newEvent->SetId(0);
+          newEvent->SetInt(library->GetId());
+          wxPostEvent(this->GetParent(), *newEvent);
+
+          wxMessageBox(crea::std2wx("The class has been created successfully."),_T("New Class - Success"),wxOK | wxICON_INFORMATION);
+        }
+      else
+        {
+          wxMessageBox(crea::std2wx("The new class name cannot be empty."),_T("New Class - Error!"),wxOK | wxICON_ERROR);
+        }
+    }
 }
 
 void wxCDMLibraryDescriptionPanel::OnBtnCreateFolder(wxCommandEvent& event)
index 6f0af4608e0acb5e93b494ab0e1ad4d6d540c9b0..143d23977ce318ac20e1872eb64758304bbb624e 100755 (executable)
@@ -867,6 +867,7 @@ void wxCDMMainFrame::OnCreationComplete(wxCommandEvent& event)
   {
   case 0:
     //select out old one to generate selection event
+    this->tree_Projects->SelectItem(event.GetInt(), false);
     this->tree_Projects->SelectItem(event.GetInt(), true);
     this->tree_Projects->Expand(event.GetInt());
     break;
@@ -941,6 +942,7 @@ void wxCDMMainFrame::OnElementSelected(wxCommandEvent& event)
   this->tree_Projects->EnsureVisible(event.GetInt());
   this->tree_Projects->SetItemBold(event.GetInt(), true);
   this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,255));
+  this->tree_Projects->SetItemBackgroundColour(event.GetInt(), wxColour(230,230,255));
   this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
   auiManager.Update();
 }
@@ -949,6 +951,7 @@ void wxCDMMainFrame::OnElementDeselected(wxCommandEvent& event)
 {
   this->tree_Projects->SetItemBold(event.GetInt(), false);
   this->tree_Projects->SetItemTextColour(event.GetInt(), wxColour(0,0,0));
+  this->tree_Projects->SetItemBackgroundColour(event.GetInt(), wxColour(255,255,255));
   this->tree_Projects->UpdateWindowUI(wxUPDATE_UI_RECURSE);
   auiManager.Update();
 }
index e332a560dea2f88e9dfecfc2b3ea889e096b02c7..d4348fa152fe9d4956fc3bf61d049d391550afa0 100644 (file)
@@ -180,18 +180,18 @@ void wxCDMPackageDescriptionPanel::CreateControls()
         {
 
           wxHyperlinkCtrl* pBBlk = new wxHyperlinkCtrl(BBPanel,ID_LINK_SELECT_BLACKBOX, crea::std2wx(blackBoxes[i]->GetName().c_str()), crea::std2wx(blackBoxes[i]->GetName().c_str()));
+          pBBlk->SetWindowStyle(wxALIGN_LEFT);
           std::string tt = "Author: " + blackBoxes[i]->GetAuthors() + "\nDescription: " + blackBoxes[i]->GetDescription() + "\nCategories: " + blackBoxes[i]->GetCategories();
           pBBlk->SetToolTip(crea::std2wx(tt));
           pBBlk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseEnter,NULL,this);
           pBBlk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageDescriptionPanel::OnMouseExit,NULL,this);
-          BBPanelSizer -> Add(pBBlk, 0, wxALIGN_LEFT | wxALL, 5);
+          BBPanelSizer -> Add(pBBlk, 0, wxEXPAND | wxALL, 5);
         }
     }
 
   BBPanel->SetSizer(BBPanelSizer);
   BBPanelSizer->Fit(BBPanel);
-  BBBox->Add(BBPanel, 0, wxALL, 5);
-
+  BBBox->Add(BBPanel, 1, wxEXPAND | wxALL, 5);
   sizer -> Add(BBBox, 0, wxEXPAND | wxALL, 10);
 
   //Actions
index 3cd317bd7c65556430fcb5f9d3c63cdff2e06e97..a888f8bcce35c53106f6217a5d94a1df48a51f97 100644 (file)
@@ -116,16 +116,17 @@ void wxCDMPackageManagerPanel::CreateControls()
   for (int i = 0; i < packages.size(); i++)
     {
       wxHyperlinkCtrl* pPackagelk = new wxHyperlinkCtrl(propertiesPanel,ID_LINK_SELECT_PACKAGE, crea::std2wx(packages[i]->GetName().c_str()), crea::std2wx(packages[i]->GetName().c_str()));
+      pPackagelk->SetWindowStyle(wxALIGN_LEFT);
       std::string tt = "Author: " + packages[i]->GetAuthors() + "\nDescription: " + packages[i]->GetDescription();
       pPackagelk->SetToolTip(crea::std2wx(tt));
-      propertiesPanelSizer -> Add(pPackagelk, 0, wxALIGN_LEFT | wxALL, 5);
+      propertiesPanelSizer -> Add(pPackagelk, 0, wxEXPAND | wxALL, 5);
       pPackagelk->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseEnter,NULL,this);
       pPackagelk->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMPackageManagerPanel::OnMouseExit,NULL,this);
     }
 
   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);