Ticket #6110: pulseLocalization.patch
File pulseLocalization.patch, 25.9 KB (added by , 14 years ago) |
---|
-
src/apps/pulse/ConfigView.cpp
14 14 #include "PulseApp.h" 15 15 #include "PrefsWindow.h" 16 16 17 #include <Catalog.h> 17 18 #include <CheckBox.h> 19 #include <Locale.h> 18 20 #include <RadioButton.h> 19 21 #include <TextControl.h> 20 22 … … 23 25 #include <stdio.h> 24 26 #include <string.h> 25 27 28 #undef B_TRANSLATE_CONTEXT 29 #define B_TRANSLATE_CONTEXT "ConfigView" 26 30 31 27 32 RTColorControl::RTColorControl(BPoint point, BMessage *message) 28 33 : BColorControl(point, B_CELLS_32x8, 6, "ColorControl", message, false) 29 34 { … … 61 66 fActiveButton = fIdleButton = fFrameButton = NULL; 62 67 fIconWidthControl = NULL; 63 68 64 SetLabel( "Bar colors");69 SetLabel(B_TRANSLATE("Bar colors")); 65 70 66 71 font_height fontHeight; 67 72 be_bold_font->GetHeight(&fontHeight); … … 78 83 if (mode == PRV_NORMAL_CHANGE_COLOR) { 79 84 // normal mode 80 85 81 fFadeCheckBox = new BCheckBox(rect, "FadeColors", "Fade colors",82 new BMessage(PRV_NORMAL_FADE_COLORS));86 fFadeCheckBox = new BCheckBox(rect, "FadeColors", 87 B_TRANSLATE("Fade colors"), new BMessage(PRV_NORMAL_FADE_COLORS)); 83 88 fFadeCheckBox->ResizeToPreferred(); 84 89 AddChild(fFadeCheckBox); 85 90 … … 88 93 } else if (mode == PRV_MINI_CHANGE_COLOR) { 89 94 // mini mode 90 95 91 fActiveButton = new BRadioButton(rect, "ActiveColor", "Active color",92 new BMessage(PRV_MINI_ACTIVE));96 fActiveButton = new BRadioButton(rect, "ActiveColor", 97 B_TRANSLATE("Active color"), new BMessage(PRV_MINI_ACTIVE)); 93 98 fActiveButton->ResizeToPreferred(); 94 99 fActiveButton->SetValue(B_CONTROL_ON); 95 100 AddChild(fActiveButton); 96 101 97 102 rect.left = fActiveButton->Frame().right + 5.0f; 98 fIdleButton = new BRadioButton(rect, "IdleColor", "Idle color",99 new BMessage(PRV_MINI_IDLE));103 fIdleButton = new BRadioButton(rect, "IdleColor", 104 B_TRANSLATE("Idle color"), new BMessage(PRV_MINI_IDLE)); 100 105 fIdleButton->ResizeToPreferred(); 101 106 AddChild(fIdleButton); 102 107 103 108 rect.left = fIdleButton->Frame().right + 5.0f; 104 fFrameButton = new BRadioButton(rect, "FrameColor", "Frame color",105 new BMessage(PRV_MINI_FRAME));109 fFrameButton = new BRadioButton(rect, "FrameColor", 110 B_TRANSLATE("Frame color"), new BMessage(PRV_MINI_FRAME)); 106 111 fFrameButton->ResizeToPreferred(); 107 112 AddChild(fFrameButton); 108 113 109 114 fColorControl->SetValue(fPrefs->mini_active_color); 110 115 } else { 111 116 // deskbar mode 112 fActiveButton = new BRadioButton(rect, "ActiveColor", "Active color",113 new BMessage(PRV_DESKBAR_ACTIVE));117 fActiveButton = new BRadioButton(rect, "ActiveColor", 118 B_TRANSLATE("Active color"), new BMessage(PRV_DESKBAR_ACTIVE)); 114 119 fActiveButton->ResizeToPreferred(); 115 120 fActiveButton->SetValue(B_CONTROL_ON); 116 121 AddChild(fActiveButton); 117 122 118 123 rect.left = fActiveButton->Frame().right + 5.0f; 119 fIdleButton = new BRadioButton(rect, "IdleColor", "Idle color",120 new BMessage(PRV_DESKBAR_IDLE));124 fIdleButton = new BRadioButton(rect, "IdleColor", 125 B_TRANSLATE("Idle color"), new BMessage(PRV_DESKBAR_IDLE)); 121 126 fIdleButton->ResizeToPreferred(); 122 127 AddChild(fIdleButton); 123 128 124 129 rect.left = fIdleButton->Frame().right + 5.0f; 125 fFrameButton = new BRadioButton(rect, "FrameColor", "Frame color",126 new BMessage(PRV_DESKBAR_FRAME));130 fFrameButton = new BRadioButton(rect, "FrameColor", 131 B_TRANSLATE("Frame color"), new BMessage(PRV_DESKBAR_FRAME)); 127 132 fFrameButton->ResizeToPreferred(); 128 133 AddChild(fFrameButton); 129 134 … … 132 137 133 138 char temp[10]; 134 139 snprintf(temp, sizeof(temp), "%d", fPrefs->deskbar_icon_width); 135 fIconWidthControl = new BTextControl(rect, "Width", "Width of icon:", temp, 140 fIconWidthControl = new BTextControl(rect, "Width", 141 B_TRANSLATE("Width of icon:"), temp, 136 142 new BMessage(PRV_DESKBAR_ICON_WIDTH)); 137 143 AddChild(fIconWidthControl); 138 144 fIconWidthControl->SetDivider(be_plain_font->StringWidth( -
src/apps/pulse/MiniPulseView.cpp
1 //***************************************************************************** ***********1 //***************************************************************************** 2 2 // 3 3 // File: MiniPulseView.cpp 4 4 // … … 6 6 // 7 7 // Copyright 1999, Be Incorporated 8 8 // 9 //***************************************************************************** ***********9 //***************************************************************************** 10 10 11 11 #include "MiniPulseView.h" 12 12 #include "Common.h" 13 #include <Catalog.h> 14 #include <Locale.h> 13 15 #include <interface/Window.h> 14 16 17 #undef B_TRANSLATE_CONTEXT 18 #define B_TRANSLATE_CONTEXT "MiniPulseView" 19 20 15 21 MiniPulseView::MiniPulseView(BRect rect, const char *name, Prefs *prefs) : 16 22 PulseView(rect, name) { 17 23 18 mode1->SetLabel( "Normal mode");24 mode1->SetLabel(B_TRANSLATE("Normal mode")); 19 25 mode1->SetMessage(new BMessage(PV_NORMAL_MODE)); 20 mode2->SetLabel( "Deskbar mode");26 mode2->SetLabel(B_TRANSLATE("Deskbar mode")); 21 27 mode2->SetMessage(new BMessage(PV_DESKBAR_MODE)); 22 quit = new BMenuItem( "Quit", new BMessage(PV_QUIT), 0, 0);28 quit = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(PV_QUIT), 0, 0); 23 29 popupmenu->AddSeparatorItem(); 24 30 popupmenu->AddItem(quit); 25 31 … … 41 47 } 42 48 43 49 // These two are only used by DeskbarPulseView, and so do nothing 44 MiniPulseView::MiniPulseView(BRect rect, const char *name) : PulseView(rect, name) { 50 MiniPulseView::MiniPulseView(BRect rect, const char *name) 51 : 52 PulseView(rect, name) 53 { 45 54 46 55 } 47 56 48 MiniPulseView::MiniPulseView(BMessage *message) : PulseView(message) { 57 MiniPulseView::MiniPulseView(BMessage *message) 58 : 59 PulseView(message) 60 { 49 61 50 62 } 51 63 … … 53 65 void MiniPulseView::Draw(BRect rect) { 54 66 system_info sys_info; 55 67 get_system_info(&sys_info); 56 if (sys_info.cpu_count > B_MAX_CPU_COUNT || sys_info.cpu_count <= 0) return; 68 if (sys_info.cpu_count > B_MAX_CPU_COUNT || sys_info.cpu_count <= 0) 69 return; 57 70 58 71 BRect bounds(Bounds()); 59 72 SetDrawingMode(B_OP_COPY); … … 70 83 double rem = cpu_times[x] * (h + 1) - bar_height; 71 84 72 85 rgb_color fraction_color; 73 fraction_color.red = (uint8)(idle_color.red + rem * (active_color.red - idle_color.red)); 74 fraction_color.green = (uint8)(idle_color.green + rem * (active_color.green - idle_color.green)); 75 fraction_color.blue = (uint8)(idle_color.blue + rem * (active_color.blue - idle_color.blue)); 86 fraction_color.red = (uint8)(idle_color.red + rem 87 * (active_color.red - idle_color.red)); 88 fraction_color.green = (uint8)(idle_color.green + rem 89 * (active_color.green - idle_color.green)); 90 fraction_color.blue = (uint8)(idle_color.blue + rem 91 * (active_color.blue - idle_color.blue)); 76 92 fraction_color.alpha = 0xff; 77 93 78 94 int idle_height = h - bar_height; -
src/apps/pulse/PrefsWindow.cpp
14 14 #include "PulseApp.h" 15 15 #include "ConfigView.h" 16 16 17 #include <Catalog.h> 17 18 #include <Button.h> 19 #include <Locale.h> 18 20 #include <TabView.h> 19 21 #include <TextControl.h> 20 22 21 23 #include <stdlib.h> 22 24 #include <stdio.h> 23 25 26 #undef B_TRANSLATE_CONTEXT 27 #define B_TRANSLATE_CONTEXT "PrefsWindow" 24 28 25 PrefsWindow::PrefsWindow(BRect frame, const char *name, BMessenger *messenger, Prefs *prefs) 29 30 PrefsWindow::PrefsWindow(BRect frame, const char *name, 31 BMessenger *messenger, Prefs *prefs) 26 32 : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE 27 33 | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS), 28 34 fTarget(*messenger), … … 43 49 BRect rect = fTabView->ContainerView()->Bounds(); 44 50 rect.InsetBy(5, 5); 45 51 46 ConfigView *normalView = new ConfigView(rect, "Normal mode",52 ConfigView *normalView = new ConfigView(rect, B_TRANSLATE("Normal mode"), 47 53 PRV_NORMAL_CHANGE_COLOR, fTarget, prefs); 48 54 fTabView->AddTab(normalView); 49 55 50 ConfigView *miniView = new ConfigView(rect, "Mini mode", PRV_MINI_CHANGE_COLOR,51 fTarget, prefs);56 ConfigView *miniView = new ConfigView(rect, B_TRANSLATE("Mini mode"), 57 PRV_MINI_CHANGE_COLOR, fTarget, prefs); 52 58 fTabView->AddTab(miniView); 53 59 54 ConfigView *deskbarView = new ConfigView(rect, "Deskbar mode", PRV_DESKBAR_CHANGE_COLOR,55 fTarget, prefs);60 ConfigView *deskbarView = new ConfigView(rect, B_TRANSLATE("Deskbar mode"), 61 PRV_DESKBAR_CHANGE_COLOR, fTarget, prefs); 56 62 fTabView->AddTab(deskbarView); 57 63 58 64 float width, height; … … 62 68 deskbarView->ResizeTo(width, height); 63 69 64 70 fTabView->Select(0L); 65 fTabView->ResizeTo(deskbarView->Bounds().Width() + 16.0f, deskbarView->Bounds().Height() 66 + fTabView->ContainerView()->Frame().top + 16.0f); 71 fTabView->ResizeTo(deskbarView->Bounds().Width() + 16.0f, 72 deskbarView->Bounds().Height() + 73 fTabView->ContainerView()->Frame().top + 16.0f); 67 74 68 BButton *okButton = new BButton(rect, "ok", "OK", new BMessage(PRV_BOTTOM_OK),69 B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);75 BButton *okButton = new BButton(rect, "ok", B_TRANSLATE("OK"), 76 new BMessage(PRV_BOTTOM_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); 70 77 okButton->ResizeToPreferred(); 71 78 okButton->MoveTo(Bounds().Width() - 8.0f - okButton->Bounds().Width(), 72 79 Bounds().Height() - 8.0f - okButton->Bounds().Height()); 73 80 topView->AddChild(okButton); 74 81 75 BButton *defaultsButton = new BButton(okButton->Frame(), "defaults", "Defaults", 76 new BMessage(PRV_BOTTOM_DEFAULTS), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); 82 BButton *defaultsButton = new BButton(okButton->Frame(), "defaults", 83 B_TRANSLATE("Defaults"), new BMessage(PRV_BOTTOM_DEFAULTS), 84 B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); 77 85 defaultsButton->ResizeToPreferred(); 78 86 defaultsButton->MoveBy(-defaultsButton->Bounds().Width() - 10.0f, 0.0f); 79 87 topView->AddChild(defaultsButton); … … 102 110 Hide(); 103 111 104 112 fTabView->Select(2); 105 ConfigView *deskbar = (ConfigView *)FindView("Deskbar mode"); 113 ConfigView *deskbar = (ConfigView *)FindView( 114 B_TRANSLATE("Deskbar mode")); 106 115 deskbar->UpdateDeskbarIconWidth(); 107 116 108 117 PostMessage(B_QUIT_REQUESTED); -
src/apps/pulse/DeskbarPulseView.cpp
12 12 #include "Common.h" 13 13 #include "Prefs.h" 14 14 #include <app/Application.h> 15 #include <Catalog.h> 15 16 #include <interface/Deskbar.h> 16 17 #include <interface/Alert.h> 18 #include <Locale.h> 17 19 #include <Roster.h> 18 20 #include <stdlib.h> 19 21 #include <string.h> 20 22 #include <stdio.h> 21 23 24 #undef B_TRANSLATE_CONTEXT 25 #define B_TRANSLATE_CONTEXT "DeskbarPulseView" 26 27 22 28 DeskbarPulseView::DeskbarPulseView(BRect rect) : MiniPulseView(rect, "DeskbarPulseView") { 23 29 messagerunner = NULL; 24 30 prefs = NULL; … … 26 32 } 27 33 28 34 DeskbarPulseView::DeskbarPulseView(BMessage *message) : MiniPulseView(message) { 29 mode1->SetLabel( "Normal mode");35 mode1->SetLabel(B_TRANSLATE("Normal mode")); 30 36 mode1->SetMessage(new BMessage(PV_NORMAL_MODE)); 31 mode2->SetLabel( "Mini mode");37 mode2->SetLabel(B_TRANSLATE("Mini mode")); 32 38 mode2->SetMessage(new BMessage(PV_MINI_MODE)); 33 quit = new BMenuItem( "Quit", new BMessage(PV_QUIT), 0, 0);39 quit = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(PV_QUIT), 0, 0); 34 40 popupmenu->AddSeparatorItem(); 35 41 popupmenu->AddItem(quit); 36 42 … … 118 124 prefswindow->Show(); 119 125 break; 120 126 case PV_ABOUT: { 121 BAlert *alert = new BAlert("Info", "Pulse\n\nBy David Ramsey and " 122 "Arve Hjønnevåg\nRevised by Daniel Switkin", "OK"); 127 BAlert *alert = new BAlert(B_TRANSLATE("Info"), 128 B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n" 129 "Revised by Daniel Switkin"), B_TRANSLATE("OK")); 123 130 alert->Go(NULL); 124 131 break; 125 132 } … … 169 176 status_t err = deskbar->RemoveItem("DeskbarPulseView"); 170 177 if (err != B_OK) { 171 178 char temp[255]; 172 sprintf(temp, "Remove(): %s", strerror(err)); 173 BAlert *alert = new BAlert("Info", temp, "OK"); 179 sprintf(temp, B_TRANSLATE("Remove(): %s"), strerror(err)); 180 BAlert *alert = new BAlert(B_TRANSLATE("Info"), temp, 181 B_TRANSLATE("OK")); 174 182 alert->Go(NULL); 175 183 } 176 184 delete deskbar; -
src/apps/pulse/PulseWindow.cpp
1 //***************************************************************************** ***********1 //***************************************************************************** 2 2 // 3 3 // File: PulseWindow.cpp 4 4 // … … 6 6 // 7 7 // Copyright 1999, Be Incorporated 8 8 // 9 //***************************************************************************** ***********9 //***************************************************************************** 10 10 11 11 12 12 #include "PulseWindow.h" … … 15 15 #include "DeskbarPulseView.h" 16 16 17 17 #include <Alert.h> 18 #include <Catalog.h> 18 19 #include <Deskbar.h> 20 #include <Locale.h> 19 21 #include <Screen.h> 20 22 21 23 #include <stdlib.h> 22 24 #include <string.h> 23 25 26 #undef B_TRANSLATE_CONTEXT 27 #define B_TRANSLATE_CONTEXT "PulseWindow" 24 28 29 25 30 PulseWindow::PulseWindow(BRect rect) : 26 31 BWindow(rect, "Pulse", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) 27 32 { 28 33 SetPulseRate(200000); 29 34 35 SetTitle(B_TRANSLATE("Pulse")); 36 30 37 PulseApp *pulseapp = (PulseApp *)be_app; 31 38 BRect bounds = Bounds(); 32 39 fNormalPulseView = new NormalPulseView(bounds); 33 40 AddChild(fNormalPulseView); 34 41 35 fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView", pulseapp->prefs); 42 fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView", 43 pulseapp->prefs); 36 44 AddChild(fMiniPulseView); 37 45 38 46 fMode = pulseapp->prefs->window_mode; … … 89 97 // Otherwise launch a new preferences window 90 98 PulseApp *pulseapp = (PulseApp *)be_app; 91 99 fPrefsWindow = new PrefsWindow(pulseapp->prefs->prefs_window_rect, 92 "Pulse settings", new BMessenger(this), pulseapp->prefs); 100 B_TRANSLATE("Pulse settings"), new BMessenger(this), 101 pulseapp->prefs); 93 102 fPrefsWindow->Show(); 94 103 break; 95 104 } 96 105 case PV_ABOUT: { 97 BAlert *alert = new BAlert("Info", "Pulse\n\nBy David Ramsey and Arve Hjønnevåg\nRevised by Daniel Switkin", "OK"); 106 BAlert *alert = new BAlert(B_TRANSLATE("Info"), 107 B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n" 108 "Revised by Daniel Switkin"), B_TRANSLATE("OK")); 98 109 // Use the asynchronous version so we don't block the window's thread 99 110 alert->Go(NULL); 100 111 break; -
src/apps/pulse/CPUButton.cpp
1 //***************************************************************************** ***********1 //***************************************************************************** 2 2 // 3 3 // File: CPUButton.cpp 4 4 // … … 6 6 // 7 7 // Copyright 1999, Be Incorporated 8 8 // 9 //***************************************************************************** ***********9 //***************************************************************************** 10 10 11 12 11 #include "CPUButton.h" 13 12 14 13 #include <stdlib.h> 15 14 #include <string.h> 16 15 17 16 #include <Alert.h> 17 #include <Catalog.h> 18 18 #include <Dragger.h> 19 #include <Locale.h> 19 20 #include <PopUpMenu.h> 20 21 21 22 #include <ViewPrivate.h> … … 26 27 #include "PulseView.h" 27 28 #include "Common.h" 28 29 30 #undef B_TRANSLATE_CONTEXT 31 #define B_TRANSLATE_CONTEXT "CPUButton" 29 32 33 30 34 CPUButton::CPUButton(BRect rect, const char *name, const char *label, BMessage *message) 31 35 : BControl(rect, name, label, message, B_FOLLOW_NONE, B_WILL_DRAW) 32 36 { … … 195 199 SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); 196 200 } else if ((B_SECONDARY_MOUSE_BUTTON & mouseButtons) != 0 197 201 && fReplicantInDeskbar) { 198 BPopUpMenu *menu = new BPopUpMenu( "Deskbar menu");199 menu->AddItem(new BMenuItem( "About Pulse" B_UTF8_ELLIPSIS,202 BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Deskbar menu")); 203 menu->AddItem(new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), 200 204 new BMessage(B_ABOUT_REQUESTED))); 201 205 menu->AddSeparatorItem(); 202 menu->AddItem(new BMenuItem( "Remove replicant",206 menu->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"), 203 207 new BMessage(kDeleteReplicant))); 204 208 menu->SetTargetForItems(this); 205 209 … … 237 241 if (!LastEnabledCPU(fCPU)) { 238 242 _kern_set_cpu_enabled(fCPU, Value()); 239 243 } else { 240 BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK"); 244 BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the " 245 "last active CPU."), B_TRANSLATE("OK")); 241 246 alert->Go(NULL); 242 247 SetValue(!Value()); 243 248 } … … 271 276 { 272 277 switch (message->what) { 273 278 case B_ABOUT_REQUESTED: { 274 BAlert *alert = new BAlert("Info", "Pulse\n\nBy David Ramsey and Arve Hjønnevåg\nRevised by Daniel Switkin", "OK"); 279 BAlert *alert = new BAlert(B_TRANSLATE("Info"), 280 B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n" 281 "Revised by Daniel Switkin"), B_TRANSLATE("OK")); 275 282 // Use the asynchronous version so we don't block the window's thread 276 283 alert->Go(NULL); 277 284 break; … … 313 320 fReplicantInDeskbar = false; 314 321 315 322 if (fReplicant) { 316 if (strcmp(Window()->Title(), "Deskbar")) {323 if (strcmp(Window()->Title(), B_TRANSLATE("Deskbar")) == 0) { 317 324 // Make room for dragger 318 325 ResizeBy(4, 4); 319 326 -
src/apps/pulse/PulseView.cpp
15 15 #include <string.h> 16 16 17 17 #include <Alert.h> 18 #include <Catalog.h> 19 #include <Locale.h> 18 20 19 21 #include <syscalls.h> 20 22 21 23 #include "Common.h" 22 24 #include "PulseApp.h" 23 25 26 #undef B_TRANSLATE_CONTEXT 27 #define B_TRANSLATE_CONTEXT "PulseView" 24 28 29 25 30 PulseView::PulseView(BRect rect, const char *name) : 26 31 BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS) { 27 32 … … 50 55 popupmenu->SetFont(be_plain_font); 51 56 mode1 = new BMenuItem("", NULL, 0, 0); 52 57 mode2 = new BMenuItem("", NULL, 0, 0); 53 preferences = new BMenuItem("Settings" B_UTF8_ELLIPSIS, new BMessage(PV_PREFERENCES), 0, 0); 54 about = new BMenuItem("About Pulse" B_UTF8_ELLIPSIS, new BMessage(PV_ABOUT), 0, 0); 58 preferences = new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), 59 new BMessage(PV_PREFERENCES), 0, 0); 60 about = new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), 61 new BMessage(PV_ABOUT), 0, 0); 55 62 56 63 popupmenu->AddItem(mode1); 57 64 popupmenu->AddItem(mode2); … … 121 128 if (!LastEnabledCPU(which)) { 122 129 _kern_set_cpu_enabled(which, (int)!cpu_menu_items[which]->IsMarked()); 123 130 } else { 124 BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK"); 131 BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the " 132 "last active CPU."), B_TRANSLATE("OK")); 125 133 alert->Go(NULL); 126 134 } 127 135 } -
src/apps/pulse/Jamfile
23 23 PulseView.cpp 24 24 PulseWindow.cpp 25 25 26 : be $(TARGET_LIBSUPC++)26 : be locale $(TARGET_LIBSUPC++) 27 27 : Pulse.rdef 28 28 ; 29 30 DoCatalogs Pulse : 31 x-vnd.Haiku-Pulse 32 : 33 PulseApp.cpp 34 PulseView.cpp 35 ConfigView.cpp 36 CPUButton.cpp 37 DeskbarPulseView.cpp 38 MiniPulseView.cpp 39 NormalPulseView.cpp 40 PrefsWindow.cpp 41 PulseWindow.cpp 42 ; -
src/apps/pulse/ProgressBar.cpp
1 //***************************************************************************** ***********1 //***************************************************************************** 2 2 // 3 3 // File: ProgressBar.cpp 4 4 // … … 6 6 // 7 7 // Copyright 1999, Be Incorporated 8 8 // 9 //***************************************************************************** ***********9 //***************************************************************************** 10 10 11 11 12 12 #include "ProgressBar.h" 13 13 #include "PulseApp.h" 14 14 15 15 16 ProgressBar::ProgressBar(BRect r, char *name) : BView(r, name, B_FOLLOW_NONE, B_WILL_DRAW) 16 ProgressBar::ProgressBar(BRect r, char *name) : BView(r, name, B_FOLLOW_NONE, 17 B_WILL_DRAW) 17 18 { 18 19 previous_value = current_value = 0; 19 20 … … 43 44 unsigned char blue_base = blue / 3; 44 45 45 46 for (int x = 0; x < 20; x++) { 46 segments[x].color.red = (uint8)(red_base + ((red - red_base) * ((float)x / 19.0))); 47 segments[x].color.green = (uint8)(green_base + ((green - green_base) * ((float)x / 19.0))); 48 segments[x].color.blue = (uint8)(blue_base + ((blue - blue_base) * ((float)x / 19.0))); 47 segments[x].color.red = (uint8)(red_base + ((red - red_base) 48 * ((float)x / 19.0))); 49 segments[x].color.green = (uint8)(green_base 50 + ((green - green_base) * ((float)x / 19.0))); 51 segments[x].color.blue = (uint8)(blue_base + ((blue - blue_base) 52 * ((float)x / 19.0))); 49 53 segments[x].color.alpha = 0xff; 50 54 } 51 55 } else { … … 151 155 SetHighColor(dkgray, dkgray, dkgray); 152 156 BRect frame = Bounds(); 153 157 StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.right, frame.top)); 154 StrokeLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right, frame.top + 1)); 155 StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.left, frame.bottom)); 156 StrokeLine(BPoint(frame.left + 1, frame.top), BPoint(frame.left + 1, frame.bottom)); 158 StrokeLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right, 159 frame.top + 1)); 160 StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.left, 161 frame.bottom)); 162 StrokeLine(BPoint(frame.left + 1, frame.top), 163 BPoint(frame.left + 1, frame.bottom)); 157 164 158 165 SetHighColor(ltgray, ltgray, ltgray); 159 StrokeLine(BPoint(frame.right-1, frame.top + 2), BPoint(frame.right - 1, frame.bottom)); 160 StrokeLine(BPoint(frame.right, frame.top + 1), BPoint(frame.right, frame.bottom)); 161 StrokeLine(BPoint(frame.left+1, frame.bottom - 1), BPoint(frame.right - 1, frame.bottom - 1)); 162 StrokeLine(BPoint(frame.left, frame.bottom), BPoint(frame.right, frame.bottom)); 166 StrokeLine(BPoint(frame.right-1, frame.top + 2), 167 BPoint(frame.right - 1, frame.bottom)); 168 StrokeLine(BPoint(frame.right, frame.top + 1), 169 BPoint(frame.right, frame.bottom)); 170 StrokeLine(BPoint(frame.left+1, frame.bottom - 1), 171 BPoint(frame.right - 1, frame.bottom - 1)); 172 StrokeLine(BPoint(frame.left, frame.bottom), 173 BPoint(frame.right, frame.bottom)); 163 174 164 175 Render(true); 165 176 } -
src/apps/pulse/PulseApp.cpp
19 19 #include <getopt.h> 20 20 21 21 #include <Alert.h> 22 #include <Catalog.h> 23 #include <Deskbar.h> 24 #include <Locale.h> 22 25 #include <Rect.h> 23 #include <Deskbar.h>24 26 25 27 #include <syscalls.h> 26 28 … … 28 30 #include "PulseWindow.h" 29 31 #include "DeskbarPulseView.h" 30 32 33 #undef B_TRANSLATE_CONTEXT 34 #define B_TRANSLATE_CONTEXT "PulseApp" 31 35 36 32 37 PulseApp::PulseApp(int argc, char **argv) 33 38 : BApplication(APP_SIGNATURE) 34 39 { … … 197 202 void 198 203 Usage() 199 204 { 200 printf( "Usage: Pulse [--mini] [-w width] [--width=width]\n"205 printf(B_TRANSLATE("Usage: Pulse [--mini] [-w width] [--width=width]\n" 201 206 "\t[--deskbar] [--normal] [--framecolor 0xrrggbb]\n" 202 "\t[--activecolor 0xrrggbb] [--idlecolor 0xrrggbb]\n") ;207 "\t[--activecolor 0xrrggbb] [--idlecolor 0xrrggbb]\n")); 203 208 exit(0); 204 209 } 205 210 … … 229 234 delete replicant; 230 235 delete deskbar; 231 236 if (err != B_OK) { 232 BAlert *alert = new BAlert(NULL, strerror(err), "OK");237 BAlert *alert = new BAlert(NULL, strerror(err), B_TRANSLATE("OK")); 233 238 alert->Go(NULL); 234 239 return false; 235 240 } … … 241 246 int 242 247 main(int argc, char **argv) 243 248 { 249 BCatalog fAppCatalog; 250 251 be_locale->GetAppCatalog(&fAppCatalog); 252 244 253 PulseApp *pulseapp = new PulseApp(argc, argv); 245 254 pulseapp->Run(); 246 255 delete pulseapp; -
src/apps/pulse/NormalPulseView.cpp
1 //***************************************************************************** ***********1 //***************************************************************************** 2 2 // 3 3 // File: NormalPulseView.cpp 4 4 // … … 6 6 // 7 7 // Copyright 1999, Be Incorporated 8 8 // 9 //***************************************************************************** ***********9 //***************************************************************************** 10 10 11 11 12 12 #include "NormalPulseView.h" 13 13 #include "Common.h" 14 14 #include "Pictures" 15 15 16 #include <Catalog.h> 16 17 #include <Bitmap.h> 17 18 #include <Dragger.h> 19 #include <Locale.h> 18 20 #include <Window.h> 19 21 20 22 #include <stdlib.h> … … 23 25 24 26 #include <cpu_type.h> 25 27 28 #undef B_TRANSLATE_CONTEXT 29 #define B_TRANSLATE_CONTEXT "NormalPulseView" 26 30 31 27 32 float 28 33 max_font_size(BFont font, const char* text, float maxSize, float maxWidth) 29 34 { … … 50 55 SetViewColor(color); 51 56 SetLowColor(color); 52 57 53 mode1->SetLabel( "Mini mode");58 mode1->SetLabel(B_TRANSLATE("Mini mode")); 54 59 mode1->SetMessage(new BMessage(PV_MINI_MODE)); 55 mode2->SetLabel( "Deskbar mode");60 mode2->SetLabel(B_TRANSLATE("Deskbar mode")); 56 61 mode2->SetMessage(new BMessage(PV_DESKBAR_MODE)); 57 62 58 63 DetermineVendorAndProcessor(); … … 69 74 BRect r(PROGRESS_MLEFT, PROGRESS_MTOP + ITEM_OFFSET * x, 70 75 PROGRESS_MLEFT + ProgressBar::PROGRESS_WIDTH, 71 76 PROGRESS_MTOP + ITEM_OFFSET * x + ProgressBar::PROGRESS_HEIGHT); 72 fProgressBars[x] = new ProgressBar(r, "CPU progress bar"); 77 char* str2 = (char *)B_TRANSLATE("CPU progress bar"); 78 fProgressBars[x] = new ProgressBar(r, str2); 73 79 AddChild(fProgressBars[x]); 74 80 75 81 r.Set(CPUBUTTON_MLEFT, CPUBUTTON_MTOP + ITEM_OFFSET * x, … … 77 83 CPUBUTTON_MTOP + ITEM_OFFSET * x + CPUBUTTON_HEIGHT + 7); 78 84 char temp[4]; 79 85 sprintf(temp, "%d", x + 1); 80 fCpuButtons[x] = new CPUButton(r, "Pulse", temp, NULL);86 fCpuButtons[x] = new CPUButton(r, B_TRANSLATE("Pulse"), temp, NULL); 81 87 AddChild(fCpuButtons[x]); 82 88 } 83 89