Author: wim Date: 2010-06-27 12:38:05 +0200 (Sun, 27 Jun 2010) New Revision: 37278 Changeset: http://dev.haiku-os.org/changeset/37278/haiku Modified: haiku/trunk/src/apps/bsnow/SnowView.cpp haiku/trunk/src/apps/bsnow/SnowView.h Log: Compiler warning and code style fixes. No functional changes. Modified: haiku/trunk/src/apps/bsnow/SnowView.cpp =================================================================== --- haiku/trunk/src/apps/bsnow/SnowView.cpp 2010-06-27 10:17:50 UTC (rev 37277) +++ haiku/trunk/src/apps/bsnow/SnowView.cpp 2010-06-27 10:38:05 UTC (rev 37278) @@ -1,3 +1,5 @@ +#include "SnowView.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -2,18 +4,22 @@ #include <math.h> + #include <Alert.h> #include <Debug.h> #include <Message.h> #include <MessageRunner.h> +#include <MessageFilter.h> #include <OS.h> +#include <Region.h> #include <Screen.h> -#include "SnowView.h" + #include "Flakes.h" -#include <Region.h> -#include <MessageFilter.h> #define FORWARD_TO_PARENT + SnowView::SnowView() - : BView(BRect(SNOW_VIEW_RECT), "BSnow", B_FOLLOW_NONE, B_WILL_DRAW|B_PULSE_NEEDED) + : + BView(BRect(SNOW_VIEW_RECT), "BSnow", B_FOLLOW_NONE, + B_WILL_DRAW | B_PULSE_NEEDED) { @@ -79,7 +85,7 @@ SetFlags(Flags() & ~B_PULSE_NEEDED); /* it's only used when in the app */ get_system_info(&si); fNumFlakes = ((int32)(si.cpu_clock_speed/1000000)) * si.cpu_count / 3; //; - printf("BSnow: using %d flakes\n", fNumFlakes); + printf("BSnow: using %ld flakes\n", fNumFlakes); for (int i = 0; i < WORKSPACES_COUNT; i++) { fFlakes[i] = new flake[fNumFlakes]; memset(fFlakes[i], 0, fNumFlakes * sizeof(flake)); @@ -545,8 +551,6 @@ int32 SnowView::SnowMakerThread(void *p_this) { SnowView *_this = (SnowView *)p_this; - bigtime_t nextDraw = 0LL; - int current=0; BView *p = _this->Parent(); BRect portion(0,0,(_this->fCachedWsWidth/PORTION_GRAN)-1, (_this->fCachedWsHeight/PORTION_GRAN)-1); int nf = _this->fNumFlakes; Modified: haiku/trunk/src/apps/bsnow/SnowView.h =================================================================== --- haiku/trunk/src/apps/bsnow/SnowView.h 2010-06-27 10:17:50 UTC (rev 37277) +++ haiku/trunk/src/apps/bsnow/SnowView.h 2010-06-27 10:38:05 UTC (rev 37278) @@ -1,13 +1,17 @@ #ifndef _SNOW_VIEW_H #define _SNOW_VIEW_H + + #include <Bitmap.h> #include <Dragger.h> #include <List.h> #include <OS.h> #include <View.h> #include <MessageRunner.h> + #include "Flakes.h" + #define APP_SIG "application/x-vnd.mmu_man.BSnow" #define SNOW_VIEW_RECT 0,0,200,40 #define NUM_FLAKES 200 @@ -22,58 +26,61 @@ #define FALLEN_HEIGHT 30 #define INVALIDATOR_THREAD_NAME "You're Neo? I'm the Snow Maker!" - #define MSG_DRAG_ME "Drag me on your desktop..." #define MSG_CLICK_ME "Click me to remove BSnow..." + typedef struct flake { BPoint pos; BPoint opos; float weight; } flake; + class SnowView : public BView { public: - SnowView(); - SnowView(BMessage *archive); - ~SnowView(); -static BArchivable *Instantiate(BMessage *data); -virtual status_t Archive(BMessage *data, bool deep = true) const; -void AttachedToWindow(); -void DetachedFromWindow(); -void MessageReceived(BMessage *msg); -void Draw(BRect ur); -void Pulse(); + SnowView(); + SnowView(BMessage *archive); + ~SnowView(); + static BArchivable *Instantiate(BMessage *data); + virtual status_t Archive(BMessage *data, bool deep = true) const; + void AttachedToWindow(); + void DetachedFromWindow(); + void MessageReceived(BMessage *msg); + void Draw(BRect ur); + void Pulse(); -virtual void MouseDown(BPoint where); -virtual void MouseUp(BPoint where); -virtual void MouseMoved(BPoint where, uint32 code, const BMessage *a_message); -virtual void KeyDown(const char *bytes, int32 numBytes); -virtual void KeyUp(const char *bytes, int32 numBytes); + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 code, + const BMessage *a_message); + virtual void KeyDown(const char *bytes, int32 numBytes); + virtual void KeyUp(const char *bytes, int32 numBytes); -static int32 SnowMakerThread(void *p_this); -void Calc(); -void InvalFlakes(); + static int32 SnowMakerThread(void *p_this); + void Calc(); + void InvalFlakes(); + private: - BMessageRunner *fMsgRunner; - BDragger *fDragger; - long fNumFlakes; - flake *fFlakes[WORKSPACES_COUNT]; - BList *fFallenFlakes[WORKSPACES_COUNT]; - uint32 fCurrentWorkspace; - uint32 fCachedWsWidth; - uint32 fCachedWsHeight; - float fWind; - bigtime_t fWindDuration; - bool fAttached; - BBitmap *fFlakeBitmaps[NUM_PATTERNS]; - thread_id fInvalidator; - BView *fCachedParent; - BBitmap *fFallenBmp; - BView *fFallenView; - BRegion *fFallenReg; - bool fShowClickMe; + BMessageRunner *fMsgRunner; + BDragger *fDragger; + long fNumFlakes; + flake *fFlakes[WORKSPACES_COUNT]; + BList *fFallenFlakes[WORKSPACES_COUNT]; + uint32 fCurrentWorkspace; + uint32 fCachedWsWidth; + uint32 fCachedWsHeight; + float fWind; + bigtime_t fWindDuration; + bool fAttached; + BBitmap *fFlakeBitmaps[NUM_PATTERNS]; + thread_id fInvalidator; + BView *fCachedParent; + BBitmap *fFallenBmp; + BView *fFallenView; + BRegion *fFallenReg; + bool fShowClickMe; }; #endif