Ticket #4966: mouse.patch

File mouse.patch, 8.0 KB (added by mt, 10 years ago)

patch file

  • MouseWindow.cpp

     
    1414#include <GroupLayout.h>
    1515#include <GroupLayoutBuilder.h>
    1616#include <Button.h>
     17#include <Catalog.h>
    1718#include <CheckBox.h>
    1819#include <Debug.h>
     20#include <Locale.h>
    1921#include <Menu.h>
    2022#include <MenuField.h>
    2123#include <MenuItem.h>
     
    2729#include "MouseConstants.h"
    2830#include "SettingsView.h"
    2931
     32#undef TR_CONTEXT
     33#define TR_CONTEXT "MouseWindow"
    3034
    3135MouseWindow::MouseWindow(BRect _rect)
    3236    :
    33         BWindow(_rect, "Mouse", B_TITLED_WINDOW,
     37        BWindow(_rect, TR("Mouse"), B_TITLED_WINDOW,
    3438            B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
    3539                B_AUTO_UPDATE_SIZE_LIMITS)
    3640{
     
    4044    fSettingsBox->AddChild(fSettingsView);
    4145
    4246    // Add the "Default" button
    43     fDefaultsButton = new BButton("Defaults", new BMessage(kMsgDefaults));
     47    fDefaultsButton = new BButton(TR("Defaults"), new BMessage(kMsgDefaults));
    4448    fDefaultsButton->SetEnabled(fSettings.IsDefaultable());
    4549
    4650    // Add the "Revert" button
    47     fRevertButton = new BButton("Revert", new BMessage(kMsgRevert));
     51    fRevertButton = new BButton(TR("Revert"), new BMessage(kMsgRevert));
    4852    fRevertButton->SetEnabled(false);
    4953
    5054    SetPulseRate(100000);
  • Jamfile

     
    88    MouseWindow.cpp
    99    MouseView.cpp
    1010    SettingsView.cpp
    11     : translation be $(TARGET_LIBSUPC++)
     11    : translation be $(TARGET_LIBSUPC++) liblocale.so
    1212    : Mouse.rdef
    1313    ;
    1414
     15DoCatalogs Mouse :
     16    x-vnd.Haiku-Mouse
     17    :
     18    Mouse.cpp
     19    MouseWindow.cpp
     20    SettingsView.cpp
     21    : en.catalog
     22    ;
  • Mouse.cpp

     
    1515#include <Alert.h>
    1616#include <Screen.h>
    1717
     18#undef TR_CONTEXT
     19#define TR_CONTEXT "MouseApplication"
    1820
    1921const char* kSignature = "application/x-vnd.Haiku-Mouse";
    2022
     
    2325    :
    2426    BApplication(kSignature)                   
    2527{
     28    be_locale->GetAppCatalog(&fCatalog);
     29   
    2630    BRect rect(0, 0, 397, 293);
    2731    MouseWindow *window = new MouseWindow(rect);
    2832    window->Show();
     
    3236void
    3337MouseApplication::AboutRequested()
    3438{
    35     (new BAlert("about", "...by Andrew Edward McCall", "Dig Deal"))->Go();
     39    (new BAlert("about", TR("...by Andrew Edward McCall"),
     40        TR("Dig Deal")))->Go();
    3641}
    3742
    3843
  • SettingsView.cpp

     
    1414#include <Bitmap.h>
    1515#include <Box.h>
    1616#include <Button.h>
     17#include <Catalog.h>
    1718#include <Debug.h>
    1819#include <GroupLayout.h>
    1920#include <GroupLayoutBuilder.h>
    2021#include <InterfaceDefs.h>
     22#include <Locale.h>
    2123#include <MenuField.h>
    2224#include <MenuItem.h>
    2325#include <PopUpMenu.h>
     
    6264
    6365//  #pragma mark -
    6466
     67#undef TR_CONTEXT
     68#define TR_CONTEXT "SettingsView"
    6569
    6670SettingsView::SettingsView(MouseSettings &settings)
    6771    : BBox("main_view"),
     
    6973{
    7074    // Add the "Mouse Type" pop up menu
    7175    fTypeMenu = new BPopUpMenu("unknown");
    72     fTypeMenu->AddItem(new BMenuItem("1-Button", new BMessage(kMsgMouseType)));
    73     fTypeMenu->AddItem(new BMenuItem("2-Button", new BMessage(kMsgMouseType)));
    74     fTypeMenu->AddItem(new BMenuItem("3-Button", new BMessage(kMsgMouseType)));
     76    fTypeMenu->AddItem(new BMenuItem(TR("1-Button"),
     77        new BMessage(kMsgMouseType)));
     78    fTypeMenu->AddItem(new BMenuItem(TR("2-Button"),
     79        new BMessage(kMsgMouseType)));
     80    fTypeMenu->AddItem(new BMenuItem(TR("3-Button"),
     81        new BMessage(kMsgMouseType)));
    7582
    76     BMenuField *fTypeField = new BMenuField("Mouse type:", fTypeMenu, NULL);
     83    BMenuField *fTypeField = new BMenuField(TR("Mouse type:"),
     84        fTypeMenu, NULL);
    7785    fTypeField->SetAlignment(B_ALIGN_RIGHT);
    7886
    7987    // Create the "Double-click speed slider...
    80     fClickSpeedSlider = new BSlider("double_click_speed", "Double-click speed",
    81         new BMessage(kMsgDoubleClickSpeed), 0, 1000, B_HORIZONTAL);
     88    fClickSpeedSlider = new BSlider("double_click_speed",
     89        TR("Double-click speed"), new BMessage(kMsgDoubleClickSpeed),
     90        0, 1000, B_HORIZONTAL);
    8291    fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
    8392    fClickSpeedSlider->SetHashMarkCount(5);
    84     fClickSpeedSlider->SetLimitLabels("Slow", "Fast");
     93    fClickSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
    8594
    8695    // Create the "Mouse Speed" slider...
    87     fMouseSpeedSlider = new BSlider("mouse_speed", "Mouse Speed",
     96    fMouseSpeedSlider = new BSlider("mouse_speed", TR("Mouse Speed"),
    8897        new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL);
    8998    fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
    9099    fMouseSpeedSlider->SetHashMarkCount(7);
    91     fMouseSpeedSlider->SetLimitLabels("Slow", "Fast");
     100    fMouseSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
    92101
    93102    // Create the "Mouse Acceleration" slider...
    94103    fAccelerationSlider = new BSlider("mouse_acceleration",
    95         "Mouse Acceleration", new BMessage(kMsgAccelerationFactor),
     104        TR("Mouse Acceleration"), new BMessage(kMsgAccelerationFactor),
    96105        0, 1000, B_HORIZONTAL);
    97106    fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
    98107    fAccelerationSlider->SetHashMarkCount(5);
    99     fAccelerationSlider->SetLimitLabels("Slow", "Fast");
     108    fAccelerationSlider->SetLimitLabels(TR("Slow"), TR("Fast"));
    100109
    101110    // Mouse image...
    102111    fMouseView = new MouseView(fSettings);
    103112
    104113    // Create the "Double-click test area" text box...
    105114    BTextControl *fDoubleClick = new BTextControl(NULL,
    106         "Double-click test area", NULL);
     115        TR("Double-click test area"), NULL);
    107116    fDoubleClick->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER);
    108117
    109118    // Add the "Mouse focus mode" pop up menu
    110     fFocusMenu = new BPopUpMenu("Click to Activate");
     119    fFocusMenu = new BPopUpMenu(TR("Click to Activate"));
    111120   
    112     const char *focusLabels[] = {"Click to Activate", "Click to Focus",
    113                                     "Focus Follows Mouse"};
     121    const char *focusLabels[] = {TR_MARK("Click to Activate"),
     122        TR_MARK("Click to Focus"),TR_MARK("Focus Follows Mouse")};
    114123    const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE,
    115124                                        B_FOCUS_FOLLOWS_MOUSE};
    116125
     
    118127        BMessage *message = new BMessage(kMsgMouseFocusMode);
    119128        message->AddInt32("mode", focusModes[i]);
    120129
    121         fFocusMenu->AddItem(new BMenuItem(focusLabels[i], message));
     130        fFocusMenu->AddItem(new BMenuItem(TR(focusLabels[i]), message));
    122131    }
    123132
    124     BMenuField *fFocusField = new BMenuField("Focus mode:", fFocusMenu, NULL);
     133    BMenuField *fFocusField = new BMenuField(TR("Focus mode:"),
     134        fFocusMenu, NULL);
    125135    fFocusField->SetAlignment(B_ALIGN_RIGHT);
    126136   
    127137    // Add the "Focus follows mouse mode" pop up menu
    128     fFocusFollowsMouseMenu = new BPopUpMenu("Normal");
     138    fFocusFollowsMouseMenu = new BPopUpMenu(TR("Normal"));
    129139   
    130     const char *focusFollowsMouseLabels[] = {"Normal", "Warp", "Instant Warp"};
     140    const char *focusFollowsMouseLabels[] = {TR_MARK("Normal"),
     141        TR_MARK("Warp"), TR_MARK("Instant Warp")};
    131142    const mode_focus_follows_mouse focusFollowsMouseModes[] =
    132143        {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
    133144            B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};
     
    138149            focusFollowsMouseModes[i]);
    139150
    140151        fFocusFollowsMouseMenu->AddItem(new BMenuItem(
    141             focusFollowsMouseLabels[i], message));
     152            TR(focusFollowsMouseLabels[i]), message));
    142153    }
    143154
    144155    BMenuField *fFocusFollowsMouseField = new BMenuField(
     
    146157    fFocusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT);
    147158
    148159    // Add the "Click-through" check box
    149     fAcceptFirstClickBox = new BCheckBox("Accept first click",
     160    fAcceptFirstClickBox = new BCheckBox(TR("Accept first click"),
    150161        new BMessage(kMsgAcceptFirstClick));
    151162
    152163    // dividers
  • Mouse.h

     
    1212
    1313
    1414#include <Application.h>
     15#include <Catalog.h>
     16#include <Locale.h>
    1517
    1618
    1719class MouseApplication : public BApplication {
     
    1921        MouseApplication();
    2022
    2123        virtual void AboutRequested();
     24private:
     25        BCatalog fCatalog;
    2226};
    2327
    2428#endif  /* MOUSE_H */