Add Leaves screensaver localizzation.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40250 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2011-01-20 10:54:48 +00:00
parent d2772fb43e
commit a6b6cbbcdd
2 changed files with 34 additions and 17 deletions
+9 -2
View File
@@ -1,6 +1,13 @@
SubDir HAIKU_TOP src add-ons screen_savers leaves ; SubDir HAIKU_TOP src add-ons screen_savers leaves ;
ScreenSaver Leaves : ScreenSaver Leaves :
Leaves.cpp : Leaves.cpp :
be screensaver $(TARGET_LIBSUPC++) ; be screensaver $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
;
DoCatalogs Leaves :
x-vnd.Haiku-LeavesScreensaver
:
Leaves.cpp
;
+25 -15
View File
@@ -12,12 +12,17 @@
#include <time.h> #include <time.h>
#include <AffineTransform.h> #include <AffineTransform.h>
#include <Catalog.h>
#include <GradientLinear.h> #include <GradientLinear.h>
#include <Shape.h> #include <Shape.h>
#include <Slider.h> #include <Slider.h>
#include <TextView.h> #include <TextView.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Leaves"
// path data for the leaf shape // path data for the leaf shape
static const BPoint kLeafBegin(56.24793f, 15.46287f); static const BPoint kLeafBegin(56.24793f, 15.46287f);
static BPoint kLeafCurves[][3] = { static BPoint kLeafCurves[][3] = {
@@ -63,8 +68,8 @@ enum {
extern "C" BScreenSaver* extern "C" BScreenSaver*
instantiate_screen_saver(BMessage* msg, image_id image) instantiate_screen_saver(BMessage* msg, image_id image)
{ {
return new Leaves(msg, image); return new Leaves(msg, image);
} }
@@ -90,34 +95,37 @@ Leaves::Leaves(BMessage* archive, image_id id)
} }
void void
Leaves::StartConfig(BView* view) Leaves::StartConfig(BView* view)
{ {
BRect bounds = view->Bounds(); BRect bounds = view->Bounds();
bounds.InsetBy(10, 10); bounds.InsetBy(10, 10);
BRect frame(0, 0, bounds.Width(), 20); BRect frame(0, 0, bounds.Width(), 20);
fDropRateSlider = new BSlider(frame, "drop rate", "Drop rate:", fDropRateSlider = new BSlider(frame, "drop rate",
new BMessage(MSG_SET_DROP_RATE), kMinimumDropRate, kMaximumDropRate, B_TRANSLATE("Drop rate:"), new BMessage(MSG_SET_DROP_RATE),
B_BLOCK_THUMB, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); kMinimumDropRate, kMaximumDropRate, B_BLOCK_THUMB,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
fDropRateSlider->SetValue(fDropRate); fDropRateSlider->SetValue(fDropRate);
fDropRateSlider->ResizeToPreferred(); fDropRateSlider->ResizeToPreferred();
bounds.bottom -= fDropRateSlider->Bounds().Height() * 1.5; bounds.bottom -= fDropRateSlider->Bounds().Height() * 1.5;
fDropRateSlider->MoveTo(bounds.LeftBottom()); fDropRateSlider->MoveTo(bounds.LeftBottom());
view->AddChild(fDropRateSlider); view->AddChild(fDropRateSlider);
fLeafSizeSlider = new BSlider(frame, "leaf size", "Leaf size:", fLeafSizeSlider = new BSlider(frame, "leaf size",
new BMessage(MSG_SET_LEAF_SIZE), kMinimumLeafSize, kMaximumLeafSize, B_TRANSLATE("Leaf size:"), new BMessage(MSG_SET_LEAF_SIZE),
B_BLOCK_THUMB, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); kMinimumLeafSize, kMaximumLeafSize, B_BLOCK_THUMB,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
fLeafSizeSlider->SetValue(fLeafSize); fLeafSizeSlider->SetValue(fLeafSize);
fLeafSizeSlider->ResizeToPreferred(); fLeafSizeSlider->ResizeToPreferred();
bounds.bottom -= fLeafSizeSlider->Bounds().Height() * 1.5; bounds.bottom -= fLeafSizeSlider->Bounds().Height() * 1.5;
fLeafSizeSlider->MoveTo(bounds.LeftBottom()); fLeafSizeSlider->MoveTo(bounds.LeftBottom());
view->AddChild(fLeafSizeSlider); view->AddChild(fLeafSizeSlider);
fSizeVariationSlider = new BSlider(frame, "variation", "Size variation:", fSizeVariationSlider = new BSlider(frame, "variation",
new BMessage(MSG_SET_SIZE_VARIATION), 0, kMaximumSizeVariation, B_TRANSLATE("Size variation:"), new BMessage(MSG_SET_SIZE_VARIATION),
B_BLOCK_THUMB, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); 0, kMaximumSizeVariation, B_BLOCK_THUMB,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
fSizeVariationSlider->SetValue(fSizeVariation); fSizeVariationSlider->SetValue(fSizeVariation);
fSizeVariationSlider->ResizeToPreferred(); fSizeVariationSlider->ResizeToPreferred();
bounds.bottom -= fSizeVariationSlider->Bounds().Height() * 1.5; bounds.bottom -= fSizeVariationSlider->Bounds().Height() * 1.5;
@@ -127,8 +135,10 @@ Leaves::StartConfig(BView* view)
BTextView* textView = new BTextView(bounds, B_EMPTY_STRING, BTextView* textView = new BTextView(bounds, B_EMPTY_STRING,
bounds.OffsetToCopy(0., 0.), B_FOLLOW_ALL, B_WILL_DRAW); bounds.OffsetToCopy(0., 0.), B_FOLLOW_ALL, B_WILL_DRAW);
textView->SetViewColor(view->ViewColor()); textView->SetViewColor(view->ViewColor());
textView->Insert("Leaves\n\n" BString text = "Leaves\n\n";
"by Deyan Genovski, Geoffry Song\n\n"); text << B_TRANSLATE("by Deyan Genovski, Geoffry Song");
text << "\n\n";
textView->Insert(text.String());
textView->SetStylable(true); textView->SetStylable(true);
textView->SetFontAndColor(0, 6, be_bold_font); textView->SetFontAndColor(0, 6, be_bold_font);
textView->MakeEditable(false); textView->MakeEditable(false);
@@ -140,7 +150,7 @@ Leaves::StartConfig(BView* view)
fDropRateSlider->SetTarget(this); fDropRateSlider->SetTarget(this);
fLeafSizeSlider->SetTarget(this); fLeafSizeSlider->SetTarget(this);
fSizeVariationSlider->SetTarget(this); fSizeVariationSlider->SetTarget(this);
} }
status_t status_t