[haiku-commits] r34118 - in haiku/trunk: data/catalogs/preferences data/catalogs/preferences/keyboard data/catalogs/preferences/mouse src/preferences/keyboard src/preferences/mouse

  • From: pulkomandy@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 18 Nov 2009 21:13:57 +0100 (CET)

Author: pulkomandy
Date: 2009-11-18 21:13:56 +0100 (Wed, 18 Nov 2009)
New Revision: 34118
Changeset: http://dev.haiku-os.org/changeset/34118/haiku

Added:
   haiku/trunk/data/catalogs/preferences/keyboard/
   haiku/trunk/data/catalogs/preferences/keyboard/fr.catkeys
   haiku/trunk/data/catalogs/preferences/mouse/
   haiku/trunk/data/catalogs/preferences/mouse/fr.catkeys
Modified:
   haiku/trunk/src/preferences/keyboard/Jamfile
   haiku/trunk/src/preferences/keyboard/Keyboard.cpp
   haiku/trunk/src/preferences/keyboard/Keyboard.h
   haiku/trunk/src/preferences/keyboard/KeyboardView.cpp
   haiku/trunk/src/preferences/keyboard/KeyboardView.h
   haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp
   haiku/trunk/src/preferences/keyboard/KeyboardWindow.h
   haiku/trunk/src/preferences/mouse/Jamfile
   haiku/trunk/src/preferences/mouse/Mouse.cpp
   haiku/trunk/src/preferences/mouse/Mouse.h
   haiku/trunk/src/preferences/mouse/MouseWindow.cpp
   haiku/trunk/src/preferences/mouse/SettingsView.cpp
Log:
Localization for keyboard and mouse preflet by mt. Thanks !
French localization by me. Please improve !


Added: haiku/trunk/data/catalogs/preferences/keyboard/fr.catkeys
===================================================================
--- haiku/trunk/data/catalogs/preferences/keyboard/fr.catkeys                   
        (rev 0)
+++ haiku/trunk/data/catalogs/preferences/keyboard/fr.catkeys   2009-11-18 
20:13:56 UTC (rev 34118)
@@ -0,0 +1,14 @@
+1      french  x-vnd.Haiku-Keyboard    914649575
+Keyboard       KeyboardWindow          Clavier
+Written by Andrew Edward McCall        KeyboardApplication             Écrit 
par Andrew Edward McCall
+Typing test area       KeyboardView            Zone de test de frappe
+Defaults       KeyboardWindow          Défauts
+Key repeat rate        KeyboardView            Vitesse de répétition des 
touches
+Revert KeyboardWindow          Défaire
+Delay until key repeat KeyboardView            Délai avant répétition des 
touches
+OK     KeyboardApplication             OK
+Fast   KeyboardView            Rapide
+Slow   KeyboardView            Lent
+Something has gone wrong!      KeyboardApplication             Quelque chose 
s'est mal passé !
+Long   KeyboardView            Long
+Short  KeyboardView            Court

Added: haiku/trunk/data/catalogs/preferences/mouse/fr.catkeys
===================================================================
--- haiku/trunk/data/catalogs/preferences/mouse/fr.catkeys                      
        (rev 0)
+++ haiku/trunk/data/catalogs/preferences/mouse/fr.catkeys      2009-11-18 
20:13:56 UTC (rev 34118)
@@ -0,0 +1,24 @@
+1      french  x-vnd.Haiku-Mouse       3306943515
+Mouse type:    SettingsView            Type de souris :
+Warp   SettingsView            Téléporter
+2-Button       SettingsView            2 boutons
+Double-click test area SettingsView            Zone de test du double clic
+Revert MouseWindow             Défaire
+...by Andrew Edward McCall     MouseApplication                ...par Andrew 
Edward McCall
+Focus Follows Mouse    SettingsView            Le focus suit le pointeur
+Mouse Acceleration     SettingsView            Accélération de la souris
+Click to Focus SettingsView            Cliquer pour focus
+3-Button       SettingsView            3 boutons
+Focus mode:    SettingsView            Méthode de focus :
+Mouse Speed    SettingsView            Vitesse de la souris
+Dig Deal       MouseApplication                Dig Deal
+1-Button       SettingsView            1 bouton
+Double-click speed     SettingsView            Vitesse du double clic
+Instant Warp   SettingsView            Téléportation instantanée
+Defaults       MouseWindow             Défauts
+Accept first click     SettingsView            Accepter le premier clic
+Fast   SettingsView            Rapide
+Normal SettingsView            Normal
+Mouse  MouseWindow             Souris
+Slow   SettingsView            Lent
+Click to Activate      SettingsView            Cliquer pour activer

Modified: haiku/trunk/src/preferences/keyboard/Jamfile
===================================================================
--- haiku/trunk/src/preferences/keyboard/Jamfile        2009-11-18 17:14:58 UTC 
(rev 34117)
+++ haiku/trunk/src/preferences/keyboard/Jamfile        2009-11-18 20:13:56 UTC 
(rev 34118)
@@ -14,6 +14,16 @@
        KeyboardSettings.cpp 
        KeyboardView.cpp 
        KeyboardWindow.cpp
-       : translation be $(TARGET_LIBSUPC++)
+       : translation be $(TARGET_LIBSUPC++) liblocale.so
        : Keyboard.rdef
        ;
+
+DoCatalogs Keyboard :
+       x-vnd.Haiku-Keyboard
+       :
+       Keyboard.cpp
+       KeyboardWindow.cpp
+       KeyboardView.cpp
+       : en.catalog
+       : fr.catkeys
+       ;

Modified: haiku/trunk/src/preferences/keyboard/Keyboard.cpp
===================================================================
--- haiku/trunk/src/preferences/keyboard/Keyboard.cpp   2009-11-18 17:14:58 UTC 
(rev 34117)
+++ haiku/trunk/src/preferences/keyboard/Keyboard.cpp   2009-11-18 20:13:56 UTC 
(rev 34118)
@@ -15,10 +15,13 @@
 
 #include <Alert.h>
 
+#undef TR_CONTEXT
+#define TR_CONTEXT "KeyboardApplication"
 
 KeyboardApplication::KeyboardApplication()
        : BApplication("application/x-vnd.Haiku-Keyboard")
 {
+       be_locale->GetAppCatalog(&fCatalog);
        new KeyboardWindow();
 }
 
@@ -26,11 +29,11 @@
 void
 KeyboardApplication::MessageReceived(BMessage* message)
 {
-       switch(message->what) {
+       switch (message->what) {
                case ERROR_DETECTED:
                {
-                       BAlert *errorAlert = new BAlert("Error", "Something has 
gone wrong!",
-                               "OK", NULL, NULL, B_WIDTH_AS_USUAL, 
B_OFFSET_SPACING,
+                       BAlert* errorAlert = new BAlert("Error", TR("Something 
has gone wrong!"),
+                               TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, 
B_OFFSET_SPACING,
                                B_WARNING_ALERT);
                        errorAlert->Go();
                        be_app->PostMessage(B_QUIT_REQUESTED);
@@ -46,7 +49,7 @@
 void
 KeyboardApplication::AboutRequested()
 {
-       (new BAlert("about", "Written by Andrew Edward McCall", "OK"))->Go();
+       (new BAlert("about", TR("Written by Andrew Edward McCall"), 
TR("OK")))->Go();
 }
 
 

Modified: haiku/trunk/src/preferences/keyboard/Keyboard.h
===================================================================
--- haiku/trunk/src/preferences/keyboard/Keyboard.h     2009-11-18 17:14:58 UTC 
(rev 34117)
+++ haiku/trunk/src/preferences/keyboard/Keyboard.h     2009-11-18 20:13:56 UTC 
(rev 34118)
@@ -11,14 +11,19 @@
 #define KEYBOARD_H
 
 #include <Application.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 class KeyboardApplication : public BApplication 
 {
 public:
-                       KeyboardApplication();
+       KeyboardApplication();
        
-       void    MessageReceived(BMessage *message);
+       void    MessageReceived(BMessage* message);
        void    AboutRequested(void);
+       
+private:
+       BCatalog fCatalog;
 };
 
 #endif

Modified: haiku/trunk/src/preferences/keyboard/KeyboardView.cpp
===================================================================
--- haiku/trunk/src/preferences/keyboard/KeyboardView.cpp       2009-11-18 
17:14:58 UTC (rev 34117)
+++ haiku/trunk/src/preferences/keyboard/KeyboardView.cpp       2009-11-18 
20:13:56 UTC (rev 34118)
@@ -11,108 +11,72 @@
 #include <TranslationUtils.h>
 #include <Bitmap.h>
 #include <Button.h>
+#include <Catalog.h>
+#include <GroupLayout.h>
+#include <GroupLayoutBuilder.h>
+#include <Locale.h>
 #include <Slider.h>
 #include <TextControl.h>
 #include <Window.h>
-#include <Font.h>
 
 #include "KeyboardView.h"
 #include "KeyboardMessages.h"
+#include "KeyboardSettings.h"
 
-// user interface
-const uint32 kBorderSpace = 10;
-const uint32 kItemSpace = 7;
+#undef TR_CONTEXT
+#define TR_CONTEXT "KeyboardView"
 
-KeyboardView::KeyboardView(BRect rect)
- :     BView(rect, "keyboard_view", B_FOLLOW_LEFT | B_FOLLOW_TOP,
-                 B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP)
-{
-       BRect frame;
-
-       SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
-       
+KeyboardView::KeyboardView()
+ :     BGroupView()
+{      
        fIconBitmap = BTranslationUtils::GetBitmap("key_bmap");
        fClockBitmap = BTranslationUtils::GetBitmap("clock_bmap");
 
-       float labelwidth = StringWidth("Delay until key repeat")+20;
-       
-       font_height fontHeight;
-       be_plain_font->GetHeight(&fontHeight);
-       
-       float labelheight = fontHeight.ascent + fontHeight.descent +
-                                               fontHeight.leading;
-       
        // Create the "Key repeat rate" slider...
-       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),
-                                                                               
20,300,B_BLOCK_THUMB,
-                                                                               
B_FOLLOW_LEFT,B_WILL_DRAW);
+       fRepeatSlider = new BSlider("key_repeat_rate",
+                                               TR("Key repeat rate"),
+                                               new 
BMessage(SLIDER_REPEAT_RATE),
+                                               20, 300, B_HORIZONTAL);
        fRepeatSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
        fRepeatSlider->SetHashMarkCount(5);
-       fRepeatSlider->SetLimitLabels("Slow","Fast");
+       fRepeatSlider->SetLimitLabels(TR("Slow"),TR("Fast"));
        
        
        // Create the "Delay until key repeat" slider...
-       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,
-                                               
B_BLOCK_THUMB,B_FOLLOW_LEFT,B_WILL_DRAW);
+       fDelaySlider = new BSlider("delay_until_key_repeat",
+                                               TR("Delay until key repeat"),
+                                               new BMessage(SLIDER_DELAY_RATE),
+                                               250000, 1000000, B_HORIZONTAL);
        fDelaySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
        fDelaySlider->SetHashMarkCount(4);
-       fDelaySlider->SetLimitLabels("Short","Long");
+       fDelaySlider->SetLimitLabels(TR("Short"),TR("Long"));
        
        // Create the "Typing test area" text box...
-       frame.OffsetBy(0,frame.Height() + 15);
-       frame.right = fDelaySlider->Frame().right + kBorderSpace
-               + (fIconBitmap != NULL ? fIconBitmap->Bounds().Width() : 0);
-       BTextControl *textcontrol = new 
BTextControl(frame,"typing_test_area",NULL,
-                                                                       "Typing 
test area",
-                                                                       new 
BMessage('TTEA'),
-                                                                       
B_FOLLOW_LEFT,B_WILL_DRAW);
-       textcontrol->SetAlignment(B_ALIGN_LEFT,B_ALIGN_CENTER);
-       
-       float width, height;
-       textcontrol->GetPreferredSize(&width, &height);
-       textcontrol->ResizeTo(frame.Width(),height);
-       
-       // Create the box for the sliders...
-       frame.left = frame.top = kBorderSpace;
-       frame.right = frame.left + fDelaySlider->Frame().right + (kBorderSpace 
* 2)
-               + (fClockBitmap != NULL ? fClockBitmap->Bounds().Width() : 0);
-       frame.bottom = textcontrol->Frame().bottom + (kBorderSpace * 2);
-       fBox = new BBox(frame,"keyboard_box",B_FOLLOW_LEFT, B_WILL_DRAW,
-               B_FANCY_BORDER);
-       AddChild(fBox);
-       
-       fBox->AddChild(fRepeatSlider);
-       fBox->AddChild(fDelaySlider);
-       fBox->AddChild(textcontrol);    
+       BTextControl* textcontrol = new BTextControl(NULL,
+                                                                       
TR("Typing test area"),
+                                                                       new 
BMessage('TTEA'));
+       textcontrol->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
+       textcontrol->SetExplicitMinSize(BSize(
+               textcontrol->StringWidth(TR("Typing test area")), 
B_SIZE_UNSET));       
+               
+       // Build the layout
+       SetLayout(new BGroupLayout(B_HORIZONTAL));
 
-       //Add the "Default" button..    
-       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",
-                                               new BMessage(BUTTON_DEFAULTS));
-       button->ResizeToPreferred();
-       AddChild(button);
-       
-       // Add the "Revert" button...
-       frame = button->Frame();
-       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 + kBorderSpace, button->Frame().bottom + 
kBorderSpace);
+       AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
+               .Add(fRepeatSlider)
+               .Add(fDelaySlider)
+               .Add(textcontrol)
+               .SetInsets(10, 10, 10, 10)
+       );
 }
 
+
+KeyboardView::~KeyboardView()
+{
+
+}
+
+
 void
 KeyboardView::Draw(BRect updateFrame)
 {
@@ -122,19 +86,12 @@
        if (fIconBitmap != NULL) {
                pt.y = fRepeatSlider->Frame().bottom - 35
                        - fIconBitmap->Bounds().Height() / 3;
-               fBox->DrawBitmap(fIconBitmap,pt);
+               DrawBitmap(fIconBitmap, pt);
        }
 
        if (fClockBitmap != NULL) {
                pt.y = fDelaySlider->Frame().bottom - 35
                        - fClockBitmap->Bounds().Height() / 3;
-               fBox->DrawBitmap(fClockBitmap,pt);
+               DrawBitmap(fClockBitmap, pt);
        }
 }
-
-void
-KeyboardView::AttachedToWindow(void)
-{
-       Window()->ResizeTo(Bounds().Width(), Bounds().Height());
-}
-

Modified: haiku/trunk/src/preferences/keyboard/KeyboardView.h
===================================================================
--- haiku/trunk/src/preferences/keyboard/KeyboardView.h 2009-11-18 17:14:58 UTC 
(rev 34117)
+++ haiku/trunk/src/preferences/keyboard/KeyboardView.h 2009-11-18 20:13:56 UTC 
(rev 34118)
@@ -11,23 +11,23 @@
 #define KEYBOARD_VIEW_H
 
 
-#include <Box.h>
+#include <GroupView.h>
 #include <Slider.h>
 #include <SupportDefs.h>
 #include <InterfaceDefs.h>
 #include <Application.h>
 
-class KeyboardView : public BView
+
+class KeyboardView : public BGroupView
 {
 public:
-                       KeyboardView(BRect frame);
+       KeyboardView();
+       virtual ~KeyboardView();
        void    Draw(BRect frame);
-       void    AttachedToWindow(void);
-       
+
 private:
        BBitmap         *fIconBitmap;
        BBitmap         *fClockBitmap;
-       BBox            *fBox;
        BSlider         *fDelaySlider;
        BSlider         *fRepeatSlider;
 };

Modified: haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp     2009-11-18 
17:14:58 UTC (rev 34117)
+++ haiku/trunk/src/preferences/keyboard/KeyboardWindow.cpp     2009-11-18 
20:13:56 UTC (rev 34118)
@@ -13,42 +13,69 @@
 #include "KeyboardView.h"
 #include "KeyboardWindow.h"
 
+#include <Box.h>
 #include <Button.h>
+#include <Catalog.h>
+#include <GroupLayout.h>
+#include <GroupLayoutBuilder.h>
+#include <Locale.h>
 #include <Message.h>
 #include <Screen.h>
 #include <Slider.h>
 #include <TextControl.h>
 
+#undef TR_CONTEXT
+#define TR_CONTEXT "KeyboardWindow"
 
 KeyboardWindow::KeyboardWindow()
-       : BWindow(BRect(0, 0, 200, 200), "Keyboard", B_TITLED_WINDOW,
-               B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
+       : BWindow(BRect(0, 0, 200, 200), TR("Keyboard"), B_TITLED_WINDOW,
+               B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
+               | B_AUTO_UPDATE_SIZE_LIMITS)
 {
        MoveTo(fSettings.WindowCorner());
 
-       // center window if it would be off-screen
-       BScreen screen;
-       if (screen.Frame().right < Frame().right
-               || screen.Frame().bottom < Frame().bottom) {
-               MoveTo((screen.Frame().right - Bounds().right) / 2,
-                       (screen.Frame().bottom - Bounds().bottom) / 2);
-       }
+       // Add the main settings view
+       fSettingsView = new KeyboardView();
+       BBox* fSettingsBox = new BBox("keyboard_box");
+       fSettingsBox->AddChild(fSettingsView);
+       
+       // Add the "Default" button..   
+       fDefaultsButton = new BButton(TR("Defaults"), new 
BMessage(BUTTON_DEFAULTS));
+       
+       // Add the "Revert" button...
+       fRevertButton = new BButton(TR("Revert"), new BMessage(BUTTON_REVERT));
+       fRevertButton->SetEnabled(false);
+       
+       // Build the layout
+       SetLayout(new BGroupLayout(B_VERTICAL));
+       
+       AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
+               .Add(fSettingsBox)
+               .AddGroup(B_HORIZONTAL, 7)
+                       .Add(fDefaultsButton)
+                       .Add(fRevertButton)
+                       .AddGlue()
+               .End()
+               .SetInsets(10, 10, 10, 10)
+       );
 
-       fView = new KeyboardView(Bounds());
-       AddChild(fView);
-
-       BSlider *slider = (BSlider *)FindView("key_repeat_rate");
+       BSlider* slider = (BSlider* )FindView("key_repeat_rate");
        if (slider !=NULL) 
                slider->SetValue(fSettings.KeyboardRepeatRate());
 
-       slider = (BSlider *)FindView("delay_until_key_repeat");
+       slider = (BSlider* )FindView("delay_until_key_repeat");
        if (slider !=NULL) 
                slider->SetValue(fSettings.KeyboardRepeatDelay());
 
-       BButton *button = (BButton *)FindView("keyboard_defaults");
-       if (button !=NULL)
-               button->SetEnabled(fSettings.IsDefaultable());
+       fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
 
+       // center window if it would be off-screen
+       BScreen screen;
+       if (screen.Frame().right < Frame().right
+               || screen.Frame().bottom < Frame().bottom) {
+               CenterOnScreen();       
+       }
+
 #ifdef DEBUG
        fSettings.Dump();
 #endif
@@ -75,49 +102,40 @@
 KeyboardWindow::MessageReceived(BMessage* message)
 {
        BSlider* slider = NULL;
-       BButton* button = NULL;
 
        switch (message->what) {
                case BUTTON_DEFAULTS:
                {
                        fSettings.Defaults();
 
-                       slider = (BSlider *)FindView("key_repeat_rate");
+                       slider = (BSlider* )FindView("key_repeat_rate");
                        if (slider !=NULL) 
                                
slider->SetValue(fSettings.KeyboardRepeatRate());
 
-                       slider = (BSlider *)FindView("delay_until_key_repeat");
+                       slider = (BSlider* )FindView("delay_until_key_repeat");
                        if (slider !=NULL) 
                                
slider->SetValue(fSettings.KeyboardRepeatDelay());
 
-                       button = (BButton *)FindView("keyboard_defaults");
-                       if (button !=NULL)
-                               button->SetEnabled(false);
+                       fDefaultsButton->SetEnabled(false);
 
-                       button = (BButton *)FindView("keyboard_revert");
-                       if (button !=NULL) 
-                               button->SetEnabled(true);
+                       fRevertButton->SetEnabled(true);
                        break;
                }
                case BUTTON_REVERT:
                {
                        fSettings.Revert();
                        
-                       slider = (BSlider *)FindView("key_repeat_rate");
+                       slider = (BSlider* )FindView("key_repeat_rate");
                        if (slider !=NULL) 
                                
slider->SetValue(fSettings.KeyboardRepeatRate());
 
-                       slider = (BSlider *)FindView("delay_until_key_repeat");
+                       slider = (BSlider* )FindView("delay_until_key_repeat");
                        if (slider !=NULL) 
                                
slider->SetValue(fSettings.KeyboardRepeatDelay());
 
-                       button = (BButton *)FindView("keyboard_defaults");
-                       if (button !=NULL)
-                               button->SetEnabled(fSettings.IsDefaultable());
+                       fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
 
-                       button = (BButton *)FindView("keyboard_revert");
-                       if (button !=NULL) 
-                               button->SetEnabled(false);
+                       fRevertButton->SetEnabled(false);
                        break;
                }
                case SLIDER_REPEAT_RATE:
@@ -127,13 +145,9 @@
                                break;
                        fSettings.SetKeyboardRepeatRate(rate);
 
-                       button = (BButton *)FindView("keyboard_defaults");
-                       if (button !=NULL)
-                               button->SetEnabled(fSettings.IsDefaultable());
+                       fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
 
-                       button = (BButton *)FindView("keyboard_revert");
-                       if (button !=NULL) 
-                               button->SetEnabled(true);
+                       fRevertButton->SetEnabled(true);
                        break;
                }
                case SLIDER_DELAY_RATE:
@@ -154,19 +168,13 @@
                        if (delay >= 875000)
                                delay = 1000000;
 
-                       fSettings.SetKeyboardRepeatDelay(delay);
-
-                       slider = (BSlider *)FindView("delay_until_key_repeat");
+                       slider = (BSlider* )FindView("delay_until_key_repeat");
                        if (slider !=NULL) 
                                slider->SetValue(delay);
 
-                       button = (BButton *)FindView("keyboard_defaults");
-                       if (button !=NULL)
-                               button->SetEnabled(fSettings.IsDefaultable());
+                       fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
 
-                       button = (BButton *)FindView("keyboard_revert");
-                       if (button !=NULL) 
-                               button->SetEnabled(true);
+                       fRevertButton->SetEnabled(true);
                        break;
                }
 

Modified: haiku/trunk/src/preferences/keyboard/KeyboardWindow.h
===================================================================
--- haiku/trunk/src/preferences/keyboard/KeyboardWindow.h       2009-11-18 
17:14:58 UTC (rev 34117)
+++ haiku/trunk/src/preferences/keyboard/KeyboardWindow.h       2009-11-18 
20:13:56 UTC (rev 34118)
@@ -10,6 +10,7 @@
 #ifndef KEYBOARD_WINDOW_H
 #define KEYBOARD_WINDOW_H
 
+#include <Button.h>
 #include <Window.h>
 
 #include "KeyboardSettings.h"
@@ -21,11 +22,13 @@
                        KeyboardWindow();
        
        bool    QuitRequested();
-       void    MessageReceived(BMessage *message);
+       void    MessageReceived(BMessage* message);
        
 private:
-       KeyboardView            *fView;
+       KeyboardView    *fSettingsView;
        KeyboardSettings        fSettings;
+       BButton         *fDefaultsButton;
+       BButton         *fRevertButton;
 };
 
 #endif

Modified: haiku/trunk/src/preferences/mouse/Jamfile
===================================================================
--- haiku/trunk/src/preferences/mouse/Jamfile   2009-11-18 17:14:58 UTC (rev 
34117)
+++ haiku/trunk/src/preferences/mouse/Jamfile   2009-11-18 20:13:56 UTC (rev 
34118)
@@ -8,7 +8,16 @@
        MouseWindow.cpp
        MouseView.cpp 
        SettingsView.cpp
-       : translation be $(TARGET_LIBSUPC++)
+       : translation be $(TARGET_LIBSUPC++) liblocale.so
        : Mouse.rdef
        ;
 
+DoCatalogs Mouse :
+       x-vnd.Haiku-Mouse
+       :
+       Mouse.cpp
+       MouseWindow.cpp
+       SettingsView.cpp
+       : en.catalog
+       : fr.catkeys
+       ;

Modified: haiku/trunk/src/preferences/mouse/Mouse.cpp
===================================================================
--- haiku/trunk/src/preferences/mouse/Mouse.cpp 2009-11-18 17:14:58 UTC (rev 
34117)
+++ haiku/trunk/src/preferences/mouse/Mouse.cpp 2009-11-18 20:13:56 UTC (rev 
34118)
@@ -15,6 +15,8 @@
 #include <Alert.h>
 #include <Screen.h>
 
+#undef TR_CONTEXT
+#define TR_CONTEXT "MouseApplication"
 
 const char* kSignature = "application/x-vnd.Haiku-Mouse";
 
@@ -23,6 +25,8 @@
        :
        BApplication(kSignature)                                        
 {
+       be_locale->GetAppCatalog(&fCatalog);
+       
        BRect rect(0, 0, 397, 293);
        MouseWindow *window = new MouseWindow(rect);
        window->Show();
@@ -32,7 +36,8 @@
 void
 MouseApplication::AboutRequested()
 {
-       (new BAlert("about", "...by Andrew Edward McCall", "Dig Deal"))->Go();
+       (new BAlert("about", TR("...by Andrew Edward McCall"),
+               TR("Dig Deal")))->Go();
 }
 
 

Modified: haiku/trunk/src/preferences/mouse/Mouse.h
===================================================================
--- haiku/trunk/src/preferences/mouse/Mouse.h   2009-11-18 17:14:58 UTC (rev 
34117)
+++ haiku/trunk/src/preferences/mouse/Mouse.h   2009-11-18 20:13:56 UTC (rev 
34118)
@@ -12,6 +12,8 @@
 
 
 #include <Application.h>
+#include <Catalog.h>
+#include <Locale.h>
 
 
 class MouseApplication : public BApplication {
@@ -19,6 +21,8 @@
                MouseApplication();
 
                virtual void AboutRequested();
+private:
+               BCatalog fCatalog;
 };
 
 #endif /* MOUSE_H */

Modified: haiku/trunk/src/preferences/mouse/MouseWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/mouse/MouseWindow.cpp   2009-11-18 17:14:58 UTC 
(rev 34117)
+++ haiku/trunk/src/preferences/mouse/MouseWindow.cpp   2009-11-18 20:13:56 UTC 
(rev 34118)
@@ -14,8 +14,10 @@
 #include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <CheckBox.h>
 #include <Debug.h>
+#include <Locale.h>
 #include <Menu.h>
 #include <MenuField.h>
 #include <MenuItem.h>
@@ -27,10 +29,12 @@
 #include "MouseConstants.h"
 #include "SettingsView.h"
 
+#undef TR_CONTEXT
+#define TR_CONTEXT "MouseWindow"
 
 MouseWindow::MouseWindow(BRect _rect)
        : 
-               BWindow(_rect, "Mouse", B_TITLED_WINDOW, 
+               BWindow(_rect, TR("Mouse"), B_TITLED_WINDOW, 
                        B_NOT_RESIZABLE | B_NOT_ZOOMABLE | 
B_ASYNCHRONOUS_CONTROLS |
                                B_AUTO_UPDATE_SIZE_LIMITS)
 {
@@ -40,11 +44,11 @@
        fSettingsBox->AddChild(fSettingsView);
 
        // Add the "Default" button
-       fDefaultsButton = new BButton("Defaults", new BMessage(kMsgDefaults));
+       fDefaultsButton = new BButton(TR("Defaults"), new 
BMessage(kMsgDefaults));
        fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
 
        // Add the "Revert" button
-       fRevertButton = new BButton("Revert", new BMessage(kMsgRevert));
+       fRevertButton = new BButton(TR("Revert"), new BMessage(kMsgRevert));
        fRevertButton->SetEnabled(false);
 
        SetPulseRate(100000);

Modified: haiku/trunk/src/preferences/mouse/SettingsView.cpp
===================================================================
--- haiku/trunk/src/preferences/mouse/SettingsView.cpp  2009-11-18 17:14:58 UTC 
(rev 34117)
+++ haiku/trunk/src/preferences/mouse/SettingsView.cpp  2009-11-18 20:13:56 UTC 
(rev 34118)
@@ -14,10 +14,12 @@
 #include <Bitmap.h>
 #include <Box.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <Debug.h>
 #include <GroupLayout.h>
 #include <GroupLayoutBuilder.h>
 #include <InterfaceDefs.h>
+#include <Locale.h>
 #include <MenuField.h>
 #include <MenuItem.h>
 #include <PopUpMenu.h>
@@ -62,6 +64,8 @@
 
 //     #pragma mark -
 
+#undef TR_CONTEXT
+#define TR_CONTEXT "SettingsView"
 
 SettingsView::SettingsView(MouseSettings &settings)
        : BBox("main_view"),
@@ -69,48 +73,53 @@
 {
        // Add the "Mouse Type" pop up menu
        fTypeMenu = new BPopUpMenu("unknown");
-       fTypeMenu->AddItem(new BMenuItem("1-Button", new 
BMessage(kMsgMouseType)));
-       fTypeMenu->AddItem(new BMenuItem("2-Button", new 
BMessage(kMsgMouseType)));
-       fTypeMenu->AddItem(new BMenuItem("3-Button", new 
BMessage(kMsgMouseType)));
+       fTypeMenu->AddItem(new BMenuItem(TR("1-Button"),
+               new BMessage(kMsgMouseType)));
+       fTypeMenu->AddItem(new BMenuItem(TR("2-Button"),
+               new BMessage(kMsgMouseType)));
+       fTypeMenu->AddItem(new BMenuItem(TR("3-Button"),
+               new BMessage(kMsgMouseType)));
 
-       BMenuField *fTypeField = new BMenuField("Mouse type:", fTypeMenu, NULL);
+       BMenuField *fTypeField = new BMenuField(TR("Mouse type:"),
+               fTypeMenu, NULL);
        fTypeField->SetAlignment(B_ALIGN_RIGHT);
 
        // Create the "Double-click speed slider...
-       fClickSpeedSlider = new BSlider("double_click_speed", "Double-click 
speed",
-               new BMessage(kMsgDoubleClickSpeed), 0, 1000, B_HORIZONTAL);
+       fClickSpeedSlider = new BSlider("double_click_speed",
+               TR("Double-click speed"), new BMessage(kMsgDoubleClickSpeed),
+               0, 1000, B_HORIZONTAL);
        fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
        fClickSpeedSlider->SetHashMarkCount(5);
-       fClickSpeedSlider->SetLimitLabels("Slow", "Fast");
+       fClickSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
 
        // Create the "Mouse Speed" slider...
-       fMouseSpeedSlider = new BSlider("mouse_speed", "Mouse Speed", 
+       fMouseSpeedSlider = new BSlider("mouse_speed", TR("Mouse Speed"), 
                new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL);
        fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
        fMouseSpeedSlider->SetHashMarkCount(7);
-       fMouseSpeedSlider->SetLimitLabels("Slow", "Fast");
+       fMouseSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
 
        // Create the "Mouse Acceleration" slider...
        fAccelerationSlider = new BSlider("mouse_acceleration",
-               "Mouse Acceleration", new BMessage(kMsgAccelerationFactor),
+               TR("Mouse Acceleration"), new BMessage(kMsgAccelerationFactor),
                0, 1000, B_HORIZONTAL);
        fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
        fAccelerationSlider->SetHashMarkCount(5);
-       fAccelerationSlider->SetLimitLabels("Slow", "Fast");
+       fAccelerationSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
 
        // Mouse image...
        fMouseView = new MouseView(fSettings);
 
        // Create the "Double-click test area" text box...
        BTextControl *fDoubleClick = new BTextControl(NULL,
-               "Double-click test area", NULL);
+               TR("Double-click test area"), NULL);
        fDoubleClick->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
 
        // Add the "Mouse focus mode" pop up menu
-       fFocusMenu = new BPopUpMenu("Click to Activate");
+       fFocusMenu = new BPopUpMenu(TR("Click to Activate"));
        
-       const char *focusLabels[] = {"Click to Activate", "Click to Focus",
-                                                                       "Focus 
Follows Mouse"};
+       const char *focusLabels[] = {TR_MARK("Click to Activate"),
+               TR_MARK("Click to Focus"),TR_MARK("Focus Follows Mouse")};
        const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE,
                                                                                
B_FOCUS_FOLLOWS_MOUSE};
 
@@ -118,16 +127,18 @@
                BMessage *message = new BMessage(kMsgMouseFocusMode);
                message->AddInt32("mode", focusModes[i]);
 
-               fFocusMenu->AddItem(new BMenuItem(focusLabels[i], message));
+               fFocusMenu->AddItem(new BMenuItem(TR(focusLabels[i]), message));
        }
 
-       BMenuField *fFocusField = new BMenuField("Focus mode:", fFocusMenu, 
NULL);
+       BMenuField *fFocusField = new BMenuField(TR("Focus mode:"),
+               fFocusMenu, NULL);
        fFocusField->SetAlignment(B_ALIGN_RIGHT);
        
        // Add the "Focus follows mouse mode" pop up menu
-       fFocusFollowsMouseMenu = new BPopUpMenu("Normal");
+       fFocusFollowsMouseMenu = new BPopUpMenu(TR("Normal"));
        
-       const char *focusFollowsMouseLabels[] = {"Normal", "Warp", "Instant 
Warp"};
+       const char *focusFollowsMouseLabels[] = {TR_MARK("Normal"),
+               TR_MARK("Warp"), TR_MARK("Instant Warp")};
        const mode_focus_follows_mouse focusFollowsMouseModes[] =
                {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
                        B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};
@@ -138,7 +149,7 @@
                        focusFollowsMouseModes[i]);
 
                fFocusFollowsMouseMenu->AddItem(new BMenuItem(
-                       focusFollowsMouseLabels[i], message));
+                       TR(focusFollowsMouseLabels[i]), message));
        }
 
        BMenuField *fFocusFollowsMouseField = new BMenuField(
@@ -146,7 +157,7 @@
        fFocusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT);
 
        // Add the "Click-through" check box
-       fAcceptFirstClickBox = new BCheckBox("Accept first click",
+       fAcceptFirstClickBox = new BCheckBox(TR("Accept first click"),
                new BMessage(kMsgAcceptFirstClick));
 
        // dividers


Other related posts:

  • » [haiku-commits] r34118 - in haiku/trunk: data/catalogs/preferences data/catalogs/preferences/keyboard data/catalogs/preferences/mouse src/preferences/keyboard src/preferences/mouse - pulkomandy