From 959168b073dd40fc1520c3a1125b42927ed8c8eb Mon Sep 17 00:00:00 2001 From: guigues Date: Tue, 14 Oct 2008 10:11:15 +0000 Subject: [PATCH] Input Proportion works !!! --- packages/wx/src/bbwxLayoutSplit.cxx | 37 ++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/packages/wx/src/bbwxLayoutSplit.cxx b/packages/wx/src/bbwxLayoutSplit.cxx index efec39b..1b47777 100644 --- a/packages/wx/src/bbwxLayoutSplit.cxx +++ b/packages/wx/src/bbwxLayoutSplit.cxx @@ -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"); } -- 2.45.1