From a0fdabc807eaac249378e987c65d7ff0b865b969 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Sat, 16 Oct 2004 23:05:05 +0000 Subject: [PATCH] Kevin's changes also affected the ScrollBar prefs. Fixed build. *sigh* git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9384 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/prefs/scrollbar/ScrollBarView.cpp | 57 +++++++++++++++------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/src/prefs/scrollbar/ScrollBarView.cpp b/src/prefs/scrollbar/ScrollBarView.cpp index c1dcbe0c76..8bd7debd3b 100644 --- a/src/prefs/scrollbar/ScrollBarView.cpp +++ b/src/prefs/scrollbar/ScrollBarView.cpp @@ -2,12 +2,7 @@ #include "messages.h" // our own homegrown private cheat function for controlling scrollbars -status_t control_scrollbar(int8 command, void *data, BScrollBar *sb); - -// Magic numbers for control_scrollbar() -#define CONTROL_SET_DOUBLE 1 -#define CONTROL_SET_PROPORTIONAL 2 -#define CONTROL_SET_STYLE 3 +status_t control_scrollbar(scroll_bar_info *info, BScrollBar *sb); ScrollBarView::ScrollBarView(void) : BView(BRect(0,0,348,280),"scrollbarview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW) @@ -18,25 +13,35 @@ ScrollBarView::ScrollBarView(void) arrowstyleBox->SetLabel( "Arrow Style" ); float doubleWidth = StringWidth("Double:"); + int32 tempint; bool tempbool; - int8 tempint; + scroll_bar_info sbi; + + // We're going to need the basics here + get_scroll_bar_info(&sbi); + + // save this for later use + tempbool=sbi.double_arrows; doubleStringView = new BStringView( BRect(25,20,25+doubleWidth,38), "doubleStringView", "Double:"); sbdouble=new BScrollBar(BRect(12,38,145,58),"doublearrowsbar",NULL,0,100,B_HORIZONTAL); arrowstyleBox->AddChild( sbdouble ); - tempbool=true; - control_scrollbar(CONTROL_SET_DOUBLE,&tempbool,sbdouble); + sbi.double_arrows=true; + control_scrollbar(&sbi,sbdouble); float singleWidth = StringWidth("Single:"); singleStringView = new BStringView( BRect(25,60,25+singleWidth,87), "singleStringView", "Single:"); sbsingle=new BScrollBar(BRect(12,82,145,102),"singlearrowsbar",NULL,0,100,B_HORIZONTAL); arrowstyleBox->AddChild( sbsingle ); - - tempbool=false; - control_scrollbar(CONTROL_SET_DOUBLE,&tempbool,sbsingle); - - + + sbi.double_arrows=false; + control_scrollbar(&sbi,sbsingle); + + // Restore the original value so we don't screw up the other ones + sbi.double_arrows=tempbool; + + tempbool=sbi.proportional; knobtypeBox = new BBox( BRect( 180, 7, 338, 119) ); knobtypeBox->SetLabel( "Knob Type" ); @@ -46,38 +51,40 @@ ScrollBarView::ScrollBarView(void) sbproportional=new BScrollBar(BRect(12,38,145,58),"proportionalbar",NULL,0,100,B_HORIZONTAL); knobtypeBox->AddChild( sbproportional ); - tempbool=true; - control_scrollbar(CONTROL_SET_PROPORTIONAL, &tempbool,sbdouble); + sbi.proportional=true; + control_scrollbar(&sbi,sbproportional); float fixedWidth = StringWidth("Fixed"); fixedStringView = new BStringView( BRect(193,60,193+fixedWidth,87), "fixedStringView", "Fixed" ); sbfixed=new BScrollBar(BRect(12,87,145,105),"fixedbar",NULL,0,100,B_HORIZONTAL); knobtypeBox->AddChild( sbfixed ); - tempbool=false; - control_scrollbar(CONTROL_SET_PROPORTIONAL,&tempbool,sbfixed); + sbi.proportional=false; + control_scrollbar(&sbi,sbfixed); minknobsizeBox = new BBox( BRect( 12, 123, 169, 232) ); minknobsizeBox->SetLabel( "Minimum Knob Size" ); + sbi.proportional=tempbool; + knobstyleBox = new BBox( BRect( 180, 123, 338, 232) ); knobstyleBox->SetLabel( "Knob Style" ); + tempint=sbi.knob; sbflat=new BScrollBar(BRect(12,22,145,42),"flatbar",NULL,0,100,B_HORIZONTAL); knobstyleBox->AddChild( sbflat ); - tempint=0; - control_scrollbar(CONTROL_SET_STYLE,&tempbool,sbflat); + sbi.knob=0; + control_scrollbar(&sbi,sbflat); sbdots=new BScrollBar(BRect(12,52,145,72),"dotbar",NULL,0,100,B_HORIZONTAL); knobstyleBox->AddChild( sbdots ); - tempint=1; - control_scrollbar(CONTROL_SET_STYLE,&tempbool,sbdots); + sbi.knob=1; + control_scrollbar(&sbi,sbdots); sblines=new BScrollBar(BRect(12,82,145,102),"linebar",NULL,0,100,B_HORIZONTAL); knobstyleBox->AddChild( sblines ); - tempint=2; - control_scrollbar(CONTROL_SET_STYLE,&tempbool,sblines); - + sbi.knob=2; + control_scrollbar(&sbi,sblines); defaultsButton = new BButton( BRect( 10, 242, 85, 265), "defaultsButton", "Defaults", NULL );