]> Creatis software - crea.git/commitdiff
Feature #1711 CreaDevManager application implementation
authorDaniel Gonzalez <daniel@daniel.laptop>
Sat, 6 Apr 2013 15:12:41 +0000 (17:12 +0200)
committerDaniel Gonzalez <daniel@daniel.laptop>
Sat, 6 Apr 2013 15:12:41 +0000 (17:12 +0200)
Feature: Show included libraries (3rd Party) and checkboxes to include them in: Libraries, Applications, Packages. Now shows found libraries but doesn't include/exclude them.

lib/creaDevManagerLib/modelCDMAppli.cpp
lib/creaDevManagerLib/modelCDMApplication.cpp
lib/creaDevManagerLib/modelCDMLib.cpp
lib/creaDevManagerLib/modelCDMLibrary.cpp
lib/creaDevManagerLib/modelCDMPackage.cpp
lib/creaDevManagerLib/modelCDMProject.cpp
lib/creaDevManagerLib/wxCDMPackageConfigurationDialog.cpp
lib/creaDevManagerLib/wxCDMPackageConfigurationDialog.h

index 9e588df4e205fb48c3f38e1f0747e6fbeb3b3735..7bcc4a26a88ca7882d126ca2758004ebf862b50f 100644 (file)
@@ -496,7 +496,7 @@ bool modelCDMAppli::IsApplicationIncluded(const std::string& application_name)
             {
               std::getline(CMFile, line);
               while(line[0]==' ')
-                line.erase(0);
+                line.erase(0,1);
               if(line[0] != '#')
                 {
                   std::vector<std::string> lineSeg;
index 1a9c3ad4c8c1f84e3d9658397948c4d912d072a6..c15bedf6c2cb04bdf49cd95282d5a03209b1be4e 100644 (file)
@@ -517,8 +517,76 @@ void modelCDMApplication::CheckStructure(std::map<std::string, bool>& properties
 
 std::map<std::string, bool> modelCDMApplication::Get3rdPartyLibraries()
 {
+  std::map<std::string, std::string> correspondence;
+  correspondence["${crea_LIBRARIES}"] = "Crea";
+  correspondence["${WXWIDGETS_LIBRARIES}"] = "WxWidgets";
+  correspondence["${KWWidgets_LIBRARIES}"] = "KWWidgets";
+  correspondence["${VTK_LIBRARIES}"] = "VTK";
+  correspondence["${ITK_LIBRARIES}"] = "ITK";
+  correspondence["${GDCM_LIBRARIES}"] = "GDCM";
+  correspondence["${BOOST_LIBRARIES}"] = "Boost";
   std::map<std::string, bool> res;
-  res["Test"] = false;
+  res["Crea"] = false;
+  res["WxWidgets"] = false;
+  res["KWWidgets"] = false;
+  res["VTK"] = false;
+  res["ITK"] = false;
+  res["GDCM"] = false;
+  res["Boost"] = false;
+
+  if(this->HasCMakeLists())
+    {
+      std::ifstream CMFile(this->CMakeLists->GetPath().c_str());
+      if (CMFile.is_open())
+        {
+          std::string line;
+          while(!CMFile.eof())
+            {
+              std::getline(CMFile, line, '(');
+
+              std::vector<std::string> lineSeg;
+              CDMUtilities::splitter::split(lineSeg,line,"\n ",CDMUtilities::splitter::no_empties);
+
+              if(lineSeg.size() > 0 && lineSeg[lineSeg.size()-1] == "SET")
+                {
+                  //std::cout << "found set" << std::endl;
+                  std::getline(CMFile, line, ')');
+                  //std::cout << line << std::endl;
+                  CDMUtilities::splitter::split(lineSeg,line,"\n",CDMUtilities::splitter::no_empties);
+                  if(lineSeg.size() > 0)
+                    {
+                      //std::cout << lineSeg[0] << std::endl;
+                      for(int i = 0; i < lineSeg[0].size(); ++i)
+                        if (lineSeg[0][i] == ' ')
+                          {
+                            lineSeg[0].erase(i,1);
+                            --i;
+                          }
+                      //std::cout << lineSeg[0] << std::endl;
+                      if (lineSeg[0] == "${EXE_NAME}_LINK_LIBRARIES")
+                        {
+                          //std::cout << "link" << std::endl;
+                          for (int l = 1; l < lineSeg.size(); ++l)
+                            {
+                              for(int i = 0;i < lineSeg[l].size(); i++)
+                                if (lineSeg[l][i] == ' ')
+                                  {
+                                    lineSeg[l].erase(i,1);
+                                    i--;
+                                  }
+                              if(lineSeg[l].size() > 0 && lineSeg[l][0] == '$')
+                                {
+                                  //std::cout << "found " << lineSeg[l] << std::endl;
+                                  res[correspondence[lineSeg[l]]] = true;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+          CMFile.close();
+        }
+    }
   return res;
 }
 
index 5cfc702a11d4aa945ac1b3940d5d323cd053641e..38cd30df188cdf8a06faf7c326f9272d7ad5380c 100644 (file)
@@ -420,7 +420,7 @@ bool modelCDMLib::IsLibraryIncluded(const std::string& library_name)
             {
               std::getline(CMFile, line);
               while(line[0]==' ')
-                line.erase(0);
+                line.erase(0,1);
               if(line[0] != '#')
                 {
                   std::vector<std::string> lineSeg;
index 524f14257b6ac6e804a6dc0442005c35fd8bc21b..b124c930309cb0300b647c979933774aae50644e 100644 (file)
@@ -436,8 +436,76 @@ void modelCDMLibrary::CheckStructure(std::map<std::string, bool>& properties)
 
 std::map<std::string, bool> modelCDMLibrary::Get3rdPartyLibraries()
 {
+  std::map<std::string, std::string> correspondence;
+  correspondence["${crea_LIBRARIES}"] = "Crea";
+  correspondence["${WXWIDGETS_LIBRARIES}"] = "WxWidgets";
+  correspondence["${KWWidgets_LIBRARIES}"] = "KWWidgets";
+  correspondence["${VTK_LIBRARIES}"] = "VTK";
+  correspondence["${ITK_LIBRARIES}"] = "ITK";
+  correspondence["${GDCM_LIBRARIES}"] = "GDCM";
+  correspondence["${BOOST_LIBRARIES}"] = "Boost";
   std::map<std::string, bool> res;
-  res["Test"] = false;
+  res["Crea"] = false;
+  res["WxWidgets"] = false;
+  res["KWWidgets"] = false;
+  res["VTK"] = false;
+  res["ITK"] = false;
+  res["GDCM"] = false;
+  res["Boost"] = false;
+
+  if(this->HasCMakeLists())
+    {
+      std::ifstream CMFile(this->CMakeLists->GetPath().c_str());
+      if (CMFile.is_open())
+        {
+          std::string line;
+          while(!CMFile.eof())
+            {
+              std::getline(CMFile, line, '(');
+
+              std::vector<std::string> lineSeg;
+              CDMUtilities::splitter::split(lineSeg,line,"\n ",CDMUtilities::splitter::no_empties);
+
+              if(lineSeg.size() > 0 && lineSeg[lineSeg.size()-1] == "SET")
+                {
+                  //std::cout << "found set" << std::endl;
+                  std::getline(CMFile, line, ')');
+                  //std::cout << line << std::endl;
+                  CDMUtilities::splitter::split(lineSeg,line,"\n",CDMUtilities::splitter::no_empties);
+                  if(lineSeg.size() > 0)
+                    {
+                      //std::cout << lineSeg[0] << std::endl;
+                      for(int i = 0; i < lineSeg[0].size(); ++i)
+                        if (lineSeg[0][i] == ' ')
+                          {
+                            lineSeg[0].erase(i,1);
+                            --i;
+                          }
+                      //std::cout << lineSeg[0] << std::endl;
+                      if (lineSeg[0] == "${LIBRARY_NAME}_LINK_LIBRARIES")
+                        {
+                          //std::cout << "link" << std::endl;
+                          for (int l = 1; l < lineSeg.size(); ++l)
+                            {
+                              for(int i = 0;i < lineSeg[l].size(); i++)
+                                if (lineSeg[l][i] == ' ')
+                                  {
+                                    lineSeg[l].erase(i,1);
+                                    i--;
+                                  }
+                              if(lineSeg[l].size() > 0 && lineSeg[l][0] == '$')
+                                {
+                                  //std::cout << "found " << lineSeg[l] << std::endl;
+                                  res[correspondence[lineSeg[l]]] = true;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+          CMFile.close();
+        }
+    }
   return res;
 }
 
index 43d169abb13bfbbefb5b209424cc84f268447959..81fb90610b5ac2b5e23877905ac06d17e61c51e6 100644 (file)
@@ -692,8 +692,64 @@ void modelCDMPackage::CheckStructure(std::map<std::string, bool>& properties)
 
 std::map<std::string, bool> modelCDMPackage::Get3rdPartyLibraries()
 {
+  std::map<std::string, std::string> correspondence;
+  correspondence["${BBTK_PACKAGE_NAME}_USE_VTKON"] = "VTK";
+  correspondence["${BBTK_PACKAGE_NAME}_USE_ITKON"] = "ITK";
+  correspondence["${BBTK_PACKAGE_NAME}_USE_GDCMON"] = "GDCM";
+  correspondence["${BBTK_PACKAGE_NAME}_USE_GDCM_VTKON"] = "GDCM_VTK";
+  correspondence["${BBTK_PACKAGE_NAME}_USE_GSMISON"] = "GSMIS";
+  correspondence["${BBTK_PACKAGE_NAME}_USE_WXWIDGETSON"] = "WxWidgets";
+  correspondence["${BBTK_PACKAGE_NAME}_USE_KWWIDGETSON"] = "KWWidgets";
   std::map<std::string, bool> res;
-  res["Test"] = false;
+  res["VTK"] = false;
+  res["ITK"] = false;
+  res["GDCM"] = false;
+  res["GDCM_VTK"] = false;
+  res["GSMIS"] = false;
+  res["WxWidgets"] = false;
+  res["KWWidgets"] = false;
+
+  if(this->HasCMakeLists())
+    {
+      std::ifstream CMFile(this->CMakeLists->GetPath().c_str());
+      if (CMFile.is_open())
+        {
+          std::string line;
+          while(!CMFile.eof())
+            {
+              std::getline(CMFile, line, '(');
+
+              std::vector<std::string> lineSeg;
+              CDMUtilities::splitter::split(lineSeg,line,"\n",CDMUtilities::splitter::no_empties);
+              for(int i = 0; lineSeg.size() > 0 && i < lineSeg[lineSeg.size()-1].size(); ++i)
+                if (lineSeg[lineSeg.size()-1][i] == ' ')
+                  {
+                    lineSeg[lineSeg.size()-1].erase(i,1);
+                    --i;
+                  }
+              if(lineSeg.size() > 0 && lineSeg[lineSeg.size()-1][0]!='#' && lineSeg[lineSeg.size()-1] == "SET")
+                {
+                  std::getline(CMFile, line, ')');
+                  CDMUtilities::splitter::split(lineSeg,line,"\t\n",CDMUtilities::splitter::no_empties);
+                  if(lineSeg.size() > 0)
+                    {
+                      for(int i = 0; i < lineSeg[0].size(); ++i)
+                        if (lineSeg[0][i] == ' ')
+                          {
+                            lineSeg[0].erase(i,1);
+                            --i;
+                          }
+
+                      if(lineSeg[0].size() > 0 && lineSeg[0][0] == '$' && correspondence.find(lineSeg[0]) != correspondence.end())
+                        {
+                          res[correspondence[lineSeg[0]]] = true;
+                        }
+                    }
+                }
+            }
+          CMFile.close();
+        }
+    }
   return res;
 }
 
index 5bc14e4d4b4ed8460aaef0b6cdab11dd3f578487..d26932d61504c65033393978a1ccdf5d69173be6 100644 (file)
@@ -1022,7 +1022,7 @@ bool modelCDMProject::IsPackageIncluded(const std::string& package_name)
             {
               std::getline(CMFile, line);
               while(line[0]==' ')
-                line.erase(0);
+                line.erase(0,1);
               if(line[0] != '#')
                 {
                   std::vector<std::string> lineSeg;
index af407bff3f371c00d61c5b3feaab8aa5a5c24e3d..07a1525b50fb2eed499a3468c3d43860445e807d 100644 (file)
@@ -53,8 +53,8 @@ wxCDMPackageConfigurationDialog::wxCDMPackageConfigurationDialog(
     long style
 )
 {
-  wxCDMPackageConfigurationDialog::Create(parent, id, caption, position, size, style);
   this->package = package;
+  wxCDMPackageConfigurationDialog::Create(parent, id, caption, position, size, style);
 }
 
 wxCDMPackageConfigurationDialog::~wxCDMPackageConfigurationDialog()
@@ -84,12 +84,16 @@ void wxCDMPackageConfigurationDialog::CreateControls()
 
 
   wxStaticText* title = new wxStaticText(this, wxID_ANY, wxT("Please select the libraries that are used in this package."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT);//new wxRichTextCtrl(this,wxID_ANY, wxString("Create a new project"), wxDefaultPosition, wxDefaultSize, wxRE_READONLY);
-  v_sizer1->Add(title, 0, wxALIGN_LEFT | wxALL, 5);
+  v_sizer1->Add(title, 0, wxEXPAND | wxALIGN_LEFT | wxALL, 5);
+
+  wxScrolledWindow* includesPanel = new wxScrolledWindow(this);
+  includesPanel->FitInside();
+  includesPanel->SetScrollRate(5,5);
 
   wxBoxSizer* includesPanelSizer = new wxBoxSizer(wxVERTICAL);
 
     //Third Party Libraries
-    wxStaticText* Title1 = new wxStaticText(this, wxID_ANY, wxT("Third Party Libraries:"));
+    wxStaticText* Title1 = new wxStaticText(includesPanel, wxID_ANY, wxT("Third Party Libraries:"));
     wxFont font = Title1->GetFont();
     font.SetWeight(wxFONTWEIGHT_BOLD);
     Title1->SetFont(font);
@@ -101,7 +105,7 @@ void wxCDMPackageConfigurationDialog::CreateControls()
     wxFlexGridSizer* includesGridSizer = new wxFlexGridSizer(inclusions.size()+1, 2, 0, 5);
 
     wxStaticText* ChBTitle = new wxStaticText(
-        this,
+        includesPanel,
         wxID_ANY,
         wxT("Included"),
         wxDefaultPosition,
@@ -109,7 +113,7 @@ void wxCDMPackageConfigurationDialog::CreateControls()
         wxALIGN_CENTER
       );
     wxStaticText* LNmTitle = new wxStaticText(
-        this,
+        includesPanel,
         wxID_ANY,
         wxT("Library Name"),
         wxDefaultPosition,
@@ -122,14 +126,14 @@ void wxCDMPackageConfigurationDialog::CreateControls()
 
     for (std::map<std::string, bool>::iterator it = inclusions.begin(); it != inclusions.end(); ++it) {
       wxCheckBox* ChBIncl = new wxCheckBox(
-          this, ID_CHECK_INCLUDE_3RDLIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
+          includesPanel, ID_CHECK_INCLUDE_3RDLIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
         );
       ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " library is included in the project configuration for this library."));
       ChBIncl->SetName(crea::std2wx(it->first));
       ChBIncl->SetValue(it->second);
       includesGridSizer->Add(ChBIncl, 1, wxEXPAND);
 
-      wxStaticText* LNmIncl = new wxStaticText(this, wxID_ANY, crea::std2wx(it->first));
+      wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
       includesGridSizer->Add(LNmIncl, 1, wxEXPAND);
     }
 
@@ -138,7 +142,7 @@ void wxCDMPackageConfigurationDialog::CreateControls()
     includesPanelSizer->Add(includesGridSizer, 1, wxEXPAND, 0);
 
     //Custom Libraries
-    wxStaticText* Title2 = new wxStaticText(this, wxID_ANY, wxT("Custom Libraries:"));
+    wxStaticText* Title2 = new wxStaticText(includesPanel, wxID_ANY, wxT("Custom Libraries:"));
     font = Title2->GetFont();
     font.SetWeight(wxFONTWEIGHT_BOLD);
     Title2->SetFont(font);
@@ -150,7 +154,7 @@ void wxCDMPackageConfigurationDialog::CreateControls()
     wxFlexGridSizer* includesLibGridSizer = new wxFlexGridSizer(inclusionsLibs.size()+1, 2, 0, 5);
 
     wxStaticText* ChBTitle1 = new wxStaticText(
-        this,
+        includesPanel,
         wxID_ANY,
         wxT("Included"),
         wxDefaultPosition,
@@ -158,7 +162,7 @@ void wxCDMPackageConfigurationDialog::CreateControls()
         wxALIGN_CENTER
       );
     wxStaticText* LNmTitle1 = new wxStaticText(
-        this,
+        includesPanel,
         wxID_ANY,
         wxT("Library Name"),
         wxDefaultPosition,
@@ -171,14 +175,14 @@ void wxCDMPackageConfigurationDialog::CreateControls()
 
     for (std::map<std::string, bool>::iterator it = inclusionsLibs.begin(); it != inclusionsLibs.end(); ++it) {
       wxCheckBox* ChBIncl = new wxCheckBox(
-          this, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
+          includesPanel, ID_CHECK_INCLUDE_LIBRARY, wxT(""), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT
         );
       ChBIncl->SetToolTip(crea::std2wx("When this box is checked the " + it->first + " custom library is included in the project configuration for this library."));
       ChBIncl->SetName(crea::std2wx(it->first));
       ChBIncl->SetValue(it->second);
       includesLibGridSizer->Add(ChBIncl, 1, wxEXPAND);
 
-      wxStaticText* LNmIncl = new wxStaticText(this, wxID_ANY, crea::std2wx(it->first));
+      wxStaticText* LNmIncl = new wxStaticText(includesPanel, wxID_ANY, crea::std2wx(it->first));
       includesLibGridSizer->Add(LNmIncl, 1, wxEXPAND);
     }
 
@@ -186,7 +190,9 @@ void wxCDMPackageConfigurationDialog::CreateControls()
 
     includesPanelSizer->Add(includesLibGridSizer, 1, wxEXPAND, 0);
 
-    v_sizer1->Add(includesPanelSizer, 1, wxEXPAND);
+    includesPanel->SetSizer(includesPanelSizer);
+
+    v_sizer1->Add(includesPanel, 1, wxEXPAND);
 
   v_sizer1->Add(new wxButton(this, wxID_OK, wxT("Close")), 0, wxALIGN_CENTER | wxRIGHT | wxBOTTOM, 30);
 
index 03e02a33e3c233d4f90f761ed76a34bf7d29626b..a839430f9603bc2a2219fc1fef3dd2e8c3f7a97a 100644 (file)
@@ -65,7 +65,7 @@ public:
       const wxString& caption = wxT("Package Library Configuration"),
       const wxPoint& position = wxDefaultPosition,
       const wxSize& size = wxSize(350,370),
-      long style = wxDEFAULT_DIALOG_STYLE
+      long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
   );
   /**
    * Destructor.