Localization for keyboard and mouse preflet by mt. Thanks !

French localization by me. Please improve !


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34118 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2009-11-18 20:13:56 +00:00
parent 143e4fbc3e
commit 1892e95632
14 changed files with 236 additions and 179 deletions
@@ -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
@@ -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
+11 -1
View File
@@ -14,6 +14,16 @@ Preference Keyboard :
KeyboardSettings.cpp KeyboardSettings.cpp
KeyboardView.cpp KeyboardView.cpp
KeyboardWindow.cpp KeyboardWindow.cpp
: translation be $(TARGET_LIBSUPC++) : translation be $(TARGET_LIBSUPC++) liblocale.so
: Keyboard.rdef : Keyboard.rdef
; ;
DoCatalogs Keyboard :
x-vnd.Haiku-Keyboard
:
Keyboard.cpp
KeyboardWindow.cpp
KeyboardView.cpp
: en.catalog
: fr.catkeys
;
+7 -4
View File
@@ -15,10 +15,13 @@
#include <Alert.h> #include <Alert.h>
#undef TR_CONTEXT
#define TR_CONTEXT "KeyboardApplication"
KeyboardApplication::KeyboardApplication() KeyboardApplication::KeyboardApplication()
: BApplication("application/x-vnd.Haiku-Keyboard") : BApplication("application/x-vnd.Haiku-Keyboard")
{ {
be_locale->GetAppCatalog(&fCatalog);
new KeyboardWindow(); new KeyboardWindow();
} }
@@ -26,11 +29,11 @@ KeyboardApplication::KeyboardApplication()
void void
KeyboardApplication::MessageReceived(BMessage* message) KeyboardApplication::MessageReceived(BMessage* message)
{ {
switch(message->what) { switch (message->what) {
case ERROR_DETECTED: case ERROR_DETECTED:
{ {
BAlert *errorAlert = new BAlert("Error", "Something has gone wrong!", BAlert* errorAlert = new BAlert("Error", TR("Something has gone wrong!"),
"OK", NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
B_WARNING_ALERT); B_WARNING_ALERT);
errorAlert->Go(); errorAlert->Go();
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
@@ -46,7 +49,7 @@ KeyboardApplication::MessageReceived(BMessage* message)
void void
KeyboardApplication::AboutRequested() KeyboardApplication::AboutRequested()
{ {
(new BAlert("about", "Written by Andrew Edward McCall", "OK"))->Go(); (new BAlert("about", TR("Written by Andrew Edward McCall"), TR("OK")))->Go();
} }
+7 -2
View File
@@ -11,14 +11,19 @@
#define KEYBOARD_H #define KEYBOARD_H
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Locale.h>
class KeyboardApplication : public BApplication class KeyboardApplication : public BApplication
{ {
public: public:
KeyboardApplication(); KeyboardApplication();
void MessageReceived(BMessage *message); void MessageReceived(BMessage* message);
void AboutRequested(void); void AboutRequested(void);
private:
BCatalog fCatalog;
}; };
#endif #endif
+44 -87
View File
@@ -11,108 +11,72 @@
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <Slider.h> #include <Slider.h>
#include <TextControl.h> #include <TextControl.h>
#include <Window.h> #include <Window.h>
#include <Font.h>
#include "KeyboardView.h" #include "KeyboardView.h"
#include "KeyboardMessages.h" #include "KeyboardMessages.h"
#include "KeyboardSettings.h"
// user interface #undef TR_CONTEXT
const uint32 kBorderSpace = 10; #define TR_CONTEXT "KeyboardView"
const uint32 kItemSpace = 7;
KeyboardView::KeyboardView(BRect rect) KeyboardView::KeyboardView()
: BView(rect, "keyboard_view", B_FOLLOW_LEFT | B_FOLLOW_TOP, : BGroupView()
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP) {
{
BRect frame;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fIconBitmap = BTranslationUtils::GetBitmap("key_bmap"); fIconBitmap = BTranslationUtils::GetBitmap("key_bmap");
fClockBitmap = BTranslationUtils::GetBitmap("clock_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... // Create the "Key repeat rate" slider...
frame.Set(kBorderSpace,kBorderSpace,kBorderSpace + labelwidth,kBorderSpace + (labelheight*2) + (kBorderSpace*2)); fRepeatSlider = new BSlider("key_repeat_rate",
fRepeatSlider = new BSlider(frame,"key_repeat_rate", TR("Key repeat rate"),
"Key repeat rate", new BMessage(SLIDER_REPEAT_RATE),
new BMessage(SLIDER_REPEAT_RATE), 20, 300, B_HORIZONTAL);
20,300,B_BLOCK_THUMB,
B_FOLLOW_LEFT,B_WILL_DRAW);
fRepeatSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fRepeatSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fRepeatSlider->SetHashMarkCount(5); fRepeatSlider->SetHashMarkCount(5);
fRepeatSlider->SetLimitLabels("Slow","Fast"); fRepeatSlider->SetLimitLabels(TR("Slow"),TR("Fast"));
// Create the "Delay until key repeat" slider... // Create the "Delay until key repeat" slider...
frame.OffsetBy(0,frame.Height() + kBorderSpace); fDelaySlider = new BSlider("delay_until_key_repeat",
fDelaySlider = new BSlider(frame,"delay_until_key_repeat", TR("Delay until key repeat"),
"Delay until key repeat", new BMessage(SLIDER_DELAY_RATE),
new BMessage(SLIDER_DELAY_RATE),250000,1000000, 250000, 1000000, B_HORIZONTAL);
B_BLOCK_THUMB,B_FOLLOW_LEFT,B_WILL_DRAW);
fDelaySlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fDelaySlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fDelaySlider->SetHashMarkCount(4); fDelaySlider->SetHashMarkCount(4);
fDelaySlider->SetLimitLabels("Short","Long"); fDelaySlider->SetLimitLabels(TR("Short"),TR("Long"));
// Create the "Typing test area" text box... // Create the "Typing test area" text box...
frame.OffsetBy(0,frame.Height() + 15); BTextControl* textcontrol = new BTextControl(NULL,
frame.right = fDelaySlider->Frame().right + kBorderSpace TR("Typing test area"),
+ (fIconBitmap != NULL ? fIconBitmap->Bounds().Width() : 0); new BMessage('TTEA'));
BTextControl *textcontrol = new BTextControl(frame,"typing_test_area",NULL, textcontrol->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
"Typing test area", textcontrol->SetExplicitMinSize(BSize(
new BMessage('TTEA'), textcontrol->StringWidth(TR("Typing test area")), B_SIZE_UNSET));
B_FOLLOW_LEFT,B_WILL_DRAW);
textcontrol->SetAlignment(B_ALIGN_LEFT,B_ALIGN_CENTER); // Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
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);
//Add the "Default" button.. AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
frame.left = kBorderSpace; .Add(fRepeatSlider)
frame.top = fBox->Frame().bottom + kBorderSpace; .Add(fDelaySlider)
frame.right = frame.left + 1; .Add(textcontrol)
frame.bottom = frame.top + 1; .SetInsets(10, 10, 10, 10)
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);
} }
KeyboardView::~KeyboardView()
{
}
void void
KeyboardView::Draw(BRect updateFrame) KeyboardView::Draw(BRect updateFrame)
{ {
@@ -122,19 +86,12 @@ KeyboardView::Draw(BRect updateFrame)
if (fIconBitmap != NULL) { if (fIconBitmap != NULL) {
pt.y = fRepeatSlider->Frame().bottom - 35 pt.y = fRepeatSlider->Frame().bottom - 35
- fIconBitmap->Bounds().Height() / 3; - fIconBitmap->Bounds().Height() / 3;
fBox->DrawBitmap(fIconBitmap,pt); DrawBitmap(fIconBitmap, pt);
} }
if (fClockBitmap != NULL) { if (fClockBitmap != NULL) {
pt.y = fDelaySlider->Frame().bottom - 35 pt.y = fDelaySlider->Frame().bottom - 35
- fClockBitmap->Bounds().Height() / 3; - fClockBitmap->Bounds().Height() / 3;
fBox->DrawBitmap(fClockBitmap,pt); DrawBitmap(fClockBitmap, pt);
} }
} }
void
KeyboardView::AttachedToWindow(void)
{
Window()->ResizeTo(Bounds().Width(), Bounds().Height());
}
+6 -6
View File
@@ -11,23 +11,23 @@
#define KEYBOARD_VIEW_H #define KEYBOARD_VIEW_H
#include <Box.h> #include <GroupView.h>
#include <Slider.h> #include <Slider.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Application.h> #include <Application.h>
class KeyboardView : public BView
class KeyboardView : public BGroupView
{ {
public: public:
KeyboardView(BRect frame); KeyboardView();
virtual ~KeyboardView();
void Draw(BRect frame); void Draw(BRect frame);
void AttachedToWindow(void);
private: private:
BBitmap *fIconBitmap; BBitmap *fIconBitmap;
BBitmap *fClockBitmap; BBitmap *fClockBitmap;
BBox *fBox;
BSlider *fDelaySlider; BSlider *fDelaySlider;
BSlider *fRepeatSlider; BSlider *fRepeatSlider;
}; };
+59 -51
View File
@@ -13,42 +13,69 @@
#include "KeyboardView.h" #include "KeyboardView.h"
#include "KeyboardWindow.h" #include "KeyboardWindow.h"
#include <Box.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <GroupLayout.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <Message.h> #include <Message.h>
#include <Screen.h> #include <Screen.h>
#include <Slider.h> #include <Slider.h>
#include <TextControl.h> #include <TextControl.h>
#undef TR_CONTEXT
#define TR_CONTEXT "KeyboardWindow"
KeyboardWindow::KeyboardWindow() KeyboardWindow::KeyboardWindow()
: BWindow(BRect(0, 0, 200, 200), "Keyboard", B_TITLED_WINDOW, : BWindow(BRect(0, 0, 200, 200), TR("Keyboard"), B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
| B_AUTO_UPDATE_SIZE_LIMITS)
{ {
MoveTo(fSettings.WindowCorner()); 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 // center window if it would be off-screen
BScreen screen; BScreen screen;
if (screen.Frame().right < Frame().right if (screen.Frame().right < Frame().right
|| screen.Frame().bottom < Frame().bottom) { || screen.Frame().bottom < Frame().bottom) {
MoveTo((screen.Frame().right - Bounds().right) / 2, CenterOnScreen();
(screen.Frame().bottom - Bounds().bottom) / 2);
} }
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 #ifdef DEBUG
fSettings.Dump(); fSettings.Dump();
#endif #endif
@@ -75,49 +102,40 @@ void
KeyboardWindow::MessageReceived(BMessage* message) KeyboardWindow::MessageReceived(BMessage* message)
{ {
BSlider* slider = NULL; BSlider* slider = NULL;
BButton* button = NULL;
switch (message->what) { switch (message->what) {
case BUTTON_DEFAULTS: case BUTTON_DEFAULTS:
{ {
fSettings.Defaults(); fSettings.Defaults();
slider = (BSlider *)FindView("key_repeat_rate"); slider = (BSlider* )FindView("key_repeat_rate");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatRate()); slider->SetValue(fSettings.KeyboardRepeatRate());
slider = (BSlider *)FindView("delay_until_key_repeat"); slider = (BSlider* )FindView("delay_until_key_repeat");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatDelay()); slider->SetValue(fSettings.KeyboardRepeatDelay());
button = (BButton *)FindView("keyboard_defaults"); fDefaultsButton->SetEnabled(false);
if (button !=NULL)
button->SetEnabled(false);
button = (BButton *)FindView("keyboard_revert"); fRevertButton->SetEnabled(true);
if (button !=NULL)
button->SetEnabled(true);
break; break;
} }
case BUTTON_REVERT: case BUTTON_REVERT:
{ {
fSettings.Revert(); fSettings.Revert();
slider = (BSlider *)FindView("key_repeat_rate"); slider = (BSlider* )FindView("key_repeat_rate");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatRate()); slider->SetValue(fSettings.KeyboardRepeatRate());
slider = (BSlider *)FindView("delay_until_key_repeat"); slider = (BSlider* )FindView("delay_until_key_repeat");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(fSettings.KeyboardRepeatDelay()); slider->SetValue(fSettings.KeyboardRepeatDelay());
button = (BButton *)FindView("keyboard_defaults"); fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
if (button !=NULL)
button->SetEnabled(fSettings.IsDefaultable());
button = (BButton *)FindView("keyboard_revert"); fRevertButton->SetEnabled(false);
if (button !=NULL)
button->SetEnabled(false);
break; break;
} }
case SLIDER_REPEAT_RATE: case SLIDER_REPEAT_RATE:
@@ -127,13 +145,9 @@ KeyboardWindow::MessageReceived(BMessage* message)
break; break;
fSettings.SetKeyboardRepeatRate(rate); fSettings.SetKeyboardRepeatRate(rate);
button = (BButton *)FindView("keyboard_defaults"); fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
if (button !=NULL)
button->SetEnabled(fSettings.IsDefaultable());
button = (BButton *)FindView("keyboard_revert"); fRevertButton->SetEnabled(true);
if (button !=NULL)
button->SetEnabled(true);
break; break;
} }
case SLIDER_DELAY_RATE: case SLIDER_DELAY_RATE:
@@ -154,19 +168,13 @@ KeyboardWindow::MessageReceived(BMessage* message)
if (delay >= 875000) if (delay >= 875000)
delay = 1000000; delay = 1000000;
fSettings.SetKeyboardRepeatDelay(delay); slider = (BSlider* )FindView("delay_until_key_repeat");
slider = (BSlider *)FindView("delay_until_key_repeat");
if (slider !=NULL) if (slider !=NULL)
slider->SetValue(delay); slider->SetValue(delay);
button = (BButton *)FindView("keyboard_defaults"); fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
if (button !=NULL)
button->SetEnabled(fSettings.IsDefaultable());
button = (BButton *)FindView("keyboard_revert"); fRevertButton->SetEnabled(true);
if (button !=NULL)
button->SetEnabled(true);
break; break;
} }
+5 -2
View File
@@ -10,6 +10,7 @@
#ifndef KEYBOARD_WINDOW_H #ifndef KEYBOARD_WINDOW_H
#define KEYBOARD_WINDOW_H #define KEYBOARD_WINDOW_H
#include <Button.h>
#include <Window.h> #include <Window.h>
#include "KeyboardSettings.h" #include "KeyboardSettings.h"
@@ -21,11 +22,13 @@ public:
KeyboardWindow(); KeyboardWindow();
bool QuitRequested(); bool QuitRequested();
void MessageReceived(BMessage *message); void MessageReceived(BMessage* message);
private: private:
KeyboardView *fView; KeyboardView *fSettingsView;
KeyboardSettings fSettings; KeyboardSettings fSettings;
BButton *fDefaultsButton;
BButton *fRevertButton;
}; };
#endif #endif
+10 -1
View File
@@ -8,7 +8,16 @@ Preference Mouse :
MouseWindow.cpp MouseWindow.cpp
MouseView.cpp MouseView.cpp
SettingsView.cpp SettingsView.cpp
: translation be $(TARGET_LIBSUPC++) : translation be $(TARGET_LIBSUPC++) liblocale.so
: Mouse.rdef : Mouse.rdef
; ;
DoCatalogs Mouse :
x-vnd.Haiku-Mouse
:
Mouse.cpp
MouseWindow.cpp
SettingsView.cpp
: en.catalog
: fr.catkeys
;
+6 -1
View File
@@ -15,6 +15,8 @@
#include <Alert.h> #include <Alert.h>
#include <Screen.h> #include <Screen.h>
#undef TR_CONTEXT
#define TR_CONTEXT "MouseApplication"
const char* kSignature = "application/x-vnd.Haiku-Mouse"; const char* kSignature = "application/x-vnd.Haiku-Mouse";
@@ -23,6 +25,8 @@ MouseApplication::MouseApplication()
: :
BApplication(kSignature) BApplication(kSignature)
{ {
be_locale->GetAppCatalog(&fCatalog);
BRect rect(0, 0, 397, 293); BRect rect(0, 0, 397, 293);
MouseWindow *window = new MouseWindow(rect); MouseWindow *window = new MouseWindow(rect);
window->Show(); window->Show();
@@ -32,7 +36,8 @@ MouseApplication::MouseApplication()
void void
MouseApplication::AboutRequested() MouseApplication::AboutRequested()
{ {
(new BAlert("about", "...by Andrew Edward McCall", "Dig Deal"))->Go(); (new BAlert("about", TR("...by Andrew Edward McCall"),
TR("Dig Deal")))->Go();
} }
+4
View File
@@ -12,6 +12,8 @@
#include <Application.h> #include <Application.h>
#include <Catalog.h>
#include <Locale.h>
class MouseApplication : public BApplication { class MouseApplication : public BApplication {
@@ -19,6 +21,8 @@ public:
MouseApplication(); MouseApplication();
virtual void AboutRequested(); virtual void AboutRequested();
private:
BCatalog fCatalog;
}; };
#endif /* MOUSE_H */ #endif /* MOUSE_H */
+7 -3
View File
@@ -14,8 +14,10 @@
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <Debug.h> #include <Debug.h>
#include <Locale.h>
#include <Menu.h> #include <Menu.h>
#include <MenuField.h> #include <MenuField.h>
#include <MenuItem.h> #include <MenuItem.h>
@@ -27,10 +29,12 @@
#include "MouseConstants.h" #include "MouseConstants.h"
#include "SettingsView.h" #include "SettingsView.h"
#undef TR_CONTEXT
#define TR_CONTEXT "MouseWindow"
MouseWindow::MouseWindow(BRect _rect) 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_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
B_AUTO_UPDATE_SIZE_LIMITS) B_AUTO_UPDATE_SIZE_LIMITS)
{ {
@@ -40,11 +44,11 @@ MouseWindow::MouseWindow(BRect _rect)
fSettingsBox->AddChild(fSettingsView); fSettingsBox->AddChild(fSettingsView);
// Add the "Default" button // Add the "Default" button
fDefaultsButton = new BButton("Defaults", new BMessage(kMsgDefaults)); fDefaultsButton = new BButton(TR("Defaults"), new BMessage(kMsgDefaults));
fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
// Add the "Revert" button // Add the "Revert" button
fRevertButton = new BButton("Revert", new BMessage(kMsgRevert)); fRevertButton = new BButton(TR("Revert"), new BMessage(kMsgRevert));
fRevertButton->SetEnabled(false); fRevertButton->SetEnabled(false);
SetPulseRate(100000); SetPulseRate(100000);
+32 -21
View File
@@ -14,10 +14,12 @@
#include <Bitmap.h> #include <Bitmap.h>
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <Debug.h> #include <Debug.h>
#include <GroupLayout.h> #include <GroupLayout.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
#include <Locale.h>
#include <MenuField.h> #include <MenuField.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <PopUpMenu.h> #include <PopUpMenu.h>
@@ -62,6 +64,8 @@ focus_follows_mouse_mode_to_index(mode_focus_follows_mouse mode)
// #pragma mark - // #pragma mark -
#undef TR_CONTEXT
#define TR_CONTEXT "SettingsView"
SettingsView::SettingsView(MouseSettings &settings) SettingsView::SettingsView(MouseSettings &settings)
: BBox("main_view"), : BBox("main_view"),
@@ -69,48 +73,53 @@ SettingsView::SettingsView(MouseSettings &settings)
{ {
// Add the "Mouse Type" pop up menu // Add the "Mouse Type" pop up menu
fTypeMenu = new BPopUpMenu("unknown"); fTypeMenu = new BPopUpMenu("unknown");
fTypeMenu->AddItem(new BMenuItem("1-Button", new BMessage(kMsgMouseType))); fTypeMenu->AddItem(new BMenuItem(TR("1-Button"),
fTypeMenu->AddItem(new BMenuItem("2-Button", new BMessage(kMsgMouseType))); new BMessage(kMsgMouseType)));
fTypeMenu->AddItem(new BMenuItem("3-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); fTypeField->SetAlignment(B_ALIGN_RIGHT);
// Create the "Double-click speed slider... // Create the "Double-click speed slider...
fClickSpeedSlider = new BSlider("double_click_speed", "Double-click speed", fClickSpeedSlider = new BSlider("double_click_speed",
new BMessage(kMsgDoubleClickSpeed), 0, 1000, B_HORIZONTAL); TR("Double-click speed"), new BMessage(kMsgDoubleClickSpeed),
0, 1000, B_HORIZONTAL);
fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fClickSpeedSlider->SetHashMarkCount(5); fClickSpeedSlider->SetHashMarkCount(5);
fClickSpeedSlider->SetLimitLabels("Slow", "Fast"); fClickSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
// Create the "Mouse Speed" slider... // 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); new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL);
fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fMouseSpeedSlider->SetHashMarkCount(7); fMouseSpeedSlider->SetHashMarkCount(7);
fMouseSpeedSlider->SetLimitLabels("Slow", "Fast"); fMouseSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
// Create the "Mouse Acceleration" slider... // Create the "Mouse Acceleration" slider...
fAccelerationSlider = new BSlider("mouse_acceleration", fAccelerationSlider = new BSlider("mouse_acceleration",
"Mouse Acceleration", new BMessage(kMsgAccelerationFactor), TR("Mouse Acceleration"), new BMessage(kMsgAccelerationFactor),
0, 1000, B_HORIZONTAL); 0, 1000, B_HORIZONTAL);
fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
fAccelerationSlider->SetHashMarkCount(5); fAccelerationSlider->SetHashMarkCount(5);
fAccelerationSlider->SetLimitLabels("Slow", "Fast"); fAccelerationSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
// Mouse image... // Mouse image...
fMouseView = new MouseView(fSettings); fMouseView = new MouseView(fSettings);
// Create the "Double-click test area" text box... // Create the "Double-click test area" text box...
BTextControl *fDoubleClick = new BTextControl(NULL, BTextControl *fDoubleClick = new BTextControl(NULL,
"Double-click test area", NULL); TR("Double-click test area"), NULL);
fDoubleClick->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER); fDoubleClick->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
// Add the "Mouse focus mode" pop up menu // 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", const char *focusLabels[] = {TR_MARK("Click to Activate"),
"Focus Follows Mouse"}; TR_MARK("Click to Focus"),TR_MARK("Focus Follows Mouse")};
const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE, const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE,
B_FOCUS_FOLLOWS_MOUSE}; B_FOCUS_FOLLOWS_MOUSE};
@@ -118,16 +127,18 @@ SettingsView::SettingsView(MouseSettings &settings)
BMessage *message = new BMessage(kMsgMouseFocusMode); BMessage *message = new BMessage(kMsgMouseFocusMode);
message->AddInt32("mode", focusModes[i]); 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); fFocusField->SetAlignment(B_ALIGN_RIGHT);
// Add the "Focus follows mouse mode" pop up menu // 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[] = const mode_focus_follows_mouse focusFollowsMouseModes[] =
{B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE, {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE}; B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};
@@ -138,7 +149,7 @@ SettingsView::SettingsView(MouseSettings &settings)
focusFollowsMouseModes[i]); focusFollowsMouseModes[i]);
fFocusFollowsMouseMenu->AddItem(new BMenuItem( fFocusFollowsMouseMenu->AddItem(new BMenuItem(
focusFollowsMouseLabels[i], message)); TR(focusFollowsMouseLabels[i]), message));
} }
BMenuField *fFocusFollowsMouseField = new BMenuField( BMenuField *fFocusFollowsMouseField = new BMenuField(
@@ -146,7 +157,7 @@ SettingsView::SettingsView(MouseSettings &settings)
fFocusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT); fFocusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT);
// Add the "Click-through" check box // Add the "Click-through" check box
fAcceptFirstClickBox = new BCheckBox("Accept first click", fAcceptFirstClickBox = new BCheckBox(TR("Accept first click"),
new BMessage(kMsgAcceptFirstClick)); new BMessage(kMsgAcceptFirstClick));
// dividers // dividers