diff --git a/data/catalogs/preferences/keyboard/fr.catkeys b/data/catalogs/preferences/keyboard/fr.catkeys new file mode 100644 index 0000000000..b1db06f744 --- /dev/null +++ b/data/catalogs/preferences/keyboard/fr.catkeys @@ -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 diff --git a/data/catalogs/preferences/mouse/fr.catkeys b/data/catalogs/preferences/mouse/fr.catkeys new file mode 100644 index 0000000000..9b83cb4f6a --- /dev/null +++ b/data/catalogs/preferences/mouse/fr.catkeys @@ -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 diff --git a/src/preferences/keyboard/Jamfile b/src/preferences/keyboard/Jamfile index cd75ae1231..2777ebf240 100644 --- a/src/preferences/keyboard/Jamfile +++ b/src/preferences/keyboard/Jamfile @@ -14,6 +14,16 @@ Preference Keyboard : 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 + ; diff --git a/src/preferences/keyboard/Keyboard.cpp b/src/preferences/keyboard/Keyboard.cpp index b32dff6b1a..70b188287c 100644 --- a/src/preferences/keyboard/Keyboard.cpp +++ b/src/preferences/keyboard/Keyboard.cpp @@ -15,10 +15,13 @@ #include +#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 @@ KeyboardApplication::KeyboardApplication() 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 @@ KeyboardApplication::MessageReceived(BMessage* message) 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(); } diff --git a/src/preferences/keyboard/Keyboard.h b/src/preferences/keyboard/Keyboard.h index bf98b9ea58..debf7a6a51 100644 --- a/src/preferences/keyboard/Keyboard.h +++ b/src/preferences/keyboard/Keyboard.h @@ -11,14 +11,19 @@ #define KEYBOARD_H #include +#include +#include class KeyboardApplication : public BApplication { public: - KeyboardApplication(); + KeyboardApplication(); - void MessageReceived(BMessage *message); + void MessageReceived(BMessage* message); void AboutRequested(void); + +private: + BCatalog fCatalog; }; #endif diff --git a/src/preferences/keyboard/KeyboardView.cpp b/src/preferences/keyboard/KeyboardView.cpp index ef932e9451..20575d8629 100644 --- a/src/preferences/keyboard/KeyboardView.cpp +++ b/src/preferences/keyboard/KeyboardView.cpp @@ -11,108 +11,72 @@ #include #include #include +#include +#include +#include +#include #include #include #include -#include #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 @@ KeyboardView::Draw(BRect updateFrame) 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()); -} - diff --git a/src/preferences/keyboard/KeyboardView.h b/src/preferences/keyboard/KeyboardView.h index 4b38fdd484..1d0e8b7325 100644 --- a/src/preferences/keyboard/KeyboardView.h +++ b/src/preferences/keyboard/KeyboardView.h @@ -11,23 +11,23 @@ #define KEYBOARD_VIEW_H -#include +#include #include #include #include #include -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; }; diff --git a/src/preferences/keyboard/KeyboardWindow.cpp b/src/preferences/keyboard/KeyboardWindow.cpp index f746c38321..031a415968 100644 --- a/src/preferences/keyboard/KeyboardWindow.cpp +++ b/src/preferences/keyboard/KeyboardWindow.cpp @@ -13,42 +13,69 @@ #include "KeyboardView.h" #include "KeyboardWindow.h" +#include #include +#include +#include +#include +#include #include #include #include #include +#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()); + // 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) + ); + + BSlider* slider = (BSlider* )FindView("key_repeat_rate"); + if (slider !=NULL) + slider->SetValue(fSettings.KeyboardRepeatRate()); + + slider = (BSlider* )FindView("delay_until_key_repeat"); + if (slider !=NULL) + slider->SetValue(fSettings.KeyboardRepeatDelay()); + + 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) { - MoveTo((screen.Frame().right - Bounds().right) / 2, - (screen.Frame().bottom - Bounds().bottom) / 2); + CenterOnScreen(); } - fView = new KeyboardView(Bounds()); - AddChild(fView); - - BSlider *slider = (BSlider *)FindView("key_repeat_rate"); - if (slider !=NULL) - slider->SetValue(fSettings.KeyboardRepeatRate()); - - 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()); - #ifdef DEBUG fSettings.Dump(); #endif @@ -75,49 +102,40 @@ void 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 @@ KeyboardWindow::MessageReceived(BMessage* message) 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 @@ KeyboardWindow::MessageReceived(BMessage* message) 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; } diff --git a/src/preferences/keyboard/KeyboardWindow.h b/src/preferences/keyboard/KeyboardWindow.h index a0d4b2e5b5..f56545e3ab 100644 --- a/src/preferences/keyboard/KeyboardWindow.h +++ b/src/preferences/keyboard/KeyboardWindow.h @@ -10,6 +10,7 @@ #ifndef KEYBOARD_WINDOW_H #define KEYBOARD_WINDOW_H +#include #include #include "KeyboardSettings.h" @@ -21,11 +22,13 @@ public: KeyboardWindow(); bool QuitRequested(); - void MessageReceived(BMessage *message); + void MessageReceived(BMessage* message); private: - KeyboardView *fView; + KeyboardView *fSettingsView; KeyboardSettings fSettings; + BButton *fDefaultsButton; + BButton *fRevertButton; }; #endif diff --git a/src/preferences/mouse/Jamfile b/src/preferences/mouse/Jamfile index 340ea24dea..a6d53466e3 100644 --- a/src/preferences/mouse/Jamfile +++ b/src/preferences/mouse/Jamfile @@ -8,7 +8,16 @@ Preference Mouse : 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 + ; diff --git a/src/preferences/mouse/Mouse.cpp b/src/preferences/mouse/Mouse.cpp index 1c378e24ef..903ab9d346 100644 --- a/src/preferences/mouse/Mouse.cpp +++ b/src/preferences/mouse/Mouse.cpp @@ -15,6 +15,8 @@ #include #include +#undef TR_CONTEXT +#define TR_CONTEXT "MouseApplication" const char* kSignature = "application/x-vnd.Haiku-Mouse"; @@ -23,6 +25,8 @@ MouseApplication::MouseApplication() : BApplication(kSignature) { + be_locale->GetAppCatalog(&fCatalog); + BRect rect(0, 0, 397, 293); MouseWindow *window = new MouseWindow(rect); window->Show(); @@ -32,7 +36,8 @@ MouseApplication::MouseApplication() 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(); } diff --git a/src/preferences/mouse/Mouse.h b/src/preferences/mouse/Mouse.h index 8d034e52e6..5edb1d5729 100644 --- a/src/preferences/mouse/Mouse.h +++ b/src/preferences/mouse/Mouse.h @@ -12,6 +12,8 @@ #include +#include +#include class MouseApplication : public BApplication { @@ -19,6 +21,8 @@ public: MouseApplication(); virtual void AboutRequested(); +private: + BCatalog fCatalog; }; #endif /* MOUSE_H */ diff --git a/src/preferences/mouse/MouseWindow.cpp b/src/preferences/mouse/MouseWindow.cpp index 592a356387..00e88b0c6a 100644 --- a/src/preferences/mouse/MouseWindow.cpp +++ b/src/preferences/mouse/MouseWindow.cpp @@ -14,8 +14,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -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 @@ MouseWindow::MouseWindow(BRect _rect) 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); diff --git a/src/preferences/mouse/SettingsView.cpp b/src/preferences/mouse/SettingsView.cpp index f761c05396..b309ce858a 100644 --- a/src/preferences/mouse/SettingsView.cpp +++ b/src/preferences/mouse/SettingsView.cpp @@ -14,10 +14,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -62,6 +64,8 @@ focus_follows_mouse_mode_to_index(mode_focus_follows_mouse mode) // #pragma mark - +#undef TR_CONTEXT +#define TR_CONTEXT "SettingsView" SettingsView::SettingsView(MouseSettings &settings) : BBox("main_view"), @@ -69,48 +73,53 @@ SettingsView::SettingsView(MouseSettings &settings) { // 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 @@ SettingsView::SettingsView(MouseSettings &settings) 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 @@ SettingsView::SettingsView(MouseSettings &settings) focusFollowsMouseModes[i]); fFocusFollowsMouseMenu->AddItem(new BMenuItem( - focusFollowsMouseLabels[i], message)); + TR(focusFollowsMouseLabels[i]), message)); } BMenuField *fFocusFollowsMouseField = new BMenuField( @@ -146,7 +157,7 @@ SettingsView::SettingsView(MouseSettings &settings) 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