[haiku-commits] haiku: hrev46973 - src/add-ons/screen_savers/debugnow

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 5 Mar 2014 00:16:17 +0100 (CET)

hrev46973 adds 3 changesets to branch 'master'
old head: 008f6763444437e505d3620b73c0ed12a266f88b
new head: 75d4568c153a64d02b73b3d620b2465e179b58a3
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=75d4568+%5E008f676

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

0f7a8c1: DebugNow: Style fixes, export class def to header
  
  Update copyright header, make colors static const, * goes with type

782f6a4: DebugNow: Internationalize text
  
  Translation instructions are "keep it short and all uppercase,
  5 characters or less".
  
  Now non-English languages can join the fun:
  
  DEBUG JETZT
  DEBUG AHORA
  DEBUG ORA
  DEBUG が現在
  
  ... this might be a bit of a challenge for some languages.

75d4568: DebugNow: Shrink the text a bit, fixes #8170

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

3 files changed, 75 insertions(+), 49 deletions(-)
src/add-ons/screen_savers/debugnow/DebugNow.cpp | 87 +++++++++------------
src/add-ons/screen_savers/debugnow/DebugNow.h   | 35 +++++++++
src/add-ons/screen_savers/debugnow/Jamfile      |  2 +-

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

Commit:      0f7a8c1da413d333a68a38ad3d000d52f31b636f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0f7a8c1
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar  4 23:05:21 2014 UTC

DebugNow: Style fixes, export class def to header

Update copyright header, make colors static const, * goes with type

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

diff --git a/src/add-ons/screen_savers/debugnow/DebugNow.cpp 
b/src/add-ons/screen_savers/debugnow/DebugNow.cpp
index 0d5d232..d1acfd7 100644
--- a/src/add-ons/screen_savers/debugnow/DebugNow.cpp
+++ b/src/add-ons/screen_savers/debugnow/DebugNow.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007-2009, Haiku, Inc. All Rights Reserved.
+ * Copyright 2007-2014 Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -7,48 +7,38 @@
  */
 
 
+#include "DebugNow.h"
+
 #include <Catalog.h>
 #include <Font.h>
-#include <ScreenSaver.h>
 #include <StringView.h>
 #include <View.h>
 
 #include <BuildScreenSaverDefaultSettingsView.h>
 
+
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "Screensaver DebugNow"
 
 
-const rgb_color kMediumBlue = {0, 0, 100};
-const rgb_color kWhite = {255, 255, 255};
+static const rgb_color kMediumBlue             = { 0, 0, 100 };
+static const rgb_color kWhite                  = { 255, 255, 255 };
+
+
+//     #pragma mark - Instantiation function
 
 
-// Inspired by the classic BeOS BuyNow screensaver, of course
-class DebugNow : public BScreenSaver
+BScreenSaver* instantiate_screen_saver(BMessage* message, image_id image)
 {
-       public:
-                                                       DebugNow(BMessage 
*archive, image_id);
-               void                            Draw(BView *view, int32 frame);
-               void                            StartConfig(BView *view);
-               status_t                        StartSaver(BView *view, bool 
preview);
-               
-       private:
-               const char*             fLine1;
-               const char*                     fLine2;
-               BPoint                          fLine1Start;
-               BPoint                          fLine2Start;
-               escapement_delta        fDelta;
-};
-
-
-BScreenSaver* instantiate_screen_saver(BMessage *msg, image_id image) 
-{ 
-       return new DebugNow(msg, image);
-} 
-
-
-DebugNow::DebugNow(BMessage *archive, image_id id)
-       :       
+       return new DebugNow(message, image);
+}
+
+
+//     #pragma mark - DebugNow
+
+
+DebugNow::DebugNow(BMessage* archive, image_id id)
+       :
        BScreenSaver(archive, id),
        fLine1("DEBUG"),
        fLine2("NOW")
@@ -56,25 +46,25 @@ DebugNow::DebugNow(BMessage *archive, image_id id)
 }
 
 
-void 
-DebugNow::StartConfig(BView *view) 
+void
+DebugNow::StartConfig(BView* view)
 {
        BPrivate::BuildScreenSaverDefaultSettingsView(view, "DEBUG NOW",
                B_TRANSLATE("by Ryan Leavengood"));
-} 
+}
 
 
-status_t 
-DebugNow::StartSaver(BView *view, bool preview)
+status_t
+DebugNow::StartSaver(BView* view, bool preview)
 {
        float viewWidth = view->Bounds().Width();
        float viewHeight = view->Bounds().Height();
-       
+
        BFont font;
        view->GetFont(&font);
        font.SetSize(viewHeight / 2.5);
        view->SetFont(&font);
-       
+
        fDelta.nonspace = 0;
        fDelta.space = 0;
        BRect stringRect;
@@ -87,30 +77,29 @@ DebugNow::StartSaver(BView *view, bool preview)
                &stringRect);
        fLine2Start.Set(((viewWidth - stringRect.Width()) / 2) - 
stringRect.left,
                y + stringRect.Height() + viewHeight / 10);
-       
-       // Set tick size to 500,000 microseconds = 0.5 second
+
+       // set tick size to 500,000 microseconds (0.5 seconds)
        SetTickSize(500000);
-       
+
        return B_OK;
 }
 
 
-void 
-DebugNow::Draw(BView *view, int32 frame)
+void
+DebugNow::Draw(BView* view, int32 frame)
 {
-       // On first frame set the low color to make the text rendering correct
+       // on first frame set the low color to make the text rendering correct
        if (frame == 0)
                view->SetLowColor(kMediumBlue);
 
-       // Draw the background color every frame 
+       // draw the background color every frame
        view->SetHighColor(kMediumBlue);
        view->FillRect(view->Bounds());
 
-       // Draw the text every other frame to make the it blink
+       // draw the text every other frame to make the it blink
        if (frame % 2 == 1) {
                view->SetHighColor(kWhite);
                view->DrawString(fLine1, fLine1Start, &fDelta);
                view->DrawString(fLine2, fLine2Start, &fDelta);
        }
 }
-
diff --git a/src/add-ons/screen_savers/debugnow/DebugNow.h 
b/src/add-ons/screen_savers/debugnow/DebugNow.h
new file mode 100644
index 0000000..ff7f6d9
--- /dev/null
+++ b/src/add-ons/screen_savers/debugnow/DebugNow.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2007-2014 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef DEBUG_NOW_H
+#define DEBUG_NOW_H
+
+
+#include <Point.h>
+#include <ScreenSaver.h>
+
+
+// Inspired by the classic BeOS BuyNow screensaver, of course
+
+class BMessage;
+class BView;
+
+class DebugNow : public BScreenSaver {
+public:
+                                                               
DebugNow(BMessage* archive, image_id);
+
+                       void                            Draw(BView* view, int32 
frame);
+                       void                            StartConfig(BView 
*view);
+                       status_t                        StartSaver(BView *view, 
bool preview);
+
+private:
+                       const char*             fLine1;
+                       const char*                     fLine2;
+                       BPoint                          fLine1Start;
+                       BPoint                          fLine2Start;
+                       escapement_delta        fDelta;
+};
+
+
+#endif // DEBUG_NOW_H
diff --git a/src/add-ons/screen_savers/debugnow/Jamfile 
b/src/add-ons/screen_savers/debugnow/Jamfile
index e5f3004..0ed9f51 100644
--- a/src/add-ons/screen_savers/debugnow/Jamfile
+++ b/src/add-ons/screen_savers/debugnow/Jamfile
@@ -15,5 +15,5 @@ ScreenSaver DebugNow :
 DoCatalogs DebugNow :
        x-vnd.Haiku-DebugNowScreensaver
        :
-       DebugNow.cpp    
+       DebugNow.cpp
 ;

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

Commit:      782f6a4faec6e3b6b3e17a1c0c571d855d0f93fd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=782f6a4
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar  4 23:10:43 2014 UTC

DebugNow: Internationalize text

Translation instructions are "keep it short and all uppercase,
5 characters or less".

Now non-English languages can join the fun:

DEBUG JETZT
DEBUG AHORA
DEBUG ORA
DEBUG が現在

... this might be a bit of a challenge for some languages.

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

diff --git a/src/add-ons/screen_savers/debugnow/DebugNow.cpp 
b/src/add-ons/screen_savers/debugnow/DebugNow.cpp
index d1acfd7..1804989 100644
--- a/src/add-ons/screen_savers/debugnow/DebugNow.cpp
+++ b/src/add-ons/screen_savers/debugnow/DebugNow.cpp
@@ -40,8 +40,10 @@ BScreenSaver* instantiate_screen_saver(BMessage* message, 
image_id image)
 DebugNow::DebugNow(BMessage* archive, image_id id)
        :
        BScreenSaver(archive, id),
-       fLine1("DEBUG"),
-       fLine2("NOW")
+       fLine1(B_TRANSLATE_COMMENT("DEBUG",
+               "keep it short and all uppercase, 5 characters or less")),
+       fLine2(B_TRANSLATE_COMMENT("NOW",
+               "keep it short and all uppercase, 5 characters or less"))
 {
 }
 

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

Revision:    hrev46973
Commit:      75d4568c153a64d02b73b3d620b2465e179b58a3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=75d4568
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Mar  4 23:11:27 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/8170

DebugNow: Shrink the text a bit, fixes #8170

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

diff --git a/src/add-ons/screen_savers/debugnow/DebugNow.cpp 
b/src/add-ons/screen_savers/debugnow/DebugNow.cpp
index 1804989..674b626 100644
--- a/src/add-ons/screen_savers/debugnow/DebugNow.cpp
+++ b/src/add-ons/screen_savers/debugnow/DebugNow.cpp
@@ -64,7 +64,7 @@ DebugNow::StartSaver(BView* view, bool preview)
 
        BFont font;
        view->GetFont(&font);
-       font.SetSize(viewHeight / 2.5);
+       font.SetSize(viewHeight / 3);
        view->SetFont(&font);
 
        fDelta.nonspace = 0;


Other related posts:

  • » [haiku-commits] haiku: hrev46973 - src/add-ons/screen_savers/debugnow - jscipione