[haiku-commits] r34480 - in haiku/trunk: data/catalogs/preferences data/catalogs/preferences/touchpad src/preferences/touchpad

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 3 Dec 2009 22:46:36 +0100 (CET)

Author: czeidler
Date: 2009-12-03 22:46:36 +0100 (Thu, 03 Dec 2009)
New Revision: 34480
Changeset: http://dev.haiku-os.org/changeset/34480/haiku

Added:
   haiku/trunk/data/catalogs/preferences/touchpad/
   haiku/trunk/data/catalogs/preferences/touchpad/en.catkeys
Modified:
   haiku/trunk/src/preferences/touchpad/Jamfile
   haiku/trunk/src/preferences/touchpad/TouchpadPrefView.cpp
   haiku/trunk/src/preferences/touchpad/TouchpadPrefView.h
   haiku/trunk/src/preferences/touchpad/main.cpp
Log:
Touchpad preferences using the local kit now.
Style cleanup. Patch by mt thanks!



Added: haiku/trunk/data/catalogs/preferences/touchpad/en.catkeys
===================================================================
--- haiku/trunk/data/catalogs/preferences/touchpad/en.catkeys                   
        (rev 0)
+++ haiku/trunk/data/catalogs/preferences/touchpad/en.catkeys   2009-12-03 
21:46:36 UTC (rev 34480)
@@ -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

Modified: haiku/trunk/src/preferences/touchpad/Jamfile
===================================================================
--- haiku/trunk/src/preferences/touchpad/Jamfile        2009-12-03 21:45:50 UTC 
(rev 34479)
+++ haiku/trunk/src/preferences/touchpad/Jamfile        2009-12-03 21:46:36 UTC 
(rev 34480)
@@ -2,10 +2,18 @@
 
 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
+       ;

Modified: haiku/trunk/src/preferences/touchpad/TouchpadPrefView.cpp
===================================================================
--- haiku/trunk/src/preferences/touchpad/TouchpadPrefView.cpp   2009-12-03 
21:45:50 UTC (rev 34479)
+++ haiku/trunk/src/preferences/touchpad/TouchpadPrefView.cpp   2009-12-03 
21:46:36 UTC (rev 34480)
@@ -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 @@
 
        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 @@
                DrawSliders();
        }
 
-       if (fYTracking){
+       if (fYTracking) {
                if (point.y > fPadRect.bottom)
                        fYScrollRange = fPadRect.Height();
                else if (point.y < fPadRect.top)
@@ -175,7 +176,7 @@
 void
 TouchpadView::DrawSliders()
 {
-       BView *view;
+       BView* view;
        if (fOffScreenView != NULL)
                view = fOffScreenView;
        else
@@ -253,10 +254,13 @@
 
 //     #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()
 {
 }
@@ -351,39 +354,38 @@
 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 @@
        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());

Modified: haiku/trunk/src/preferences/touchpad/TouchpadPrefView.h
===================================================================
--- haiku/trunk/src/preferences/touchpad/TouchpadPrefView.h     2009-12-03 
21:45:50 UTC (rev 34479)
+++ haiku/trunk/src/preferences/touchpad/TouchpadPrefView.h     2009-12-03 
21:46:36 UTC (rev 34480)
@@ -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 @@
 };
 
 
-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();

Modified: haiku/trunk/src/preferences/touchpad/main.cpp
===================================================================
--- haiku/trunk/src/preferences/touchpad/main.cpp       2009-12-03 21:45:50 UTC 
(rev 34479)
+++ haiku/trunk/src/preferences/touchpad/main.cpp       2009-12-03 21:46:36 UTC 
(rev 34480)
@@ -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 @@
        }
 };
 
+#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();
 


Other related posts: