]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Wed, 15 Oct 2008 13:02:11 +0000 (13:02 +0000)
committerguigues <guigues>
Wed, 15 Oct 2008 13:02:11 +0000 (13:02 +0000)
kernel/cmake/BBTKConfigurePackage.cmake
kernel/cmake/bbtkPackage.in [new file with mode: 0644]
kernel/src/bbtkConfigurationFile.cxx
kernel/src/bbtkConfigurationFile.h
kernel/src/bbtkWxGUIScriptingInterface.cxx
kernel/src/bbtkWxGUIScriptingInterface.h

index 0d3953f9b4f893bada868d97c183ee89f767e37d..d2aa0c021b69535b86ec383d29aca97b9ab56552 100644 (file)
@@ -1,4 +1,18 @@
-
+#---------------------------------------------------------------------------
+# CREATES THE bbtkPackage TEXT FILE
+CONFIGURE_FILE(
+  ${BBTK_CMAKE_DIR}/bbtkPackage.in
+  ${PROJECT_BINARY_DIR}/bbtkPackage
+  @ONLY
+)
+
+IF (WIN32)
+  
+  INSTALL ( FILES ${PROJECT_BINARY_DIR}/bbtkPackage
+    DESTINATION "" )
+  
+ENDIF (WIN32)
+#---------------------------------------------------------------------------
 
 
 #---------------------------------------------------------------------------
diff --git a/kernel/cmake/bbtkPackage.in b/kernel/cmake/bbtkPackage.in
new file mode 100644 (file)
index 0000000..620f5ac
--- /dev/null
@@ -0,0 +1 @@
+@BBTK_PACKAGE_NAME@
index 082f2a38d65343f18b0c5de425b416c3f5162710..f19f5075f6bc7fc11b7a1bed711ed20a40a7fd5c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConfigurationFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/09/10 07:25:23 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2008/10/15 13:02:14 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -469,6 +469,59 @@ namespace bbtk
   }
   //=========================================================================
   
+  //=========================================================================
+  bool ConfigurationFile::AddPackagePathsAndWrite( const std::string& path )
+  {
+    bbtkDebugMessageInc("Config",9,
+                       "ConfigurationFile::AddPackagePathsAndWrite("
+                       <<path<<")"<<std::endl);
+    
+     XMLResults* res = new XMLResults;
+    XMLNode BB = 
+      XMLNode::parseFile((XMLCSTR)Get_config_xml_full_path().c_str(),
+                        (XMLCSTR)"config",res);
+    
+    if ( res->error != eXMLErrorNone ) 
+      {
+       std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
+       delete res;
+       bbtkDebugMessage("Config",1,mess<< std::endl);
+       bbtkError(mess);
+      }
+   delete res;
+
+#ifdef _WIN32
+    std::string bbs_path = path + "/bbs";
+#else
+    std::string bbs_path = path + "/share/bbtk/bbs" ;
+#endif
+    XMLNode BBSPATH = BB.addChild((XMLCSTR)"bbs_path");
+    BBSPATH.addText((XMLCSTR)bbs_path.c_str());
+    Utilities::replace(bbs_path, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);
+    mBbs_paths.push_back(bbs_path);
+#ifdef _WIN32
+    std::string pack_path = path + "/bin";
+    std::string pack_path = path + "/lib";
+#else
+    std::string pack_path = path ;
+#endif
+    XMLNode PACKPATH = BB.addChild((XMLCSTR)"package_path");
+    PACKPATH.addText((XMLCSTR)pack_path.c_str());
+    Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
+    mPackage_paths.push_back(pack_path);
+      
+    XMLError err = BB.writeToFile((XMLCSTR)Get_config_xml_full_path().c_str());
+    if ( err != eXMLErrorNone ) 
+      {
+       std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
+       bbtkDebugMessage("Config",1,mess<< std::endl);
+       bbtkError(mess);
+      }
+
+    return true;
+  }
+  //=========================================================================
 
   //=========================================================================
   void ConfigurationFile::GetHelp(int level) const
index 94992f8098882dfc3c09fcef6f2512f1653cd9fa..47521d976cfe40ca14ebe3d830ad3b6ddc33d30f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkConfigurationFile.h,v $
   Language:  C++
-  Date:      $Date: 2008/09/10 07:25:23 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2008/10/15 13:02:14 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -61,7 +61,7 @@ namespace bbtk
   {
   public:
     
-    static ConfigurationFile const &GetInstance()
+    static ConfigurationFileGetInstance()
     {
       static ConfigurationFile f;
       return f;
@@ -104,6 +104,8 @@ namespace bbtk
     { return mConfig_xml_full_path;}
     inline const std::string& Get_default_temp_dir() const
     { return mDefault_temp_dir;}
+
+    bool AddPackagePathsAndWrite( const std::string& package_root_path );
     
   private:
     void Read(const std::string& fileName);
index 4bde5cbe221519ef4ac00a8d0683b59571261378..ad1d963e75d1ea9d1ddc14c3d1a4c48d56a67542 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/09 14:38:57 $
-  Version:   $Revision: 1.25 $
+  Date:      $Date: 2008/10/15 13:02:14 $
+  Version:   $Revision: 1.26 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -57,6 +57,7 @@ namespace bbtk
       ID_Menu_RegeneratePackageDoc,
       ID_Menu_RegenerateBoxesLists,
       ID_Menu_RegenerateAll,
+      ID_Menu_PlugPackage,
       ID_Menu_Windows_Files,
       ID_Menu_Windows_Help,
       ID_Menu_Windows_Messages,
@@ -94,12 +95,13 @@ namespace bbtk
     wxMenu *menuTools = new wxMenu;
     menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") );
     menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &black box") );
-    menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") );
+    menuTools->Append( ID_Menu_PlugPackage, _T("&Plug package") );
     menuTools->AppendSeparator();
-    menuTools->Append( ID_Menu_RegeneratePackageDoc,_T("&Regenerate package doc") );
-    menuTools->Append( ID_Menu_RegenerateBoxesLists,_T("&Regenerate boxes lists") );
-    menuTools->Append( ID_Menu_RegenerateAll,_T("&Regenerate all") );
-
+    menuTools->Append( ID_Menu_RegeneratePackageDoc,_T("Regenerate package &doc") );
+    menuTools->Append( ID_Menu_RegenerateBoxesLists,_T("Regenerate boxes &lists") );
+    menuTools->Append( ID_Menu_RegenerateAll,_T("Regenerate &all") );
+    menuTools->AppendSeparator();
+    menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") );
 
     wxMenu *menuWindows = new wxMenu;
     menuWindows->AppendCheckItem(ID_Menu_Windows_Files,
@@ -448,7 +450,7 @@ namespace bbtk
     std::string command;
     command = ConfigurationFile::GetInstance().Get_bin_path();
     command += ConfigurationFile::GetInstance().Get_file_separator();
-    command += "bbRegeneratePackageDoc " + pack;
+    command += "bbRegeneratePackageDoc " + pack + " -q";
     bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
     
     if ( ! system ( command.c_str() ) )
@@ -471,7 +473,7 @@ namespace bbtk
     std::string command;
     command = ConfigurationFile::GetInstance().Get_bin_path();
     command += ConfigurationFile::GetInstance().Get_file_separator();
-    command += "bbRegenerateBoxesLists";
+    command += "bbRegenerateBoxesLists -q";
        bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
 
        if ( ! system ( command.c_str() ) )
@@ -494,10 +496,10 @@ namespace bbtk
     std::string command;
     command = ConfigurationFile::GetInstance().Get_bin_path();
     command += ConfigurationFile::GetInstance().Get_file_separator();
-    command += "bbRegeneratePackageDoc -a && ";
+    command += "bbRegeneratePackageDoc -a -q && ";
     command += ConfigurationFile::GetInstance().Get_bin_path();
     command += ConfigurationFile::GetInstance().Get_file_separator();
-    command += "bbRegenerateBoxesLists";
+    command += "bbRegenerateBoxesLists -q ";
        bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
 
        if ( ! system ( command.c_str() ) )
@@ -515,6 +517,62 @@ namespace bbtk
   //================================================================
 
  
+  //================================================================
+  void WxGUIScriptingInterface::OnMenuPlugPackage(wxCommandEvent& WXUNUSED(event))
+  {
+    long style = wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST;
+    wxDirDialog* FD = 
+      new wxDirDialog( 0, 
+                      _T("Select package directory"),
+                      _T(""),
+                      style);
+    
+    if (FD->ShowModal()==wxID_OK)
+      {
+       std::string path = wx2std (FD->GetPath()) ;
+       std::string fname = path + "/bbtkPackage"; 
+       if ( ! Utilities::FileExists( fname ) )
+         {
+           wxString err(_T("The directory does not contain a 'bbtkPackage' file"));
+           wxMessageBox(err,_T("Plug package"),wxOK | wxICON_ERROR);      
+           return;
+         }
+       
+       std::ifstream f;
+       f.open(fname.c_str());
+       std::string pname;
+       f >> pname;
+       f.close();
+       
+       
+       bbtk::ConfigurationFile::GetInstance().AddPackagePathsAndWrite( path );
+       
+       std::string command;
+       command = ConfigurationFile::GetInstance().Get_bin_path();
+       command += ConfigurationFile::GetInstance().Get_file_separator();
+       command += "bbRegeneratePackageDoc " + pname + " -q && ";
+       command += ConfigurationFile::GetInstance().Get_bin_path();
+       command += ConfigurationFile::GetInstance().Get_file_separator();
+       command += "bbRegenerateBoxesLists -q ";
+       bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+       
+       if ( ! system ( command.c_str() ) )
+         {
+           std::string mess("Package '");
+           mess += pname + "' successfully plugged in";
+           wxMessageBox(std2wx(mess),_T("Plug package"),
+                        wxOK | wxICON_INFORMATION);
+         }
+       else 
+         {
+           wxString err(_T("An error occured while running '"));
+           err +=  bbtk::std2wx(command) + _T("'");
+           wxMessageBox(err,_T("Regenerate all"),wxOK | wxICON_ERROR);      
+         }
+      }
+
+  }
+  //================================================================
 
   //================================================================
   void WxGUIScriptingInterface::InterpreterUserViewHtmlPage(const std::string& page)
@@ -682,6 +740,7 @@ namespace bbtk
     EVT_MENU(ID_Menu_RegeneratePackageDoc, WxGUIScriptingInterface::OnMenuRegeneratePackageDoc)
     EVT_MENU(ID_Menu_RegenerateBoxesLists, WxGUIScriptingInterface::OnMenuRegenerateBoxesLists)
     EVT_MENU(ID_Menu_RegenerateAll, WxGUIScriptingInterface::OnMenuRegenerateAll)
+    EVT_MENU(ID_Menu_PlugPackage, WxGUIScriptingInterface::OnMenuPlugPackage)
     EVT_MENU(ID_Menu_Windows_Files, WxGUIScriptingInterface::OnMenuWindowsFiles)
     EVT_MENU(ID_Menu_Windows_Help, WxGUIScriptingInterface::OnMenuWindowsHelp)
     EVT_MENU(ID_Menu_Windows_Messages, WxGUIScriptingInterface::OnMenuWindowsMessages)
index 530a07d7d5afc463d0429a260a31fd65225d3245..b16878687dd50158398fcd477a5724bd13f4a100 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxGUIScriptingInterface.h,v $
   Language:  C++
-  Date:      $Date: 2008/10/08 10:56:27 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2008/10/15 13:02:14 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -97,6 +97,7 @@ namespace bbtk
     void OnMenuRegeneratePackageDoc(wxCommandEvent& WXUNUSED(event));
     void OnMenuRegenerateBoxesLists(wxCommandEvent& WXUNUSED(event));
     void OnMenuRegenerateAll(wxCommandEvent& WXUNUSED(event));
+    void OnMenuPlugPackage(wxCommandEvent& WXUNUSED(event));
     void OnMenuWindowsFiles(wxCommandEvent& event);
     void OnMenuWindowsHelp(wxCommandEvent& event);
     void OnMenuWindowsPackageBrowser(wxCommandEvent& event);