[haiku-commits] haiku: hrev45136 - src/tests/servers/app/playground

  • From: humdingerb@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 7 Jan 2013 14:07:56 +0100 (CET)

hrev45136 adds 3 changesets to branch 'master'
old head: 042344329e6368d53eaa40aed1cc22aac4ecf6b7
new head: 41b920bce29552d58897a11ede1893054552a26b
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=41b920b+%5E0423443

----------------------------------------------------------------------------

7c17855: Added localization support for Playground app.
  
  Signed-off-by: Humdinger <humdingerb@xxxxxxxxx>

                             [ Dancsó Róbert <dancso.robert@xxxxxxxxxxxxx> ]

f92bcd1: Sentence casing, improved alert text, buttons, ESC shortcut

                                        [ Humdinger <humdingerb@xxxxxxxxx> ]

41b920b: Reordered includes, removed unneeded comment

                                        [ Humdinger <humdingerb@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 55 insertions(+), 34 deletions(-)
src/tests/servers/app/playground/Jamfile         |  9 ++-
src/tests/servers/app/playground/ObjectView.cpp  | 10 +++-
.../servers/app/playground/ObjectWindow.cpp      | 63 +++++++++++---------
src/tests/servers/app/playground/main.cpp        |  7 ++-

############################################################################

Commit:      7c178559191a9154f2a95a12ae34ba13ccce95fa
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7c17855
Author:      Dancsó Róbert <dancso.robert@xxxxxxxxxxxxx>
Date:        Fri Jan  4 18:05:33 2013 UTC
Committer:   Humdinger <humdingerb@xxxxxxxxx>
Commit-Date: Mon Jan  7 10:05:23 2013 UTC

Added localization support for Playground app.

Signed-off-by: Humdinger <humdingerb@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/tests/servers/app/playground/Jamfile 
b/src/tests/servers/app/playground/Jamfile
index 343845d..327085d 100644
--- a/src/tests/servers/app/playground/Jamfile
+++ b/src/tests/servers/app/playground/Jamfile
@@ -11,7 +11,7 @@ Application Playground :
        ObjectView.cpp
        ObjectWindow.cpp
        States.cpp
-       : be $(TARGET_LIBSUPC++)
+       : be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
        : Playground.rdef
 ;
 
@@ -20,3 +20,10 @@ if ( $(TARGET_PLATFORM) = libbe_test ) {
                : tests!apps ;
 }
 
+DoCatalogs Playground :
+    application/x-vnd.Haiku-Playground
+    :
+    main.cpp
+    ObjectView.cpp
+    ObjectWindow.cpp
+;
diff --git a/src/tests/servers/app/playground/ObjectView.cpp 
b/src/tests/servers/app/playground/ObjectView.cpp
index 497304f..932cfc1 100644
--- a/src/tests/servers/app/playground/ObjectView.cpp
+++ b/src/tests/servers/app/playground/ObjectView.cpp
@@ -11,6 +11,11 @@
 #include <Shape.h>
 #include <String.h>
 #include <Window.h>
+// Locale Kit
+#include <Catalog.h>
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Playground"
 
 #include "States.h"
 
@@ -157,7 +162,7 @@ ObjectView::Draw(BRect updateRect)
        SetDrawingMode(B_OP_OVER);
        SetHighColor(255, 0, 0, 128);
 
-       const char* message = "Click and drag to draw an object";
+       const char* message = B_TRANSLATE("Click and drag to draw an object");
        float width = StringWidth(message);
 
        BPoint p((r.Width() - width) / 2.0, r.Height() / 2.0);
@@ -341,7 +346,7 @@ if (dragMessage) {
                                helper->FillRect(r);
 
                                helper->SetHighColor(0, 0, 0, 255);
-                               const char* text = "Test";
+                               const char* text = B_TRANSLATE("Test");
                                float pos = (r.Width() - 
helper->StringWidth(text)) / 2;
                                helper->DrawString(text, BPoint(pos, 25));
                                helper->Sync();
diff --git a/src/tests/servers/app/playground/ObjectWindow.cpp 
b/src/tests/servers/app/playground/ObjectWindow.cpp
index 3b9129b..ca9e90e 100644
--- a/src/tests/servers/app/playground/ObjectWindow.cpp
+++ b/src/tests/servers/app/playground/ObjectWindow.cpp
@@ -26,6 +26,11 @@
 #include <TabView.h>
 #include <TextControl.h>
 #include <TextView.h>
+// Locale Kit
+#include <Catalog.h>
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Playground"
 
 #include "ObjectView.h"
 #include "States.h"
@@ -126,12 +131,12 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        BMenuBar* menuBar = new BMenuBar(b, "menu bar");
        AddChild(menuBar);
 
-       BMenu* menu = new BMenu("File");
+       BMenu* menu = new BMenu(B_TRANSLATE("File"));
        menuBar->AddItem(menu);
 
-       menu->AddItem(new BMenu("Submenu"));
+       menu->AddItem(new BMenu(B_TRANSLATE("Submenu")));
 
-       BMenuItem* menuItem = new BMenuItem("Quit", new 
BMessage(B_QUIT_REQUESTED),
+       BMenuItem* menuItem = new BMenuItem(B_TRANSLATE("Quit"), new 
BMessage(B_QUIT_REQUESTED),
                                                                                
'Q');
        menu->AddItem(menuItem);
 
@@ -170,7 +175,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        BBox* controlGroup = new BBox(b, "controls box",
                B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, 
B_FANCY_BORDER);
 
-       controlGroup->SetLabel("Controls");
+       controlGroup->SetLabel(B_TRANSLATE("Controls"));
        bg->AddChild(controlGroup);
 
        b = controlGroup->Bounds();
@@ -180,14 +185,14 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        b.right = b.left + b.Width() / 2.0 - 5.0;
 
        // new button
-       fNewB = new BButton(b, "new button", "New Object",
+       fNewB = new BButton(b, "new button", B_TRANSLATE("New Object"),
                new BMessage(MSG_NEW_OBJECT));
        controlGroup->AddChild(fNewB);
        SetDefaultButton(fNewB);
 
        // clear button
        b.OffsetBy(0, fNewB->Bounds().Height() + 5.0);
-       fClearB = new BButton(b, "clear button", "Clear", new 
BMessage(MSG_CLEAR));
+       fClearB = new BButton(b, "clear button", B_TRANSLATE("Clear"), new 
BMessage(MSG_CLEAR));
        controlGroup->AddChild(fClearB);
 
        // object type radio buttons
@@ -197,7 +202,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        b.OffsetBy(0, fClearB->Bounds().Height() + 5.0);
        message = new BMessage(MSG_SET_OBJECT_TYPE);
        message->AddInt32("type", OBJECT_LINE);
-       radioButton = new BRadioButton(b, "radio 1", "Line", message);
+       radioButton = new BRadioButton(b, "radio 1", B_TRANSLATE("Line"), 
message);
        controlGroup->AddChild(radioButton);
 
        radioButton->SetValue(B_CONTROL_ON);
@@ -205,72 +210,72 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
        message = new BMessage(MSG_SET_OBJECT_TYPE);
        message->AddInt32("type", OBJECT_RECT);
-       radioButton = new BRadioButton(b, "radio 2", "Rect", message);
+       radioButton = new BRadioButton(b, "radio 2", B_TRANSLATE("Rect"), 
message);
        controlGroup->AddChild(radioButton);
 
        b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
        message = new BMessage(MSG_SET_OBJECT_TYPE);
        message->AddInt32("type", OBJECT_ROUND_RECT);
-       radioButton = new BRadioButton(b, "radio 3", "Round Rect", message);
+       radioButton = new BRadioButton(b, "radio 3", B_TRANSLATE("Round Rect"), 
message);
        controlGroup->AddChild(radioButton);
 
        b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
        message = new BMessage(MSG_SET_OBJECT_TYPE);
        message->AddInt32("type", OBJECT_ELLIPSE);
-       radioButton = new BRadioButton(b, "radio 4", "Ellipse", message);
+       radioButton = new BRadioButton(b, "radio 4", B_TRANSLATE("Ellipse"), 
message);
        controlGroup->AddChild(radioButton);
 
        // drawing mode
-       BPopUpMenu* popupMenu = new BPopUpMenu("<pick>");
+       BPopUpMenu* popupMenu = new BPopUpMenu(B_TRANSLATE("<pick>"));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_COPY);
-       popupMenu->AddItem(new BMenuItem("Copy", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Copy"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_OVER);
-       popupMenu->AddItem(new BMenuItem("Over", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Over"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_INVERT);
-       popupMenu->AddItem(new BMenuItem("Invert", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Invert"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_BLEND);
-       popupMenu->AddItem(new BMenuItem("Blend", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Blend"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_SELECT);
-       popupMenu->AddItem(new BMenuItem("Select", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Select"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_ERASE);
-       popupMenu->AddItem(new BMenuItem("Erase", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Erase"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_ADD);
-       popupMenu->AddItem(new BMenuItem("Add", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Add"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_SUBTRACT);
-       popupMenu->AddItem(new BMenuItem("Subtract", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Subtract"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_MIN);
-       popupMenu->AddItem(new BMenuItem("Min", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Min"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_MAX);
-       popupMenu->AddItem(new BMenuItem("Max", message));
+       popupMenu->AddItem(new BMenuItem(B_TRANSLATE("Max"), message));
 
        message = new BMessage(MSG_SET_DRAWING_MODE);
        message->AddInt32("mode", B_OP_ALPHA);
-       BMenuItem* item = new BMenuItem("Alpha", message);
+       BMenuItem* item = new BMenuItem(B_TRANSLATE("Alpha"), message);
        item->SetMarked(true);
        popupMenu->AddItem(item);
 
        b.OffsetBy(0, radioButton->Bounds().Height() + 10.0);
-       fDrawingModeMF = new BMenuField(b, "drawing mode field", "Mode:",
+       fDrawingModeMF = new BMenuField(b, "drawing mode field", 
B_TRANSLATE("Mode:"),
                popupMenu);
 
        controlGroup->AddChild(fDrawingModeMF);
@@ -286,7 +291,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        
        // alpha text control
        b.OffsetBy(0, fColorControl-> Bounds().Height() + 5.0);
-       fAlphaTC = new BTextControl(b, "alpha text control", "Alpha:", "",
+       fAlphaTC = new BTextControl(b, "alpha text control", 
B_TRANSLATE("Alpha:"), "",
                new BMessage(MSG_SET_COLOR));
        controlGroup->AddChild(fAlphaTC);
 
@@ -300,14 +305,14 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
 
        // fill check box
        b.OffsetBy(0, fAlphaTC->Bounds().Height() + 5.0);
-       fFillCB = new BCheckBox(b, "fill check box", "Fill",
+       fFillCB = new BCheckBox(b, "fill check box", B_TRANSLATE("Fill"),
                new BMessage(MSG_SET_FILL_OR_STROKE));
        controlGroup->AddChild(fFillCB);
 
        // pen size text control
        b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
        b.bottom = b.top + 10.0;//35;
-       fPenSizeS = new BSlider(b, "width slider", "Width:", NULL, 1, 100,
+       fPenSizeS = new BSlider(b, "width slider", B_TRANSLATE("Width:"), NULL, 
1, 100,
                B_TRIANGLE_THUMB);
        fPenSizeS->SetLimitLabels("1", "100");
        fPenSizeS->SetModificationMessage(new BMessage(MSG_SET_PEN_SIZE));
@@ -417,8 +422,8 @@ ObjectWindow::MessageReceived(BMessage* message)
                        break;
                case MSG_CLEAR: {
                        BAlert *alert = new BAlert("Playground",
-                                                                          "Do 
you really want to clear all drawing objects?",
-                                                                          
"No", "Yes");
+                                                                          
B_TRANSLATE("Do you really want to clear all drawing objects?"),
+                                                                          
B_TRANSLATE("No"), B_TRANSLATE("Yes"));
                        if (alert->Go() == 1) {
                                fObjectView->MakeEmpty();
                                fObjectLV->MakeEmpty();
diff --git a/src/tests/servers/app/playground/main.cpp 
b/src/tests/servers/app/playground/main.cpp
index 5612123..db3c202 100644
--- a/src/tests/servers/app/playground/main.cpp
+++ b/src/tests/servers/app/playground/main.cpp
@@ -3,6 +3,11 @@
 
 #include <Application.h>
 #include <Message.h>
+// Locale Kit
+#include <Catalog.h>
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Playground"
 
 #include "ObjectWindow.h"
 
@@ -13,7 +18,7 @@ main(int argc, char** argv)
        BApplication* app = new 
BApplication("application/x-vnd.Haiku-Playground");
 
        BRect frame(50.0, 50.0, 600.0, 400.0);
-       BWindow* window = new ObjectWindow(frame, "Playground");
+       BWindow* window = new ObjectWindow(frame, 
B_TRANSLATE_SYSTEM_NAME("Playground"));
 
        window->Show();
 

############################################################################

Commit:      f92bcd193826d2e26d437048464a1d47c5db6e97
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f92bcd1
Author:      Humdinger <humdingerb@xxxxxxxxx>
Date:        Mon Jan  7 10:21:37 2013 UTC

Sentence casing, improved alert text, buttons, ESC shortcut

----------------------------------------------------------------------------

diff --git a/src/tests/servers/app/playground/ObjectWindow.cpp 
b/src/tests/servers/app/playground/ObjectWindow.cpp
index ca9e90e..a5e9065 100644
--- a/src/tests/servers/app/playground/ObjectWindow.cpp
+++ b/src/tests/servers/app/playground/ObjectWindow.cpp
@@ -185,7 +185,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        b.right = b.left + b.Width() / 2.0 - 5.0;
 
        // new button
-       fNewB = new BButton(b, "new button", B_TRANSLATE("New Object"),
+       fNewB = new BButton(b, "new button", B_TRANSLATE("New object"),
                new BMessage(MSG_NEW_OBJECT));
        controlGroup->AddChild(fNewB);
        SetDefaultButton(fNewB);
@@ -216,7 +216,7 @@ ObjectWindow::ObjectWindow(BRect frame, const char* name)
        b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
        message = new BMessage(MSG_SET_OBJECT_TYPE);
        message->AddInt32("type", OBJECT_ROUND_RECT);
-       radioButton = new BRadioButton(b, "radio 3", B_TRANSLATE("Round Rect"), 
message);
+       radioButton = new BRadioButton(b, "radio 3", B_TRANSLATE("Round rect"), 
message);
        controlGroup->AddChild(radioButton);
 
        b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
@@ -422,8 +422,9 @@ ObjectWindow::MessageReceived(BMessage* message)
                        break;
                case MSG_CLEAR: {
                        BAlert *alert = new BAlert("Playground",
-                                                                          
B_TRANSLATE("Do you really want to clear all drawing objects?"),
-                                                                          
B_TRANSLATE("No"), B_TRANSLATE("Yes"));
+                               B_TRANSLATE("Clear all drawing objects?"),
+                               B_TRANSLATE("Cancel"), B_TRANSLATE("Clear"));
+                       alert->SetShortcut(0, B_ESCAPE);
                        if (alert->Go() == 1) {
                                fObjectView->MakeEmpty();
                                fObjectLV->MakeEmpty();

############################################################################

Revision:    hrev45136
Commit:      41b920bce29552d58897a11ede1893054552a26b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=41b920b
Author:      Humdinger <humdingerb@xxxxxxxxx>
Date:        Mon Jan  7 10:32:34 2013 UTC

Reordered includes, removed unneeded comment

----------------------------------------------------------------------------

diff --git a/src/tests/servers/app/playground/ObjectView.cpp 
b/src/tests/servers/app/playground/ObjectView.cpp
index 932cfc1..ffa736c 100644
--- a/src/tests/servers/app/playground/ObjectView.cpp
+++ b/src/tests/servers/app/playground/ObjectView.cpp
@@ -4,6 +4,7 @@
 
 #include <Application.h>
 #include <Bitmap.h>
+#include <Catalog.h>
 #include <Cursor.h>
 #include <Message.h>
 #include <MessageQueue.h>
@@ -11,15 +12,13 @@
 #include <Shape.h>
 #include <String.h>
 #include <Window.h>
-// Locale Kit
-#include <Catalog.h>
+
+#include "ObjectView.h"
+#include "States.h"
 
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "Playground"
 
-#include "States.h"
-
-#include "ObjectView.h"
 
 const unsigned char kMoveCursor[] = { 16, 1, 8, 8,
        0x01, 0x80, 0x02, 0x40, 0x04, 0x20, 0x08, 0x10,
diff --git a/src/tests/servers/app/playground/ObjectWindow.cpp 
b/src/tests/servers/app/playground/ObjectWindow.cpp
index a5e9065..0b6b9cc 100644
--- a/src/tests/servers/app/playground/ObjectWindow.cpp
+++ b/src/tests/servers/app/playground/ObjectWindow.cpp
@@ -8,6 +8,7 @@
 #include <Bitmap.h>
 #include <Box.h>
 #include <Button.h>
+#include <Catalog.h>
 #include <CheckBox.h>
 #include <ColorControl.h>
 #include <ListItem.h>
@@ -26,17 +27,15 @@
 #include <TabView.h>
 #include <TextControl.h>
 #include <TextView.h>
-// Locale Kit
-#include <Catalog.h>
-
-#undef B_TRANSLATION_CONTEXT
-#define B_TRANSLATION_CONTEXT "Playground"
 
 #include "ObjectView.h"
+#include "ObjectWindow.h"
 #include "States.h"
 //#include "StatusView.h"
 
-#include "ObjectWindow.h"
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Playground"
 
 enum {
        MSG_SET_OBJECT_TYPE             = 'stot',
diff --git a/src/tests/servers/app/playground/main.cpp 
b/src/tests/servers/app/playground/main.cpp
index db3c202..6d2d0a2 100644
--- a/src/tests/servers/app/playground/main.cpp
+++ b/src/tests/servers/app/playground/main.cpp
@@ -2,14 +2,14 @@
 #include <string.h>
 
 #include <Application.h>
-#include <Message.h>
-// Locale Kit
 #include <Catalog.h>
+#include <Message.h>
+
+#include "ObjectWindow.h"
 
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "Playground"
 
-#include "ObjectWindow.h"
 
 // main
 int


Other related posts:

  • » [haiku-commits] haiku: hrev45136 - src/tests/servers/app/playground - humdingerb