]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Tue, 22 Jan 2008 15:41:34 +0000 (15:41 +0000)
committerguigues <guigues>
Tue, 22 Jan 2008 15:41:34 +0000 (15:41 +0000)
kernel/src/bbtkUserBlackBox.h
kernel/src/bbtkUserBlackBoxMacros.h
kernel/src/bbtkWxBlackBox.cxx
kernel/src/bbtkWxBlackBox.h
packages/wx/src/bbwxSlider.cxx
packages/wx/src/bbwxSlider.h
packages/wx/src/bbwxSplit.cxx
packages/wx/src/bbwxSplit.h

index a716cc6681a8a8a7ff7b66e40658e47f8b13561b..900fc082574bee1ad654dbdd27464c8a95affcd9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkUserBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:34 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -83,31 +83,26 @@ namespace bbtk
     /// First checks that re-processing is needed (either Status==MODIFIED or InputProcessMode==Always)
     /// then : 
     /// - updates its inputs by calling bbUpdateInputs (which recursively calls bbBackwardUpdate on amont boxes)
-    /// - calls bbCreateWidget
-    /// - calls bbProcess which is the user callback which does the actual processing
-    /// - calls bbUpdateChildren
-    /// - calls bbShowWidget which shows the widget associated to the box (if any)
+    /// - calls bbProcess which here simply calls the user callback bbUserProcess which does the actual processing. 
+    ///    bbProcess is overloaded in WxBlackBox to handle widget creation and show
     IOStatus bbBackwardUpdate(Connection* caller);
     //==================================================================
 
     //==================================================================
-    /// Recursive pipeline processing in forward direction along "Child"-"Parent" connections
-    /// 
-    /// First checks that re-processing is needed (either Status==MODIFIED or InputProcessMode==Always)
-    /// then : 
-    /// - calls bbCreateWidget
-    /// - calls bbProcess which is the user callback which does the actual processing
-    /// - calls bbUpdateChildren which recursively calls bbForwardUpdate on connections attached the "Child" output
-    // void bbForwardUpdate(Connection* caller);
-    //==================================================================
   protected:
+    //==================================================================
+    /// Calls the user defined processing method.
+    /// Overloaded in WxBlackBox to handle widget creation and show
+    virtual void bbProcess() { this->bbUserProcess(); }
+    //==================================================================
+
     //==================================================================
     /// User callback which computes the outputs as a function of the inputs. 
     /// It is assumed to be deterministic and thus is only called is the inputs have changed 
     /// (i.e. if the black box is marked as modified)
-    virtual void bbProcess() 
+    virtual void bbUserProcess() 
     {
-      bbtkWarning("UserBlackBox::bbProcess() not overloaded for box '"
+      bbtkWarning("UserBlackBox::bbUserProcess() not overloaded for box '"
                  <<bbGetFullName()
                  <<"' : the box does nothing. Is it a bug or a feature ?"
                  <<std::endl);
index fb09f342dc526c338928ec85a190485c0134471f..f7d145cad09abf7aa6cac4a2aece96a8139fdbba 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkUserBlackBoxMacros.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:34 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 
 //============================================================================
-/// Defines the bbProcess method
+/// Defines the bbUserProcess method
 #define BBTK_PROCESS(CALLBACK)                                         \
   public:                                                              \
-  inline void bbProcess()                                              \
+  inline void bbUserProcess()                                          \
   {                                                                    \
-    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbProcess() [" \
+    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserProcess() [" \
                        <<bbGetFullName()<<"]"<<std::endl);             \
     CALLBACK();                                                                \
-    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbProcess() [" \
+    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserProcess() [" \
                        <<bbGetFullName()<<"]"<<std::endl);             \
   }
 //============================================================================
index 66cdb786bb885c7173b69458e05b9a7dc1d69228..431f89137af86431810dd3e1a8e84656f8e9e7ec 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:34 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -544,7 +544,7 @@ namespace bbtk
   /// Specific methods for window creation during pipeline execution
   /// Shows the window associated to the box 
   /// (called after bbProcess during bbExecute)
-  void WxBlackBox::bbShowWindow(Connection* caller)
+  void WxBlackBox::bbShowWindow()
   {
     bbtkDebugMessageInc("Process",1,"=> WxBlackBox::bbShowWindow() ["
                        <<bbGetFullName()<<"]"<<std::endl);
index 5ff5d6644b4d350503e8d448b48d1ff2b014fce3..d074414dea09017946f65e00c0a89d94e0d3cc37 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:34 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -70,7 +70,6 @@ namespace bbtk
     BBTK_DECLARE_INPUT(WinDialog,bool);
     BBTK_DECLARE_INPUT(WinHide,Void);
     BBTK_DECLARE_OUTPUT(Widget, wxWindow*);//WxBlackBoxWidget*);
-    BBTK_PROCESS(Process);
 
   public:
     typedef WxBlackBoxWindow Window;
@@ -116,42 +115,32 @@ namespace bbtk
     virtual void bbUserDestructor();
     //==================================================================    
 
-    /*
-
-    //==================================================================    
-    /// User callback for creating the window associated to the box
-    /// Can be overloaded in order to impose your own window to show,
-    /// Typically if your widget is already a dialog that cannot 
-    /// be inserted into a parent.
-    /// WARNING : If you use it then your widget will not be inserted 
-    /// in the parent window, if any 
-    /// (i.e. even if the Parent-Child connection is set)
-    virtual Window* bbUserCreateWindow()
-    {
-      return 0;
-    }
-    //==================================================================    
-
     //==================================================================    
     /// User callback for creating the widget associated to the box
-    /// Must be defined if bbUserCreateWindow is not 
-    virtual Widget* bbUserCreateWidget(wxWindow *parent
+    /// ** Must be defined **
+    virtual void bbUserCreateWidget(
     {
-      bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWindow and bbUserCreateWidget methods are both undefined : cannot work !!");
-      return 0;
+      bbtkError(bbGetTypeName()<<" is a WxBlackBox whose bbUserCreateWidget methods is undefined : cannot work !!");
     }
     //==================================================================    
-    */
+    
+    //==================================================================
+    /// Calls the user defined widget creation method 
+    /// and the user processing method and then displays the window
+    virtual void bbProcess() 
+    { 
+      if (bbGetOutputWidget()==0) this->bbUserCreateWidget();
+      this->bbUserProcess(); 
+      bbShowWindow();
+    }
+    //==================================================================
 
     //==================================================================
     /// Specific methods for windows creation during pipeline execution
-    //void bbCreateWindow();
-    void bbShowWindow(Connection* caller);
+    void bbShowWindow();
     void bbHideWindow();
     //==================================================================
 
-    void Process() { } 
-
   private:
     /// friendship
     friend class WxBlackBoxWindow;
@@ -181,6 +170,21 @@ namespace bbtk
   //=================================================================
  
 
+  //======================================================================
+  /// Defines the bbUserCreateWidget method
+#define BBTK_CREATE_WIDGET(CALLBACK)                                   \
+  public:                                                              \
+  inline void bbUserCreateWidget()                                     \
+  {                                                                    \
+    bbtkDebugMessageInc("Process",1,"=> "<<bbGetTypeName()<<"::bbUserCreateWidget() [" \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+    CALLBACK();                                                                \
+    bbtkDebugMessageDec("Process",1,"<= "<<bbGetTypeName()<<"::bbUserCreateWidget() [" \
+                       <<bbGetFullName()<<"]"<<std::endl);             \
+  }
+  
+  //======================================================================
+
   //=================================================================
   // UserBlackBox description
   BBTK_BEGIN_DESCRIBE_BLACK_BOX(WxBlackBox,bbtk::UserBlackBox);
index 557e7b2a7459bfde9625f5d45f8898576339f76d..7039139bfb0be22fedd0688e1708f4ae6b35a071 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSlider.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:35 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -354,25 +354,25 @@ namespace bbwx
   //--------------------------------------------------------------------------
   void Slider::Process() 
   {
-    int val = bbGetInputIn();
     bbSetOutputOut( bbGetInputIn() );
+  }
 
-    if (bbGetOutputWidget()==0) 
-      {
-       bbSetOutputWidget( new SliderWidget(this, 
-                                           bbGetWxParent(),
-                                           bbGetInputOrientation() , 
-                                           bbGetInputChangeResolution(), 
-                                           bbGetInputLabel(), 
-                                           bbtk::std2wx( bbGetInputTitle() ),
-                                           bbGetInputMin(), 
-                                           bbGetInputMax(),
-                                           val,
-                                           bbGetInputReactiveOnTrack()
-                                           )
-                          );
-      }
+  void Slider::CreateWidget()
+  {
+    bbSetOutputWidget( new SliderWidget(this, 
+                                       bbGetWxParent(),
+                                       bbGetInputOrientation() , 
+                                       bbGetInputChangeResolution(), 
+                                       bbGetInputLabel(), 
+                                       bbtk::std2wx( bbGetInputTitle() ),
+                                       bbGetInputMin(), 
+                                       bbGetInputMax(),
+                                       bbGetInputIn(),
+                                       bbGetInputReactiveOnTrack()
+                                       )
+                      );
   }
+  
   //--------------------------------------------------------------------------  
   /*
   //--------------------------------------------------------------------------
index a0a090f331a69e49cffaf4ccbff11a0abc358e89..ba98ec889b03e8ac5c19011def308357b57e2622 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSlider.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:35 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -135,13 +135,12 @@ namespace bbwx
     BBTK_DECLARE_INPUT(ReactiveOnTrack,int);    
     BBTK_DECLARE_OUTPUT(Out,int);
     BBTK_PROCESS(Process);
+    BBTK_CREATE_WIDGET(CreateWidget);
     void Process();
+    void CreateWidget();
 
   protected:
     virtual void bbUserConstructor();
-    
-    //  private:
-    //  virtual bbtk::WxBlackBoxWidget* bbUserCreateWidget(wxWindow *parent);
   };
   //=================================================================
  
index ed661342d0940d49375858e223ba8623b7b180b2..7386ef3eca6c4098961f2293f1ec5fbfeed5c12e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:35 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -110,34 +110,31 @@ namespace bbwx
 
   void Split::Process() 
   { 
-    bbtkDebugMessageInc("Core",9,"Split::Process()"<<std::endl);
+  }
 
-    if (bbGetOutputWidget()==0) 
-      {
-       
-       
-       wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
-                                                  -1,
-                                                  wxDefaultPosition,
-                                                  wxDefaultSize, 
-                                                  //wxSize(400,200),
-                                                  wxSP_3D | 
-                                                  wxSP_LIVE_UPDATE );
-       wxWindow* w1 = bbGetInputWidget1();
-       wxWindow* w2 = bbGetInputWidget2();
-       //w->SetInitialSize(wxSize(100,100));
-       //    int sz =  (int)(GetParent()->GetSize().GetHeight() * prop * 0.01);
-       w1->Reparent(w);
-       w2->Reparent(w);
-       w->SplitHorizontally( w1, w2, 100);
-       //w->SetMinimumPaneSize(100);
-       // w->SetAutoLayout(true);
-       // w->Fit();
-       // w->Layout();
-       
-
-       bbSetOutputWidget( w );
-      }
+  void Split::CreateWidget() 
+  { 
+    wxSplitterWindow* w = new wxSplitterWindow(bbGetWxParent(),
+                                              -1,
+                                              wxDefaultPosition,
+                                              wxDefaultSize, 
+                                              //wxSize(400,200),
+                                              wxSP_3D | 
+                                              wxSP_LIVE_UPDATE );
+    wxWindow* w1 = bbGetInputWidget1();
+    wxWindow* w2 = bbGetInputWidget2();
+    //w->SetInitialSize(wxSize(100,100));
+    //    int sz =  (int)(GetParent()->GetSize().GetHeight() * prop * 0.01);
+    w1->Reparent(w);
+    w2->Reparent(w);
+    w->SplitHorizontally( w1, w2, 100);
+    //w->SetMinimumPaneSize(100);
+    // w->SetAutoLayout(true);
+    // w->Fit();
+    // w->Layout();
+    
+    
+    bbSetOutputWidget( w );
   }
   
   
index ded5330b5a82f3b4255e2835c74c5ff943c3136b..ba7744fb0aee61ce87c52cb072f2c82ad1c39f85 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxSplit.h,v $
   Language:  C++
-  Date:      $Date: 2008/01/22 15:02:00 $
-  Version:   $Revision: 1.1 $
+  Date:      $Date: 2008/01/22 15:41:35 $
+  Version:   $Revision: 1.2 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -86,10 +86,10 @@ namespace bbwx
     BBTK_DECLARE_INPUT(Orientation,int);
     BBTK_DECLARE_INPUT(Proportion,int);
     BBTK_PROCESS(Process);
-    // BBTK_CREATE_WIDGET(CreateWidget);
+    BBTK_CREATE_WIDGET(CreateWidget);
     
     void Process();
-    //    void CreateWidget();
+    void CreateWidget();
 
   protected:
     virtual void bbUserConstructor();