]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxGUIPackageBrowser2.cxx
drag and drop send package and box names
[bbtk.git] / kernel / src / bbtkWxGUIPackageBrowser2.cxx
index 02a11a9b9839475b2d7e8727f0560e2bd5cde9eb..e4a688e8bc65df133e33be0b386ec185ef7f3fb1 100644 (file)
@@ -1,25 +1,40 @@
-/*=========================================================================
-                                                                                
-Program:   bbtk
-Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
-Language:  C++
-Date:      $Date: 2008/04/04 08:04:05 $
-Version:   $Revision: 1.1 $
-                                                                                
-Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
-l'Image). All rights reserved. See Doc/License.txt or
-http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
-                                                                                
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.  See the above copyright notices for more information.
-                                                                                
-=========================================================================*//**
-                                                                           * \brief Short description in one line
-                                                                           * 
-                                                                           * Long description which 
-                                                                           * can span multiple lines
-                                                                           */
+/*=========================================================================                                                                               
+  Program:   bbtk
+  Module:    $RCSfile: bbtkWxGUIPackageBrowser2.cxx,v $
+  Language:  C++
+  Date:      $Date: 2010/03/29 16:07:15 $
+  Version:   $Revision: 1.17 $
+=========================================================================*/
+
+/* ---------------------------------------------------------------------
+
+* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
+* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
+*
+*  This software is governed by the CeCILL-B license under French law and 
+*  abiding by the rules of distribution of free software. You can  use, 
+*  modify and/ or redistribute the software under the terms of the CeCILL-B 
+*  license as circulated by CEA, CNRS and INRIA at the following URL 
+*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+*  or in the file LICENSE.txt.
+*
+*  As a counterpart to the access to the source code and  rights to copy,
+*  modify and redistribute granted by the license, users are provided only
+*  with a limited warranty  and the software's author,  the holder of the
+*  economic rights,  and the successive licensors  have only  limited
+*  liability. 
+*
+*  The fact that you are presently reading this means that you have had
+*  knowledge of the CeCILL-B license and that you accept its terms.
+* ------------------------------------------------------------------------ */                                                                         
+
+
+/* \brief Short description in one line
+ * 
+ * Long description which 
+ * can span multiple lines
+ */
 /**
  * \file 
  * \brief 
@@ -109,12 +124,12 @@ namespace bbtk
 #endif
   }
   
-  void WxGUIBlackBoxList::Insert(BlackBoxDescriptor* d)
+  void WxGUIBlackBoxList::Insert(BlackBoxDescriptor::Pointer d)
   {
     if (GetColumnCount()!=3)
       {
        InsertColumn( 0, _("Package"), 
-                     wxLIST_FORMAT_LEFT, 40  ); 
+                     wxLIST_FORMAT_LEFT, 60  ); 
        InsertColumn( 1, _("Box"), 
                      wxLIST_FORMAT_LEFT, 200 ); 
        InsertColumn( 2, _("Description"), 
@@ -127,8 +142,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 SMART 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()) );
@@ -192,7 +208,7 @@ namespace bbtk
 
   void WxGUIBlackBoxList::LogColEvent(const wxListEvent& event, const wxChar *name)
   {
-    const int col = event.GetColumn();
+    //    const int col = event.GetColumn();
 
     /*
       wxLogMessage(wxT("%s: column %d (width = %d or %d)."),
@@ -228,9 +244,33 @@ namespace bbtk
 
   void WxGUIBlackBoxList::OnBeginDrag(wxListEvent& event)
   {
-    const wxPoint& pt = event.m_pointDrag;
+         std::cout<<"RaC DRAG TABLE"<<std::endl;
+         wxString text(wxT(this->GetItemText(event.GetIndex())));
+         wxListItem info;
+         info.m_itemId = event.m_itemIndex;
+         info.m_col = 0;
+         info.m_mask = wxLIST_MASK_DATA;
+         wxString sendtext(wxT(""));
+         if ( GetItem(info) )
+         {
+                 // TO DO : STORE SMART PTR ?
+                 BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
+                 if (d!=0)
+                 {
+                         sendtext += wxT(d->GetFullTypeName());
+                 }
+         }
+         else
+         {
+                 wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
+         }
+
+       
+         wxTextDataObject tdo(wxT(sendtext));
+         wxDropSource tds(tdo, this);
+         tds.DoDragDrop();
+    //    const wxPoint& pt = event.m_pointDrag;
 
-    int flags;
     //wxLogMessage( wxT("OnBeginDrag at (%d, %d), item %ld."),
     //          pt.x, pt.y, HitTest(pt, flags) );
   }
@@ -312,6 +352,7 @@ namespace bbtk
     info.m_mask = wxLIST_MASK_DATA;
     if ( GetItem(info) )
       {
+       // TO DO : STORE SMART PTR ?
        BlackBoxDescriptor* d = (BlackBoxDescriptor*)(info.GetData());
        if (d!=0) mUser->WxGUIBlackBoxListUserOnSelected(d);
       }
@@ -464,7 +505,8 @@ namespace bbtk
 
     int flags;
     long subitem;
-    long item = HitTest(event.GetPosition(), flags, &subitem);
+    //    long item = 
+    HitTest(event.GetPosition(), flags, &subitem);
 
     wxString where;
     switch ( flags )
@@ -556,12 +598,12 @@ namespace bbtk
   WxGUIBlackBoxInfo::WxGUIBlackBoxInfo(wxWindow* parent)
     :
     wxPanel(parent, -1),
-    mDescriptor(0)
+    mDescriptor()
   {
     wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
     
-    mName = new wxStaticText(this,-1,_T(""));
-    sizer->Add(mName,0,wxGROW);
+    //    mName = new wxStaticText(this,-1,_T(""));
+    //    sizer->Add(mName,0,wxGROW);
     mDescription = new wxStaticText(this,-1,_T(""));
     sizer->Add(mDescription,0,wxGROW);
     mAuthor = new wxStaticText(this,-1,_T(""));
@@ -580,8 +622,8 @@ namespace bbtk
                                | wxSUNKEN_BORDER);
     
     
-    inputs->Add(mInputList,0,wxGROW);
-    sizer->Add(inputs,0,wxGROW);
+    inputs->Add(mInputList,1,wxGROW);
+    sizer->Add(inputs,1,wxGROW);
 
     wxBoxSizer *outputs = 
       new wxStaticBoxSizer
@@ -592,8 +634,8 @@ namespace bbtk
                                 wxLC_REPORT //wxLC_LIST
                                 | wxSUNKEN_BORDER);
     
-    outputs->Add(mOutputList,0,wxGROW);
-    sizer->Add(outputs,0,wxGROW);
+    outputs->Add(mOutputList,1,wxGROW);
+    sizer->Add(outputs,1,wxGROW);
     
     
     SetSizer(sizer);
@@ -606,8 +648,8 @@ namespace bbtk
   //================================================================
   void WxGUIBlackBoxInfo::UpdateInfo(BlackBoxDescriptor* descr)
   {
-    std::cout << "UpdateInfo "<<descr<<std::endl;
-    mName->SetLabel(std2wx(descr->GetTypeName()));
+
+    //    mName->SetLabel(std2wx(descr->GetTypeName()));
     mDescription->SetLabel(std2wx(descr->GetDescription()));
     mAuthor->SetLabel(std2wx(descr->GetAuthor()));
     mCategory->SetLabel(std2wx(descr->GetCategory()));
@@ -617,7 +659,9 @@ namespace bbtk
                               wxLIST_FORMAT_LEFT, 80  ); 
     mInputList->InsertColumn( 1, _("Type"), 
                               wxLIST_FORMAT_LEFT, 100 ); 
-    mInputList->InsertColumn( 2, _("Description"), 
+    mInputList->InsertColumn( 2, _("Nature"), 
+                              wxLIST_FORMAT_LEFT, 100  ); 
+    mInputList->InsertColumn( 3, _("Description"), 
                               wxLIST_FORMAT_LEFT, 500  ); 
 
     mOutputList->ClearAll();
@@ -625,7 +669,9 @@ namespace bbtk
                               wxLIST_FORMAT_LEFT, 80  ); 
     mOutputList->InsertColumn( 1, _("Type"), 
                               wxLIST_FORMAT_LEFT, 100 ); 
-    mOutputList->InsertColumn( 2, _("Description"), 
+    mOutputList->InsertColumn( 2, _("Nature"), 
+                              wxLIST_FORMAT_LEFT, 100  ); 
+    mOutputList->InsertColumn( 3, _("Description"), 
                               wxLIST_FORMAT_LEFT, 500  ); 
     
 
@@ -718,14 +764,15 @@ namespace bbtk
     wxListItem kNewItem;
     kNewItem.SetAlign(wxLIST_FORMAT_LEFT);
     int nID = l->GetItemCount();
-    std::cout << nID << std::endl;
+    //    std::cout << nID << std::endl;
     kNewItem.SetId(nID);
     //    kNewItem.SetMask(wxLIST_MASK_DATA);
     //    kNewItem.SetData(d);  
     l->InsertItem(kNewItem);
     l->SetItem(nID, 0, std2wx(d->GetName()) );
     l->SetItem(nID, 1, std2wx(d->GetTypeName()) );
-    l->SetItem(nID, 2, std2wx(d->GetDescription()) );
+    l->SetItem(nID, 2, std2wx(d->GetNature()) );
+    l->SetItem(nID, 3, std2wx(d->GetDescription()) );
   }
   //================================================================
 
@@ -743,8 +790,12 @@ namespace bbtk
       id_f3,
       id_f4,
       id_f5,
-      id_f6
-
+      id_f6,
+      id_f7,
+      id_f8,
+      id_fc1,
+      id_fc2,
+      id_fc3
     };
 
 
@@ -753,10 +804,11 @@ namespace bbtk
                                              WxGUIPackageBrowser2User* user )
     : wxPanel(parent, -1),
       mUser(user),
-      mInterpreter(0)
+      mInterpreter()
   {
+    m_mgr.SetManagedWindow(this);
 
-    wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+    //    wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
     mBoxList = new WxGUIBlackBoxList(this, LIST_CTRL,
                                     wxDefaultPosition,
                                     wxDefaultSize,
@@ -764,51 +816,134 @@ namespace bbtk
                                     | wxSUNKEN_BORDER);
     mBoxList->SetUser(this);
     mBoxList->SetBackgroundColour(*wxWHITE);
-    sizer->Add(mBoxList,5,wxGROW);
 
-    mBoxInfo = new WxGUIBlackBoxInfo(this);
-    sizer->Add(mBoxInfo,3,wxGROW);
+    m_mgr.AddPane(mBoxList,
+                 wxAuiPaneInfo().Name(wxT("BoxList"))
+                 .Caption(wxT("Black Boxes"))
+                 .MinimizeButton(true)
+                 .MaximizeButton(true)
+                 .Center()
+                 .MinSize(wxSize(100,100))
+                 );     
+    //    sizer->Add(mBoxList,5,wxGROW);
 
+    mBoxInfo = new WxGUIBlackBoxInfo(this);
+    //    sizer->Add(mBoxInfo,3,wxGROW);
+
+    m_mgr.AddPane(mBoxInfo,
+                 wxAuiPaneInfo().Name(wxT("Box"))
+                 .Caption(wxT(""))
+                 .MinimizeButton(true)
+                 .MaximizeButton(true)
+                 .Bottom()
+                 .MinSize(wxSize(100,300))
+                 );     
     
 
-    wxBoxSizer *fsizer = new wxStaticBoxSizer
-      ( new wxStaticBox(this, wxID_ANY, _T("Filters")), wxHORIZONTAL );    
-
-    mPackageFilter = new wxTextCtrl(this,id_f1,_T(""),
+    wxPanel* filters = new wxPanel(this,-1);
+    wxBoxSizer *fsizer = new wxBoxSizer(wxVERTICAL );    
+    wxBoxSizer *fpack = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Package")), wxHORIZONTAL );    
+    mPackageFilter = new wxTextCtrl(filters,id_f1,_T(""),
                                    wxDefaultPosition,
                                    wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
-    fsizer->Add(mPackageFilter,1,wxGROW);
-    mNameFilter = new wxTextCtrl(this,id_f2,_T(""),
+    fpack->Add(mPackageFilter,1,wxGROW);
+    fsizer->Add(fpack,0,wxGROW);
+    wxBoxSizer *fname = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Name")), wxHORIZONTAL );    
+    mNameFilter = new wxTextCtrl(filters,id_f2,_T(""),
                                    wxDefaultPosition,
                                    wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
-    fsizer->Add(mNameFilter,1,wxGROW);
-    mDescriptionFilter = new wxTextCtrl(this,id_f3,_T(""),
+    fname->Add(mNameFilter,1,wxGROW);
+    fsizer->Add(fname,0,wxGROW);
+    wxBoxSizer *fdescr = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Description")), wxHORIZONTAL );
+    mDescriptionFilter = new wxTextCtrl(filters,id_f3,_T(""),
                                    wxDefaultPosition,
                                    wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
-    fsizer->Add(mDescriptionFilter,1,wxGROW);
-    mCategoryFilter = new wxTextCtrl(this,id_f4,_T(""),
+    fdescr->Add(mDescriptionFilter,1,wxGROW);
+    fsizer->Add(fdescr,0,wxGROW);
+    wxBoxSizer *fcat = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Category")), wxHORIZONTAL );    
+    mCategoryFilter = new wxTextCtrl(filters,id_f4,_T(""),
                                    wxDefaultPosition,
                                    wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
-    fsizer->Add(mCategoryFilter,1,wxGROW);
-    mInputTypeFilter = new wxTextCtrl(this,id_f4,_T(""),
+    fcat->Add(mCategoryFilter,1,wxGROW);
+    fsizer->Add(fcat,0,wxGROW);
+    wxBoxSizer *fintype = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Input type")), wxHORIZONTAL );
+    mInputTypeFilter = new wxTextCtrl(filters,id_f5,_T(""),
                                    wxDefaultPosition,
                                    wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
-    fsizer->Add(mInputTypeFilter,1,wxGROW);
-    mOutputTypeFilter = new wxTextCtrl(this,id_f4,_T(""),
+    fintype->Add(mInputTypeFilter,1,wxGROW);
+    fsizer->Add(fintype,0,wxGROW);
+    wxBoxSizer *fouttype = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Output type")), wxHORIZONTAL );
+    mOutputTypeFilter = new wxTextCtrl(filters,id_f6,_T(""),
                                    wxDefaultPosition,
                                    wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
-    fsizer->Add(mOutputTypeFilter,1,wxGROW);
+    fouttype->Add(mOutputTypeFilter,1,wxGROW);
+    fsizer->Add(fouttype,0,wxGROW);
+    wxBoxSizer *finnat = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY, _T("Input nature")),wxHORIZONTAL ); 
+    mInputNatureFilter = new wxTextCtrl(filters,id_f7,_T(""),
+                                       wxDefaultPosition,
+                                       wxDefaultSize,
+                                       wxTE_PROCESS_ENTER);
+    finnat->Add(mInputNatureFilter,1,wxGROW);
+    fsizer->Add(finnat,0,wxGROW);
+    wxBoxSizer *foutnat = 
+      new wxStaticBoxSizer
+      ( new wxStaticBox(filters, wxID_ANY,_T("Output nature")),wxHORIZONTAL ); 
+    mOutputNatureFilter = new wxTextCtrl(filters,id_f8,_T(""),
+                                       wxDefaultPosition,
+                                       wxDefaultSize,
+                                       wxTE_PROCESS_ENTER);
+    foutnat->Add(mOutputNatureFilter,1,wxGROW);
+    fsizer->Add(foutnat,0,wxGROW);
+
+
+    mShowWidgetsFilter = new wxCheckBox(filters,id_fc1,_T("Show widgets"));
+    mShowWidgetsFilter->SetValue(true);
+    fsizer->Add(mShowWidgetsFilter,0,wxGROW);
+
+    mShowAdaptorsFilter = new wxCheckBox(filters,id_fc2,_T("Show adaptors"));
+    mShowAdaptorsFilter->SetValue(false);
+    fsizer->Add(mShowAdaptorsFilter,0,wxGROW);
+
+    mShowGUIsFilter = new wxCheckBox(filters,id_fc3,_T("Show GUIs"));
+    mShowGUIsFilter->SetValue(false);
+    fsizer->Add(mShowGUIsFilter,0,wxGROW);
+
+    filters->SetSizer(fsizer);
+
+    m_mgr.AddPane(filters,
+                 wxAuiPaneInfo().Name(wxT("Filter"))
+                 .Caption(wxT("Filter"))
+                 .MinimizeButton(true)
+                 .MaximizeButton(true)
+                 .Right()
+                 .MinSize(wxSize(100,100)) );
 
     
-    sizer->Add(fsizer,1,wxGROW);
 
-    SetSizer(sizer);
+    //    sizer->Add(fsizer,1,wxGROW);
+    m_mgr.Update();
+
+    //    SetSizer(sizer);
     SetAutoLayout(true);
     Layout();
     
@@ -824,40 +959,62 @@ namespace bbtk
 
   //================================================================
   // User callback when a box is selected in the list 
-  void WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected( BlackBoxDescriptor* d)
+  void WxGUIPackageBrowser2::WxGUIBlackBoxListUserOnSelected
+  ( BlackBoxDescriptor* d)
   {
+       //RaC
+       _actualSelected=d;
+
     mBoxInfo->UpdateInfo(d);
+    std::string title = d->GetPackage()->GetName()+"::"+d->GetTypeName();
+    m_mgr.GetPane(mBoxInfo).Caption(std2wx(title));
+    m_mgr.Update();
   }
   
+  //================================================================
+
+  //================================================================
+  BlackBoxDescriptor* WxGUIPackageBrowser2::GetActualSelected()
+  {
+         return _actualSelected;
+  }
+
+
   //================================================================
 
   //================================================================
   WxGUIPackageBrowser2::~WxGUIPackageBrowser2()
   {
-    std::cout << "del interpreter" << std::endl;
-    if (mInterpreter) delete mInterpreter;
-    std::cout << "ok" << std::endl;
+    mFactory.reset();
+    mInterpreter.reset();
+    //    Object::PrintObjectListInfo("");
+    m_mgr.UnInit();
   }
   //================================================================
 
   //================================================================
   void WxGUIPackageBrowser2::IncludeAll()
   {
-    if (!mInterpreter) mInterpreter = new bbtk::Interpreter();
+    if (!mInterpreter) mInterpreter =bbtk::Interpreter::New();
     mInterpreter->SetCommandLine(true);
-    mInterpreter->InterpretLine("include *");
+    std::stringstream* buf = new std::stringstream;
+    *buf << "exec freeze_no_error" << std::endl;
+    *buf << "message max 0" << std::endl; 
+    *buf << "include *" << std::endl;
+    mInterpreter->InterpretBuffer(buf);
 
-    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();
   }  
+
   //================================================================
 
   //================================================================
@@ -870,12 +1027,12 @@ 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;
-       for (j=P->GetBlackBoxMap().begin();
-            j!=P->GetBlackBoxMap().end();
+       Package::DescriptorMapType::iterator j;
+       for (j=P->GetDescriptorMap().begin();
+            j!=P->GetDescriptorMap().end();
             ++j)
          {
            //      std::cout << "Insert "<<j->second->GetTypeName()<<std::endl;
@@ -888,10 +1045,18 @@ 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;
+    if ((!mShowAdaptorsFilter->IsChecked())&&
+       ((d->GetKind()==BlackBoxDescriptor::ADAPTOR)||
+        (d->GetKind()==BlackBoxDescriptor::DEFAULT_ADAPTOR)))
+      return false;
+    if ((!mShowGUIsFilter->IsChecked())&&
+       ((d->GetKind()==BlackBoxDescriptor::GUI)||
+        (d->GetKind()==BlackBoxDescriptor::DEFAULT_GUI)))
+      return false;
     if (d->GetPackage()->GetName().find( wx2std(mPackageFilter->GetValue()) ) 
        == std::string::npos ) return false;
    if (d->GetTypeName().find( wx2std(mNameFilter->GetValue()) ) 
@@ -900,6 +1065,22 @@ namespace bbtk
        == std::string::npos ) return false;
    if (d->GetCategory().find( wx2std(mCategoryFilter->GetValue()) ) 
        == std::string::npos ) return false;
+   if (!mShowWidgetsFilter->IsChecked())
+     {
+       bool found = false;
+       const BlackBoxDescriptor::OutputDescriptorMapType& imap = 
+        d->GetOutputDescriptorMap();
+       BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in;
+       for ( in = imap.begin();  in != imap.end(); ++in ) 
+        {
+          if (in->second->GetName() == "Widget" )
+            {
+              found = true;
+              break;
+            }
+        }
+       if (found) return false;
+     }
    if (mInputTypeFilter->GetValue().size()>0)
      {
        std::string s = wx2std(mInputTypeFilter->GetValue());
@@ -934,7 +1115,40 @@ namespace bbtk
         }
        if (!found) return false;
      }
-
+   if (mInputNatureFilter->GetValue().size()>0)
+     {
+       std::string s = wx2std(mInputNatureFilter->GetValue());
+       bool found = false;
+       const BlackBoxDescriptor::InputDescriptorMapType& imap = 
+        d->GetInputDescriptorMap();
+       BlackBoxDescriptor::InputDescriptorMapType::const_iterator in;
+       for ( in = imap.begin();  in != imap.end(); ++in ) 
+        {
+          if (in->second->GetNature().find(s)!=std::string::npos)
+            {
+              found = true;
+              break;
+            }
+        }
+       if (!found) return false;
+     }
+   if (mOutputNatureFilter->GetValue().size()>0)
+     {
+       std::string s = wx2std(mOutputNatureFilter->GetValue());
+       bool found = false;
+       const BlackBoxDescriptor::OutputDescriptorMapType& imap = 
+        d->GetOutputDescriptorMap();
+       BlackBoxDescriptor::OutputDescriptorMapType::const_iterator in;
+       for ( in = imap.begin();  in != imap.end(); ++in ) 
+        {
+          if (in->second->GetNature().find(s)!=std::string::npos)
+            {
+              found = true;
+              break;
+            }
+        }
+       if (!found) return false;
+     }
 
     return true;
   }
@@ -948,6 +1162,11 @@ namespace bbtk
     EVT_TEXT_ENTER(id_f4, WxGUIPackageBrowser2::OnFilter )
     EVT_TEXT_ENTER(id_f5, WxGUIPackageBrowser2::OnFilter )
     EVT_TEXT_ENTER(id_f6, WxGUIPackageBrowser2::OnFilter )
+    EVT_TEXT_ENTER(id_f7, WxGUIPackageBrowser2::OnFilter )
+    EVT_TEXT_ENTER(id_f8, WxGUIPackageBrowser2::OnFilter )
+    EVT_CHECKBOX(  id_fc1, WxGUIPackageBrowser2::OnFilter )
+    EVT_CHECKBOX(  id_fc2, WxGUIPackageBrowser2::OnFilter )
+    EVT_CHECKBOX(  id_fc3, WxGUIPackageBrowser2::OnFilter )
     END_EVENT_TABLE()
   //========================================================================
 
@@ -972,12 +1191,11 @@ namespace bbtk
     
     SetSizer(sizer);
 
-    // Creates and sets the parent window of all bbtk windows
-    wxWindow* top = new wxPanel(this,-1);
-    top->Hide();
-    
-    Wx::SetTopWindow(top);
-   
+     // Creates the parent window of all bbtk windows as a child of this
+//    Wx::CreateTopWindow(this);
+    // Add the method OnWxSignal as a Wx::Signal observer 
+    //bbtkAddWxSignalObserver(WxGUIPackageBrowser2Window::OnWxSignal);
     SetAutoLayout(true);
     Layout();
   }