]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUIPackageBrowser2.cxx
=== MAJOR RELEASE ====
[bbtk.git] / kernel / src / bbtkWxGUIPackageBrowser2.cxx
index d7349e8ec230dddd69a754e0d9669bf9261dff54..d95d80dee445b049038efc327f155694e990439a 100644 (file)
@@ -3,8 +3,8 @@
 Program:   bbtk
 Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
 Language:  C++
-Date:      $Date: 2008/04/09 11:16:57 $
-Version:   $Revision: 1.4 $
+Date:      $Date: 2008/04/18 12:59:16 $
+Version:   $Revision: 1.5 $
                                                                                 
 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
 l'Image). All rights reserved. See Doc/License.txt or
@@ -109,7 +109,7 @@ namespace bbtk
 #endif
   }
   
-  void WxGUIBlackBoxList::Insert(BlackBoxDescriptor* d)
+  void WxGUIBlackBoxList::Insert(BlackBoxDescriptor::Pointer d)
   {
     if (GetColumnCount()!=3)
       {
@@ -127,8 +127,9 @@ namespace bbtk
     int nID = this->GetItemCount();
     kNewItem.SetId(nID);
     kNewItem.SetMask(wxLIST_MASK_DATA);
-    kNewItem.SetData(d);  
-    //    BlackBoxDescriptor* d2 = (BlackBoxDescriptor*)kNewItem.GetData();
+    // TO DO : STORE SHARED POINTER
+    //    kNewItem.SetData(d.get());  
+    //    BlackBoxDescriptor::Pointer* d2 = (BlackBoxDescriptor::Pointer*)kNewItem.GetData();
     //    std::cout << "Descr = "<<d<<" = "<<d2<<std::endl;
     this->InsertItem(kNewItem);
     this->SetItem(nID, 0, std2wx(d->GetPackage()->GetName()) );
@@ -312,8 +313,9 @@ namespace bbtk
     info.m_mask = wxLIST_MASK_DATA;
     if ( GetItem(info) )
       {
-       BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
-       if (d!=0) mUser->WxGUIBlackBoxListUserOnSelected(d);
+       // TO DO : STORE SHARED
+       //      BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
+       //      if (d!=0) mUser->WxGUIBlackBoxListUserOnSelected(d);
       }
     else
       {
@@ -556,7 +558,7 @@ namespace bbtk
   WxGUIBlackBoxInfo::WxGUIBlackBoxInfo(wxWindow* parent)
     :
     wxPanel(parent, -1),
-    mDescriptor(0)
+    mDescriptor()
   {
     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
     
@@ -604,7 +606,7 @@ namespace bbtk
 
     
   //================================================================
-  void WxGUIBlackBoxInfo::UpdateInfo(BlackBoxDescriptor* descr)
+  void WxGUIBlackBoxInfo::UpdateInfo(BlackBoxDescriptor::Pointer descr)
   {
 
     //    mName->SetLabel(std2wx(descr->GetTypeName()));
@@ -758,7 +760,7 @@ namespace bbtk
                                              WxGUIPackageBrowser2User* user )
     : wxPanel(parent, -1),
       mUser(user),
-      mInterpreter(0)
+      mInterpreter()
   {
     m_mgr.SetManagedWindow(this);
 
@@ -882,7 +884,7 @@ namespace bbtk
 
   //================================================================
   // User callback when a box is selected in the list 
-  void WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor* d)
+  void WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor::Pointer d)
   {
     mBoxInfo->UpdateInfo(d);
     std::string title = d->GetPackage()->GetName()+"::"+d->GetTypeName();
@@ -895,26 +897,27 @@ namespace bbtk
   //================================================================
   WxGUIPackageBrowser2::~WxGUIPackageBrowser2()
   {
-    std::cout << "del interpreter" << std::endl;
-    if (mInterpreter) delete mInterpreter;
-    std::cout << "ok" << std::endl;
+
+    //    std::cout << "del interpreter" << std::endl;
+    //    if (mInterpreter) delete mInterpreter;
+    //    std::cout << "ok" << std::endl;
   }
   //================================================================
 
   //================================================================
   void WxGUIPackageBrowser2::IncludeAll()
   {
-    if (!mInterpreter) mInterpreter = new bbtk::Interpreter();
+    if (!mInterpreter) mInterpreter =bbtk::Interpreter::New();
     mInterpreter->SetCommandLine(true);
     mInterpreter->InterpretLine("include *");
 
-    Factory* F = mInterpreter->GetExecuter()->GetFactory();
+    Factory::Pointer F = mInterpreter->GetExecuter()->GetFactory();
     BuildFromFactory(F);
   }
   //================================================================
 
   //================================================================
-  void WxGUIPackageBrowser2::BuildFromFactory(Factory* F)
+  void WxGUIPackageBrowser2::BuildFromFactory(Factory::Pointer F)
   {
     mFactory = F;
     RebuildList();
@@ -931,7 +934,7 @@ namespace bbtk
     Factory::PackageMapType::const_iterator i;
     for (i=M.begin();i!=M.end();++i)
       {
-       Package* P = i->second.mPackage;
+       Package::Pointer P = i->second;
        if (P->GetName() == "user") continue;
        
        Package::BlackBoxMapType::iterator j;
@@ -949,7 +952,7 @@ namespace bbtk
   //================================================================
 
   //================================================================
-  bool WxGUIPackageBrowser2::IsVisible(BlackBoxDescriptor* d)
+  bool WxGUIPackageBrowser2::IsVisible(BlackBoxDescriptor::Pointer d)
   {
     //    std::cout << "   '" << wx2std(mPackageFilter->GetValue())<<"'"<<std::endl;
     //    std::cout << "vs '" << d->GetPackage()->GetName() << "'"<<std::endl;