[haiku-commits] haiku: hrev49381 - src/add-ons/screen_savers/nebula

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 9 Jul 2015 00:41:29 +0200 (CEST)

hrev49381 adds 8 changesets to branch 'master'
old head: 2df2dca42235e77e881042ecfc9b7f06a6282af3
new head: 0f0de97fede6e93af99ac99c7e5bf7e6972e8a46
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=0f0de97fede6+%5E2df2dca42235

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

dd822ba860f9: Nebula: Style screen saver prefs

* Make the title the default font and bold like other screen savers
* Don't center the copyright text, left align
* Put spacing strut between title/copyright and the rest
* Put the pop-up menus in a grid, make them variable width
* Add some more glue so items grow apart more nicely

d1c13fd009b5: Nebula: Move prefs layout into constructor.

Only setting the targets is done in AttachedToWindow()
Some style fixes also applied

3ad91dc4f1c3: Nebula: Convert fixed length char array to BString

1a1667fc1d63: Nebula: Use B_PRId32 instead of %ld

ab2bb7fe6198: Nebula: Use size_t instead of int32 for iterator

5a17435fc386: Nebula: whitespace style fixes only, no functional changes

a11f9c281c30: Nebula: Internationalize strings

0f0de97fede6: Nebula: Convert fixed length char to BString

[ John Scipione <jscipione@xxxxxxxxx> ]

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

2 files changed, 317 insertions(+), 217 deletions(-)
src/add-ons/screen_savers/nebula/Jamfile | 8 +-
src/add-ons/screen_savers/nebula/Nebula.cpp | 526 ++++++++++++++----------

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

Commit: dd822ba860f959304953d0a6c319c2b29f85dd13
URL: http://cgit.haiku-os.org/haiku/commit/?id=dd822ba860f9
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 19:09:02 2015 UTC

Nebula: Style screen saver prefs

* Make the title the default font and bold like other screen savers
* Don't center the copyright text, left align
* Put spacing strut between title/copyright and the rest
* Put the pop-up menus in a grid, make them variable width
* Add some more glue so items grow apart more nicely

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index 086e526..b929ffd 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -7,6 +7,7 @@
*/

#include <AppKit.h>
+#include <ControlLook.h>
#include <InterfaceKit.h>
#include <LayoutBuilder.h>
#include <Window.h>
@@ -443,11 +444,10 @@ SettingsView::AttachedToWindow()
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

BStringView* titleString = new BStringView(B_EMPTY_STRING, "Nebula");
- titleString->SetFontSize(18.0);
+ titleString->SetFont(be_bold_font);

BStringView* copyrightString = new BStringView(B_EMPTY_STRING,
"© 2001-2004 Axel Dörfler.");
- copyrightString->SetAlignment(B_ALIGN_CENTER);

BPopUpMenu *popMenu = new BPopUpMenu("");
BMenuItem *item;
@@ -515,11 +515,32 @@ SettingsView::AttachedToWindow()
B_USE_BIG_INSETS, B_USE_HALF_ITEM_INSETS)
.Add(titleString)
.Add(copyrightString)
- .Add(fColorMenu)
- .Add(fWidthMenu)
- .Add(fBorderMenu)
- .Add(fMotionCheck)
+ .AddStrut(roundf(be_control_look->DefaultItemSpacing() / 2))
+ .AddGlue()
+ .AddGroup(B_HORIZONTAL, 0.0f)
+ .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
+ .Add(fColorMenu->CreateLabelLayoutItem(), 0, 0)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 0)
+
.Add(fColorMenu->CreateMenuBarLayoutItem(), 0.0f)
+ .AddGlue()
+ .End()
+ .Add(fWidthMenu->CreateLabelLayoutItem(), 0, 1)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 1)
+
.Add(fWidthMenu->CreateMenuBarLayoutItem(), 0.0f)
+ .AddGlue()
+ .End()
+ .Add(fBorderMenu->CreateLabelLayoutItem(), 0, 2)
+ .AddGroup(B_HORIZONTAL, 0.0f, 1, 2)
+
.Add(fBorderMenu->CreateMenuBarLayoutItem(), 0.0f)
+ .AddGlue()
+ .End()
+ .Add(fMotionCheck, 1, 3)
+ .End()
+ .AddGlue()
+ .End()
+ .AddGlue()
.Add(fSpeedSlider)
+ .AddGlue()
.Add(fFramesSlider)
.AddGlue()
.End();

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

Commit: d1c13fd009b5ec3391a64d90fba0ab7d36169590
URL: http://cgit.haiku-os.org/haiku/commit/?id=d1c13fd009b5
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 21:16:46 2015 UTC

Nebula: Move prefs layout into constructor.

Only setting the targets is done in AttachedToWindow()
Some style fixes also applied

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index b929ffd..4afbae5 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -392,8 +392,8 @@ setPalette()

class SimpleSlider : public BSlider {
public:
- SimpleSlider(const char *label, BMessage *msg)
- : BSlider(B_EMPTY_STRING, B_EMPTY_STRING, msg, 1, 100,
B_HORIZONTAL)
+ SimpleSlider(const char *label, BMessage *message)
+ : BSlider(B_EMPTY_STRING, B_EMPTY_STRING, message, 1,
100, B_HORIZONTAL)
{
SetLimitLabels("1", "100");
SetHashMarks(B_HASH_MARKS_BOTTOM);
@@ -418,97 +418,116 @@ class SimpleSlider : public BSlider {


class SettingsView : public BView {
- public:
- SettingsView(BRect frame);
+public:
+
SettingsView(BRect frame);

- virtual void AttachedToWindow();
- virtual void MessageReceived(BMessage *msg);
+ virtual void AttachedToWindow();
+ virtual void MessageReceived(BMessage*
message);

private:
- BMenuField *fWidthMenu,*fColorMenu,*fBorderMenu;
- BCheckBox *fMotionCheck;
- BSlider *fSpeedSlider,*fFramesSlider;
+ BMenuField* fWidthMenu;
+ BMenuField* fColorMenu;
+ BMenuField* fBorderMenu;
+ BCheckBox* fMotionCheck;
+ BSlider* fSpeedSlider;
+ BSlider* fFramesSlider;
};


SettingsView::SettingsView(BRect frame)
- : BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW)
-{
- MoveBy(0, -25); // The view is not where it should be.
-}
-
-
-void
-SettingsView::AttachedToWindow()
+ :
+ BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW)
{
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
-
BStringView* titleString = new BStringView(B_EMPTY_STRING, "Nebula");
titleString->SetFont(be_bold_font);

BStringView* copyrightString = new BStringView(B_EMPTY_STRING,
"© 2001-2004 Axel Dörfler.");

- BPopUpMenu *popMenu = new BPopUpMenu("");
- BMenuItem *item;
+ BPopUpMenu* popMenu;
+ BMenuItem* item;
+
+ int32 widths[] = {
+ 0,
+ 320,
+ 512,
+ 576,
+ 640,
+ 800,
+ 1024,
+ 1152,
+ 1280,
+ 1400,
+ 1600
+ };
+
+ size_t widthsLength = sizeof(widths) / sizeof(widths[0]);

- int32 widths[] = { 0, 320, 512, 576, 640, 800, 1024, 1152, 1280, 1400,
1600 };
- for (int32 i = 0; i < sizeof(widths) / sizeof(widths[0]); i++) {
- BMessage *msg = new BMessage(kMsgWidth);
+ popMenu = new BPopUpMenu("");
+ for (int32 i = 0; i < widthsLength; i++) {
+ BMessage* message = new BMessage(kMsgWidth);
char label[64];
if (widths[i] == 0)
sprintf(label, "screen resolution");
else
sprintf(label, "%ld pixels", widths[i]);
- msg->AddInt32("width", widths[i]);
- popMenu->AddItem(item = new BMenuItem(label, msg));
+
+ message->AddInt32("width", widths[i]);
+ popMenu->AddItem(item = new BMenuItem(label, message));

if (gSettingsWidth == widths[i])
item->SetMarked(true);
}

- popMenu->SetTargetForItems(this);
fWidthMenu = new BMenuField("res", "Internal width:", popMenu);

- popMenu = new BPopUpMenu("");
+ const char* colorSchemes[] = {
+ "yellow",
+ "cyan",
+ "red",
+ "green",
+ "grey",
+ "cold",
+ "orange (original)"
+ };

- const char *colorSchemes[] =
{"yellow","cyan","red","green","grey","cold","orange (original)"};
+ popMenu = new BPopUpMenu("");
for (int i = 0; i < 7; i++) {
- BMessage *msg = new BMessage(kMsgColorScheme);
- msg->AddInt8("scheme",(int8)i);
- popMenu->AddItem(item = new BMenuItem(colorSchemes[i],msg));
+ BMessage* message = new BMessage(kMsgColorScheme);
+ message->AddInt8("scheme",(int8)i);
+ popMenu->AddItem(item = new BMenuItem(colorSchemes[i],
message));
if (gPaletteScheme == i)
item->SetMarked(true);
}

- popMenu->SetTargetForItems(this);
fColorMenu = new BMenuField("col", "Color: ", popMenu);

- popMenu = new BPopUpMenu("");
+ const char* blankBorderFormats[] = {
+ "fullscreen, no borders",
+ "16:9, wide-screen",
+ "2:3.5, cinemascope",
+ "only a slit"
+ };

- const char *blankBorderFormats[] = {"fullscreen, no borders","16:9,
wide-screen","2:3.5, cinemascope","only a slit"};
+ popMenu = new BPopUpMenu("");
for (int8 i = 0;i < 4;i++) {
- BMessage *msg = new BMessage(kMsgBlankBorders);
- msg->AddInt8("border",i);
- popMenu->AddItem(item = new
BMenuItem(blankBorderFormats[i],msg));
+ BMessage* message = new BMessage(kMsgBlankBorders);
+ message->AddInt8("border", i);
+ popMenu->AddItem(item = new BMenuItem(blankBorderFormats[i],
message));
if (gBlankBorders == i)
item->SetMarked(true);
}

- popMenu->SetTargetForItems(this);
fBorderMenu = new BMenuField("cinema", "Format: ", popMenu);

fMotionCheck = new BCheckBox(B_EMPTY_STRING, "Enable motion blur", new
BMessage(kMsgMotionBlur));
- fMotionCheck->SetTarget(this);
fMotionCheck->SetValue((int)gMotionBlur);

fSpeedSlider = new SimpleSlider("Speed", new BMessage(kMsgSpeed));
- fSpeedSlider->SetValue((gSpeed - 0.002)/0.05);
- fSpeedSlider->SetTarget(this);
+ fSpeedSlider->SetValue((gSpeed - 0.002) / 0.05);

fFramesSlider = new SimpleSlider("Maximum Frames Per Second", new
BMessage(kMsgFrames));
fFramesSlider->SetValue(gMaxFramesPerSecond);
- fFramesSlider->SetTarget(this);

BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_HALF_ITEM_SPACING)
.SetInsets(B_USE_HALF_ITEM_INSETS, B_USE_HALF_ITEM_INSETS,
@@ -544,30 +563,51 @@ SettingsView::AttachedToWindow()
.Add(fFramesSlider)
.AddGlue()
.End();
+
+ MoveBy(0, -25); // The view is not where it should be.
+}
+
+
+void
+SettingsView::AttachedToWindow()
+{
+ SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+
+ fWidthMenu->Menu()->SetTargetForItems(this);
+ fColorMenu->Menu()->SetTargetForItems(this);
+ fBorderMenu->Menu()->SetTargetForItems(this);
+ fMotionCheck->SetTarget(this);
+ fSpeedSlider->SetTarget(this);
+ fFramesSlider->SetTarget(this);
}


void
-SettingsView::MessageReceived(BMessage *msg)
+SettingsView::MessageReceived(BMessage* message)
{
- switch(msg->what) {
+ switch(message->what) {
case kMsgWidth:
- msg->FindInt32("width",&gSettingsWidth);
+ message->FindInt32("width",&gSettingsWidth);
break;
+
case kMsgColorScheme:
- if (msg->FindInt8("scheme",&gPaletteScheme) == B_OK)
+ if (message->FindInt8("scheme",&gPaletteScheme) == B_OK)
setPalette();
break;
+
case kMsgBlankBorders:
- msg->FindInt8("border",&gBlankBorders);
+ message->FindInt8("border",&gBlankBorders);
break;
+
case kMsgMotionBlur:
gMotionBlur = fMotionCheck->Value() > 0;
break;
+
case kMsgSpeed:
gSpeed = 0.002 + 0.05 * fSpeedSlider->Value();
//printf("value = %d, gSpeed =
%f\n",fSpeedSlider->Value(),gSpeed);
break;
+
case kMsgFrames:
gMaxFramesPerSecond = fFramesSlider->Value();
gScreenSaver->SetTickSize((bigtime_t)(1000000LL /
gMaxFramesPerSecond));
@@ -582,23 +622,23 @@ SettingsView::MessageReceived(BMessage *msg)


class Nebula : public BScreenSaver {
- public:
- Nebula(BMessage *message, image_id id);
+public:
+
Nebula(BMessage* message, image_id id);

- virtual void StartConfig(BView *view);
- virtual status_t SaveState(BMessage *state) const;
+ virtual void StartConfig(BView* view);
+ virtual status_t SaveState(BMessage* state)
const;

- virtual status_t StartSaver(BView *view, bool preview);
- virtual void StopSaver();
- virtual void Draw(BView *view, int32 frame);
+ virtual status_t StartSaver(BView* view, bool
preview);
+ virtual void StopSaver();
+ virtual void Draw(BView* view, int32 frame);

- private:
- float fFactor;
- bool fStarted;
+private:
+ float fFactor;
+ bool fStarted;
};


-Nebula::Nebula(BMessage *message, image_id id)
+Nebula::Nebula(BMessage* message, image_id id)
:
BScreenSaver(message, id),
fStarted(false)
@@ -612,6 +652,7 @@ Nebula::Nebula(BMessage *message, image_id id)

if (gSpeed < 0.01f)
gSpeed = 0.4f;
+
if (gMaxFramesPerSecond < 1.f)
gMaxFramesPerSecond = 40.0f;

@@ -620,7 +661,7 @@ Nebula::Nebula(BMessage *message, image_id id)


void
-Nebula::StartConfig(BView *view)
+Nebula::StartConfig(BView* view)
{
view->AddChild(new SettingsView(view->Frame()));
}

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

Commit: 3ad91dc4f1c388c8b7d1a6418434ba8605936ab4
URL: http://cgit.haiku-os.org/haiku/commit/?id=3ad91dc4f1c3
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 21:23:52 2015 UTC

Nebula: Convert fixed length char array to BString

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index 4afbae5..27ba230 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -12,6 +12,7 @@
#include <LayoutBuilder.h>
#include <Window.h>
#include <ScreenSaver.h>
+#include <String.h>
#include <SupportDefs.h>

#include <math.h>
@@ -465,15 +466,16 @@ SettingsView::SettingsView(BRect frame)

popMenu = new BPopUpMenu("");
for (int32 i = 0; i < widthsLength; i++) {
- BMessage* message = new BMessage(kMsgWidth);
- char label[64];
+ BString label;
if (widths[i] == 0)
- sprintf(label, "screen resolution");
+ label.SetTo("screen resolution");
else
- sprintf(label, "%ld pixels", widths[i]);
+ label.SetToFormat("%ld pixels", widths[i]);

+ BMessage* message = new BMessage(kMsgWidth);
message->AddInt32("width", widths[i]);
- popMenu->AddItem(item = new BMenuItem(label, message));
+
+ popMenu->AddItem(item = new BMenuItem(label.String(), message));

if (gSettingsWidth == widths[i])
item->SetMarked(true);

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

Commit: 1a1667fc1d63f7bb6b23fc6149f026c461372c25
URL: http://cgit.haiku-os.org/haiku/commit/?id=1a1667fc1d63
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 21:27:09 2015 UTC

Nebula: Use B_PRId32 instead of %ld

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index 27ba230..7ae5354 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -470,7 +470,7 @@ SettingsView::SettingsView(BRect frame)
if (widths[i] == 0)
label.SetTo("screen resolution");
else
- label.SetToFormat("%ld pixels", widths[i]);
+ label.SetToFormat("%" B_PRId32 " pixels", widths[i]);

BMessage* message = new BMessage(kMsgWidth);
message->AddInt32("width", widths[i]);

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

Commit: ab2bb7fe6198bb7b01879fedc74f0cfed156d865
URL: http://cgit.haiku-os.org/haiku/commit/?id=ab2bb7fe6198
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 21:28:57 2015 UTC

Nebula: Use size_t instead of int32 for iterator

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index 7ae5354..fcf55fc 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -465,7 +465,7 @@ SettingsView::SettingsView(BRect frame)
size_t widthsLength = sizeof(widths) / sizeof(widths[0]);

popMenu = new BPopUpMenu("");
- for (int32 i = 0; i < widthsLength; i++) {
+ for (size_t i = 0; i < widthsLength; i++) {
BString label;
if (widths[i] == 0)
label.SetTo("screen resolution");

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

Commit: 5a17435fc3865a63232e9c3ace736e7771b6c7c2
URL: http://cgit.haiku-os.org/haiku/commit/?id=5a17435fc386
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 22:02:17 2015 UTC

Nebula: whitespace style fixes only, no functional changes

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index fcf55fc..4f431c0 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -22,7 +22,7 @@

typedef struct
{
- int x,y,z,r;
+ int x, y, z, r;
} p3;

typedef float matrix[3][3];
@@ -52,33 +52,34 @@ int32 gSettingsWidth;
int32 gWidth;
int32 gHeight;
float gMaxFramesPerSecond;
-BBitmap *gBitmap;
-BScreenSaver *gScreenSaver;
+BBitmap* gBitmap;
+BScreenSaver* gScreenSaver;
uint32 gPalette[256];
-int8 gPaletteScheme,gBlankBorders;
-char *gBuffer8; /* working 8bit buffer */
+int8 gPaletteScheme;
+int8 gBlankBorders;
+char* gBuffer8; /* working 8bit buffer */


inline float
ocos(float a)
{
- return (precos[(int)(a*256/M_PI) & 511]);
+ return (precos[(int)(a * 256 / M_PI) & 511]);
}

inline float
osin(float a)
{
- return (presin[(int)(a*256/M_PI) & 511]);
+ return (presin[(int)(a * 256 / M_PI) & 511]);
}


void
-mulmat(matrix *a, matrix *b, matrix *c)
+mulmat(matrix* a, matrix* b, matrix* c)
{
- int i,j;
+ int i, j;

- for (i = 0;i < 3;i++) {
- for (j = 0;j < 3;j++) {
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 3; j++) {
(*c)[i][j] = (*a)[i][0] * (*b)[0][j] +
(*a)[i][1] * (*b)[1][j] +
(*a)[i][2] * (*b)[2][j];
@@ -88,22 +89,22 @@ mulmat(matrix *a, matrix *b, matrix *c)


inline void
-mulvec(matrix *a, float *x, float *y, float *z)
+mulvec(matrix* a, float* x, float* y, float* z)
{
- float nx = *x,ny = *y,nz = *z;
+ float nx = *x, ny = *y, nz = *z;

- *x = nx*(*a)[0][0] + ny*(*a)[0][1] + nz*(*a)[0][2];
- *y = nx*(*a)[1][0] + ny*(*a)[1][1] + nz*(*a)[1][2];
- *z = nx*(*a)[2][0] + ny*(*a)[2][1] + nz*(*a)[2][2];
+ *x = nx * (*a)[0][0] + ny * (*a)[0][1] + nz * (*a)[0][2];
+ *y = nx * (*a)[1][0] + ny * (*a)[1][1] + nz * (*a)[1][2];
+ *z = nx * (*a)[2][0] + ny * (*a)[2][1] + nz * (*a)[2][2];
}


void
-setrmat(float a, float b, float c, matrix *m)
+setrmat(float a, float b, float c, matrix* m)
{
- int i,j;
- for (i = 0;i < 3;i++)
- for (j = 0;j < 3;j++)
+ int i, j;
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
(*m)[i][j] = (float)(i == j);

if (a != 0) {
@@ -122,23 +123,23 @@ setrmat(float a, float b, float c, matrix *m)


void
-rotate3d(float *xr, float *yr, float *zr, /* point to rotate */
+rotate3d(float* xr, float* yr, float* zr, /* point to rotate */
float ax, float ay, float az) /* the 3 angles (order ?..) */
{
float xr2, yr2, zr2;

- xr2 = (*xr*ocos(az) + *yr*osin(az));
- yr2 = (*xr*osin(az) - *yr*ocos(az));
+ xr2 = (*xr * ocos(az) + *yr * osin(az));
+ yr2 = (*xr * osin(az) - *yr * ocos(az));
*xr = xr2;
*yr = yr2;

- xr2 = (*xr*ocos(ay) + *zr*osin(ay));
- zr2 = (*xr*osin(ay) - *zr*ocos(ay));
+ xr2 = (*xr * ocos(ay) + *zr * osin(ay));
+ zr2 = (*xr * osin(ay) - *zr * ocos(ay));
*xr = xr2;
*zr = zr2;

- zr2 = (*zr*ocos(ax) + *yr*osin(ax));
- yr2 = (*zr*osin(ax) - *yr*ocos(ax));
+ zr2 = (*zr * ocos(ax) + *yr * osin(ax));
+ yr2 = (*zr * osin(ax) - *yr * ocos(ax));
*zr = zr2;
*yr = yr2;
}
@@ -159,24 +160,24 @@ drawshdisk(int x0, int y0, int r)

if (r <= SLIMIT) {
/* range checking is already (more or less) done... */
- draw_stars(gWidth, &gBuffer8[x0 + gWidth*y0], 10+r*5);
- //gBuffer8[x0+W*y0] = 10+r*5;
+ draw_stars(gWidth, &gBuffer8[x0 + gWidth * y0], 10 + r * 5);
+ //gBuffer8[x0 + W * y0] = 10 + r * 5;
return;
}

- if (r < SLIMIT+SRANGE)
- r = ((r-SLIMIT)*SLIMIT)/SRANGE+1;
+ if (r < SLIMIT + SRANGE)
+ r = ((r - SLIMIT) * SLIMIT) / SRANGE + 1;

y = ly = r; /* AAaargh */
- delta = 3-2*r;
+ delta = 3 - 2 * r;

do {
if (y != ly) {
/* dont overlap these lines */
- c = ((r-y+1)<<13)/r;
- d = -c/(x+1);
+ c = ((r - y + 1) << 13) / r;
+ d = -c / (x + 1);

- if (y == x+1) /* this would overlap with the
next x lines */
+ if (y == x + 1) /* this would overlap with the
next x lines */
goto TOTO; /* WHY NOT */

/* note : for "normal" numbers (not too big) :
@@ -187,25 +188,26 @@ drawshdisk(int x0, int y0, int r)
This is clearly a stupid, unmaintanable,
unreadable "optimization".
But i like it :)
*/
- if ((uint32)(y0-y-1) < gHeight-3)
- memshset(&gBuffer8[x0 + gWidth*(y0-y+1)] ,c,d,
x);
- if ((uint32)(y0+y-1) < gHeight-3)
- memshset(&gBuffer8[x0 + gWidth*(y0+y)] ,c,d, x);
+ if ((uint32)(y0 - y - 1) < gHeight - 3)
+ memshset(&gBuffer8[x0 + gWidth * (y0 - y + 1)],
c, d, x);
+
+ if ((uint32)(y0 + y - 1) < gHeight - 3)
+ memshset(&gBuffer8[x0 + gWidth*(y0 + y)], c, d,
x);
}
TOTO:
- c = ((r-x+1)<<13)/r;
- d = -c/(y);
+ c = ((r - x + 1) << 13) / r;
+ d = -c / (y);

- if ((uint32)(y0-x-1) < gHeight-3)
- memshset(&gBuffer8[x0 + gWidth*(y0-x)] ,c,d, y);
- if ((uint32)(y0+x-1) < gHeight-3)
- memshset(&gBuffer8[x0 + gWidth*(y0+x+1)] ,c,d, y);
+ if ((uint32)(y0 - x - 1) < gHeight - 3)
+ memshset(&gBuffer8[x0 + gWidth*(y0 - x)], c, d, y);
+ if ((uint32)(y0 + x - 1) < gHeight - 3)
+ memshset(&gBuffer8[x0 + gWidth * (y0 + x + 1)], c, d,
y);

ly = y;
if (delta < 0)
- delta += 4*x+6;
+ delta += 4 * x + 6;
else {
- delta += 4*(x-y)+10;
+ delta += 4 * (x - y) + 10;
y--;
}
x++;
@@ -217,30 +219,31 @@ void
drawGalaxy()
{
int r;
- int x,y;
- float rx,ry,rz;
+ int x, y;
+ float rx, ry, rz;
int i;
- float oa,ob,oc;
+ float oa, ob, oc;
float t;
float a, b, c;
- matrix ma,mb,mc,mr;
+ matrix ma, mb, mc, mr;

/* t is the parametric coordinate for the animation;
change the scale value to change the speed of anim
(independant of processor speed)
*/
static bigtime_t firstTime = system_time();
- t = ((double)gSpeed * system_time()-firstTime)/1000000.0;
//opti_scale_time(0.418, &demo_elapsed_time);
+ t = ((double)gSpeed * system_time() - firstTime) / 1000000.0;
+ //opti_scale_time(0.418, &demo_elapsed_time);

- a = 0.9*t;
+ a = 0.9 * t;
b = t;
- c = 1.1*t;
+ c = 1.1 * t;

- setrmat(a,0,0,&ma);
- setrmat(0,b,0,&mb);
- mulmat(&ma,&mb,&mc);
- setrmat(0,0,c,&ma);
- mulmat(&ma,&mc,&mr);
+ setrmat(a, 0, 0, &ma);
+ setrmat(0, b, 0, &mb);
+ mulmat(&ma, &mb, &mc);
+ setrmat(0, 0, c, &ma);
+ mulmat(&ma, &mc, &mr);

oa = 140 * osin(a);
ob = 140 * ocos(b);
@@ -250,12 +253,12 @@ drawGalaxy()
/* mblur does something like that:
* (or did, perhaps it's another version!..)

- for (i=0; i<W*H; i++)
- gBuffer8[i]= (gBuffer8[i]>>3) + (gBuffer8[i]>>1);
+ for (i = 0; i < W * H; i++)
+ gBuffer8[i]= (gBuffer8[i] >> 3) + (gBuffer8[i] >> 1);
*/
- mblur (gBuffer8, gWidth*gHeight);
+ mblur (gBuffer8, gWidth * gHeight);
} else
- memset(gBuffer8,0,gWidth*gHeight);
+ memset(gBuffer8, 0, gWidth * gHeight);

for (i = 0; i < GMAX; i++) {
rx = gal[i].x;
@@ -270,13 +273,15 @@ drawGalaxy()
rz += 300;

if (rz > 5) {
- x = (int)(15*rx/(rz/5+1)) + gWidth/2; /* tain
jcomprend plus rien */
- y = (int)(15*ry/(rz/5+1)) + gHeight/2; /* a ces
formules de daube !! */
- r = (int)(3*gal[i].r / (rz/4+3))+2;
-
- if (x > 5 && x < gWidth-6 && y > 5 && y < gHeight-6)
-// if ((uint32)x < gWidth-1 && (uint32)y < gHeight-1)
- drawshdisk(x,y,r);
+ x = (int)(15 * rx / (rz / 5 + 1)) + gWidth / 2;
+ /* tain jcomprend plus rien */
+ y = (int)(15 * ry/ (rz / 5 + 1)) + gHeight / 2;
+ /* a ces formules de daube !! */
+ r = (int)(3 * gal[i].r / (rz / 4 + 3)) + 2;
+
+ if (x > 5 && x < gWidth - 6 && y > 5 && y < gHeight - 6)
+// if ((uint32)x < gWidth - 1 && (uint32)y < gHeight - 1)
+ drawshdisk(x, y, r);
}
}
}
@@ -291,80 +296,94 @@ setPalette()
case 0: // yellow
default:
for (i = 0; i < 30; i++)
- gPalette[i] = (uint8)(i*8/10) << 16 |
(uint8)(i*6/10) << 8; // | (uint8)(i*3/10);
+ gPalette[i] = (uint8)(i * 8 / 10) << 16 |
(uint8)(i * 6 / 10) << 8;
+ // | (uint8)(i*3/10);

for (i = 30; i < 256; i++) {
uint8 r = (i);
- uint8 g = (i*i >> 8); //(i*8/10);
- uint8 b = i >= 240 ? (i-240) << 3 : 0;
//(i*2/10);
+ uint8 g = (i * i >> 8); //(i*8/10);
+ uint8 b = i >= 240 ? (i - 240) << 3 : 0; //(i *
2 / 10);

gPalette[i] = ((r << 16) | (g << 8) | (b));
}
break;
+
case 1: // blue
for (i = 0; i < 30; i++)
- gPalette[i] = (uint8)(i*8/10); // << 16 |
(uint8)(i*6/10) << 8; // | (uint8)(i*3/10);
+ gPalette[i] = (uint8)(i * 8 / 10);
+ // << 16 | (uint8)(i * 6 / 10) << 8;
+ // | (uint8)(i * 3 / 10);

for (i = 30; i < 256; i++) {
uint8 b = (i);
- uint8 g = (i*i >> 8); //(i*8/10);
- uint8 r = i >= 240 ? (i-240) << 3 : 0;
//(i*2/10);
+ uint8 g = (i * i >> 8); //(i * 8 / 10);
+ uint8 r = i >= 240 ? (i - 240) << 3 : 0; //(i *
2 / 10);

gPalette[i] = ((r << 16) | (g << 8) | (b));
}
break;
+
case 2: // red
- for (i = 0;i < 128;i++)
- gPalette[i] = (uint8)i << 16; // << 16 |
(uint8)(i*6/10) << 8; // | (uint8)(i*3/10);
+ for (i = 0; i < 128; i++)
+ gPalette[i] = (uint8)i << 16;
+ // << 16 | (uint8)(i * 6/10) << 8;
+ // | (uint8)(i * 3 / 10);

for (i = 128;i < 256;i++)
{
uint8 r = i;
- uint8 c = (uint8)((cos((i-256) / 42.0)*0.5 +
0.5)*225);
+ uint8 c = (uint8)((cos((i - 256) / 42.0) * 0.5
+ 0.5) * 225);

gPalette[i] = ((r << 16) | (c << 8) | c);
}
-/* for (i = 192;i < 224;i++)
+/* for (i = 192; i < 224; i++)
{
- uint8 c = (i-192);
+ uint8 c = (i - 192);
gPalette[i] = gPalette[i] & 0xff0000 | c << 8 |
c;
}
- for (i = 224;i < 256;i++)
+ for (i = 224; i < 256; i++)
{
- uint8 c = (i-224)/2;
- c = 32 + c*c*6/10;
+ uint8 c = (i-224) / 2;
+ c = 32 + c * c * 6 / 10;
gPalette[i] = gPalette[i] & 0xff0000 | c << 8 |
c;
}
*/ break;
+
case 3: // green
for (i = 0; i < 30; i++)
- gPalette[i] = (uint8)(i*8/10) << 8; // << 16 |
(uint8)(i*6/10) << 8; // | (uint8)(i*3/10);
+ gPalette[i] = (uint8)(i * 8 / 10) << 8;
+ // << 16 | (uint8)(i * 6 / 10) << 8;
+ // | (uint8)(i * 3 / 10);

for (i = 30; i < 256; i++) {
uint8 g = (i);
- uint8 r = (i*i >> 8); //(i*8/10);
- uint8 b = i >= 240 ? (i-240) << 3 : 0;
//(i*2/10);
+ uint8 r = (i * i >> 8); //(i * 8 / 10);
+ uint8 b = i >= 240 ? (i-240) << 3 : 0; //(i * 2
/ 10);

gPalette[i] = ((r << 16) | (g << 8) | (b));
}
break;
+
case 4: // grey
for (i = 0; i < 256; i++) {
- uint8 c = i*15/16 + 10;
+ uint8 c = i * 15 / 16 + 10;
gPalette[i] = c << 16 | c << 8 | c;
}
break;
case 5: // cold
for (i = 0; i < 30; i++)
- gPalette[i] = (uint8)(i*8/10) << 16; // << 16 |
(uint8)(i*6/10) << 8; // | (uint8)(i*3/10);
+ gPalette[i] = (uint8)(i * 8 / 10) << 16;
+ // << 16 | (uint8)(i * 6 / 10) << 8;
+ // | (uint8)(i * 3 / 10);

for (i = 30; i < 256; i++) {
uint8 r = i;
- uint8 c = (uint8)((cos((i-255) / 82.0)*0.5 +
0.5)*255);
+ uint8 c = (uint8)((cos((i - 255) / 82.0) * 0.5
+ 0.5) * 255);

gPalette[i] = ((r << 16) | (c << 8) | c);
}
break;
+
case 6: // original
for (i = 0; i < 256; i++) {
uint32 c = *(char *)&i;
@@ -375,14 +394,14 @@ setPalette()
/* for (i = 0;i < 256;i++)
{
uint8 r = (i);
- uint8 g = (i*i >> 8); //(i*8/10);
- uint8 b = 0; //(i*2/10);
+ uint8 g = (i * i >> 8); //(i * 8 / 10);
+ uint8 b = 0; //(i * 2 / 10);

gPalette[i] = ((r << 16) | (g << 8) | (b));
}
*/
-/* for (i = 240;i < 256;i++)
- gPalette[i] = (uint8)i << 16 | (uint8)i << 8 | (uint8)(i*6/10);
+/* for (i = 240; i < 256; i++)
+ gPalette[i] = (uint8)i << 16 | (uint8)i << 8 | (uint8)(i * 6 /
10);
*/
}

@@ -392,25 +411,26 @@ setPalette()
// #pragma mark SimpleSlider

class SimpleSlider : public BSlider {
- public:
- SimpleSlider(const char *label, BMessage *message)
- : BSlider(B_EMPTY_STRING, B_EMPTY_STRING, message, 1,
100, B_HORIZONTAL)
- {
- SetLimitLabels("1", "100");
- SetHashMarks(B_HASH_MARKS_BOTTOM);
- SetHashMarkCount(11);
- fLabel = label;
- };
-
- const char* UpdateText() const
- {
- sprintf(fText, "%s: %d", fLabel, Value());
- return fText;
- };
+public:
+ SimpleSlider(const char* label, BMessage* message)
+ :
+ BSlider(B_EMPTY_STRING, B_EMPTY_STRING, message, 1, 100,
B_HORIZONTAL)
+ {
+ SetLimitLabels("1", "100");
+ SetHashMarks(B_HASH_MARKS_BOTTOM);
+ SetHashMarkCount(11);
+ fLabel = label;
+ };

- private:
- mutable char fText[32];
- const char *fLabel;
+ const char* UpdateText() const
+ {
+ sprintf(fText, "%s: %d", fLabel, Value());
+ return fText;
+ };
+
+private:
+ mutable char fText[32];
+ const char* fLabel;
};


@@ -496,7 +516,7 @@ SettingsView::SettingsView(BRect frame)
popMenu = new BPopUpMenu("");
for (int i = 0; i < 7; i++) {
BMessage* message = new BMessage(kMsgColorScheme);
- message->AddInt8("scheme",(int8)i);
+ message->AddInt8("scheme", (int8)i);
popMenu->AddItem(item = new BMenuItem(colorSchemes[i],
message));
if (gPaletteScheme == i)
item->SetMarked(true);
@@ -512,7 +532,7 @@ SettingsView::SettingsView(BRect frame)
};

popMenu = new BPopUpMenu("");
- for (int8 i = 0;i < 4;i++) {
+ for (int8 i = 0; i < 4; i++) {
BMessage* message = new BMessage(kMsgBlankBorders);
message->AddInt8("border", i);
popMenu->AddItem(item = new BMenuItem(blankBorderFormats[i],
message));
@@ -589,16 +609,16 @@ SettingsView::MessageReceived(BMessage* message)
{
switch(message->what) {
case kMsgWidth:
- message->FindInt32("width",&gSettingsWidth);
+ message->FindInt32("width", &gSettingsWidth);
break;

case kMsgColorScheme:
- if (message->FindInt8("scheme",&gPaletteScheme) == B_OK)
+ if (message->FindInt8("scheme", &gPaletteScheme) ==
B_OK)
setPalette();
break;

case kMsgBlankBorders:
- message->FindInt8("border",&gBlankBorders);
+ message->FindInt8("border", &gBlankBorders);
break;

case kMsgMotionBlur:
@@ -607,7 +627,6 @@ SettingsView::MessageReceived(BMessage* message)

case kMsgSpeed:
gSpeed = 0.002 + 0.05 * fSpeedSlider->Value();
- //printf("value = %d, gSpeed =
%f\n",fSpeedSlider->Value(),gSpeed);
break;

case kMsgFrames:
@@ -670,7 +689,7 @@ Nebula::StartConfig(BView* view)


status_t
-Nebula::SaveState(BMessage *state) const
+Nebula::SaveState(BMessage* state) const
{
state->AddFloat("speed", gSpeed);
state->AddInt32("width", gSettingsWidth);
@@ -684,47 +703,47 @@ Nebula::SaveState(BMessage *state) const


status_t
-Nebula::StartSaver(BView *view, bool preview)
+Nebula::StartSaver(BView* view, bool preview)
{
// initialize palette
setPalette();

int i;
for (i = 0; i < 512; i++) {
- precos[i]=cos(i*M_PI/256);
- presin[i]=sin(i*M_PI/256);
+ precos[i]=cos(i * M_PI / 256);
+ presin[i]=sin(i * M_PI / 256);
}

// uniforme cubique
/* for (i = 0;i < GMAX;i++)
{
- gal[i].x = 1*((rand()&1023) - 512);
- gal[i].y = 1*((rand()&1023) - 512);
- gal[i].z = 1*((rand()&1023) - 512);
- gal[i].r = rand()&63;
+ gal[i].x = 1 * ((rand()&1023) - 512);
+ gal[i].y = 1 * ((rand()&1023) - 512);
+ gal[i].z = 1 * ((rand()&1023) - 512);
+ gal[i].r = rand() & 63;
}
*/

for (i = 0; i < GMAX; i++) {
float r, th, h, dth;

- r = rand()*1.0 / RAND_MAX;
- r = (1-r)*(1-r)+0.05;
+ r = rand() * 1.0 / RAND_MAX;
+ r = (1 - r) * (1 - r) + 0.05;

if (r < 0.12)
- th = rand()*M_PI*2/RAND_MAX;
+ th = rand() * M_PI * 2 / RAND_MAX;
else {
- th = (rand()&3)*M_PI_2 + r*r*2;
- dth = rand()*1.0/RAND_MAX;
- dth = dth*dth*2;
- th+=dth;
+ th = (rand() & 3) * M_PI_2 + r * r * 2;
+ dth = rand() * 1.0 / RAND_MAX;
+ dth = dth * dth * 2;
+ th += dth;
}
- gal[i].x = (int)(512*r*cos(th));
- gal[i].z = (int)(512*r*sin(th));
- h = (1+cos(r*M_PI))*150;
- dth = rand()*1.0/RAND_MAX;
- gal[i].y = (int)(h*(dth-0.5));
- gal[i].r = (int)((2-r)*60 + 31);
+ gal[i].x = (int)(512 * r * cos(th));
+ gal[i].z = (int)(512 * r * sin(th));
+ h = (1 + cos(r * M_PI)) * 150;
+ dth = rand() * 1.0 / RAND_MAX;
+ gal[i].y = (int)(h * (dth - 0.5));
+ gal[i].r = (int)((2 - r) * 60 + 31);
}
gal[0].x = gal[0].y = gal[0].z = 0;
gal[0].r = 320;
@@ -755,7 +774,7 @@ Nebula::StartSaver(BView *view, bool preview)
view->SetScale(fFactor);

gBitmap = new BBitmap(BRect(0, 0, gWidth - 1, gHeight - 1), B_RGB32);
- gBuffer8 = (char *)malloc(gWidth * gHeight);
+ gBuffer8 = (char*)malloc(gWidth * gHeight);

SetTickSize((bigtime_t)(1000000LL / gMaxFramesPerSecond));
fStarted = true;
@@ -776,7 +795,7 @@ Nebula::StopSaver()


void
-Nebula::Draw(BView *view, int32)
+Nebula::Draw(BView* view, int32)
{
if (fStarted) {
view->SetHighColor(0, 0, 0, 0);
@@ -785,7 +804,7 @@ Nebula::Draw(BView *view, int32)

fStarted = false;
}
- uint32 *buffer32 = (uint32 *)gBitmap->Bits();
+ uint32* buffer32 = (uint32*)gBitmap->Bits();

drawGalaxy();

@@ -800,8 +819,8 @@ Nebula::Draw(BView *view, int32)
// #pragma mark -


-extern "C" _EXPORT BScreenSaver *
-instantiate_screen_saver(BMessage *message, image_id image)
+extern "C" _EXPORT BScreenSaver*
+instantiate_screen_saver(BMessage* message, image_id image)
{
return new Nebula(message, image);
}

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

Commit: a11f9c281c3062418f774966432a4de191310270
URL: http://cgit.haiku-os.org/haiku/commit/?id=a11f9c281c30
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 21:43:59 2015 UTC

Nebula: Internationalize strings

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

diff --git a/src/add-ons/screen_savers/nebula/Jamfile
b/src/add-ons/screen_savers/nebula/Jamfile
index 8c81921..9cd58ca 100644
--- a/src/add-ons/screen_savers/nebula/Jamfile
+++ b/src/add-ons/screen_savers/nebula/Jamfile
@@ -8,5 +8,11 @@ ScreenSaver Nebula :
Draw.c
DrawStars.c
Nebula.cpp :
- be libscreensaver.so [ TargetLibsupc++ ]
+ be libscreensaver.so localestub [ TargetLibsupc++ ]
+;
+
+DoCatalogs Message :
+ x-vnd.Haiku-NebulaScreensaver
+ :
+ Nebula.cpp
;
diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index 4f431c0..3505de3 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -7,6 +7,7 @@
*/

#include <AppKit.h>
+#include <Catalog.h>
#include <ControlLook.h>
#include <InterfaceKit.h>
#include <LayoutBuilder.h>
@@ -20,6 +21,11 @@
#include <stdlib.h>
#include <string.h>

+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Nebula Screen Saver"
+
+
typedef struct
{
int x, y, z, r;
@@ -459,11 +465,12 @@ SettingsView::SettingsView(BRect frame)
:
BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW)
{
- BStringView* titleString = new BStringView(B_EMPTY_STRING, "Nebula");
+ BStringView* titleString = new BStringView(B_EMPTY_STRING,
+ B_TRANSLATE("Nebula"));
titleString->SetFont(be_bold_font);

BStringView* copyrightString = new BStringView(B_EMPTY_STRING,
- "© 2001-2004 Axel Dörfler.");
+ B_TRANSLATE("© 2001-2004 Axel Dörfler."));

BPopUpMenu* popMenu;
BMenuItem* item;
@@ -495,22 +502,24 @@ SettingsView::SettingsView(BRect frame)
BMessage* message = new BMessage(kMsgWidth);
message->AddInt32("width", widths[i]);

- popMenu->AddItem(item = new BMenuItem(label.String(), message));
+ const char* l = label.String();
+ popMenu->AddItem(item = new BMenuItem(B_TRANSLATE(l), message));

if (gSettingsWidth == widths[i])
item->SetMarked(true);
}

- fWidthMenu = new BMenuField("res", "Internal width:", popMenu);
+ fWidthMenu = new BMenuField("res", B_TRANSLATE("Internal width:"),
+ popMenu);

const char* colorSchemes[] = {
- "yellow",
- "cyan",
- "red",
- "green",
- "grey",
- "cold",
- "orange (original)"
+ B_TRANSLATE("yellow"),
+ B_TRANSLATE("cyan"),
+ B_TRANSLATE("red"),
+ B_TRANSLATE("green"),
+ B_TRANSLATE("grey"),
+ B_TRANSLATE("cold"),
+ B_TRANSLATE("orange (original)")
};

popMenu = new BPopUpMenu("");
@@ -522,13 +531,13 @@ SettingsView::SettingsView(BRect frame)
item->SetMarked(true);
}

- fColorMenu = new BMenuField("col", "Color: ", popMenu);
+ fColorMenu = new BMenuField("col", B_TRANSLATE("Color:"), popMenu);

const char* blankBorderFormats[] = {
- "fullscreen, no borders",
- "16:9, wide-screen",
- "2:3.5, cinemascope",
- "only a slit"
+ B_TRANSLATE("fullscreen, no borders"),
+ B_TRANSLATE("16:9, wide-screen"),
+ B_TRANSLATE("2:3.5, cinemascope"),
+ B_TRANSLATE("only a slit")
};

popMenu = new BPopUpMenu("");
@@ -540,15 +549,17 @@ SettingsView::SettingsView(BRect frame)
item->SetMarked(true);
}

- fBorderMenu = new BMenuField("cinema", "Format: ", popMenu);
+ fBorderMenu = new BMenuField("cinema", B_TRANSLATE("Format:"), popMenu);

- fMotionCheck = new BCheckBox(B_EMPTY_STRING, "Enable motion blur", new
BMessage(kMsgMotionBlur));
+ fMotionCheck = new BCheckBox(B_EMPTY_STRING,
+ B_TRANSLATE("Enable motion blur"), new
BMessage(kMsgMotionBlur));
fMotionCheck->SetValue((int)gMotionBlur);

- fSpeedSlider = new SimpleSlider("Speed", new BMessage(kMsgSpeed));
+ fSpeedSlider = new SimpleSlider(B_TRANSLATE("Speed"), new
BMessage(kMsgSpeed));
fSpeedSlider->SetValue((gSpeed - 0.002) / 0.05);

- fFramesSlider = new SimpleSlider("Maximum Frames Per Second", new
BMessage(kMsgFrames));
+ fFramesSlider = new SimpleSlider(B_TRANSLATE("Maximum Frames Per
Second"),
+ new BMessage(kMsgFrames));
fFramesSlider->SetValue(gMaxFramesPerSecond);

BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_HALF_ITEM_SPACING)

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

Revision: hrev49381
Commit: 0f0de97fede6e93af99ac99c7e5bf7e6972e8a46
URL: http://cgit.haiku-os.org/haiku/commit/?id=0f0de97fede6
Author: John Scipione <jscipione@xxxxxxxxx>
Date: Wed Jul 8 22:31:07 2015 UTC

Nebula: Convert fixed length char to BString

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

diff --git a/src/add-ons/screen_savers/nebula/Nebula.cpp
b/src/add-ons/screen_savers/nebula/Nebula.cpp
index 3505de3..067c146 100644
--- a/src/add-ons/screen_savers/nebula/Nebula.cpp
+++ b/src/add-ons/screen_savers/nebula/Nebula.cpp
@@ -430,12 +430,12 @@ public:

const char* UpdateText() const
{
- sprintf(fText, "%s: %d", fLabel, Value());
- return fText;
+ fText.SetToFormat("%s: %d", fLabel, Value());
+ return fText.String();
};

private:
- mutable char fText[32];
+ mutable BString fText;
const char* fLabel;
};



Other related posts:

  • » [haiku-commits] haiku: hrev49381 - src/add-ons/screen_savers/nebula - jscipione