]> Creatis software - bbtk.git/commitdiff
Fix a big bug. Consider the script :
authorguigues <guigues>
Thu, 6 Mar 2008 09:23:43 +0000 (09:23 +0000)
committerguigues <guigues>
Thu, 6 Mar 2008 09:23:43 +0000 (09:23 +0000)
 new slider s
 new LayoutLine l
 connect s.Widget l.Widget1
 exec s
Before bug fix, created the slider in bbi Console !!!
(note that 'exec l' instead of 'exec s' worked fine)

Cause :
When a WxBlackBox is 'included' into another (output 'Widget' connected) it does not create its own window (frame) but is inserted into the frame of the box to which it is connected.
The wxWindows are all created with parent the wx top frame (bbGetWxParent) which is bbi's Console and are reparented after to be placed in the right frame (own or container)).
Hence when 'l' was executed it was created in bbi's console (normal) but as 's' was not executed it did not created its frame and did not reparented l's window.

Fix : executing a WxBlackBox whose output 'Widget' is connected must produce the execution of the box to which it is connected (remark that it works recursively). Hence overloaded bbExecute in WxBlackBox to do the job.

kernel/src/bbtkWxBlackBox.cxx
kernel/src/bbtkWxBlackBox.h

index 1cea747459170fe233e9acec99b57b89f49ce3f1..06ec96786de00233ec26424bfb22e6ce7055455e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/02/08 10:05:38 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/03/06 09:23:43 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -75,6 +75,7 @@ namespace bbtk
   }
   //========================================================================= 
 
+
   //=========================================================================
   void WxBlackBoxWindow::bbShow()
   {
@@ -486,6 +487,41 @@ namespace bbtk
   }
   //=========================================================================
 
+  //=========================================================================
+  /// Main processing method of the box.
+  void WxBlackBox::bbExecute(bool force)
+  {
+    bbtkDebugMessageInc("Process",1,
+                       "=> WxBlackBox::bbExecute() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+
+    // If the output 'Widget' is connected then 
+    // we must execute the parent box
+    BlackBox::OutputConnectorMapType::const_iterator i 
+      = bbGetOutputConnectorMap().find("Widget");
+
+    if ( i->second->GetConnectionVector().size() != 0 ) 
+      {
+       bbtkDebugMessage("Process",2,
+                        "-> Output 'Widget' connected : transfering execution to parent"
+                        <<std::endl);
+       
+       i->second->GetConnectionVector().front()
+         ->GetBlackBoxTo()->bbExecute(force);
+
+      }
+    // else call 'standard' BlackBox execution method
+    else 
+      {
+       BlackBox::bbExecute(force);
+      }
+    //
+
+    bbtkDebugMessageDec("Process",1,
+                       "<= WxBlackBox::bbExecute() ["
+                       <<bbGetFullName()<<"]"<<std::endl);
+  }
+  //=========================================================================
 
 
   //==================================================================
index e0418a101c308dd92639adb203c58fa14b8955af..b7a3eab5bd44307d07818496ce838692c397af10 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkWxBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/02/08 10:05:38 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/03/06 09:23:43 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -145,6 +145,9 @@ namespace bbtk
 
     void bbInitAttributes();
 
+  protected :
+    /// Main processing method of the box. Overloaded to handle windows inclusion : if the output Widget is connected then the execution is transfered to the box to which it is connected (the container window must be created and displayed - this box will be also executed by the normal pipeline recursion mechanism)
+    virtual void bbExecute(bool force = false);
 
   };
   //=================================================================