]> Creatis software - bbtk.git/commitdiff
Input Proportion works !!!
authorguigues <guigues>
Tue, 14 Oct 2008 10:11:15 +0000 (10:11 +0000)
committerguigues <guigues>
Tue, 14 Oct 2008 10:11:15 +0000 (10:11 +0000)
packages/wx/src/bbwxLayoutSplit.cxx

index efec39bcf5bcfce1cb4120b08d1c33b9ae86c51f..1b47777ba05a634c88715e41084357523f312c66 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbwxLayoutSplit.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/06/19 09:46:46 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2008/10/14 10:11:15 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -54,7 +54,7 @@ namespace bbwx
                                               //wxSize(400,200),
                                               wxSP_3D |
                                               wxSP_LIVE_UPDATE );
-       w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
+    w->SetName( bbtk::std2wx( bbGetInputWinTitle() ) );
     wxWindow* w1 = bbGetInputWidget1();
     wxWindow* w2 = bbGetInputWidget2();
 
@@ -63,12 +63,12 @@ namespace bbwx
     w1->Reparent(w);
     w2->Reparent(w);
     int orientation=0;
-       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
-       if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)    { orientation=1; }
-
-       if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
-       else                { w->SplitVertically( w1, w2, 100);   }
-
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"0|H|HORIZONTAL")==true)  { orientation=0; }
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),"1|V|VERTICAL")==true)       { orientation=1; }
+    
+    if (orientation==1) { w->SplitHorizontally( w1, w2, 100); }
+    else                { w->SplitVertically( w1, w2, 100);   }
+    
     bbSetOutputWidget( w );
   }
 
@@ -77,8 +77,23 @@ namespace bbwx
   // when window is shown
   void  LayoutSplit::bbUserOnShow()
   {
-         bbUserOnShowWidget("Widget1");
-         bbUserOnShowWidget("Widget2");
+    wxSplitterWindow* win = (wxSplitterWindow*)bbGetOutputWidget();
+    int w,h;
+    win->GetClientSize(&w,&h);
+    int pos = 100;
+    if (bbtk::Utilities::loosematch(bbGetInputOrientation(),
+                                   "0|H|HORIZONTAL")==true)  
+      { 
+       pos = (int)(w * bbGetInputProportion() * 0.01);
+      }
+    else 
+      {
+       pos = (int)(h * bbGetInputProportion() * 0.01);
+      } 
+  
+    win->SetSashPosition(pos,true);
+    bbUserOnShowWidget("Widget1");
+    bbUserOnShowWidget("Widget2");
   }