From 9b2a90368819a01ff91c6acaef71da34f60d1cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 21 Apr 2006 22:46:21 +0000 Subject: [PATCH] Fixed bug #522 by removing the ScrollBar preferences application - you'll just have to live with the default settings (which hopefully have *two* arrows per side, though, won't they, Stephan? :-)) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17199 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 3 +- src/preferences/Jamfile | 1 - src/preferences/scrollbar/Jamfile | 12 - src/preferences/scrollbar/ScrollBar.rdef | 84 ---- src/preferences/scrollbar/ScrollBarApp.cpp | 57 --- src/preferences/scrollbar/ScrollBarApp.h | 49 -- src/preferences/scrollbar/ScrollBarView.cpp | 385 --------------- src/preferences/scrollbar/ScrollBarView.h | 67 --- src/preferences/scrollbar/ScrollBarWindow.cpp | 57 --- src/preferences/scrollbar/ScrollBarWindow.h | 43 -- src/preferences/scrollbar/fakescrollbar.cpp | 450 ------------------ src/preferences/scrollbar/fakescrollbar.h | 86 ---- .../scrollbar/knobsizeadjuster.cpp | 175 ------- src/preferences/scrollbar/knobsizeadjuster.h | 58 --- src/preferences/scrollbar/messages.h | 49 -- 15 files changed, 1 insertion(+), 1575 deletions(-) delete mode 100644 src/preferences/scrollbar/Jamfile delete mode 100644 src/preferences/scrollbar/ScrollBar.rdef delete mode 100644 src/preferences/scrollbar/ScrollBarApp.cpp delete mode 100644 src/preferences/scrollbar/ScrollBarApp.h delete mode 100644 src/preferences/scrollbar/ScrollBarView.cpp delete mode 100644 src/preferences/scrollbar/ScrollBarView.h delete mode 100644 src/preferences/scrollbar/ScrollBarWindow.cpp delete mode 100644 src/preferences/scrollbar/ScrollBarWindow.h delete mode 100644 src/preferences/scrollbar/fakescrollbar.cpp delete mode 100644 src/preferences/scrollbar/fakescrollbar.h delete mode 100644 src/preferences/scrollbar/knobsizeadjuster.cpp delete mode 100644 src/preferences/scrollbar/knobsizeadjuster.h delete mode 100644 src/preferences/scrollbar/messages.h diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index dc93f9a21f..5c2ef23443 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -32,8 +32,7 @@ BEOS_APPS = Terminal Expander People ShowImage Clock Pulse StyledEdit Chart Workspaces Cortex CortexAddOnHost GLTeapot ; BEOS_PREFERENCES = Backgrounds DataTranslations FileTypes Fonts Media Menu - Mouse Keyboard Keymap Screen ScrollBar Sounds Time VirtualMemory - ScreenSaver + Mouse Keyboard Keymap Screen ScreenSaver Sounds Time VirtualMemory ; BEOS_SYSTEM_LIB = libbe.so $(HAIKU_LIBSTDC++) libnet.so libmedia.so libtracker.so libtranslation.so libnetwork.so libbind.so libnetapi.so libsocket.so libdebug.so diff --git a/src/preferences/Jamfile b/src/preferences/Jamfile index 497929fdb0..c160518b7e 100644 --- a/src/preferences/Jamfile +++ b/src/preferences/Jamfile @@ -18,7 +18,6 @@ SubInclude HAIKU_TOP src preferences network ; SubInclude HAIKU_TOP src preferences print ; SubInclude HAIKU_TOP src preferences screen ; SubInclude HAIKU_TOP src preferences screensaver ; -SubInclude HAIKU_TOP src preferences scrollbar ; SubInclude HAIKU_TOP src preferences sounds ; SubInclude HAIKU_TOP src preferences time ; SubInclude HAIKU_TOP src preferences virtualmemory ; diff --git a/src/preferences/scrollbar/Jamfile b/src/preferences/scrollbar/Jamfile deleted file mode 100644 index 70799e5c50..0000000000 --- a/src/preferences/scrollbar/Jamfile +++ /dev/null @@ -1,12 +0,0 @@ -SubDir HAIKU_TOP src preferences scrollbar ; - -Preference ScrollBar : - ScrollBarApp.cpp - ScrollBarWindow.cpp - ScrollBarView.cpp - knobsizeadjuster.cpp - fakescrollbar.cpp - : libbe.so - : ScrollBar.rdef - ; - diff --git a/src/preferences/scrollbar/ScrollBar.rdef b/src/preferences/scrollbar/ScrollBar.rdef deleted file mode 100644 index f481eeeb19..0000000000 --- a/src/preferences/scrollbar/ScrollBar.rdef +++ /dev/null @@ -1,84 +0,0 @@ - -resource app_flags B_SINGLE_LAUNCH; - -/* TODO: replace this with something human-readable. */ -resource(1, "BEOS:APP_VERSION") #'APPV' array { - $"0500000000000000000000000500000001000000523500000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"000000000000000000000000000000000000000042654F53203520C2A9313939" - $"312D3230303020426520496E636F72706F726174656400000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000080050000000000000000000000" - $"0500000001000000523500000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"000000000000000042654F53203520C2A9313939312D3230303020426520496E" - $"636F72706F726174656400000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000000000000000000000000000000000000000000000000000" - $"0000000000000000" -}; - -resource large_icon array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF003F0000FFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF003F3F3F0000FFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFF003F1B1C3F3F0000FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F0000FF003F1B1C1B1C0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F3F3F00003F1B001C1B0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F1B1C3F3F00001B0F1C0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F1B1C1B1C0F001C001B0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F1B001C1B0F001C1C1B0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F001B0F1C0F000E1C1C0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF003F1B1C001B0F00180F0E0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFFFF0000000E1C1C1B1C0F001718170F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFF007B7B003F0E0F1C1C0E001817180E00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFFFF00DA7B7B003F3F0E0F0F000F17180F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFF002B2CDA7B001B1C3F3F0E003F0E0F0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFFFF002B2F2F0017171C1C170F001C3F3F0E00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFF002B2CEB2F0017171C1C170F001B1C1C0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFFFF002B2F2F0000171C1B1C170F001C1B1C0F00FFFFFFFFFF" - $"FFFFFFFFFFFFFFFF002B2CEB2F0000171C1B1C170F000F1C1B0F00FFFFFFFFFF" - $"FFFF000000FFFFFF002B2F2F00FF003F1B1C1B180F003F0E0F0F00FFFFFFFFFF" - $"FF007B7B7B00FF002B2CEB2F00FF000E18171C170F001C3F3F0E00FFFFFFFFFF" - $"007B7B7BDA00FF002B2F2F00FFFF003F0E0F18170F001C1B1C0F000FFFFFFFFF" - $"002B2CDA7B7B002B2CEB2F00FFFF003F3F3F0E0F0F001C001B0F000F0F0FFFFF" - $"FF002B2CDA7B2B2CEB2F00FFFFFF003F1B1C3F3F0E00001C1C0F000E0F0F0F0F" - $"FF002B2CDA7B2B2CEB2F00FFFFFF003F001B1C1B0F001C1C1B0F000F0F0F0FFF" - $"FFFF002B2C2B2B2F2F00FFFFFFFF003F0E1C001C0F000E1C1C0F000E0F0FFFFF" - $"FFFF002B2C2B2B2F2F00FFFFFFFF003F1B001C1B0F00000F0F0F000F0FFFFFFF" - $"FFFFFF002B2CEB2F00FFFFFFFFFF000E1C1C1B1C0F000F0000000F0EFFFFFFFF" - $"FFFFFF002B2CEB2F00FFFFFFFFFF00000E0F1C1C0E000F0F0FFFFFFFFFFFFFFF" - $"FFFFFFFF002B2F000E0F0F0F0F0F0F0F00000E0F0F000F0FFFFFFFFFFFFFFFFF" - $"FFFFFFFF0000000E0F0F0F0F0F0F0F0E0F0F0000000FFFFFFFFFFFFFFFFFFFFF" -}; - -resource mini_icon array { - $"FFFFFFFFFFFFFFFFFFFF0000FFFFFFFF" - $"FFFFFFFFFFFFFF0000FF003F0000FFFF" - $"FFFFFFFFFFFFFF003F00001B1800FFFF" - $"FFFFFFFFFFFFFF003F3F001B1800FFFF" - $"FFFFFFFFFFFFFF001B18001B1800FFFF" - $"FFFFFFFFFFFF0000001700000000FFFF" - $"FFFFFFFFFFFF00003F00003F1700FFFF" - $"FFFFFFFFFF007B001B3F001B1C00FFFF" - $"FFFFFFFFFF002F001B18001B1800FFFF" - $"FFFFFFFF002F00001B18001B1800FFFF" - $"FF00FFFF002F0000171700000000FFFF" - $"002B00002F00FF000017001C17000F0F" - $"002B7B2CEB00FF003F00001717000F0F" - $"FF002B2F00FFFF00171C000000000EFF" - $"FF002B2F000E0F000018000F0EFFFFFF" - $"FFFF00000E0F0F0F0F0000FFFFFFFFFF" -}; - -resource app_signature "application/x-vnd.haiku-ScrollBar"; diff --git a/src/preferences/scrollbar/ScrollBarApp.cpp b/src/preferences/scrollbar/ScrollBarApp.cpp deleted file mode 100644 index 1199e5932a..0000000000 --- a/src/preferences/scrollbar/ScrollBarApp.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ScrollBarApp.cpp -// Author: MrSiggler -// DarkWyrm -// Description: main app class -// -//------------------------------------------------------------------------------ -#include "ScrollBarApp.h" -#include "ScrollBarWindow.h" - -scroll_bar_info gSettings; -scroll_bar_info gRevertSettings; - -ScrollBarApp::ScrollBarApp() - : BApplication("application/x-vnd.haiku-ScrollBar") -{ - fWindow = new ScrollBarWindow(); -} - -ScrollBarApp::~ScrollBarApp() -{ -} - -void -ScrollBarApp::ReadyToRun() -{ - fWindow->Show(); -} - -int main(int, char**) -{ - ScrollBarApp myApplication; - - myApplication.Run(); - - return 0; -} diff --git a/src/preferences/scrollbar/ScrollBarApp.h b/src/preferences/scrollbar/ScrollBarApp.h deleted file mode 100644 index fdaa262ca6..0000000000 --- a/src/preferences/scrollbar/ScrollBarApp.h +++ /dev/null @@ -1,49 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ScrollBarApp.h -// Author: MrSiggler -// DarkWyrm -// Description: main app class -// -//------------------------------------------------------------------------------ -#ifndef SCROLL_BAR_APP_H -#define SCROLL_BAR_APP_H - -#include - -class ScrollBarWindow; - -class ScrollBarApp : public BApplication -{ -public: - ScrollBarApp(); - virtual ~ScrollBarApp(); - virtual void ReadyToRun(); - -private: - ScrollBarWindow *fWindow; -}; - -extern scroll_bar_info gSettings; -extern scroll_bar_info gRevertSettings; - -#endif // SCROLL_BAR_APP_H diff --git a/src/preferences/scrollbar/ScrollBarView.cpp b/src/preferences/scrollbar/ScrollBarView.cpp deleted file mode 100644 index 376f4674b0..0000000000 --- a/src/preferences/scrollbar/ScrollBarView.cpp +++ /dev/null @@ -1,385 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ScrollBarView.cpp -// Author: MrSiggler -// DarkWyrm -// Description: view which does all the work -// -//------------------------------------------------------------------------------ -#include "ScrollBarApp.h" -#include "ScrollBarView.h" -#include "fakescrollbar.h" -#include "knobsizeadjuster.h" -#include "messages.h" - -// This is R5's default value -#define DEFAULT_KNOB_SIZE 15 - -ScrollBarView::ScrollBarView(void) - : BView( BRect(0,0,348,280),"scrollbarview", B_FOLLOW_LEFT | B_FOLLOW_TOP, - B_WILL_DRAW) -{ - SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) ); - - get_scroll_bar_info(&gRevertSettings); - gSettings=gRevertSettings; - - // Set up the top left box - single vs. double arrow selection - BBox *arrowstyleBox = new BBox( BRect(12, 7, 169, 119) ); - arrowstyleBox->SetLabel( "Arrow Style" ); - - float doubleWidth = StringWidth("Double:"); - BStringView *doubleStringView = new BStringView( BRect(25,20,25+doubleWidth,38), - "doubleStringView","Double:"); - - fDouble=new FakeScrollBar( BPoint(12,38), gSettings.double_arrows, gSettings.knob, - !gSettings.proportional, true, gSettings.min_knob_size, - new BMessage(SCROLLBAR_ARROW_STYLE_DOUBLE)); - arrowstyleBox->AddChild( fDouble ); - - float singleWidth = StringWidth("Single:"); - BStringView *singleStringView = new BStringView( BRect(25,60,25+singleWidth,87), - "singleStringView", "Single:"); - - fSingle=new FakeScrollBar( BPoint(12,singleStringView->Frame().bottom+1), - !gSettings.double_arrows, gSettings.knob, - !gSettings.proportional, false, gSettings.min_knob_size, - new BMessage(SCROLLBAR_ARROW_STYLE_SINGLE)); - arrowstyleBox->AddChild( fSingle ); - - BBox *knobtypeBox = new BBox( BRect(180, 7, 338, 119) ); - knobtypeBox->SetLabel( "Knob Type" ); - - float proportionalWidth = StringWidth("Proportional:"); - BStringView *proportionalStringView = new BStringView( BRect(193,20,193+proportionalWidth,38), - "proportionalStringView", - "Proportional:" ); - - fProportional=new FakeScrollBar( BPoint(12,38),gSettings.proportional, gSettings.knob, - false, gSettings.double_arrows, gSettings.min_knob_size, - new BMessage(SCROLLBAR_KNOB_TYPE_PROPORTIONAL)); - knobtypeBox->AddChild( fProportional ); - - float fixedWidth = StringWidth("Fixed:"); - BStringView *fixedStringView = new BStringView( BRect(193,60,193+fixedWidth,87), - "fixedStringView", "Fixed:" ); - - fFixed=new FakeScrollBar( BPoint(12,87),!gSettings.proportional, gSettings.knob, - true, gSettings.double_arrows, gSettings.min_knob_size, - new BMessage(SCROLLBAR_KNOB_TYPE_FIXED)); - knobtypeBox->AddChild( fFixed ); - - BBox *minknobsizeBox = new BBox( BRect(12, 123, 169, 232) ); - minknobsizeBox->SetLabel( "Minimum Knob Size:" ); - - fSizeAdjuster = new KnobSizeAdjuster( BPoint(12,38), gSettings.min_knob_size ); - minknobsizeBox->AddChild( fSizeAdjuster ); - - BBox *knobstyleBox = new BBox( BRect(180, 123, 338, 232) ); - knobstyleBox->SetLabel( "Knob Style:" ); - - fFlat=new FakeScrollBar( BPoint(12,22),gSettings.knob==THUMB_BLANK, THUMB_BLANK, - !gSettings.proportional, gSettings.double_arrows, - gSettings.min_knob_size, - new BMessage(SCROLLBAR_KNOB_STYLE_FLAT)); - knobstyleBox->AddChild( fFlat ); - - fDots=new FakeScrollBar( BPoint(12,52),gSettings.knob==THUMB_DOTS, THUMB_DOTS, - !gSettings.proportional, gSettings.double_arrows, - gSettings.min_knob_size, - new BMessage(SCROLLBAR_KNOB_STYLE_DOT)); - knobstyleBox->AddChild( fDots ); - - fLines=new FakeScrollBar( BPoint(12,82),gSettings.knob==THUMB_LINES, THUMB_LINES, - !gSettings.proportional, gSettings.double_arrows, - gSettings.min_knob_size, - new BMessage(SCROLLBAR_KNOB_STYLE_LINE)); - knobstyleBox->AddChild( fLines ); - - fDefaultsButton = new BButton( BRect(10, 242, 85, 265), "defaultsbutton", - "Defaults", new BMessage(SCROLLBAR_DEFAULTS) ); - - // Disable defaults button if the current settings are already the defaults - if( gSettings.knob==THUMB_DOTS && gSettings.proportional==true && - gSettings.double_arrows==true && gSettings.min_knob_size==DEFAULT_KNOB_SIZE ) - { - fDefaultsButton->SetEnabled(false); - } - - fRevertButton = new BButton( BRect( 95, 242, 170, 265), "revertbutton", "Revert", - new BMessage(SCROLLBAR_REVERT) ); - fRevertButton->SetEnabled( false ); - - AddChild( arrowstyleBox ); - AddChild( doubleStringView ); - AddChild( singleStringView ); - - AddChild( knobtypeBox ); - AddChild( proportionalStringView ); - AddChild( fixedStringView ); - - AddChild( minknobsizeBox ); - AddChild( knobstyleBox ); - - AddChild( fDefaultsButton ); - AddChild( fRevertButton ); -} - -ScrollBarView::~ScrollBarView(void) -{ -} - -void -ScrollBarView::AttachedToWindow(void) -{ - fSingle->SetTarget(this); - fDouble->SetTarget(this); - fProportional->SetTarget(this); - fFixed->SetTarget(this); - fFlat->SetTarget(this); - fDots->SetTarget(this); - fLines->SetTarget(this); - - fSizeAdjuster->SetTarget(this); - - fDefaultsButton->SetTarget(this); - fRevertButton->SetTarget(this); -} - -void -ScrollBarView::HandleButtonStates(void) -{ - if( gSettings.knob!=gRevertSettings.knob || - gSettings.proportional!=gRevertSettings.proportional || - gSettings.double_arrows!=gRevertSettings.double_arrows || - gSettings.min_knob_size!=gRevertSettings.min_knob_size ) - { - fDefaultsButton->SetEnabled(false); - fRevertButton->SetEnabled(true); - } - else - { - fDefaultsButton->SetEnabled(true); - fRevertButton->SetEnabled(false); - } -} - -void -ScrollBarView::SetAllScrollBars(void) -{ - fSingle->SetFromScrollBarInfo(gSettings); - fSingle->SetDoubleArrows(false); - fDouble->SetFromScrollBarInfo(gSettings); - fDouble->SetDoubleArrows(true); - - fProportional->SetFromScrollBarInfo(gSettings); - fProportional->SetFixedThumb(false); - fFixed->SetFromScrollBarInfo(gSettings); - fFixed->SetFixedThumb(true); - - fFlat->SetFromScrollBarInfo(gSettings); - fFlat->SetKnobStyle(THUMB_BLANK); - fDots->SetFromScrollBarInfo(gSettings); - fDots->SetKnobStyle(THUMB_DOTS); - fLines->SetFromScrollBarInfo(gSettings); - fLines->SetKnobStyle(THUMB_LINES); - - fSingle->SetSelected( !gSettings.double_arrows ); - fDouble->SetSelected( gSettings.double_arrows ); - - fProportional->SetSelected( gSettings.proportional ); - fFixed->SetSelected( !gSettings.proportional ); - - fFlat->SetSelected(gSettings.knob==THUMB_BLANK); - fDots->SetSelected(gSettings.knob==THUMB_DOTS); - fLines->SetSelected(gSettings.knob==THUMB_LINES); -} - -void -ScrollBarView::MessageReceived(BMessage *msg) -{ - switch(msg->what) - { - case SCROLLBAR_DEFAULTS: - { - gSettings.double_arrows=true; - gSettings.proportional=true; - gSettings.knob=THUMB_DOTS; - gSettings.min_knob_size=DEFAULT_KNOB_SIZE; - - SetAllScrollBars(); - HandleButtonStates(); - break; - } - case SCROLLBAR_REVERT: - { - gSettings=gRevertSettings; - - fSingle->SetFromScrollBarInfo(gSettings); - fDouble->SetFromScrollBarInfo(gSettings); - fProportional->SetFromScrollBarInfo(gSettings); - fFixed->SetFromScrollBarInfo(gSettings); - fFlat->SetFromScrollBarInfo(gSettings); - fDots->SetFromScrollBarInfo(gSettings); - fLines->SetFromScrollBarInfo(gSettings); - - SetAllScrollBars(); - HandleButtonStates(); - break; - } - - case SCROLLBAR_ARROW_STYLE_DOUBLE: - { - fDouble->SetSelected(true); - fSingle->SetSelected(false); - - fFixed->SetDoubleArrows(true); - fProportional->SetDoubleArrows(true); - - fFlat->SetDoubleArrows(true); - fDots->SetDoubleArrows(true); - fLines->SetDoubleArrows(true); - - gSettings.double_arrows=true; - HandleButtonStates(); - break; - } - case SCROLLBAR_ARROW_STYLE_SINGLE: - { - fDouble->SetSelected(false); - fSingle->SetSelected(true); - - fFixed->SetDoubleArrows(false); - fProportional->SetDoubleArrows(false); - - fFlat->SetDoubleArrows(false); - fDots->SetDoubleArrows(false); - fLines->SetDoubleArrows(false); - - gSettings.double_arrows=false; - HandleButtonStates(); - break; - } - case SCROLLBAR_KNOB_TYPE_PROPORTIONAL: - { - fDouble->SetFixedThumb(false); - fSingle->SetFixedThumb(false); - - fFixed->SetSelected(false); - fProportional->SetSelected(true); - - fFlat->SetFixedThumb(false); - fDots->SetFixedThumb(false); - fLines->SetFixedThumb(false); - - gSettings.proportional=true; - HandleButtonStates(); - break; - } - case SCROLLBAR_KNOB_TYPE_FIXED: - { - fDouble->SetFixedThumb(true); - fSingle->SetFixedThumb(true); - - fFixed->SetSelected(true); - fProportional->SetSelected(false); - - fFlat->SetFixedThumb(true); - fDots->SetFixedThumb(true); - fLines->SetFixedThumb(true); - - gSettings.proportional=false; - HandleButtonStates(); - break; - } - - case SCROLLBAR_KNOB_STYLE_FLAT: - { - fDouble->SetKnobStyle(THUMB_BLANK); - fSingle->SetKnobStyle(THUMB_BLANK); - - fFixed->SetKnobStyle(THUMB_BLANK); - fProportional->SetKnobStyle(THUMB_BLANK); - - fFlat->SetSelected(true); - fDots->SetSelected(false); - fLines->SetSelected(false); - - gSettings.knob=THUMB_BLANK; - HandleButtonStates(); - break; - } - case SCROLLBAR_KNOB_STYLE_DOT: - { - fDouble->SetKnobStyle(THUMB_DOTS); - fSingle->SetKnobStyle(THUMB_DOTS); - - fFixed->SetKnobStyle(THUMB_DOTS); - fProportional->SetKnobStyle(THUMB_DOTS); - - fFlat->SetSelected(false); - fDots->SetSelected(true); - fLines->SetSelected(false); - - gSettings.knob=THUMB_DOTS; - HandleButtonStates(); - break; - } - case SCROLLBAR_KNOB_STYLE_LINE: - { - fDouble->SetKnobStyle(THUMB_LINES); - fSingle->SetKnobStyle(THUMB_LINES); - - fFixed->SetKnobStyle(THUMB_LINES); - fProportional->SetKnobStyle(THUMB_LINES); - - fFlat->SetSelected(false); - fDots->SetSelected(false); - fLines->SetSelected(true); - - gSettings.knob=THUMB_LINES; - HandleButtonStates(); - break; - } - - case SCROLLBAR_KNOB_SIZE_CHANGED: - { - fDouble->SetKnobSize(fSizeAdjuster->KnobSize()); - fSingle->SetKnobSize(fSizeAdjuster->KnobSize()); - - fFixed->SetKnobSize(fSizeAdjuster->KnobSize()); - fProportional->SetKnobSize(fSizeAdjuster->KnobSize()); - - fFlat->SetKnobSize(fSizeAdjuster->KnobSize()); - fDots->SetKnobSize(fSizeAdjuster->KnobSize()); - fLines->SetKnobSize(fSizeAdjuster->KnobSize()); - - gSettings.min_knob_size=fSizeAdjuster->KnobSize(); - HandleButtonStates(); - break; - } - - default: - BView::MessageReceived(msg); - break; - } -} diff --git a/src/preferences/scrollbar/ScrollBarView.h b/src/preferences/scrollbar/ScrollBarView.h deleted file mode 100644 index ec25f33922..0000000000 --- a/src/preferences/scrollbar/ScrollBarView.h +++ /dev/null @@ -1,67 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ScrollBarView.cpp -// Author: MrSiggler -// DarkWyrm -// Description: view which does all the work -// -//------------------------------------------------------------------------------ -#ifndef SCROLLBAR_VIEW -#define SCROLLBAR_VIEW - -#include -#include -#include -#include -#include - -class FakeScrollBar; -class KnobSizeAdjuster; - -class ScrollBarView : public BView -{ -public: - ScrollBarView(void); - ~ScrollBarView(void); - void MessageReceived(BMessage *msg); - void AttachedToWindow(void); - -private: - - void HandleButtonStates(void); - void SetAllScrollBars(void); - - BButton *fDefaultsButton; - BButton *fRevertButton; - - KnobSizeAdjuster *fSizeAdjuster; - - FakeScrollBar *fSingle; - FakeScrollBar *fDouble; - FakeScrollBar *fProportional; - FakeScrollBar *fFixed; - FakeScrollBar *fFlat; - FakeScrollBar *fDots; - FakeScrollBar *fLines; -}; - -#endif diff --git a/src/preferences/scrollbar/ScrollBarWindow.cpp b/src/preferences/scrollbar/ScrollBarWindow.cpp deleted file mode 100644 index 61ac3e39a4..0000000000 --- a/src/preferences/scrollbar/ScrollBarWindow.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ScrollBarWindow.cpp -// Author: MrSiggler -// DarkWyrm -// Description: Container window class -// -//------------------------------------------------------------------------------ -#include -#include -#include -#include -#include -#include - -#include "ScrollBarWindow.h" -#include "ScrollBarApp.h" -#include "ScrollBarView.h" - -ScrollBarWindow::ScrollBarWindow(void) - : BWindow( BRect(50,50,398,325), "Scroll Bar", B_TITLED_WINDOW, B_NOT_RESIZABLE | - B_NOT_ZOOMABLE ) -{ - AddChild(new ScrollBarView); -} - -ScrollBarWindow::~ScrollBarWindow(void) -{ -} - -bool -ScrollBarWindow::QuitRequested(void) -{ - set_scroll_bar_info(&gSettings); - - be_app->PostMessage(B_QUIT_REQUESTED); - return true; -} diff --git a/src/preferences/scrollbar/ScrollBarWindow.h b/src/preferences/scrollbar/ScrollBarWindow.h deleted file mode 100644 index 2dbe8abd66..0000000000 --- a/src/preferences/scrollbar/ScrollBarWindow.h +++ /dev/null @@ -1,43 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: ScrollBarWindow.h -// Author: MrSiggler -// DarkWyrm -// Description: Container window class -// -//------------------------------------------------------------------------------ -#ifndef SCROLL_BAR_WINDOW_H -#define SCROLL_BAR_WINDOW_H - -#include - -class ScrollBarView; - -class ScrollBarWindow : public BWindow -{ -public: - ScrollBarWindow(void); - virtual ~ScrollBarWindow(void); - virtual bool QuitRequested(void); -}; - -#endif // SCROLL_BAR_WINDOW_H diff --git a/src/preferences/scrollbar/fakescrollbar.cpp b/src/preferences/scrollbar/fakescrollbar.cpp deleted file mode 100644 index 68dbb65dc5..0000000000 --- a/src/preferences/scrollbar/fakescrollbar.cpp +++ /dev/null @@ -1,450 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: fakescrollbar.cpp -// Author: MrSiggler -// DarkWyrm -// Description: Control to simulate a scrollbar -// -//------------------------------------------------------------------------------ -#include "fakescrollbar.h" -#include "messages.h" - -FakeScrollBar::FakeScrollBar( BPoint position, bool selected, int32 knobstyle, - bool fixedthumb, bool doublearrow, int32 size, BMessage *message ) - - : BControl( BRect(position.x, position.y, position.x+132, position.y+20), "FakeScrollBar", NULL, - message, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE) -{ - fIsSelected=selected; - fIsPressed=false; - fDoubleArrows=doublearrow; - fFixedThumb=fixedthumb; - - fKnobStyle=knobstyle; - fMinKnobSize=size; -} - -FakeScrollBar::~FakeScrollBar(void) -{ -} - -void -FakeScrollBar::DrawArrowBox( uint32 x, bool facingleft ) -{ - // draw box - SetHighColor( 216, 216, 216 ); - FillRect( BRect(x, Bounds().top+3, x+16, Bounds().bottom-3), B_SOLID_HIGH ); - - SetHighColor( 152, 152, 152 ); - StrokeRect( BRect(x, Bounds().top+3, x+16, Bounds().bottom-3 ) , B_SOLID_HIGH ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x+1, Bounds().top+4), BPoint(x+15, Bounds().top+4), B_SOLID_HIGH ); - StrokeLine( BPoint(x+1, Bounds().top+4), BPoint(x+1, Bounds().bottom-4), B_SOLID_HIGH ); - - SetHighColor( 192, 192, 192 ); - StrokeLine( BPoint(x+15, Bounds().bottom-4), BPoint(x+15, Bounds().top+4), B_SOLID_HIGH ); - StrokeLine( BPoint(x+15, Bounds().bottom-4), BPoint(x+1, Bounds().bottom-4), B_SOLID_HIGH ); - - if ( facingleft ) - { - // draw arrow - SetHighColor( 112, 112, 112 ); - StrokeLine( BPoint(x+4, Bounds().top+10), BPoint(x+11, Bounds().top+7), B_SOLID_HIGH ); - StrokeLine( BPoint(x+4, Bounds().top+10), BPoint(x+11, Bounds().bottom-7), B_SOLID_HIGH ); - StrokeLine( BPoint(x+11, Bounds().top+7), BPoint(x+11, Bounds().bottom-7), B_SOLID_HIGH ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x+4, Bounds().top+11), BPoint(x+11, Bounds().bottom-6), B_SOLID_HIGH ); - StrokeLine( BPoint(x+12, Bounds().top+7), BPoint(x+12, Bounds().bottom-6), B_SOLID_HIGH ); - - SetHighColor( 192, 192, 192 ); - StrokeLine( BPoint(x+4, Bounds().top+9), BPoint(x+11, Bounds().top+6), B_SOLID_HIGH ); - StrokeLine( BPoint(x+3, Bounds().top+10), BPoint(x+3, Bounds().top+10), B_SOLID_HIGH ); - StrokeLine( BPoint(x+12, Bounds().top+6), BPoint(x+12, Bounds().top+6), B_SOLID_HIGH ); - } - else - { - // draw arrow - SetHighColor( 112, 112, 112 ); - StrokeLine( BPoint(x+12, Bounds().top+10), BPoint(x+5, Bounds().top+7), B_SOLID_HIGH ); - StrokeLine( BPoint(x+12, Bounds().top+10), BPoint(x+5, Bounds().bottom-7), B_SOLID_HIGH ); - StrokeLine( BPoint(x+5, Bounds().top+7), BPoint(x+5, Bounds().bottom-7), B_SOLID_HIGH ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x+12, Bounds().top+11), BPoint(x+5, Bounds().bottom-6), B_SOLID_HIGH ); - StrokeLine( BPoint(x+4, Bounds().top+7), BPoint(x+4, Bounds().bottom-6), B_SOLID_HIGH ); - - SetHighColor( 192, 192, 192 ); - StrokeLine( BPoint(x+12, Bounds().top+9), BPoint(x+5, Bounds().top+6), B_SOLID_HIGH ); - StrokeLine( BPoint(x+13, Bounds().top+10), BPoint(x+13, Bounds().top+10), B_SOLID_HIGH ); - StrokeLine( BPoint(x+4, Bounds().top+6), BPoint(x+4, Bounds().top+6), B_SOLID_HIGH ); - } -} - -void -FakeScrollBar::Draw( BRect updateRect ) -{ - SetViewColor( 216, 216, 216 ); - - // Draw border - if ( fIsSelected ) - SetHighColor( 0, 0, 0 ); - else if ( fIsPressed ) - SetHighColor( 128, 128, 128 ); - else - SetHighColor( 216, 216, 216 ); - - SetPenSize( 2 ); - StrokeRect( BRect(Bounds().left, Bounds().top, Bounds().right-1, Bounds().bottom-1) ); - - SetPenSize( 1 ); - SetHighColor( 216, 216, 216 ); - - FillRect( BRect(Bounds().left+2, Bounds().top+2, Bounds().right-2, Bounds().bottom-2) ); - - // Draw first arrows - DrawArrowBox( 3, true ); - DrawArrowBox( 113, false ); - - // If double arrows, draw another set. - if ( fDoubleArrows ) - { - DrawArrowBox( 19, false ); - DrawArrowBox( 97, true ); - } - - // Draw back - if ( fDoubleArrows ) - { - SetHighColor( 200, 200, 200 ); - FillRect( BRect(36, 3, 96, 15) ); - - SetHighColor( 152, 152, 152 ); - StrokeLine( BPoint(36, 3), BPoint(96, 3) ); - StrokeLine( BPoint(36, 17), BPoint(96, 17) ); - - SetHighColor( 216, 216, 216 ); - StrokeLine( BPoint(36, 16), BPoint(96, 16) ); - - SetHighColor( 184, 184, 184 ); - FillRect( BRect(36, 4, 37, 15) ); - FillRect( BRect(36, 4, 96, 5) ); - } - else - { - SetHighColor( 200, 200, 200 ); - FillRect( BRect(20, 3, 112, 15) ); - - SetHighColor( 152, 152, 152 ); - StrokeLine( BPoint(20, 3), BPoint(112, 3) ); - StrokeLine( BPoint(20, 17), BPoint(112, 17) ); - - SetHighColor( 216, 216, 216 ); - StrokeLine( BPoint(20, 16), BPoint(112, 16) ); - - SetHighColor( 184, 184, 184 ); - FillRect( BRect(20, 4, 21, 15) ); - FillRect( BRect(20, 4, 112, 5) ); - } - - // Draw knob - if ( fFixedThumb ) - { - SetHighColor( 216, 216, 216 ); - FillRect( BRect((Bounds().right/2)-(fMinKnobSize/2), 3, - (Bounds().right/2)+(fMinKnobSize/2), 17) ); - SetHighColor( 152, 152, 152 ); - StrokeRect( BRect((Bounds().right/2)-(fMinKnobSize/2), 3, - (Bounds().right/2)+(fMinKnobSize/2), 17) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint((Bounds().right/2)-(fMinKnobSize/2)+1, 4), - BPoint((Bounds().right/2)+(fMinKnobSize/2)-1, 4) ); - StrokeLine( BPoint((Bounds().right/2)-(fMinKnobSize/2)+1, 4), - BPoint((Bounds().right/2)-(fMinKnobSize/2)+1, 16) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint((Bounds().right/2)-(fMinKnobSize/2)+1, 16), - BPoint((Bounds().right/2)+(fMinKnobSize/2)-1, 16) ); - StrokeLine( BPoint((Bounds().right/2)+(fMinKnobSize/2)-1, 16), - BPoint((Bounds().right/2)+(fMinKnobSize/2)-1, 4) ); - - SetHighColor( 96, 96, 96 ); - StrokeLine( BPoint((Bounds().right/2)+(fMinKnobSize/2), 4), - BPoint((Bounds().right/2)+(fMinKnobSize/2), 16) ); - } - else - { - if ( fDoubleArrows ) - { - SetHighColor( 216, 216, 216 ); - FillRect( BRect(44, 3, 88, 17) ); - SetHighColor( 152, 152, 152 ); - StrokeRect( BRect(44, 3, 88, 17) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(45, 4), BPoint(87, 4) ); - StrokeLine( BPoint(45, 4), BPoint(45, 16) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(45, 16), BPoint(87, 16) ); - StrokeLine( BPoint(87, 16), BPoint(87, 4) ); - - SetHighColor( 96, 96, 96 ); - StrokeLine( BPoint(88, 4), BPoint(88, 16) ); - } - else - { - SetHighColor( 216, 216, 216 ); - FillRect( BRect(32, 3, 100, 17) ); - SetHighColor( 152, 152, 152 ); - StrokeRect( BRect(32, 3, 100, 17) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(33, 4), BPoint(99, 4) ); - StrokeLine( BPoint(33, 4), BPoint(33, 16) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(33, 16), BPoint(99, 16) ); - StrokeLine( BPoint(99, 16), BPoint(99, 4) ); - - SetHighColor( 96, 96, 96 ); - StrokeLine( BPoint(100, 4), BPoint(100, 16) ); - } - } - - // Draw knob grabber - if ( fKnobStyle == THUMB_DOTS ) - { - if( fFixedThumb ) - DrawDotGrabber( Bounds().right/2, fMinKnobSize ); - else - DrawDotGrabber( Bounds().right/2, 100 ); - } - else if ( fKnobStyle == THUMB_LINES ) - { - if ( fFixedThumb ) - DrawLineGrabber( Bounds().right/2, fMinKnobSize ); - else - DrawLineGrabber( Bounds().right/2, 100 ); - } -} - -void -FakeScrollBar::DrawLineGrabber( uint32 x, uint32 size ) -{ - if ( size < 12 ) - { - // Draw nothing! - } - else if ( size < 22 ) - { - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x-1, 7), BPoint(x+1, 7) ); - StrokeLine( BPoint(x-1, 7), BPoint(x-1, 13) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x+1, 7), BPoint(x+1, 13) ); - StrokeLine( BPoint(x+1, 13), BPoint(x-1, 13) ); - } - else - { - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x-1, 7), BPoint(x+1, 7) ); - StrokeLine( BPoint(x-1, 7), BPoint(x-1, 13) ); - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x+1, 7), BPoint(x+1, 13) ); - StrokeLine( BPoint(x+1, 13), BPoint(x-1, 13) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x-5, 7), BPoint(x-3, 7) ); - StrokeLine( BPoint(x-5, 7), BPoint(x-5, 13) ); - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x-3, 7), BPoint(x-3, 13) ); - StrokeLine( BPoint(x-3, 13), BPoint(x-5, 13) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x+3, 7), BPoint(x+5, 7) ); - StrokeLine( BPoint(x+3, 7), BPoint(x+3, 13) ); - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x+5, 7), BPoint(x+5, 13) ); - StrokeLine( BPoint(x+5, 13), BPoint(x+3, 13) ); - } -} - -void -FakeScrollBar::DrawDotGrabber( uint32 x, uint32 size ) -{ - if ( size < 14 ) - { - // Draw Nothing! - } - else if ( size < 27 ) - { - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x-2, 8), BPoint(x+2, 8) ); - StrokeLine( BPoint(x-2, 8), BPoint(x-2, 12) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x+2, 8), BPoint(x+2, 12) ); - StrokeLine( BPoint(x+2, 12), BPoint(x-2, 12) ); - } - else - { - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x-2, 8), BPoint(x+2, 8) ); - StrokeLine( BPoint(x-2, 8), BPoint(x-2, 12) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x+2, 8), BPoint(x+2, 12) ); - StrokeLine( BPoint(x+2, 12), BPoint(x-2, 12) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x-9, 8), BPoint(x-5, 8) ); - StrokeLine( BPoint(x-9, 8), BPoint(x-9, 12) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x-5, 8), BPoint(x-5, 12) ); - StrokeLine( BPoint(x-5, 12), BPoint(x-9, 12) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(x+5, 8), BPoint(x+9, 8) ); - StrokeLine( BPoint(x+5, 8), BPoint(x+5, 12) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(x+9, 8), BPoint(x+9, 12) ); - StrokeLine( BPoint(x+9, 12), BPoint(x+5, 12) ); - } -} - -void -FakeScrollBar::MouseDown( BPoint point ) -{ - SetTracking( true ); -} - -void -FakeScrollBar::MouseUp( BPoint point ) -{ - if ( IsPressed() ) - Invoke(); - - SetTracking( false ); -} - -void -FakeScrollBar::MouseMoved( BPoint point, uint32 transit, const BMessage *message ) -{ - if ( transit == B_ENTERED_VIEW && IsTracking() ) - SetPressed( true ); - - if ( transit == B_EXITED_VIEW && IsTracking() ) - SetPressed( false ); -} - -void -FakeScrollBar::SetDoubleArrows( bool doublearrows ) -{ - fDoubleArrows = doublearrows; - Invalidate(); -} - -void -FakeScrollBar::SetFixedThumb( bool fixed ) -{ - fFixedThumb = fixed; - Invalidate(); -} - -void -FakeScrollBar::SetKnobStyle( uint32 style ) -{ - fKnobStyle=style; - Invalidate(); -} - -void -FakeScrollBar::SetKnobSize( int32 size ) -{ - fMinKnobSize=size; - Invalidate(); -} - -void -FakeScrollBar::SetFromScrollBarInfo(const scroll_bar_info &info) -{ - fDoubleArrows=info.double_arrows; - fFixedThumb=!info.proportional; - fMinKnobSize=info.min_knob_size; - fKnobStyle=info.knob; - Invalidate(); -} - -void -FakeScrollBar::SetSelected( bool selected ) -{ - fIsSelected=selected; - Invalidate(); -} - -void -FakeScrollBar::SetPressed( bool pressed ) -{ - fIsPressed=pressed; - Invalidate(); -} - -void -FakeScrollBar::SetTracking( bool tracking ) -{ - fIsTracking=tracking; - - if ( IsTracking() ) - { - SetEventMask( B_POINTER_EVENTS ); - SetPressed( true ); - } - else - { - SetEventMask( 0 ); - SetPressed( false ); - } -} - -bool -FakeScrollBar::IsSelected() -{ - return fIsSelected; -} - -bool -FakeScrollBar::IsPressed() -{ - return fIsPressed; -} - -bool -FakeScrollBar::IsTracking() -{ - return fIsTracking; -} diff --git a/src/preferences/scrollbar/fakescrollbar.h b/src/preferences/scrollbar/fakescrollbar.h deleted file mode 100644 index d08978b586..0000000000 --- a/src/preferences/scrollbar/fakescrollbar.h +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: fakescrollbar.h -// Author: MrSiggler -// DarkWyrm -// Description: Control to simulate a scrollbar -// -//------------------------------------------------------------------------------ -#ifndef SCROLLBAR_FAKE_H -#define SCROLLBAR_FAKE_H - -#include - -// These values are the same as what is kept in the scroll_bar_info struct. -enum -{ - THUMB_BLANK = 0, - THUMB_DOTS, - THUMB_LINES -}; - -class FakeScrollBar : public BControl -{ -public: - FakeScrollBar( BPoint position, bool selected, int32 knobstyle, - bool fixedthumb, bool doublearrows, int32 size, - BMessage *message ); - ~FakeScrollBar(void); - - void SetFromScrollBarInfo(const scroll_bar_info &info); - - void SetDoubleArrows( bool doublearrows ); - void SetKnobSize( int32 size ); - void SetFixedThumb( bool fixed ); - void SetKnobStyle( uint32 style ); - - void SetSelected( bool selected ); - void SetPressed( bool pressed ); - void SetTracking( bool tracking ); - - bool IsPressed(); - bool IsSelected(); - bool IsTracking(); - -private: - - void MouseDown( BPoint point ); - void MouseUp( BPoint point ); - void MouseMoved( BPoint point, uint32 transit, const BMessage *message ); - - void Draw( BRect updateRect ); - void DrawArrowBox( uint32 x, bool facingleft ); - void DrawDotGrabber( uint32 x, uint32 size ); - void DrawLineGrabber( uint32 x, uint32 size ); - - bool fIsSelected; - bool fIsPressed; - bool fIsTracking; - - int32 fKnobStyle; - - bool fDoubleArrows; - bool fFixedThumb; - int32 fMinKnobSize; -}; - -#endif diff --git a/src/preferences/scrollbar/knobsizeadjuster.cpp b/src/preferences/scrollbar/knobsizeadjuster.cpp deleted file mode 100644 index 0aeb0c8637..0000000000 --- a/src/preferences/scrollbar/knobsizeadjuster.cpp +++ /dev/null @@ -1,175 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: knobsizeadjuster.cpp -// Author: MrSiggler -// DarkWyrm -// Description: Control for changing the minimum size of thumb for scrollbars -// -//------------------------------------------------------------------------------ -#include - -#include "ScrollBarApp.h" -#include "knobsizeadjuster.h" -#include "messages.h" - -#define MAXIMUM_KNOB_SIZE 50 -#define MINIMUM_KNOB_SIZE 9 - -KnobSizeAdjuster::KnobSizeAdjuster( BPoint position, uint32 size ) - :BControl( BRect(position.x, position.y, position.x+133, position.y+26), - "KnobSizeAdjuster", NULL, new BMessage(SCROLLBAR_KNOB_SIZE_CHANGED), - B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ) -{ - fKnobSize=size; -} - -void KnobSizeAdjuster::Draw( BRect updateRect ) -{ - SetViewColor( 216, 216, 216 ); - - // Draw border - SetHighColor( 216, 216, 216 ); - FillRect( Bounds() ); - - // Draw back - SetHighColor( 152, 152, 152 ); - StrokeLine( BPoint(4, 3), BPoint(Bounds().right-5, 3) ); - StrokeLine( BPoint(4, 17), BPoint(Bounds().right-5, 17) ); - - SetHighColor( 184, 184, 184 ); - FillRect( BRect(4, 4, Bounds().right-5, 5) ); - - SetHighColor( 200, 200, 200 ); - FillRect( BRect(4, 6, Bounds().right-5, 15) ); - StrokeLine( BPoint(3, 15), BPoint(3, 13) ); - StrokeLine( BPoint(Bounds().right-4, 7), BPoint(Bounds().right-4, 11) ); - StrokeLine( BPoint(Bounds().right-3, 9), BPoint(Bounds().right-3, 9) ); - - SetHighColor( 216, 216, 216 ); - StrokeLine( BPoint(4, 7), BPoint(4, 11) ); - StrokeLine( BPoint(5, 9), BPoint(5, 9) ); - StrokeLine( BPoint(Bounds().right-5, 15), BPoint(Bounds().right-5, 13) ); - - // Draw knob - SetHighColor( 216, 216, 216 ); - FillRect( BRect(41, 3, 41+fKnobSize, 17) ); - - SetHighColor( 152, 152, 152 ); - StrokeRect( BRect(41, 3, 41+fKnobSize, 17) ); - - SetHighColor( 255, 255, 255 ); - StrokeLine( BPoint(42, 4), BPoint(41+fKnobSize-1, 4) ); - StrokeLine( BPoint(42, 4), BPoint(42, 16) ); - - SetHighColor( 184, 184, 184 ); - StrokeLine( BPoint(42, 16), BPoint(41+fKnobSize-1, 16) ); - StrokeLine( BPoint(41+fKnobSize-1, 16), BPoint(41+fKnobSize-1, 4) ); - - SetHighColor( 96, 96, 96 ); - StrokeLine( BPoint(41+fKnobSize, 4), BPoint(41+fKnobSize, 16) ); - - // Draw slider - SetHighColor( 0, 255, 0 ); - FillTriangle( BPoint(41+fKnobSize, 18), BPoint(41+fKnobSize+5, 23), BPoint(41+fKnobSize-5, 23) ); - - SetHighColor( 0, 0, 0 ); - StrokeTriangle( BPoint(41+fKnobSize, 18), BPoint(41+fKnobSize+5, 23), - BPoint(41+fKnobSize-5, 23) ); -} - -void KnobSizeAdjuster::MouseDown( BPoint point ) -{ - int32 newsize=0; - - if ( point.x > 41+MINIMUM_KNOB_SIZE && point.x < MAXIMUM_KNOB_SIZE+41 ) - newsize = (int)point.x-41; - - if ( point.x <= 41+MINIMUM_KNOB_SIZE ) - newsize = MINIMUM_KNOB_SIZE; - - if ( point.x >= 41+MAXIMUM_KNOB_SIZE ) - newsize = MAXIMUM_KNOB_SIZE; - - SetKnobSize( newsize ); - - SetTracking( true ); -} - -void KnobSizeAdjuster::MouseUp( BPoint point ) -{ - SetTracking( false ); - Invoke(); -} - -void KnobSizeAdjuster::MouseMoved( BPoint point, uint32 transit, const BMessage *message ) -{ - int32 newsize=0; - - if ( transit == B_INSIDE_VIEW && IsTracking() == true ) - { - if ( point.x > 41+MINIMUM_KNOB_SIZE && point.x < MAXIMUM_KNOB_SIZE+41 ) - newsize = (int)point.x-41; - - if ( point.x <= 41+MINIMUM_KNOB_SIZE ) - newsize = MINIMUM_KNOB_SIZE; - - if ( point.x >= 41+MAXIMUM_KNOB_SIZE ) - newsize = MAXIMUM_KNOB_SIZE; - - SetKnobSize( newsize ); - } -} - -void KnobSizeAdjuster::SetKnobSize( int32 size ) -{ - fKnobSize=size; - gSettings.min_knob_size=fKnobSize; - - Invalidate(); -} - -void KnobSizeAdjuster::SetPressed( bool pressed ) -{ - fPressed=pressed; -} - -void KnobSizeAdjuster::SetTracking( bool tracking ) -{ - fTracking=tracking; - - if ( IsTracking() == true ) - SetEventMask( B_POINTER_EVENTS ); - else - SetEventMask( 0 ); -} - -bool KnobSizeAdjuster::IsPressed() -{ - return fPressed; -} - -bool KnobSizeAdjuster::IsTracking() -{ - return fTracking; -} - - diff --git a/src/preferences/scrollbar/knobsizeadjuster.h b/src/preferences/scrollbar/knobsizeadjuster.h deleted file mode 100644 index d02a1051d1..0000000000 --- a/src/preferences/scrollbar/knobsizeadjuster.h +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: knobsizeadjuster.h -// Author: MrSiggler -// DarkWyrm -// Description: Control for changing the minimum size of thumb for scrollbars -// -//------------------------------------------------------------------------------ -#ifndef SCROLLBAR_KNOB_ADJUSTER_H -#define SCROLLBAR_KNOB_ADJUSTER_H - -#include - -class KnobSizeAdjuster : public BControl -{ -public: - KnobSizeAdjuster( BPoint position, uint32 size ); - - void SetKnobSize( int32 size ); - void SetPressed( bool pressed ); - void SetTracking( bool tracking ); - bool IsPressed(); - bool IsTracking(); - - int32 KnobSize(void) const { return fKnobSize; } - -private: - - void Draw( BRect updateRect ); - void MouseDown( BPoint point ); - void MouseUp( BPoint point ); - void MouseMoved( BPoint point, uint32 transit, const BMessage *message ); - - int32 fKnobSize; - bool fPressed; - bool fTracking; -}; - -#endif \ No newline at end of file diff --git a/src/preferences/scrollbar/messages.h b/src/preferences/scrollbar/messages.h deleted file mode 100644 index 9405202759..0000000000 --- a/src/preferences/scrollbar/messages.h +++ /dev/null @@ -1,49 +0,0 @@ -//------------------------------------------------------------------------------ -// Copyright (c) 2001-2005, Haiku, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the "Software"), -// to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, -// and/or sell copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// File Name: messages.h -// Author: MrSiggler -// DarkWyrm -// Description: message defs -// -//------------------------------------------------------------------------------ -#ifndef SCROLLBAR_MESSAGES_H -#define SCROLLBAR_MESSAGES_H - -const uint32 SCROLLBAR_DEFAULTS = 'dflt'; -const uint32 SCROLLBAR_REVERT = 'rvrt'; - -const uint32 SCROLLBAR_ARROW_STYLE_NONE = 'anon'; -const uint32 SCROLLBAR_ARROW_STYLE_DOUBLE = 'adbl'; -const uint32 SCROLLBAR_ARROW_STYLE_SINGLE = 'asng'; - -const uint32 SCROLLBAR_KNOB_TYPE_PROPORTIONAL = 'ktpr'; -const uint32 SCROLLBAR_KNOB_TYPE_FIXED = 'ktfx'; - -const uint32 SCROLLBAR_KNOB_STYLE_FLAT = 'ksfl'; -const uint32 SCROLLBAR_KNOB_STYLE_DOT = 'ksdt'; -const uint32 SCROLLBAR_KNOB_STYLE_LINE = 'ksln'; - -const uint32 SCROLLBAR_KNOB_SIZE_CHANGED = 'ksch'; - -const uint32 TEST_MSG = 'tstm'; - -#endif