From c31c1fef4f7a3f73435b734a7f42f41cd3f41911 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Thu, 6 May 2010 22:55:49 +0000 Subject: [PATCH] Updated to use B_TRANSLATE* macros. relates to #5408. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36680 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/appearance/APRView.cpp | 18 +++---- src/preferences/appearance/APRWindow.cpp | 13 ++--- .../appearance/AntialiasingSettingsView.cpp | 53 ++++++++++-------- src/preferences/appearance/ColorSet.cpp | 54 ++++++++++--------- 4 files changed, 75 insertions(+), 63 deletions(-) diff --git a/src/preferences/appearance/APRView.cpp b/src/preferences/appearance/APRView.cpp index 68deaace59..f01b3cbe51 100644 --- a/src/preferences/appearance/APRView.cpp +++ b/src/preferences/appearance/APRView.cpp @@ -63,7 +63,7 @@ APRView::APRView(const char *name, uint32 flags) fDecorMenu->AddItem(new BMenuItem(name.String(), new BMessage(DECORATOR_CHANGED))); } - + BMenuField *field = new BMenuField("Window Style", fDecorMenu); // TODO: use this menu field. } @@ -79,13 +79,13 @@ APRView::APRView(const char *name, uint32 flags) // Set up list of color attributes fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); - + fScrollView = new BScrollView("ScrollView", fAttrList, 0, false, true); fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - + for (int32 i = 0; i < color_description_count(); i++) { - const ColorDescription& description = *get_color_description(i); - const char* text = TR(description.text); + const ColorDescription& description = *get_color_description(i); + const char* text = B_TRANSLATE(description.text); color_which which = description.which; fAttrList->AddItem(new ColorWhichItem(text, which)); } @@ -164,8 +164,8 @@ APRView::MessageReceived(BMessage *msg) { // Received from the color fPicker when its color changes rgb_color color = fPicker->ValueAsColor(); - SetCurrentColor(color); - + SetCurrentColor(color); + Window()->PostMessage(kMsgUpdate); break; } @@ -225,7 +225,7 @@ void APRView::LoadSettings() { for (int32 i = 0; i < color_description_count(); i++) { - color_which which = get_color_description(i)->which; + color_which which = get_color_description(i)->which; fCurrentSet.SetColor(which, ui_color(which)); } @@ -244,7 +244,7 @@ void APRView::UpdateAllColors() { for (int32 i = 0; i < color_description_count(); i++) { - color_which which = get_color_description(i)->which; + color_which which = get_color_description(i)->which; rgb_color color = fCurrentSet.GetColor(which); set_ui_color(which, color); } diff --git a/src/preferences/appearance/APRWindow.cpp b/src/preferences/appearance/APRWindow.cpp index 1a20343589..227cab910c 100644 --- a/src/preferences/appearance/APRWindow.cpp +++ b/src/preferences/appearance/APRWindow.cpp @@ -25,27 +25,28 @@ static const uint32 kMsgSetDefaults = 'dflt'; static const uint32 kMsgRevert = 'rvrt'; APRWindow::APRWindow(BRect frame) - : BWindow(frame, TR("Appearance"), B_TITLED_WINDOW, + : BWindow(frame, B_TRANSLATE("Appearance"), B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES) { SetLayout(new BGroupLayout(B_HORIZONTAL)); - fDefaultsButton = new BButton("defaults", TR("Defaults"), + fDefaultsButton = new BButton("defaults", B_TRANSLATE("Defaults"), new BMessage(kMsgSetDefaults), B_WILL_DRAW); - fRevertButton = new BButton("revert", TR("Revert"), + fRevertButton = new BButton("revert", B_TRANSLATE("Revert"), new BMessage(kMsgRevert), B_WILL_DRAW); BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); - fAntialiasingSettings = new AntialiasingSettingsView(TR("Antialiasing")); - fColorsView = new APRView(TR("Colors"), B_WILL_DRAW); + fAntialiasingSettings = new AntialiasingSettingsView( + B_TRANSLATE("Antialiasing")); + fColorsView = new APRView(B_TRANSLATE("Colors"), B_WILL_DRAW); tabView->AddTab(fColorsView); tabView->AddTab(fAntialiasingSettings); - + fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() || fAntialiasingSettings->IsDefaultable()); fRevertButton->SetEnabled(false); diff --git a/src/preferences/appearance/AntialiasingSettingsView.cpp b/src/preferences/appearance/AntialiasingSettingsView.cpp index 83c9806517..de01ac2395 100644 --- a/src/preferences/appearance/AntialiasingSettingsView.cpp +++ b/src/preferences/appearance/AntialiasingSettingsView.cpp @@ -38,11 +38,12 @@ static const int32 kMsgSetAntialiasing = 'anti'; static const int32 kMsgSetHinting = 'hint'; static const int32 kMsgSetAverageWeight = 'avrg'; -static const char* kSubpixelLabel = TR_MARK("LCD subpixel"); -static const char* kGrayscaleLabel = TR_MARK("Grayscale"); -static const char* kNoHintingLabel = TR_MARK("Off"); -static const char* kMonospacedHintingLabel = TR_MARK("Monospaced fonts only"); -static const char* kFullHintingLabel = TR_MARK("On"); +static const char* kSubpixelLabel = B_TRANSLATE_MARK("LCD subpixel"); +static const char* kGrayscaleLabel = B_TRANSLATE_MARK("Grayscale"); +static const char* kNoHintingLabel = B_TRANSLATE_MARK("Off"); +static const char* kMonospacedHintingLabel = + B_TRANSLATE_MARK("Monospaced fonts only"); +static const char* kFullHintingLabel = B_TRANSLATE_MARK("On"); // #pragma mark - private libbe API @@ -86,20 +87,21 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name) // antialiasing menu _BuildAntialiasingMenu(); fAntialiasingMenuField = new BMenuField("antialiasing", - TR("Antialiasing type:"), fAntialiasingMenu, NULL); + B_TRANSLATE("Antialiasing type:"), fAntialiasingMenu, NULL); // "average weight" in subpixel filtering fAverageWeightControl = new BSlider("averageWeightControl", - TR("Reduce colored edges filter strength:"), + B_TRANSLATE("Reduce colored edges filter strength:"), new BMessage(kMsgSetAverageWeight), 0, 255, B_HORIZONTAL); - fAverageWeightControl->SetLimitLabels(TR("Off"), TR("Strong")); + fAverageWeightControl->SetLimitLabels(B_TRANSLATE("Off"), + B_TRANSLATE("Strong")); fAverageWeightControl->SetHashMarks(B_HASH_MARKS_BOTTOM); fAverageWeightControl->SetHashMarkCount(255 / 15); fAverageWeightControl->SetEnabled(false); // hinting menu _BuildHintingMenu(); - fHintingMenuField = new BMenuField("hinting", TR("Glyph hinting:"), + fHintingMenuField = new BMenuField("hinting", B_TRANSLATE("Glyph hinting:"), fHintingMenu, NULL); #ifdef DISABLE_HINTING_CONTROL @@ -117,11 +119,11 @@ AntialiasingSettingsView::AntialiasingSettingsView(const char* name) BTextView* subpixelAntialiasingDisabledLabel = new BTextView( textBounds, "unavailable label", textBounds, &infoFont, &infoColor, B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT); - subpixelAntialiasingDisabledLabel->SetText(TR("Subpixel based anti-aliasing " - "in combination with glyph hinting is not available in this build of " - "Haiku to avoid possible patent issues. To enable this feature, you " - "have to build Haiku yourself and enable certain options in the " - "libfreetype configuration header.")); + subpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE( + "Subpixel based anti-aliasing in combination with glyph hinting is not " + "available in this build of Haiku to avoid possible patent issues. To " + "enable this feature, you have to build Haiku yourself and enable " + "certain options in the libfreetype configuration header.")); subpixelAntialiasingDisabledLabel->SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR)); subpixelAntialiasingDisabledLabel->MakeEditable(false); @@ -228,19 +230,19 @@ AntialiasingSettingsView::MessageReceived(BMessage *msg) void AntialiasingSettingsView::_BuildAntialiasingMenu() { - fAntialiasingMenu = new BPopUpMenu(TR("Antialiasing menu")); + fAntialiasingMenu = new BPopUpMenu(B_TRANSLATE("Antialiasing menu")); BMessage* message = new BMessage(kMsgSetAntialiasing); message->AddBool("antialiasing", false); - BMenuItem* item = new BMenuItem(TR(kGrayscaleLabel), message); + BMenuItem* item = new BMenuItem(B_TRANSLATE(kGrayscaleLabel), message); fAntialiasingMenu->AddItem(item); message = new BMessage(kMsgSetAntialiasing); message->AddBool("antialiasing", true); - item = new BMenuItem(TR(kSubpixelLabel), message); + item = new BMenuItem(B_TRANSLATE(kSubpixelLabel), message); fAntialiasingMenu->AddItem(item); } @@ -249,19 +251,22 @@ AntialiasingSettingsView::_BuildAntialiasingMenu() void AntialiasingSettingsView::_BuildHintingMenu() { - fHintingMenu = new BPopUpMenu(TR("Hinting menu")); + fHintingMenu = new BPopUpMenu(B_TRANSLATE("Hinting menu")); BMessage* message = new BMessage(kMsgSetHinting); message->AddInt8("hinting", HINTING_MODE_OFF); - fHintingMenu->AddItem(new BMenuItem(TR(kNoHintingLabel), message)); + fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE(kNoHintingLabel), + message)); message = new BMessage(kMsgSetHinting); message->AddInt8("hinting", HINTING_MODE_ON); - fHintingMenu->AddItem(new BMenuItem(TR(kFullHintingLabel), message)); + fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE(kFullHintingLabel), + message)); message = new BMessage(kMsgSetHinting); message->AddInt8("hinting", HINTING_MODE_MONOSPACED_ONLY); - fHintingMenu->AddItem(new BMenuItem(TR(kMonospacedHintingLabel), message)); + fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE(kMonospacedHintingLabel), + message)); } @@ -269,7 +274,9 @@ void AntialiasingSettingsView::_SetCurrentAntialiasing() { BMenuItem *item = fAntialiasingMenu->FindItem( - fCurrentSubpixelAntialiasing ? TR(kSubpixelLabel) : TR(kGrayscaleLabel)); + fCurrentSubpixelAntialiasing + ? B_TRANSLATE(kSubpixelLabel) + : B_TRANSLATE(kGrayscaleLabel)); if (item != NULL) item->SetMarked(true); if (fCurrentSubpixelAntialiasing) @@ -293,7 +300,7 @@ AntialiasingSettingsView::_SetCurrentHinting() break; } - BMenuItem *item = fHintingMenu->FindItem(TR(label)); + BMenuItem *item = fHintingMenu->FindItem(B_TRANSLATE(label)); if (item != NULL) item->SetMarked(true); } diff --git a/src/preferences/appearance/ColorSet.cpp b/src/preferences/appearance/ColorSet.cpp index ba29a739be..8c2de1a624 100644 --- a/src/preferences/appearance/ColorSet.cpp +++ b/src/preferences/appearance/ColorSet.cpp @@ -24,31 +24,35 @@ static ColorDescription sColorDescriptionTable[] = { - { B_PANEL_BACKGROUND_COLOR, TR_MARK("Panel background") }, - { B_PANEL_TEXT_COLOR, TR_MARK("Panel text") }, - { B_DOCUMENT_BACKGROUND_COLOR, TR_MARK("Document background") }, - { B_DOCUMENT_TEXT_COLOR, TR_MARK("Document text") }, - { B_CONTROL_BACKGROUND_COLOR, TR_MARK("Control background") }, - { B_CONTROL_TEXT_COLOR, TR_MARK("Control text") }, - { B_CONTROL_BORDER_COLOR, TR_MARK("Control border") }, - { B_CONTROL_HIGHLIGHT_COLOR, TR_MARK("Control highlight") }, - { B_NAVIGATION_BASE_COLOR, TR_MARK("Navigation base") }, - { B_NAVIGATION_PULSE_COLOR, TR_MARK("Navigation pulse") }, - { B_SHINE_COLOR, TR_MARK("Shine") }, - { B_SHADOW_COLOR, TR_MARK("Shadow") }, - { B_MENU_BACKGROUND_COLOR, TR_MARK("Menu background") }, - { B_MENU_SELECTED_BACKGROUND_COLOR, TR_MARK("Selected menu item background") }, - { B_MENU_ITEM_TEXT_COLOR, TR_MARK("Menu item text") }, - { B_MENU_SELECTED_ITEM_TEXT_COLOR, TR_MARK("Selected menu item text") }, - { B_MENU_SELECTED_BORDER_COLOR, TR_MARK("Selected menu item border") }, - { B_TOOL_TIP_BACKGROUND_COLOR, TR_MARK("Tooltip background") }, - { B_TOOL_TIP_TEXT_COLOR, TR_MARK("Tooltip text") }, - { B_SUCCESS_COLOR, TR_MARK("Success") }, - { B_FAILURE_COLOR, TR_MARK("Failure") }, - { B_WINDOW_TAB_COLOR, TR_MARK("Window tab") }, - { B_WINDOW_TEXT_COLOR, TR_MARK("Window tab text") }, - { B_WINDOW_INACTIVE_TAB_COLOR, TR_MARK("Inactive window tab") }, - { B_WINDOW_INACTIVE_TEXT_COLOR, TR_MARK("Inactive window tab text") } + { B_PANEL_BACKGROUND_COLOR, B_TRANSLATE_MARK("Panel background") }, + { B_PANEL_TEXT_COLOR, B_TRANSLATE_MARK("Panel text") }, + { B_DOCUMENT_BACKGROUND_COLOR, B_TRANSLATE_MARK("Document background") }, + { B_DOCUMENT_TEXT_COLOR, B_TRANSLATE_MARK("Document text") }, + { B_CONTROL_BACKGROUND_COLOR, B_TRANSLATE_MARK("Control background") }, + { B_CONTROL_TEXT_COLOR, B_TRANSLATE_MARK("Control text") }, + { B_CONTROL_BORDER_COLOR, B_TRANSLATE_MARK("Control border") }, + { B_CONTROL_HIGHLIGHT_COLOR, B_TRANSLATE_MARK("Control highlight") }, + { B_NAVIGATION_BASE_COLOR, B_TRANSLATE_MARK("Navigation base") }, + { B_NAVIGATION_PULSE_COLOR, B_TRANSLATE_MARK("Navigation pulse") }, + { B_SHINE_COLOR, B_TRANSLATE_MARK("Shine") }, + { B_SHADOW_COLOR, B_TRANSLATE_MARK("Shadow") }, + { B_MENU_BACKGROUND_COLOR, B_TRANSLATE_MARK("Menu background") }, + { B_MENU_SELECTED_BACKGROUND_COLOR, + B_TRANSLATE_MARK("Selected menu item background") }, + { B_MENU_ITEM_TEXT_COLOR, B_TRANSLATE_MARK("Menu item text") }, + { B_MENU_SELECTED_ITEM_TEXT_COLOR, + B_TRANSLATE_MARK("Selected menu item text") }, + { B_MENU_SELECTED_BORDER_COLOR, + B_TRANSLATE_MARK("Selected menu item border") }, + { B_TOOL_TIP_BACKGROUND_COLOR, B_TRANSLATE_MARK("Tooltip background") }, + { B_TOOL_TIP_TEXT_COLOR, B_TRANSLATE_MARK("Tooltip text") }, + { B_SUCCESS_COLOR, B_TRANSLATE_MARK("Success") }, + { B_FAILURE_COLOR, B_TRANSLATE_MARK("Failure") }, + { B_WINDOW_TAB_COLOR, B_TRANSLATE_MARK("Window tab") }, + { B_WINDOW_TEXT_COLOR, B_TRANSLATE_MARK("Window tab text") }, + { B_WINDOW_INACTIVE_TAB_COLOR, B_TRANSLATE_MARK("Inactive window tab") }, + { B_WINDOW_INACTIVE_TEXT_COLOR, + B_TRANSLATE_MARK("Inactive window tab text") } }; const int32 sColorDescriptionCount = sizeof(sColorDescriptionTable)