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:
@@ -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
|
||||||
@@ -2,10 +2,18 @@ SubDir HAIKU_TOP src preferences touchpad ;
|
|||||||
|
|
||||||
UsePrivateHeaders input ;
|
UsePrivateHeaders input ;
|
||||||
|
|
||||||
Preference Touchpad :
|
Preference Touchpad :
|
||||||
TouchpadPref.cpp
|
TouchpadPref.cpp
|
||||||
TouchpadPrefView.cpp
|
TouchpadPrefView.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
: be $(TARGET_LIBSUPC++)
|
: be $(TARGET_LIBSUPC++) liblocale.so
|
||||||
: Touchpad.rdef
|
: Touchpad.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs Touchpad :
|
||||||
|
x-vnd.Haiku-Appearance
|
||||||
|
:
|
||||||
|
TouchpadPrefView.cpp
|
||||||
|
main.cpp
|
||||||
|
: en.catalog
|
||||||
|
;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -93,7 +94,7 @@ TouchpadView::MouseUp(BPoint point)
|
|||||||
|
|
||||||
int32 result = 0;
|
int32 result = 0;
|
||||||
if (GetRightScrollRatio() > 0.7 || GetBottomScrollRatio() > 0.7) {
|
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 new scroll area is very small. Do you really want to change "
|
||||||
"the scroll area?", "Ok", "Cancel", NULL, B_WIDTH_AS_USUAL,
|
"the scroll area?", "Ok", "Cancel", NULL, B_WIDTH_AS_USUAL,
|
||||||
B_WARNING_ALERT);
|
B_WARNING_ALERT);
|
||||||
@@ -158,7 +159,7 @@ TouchpadView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
|||||||
DrawSliders();
|
DrawSliders();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fYTracking){
|
if (fYTracking) {
|
||||||
if (point.y > fPadRect.bottom)
|
if (point.y > fPadRect.bottom)
|
||||||
fYScrollRange = fPadRect.Height();
|
fYScrollRange = fPadRect.Height();
|
||||||
else if (point.y < fPadRect.top)
|
else if (point.y < fPadRect.top)
|
||||||
@@ -175,7 +176,7 @@ TouchpadView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
|||||||
void
|
void
|
||||||
TouchpadView::DrawSliders()
|
TouchpadView::DrawSliders()
|
||||||
{
|
{
|
||||||
BView *view;
|
BView* view;
|
||||||
if (fOffScreenView != NULL)
|
if (fOffScreenView != NULL)
|
||||||
view = fOffScreenView;
|
view = fOffScreenView;
|
||||||
else
|
else
|
||||||
@@ -253,10 +254,13 @@ TouchpadView::DrawSliders()
|
|||||||
|
|
||||||
// #pragma mark - TouchpadPrefView
|
// #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();
|
SetupView();
|
||||||
// set view values
|
// set view values
|
||||||
@@ -264,7 +268,6 @@ TouchpadPrefView::TouchpadPrefView(BRect frame, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TouchpadPrefView::~TouchpadPrefView()
|
TouchpadPrefView::~TouchpadPrefView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -351,39 +354,38 @@ void
|
|||||||
TouchpadPrefView::SetupView()
|
TouchpadPrefView::SetupView()
|
||||||
{
|
{
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
BRect rect = Bounds();
|
BBox* scrollBox = new BBox("Touchpad");
|
||||||
rect.InsetBy(5, 5);
|
scrollBox->SetLabel(TR("Scrolling"));
|
||||||
BBox* scrollBox = new BBox(rect, "Touchpad");
|
|
||||||
scrollBox->SetLabel("Scrolling");
|
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
|
|
||||||
fTouchpadView = new TouchpadView(BRect(0,0,130,120));
|
fTouchpadView = new TouchpadView(BRect(0, 0, 130, 120));
|
||||||
fTouchpadView->SetExplicitMaxSize(BSize(130, 120));
|
fTouchpadView->SetExplicitMaxSize(BSize(130, 120));
|
||||||
|
|
||||||
// Create the "Mouse Speed" slider...
|
// Create the "Mouse Speed" slider...
|
||||||
fScrollAccelSlider = new BSlider(rect, "scroll_accel",
|
fScrollAccelSlider = new BSlider("scroll_accel",
|
||||||
"Scroll Acceleration", new BMessage(SCROLL_CONTROL_CHANGED), 0, 20);
|
TR("Scroll Acceleration"), new BMessage(SCROLL_CONTROL_CHANGED),
|
||||||
|
0, 20, B_HORIZONTAL);
|
||||||
fScrollAccelSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fScrollAccelSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fScrollAccelSlider->SetHashMarkCount(7);
|
fScrollAccelSlider->SetHashMarkCount(7);
|
||||||
fScrollAccelSlider->SetLimitLabels("Slow", "Fast");
|
fScrollAccelSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
|
||||||
|
|
||||||
fScrollStepXSlider = new BSlider(rect, "scroll_stepX",
|
fScrollStepXSlider = new BSlider("scroll_stepX",
|
||||||
"Horizontal Scroll Step Size", new BMessage(SCROLL_CONTROL_CHANGED), 0,
|
TR("Horizontal Scroll Step Size"),
|
||||||
20);
|
new BMessage(SCROLL_CONTROL_CHANGED),
|
||||||
|
0, 20, B_HORIZONTAL);
|
||||||
fScrollStepXSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fScrollStepXSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fScrollStepXSlider->SetHashMarkCount(7);
|
fScrollStepXSlider->SetHashMarkCount(7);
|
||||||
fScrollStepXSlider->SetLimitLabels("Wide", "Small");
|
fScrollStepXSlider->SetLimitLabels(TR("Wide"), TR("Small"));
|
||||||
|
|
||||||
fScrollStepYSlider = new BSlider(rect, "scroll_stepY",
|
fScrollStepYSlider = new BSlider("scroll_stepY",
|
||||||
"Vertical Scroll Step Size", new BMessage(SCROLL_CONTROL_CHANGED), 0,
|
TR("Vertical Scroll Step Size"), new BMessage(SCROLL_CONTROL_CHANGED),
|
||||||
20);
|
0, 20, B_HORIZONTAL);
|
||||||
fScrollStepYSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fScrollStepYSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fScrollStepYSlider->SetHashMarkCount(7);
|
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));
|
new BMessage(SCROLL_CONTROL_CHANGED));
|
||||||
fTwoFingerHorizontalBox = new BCheckBox("Horizontal Scrolling",
|
fTwoFingerHorizontalBox = new BCheckBox(TR("Horizontal Scrolling"),
|
||||||
new BMessage(SCROLL_CONTROL_CHANGED));
|
new BMessage(SCROLL_CONTROL_CHANGED));
|
||||||
|
|
||||||
BGroupView* scrollPrefLeftLayout = new BGroupView(B_VERTICAL);
|
BGroupView* scrollPrefLeftLayout = new BGroupView(B_VERTICAL);
|
||||||
@@ -409,28 +411,29 @@ TouchpadPrefView::SetupView()
|
|||||||
scrollPrefLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(15));
|
scrollPrefLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(15));
|
||||||
scrollPrefLayout->AddView(scrollPrefRightLayout);
|
scrollPrefLayout->AddView(scrollPrefRightLayout);
|
||||||
|
|
||||||
BBox* tapBox = new BBox(rect, "tapbox");
|
BBox* tapBox = new BBox("tapbox");
|
||||||
tapBox->SetLabel("Tap Gesture");
|
tapBox->SetLabel(TR("Tap Gesture"));
|
||||||
|
|
||||||
BGroupLayout* tapPrefLayout = new BGroupLayout(B_HORIZONTAL);
|
BGroupLayout* tapPrefLayout = new BGroupLayout(B_HORIZONTAL);
|
||||||
tapPrefLayout->SetInsets(10, tapBox->TopBorderOffset() * 2 + 10, 10, 10);
|
tapPrefLayout->SetInsets(10, tapBox->TopBorderOffset() * 2 + 10, 10, 10);
|
||||||
tapBox->SetLayout(tapPrefLayout);
|
tapBox->SetLayout(tapPrefLayout);
|
||||||
|
|
||||||
fTapSlider = new BSlider(rect, "tap_sens", "Tap Click Sensitivity",
|
fTapSlider = new BSlider("tap_sens", TR("Tap Click Sensitivity"),
|
||||||
new BMessage(TAP_CONTROL_CHANGED), 0, 20);
|
new BMessage(TAP_CONTROL_CHANGED), 0, 20, B_HORIZONTAL);
|
||||||
fTapSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
fTapSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
|
||||||
fTapSlider->SetHashMarkCount(7);
|
fTapSlider->SetHashMarkCount(7);
|
||||||
fTapSlider->SetLimitLabels("Off", "High");
|
fTapSlider->SetLimitLabels(TR("Off"), TR("High"));
|
||||||
|
|
||||||
tapPrefLayout->AddView(fTapSlider);
|
tapPrefLayout->AddView(fTapSlider);
|
||||||
|
|
||||||
BGroupView* buttonView = new BGroupView(B_HORIZONTAL);
|
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->AddChild(fDefaultButton);
|
||||||
buttonView->GetLayout()->AddItem(
|
buttonView->GetLayout()->AddItem(
|
||||||
BSpaceLayoutItem::CreateHorizontalStrut(7));
|
BSpaceLayoutItem::CreateHorizontalStrut(7));
|
||||||
fRevertButton = new BButton("Revert", new BMessage(REVERT_SETTINGS));
|
fRevertButton = new BButton(TR("Revert"), new BMessage(REVERT_SETTINGS));
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
buttonView->AddChild(fRevertButton);
|
buttonView->AddChild(fRevertButton);
|
||||||
buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <Invoker.h>
|
#include <Invoker.h>
|
||||||
#include <Slider.h>
|
#include <Slider.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include <GroupView.h>
|
||||||
|
|
||||||
#include "TouchpadPref.h"
|
#include "TouchpadPref.h"
|
||||||
#include "touchpad_settings.h"
|
#include "touchpad_settings.h"
|
||||||
@@ -78,9 +79,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TouchpadPrefView : public BView {
|
class TouchpadPrefView : public BGroupView {
|
||||||
public:
|
public:
|
||||||
TouchpadPrefView(BRect frame, const char* name);
|
TouchpadPrefView();
|
||||||
virtual ~TouchpadPrefView();
|
virtual ~TouchpadPrefView();
|
||||||
virtual void MessageReceived(BMessage* msg);
|
virtual void MessageReceived(BMessage* msg);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <GroupLayout.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
|
||||||
#include "TouchpadPrefView.h"
|
#include "TouchpadPrefView.h"
|
||||||
|
|
||||||
@@ -28,16 +32,25 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "TouchpadMain"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* argv[])
|
main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
BApplication* app = new BApplication("application/x-vnd.Haiku-Touchpad");
|
BApplication* app = new BApplication("application/x-vnd.Haiku-Touchpad");
|
||||||
|
BCatalog fCatalog;
|
||||||
|
|
||||||
|
be_locale->GetAppCatalog(&fCatalog);
|
||||||
TouchpadPrefWindow* window = new TouchpadPrefWindow(BRect(50, 50, 450, 350),
|
TouchpadPrefWindow* window = new TouchpadPrefWindow(BRect(50, 50, 450, 350),
|
||||||
"Touchpad", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
|
TR("Touchpad"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
|
||||||
| B_ASYNCHRONOUS_CONTROLS);
|
| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS);
|
||||||
window->AddChild(
|
window->SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
new TouchpadPrefView(window->Bounds(), "TouchpadPrefView"));
|
window->AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
|
||||||
|
.Add(new TouchpadPrefView())
|
||||||
|
.End()
|
||||||
|
.SetInsets(5, 5, 5, 5)
|
||||||
|
);
|
||||||
window->Show();
|
window->Show();
|
||||||
app->Run();
|
app->Run();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user