Author: wim Date: 2010-06-06 08:25:13 +0200 (Sun, 06 Jun 2010) New Revision: 37026 Changeset: http://dev.haiku-os.org/changeset/37026/haiku Ticket: http://dev.haiku-os.org/ticket/6110 Modified: haiku/trunk/src/apps/pulse/CPUButton.cpp haiku/trunk/src/apps/pulse/ConfigView.cpp haiku/trunk/src/apps/pulse/DeskbarPulseView.cpp haiku/trunk/src/apps/pulse/Jamfile haiku/trunk/src/apps/pulse/MiniPulseView.cpp haiku/trunk/src/apps/pulse/NormalPulseView.cpp haiku/trunk/src/apps/pulse/PrefsWindow.cpp haiku/trunk/src/apps/pulse/ProgressBar.cpp haiku/trunk/src/apps/pulse/PulseApp.cpp haiku/trunk/src/apps/pulse/PulseView.cpp haiku/trunk/src/apps/pulse/PulseWindow.cpp Log: Patch by Karvjorm to localize the Pulse demo application. This closes ticket #6110. Modified: haiku/trunk/src/apps/pulse/CPUButton.cpp =================================================================== --- haiku/trunk/src/apps/pulse/CPUButton.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/CPUButton.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -1,4 +1,4 @@ -//**************************************************************************************** +//***************************************************************************** // // File: CPUButton.cpp // @@ -6,16 +6,17 @@ // // Copyright 1999, Be Incorporated // -//**************************************************************************************** +//***************************************************************************** - #include "CPUButton.h" #include <stdlib.h> #include <string.h> #include <Alert.h> +#include <Catalog.h> #include <Dragger.h> +#include <Locale.h> #include <PopUpMenu.h> #include <ViewPrivate.h> @@ -26,7 +27,10 @@ #include "PulseView.h" #include "Common.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "CPUButton" + CPUButton::CPUButton(BRect rect, const char *name, const char *label, BMessage *message) : BControl(rect, name, label, message, B_FOLLOW_NONE, B_WILL_DRAW) { @@ -195,11 +199,11 @@ SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); } else if ((B_SECONDARY_MOUSE_BUTTON & mouseButtons) != 0 && fReplicantInDeskbar) { - BPopUpMenu *menu = new BPopUpMenu("Deskbar menu"); - menu->AddItem(new BMenuItem("About Pulse" B_UTF8_ELLIPSIS, + BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Deskbar menu")); + menu->AddItem(new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Remove replicant", + menu->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"), new BMessage(kDeleteReplicant))); menu->SetTargetForItems(this); @@ -237,7 +241,8 @@ if (!LastEnabledCPU(fCPU)) { _kern_set_cpu_enabled(fCPU, Value()); } else { - BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK"); + BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the " + "last active CPU."), B_TRANSLATE("OK")); alert->Go(NULL); SetValue(!Value()); } @@ -271,7 +276,9 @@ { switch (message->what) { case B_ABOUT_REQUESTED: { - BAlert *alert = new BAlert("Info", "Pulse\n\nBy David Ramsey and Arve Hjønnevåg\nRevised by Daniel Switkin", "OK"); + BAlert *alert = new BAlert(B_TRANSLATE("Info"), + B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n" + "Revised by Daniel Switkin"), B_TRANSLATE("OK")); // Use the asynchronous version so we don't block the window's thread alert->Go(NULL); break; @@ -313,7 +320,7 @@ fReplicantInDeskbar = false; if (fReplicant) { - if (strcmp(Window()->Title(), "Deskbar")) { + if (strcmp(Window()->Title(), B_TRANSLATE("Deskbar")) == 0) { // Make room for dragger ResizeBy(4, 4); Modified: haiku/trunk/src/apps/pulse/ConfigView.cpp =================================================================== --- haiku/trunk/src/apps/pulse/ConfigView.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/ConfigView.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -14,7 +14,9 @@ #include "PulseApp.h" #include "PrefsWindow.h" +#include <Catalog.h> #include <CheckBox.h> +#include <Locale.h> #include <RadioButton.h> #include <TextControl.h> @@ -23,7 +25,10 @@ #include <stdio.h> #include <string.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "ConfigView" + RTColorControl::RTColorControl(BPoint point, BMessage *message) : BColorControl(point, B_CELLS_32x8, 6, "ColorControl", message, false) { @@ -61,7 +66,7 @@ fActiveButton = fIdleButton = fFrameButton = NULL; fIconWidthControl = NULL; - SetLabel("Bar colors"); + SetLabel(B_TRANSLATE("Bar colors")); font_height fontHeight; be_bold_font->GetHeight(&fontHeight); @@ -78,8 +83,8 @@ if (mode == PRV_NORMAL_CHANGE_COLOR) { // normal mode - fFadeCheckBox = new BCheckBox(rect, "FadeColors", "Fade colors", - new BMessage(PRV_NORMAL_FADE_COLORS)); + fFadeCheckBox = new BCheckBox(rect, "FadeColors", + B_TRANSLATE("Fade colors"), new BMessage(PRV_NORMAL_FADE_COLORS)); fFadeCheckBox->ResizeToPreferred(); AddChild(fFadeCheckBox); @@ -88,42 +93,42 @@ } else if (mode == PRV_MINI_CHANGE_COLOR) { // mini mode - fActiveButton = new BRadioButton(rect, "ActiveColor", "Active color", - new BMessage(PRV_MINI_ACTIVE)); + fActiveButton = new BRadioButton(rect, "ActiveColor", + B_TRANSLATE("Active color"), new BMessage(PRV_MINI_ACTIVE)); fActiveButton->ResizeToPreferred(); fActiveButton->SetValue(B_CONTROL_ON); AddChild(fActiveButton); rect.left = fActiveButton->Frame().right + 5.0f; - fIdleButton = new BRadioButton(rect, "IdleColor", "Idle color", - new BMessage(PRV_MINI_IDLE)); + fIdleButton = new BRadioButton(rect, "IdleColor", + B_TRANSLATE("Idle color"), new BMessage(PRV_MINI_IDLE)); fIdleButton->ResizeToPreferred(); AddChild(fIdleButton); rect.left = fIdleButton->Frame().right + 5.0f; - fFrameButton = new BRadioButton(rect, "FrameColor", "Frame color", - new BMessage(PRV_MINI_FRAME)); + fFrameButton = new BRadioButton(rect, "FrameColor", + B_TRANSLATE("Frame color"), new BMessage(PRV_MINI_FRAME)); fFrameButton->ResizeToPreferred(); AddChild(fFrameButton); fColorControl->SetValue(fPrefs->mini_active_color); } else { // deskbar mode - fActiveButton = new BRadioButton(rect, "ActiveColor", "Active color", - new BMessage(PRV_DESKBAR_ACTIVE)); + fActiveButton = new BRadioButton(rect, "ActiveColor", + B_TRANSLATE("Active color"), new BMessage(PRV_DESKBAR_ACTIVE)); fActiveButton->ResizeToPreferred(); fActiveButton->SetValue(B_CONTROL_ON); AddChild(fActiveButton); rect.left = fActiveButton->Frame().right + 5.0f; - fIdleButton = new BRadioButton(rect, "IdleColor", "Idle color", - new BMessage(PRV_DESKBAR_IDLE)); + fIdleButton = new BRadioButton(rect, "IdleColor", + B_TRANSLATE("Idle color"), new BMessage(PRV_DESKBAR_IDLE)); fIdleButton->ResizeToPreferred(); AddChild(fIdleButton); rect.left = fIdleButton->Frame().right + 5.0f; - fFrameButton = new BRadioButton(rect, "FrameColor", "Frame color", - new BMessage(PRV_DESKBAR_FRAME)); + fFrameButton = new BRadioButton(rect, "FrameColor", + B_TRANSLATE("Frame color"), new BMessage(PRV_DESKBAR_FRAME)); fFrameButton->ResizeToPreferred(); AddChild(fFrameButton); @@ -132,7 +137,8 @@ char temp[10]; snprintf(temp, sizeof(temp), "%d", fPrefs->deskbar_icon_width); - fIconWidthControl = new BTextControl(rect, "Width", "Width of icon:", temp, + fIconWidthControl = new BTextControl(rect, "Width", + B_TRANSLATE("Width of icon:"), temp, new BMessage(PRV_DESKBAR_ICON_WIDTH)); AddChild(fIconWidthControl); fIconWidthControl->SetDivider(be_plain_font->StringWidth( Modified: haiku/trunk/src/apps/pulse/DeskbarPulseView.cpp =================================================================== --- haiku/trunk/src/apps/pulse/DeskbarPulseView.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/DeskbarPulseView.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -12,13 +12,19 @@ #include "Common.h" #include "Prefs.h" #include <app/Application.h> +#include <Catalog.h> #include <interface/Deskbar.h> #include <interface/Alert.h> +#include <Locale.h> #include <Roster.h> #include <stdlib.h> #include <string.h> #include <stdio.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "DeskbarPulseView" + + DeskbarPulseView::DeskbarPulseView(BRect rect) : MiniPulseView(rect, "DeskbarPulseView") { messagerunner = NULL; prefs = NULL; @@ -26,11 +32,11 @@ } DeskbarPulseView::DeskbarPulseView(BMessage *message) : MiniPulseView(message) { - mode1->SetLabel("Normal mode"); + mode1->SetLabel(B_TRANSLATE("Normal mode")); mode1->SetMessage(new BMessage(PV_NORMAL_MODE)); - mode2->SetLabel("Mini mode"); + mode2->SetLabel(B_TRANSLATE("Mini mode")); mode2->SetMessage(new BMessage(PV_MINI_MODE)); - quit = new BMenuItem("Quit", new BMessage(PV_QUIT), 0, 0); + quit = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(PV_QUIT), 0, 0); popupmenu->AddSeparatorItem(); popupmenu->AddItem(quit); @@ -118,8 +124,9 @@ prefswindow->Show(); break; case PV_ABOUT: { - BAlert *alert = new BAlert("Info", "Pulse\n\nBy David Ramsey and " - "Arve Hjønnevåg\nRevised by Daniel Switkin", "OK"); + BAlert *alert = new BAlert(B_TRANSLATE("Info"), + B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n" + "Revised by Daniel Switkin"), B_TRANSLATE("OK")); alert->Go(NULL); break; } @@ -169,8 +176,9 @@ status_t err = deskbar->RemoveItem("DeskbarPulseView"); if (err != B_OK) { char temp[255]; - sprintf(temp, "Remove(): %s", strerror(err)); - BAlert *alert = new BAlert("Info", temp, "OK"); + sprintf(temp, B_TRANSLATE("Remove(): %s"), strerror(err)); + BAlert *alert = new BAlert(B_TRANSLATE("Info"), temp, + B_TRANSLATE("OK")); alert->Go(NULL); } delete deskbar; Modified: haiku/trunk/src/apps/pulse/Jamfile =================================================================== --- haiku/trunk/src/apps/pulse/Jamfile 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/Jamfile 2010-06-06 06:25:13 UTC (rev 37026) @@ -23,6 +23,20 @@ PulseView.cpp PulseWindow.cpp - : be $(TARGET_LIBSUPC++) + : be locale $(TARGET_LIBSUPC++) : Pulse.rdef ; + +DoCatalogs Pulse : + x-vnd.Haiku-Pulse + : + PulseApp.cpp + PulseView.cpp + ConfigView.cpp + CPUButton.cpp + DeskbarPulseView.cpp + MiniPulseView.cpp + NormalPulseView.cpp + PrefsWindow.cpp + PulseWindow.cpp +; Modified: haiku/trunk/src/apps/pulse/MiniPulseView.cpp =================================================================== --- haiku/trunk/src/apps/pulse/MiniPulseView.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/MiniPulseView.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -1,4 +1,4 @@ -//**************************************************************************************** +//***************************************************************************** // // File: MiniPulseView.cpp // @@ -6,20 +6,26 @@ // // Copyright 1999, Be Incorporated // -//**************************************************************************************** +//***************************************************************************** #include "MiniPulseView.h" #include "Common.h" +#include <Catalog.h> +#include <Locale.h> #include <interface/Window.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "MiniPulseView" + + MiniPulseView::MiniPulseView(BRect rect, const char *name, Prefs *prefs) : PulseView(rect, name) { - mode1->SetLabel("Normal mode"); + mode1->SetLabel(B_TRANSLATE("Normal mode")); mode1->SetMessage(new BMessage(PV_NORMAL_MODE)); - mode2->SetLabel("Deskbar mode"); + mode2->SetLabel(B_TRANSLATE("Deskbar mode")); mode2->SetMessage(new BMessage(PV_DESKBAR_MODE)); - quit = new BMenuItem("Quit", new BMessage(PV_QUIT), 0, 0); + quit = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(PV_QUIT), 0, 0); popupmenu->AddSeparatorItem(); popupmenu->AddItem(quit); @@ -41,11 +47,17 @@ } // These two are only used by DeskbarPulseView, and so do nothing -MiniPulseView::MiniPulseView(BRect rect, const char *name) : PulseView(rect, name) { +MiniPulseView::MiniPulseView(BRect rect, const char *name) + : + PulseView(rect, name) +{ } -MiniPulseView::MiniPulseView(BMessage *message) : PulseView(message) { +MiniPulseView::MiniPulseView(BMessage *message) + : + PulseView(message) +{ } @@ -53,7 +65,8 @@ void MiniPulseView::Draw(BRect rect) { system_info sys_info; get_system_info(&sys_info); - if (sys_info.cpu_count > B_MAX_CPU_COUNT || sys_info.cpu_count <= 0) return; + if (sys_info.cpu_count > B_MAX_CPU_COUNT || sys_info.cpu_count <= 0) + return; BRect bounds(Bounds()); SetDrawingMode(B_OP_COPY); @@ -70,9 +83,12 @@ double rem = cpu_times[x] * (h + 1) - bar_height; rgb_color fraction_color; - fraction_color.red = (uint8)(idle_color.red + rem * (active_color.red - idle_color.red)); - fraction_color.green = (uint8)(idle_color.green + rem * (active_color.green - idle_color.green)); - fraction_color.blue = (uint8)(idle_color.blue + rem * (active_color.blue - idle_color.blue)); + fraction_color.red = (uint8)(idle_color.red + rem + * (active_color.red - idle_color.red)); + fraction_color.green = (uint8)(idle_color.green + rem + * (active_color.green - idle_color.green)); + fraction_color.blue = (uint8)(idle_color.blue + rem + * (active_color.blue - idle_color.blue)); fraction_color.alpha = 0xff; int idle_height = h - bar_height; Modified: haiku/trunk/src/apps/pulse/NormalPulseView.cpp =================================================================== --- haiku/trunk/src/apps/pulse/NormalPulseView.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/NormalPulseView.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -1,4 +1,4 @@ -//**************************************************************************************** +//***************************************************************************** // // File: NormalPulseView.cpp // @@ -6,15 +6,17 @@ // // Copyright 1999, Be Incorporated // -//**************************************************************************************** +//***************************************************************************** #include "NormalPulseView.h" #include "Common.h" #include "Pictures" +#include <Catalog.h> #include <Bitmap.h> #include <Dragger.h> +#include <Locale.h> #include <Window.h> #include <stdlib.h> @@ -23,7 +25,10 @@ #include <cpu_type.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "NormalPulseView" + float max_font_size(BFont font, const char* text, float maxSize, float maxWidth) { @@ -50,9 +55,9 @@ SetViewColor(color); SetLowColor(color); - mode1->SetLabel("Mini mode"); + mode1->SetLabel(B_TRANSLATE("Mini mode")); mode1->SetMessage(new BMessage(PV_MINI_MODE)); - mode2->SetLabel("Deskbar mode"); + mode2->SetLabel(B_TRANSLATE("Deskbar mode")); mode2->SetMessage(new BMessage(PV_DESKBAR_MODE)); DetermineVendorAndProcessor(); @@ -69,7 +74,8 @@ BRect r(PROGRESS_MLEFT, PROGRESS_MTOP + ITEM_OFFSET * x, PROGRESS_MLEFT + ProgressBar::PROGRESS_WIDTH, PROGRESS_MTOP + ITEM_OFFSET * x + ProgressBar::PROGRESS_HEIGHT); - fProgressBars[x] = new ProgressBar(r, "CPU progress bar"); + char* str2 = (char *)B_TRANSLATE("CPU progress bar"); + fProgressBars[x] = new ProgressBar(r, str2); AddChild(fProgressBars[x]); r.Set(CPUBUTTON_MLEFT, CPUBUTTON_MTOP + ITEM_OFFSET * x, @@ -77,7 +83,7 @@ CPUBUTTON_MTOP + ITEM_OFFSET * x + CPUBUTTON_HEIGHT + 7); char temp[4]; sprintf(temp, "%d", x + 1); - fCpuButtons[x] = new CPUButton(r, "Pulse", temp, NULL); + fCpuButtons[x] = new CPUButton(r, B_TRANSLATE("Pulse"), temp, NULL); AddChild(fCpuButtons[x]); } Modified: haiku/trunk/src/apps/pulse/PrefsWindow.cpp =================================================================== --- haiku/trunk/src/apps/pulse/PrefsWindow.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/PrefsWindow.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -14,15 +14,21 @@ #include "PulseApp.h" #include "ConfigView.h" +#include <Catalog.h> #include <Button.h> +#include <Locale.h> #include <TabView.h> #include <TextControl.h> #include <stdlib.h> #include <stdio.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PrefsWindow" -PrefsWindow::PrefsWindow(BRect frame, const char *name, BMessenger *messenger, Prefs *prefs) + +PrefsWindow::PrefsWindow(BRect frame, const char *name, + BMessenger *messenger, Prefs *prefs) : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS), fTarget(*messenger), @@ -43,16 +49,16 @@ BRect rect = fTabView->ContainerView()->Bounds(); rect.InsetBy(5, 5); - ConfigView *normalView = new ConfigView(rect, "Normal mode", + ConfigView *normalView = new ConfigView(rect, B_TRANSLATE("Normal mode"), PRV_NORMAL_CHANGE_COLOR, fTarget, prefs); fTabView->AddTab(normalView); - ConfigView *miniView = new ConfigView(rect, "Mini mode", PRV_MINI_CHANGE_COLOR, - fTarget, prefs); + ConfigView *miniView = new ConfigView(rect, B_TRANSLATE("Mini mode"), + PRV_MINI_CHANGE_COLOR, fTarget, prefs); fTabView->AddTab(miniView); - ConfigView *deskbarView = new ConfigView(rect, "Deskbar mode", PRV_DESKBAR_CHANGE_COLOR, - fTarget, prefs); + ConfigView *deskbarView = new ConfigView(rect, B_TRANSLATE("Deskbar mode"), + PRV_DESKBAR_CHANGE_COLOR, fTarget, prefs); fTabView->AddTab(deskbarView); float width, height; @@ -62,18 +68,20 @@ deskbarView->ResizeTo(width, height); fTabView->Select(0L); - fTabView->ResizeTo(deskbarView->Bounds().Width() + 16.0f, deskbarView->Bounds().Height() - + fTabView->ContainerView()->Frame().top + 16.0f); + fTabView->ResizeTo(deskbarView->Bounds().Width() + 16.0f, + deskbarView->Bounds().Height() + + fTabView->ContainerView()->Frame().top + 16.0f); - BButton *okButton = new BButton(rect, "ok", "OK", new BMessage(PRV_BOTTOM_OK), - B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); + BButton *okButton = new BButton(rect, "ok", B_TRANSLATE("OK"), + new BMessage(PRV_BOTTOM_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); okButton->ResizeToPreferred(); okButton->MoveTo(Bounds().Width() - 8.0f - okButton->Bounds().Width(), Bounds().Height() - 8.0f - okButton->Bounds().Height()); topView->AddChild(okButton); - BButton *defaultsButton = new BButton(okButton->Frame(), "defaults", "Defaults", - new BMessage(PRV_BOTTOM_DEFAULTS), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); + BButton *defaultsButton = new BButton(okButton->Frame(), "defaults", + B_TRANSLATE("Defaults"), new BMessage(PRV_BOTTOM_DEFAULTS), + B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); defaultsButton->ResizeToPreferred(); defaultsButton->MoveBy(-defaultsButton->Bounds().Width() - 10.0f, 0.0f); topView->AddChild(defaultsButton); @@ -102,7 +110,8 @@ Hide(); fTabView->Select(2); - ConfigView *deskbar = (ConfigView *)FindView("Deskbar mode"); + ConfigView *deskbar = (ConfigView *)FindView( + B_TRANSLATE("Deskbar mode")); deskbar->UpdateDeskbarIconWidth(); PostMessage(B_QUIT_REQUESTED); Modified: haiku/trunk/src/apps/pulse/ProgressBar.cpp =================================================================== --- haiku/trunk/src/apps/pulse/ProgressBar.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/ProgressBar.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -1,4 +1,4 @@ -//**************************************************************************************** +//***************************************************************************** // // File: ProgressBar.cpp // @@ -6,14 +6,15 @@ // // Copyright 1999, Be Incorporated // -//**************************************************************************************** +//***************************************************************************** #include "ProgressBar.h" #include "PulseApp.h" -ProgressBar::ProgressBar(BRect r, char *name) : BView(r, name, B_FOLLOW_NONE, B_WILL_DRAW) +ProgressBar::ProgressBar(BRect r, char *name) : BView(r, name, B_FOLLOW_NONE, + B_WILL_DRAW) { previous_value = current_value = 0; @@ -43,9 +44,12 @@ unsigned char blue_base = blue / 3; for (int x = 0; x < 20; x++) { - segments[x].color.red = (uint8)(red_base + ((red - red_base) * ((float)x / 19.0))); - segments[x].color.green = (uint8)(green_base + ((green - green_base) * ((float)x / 19.0))); - segments[x].color.blue = (uint8)(blue_base + ((blue - blue_base) * ((float)x / 19.0))); + segments[x].color.red = (uint8)(red_base + ((red - red_base) + * ((float)x / 19.0))); + segments[x].color.green = (uint8)(green_base + + ((green - green_base) * ((float)x / 19.0))); + segments[x].color.blue = (uint8)(blue_base + ((blue - blue_base) + * ((float)x / 19.0))); segments[x].color.alpha = 0xff; } } else { @@ -151,15 +155,22 @@ SetHighColor(dkgray, dkgray, dkgray); BRect frame = Bounds(); StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.right, frame.top)); - StrokeLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right, frame.top + 1)); - StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.left, frame.bottom)); - StrokeLine(BPoint(frame.left + 1, frame.top), BPoint(frame.left + 1, frame.bottom)); + StrokeLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right, + frame.top + 1)); + StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.left, + frame.bottom)); + StrokeLine(BPoint(frame.left + 1, frame.top), + BPoint(frame.left + 1, frame.bottom)); SetHighColor(ltgray, ltgray, ltgray); - StrokeLine(BPoint(frame.right-1, frame.top + 2), BPoint(frame.right - 1, frame.bottom)); - StrokeLine(BPoint(frame.right, frame.top + 1), BPoint(frame.right, frame.bottom)); - StrokeLine(BPoint(frame.left+1, frame.bottom - 1), BPoint(frame.right - 1, frame.bottom - 1)); - StrokeLine(BPoint(frame.left, frame.bottom), BPoint(frame.right, frame.bottom)); + StrokeLine(BPoint(frame.right-1, frame.top + 2), + BPoint(frame.right - 1, frame.bottom)); + StrokeLine(BPoint(frame.right, frame.top + 1), + BPoint(frame.right, frame.bottom)); + StrokeLine(BPoint(frame.left+1, frame.bottom - 1), + BPoint(frame.right - 1, frame.bottom - 1)); + StrokeLine(BPoint(frame.left, frame.bottom), + BPoint(frame.right, frame.bottom)); Render(true); } Modified: haiku/trunk/src/apps/pulse/PulseApp.cpp =================================================================== --- haiku/trunk/src/apps/pulse/PulseApp.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/PulseApp.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -19,8 +19,10 @@ #include <getopt.h> #include <Alert.h> +#include <Catalog.h> +#include <Deskbar.h> +#include <Locale.h> #include <Rect.h> -#include <Deskbar.h> #include <syscalls.h> @@ -28,7 +30,10 @@ #include "PulseWindow.h" #include "DeskbarPulseView.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PulseApp" + PulseApp::PulseApp(int argc, char **argv) : BApplication(APP_SIGNATURE) { @@ -197,9 +202,9 @@ void Usage() { - printf("Usage: Pulse [--mini] [-w width] [--width=width]\n" + printf(B_TRANSLATE("Usage: Pulse [--mini] [-w width] [--width=width]\n" "\t[--deskbar] [--normal] [--framecolor 0xrrggbb]\n" - "\t[--activecolor 0xrrggbb] [--idlecolor 0xrrggbb]\n"); + "\t[--activecolor 0xrrggbb] [--idlecolor 0xrrggbb]\n")); exit(0); } @@ -229,7 +234,7 @@ delete replicant; delete deskbar; if (err != B_OK) { - BAlert *alert = new BAlert(NULL, strerror(err), "OK"); + BAlert *alert = new BAlert(NULL, strerror(err), B_TRANSLATE("OK")); alert->Go(NULL); return false; } @@ -241,6 +246,10 @@ int main(int argc, char **argv) { + BCatalog fAppCatalog; + + be_locale->GetAppCatalog(&fAppCatalog); + PulseApp *pulseapp = new PulseApp(argc, argv); pulseapp->Run(); delete pulseapp; Modified: haiku/trunk/src/apps/pulse/PulseView.cpp =================================================================== --- haiku/trunk/src/apps/pulse/PulseView.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/PulseView.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -15,13 +15,18 @@ #include <string.h> #include <Alert.h> +#include <Catalog.h> +#include <Locale.h> #include <syscalls.h> #include "Common.h" #include "PulseApp.h" +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PulseView" + PulseView::PulseView(BRect rect, const char *name) : BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS) { @@ -50,8 +55,10 @@ popupmenu->SetFont(be_plain_font); mode1 = new BMenuItem("", NULL, 0, 0); mode2 = new BMenuItem("", NULL, 0, 0); - preferences = new BMenuItem("Settings" B_UTF8_ELLIPSIS, new BMessage(PV_PREFERENCES), 0, 0); - about = new BMenuItem("About Pulse" B_UTF8_ELLIPSIS, new BMessage(PV_ABOUT), 0, 0); + preferences = new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), + new BMessage(PV_PREFERENCES), 0, 0); + about = new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), + new BMessage(PV_ABOUT), 0, 0); popupmenu->AddItem(mode1); popupmenu->AddItem(mode2); @@ -121,7 +128,8 @@ if (!LastEnabledCPU(which)) { _kern_set_cpu_enabled(which, (int)!cpu_menu_items[which]->IsMarked()); } else { - BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK"); + BAlert *alert = new BAlert(NULL, B_TRANSLATE("You can't disable the " + "last active CPU."), B_TRANSLATE("OK")); alert->Go(NULL); } } Modified: haiku/trunk/src/apps/pulse/PulseWindow.cpp =================================================================== --- haiku/trunk/src/apps/pulse/PulseWindow.cpp 2010-06-05 22:20:34 UTC (rev 37025) +++ haiku/trunk/src/apps/pulse/PulseWindow.cpp 2010-06-06 06:25:13 UTC (rev 37026) @@ -1,4 +1,4 @@ -//**************************************************************************************** +//***************************************************************************** // // File: PulseWindow.cpp // @@ -6,7 +6,7 @@ // // Copyright 1999, Be Incorporated // -//**************************************************************************************** +//***************************************************************************** #include "PulseWindow.h" @@ -15,24 +15,32 @@ #include "DeskbarPulseView.h" #include <Alert.h> +#include <Catalog.h> #include <Deskbar.h> +#include <Locale.h> #include <Screen.h> #include <stdlib.h> #include <string.h> +#undef B_TRANSLATE_CONTEXT +#define B_TRANSLATE_CONTEXT "PulseWindow" + PulseWindow::PulseWindow(BRect rect) : BWindow(rect, "Pulse", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { SetPulseRate(200000); + SetTitle(B_TRANSLATE("Pulse")); + PulseApp *pulseapp = (PulseApp *)be_app; BRect bounds = Bounds(); fNormalPulseView = new NormalPulseView(bounds); AddChild(fNormalPulseView); - fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView", pulseapp->prefs); + fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView", + pulseapp->prefs); AddChild(fMiniPulseView); fMode = pulseapp->prefs->window_mode; @@ -89,12 +97,15 @@ // Otherwise launch a new preferences window PulseApp *pulseapp = (PulseApp *)be_app; fPrefsWindow = new PrefsWindow(pulseapp->prefs->prefs_window_rect, - "Pulse settings", new BMessenger(this), pulseapp->prefs); + B_TRANSLATE("Pulse settings"), new BMessenger(this), + pulseapp->prefs); fPrefsWindow->Show(); break; } case PV_ABOUT: { - BAlert *alert = new BAlert("Info", "Pulse\n\nBy David Ramsey and Arve Hjønnevåg\nRevised by Daniel Switkin", "OK"); + BAlert *alert = new BAlert(B_TRANSLATE("Info"), + B_TRANSLATE("Pulse\n\nBy David Ramsey and Arve Hjønnevåg\n" + "Revised by Daniel Switkin"), B_TRANSLATE("OK")); // Use the asynchronous version so we don't block the window's thread alert->Go(NULL); break;