Touchpad preferences using the local kit now.

Style cleanup. Patch by mt thanks!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34480 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2009-12-03 21:46:36 +00:00
parent 1e752e59df
commit 63a39e24d0
5 changed files with 83 additions and 40 deletions

View File

@ -0,0 +1,18 @@
1 english x-vnd.Haiku-Touchpad 363566569
Scrolling TouchpadPrefView Scrolling
Revert TouchpadPrefView Revert
Two Finger Scrolling TouchpadPrefView Two Finger Scrolling
Defaults TouchpadPrefView Defaults
Slow TouchpadPrefView Slow
Tap Gesture TouchpadPrefView Tap Gesture
Tap Click Sensitivity TouchpadPrefView Tap Click Sensitivity
High TouchpadPrefView High
Horizontal Scroll Step Size TouchpadPrefView Horizontal Scroll Step Size
Wide TouchpadPrefView Wide
Fast TouchpadPrefView Fast
Vertical Scroll Step Size TouchpadPrefView Vertical Scroll Step Size
Off TouchpadPrefView Off
Small TouchpadPrefView Small
Scroll Acceleration TouchpadPrefView Scroll Acceleration
Touchpad TouchpadMain Touchpad
Horizontal Scrolling TouchpadPrefView Horizontal Scrolling

View File

@ -2,10 +2,18 @@ SubDir HAIKU_TOP src preferences touchpad ;
UsePrivateHeaders input ;
Preference Touchpad :
Preference Touchpad :
TouchpadPref.cpp
TouchpadPrefView.cpp
main.cpp
: be $(TARGET_LIBSUPC++)
: be $(TARGET_LIBSUPC++) liblocale.so
: Touchpad.rdef
;
DoCatalogs Touchpad :
x-vnd.Haiku-Appearance
:
TouchpadPrefView.cpp
main.cpp
: en.catalog
;

View File

@ -13,6 +13,7 @@
#include <Alert.h>
#include <Box.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <File.h>
#include <FindDirectory.h>
@ -93,7 +94,7 @@ TouchpadView::MouseUp(BPoint point)
int32 result = 0;
if (GetRightScrollRatio() > 0.7 || GetBottomScrollRatio() > 0.7) {
BAlert *alert = new BAlert("ReallyChangeScrollArea",
BAlert* alert = new BAlert("ReallyChangeScrollArea",
"The new scroll area is very small. Do you really want to change "
"the scroll area?", "Ok", "Cancel", NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT);
@ -158,7 +159,7 @@ TouchpadView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
DrawSliders();
}
if (fYTracking){
if (fYTracking) {
if (point.y > fPadRect.bottom)
fYScrollRange = fPadRect.Height();
else if (point.y < fPadRect.top)
@ -175,7 +176,7 @@ TouchpadView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
void
TouchpadView::DrawSliders()
{
BView *view;
BView* view;
if (fOffScreenView != NULL)
view = fOffScreenView;
else
@ -253,10 +254,13 @@ TouchpadView::DrawSliders()
// #pragma mark - TouchpadPrefView
#undef TR_CONTEXT
#define TR_CONTEXT "TouchpadPrefView"
TouchpadPrefView::TouchpadPrefView(BRect frame, const char *name)
TouchpadPrefView::TouchpadPrefView()
:
BView(frame, name, B_FOLLOW_ALL_SIDES, 0)
BGroupView()
{
SetupView();
// set view values
@ -264,7 +268,6 @@ TouchpadPrefView::TouchpadPrefView(BRect frame, const char *name)
}
TouchpadPrefView::~TouchpadPrefView()
{
}
@ -351,39 +354,38 @@ void
TouchpadPrefView::SetupView()
{
SetLayout(new BGroupLayout(B_VERTICAL));
BRect rect = Bounds();
rect.InsetBy(5, 5);
BBox* scrollBox = new BBox(rect, "Touchpad");
scrollBox->SetLabel("Scrolling");
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BBox* scrollBox = new BBox("Touchpad");
scrollBox->SetLabel(TR("Scrolling"));
fTouchpadView = new TouchpadView(BRect(0,0,130,120));
fTouchpadView = new TouchpadView(BRect(0, 0, 130, 120));
fTouchpadView->SetExplicitMaxSize(BSize(130, 120));
// Create the "Mouse Speed" slider...
fScrollAccelSlider = new BSlider(rect, "scroll_accel",
"Scroll Acceleration", new BMessage(SCROLL_CONTROL_CHANGED), 0, 20);
fScrollAccelSlider = new BSlider("scroll_accel",
TR("Scroll Acceleration"), new BMessage(SCROLL_CONTROL_CHANGED),
0, 20, B_HORIZONTAL);
fScrollAccelSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fScrollAccelSlider->SetHashMarkCount(7);
fScrollAccelSlider->SetLimitLabels("Slow", "Fast");
fScrollAccelSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
fScrollStepXSlider = new BSlider(rect, "scroll_stepX",
"Horizontal Scroll Step Size", new BMessage(SCROLL_CONTROL_CHANGED), 0,
20);
fScrollStepXSlider = new BSlider("scroll_stepX",
TR("Horizontal Scroll Step Size"),
new BMessage(SCROLL_CONTROL_CHANGED),
0, 20, B_HORIZONTAL);
fScrollStepXSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fScrollStepXSlider->SetHashMarkCount(7);
fScrollStepXSlider->SetLimitLabels("Wide", "Small");
fScrollStepXSlider->SetLimitLabels(TR("Wide"), TR("Small"));
fScrollStepYSlider = new BSlider(rect, "scroll_stepY",
"Vertical Scroll Step Size", new BMessage(SCROLL_CONTROL_CHANGED), 0,
20);
fScrollStepYSlider = new BSlider("scroll_stepY",
TR("Vertical Scroll Step Size"), new BMessage(SCROLL_CONTROL_CHANGED),
0, 20, B_HORIZONTAL);
fScrollStepYSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fScrollStepYSlider->SetHashMarkCount(7);
fScrollStepYSlider->SetLimitLabels("Wide", "Small");
fScrollStepYSlider->SetLimitLabels(TR("Wide"), TR("Small"));
fTwoFingerBox = new BCheckBox("Two Finger Scrolling",
fTwoFingerBox = new BCheckBox(TR("Two Finger Scrolling"),
new BMessage(SCROLL_CONTROL_CHANGED));
fTwoFingerHorizontalBox = new BCheckBox("Horizontal Scrolling",
fTwoFingerHorizontalBox = new BCheckBox(TR("Horizontal Scrolling"),
new BMessage(SCROLL_CONTROL_CHANGED));
BGroupView* scrollPrefLeftLayout = new BGroupView(B_VERTICAL);
@ -409,28 +411,29 @@ TouchpadPrefView::SetupView()
scrollPrefLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(15));
scrollPrefLayout->AddView(scrollPrefRightLayout);
BBox* tapBox = new BBox(rect, "tapbox");
tapBox->SetLabel("Tap Gesture");
BBox* tapBox = new BBox("tapbox");
tapBox->SetLabel(TR("Tap Gesture"));
BGroupLayout* tapPrefLayout = new BGroupLayout(B_HORIZONTAL);
tapPrefLayout->SetInsets(10, tapBox->TopBorderOffset() * 2 + 10, 10, 10);
tapBox->SetLayout(tapPrefLayout);
fTapSlider = new BSlider(rect, "tap_sens", "Tap Click Sensitivity",
new BMessage(TAP_CONTROL_CHANGED), 0, 20);
fTapSlider = new BSlider("tap_sens", TR("Tap Click Sensitivity"),
new BMessage(TAP_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
fTapSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fTapSlider->SetHashMarkCount(7);
fTapSlider->SetLimitLabels("Off", "High");
fTapSlider->SetLimitLabels(TR("Off"), TR("High"));
tapPrefLayout->AddView(fTapSlider);
BGroupView* buttonView = new BGroupView(B_HORIZONTAL);
fDefaultButton = new BButton("Defaults", new BMessage(DEFAULT_SETTINGS));
fDefaultButton = new BButton(TR("Defaults"),
new BMessage(DEFAULT_SETTINGS));
buttonView->AddChild(fDefaultButton);
buttonView->GetLayout()->AddItem(
BSpaceLayoutItem::CreateHorizontalStrut(7));
fRevertButton = new BButton("Revert", new BMessage(REVERT_SETTINGS));
fRevertButton = new BButton(TR("Revert"), new BMessage(REVERT_SETTINGS));
fRevertButton->SetEnabled(false);
buttonView->AddChild(fRevertButton);
buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

View File

@ -15,6 +15,7 @@
#include <Invoker.h>
#include <Slider.h>
#include <View.h>
#include <GroupView.h>
#include "TouchpadPref.h"
#include "touchpad_settings.h"
@ -78,9 +79,9 @@ private:
};
class TouchpadPrefView : public BView {
class TouchpadPrefView : public BGroupView {
public:
TouchpadPrefView(BRect frame, const char* name);
TouchpadPrefView();
virtual ~TouchpadPrefView();
virtual void MessageReceived(BMessage* msg);
virtual void AttachedToWindow();

View File

@ -9,6 +9,10 @@
#include <Application.h>
#include <Window.h>
#include <Catalog.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include "TouchpadPrefView.h"
@ -28,16 +32,25 @@ public:
}
};
#undef TR_CONTEXT
#define TR_CONTEXT "TouchpadMain"
int
main(int argc, char* argv[])
{
BApplication* app = new BApplication("application/x-vnd.Haiku-Touchpad");
BCatalog fCatalog;
be_locale->GetAppCatalog(&fCatalog);
TouchpadPrefWindow* window = new TouchpadPrefWindow(BRect(50, 50, 450, 350),
"Touchpad", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
| B_ASYNCHRONOUS_CONTROLS);
window->AddChild(
new TouchpadPrefView(window->Bounds(), "TouchpadPrefView"));
TR("Touchpad"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS);
window->SetLayout(new BGroupLayout(B_HORIZONTAL));
window->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
.Add(new TouchpadPrefView())
.End()
.SetInsets(5, 5, 5, 5)
);
window->Show();
app->Run();