Ticket #4966: mouse.patch
File mouse.patch, 8.0 KB (added by , 15 years ago) |
---|
-
MouseWindow.cpp
14 14 #include <GroupLayout.h> 15 15 #include <GroupLayoutBuilder.h> 16 16 #include <Button.h> 17 #include <Catalog.h> 17 18 #include <CheckBox.h> 18 19 #include <Debug.h> 20 #include <Locale.h> 19 21 #include <Menu.h> 20 22 #include <MenuField.h> 21 23 #include <MenuItem.h> … … 27 29 #include "MouseConstants.h" 28 30 #include "SettingsView.h" 29 31 32 #undef TR_CONTEXT 33 #define TR_CONTEXT "MouseWindow" 30 34 31 35 MouseWindow::MouseWindow(BRect _rect) 32 36 : 33 BWindow(_rect, "Mouse", B_TITLED_WINDOW,37 BWindow(_rect, TR("Mouse"), B_TITLED_WINDOW, 34 38 B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | 35 39 B_AUTO_UPDATE_SIZE_LIMITS) 36 40 { … … 40 44 fSettingsBox->AddChild(fSettingsView); 41 45 42 46 // Add the "Default" button 43 fDefaultsButton = new BButton( "Defaults", new BMessage(kMsgDefaults));47 fDefaultsButton = new BButton(TR("Defaults"), new BMessage(kMsgDefaults)); 44 48 fDefaultsButton->SetEnabled(fSettings.IsDefaultable()); 45 49 46 50 // Add the "Revert" button 47 fRevertButton = new BButton( "Revert", new BMessage(kMsgRevert));51 fRevertButton = new BButton(TR("Revert"), new BMessage(kMsgRevert)); 48 52 fRevertButton->SetEnabled(false); 49 53 50 54 SetPulseRate(100000); -
Jamfile
8 8 MouseWindow.cpp 9 9 MouseView.cpp 10 10 SettingsView.cpp 11 : translation be $(TARGET_LIBSUPC++) 11 : translation be $(TARGET_LIBSUPC++) liblocale.so 12 12 : Mouse.rdef 13 13 ; 14 14 15 DoCatalogs Mouse : 16 x-vnd.Haiku-Mouse 17 : 18 Mouse.cpp 19 MouseWindow.cpp 20 SettingsView.cpp 21 : en.catalog 22 ; -
Mouse.cpp
15 15 #include <Alert.h> 16 16 #include <Screen.h> 17 17 18 #undef TR_CONTEXT 19 #define TR_CONTEXT "MouseApplication" 18 20 19 21 const char* kSignature = "application/x-vnd.Haiku-Mouse"; 20 22 … … 23 25 : 24 26 BApplication(kSignature) 25 27 { 28 be_locale->GetAppCatalog(&fCatalog); 29 26 30 BRect rect(0, 0, 397, 293); 27 31 MouseWindow *window = new MouseWindow(rect); 28 32 window->Show(); … … 32 36 void 33 37 MouseApplication::AboutRequested() 34 38 { 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(); 36 41 } 37 42 38 43 -
SettingsView.cpp
14 14 #include <Bitmap.h> 15 15 #include <Box.h> 16 16 #include <Button.h> 17 #include <Catalog.h> 17 18 #include <Debug.h> 18 19 #include <GroupLayout.h> 19 20 #include <GroupLayoutBuilder.h> 20 21 #include <InterfaceDefs.h> 22 #include <Locale.h> 21 23 #include <MenuField.h> 22 24 #include <MenuItem.h> 23 25 #include <PopUpMenu.h> … … 62 64 63 65 // #pragma mark - 64 66 67 #undef TR_CONTEXT 68 #define TR_CONTEXT "SettingsView" 65 69 66 70 SettingsView::SettingsView(MouseSettings &settings) 67 71 : BBox("main_view"), … … 69 73 { 70 74 // Add the "Mouse Type" pop up menu 71 75 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))); 75 82 76 BMenuField *fTypeField = new BMenuField("Mouse type:", fTypeMenu, NULL); 83 BMenuField *fTypeField = new BMenuField(TR("Mouse type:"), 84 fTypeMenu, NULL); 77 85 fTypeField->SetAlignment(B_ALIGN_RIGHT); 78 86 79 87 // 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); 82 91 fClickSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); 83 92 fClickSpeedSlider->SetHashMarkCount(5); 84 fClickSpeedSlider->SetLimitLabels( "Slow", "Fast");93 fClickSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast")); 85 94 86 95 // Create the "Mouse Speed" slider... 87 fMouseSpeedSlider = new BSlider("mouse_speed", "Mouse Speed",96 fMouseSpeedSlider = new BSlider("mouse_speed", TR("Mouse Speed"), 88 97 new BMessage(kMsgMouseSpeed), 0, 1000, B_HORIZONTAL); 89 98 fMouseSpeedSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); 90 99 fMouseSpeedSlider->SetHashMarkCount(7); 91 fMouseSpeedSlider->SetLimitLabels( "Slow", "Fast");100 fMouseSpeedSlider->SetLimitLabels(TR("Slow"), TR("Fast")); 92 101 93 102 // Create the "Mouse Acceleration" slider... 94 103 fAccelerationSlider = new BSlider("mouse_acceleration", 95 "Mouse Acceleration", new BMessage(kMsgAccelerationFactor),104 TR("Mouse Acceleration"), new BMessage(kMsgAccelerationFactor), 96 105 0, 1000, B_HORIZONTAL); 97 106 fAccelerationSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); 98 107 fAccelerationSlider->SetHashMarkCount(5); 99 fAccelerationSlider->SetLimitLabels( "Slow", "Fast");108 fAccelerationSlider->SetLimitLabels(TR("Slow"), TR("Fast")); 100 109 101 110 // Mouse image... 102 111 fMouseView = new MouseView(fSettings); 103 112 104 113 // Create the "Double-click test area" text box... 105 114 BTextControl *fDoubleClick = new BTextControl(NULL, 106 "Double-click test area", NULL);115 TR("Double-click test area"), NULL); 107 116 fDoubleClick->SetAlignment(B_ALIGN_LEFT, B_ALIGN_CENTER); 108 117 109 118 // Add the "Mouse focus mode" pop up menu 110 fFocusMenu = new BPopUpMenu( "Click to Activate");119 fFocusMenu = new BPopUpMenu(TR("Click to Activate")); 111 120 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")}; 114 123 const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE, 115 124 B_FOCUS_FOLLOWS_MOUSE}; 116 125 … … 118 127 BMessage *message = new BMessage(kMsgMouseFocusMode); 119 128 message->AddInt32("mode", focusModes[i]); 120 129 121 fFocusMenu->AddItem(new BMenuItem( focusLabels[i], message));130 fFocusMenu->AddItem(new BMenuItem(TR(focusLabels[i]), message)); 122 131 } 123 132 124 BMenuField *fFocusField = new BMenuField("Focus mode:", fFocusMenu, NULL); 133 BMenuField *fFocusField = new BMenuField(TR("Focus mode:"), 134 fFocusMenu, NULL); 125 135 fFocusField->SetAlignment(B_ALIGN_RIGHT); 126 136 127 137 // Add the "Focus follows mouse mode" pop up menu 128 fFocusFollowsMouseMenu = new BPopUpMenu( "Normal");138 fFocusFollowsMouseMenu = new BPopUpMenu(TR("Normal")); 129 139 130 const char *focusFollowsMouseLabels[] = {"Normal", "Warp", "Instant Warp"}; 140 const char *focusFollowsMouseLabels[] = {TR_MARK("Normal"), 141 TR_MARK("Warp"), TR_MARK("Instant Warp")}; 131 142 const mode_focus_follows_mouse focusFollowsMouseModes[] = 132 143 {B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE, 133 144 B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE}; … … 138 149 focusFollowsMouseModes[i]); 139 150 140 151 fFocusFollowsMouseMenu->AddItem(new BMenuItem( 141 focusFollowsMouseLabels[i], message));152 TR(focusFollowsMouseLabels[i]), message)); 142 153 } 143 154 144 155 BMenuField *fFocusFollowsMouseField = new BMenuField( … … 146 157 fFocusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT); 147 158 148 159 // Add the "Click-through" check box 149 fAcceptFirstClickBox = new BCheckBox( "Accept first click",160 fAcceptFirstClickBox = new BCheckBox(TR("Accept first click"), 150 161 new BMessage(kMsgAcceptFirstClick)); 151 162 152 163 // dividers -
Mouse.h
12 12 13 13 14 14 #include <Application.h> 15 #include <Catalog.h> 16 #include <Locale.h> 15 17 16 18 17 19 class MouseApplication : public BApplication { … … 19 21 MouseApplication(); 20 22 21 23 virtual void AboutRequested(); 24 private: 25 BCatalog fCatalog; 22 26 }; 23 27 24 28 #endif /* MOUSE_H */