Patch from Pier Luigi Fiorini for layouts of Appearance and Keyboard preferences

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22531 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-10-13 13:06:33 +00:00
parent 993b0dbd3b
commit 4b3db10297
3 changed files with 24 additions and 15 deletions

View File

@ -48,7 +48,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BRect rect(Bounds().InsetByCopy(10,10));
BRect rect(Bounds().InsetByCopy(kBorderSpace,kBorderSpace));
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
@ -139,7 +139,7 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
rect.right = wellrect.right;
rect.OffsetTo((Bounds().Width()-rect.Width())/2,rect.top);
fPicker = new BColorControl(BPoint(10,fScrollView->Frame().bottom+20),B_CELLS_32x8,5.0,"fPicker",
fPicker = new BColorControl(BPoint(fScrollView->Frame().left,fScrollView->Frame().bottom+kBorderSpace),B_CELLS_32x8,5.0,"fPicker",
new BMessage(UPDATE_COLOR));
AddChild(fPicker);
@ -148,19 +148,19 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
B_FOLLOW_LEFT |B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
fDefaults->ResizeToPreferred();
fDefaults->SetEnabled(false);
fDefaults->MoveTo((fPicker->Frame().right-(fDefaults->Frame().Width()*2)-20)/2,fPicker->Frame().bottom+20);
fDefaults->MoveTo(fPicker->Frame().left,fPicker->Frame().bottom+kBorderSpace);
AddChild(fDefaults);
BRect cvrect(fDefaults->Frame());
cvrect.OffsetBy(cvrect.Width() + 20,0);
cvrect.OffsetBy(cvrect.Width() + kItemSpace,0);
fRevert = new BButton(cvrect,"RevertButton","Revert",
new BMessage(REVERT_SETTINGS),
B_FOLLOW_LEFT |B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
fRevert->ResizeToPreferred();
fRevert->SetEnabled(false);
AddChild(fRevert);
}
APRView::~APRView(void)

View File

@ -35,4 +35,9 @@
#define SET_UI_COLORS 'suic'
#define PREFS_CHOSEN 'prch'
// user interface
const uint32 kBorderSpace = 10;
const uint32 kItemSpace = 7;
#endif

View File

@ -19,6 +19,9 @@
#include "KeyboardView.h"
#include "KeyboardMessages.h"
// user interface
const uint32 kBorderSpace = 10;
const uint32 kItemSpace = 7;
KeyboardView::KeyboardView(BRect rect)
: BView(rect, "keyboard_view", B_FOLLOW_LEFT | B_FOLLOW_TOP,
@ -40,7 +43,7 @@ KeyboardView::KeyboardView(BRect rect)
fontHeight.leading;
// Create the "Key repeat rate" slider...
frame.Set(10,10,10 + labelwidth,10 + (labelheight*2) + 20);
frame.Set(kBorderSpace,kBorderSpace,kBorderSpace + labelwidth,kBorderSpace + (labelheight*2) + (kBorderSpace*2));
fRepeatSlider = new BSlider(frame,"key_repeat_rate",
"Key repeat rate",
new BMessage(SLIDER_REPEAT_RATE),
@ -52,7 +55,7 @@ KeyboardView::KeyboardView(BRect rect)
// Create the "Delay until key repeat" slider...
frame.OffsetBy(0,frame.Height() + 10);
frame.OffsetBy(0,frame.Height() + kBorderSpace);
fDelaySlider = new BSlider(frame,"delay_until_key_repeat",
"Delay until key repeat",
new BMessage(SLIDER_DELAY_RATE),250000,1000000,
@ -64,7 +67,7 @@ KeyboardView::KeyboardView(BRect rect)
// Create the "Typing test area" text box...
frame.OffsetBy(0,frame.Height() + 15);
frame.right = fDelaySlider->Frame().right + fIconBitmap->Bounds().Width() +
10;
kBorderSpace;
BTextControl *textcontrol = new BTextControl(frame,"typing_test_area",NULL,
"Typing test area",
new BMessage('TTEA'),
@ -76,10 +79,10 @@ KeyboardView::KeyboardView(BRect rect)
textcontrol->ResizeTo(frame.Width(),height);
// Create the box for the sliders...
frame.left = frame.top = 10;
frame.left = frame.top = kBorderSpace;
frame.right = frame.left + fDelaySlider->Frame().right +
fClockBitmap->Bounds().Width() + 20;
frame.bottom = textcontrol->Frame().bottom + 20;
fClockBitmap->Bounds().Width() + (kBorderSpace*2);
frame.bottom = textcontrol->Frame().bottom + (kBorderSpace*2);
fBox = new BBox(frame,"keyboard_box",B_FOLLOW_LEFT,B_WILL_DRAW,
B_FANCY_BORDER);
AddChild(fBox);
@ -89,8 +92,8 @@ KeyboardView::KeyboardView(BRect rect)
fBox->AddChild(textcontrol);
//Add the "Default" button..
frame.left = 10;
frame.top = fBox->Frame().bottom + 10;
frame.left = kBorderSpace;
frame.top = fBox->Frame().bottom + kBorderSpace;
frame.right = frame.left + 1;
frame.bottom = frame.top + 1;
BButton *button = new BButton(frame,"keyboard_defaults","Defaults",
@ -100,13 +103,14 @@ KeyboardView::KeyboardView(BRect rect)
// Add the "Revert" button...
frame = button->Frame();
frame.OffsetBy(frame.Width() + 10, 0);
frame.OffsetBy(frame.Width() + kItemSpace, 0);
button = new BButton(frame,"keyboard_revert","Revert",
new BMessage(BUTTON_REVERT));
button->ResizeToPreferred();
button->SetEnabled(false);
AddChild(button);
ResizeTo(fBox->Frame().right + 10, button->Frame().bottom + 10);
ResizeTo(fBox->Frame().right + kBorderSpace, button->Frame().bottom + kBorderSpace);
}
void