Patch by Karvjorm : localize FontDemo (#7349).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42959 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
@@ -24,6 +25,8 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "ControlView"
|
||||||
|
|
||||||
ControlView::ControlView(BRect rect)
|
ControlView::ControlView(BRect rect)
|
||||||
: BView(rect, "ControlView", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE_JUMP),
|
: BView(rect, "ControlView", B_FOLLOW_ALL, B_WILL_DRAW | B_NAVIGABLE_JUMP),
|
||||||
@@ -66,7 +69,8 @@ ControlView::AttachedToWindow()
|
|||||||
float offsetX = 0;
|
float offsetX = 0;
|
||||||
float offsetY = 0;
|
float offsetY = 0;
|
||||||
|
|
||||||
fTextControl = new BTextControl(rect, "TextInput", "Text:", "Haiku, Inc.", NULL);
|
fTextControl = new BTextControl(rect, "TextInput", B_TRANSLATE("Text:"),
|
||||||
|
B_TRANSLATE("Haiku, Inc."), NULL);
|
||||||
fTextControl->SetDivider(29.0);
|
fTextControl->SetDivider(29.0);
|
||||||
fTextControl->SetModificationMessage(new BMessage(TEXT_CHANGED_MSG));
|
fTextControl->SetModificationMessage(new BMessage(TEXT_CHANGED_MSG));
|
||||||
AddChild(fTextControl);
|
AddChild(fTextControl);
|
||||||
@@ -75,7 +79,8 @@ ControlView::AttachedToWindow()
|
|||||||
_AddFontMenu(rect);
|
_AddFontMenu(rect);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, 29.0);
|
rect.OffsetBy(0.0, 29.0);
|
||||||
fFontsizeSlider = new BSlider(rect, "Fontsize", "Size: 50", NULL, 4, 360);
|
fFontsizeSlider = new BSlider(rect, "Fontsize", B_TRANSLATE("Size: 50"),
|
||||||
|
NULL, 4, 360);
|
||||||
fFontsizeSlider->SetModificationMessage(new BMessage(FONTSIZE_MSG));
|
fFontsizeSlider->SetModificationMessage(new BMessage(FONTSIZE_MSG));
|
||||||
fFontsizeSlider->SetValue(50);
|
fFontsizeSlider->SetValue(50);
|
||||||
AddChild(fFontsizeSlider);
|
AddChild(fFontsizeSlider);
|
||||||
@@ -85,31 +90,35 @@ ControlView::AttachedToWindow()
|
|||||||
offsetX += 1;
|
offsetX += 1;
|
||||||
|
|
||||||
rect.OffsetBy(0.0, offsetX);
|
rect.OffsetBy(0.0, offsetX);
|
||||||
fShearSlider = new BSlider(rect, "Shear", "Shear: 90", NULL, 45, 135);
|
fShearSlider = new BSlider(rect, "Shear", B_TRANSLATE("Shear: 90"), NULL,
|
||||||
|
45, 135);
|
||||||
fShearSlider->SetModificationMessage(new BMessage(FONTSHEAR_MSG));
|
fShearSlider->SetModificationMessage(new BMessage(FONTSHEAR_MSG));
|
||||||
fShearSlider->SetValue(90);
|
fShearSlider->SetValue(90);
|
||||||
AddChild(fShearSlider);
|
AddChild(fShearSlider);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, offsetX);
|
rect.OffsetBy(0.0, offsetX);
|
||||||
fRotationSlider = new BSlider(rect, "Rotation", "Rotation: 0", NULL, 0, 360);
|
fRotationSlider = new BSlider(rect, "Rotation", B_TRANSLATE("Rotation: 0"),
|
||||||
|
NULL, 0, 360);
|
||||||
fRotationSlider->SetModificationMessage( new BMessage(ROTATION_MSG));
|
fRotationSlider->SetModificationMessage( new BMessage(ROTATION_MSG));
|
||||||
fRotationSlider->SetValue(0);
|
fRotationSlider->SetValue(0);
|
||||||
AddChild(fRotationSlider);
|
AddChild(fRotationSlider);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, offsetX);
|
rect.OffsetBy(0.0, offsetX);
|
||||||
fSpacingSlider = new BSlider(rect, "Spacing", "Spacing: 0", NULL, -5, 50);
|
fSpacingSlider = new BSlider(rect, "Spacing", B_TRANSLATE("Spacing: 0"),
|
||||||
|
NULL, -5, 50);
|
||||||
fSpacingSlider->SetModificationMessage(new BMessage(SPACING_MSG));
|
fSpacingSlider->SetModificationMessage(new BMessage(SPACING_MSG));
|
||||||
fSpacingSlider->SetValue(0);
|
fSpacingSlider->SetValue(0);
|
||||||
AddChild(fSpacingSlider);
|
AddChild(fSpacingSlider);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, offsetX);
|
rect.OffsetBy(0.0, offsetX);
|
||||||
fOutlineSlider = new BSlider(rect, "Outline", "Outline:", NULL, 0, 20);
|
fOutlineSlider = new BSlider(rect, "Outline", B_TRANSLATE("Outline:"),
|
||||||
|
NULL, 0, 20);
|
||||||
fOutlineSlider->SetModificationMessage(new BMessage(OUTLINE_MSG));
|
fOutlineSlider->SetModificationMessage(new BMessage(OUTLINE_MSG));
|
||||||
AddChild(fOutlineSlider);
|
AddChild(fOutlineSlider);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, offsetX);
|
rect.OffsetBy(0.0, offsetX);
|
||||||
fAliasingCheckBox = new BCheckBox(rect, "Aliasing", "Antialiased text",
|
fAliasingCheckBox = new BCheckBox(rect, "Aliasing",
|
||||||
new BMessage(ALIASING_MSG));
|
B_TRANSLATE("Antialiased text"), new BMessage(ALIASING_MSG));
|
||||||
fAliasingCheckBox->SetValue(B_CONTROL_ON);
|
fAliasingCheckBox->SetValue(B_CONTROL_ON);
|
||||||
AddChild(fAliasingCheckBox);
|
AddChild(fAliasingCheckBox);
|
||||||
|
|
||||||
@@ -154,18 +163,20 @@ ControlView::AttachedToWindow()
|
|||||||
|
|
||||||
fDrawingModeMenu->SetLabelFromMarked(true);
|
fDrawingModeMenu->SetLabelFromMarked(true);
|
||||||
|
|
||||||
BMenuField *drawingModeMenuField = new BMenuField(rect, "FontMenuField", "Drawing mode:", fDrawingModeMenu, true);
|
BMenuField *drawingModeMenuField = new BMenuField(rect, "FontMenuField",
|
||||||
drawingModeMenuField->SetDivider(5+StringWidth("Drawing mode:"));
|
B_TRANSLATE("Drawing mode:"), fDrawingModeMenu, true);
|
||||||
|
drawingModeMenuField->SetDivider(5+StringWidth(
|
||||||
|
B_TRANSLATE("Drawing mode:")));
|
||||||
AddChild(drawingModeMenuField);
|
AddChild(drawingModeMenuField);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, 22);
|
rect.OffsetBy(0.0, 22);
|
||||||
fBoundingboxesCheckBox = new BCheckBox(rect, "BoundingBoxes", "Bounding boxes",
|
fBoundingboxesCheckBox = new BCheckBox(rect, "BoundingBoxes",
|
||||||
new BMessage(BOUNDING_BOX_MSG));
|
B_TRANSLATE("Bounding boxes"), new BMessage(BOUNDING_BOX_MSG));
|
||||||
AddChild(fBoundingboxesCheckBox);
|
AddChild(fBoundingboxesCheckBox);
|
||||||
|
|
||||||
rect.OffsetBy(0.0, 22.0);
|
rect.OffsetBy(0.0, 22.0);
|
||||||
fCyclingFontButton = new BButton(rect, "Cyclefonts", "Cycle fonts",
|
fCyclingFontButton = new BButton(rect, "Cyclefonts",
|
||||||
new BMessage(CYCLING_FONTS_MSG));
|
B_TRANSLATE("Cycle fonts"), new BMessage(CYCLING_FONTS_MSG));
|
||||||
AddChild(fCyclingFontButton);
|
AddChild(fCyclingFontButton);
|
||||||
|
|
||||||
fTextControl->SetTarget(this);
|
fTextControl->SetTarget(this);
|
||||||
@@ -222,7 +233,8 @@ ControlView::MessageReceived(BMessage* msg)
|
|||||||
case FONTSIZE_MSG:
|
case FONTSIZE_MSG:
|
||||||
{
|
{
|
||||||
char buff[256];
|
char buff[256];
|
||||||
sprintf(buff, "Size: %d", static_cast<int>(fFontsizeSlider->Value()));
|
sprintf(buff, B_TRANSLATE("Size: %d"),
|
||||||
|
static_cast<int>(fFontsizeSlider->Value()));
|
||||||
fFontsizeSlider->SetLabel(buff);
|
fFontsizeSlider->SetLabel(buff);
|
||||||
|
|
||||||
BMessage msg(FONTSIZE_MSG);
|
BMessage msg(FONTSIZE_MSG);
|
||||||
@@ -234,7 +246,8 @@ ControlView::MessageReceived(BMessage* msg)
|
|||||||
case FONTSHEAR_MSG:
|
case FONTSHEAR_MSG:
|
||||||
{
|
{
|
||||||
char buff[256];
|
char buff[256];
|
||||||
sprintf(buff, "Shear: %d", static_cast<int>(fShearSlider->Value()));
|
sprintf(buff, B_TRANSLATE("Shear: %d"),
|
||||||
|
static_cast<int>(fShearSlider->Value()));
|
||||||
fShearSlider->SetLabel(buff);
|
fShearSlider->SetLabel(buff);
|
||||||
|
|
||||||
BMessage msg(FONTSHEAR_MSG);
|
BMessage msg(FONTSHEAR_MSG);
|
||||||
@@ -246,7 +259,8 @@ ControlView::MessageReceived(BMessage* msg)
|
|||||||
case ROTATION_MSG:
|
case ROTATION_MSG:
|
||||||
{
|
{
|
||||||
char buff[256];
|
char buff[256];
|
||||||
sprintf(buff, "Rotation: %d", static_cast<int>(fRotationSlider->Value()));
|
sprintf(buff, B_TRANSLATE("Rotation: %d"),
|
||||||
|
static_cast<int>(fRotationSlider->Value()));
|
||||||
fRotationSlider->SetLabel(buff);
|
fRotationSlider->SetLabel(buff);
|
||||||
|
|
||||||
BMessage msg(ROTATION_MSG);
|
BMessage msg(ROTATION_MSG);
|
||||||
@@ -258,7 +272,8 @@ ControlView::MessageReceived(BMessage* msg)
|
|||||||
case SPACING_MSG:
|
case SPACING_MSG:
|
||||||
{
|
{
|
||||||
char buff[256];
|
char buff[256];
|
||||||
sprintf(buff, "Spacing: %d", (int)fSpacingSlider->Value());
|
sprintf(buff, B_TRANSLATE("Spacing: %d"),
|
||||||
|
(int)fSpacingSlider->Value());
|
||||||
fSpacingSlider->SetLabel(buff);
|
fSpacingSlider->SetLabel(buff);
|
||||||
|
|
||||||
BMessage msg(SPACING_MSG);
|
BMessage msg(SPACING_MSG);
|
||||||
@@ -296,7 +311,7 @@ ControlView::MessageReceived(BMessage* msg)
|
|||||||
int8 outlineVal = (int8)fOutlineSlider->Value();
|
int8 outlineVal = (int8)fOutlineSlider->Value();
|
||||||
|
|
||||||
char buff[256];
|
char buff[256];
|
||||||
sprintf(buff, "Outline: %d", outlineVal);
|
sprintf(buff, B_TRANSLATE("Outline: %d"), outlineVal);
|
||||||
fOutlineSlider->SetLabel(buff);
|
fOutlineSlider->SetLabel(buff);
|
||||||
|
|
||||||
fAliasingCheckBox->SetEnabled(outlineVal < 1);
|
fAliasingCheckBox->SetEnabled(outlineVal < 1);
|
||||||
@@ -310,7 +325,8 @@ ControlView::MessageReceived(BMessage* msg)
|
|||||||
|
|
||||||
case CYCLING_FONTS_MSG:
|
case CYCLING_FONTS_MSG:
|
||||||
{
|
{
|
||||||
fCyclingFontButton->SetLabel(fCycleFonts ? "Cycle fonts" : "Stop cycling");
|
fCyclingFontButton->SetLabel(fCycleFonts ? \
|
||||||
|
B_TRANSLATE("Cycle fonts") : B_TRANSLATE("Stop cycling"));
|
||||||
fCycleFonts = !fCycleFonts;
|
fCycleFonts = !fCycleFonts;
|
||||||
|
|
||||||
if (fCycleFonts) {
|
if (fCycleFonts) {
|
||||||
@@ -456,7 +472,8 @@ ControlView::_AddFontMenu(BRect rect)
|
|||||||
|
|
||||||
_UpdateFontmenus(true);
|
_UpdateFontmenus(true);
|
||||||
|
|
||||||
fFontMenuField = new BMenuField(rect, "FontMenuField", "Font:", fFontFamilyMenu, true);
|
fFontMenuField = new BMenuField(rect, "FontMenuField",
|
||||||
|
B_TRANSLATE("Font:"), fFontFamilyMenu, true);
|
||||||
fFontMenuField->SetDivider(30.0);
|
fFontMenuField->SetDivider(30.0);
|
||||||
AddChild(fFontMenuField);
|
AddChild(fFontMenuField);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,20 +11,25 @@
|
|||||||
#include "FontDemoView.h"
|
#include "FontDemoView.h"
|
||||||
#include "ControlView.h"
|
#include "ControlView.h"
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "FontDemo"
|
||||||
|
|
||||||
|
const BString APP_NAME = B_TRANSLATE_MARK("FontDemo");
|
||||||
|
|
||||||
FontDemo::FontDemo()
|
FontDemo::FontDemo()
|
||||||
: BApplication("application/x-vnd.Haiku-FontDemo")
|
: BApplication("application/x-vnd.Haiku-FontDemo")
|
||||||
{
|
{
|
||||||
// Create the demo window where we draw the string
|
// Create the demo window where we draw the string
|
||||||
BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300), "FontDemo",
|
BWindow* demoWindow = new BWindow(BRect(80, 30, 490, 300), APP_NAME,
|
||||||
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
|
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
|
||||||
|
|
||||||
FontDemoView* demoView = new FontDemoView(demoWindow->Bounds());
|
FontDemoView* demoView = new FontDemoView(demoWindow->Bounds());
|
||||||
demoWindow->AddChild(demoView);
|
demoWindow->AddChild(demoView);
|
||||||
|
|
||||||
BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402), "Controls",
|
BWindow* controlWindow = new BWindow(BRect(500, 30, 700, 402), B_TRANSLATE("Controls"),
|
||||||
B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL,
|
B_FLOATING_WINDOW_LOOK, B_FLOATING_APP_WINDOW_FEEL,
|
||||||
B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS);
|
B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Catalog.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
@@ -21,6 +22,8 @@
|
|||||||
|
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
|
|
||||||
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
#define B_TRANSLATE_CONTEXT "FontDemoView"
|
||||||
|
|
||||||
FontDemoView::FontDemoView(BRect rect)
|
FontDemoView::FontDemoView(BRect rect)
|
||||||
: BView(rect, "FontDemoView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS),
|
: BView(rect, "FontDemoView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS),
|
||||||
@@ -36,7 +39,8 @@ FontDemoView::FontDemoView(BRect rect)
|
|||||||
fShapes(NULL)
|
fShapes(NULL)
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
SetString("Haiku, Inc.");
|
BString setStr = B_TRANSLATE("Haiku, Inc.");
|
||||||
|
SetString(setStr);
|
||||||
SetFontSize(fFontSize);
|
SetFontSize(fFontSize);
|
||||||
SetAntialiasing(true);
|
SetAntialiasing(true);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,19 @@ Application FontDemo :
|
|||||||
ControlView.cpp
|
ControlView.cpp
|
||||||
FontDemo.cpp
|
FontDemo.cpp
|
||||||
FontDemoView.cpp
|
FontDemoView.cpp
|
||||||
: be $(TARGET_LIBSUPC++)
|
: be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSUPC++)
|
||||||
: FontDemo.rdef
|
: FontDemo.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs FontDemo :
|
||||||
|
x-vnd.Haiku-FontDemo
|
||||||
|
:
|
||||||
|
FontDemo.cpp
|
||||||
|
ControlView.cpp
|
||||||
|
FontDemoView.cpp
|
||||||
|
;
|
||||||
|
|
||||||
|
AddCatalogEntryAttribute FontDemo
|
||||||
|
:
|
||||||
|
x-vnd.Haiku-FontDemo:FontDemo:FontDemo
|
||||||
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user