[haiku-commits] r33910 - haiku/trunk/src/preferences/backgrounds

  • From: jonas@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 6 Nov 2009 00:39:57 +0100 (CET)

Author: kirilla
Date: 2009-11-06 00:39:57 +0100 (Fri, 06 Nov 2009)
New Revision: 33910
Changeset: http://dev.haiku-os.org/changeset/33910/haiku

Modified:
   haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp
   haiku/trunk/src/preferences/backgrounds/BackgroundImage.h
   haiku/trunk/src/preferences/backgrounds/Backgrounds.cpp
   haiku/trunk/src/preferences/backgrounds/BackgroundsView.cpp
   haiku/trunk/src/preferences/backgrounds/BackgroundsView.h
   haiku/trunk/src/preferences/backgrounds/ImageFilePanel.cpp
   haiku/trunk/src/preferences/backgrounds/ImageFilePanel.h
   haiku/trunk/src/preferences/backgrounds/Jamfile
Log:
Partial clean-up.

Modified: haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp
===================================================================
--- haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp 2009-11-05 
19:40:52 UTC (rev 33909)
+++ haiku/trunk/src/preferences/backgrounds/BackgroundImage.cpp 2009-11-05 
23:39:57 UTC (rev 33910)
@@ -35,8 +35,14 @@
 //  Classes used for setting up and managing background images
 //
 
+#include "BackgroundImage.h"
+
+#include <new>
+#include <stdlib.h>
+
 #include <Bitmap.h>
 #include <Debug.h>
+#include <fs_attr.h>
 #include <Node.h>
 #include <TranslationKit.h>
 #include <View.h>
@@ -47,43 +53,37 @@
 #include <Screen.h>
 #include <String.h>
 
-#include <fs_attr.h>
-#include <stdlib.h>
-
-#include "BackgroundImage.h"
 #include "BackgroundsView.h"
 
-#include <new>
 
-
-const char *kBackgroundImageInfo                       = "be:bgndimginfo";
-const char *kBackgroundImageInfoOffset                 = 
"be:bgndimginfooffset";
-//const char *kBackgroundImageInfoTextOutline  = "be:bgndimginfotextoutline";
-const char *kBackgroundImageInfoTextOutline    = "be:bgndimginfoerasetext";
+const char* kBackgroundImageInfo                       = "be:bgndimginfo";
+const char* kBackgroundImageInfoOffset                 = 
"be:bgndimginfooffset";
+// const char* kBackgroundImageInfoTextOutline = "be:bgndimginfotextoutline";
+const char* kBackgroundImageInfoTextOutline    = "be:bgndimginfoerasetext";
 // NOTE: the attribute keeps the old name for backwards compatibility,
 // just in case some users spend time configuring a few windows with
 // this feature on or off...
-const char *kBackgroundImageInfoMode           = "be:bgndimginfomode";
-const char *kBackgroundImageInfoWorkspaces     = "be:bgndimginfoworkspaces";
-const char *kBackgroundImageInfoPath           = "be:bgndimginfopath";
-const char *kBackgroundImageInfoSet            = "be:bgndimginfoset";
-const char *kBackgroundImageInfoCacheMode      = "be:bgndimginfocachemode";
-const char *kBackgroundImageSetPeriod          = "be:bgndimgsetperiod";
-const char *kBackgroundImageRandomChange       = "be:bgndimgrandomchange";
-const char *kBackgroundImageCacheMode          = "be:bgndimgcachemode";
+const char* kBackgroundImageInfoMode           = "be:bgndimginfomode";
+const char* kBackgroundImageInfoWorkspaces     = "be:bgndimginfoworkspaces";
+const char* kBackgroundImageInfoPath           = "be:bgndimginfopath";
+const char* kBackgroundImageInfoSet            = "be:bgndimginfoset";
+const char* kBackgroundImageInfoCacheMode      = "be:bgndimginfocachemode";
+const char* kBackgroundImageSetPeriod          = "be:bgndimgsetperiod";
+const char* kBackgroundImageRandomChange       = "be:bgndimgrandomchange";
+const char* kBackgroundImageCacheMode          = "be:bgndimgcachemode";
 
 
-BackgroundImage *
-BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
+BackgroundImage*
+BackgroundImage::GetBackgroundImage(const BNode* node, bool isDesktop,
        BackgroundsView* view)
 {
-       BackgroundImage *result = new BackgroundImage(node, isDesktop, view);
+       BackgroundImage* result = new BackgroundImage(node, isDesktop, view);
        attr_info info;
        if (node->GetAttrInfo(kBackgroundImageInfo, &info) != B_OK)
                return result;
 
        BMessage container;
-       char *buffer = new char [info.size];
+       char* buffer = new char [info.size];
 
        status_t error = node->ReadAttr(kBackgroundImageInfo, info.type, 0, 
buffer,
                (size_t)info.size);
@@ -103,13 +103,14 @@
        uint32 maxImageSet = 0;
 
        if (isDesktop) {
-               container.FindInt32(kBackgroundImageSetPeriod, (int32 
*)&imageSetPeriod);
-               container.FindInt32(kBackgroundImageCacheMode, (int32 
*)&globalCacheMode);
+               container.FindInt32(kBackgroundImageSetPeriod, 
(int32*)&imageSetPeriod);
+               container.FindInt32(kBackgroundImageCacheMode,
+                       (int32*)&globalCacheMode);
                container.FindBool(kBackgroundImageRandomChange, &randomChange);
        }
 
        for (int32 index = 0; ; index++) {
-               const char *path;
+               const char* path;
                uint32 workspaces = B_ALL_WORKSPACES;
                Mode mode = kTiled;
                bool textWidgetLabelOutline = false;
@@ -118,7 +119,8 @@
                uint32 cacheMode = 0;
                int32 imageIndex = -1;
 
-               if (container.FindString(kBackgroundImageInfoPath, index, 
&path) == B_OK) {
+               if (container.FindString(kBackgroundImageInfoPath, index, &path)
+                       == B_OK) {
                        if (strcmp(path, "")) {
                                BPath bpath(path);
                                imageIndex = view->AddImage(bpath);
@@ -130,24 +132,24 @@
                        break;
 
                container.FindInt32(kBackgroundImageInfoWorkspaces, index,
-                       (int32 *)&workspaces);
-               container.FindInt32(kBackgroundImageInfoMode, index, (int32 
*)&mode);
+                       (int32*)&workspaces);
+               container.FindInt32(kBackgroundImageInfoMode, index, 
(int32*)&mode);
                container.FindBool(kBackgroundImageInfoTextOutline, index,
                        &textWidgetLabelOutline);
                container.FindPoint(kBackgroundImageInfoOffset, index, &offset);
 
                if (isDesktop) {
                        container.FindInt32(kBackgroundImageInfoSet, index,
-                               (int32 *)&imageSet);
+                               (int32*)&imageSet);
                        container.FindInt32(kBackgroundImageInfoCacheMode, 
index,
-                               (int32 *)&cacheMode);
+                               (int32*)&cacheMode);
                }
 
-               BackgroundImage::BackgroundImageInfo *imageInfo = new
+               BackgroundImage::BackgroundImageInfo* imageInfo = new
                        BackgroundImage::BackgroundImageInfo(workspaces, 
imageIndex,
                                mode, offset, textWidgetLabelOutline, imageSet, 
cacheMode);
 
-               //imageInfo->UnloadBitmap(globalCacheMode);
+               // imageInfo->UnloadBitmap(globalCacheMode);
 
                if (imageSet > maxImageSet)
                        maxImageSet = imageSet;
@@ -191,7 +193,8 @@
 //     #pragma mark -
 
 
-BackgroundImage::BackgroundImage(const BNode *node, bool desktop, 
BackgroundsView* view)
+BackgroundImage::BackgroundImage(const BNode* node, bool desktop,
+       BackgroundsView* view)
        :
        fIsDesktop(desktop),
        fDefinedByNode(*node),
@@ -214,14 +217,14 @@
 
 
 void
-BackgroundImage::Add(BackgroundImageInfo *info)
+BackgroundImage::Add(BackgroundImageInfo* info)
 {
        fBitmapForWorkspaceList.AddItem(info);
 }
 
 
 void
-BackgroundImage::Remove(BackgroundImageInfo *info)
+BackgroundImage::Remove(BackgroundImageInfo* info)
 {
        fBitmapForWorkspaceList.RemoveItem(info);
 }
@@ -231,7 +234,7 @@
 BackgroundImage::RemoveAll()
 {
        for (int32 index = 0; index < fBitmapForWorkspaceList.CountItems();) {
-               BackgroundImageInfo *info = 
fBitmapForWorkspaceList.ItemAt(index);
+               BackgroundImageInfo* info = 
fBitmapForWorkspaceList.ItemAt(index);
                if (info->fImageSet != fShowingImageSet)
                        index++;
                else
@@ -241,24 +244,26 @@
 
 
 void
-BackgroundImage::Show(BView *view, int32 workspace)
+BackgroundImage::Show(BView* view, int32 workspace)
 {
        fView = view;
 
-       BackgroundImageInfo *info = ImageInfoForWorkspace(workspace);
+       BackgroundImageInfo* info = ImageInfoForWorkspace(workspace);
        if (info) {
-               /*BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
+               /*BPoseView* poseView = dynamic_cast<BPoseView*>(fView);
                if (poseView)
-                       
poseView->SetEraseWidgetTextBackground(info->fTextWidgetLabelOutline);*/
+                       poseView
+                               
->SetEraseWidgetTextBackground(info->fTextWidgetLabelOutline);*/
                Show(info, fView);
        }
 }
 
 
 void
-BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
+BackgroundImage::Show(BackgroundImageInfo* info, BView* view)
 {
-       BBitmap *bitmap = 
fBackgroundsView->GetImage(info->fImageIndex)->GetBitmap();
+       BBitmap* bitmap
+               = fBackgroundsView->GetImage(info->fImageIndex)->GetBitmap();
 
        if (!bitmap)
                return;
@@ -287,7 +292,8 @@
                        if (fIsDesktop) {
                                destinationBitmapBounds.OffsetBy(
                                        (viewBounds.Width() - 
destinationBitmapBounds.Width()) / 2,
-                                       (viewBounds.Height() - 
destinationBitmapBounds.Height()) / 2);
+                                       (viewBounds.Height() - 
destinationBitmapBounds.Height())
+                                       / 2);
                                break;
                        }
                        // else fall thru
@@ -304,7 +310,8 @@
                        break;
                }
                case kTiled:
-                       // Original Backgrounds Preferences center the tiled 
paper but the Tracker don't do that
+                       // Original Backgrounds Preferences center the tiled 
paper
+                       // but Tracker doesn't do that
                        //if (fIsDesktop) {
                        destinationBitmapBounds.OffsetBy(
                                (viewBounds.Width() - 
destinationBitmapBounds.Width()) / 2,
@@ -333,7 +340,7 @@
        if (fShowingBitmap) {
                fView->ClearViewBitmap();
                fView->Invalidate();
-               /*BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
+               /*BPoseView* poseView = dynamic_cast<BPoseView*>(fView);
                // make sure text widgets draw the default way, erasing their 
background
                if (poseView)
                        poseView->SetEraseWidgetTextBackground(true);*/
@@ -342,7 +349,7 @@
 }
 
 
-BackgroundImage::BackgroundImageInfo *
+BackgroundImage::BackgroundImageInfo*
 BackgroundImage::ImageInfoForWorkspace(int32 workspace) const
 {
        uint32 workspaceMask = 1;
@@ -355,9 +362,9 @@
        // do a simple lookup for the most likely candidate bitmap -
        // pick the imageInfo that is only defined for this workspace over one
        // that supports multiple workspaces
-       BackgroundImageInfo *result = NULL;
+       BackgroundImageInfo* result = NULL;
        for (int32 index = 0; index < count; index++) {
-               BackgroundImageInfo *info = 
fBitmapForWorkspaceList.ItemAt(index);
+               BackgroundImageInfo* info = 
fBitmapForWorkspaceList.ItemAt(index);
                if (info->fImageSet != fShowingImageSet)
                        continue;
 
@@ -375,7 +382,7 @@
 
 
 void
-BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state)
+BackgroundImage::WorkspaceActivated(BView* view, int32 workspace, bool state)
 {
        if (!fIsDesktop) {
                // we only care for desktop bitmaps
@@ -387,12 +394,12 @@
                return;
        }
 
-       BackgroundImageInfo *info = ImageInfoForWorkspace(workspace);
+       BackgroundImageInfo* info = ImageInfoForWorkspace(workspace);
        if (info != fShowingBitmap) {
                if (info)
                        Show(info, view);
                else {
-                       /*if (BPoseView *poseView = dynamic_cast<BPoseView 
*>(view))
+                       /*if (BPoseView* poseView = 
dynamic_cast<BPoseView*>(view))
                                poseView->SetEraseWidgetTextBackground(true);*/
                        view->ClearViewBitmap();
                        view->Invalidate();
@@ -416,28 +423,29 @@
                        (viewBounds.Width() - bitmapBounds.Width()) / 2,
                        (viewBounds.Height() - bitmapBounds.Height()) / 2);
 
-               fView->SetViewBitmap(fShowingBitmap->fBitmap, bitmapBounds, 
destinationBitmapBounds,
-                       B_FOLLOW_NONE, 0);
+               fView->SetViewBitmap(fShowingBitmap->fBitmap, bitmapBounds,
+                       destinationBitmapBounds, B_FOLLOW_NONE, 0);
                fView->Invalidate();
        }*/
 }
 
 
 status_t
-BackgroundImage::SetBackgroundImage(BNode *node)
+BackgroundImage::SetBackgroundImage(BNode* node)
 {
        status_t err;
        BMessage container;
        int32 count = fBitmapForWorkspaceList.CountItems();
 
        for (int32 index = 0; index < count; index++) {
-               BackgroundImageInfo *info = 
fBitmapForWorkspaceList.ItemAt(index);
+               BackgroundImageInfo* info = 
fBitmapForWorkspaceList.ItemAt(index);
 
                container.AddBool(kBackgroundImageInfoTextOutline,
                        info->fTextWidgetLabelOutline);
                if (fBackgroundsView->GetImage(info->fImageIndex) != NULL) {
                        container.AddString(kBackgroundImageInfoPath,
-                               
fBackgroundsView->GetImage(info->fImageIndex)->GetPath().Path());
+                               fBackgroundsView
+                                       
->GetImage(info->fImageIndex)->GetPath().Path());
                } else 
                        container.AddString(kBackgroundImageInfoPath, "");
 
@@ -473,16 +481,16 @@
 }
 
 
-/*BackgroundImage *
-BackgroundImage::Refresh(BackgroundImage *oldBackgroundImage,
-       const BNode *fromNode, bool desktop, BPoseView *poseView)
+/*BackgroundImage*
+BackgroundImage::Refresh(BackgroundImage* oldBackgroundImage,
+       const BNode* fromNode, bool desktop, BPoseView* poseView)
 {
        if (oldBackgroundImage) {
                oldBackgroundImage->Remove();
                delete oldBackgroundImage;
        }
 
-       BackgroundImage *result = GetBackgroundImage(fromNode, desktop);
+       BackgroundImage* result = GetBackgroundImage(fromNode, desktop);
        if (result && poseView->ViewMode() != kListMode)
                result->Show(poseView, current_workspace());
        return result;
@@ -490,12 +498,12 @@
 
 
 void
-BackgroundImage::ChangeImageSet(BPoseView *poseView)
+BackgroundImage::ChangeImageSet(BPoseView* poseView)
 {
        if (fRandomChange) {
                if (fImageSetCount > 1) {
                        uint32 oldShowingImageSet = fShowingImageSet;
-                       while(oldShowingImageSet == fShowingImageSet)
+                       while (oldShowingImageSet == fShowingImageSet)
                                fShowingImageSet = random()%fImageSetCount;
                } else
                        fShowingImageSet = 0;
@@ -535,3 +543,4 @@
 
        return fBitmap;
 }
+

Modified: haiku/trunk/src/preferences/backgrounds/BackgroundImage.h
===================================================================
--- haiku/trunk/src/preferences/backgrounds/BackgroundImage.h   2009-11-05 
19:40:52 UTC (rev 33909)
+++ haiku/trunk/src/preferences/backgrounds/BackgroundImage.h   2009-11-05 
23:39:57 UTC (rev 33910)
@@ -38,14 +38,15 @@
 #ifndef __BACKGROUND_IMAGE__
 #define __BACKGROUND_IMAGE__
 
-#include "String.h"
-#include "ObjectList.h"
 
 #include <GraphicsDefs.h>
 #include <Node.h>
 #include <Path.h>
 
+#include "ObjectList.h"
+#include "String.h"
 
+
 class BView;
 class BBitmap;
 
@@ -53,14 +54,14 @@
 class Image;
 class BackgroundsView;
 
-extern const char *kBackgroundImageInfo;
-extern const char *kBackgroundImageInfoOffset;
-extern const char *kBackgroundImageInfoEraseText;
-extern const char *kBackgroundImageInfoMode;
-extern const char *kBackgroundImageInfoWorkspaces;
-extern const char *kBackgroundImageInfoPath;
-extern const char *kBackgroundImageInfoSet;
-extern const char *kBackgroundImageInfoSetPeriod;
+extern const char* kBackgroundImageInfo;
+extern const char* kBackgroundImageInfoOffset;
+extern const char* kBackgroundImageInfoEraseText;
+extern const char* kBackgroundImageInfoMode;
+extern const char* kBackgroundImageInfoWorkspaces;
+extern const char* kBackgroundImageInfoPath;
+extern const char* kBackgroundImageInfoSet;
+extern const char* kBackgroundImageInfoSetPeriod;
 
 const uint32 kRestoreBackgroundImage = 'Tbgr';
 const uint32 kChangeBackgroundImage = 'Cbgr';
@@ -99,50 +100,50 @@
                uint32 fCacheMode;              // image cache strategy (0 
cache , 1 no cache)
        };
 
-       static BackgroundImage *GetBackgroundImage(const BNode *node,
+       static BackgroundImage* GetBackgroundImage(const BNode* node,
                bool isDesktop, BackgroundsView* view);
                // create a BackgroundImage object by reading it from a node
 
        virtual ~BackgroundImage();
 
-       void Show(BView *view, int32 workspace);
+       void Show(BView* view, int32 workspace);
                // display the right background for a given workspace
        void Remove();
                // remove the background from it's current view
 
-       void WorkspaceActivated(BView *view, int32 workspace, bool state);
+       void WorkspaceActivated(BView* view, int32 workspace, bool state);
                // respond to a workspace change
        void ScreenChanged(BRect rect, color_space space);
                // respond to a screen size change
-       /*static BackgroundImage *Refresh(BackgroundImage *oldBackgroundImage,
-               const BNode *fromNode, bool desktop, BPoseView *poseView);
+       /*static BackgroundImage* Refresh(BackgroundImage* oldBackgroundImage,
+               const BNode* fromNode, bool desktop, BPoseView* poseView);
                // respond to a background image setting change
-       void ChangeImageSet(BPoseView *poseView);
+       void ChangeImageSet(BPoseView* poseView);
                // change to the next imageSet if any, no refresh*/
-       BackgroundImageInfo *ImageInfoForWorkspace(int32) const;
+       BackgroundImageInfo* ImageInfoForWorkspace(int32) const;
 
        bool IsDesktop() { return fIsDesktop;}
 
-       status_t SetBackgroundImage(BNode *node);
+       status_t SetBackgroundImage(BNode* node);
 
-       void Show(BackgroundImageInfo *, BView *view);
+       void Show(BackgroundImageInfo*, BView* view);
 
        uint32 GetShowingImageSet() { return fShowingImageSet; }
 
-       void Add(BackgroundImageInfo *);
-       void Remove(BackgroundImageInfo *);
+       void Add(BackgroundImageInfo*);
+       void Remove(BackgroundImageInfo*);
        void RemoveAll();
 
 private:
-       BackgroundImage(const BNode *node, bool isDesktop, BackgroundsView* 
view);
+       BackgroundImage(const BNode* node, bool isDesktop, BackgroundsView* 
view);
                // no public constructor, GetBackgroundImage factory function is
                // used instead
 
        bool fIsDesktop;
        BNode fDefinedByNode;
-       BView *fView;
+       BView* fView;
        BackgroundsView* fBackgroundsView;
-       BackgroundImageInfo *fShowingBitmap;
+       BackgroundImageInfo* fShowingBitmap;
 
        BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList;
 
@@ -164,9 +165,10 @@
        BBitmap* GetBitmap();
        BPath GetPath() {return fPath;}
 private:
-       BBitmap *fBitmap;
+       BBitmap* fBitmap;
        BPath fPath;
        BString name;
 };
 
 #endif
+

Modified: haiku/trunk/src/preferences/backgrounds/Backgrounds.cpp
===================================================================
--- haiku/trunk/src/preferences/backgrounds/Backgrounds.cpp     2009-11-05 
19:40:52 UTC (rev 33909)
+++ haiku/trunk/src/preferences/backgrounds/Backgrounds.cpp     2009-11-05 
23:39:57 UTC (rev 33910)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2008, Haiku, Inc. All Rights Reserved.
+ * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -8,17 +8,17 @@
  */
 
 
-#include "BackgroundsView.h"
-
 #include <Application.h>
 #include <LayoutBuilder.h>
 #include <TrackerAddOnAppLaunch.h>
 #include <Window.h>
 
+#include "BackgroundsView.h"
 
-static const char *kSignature = "application/x-vnd.Haiku-Backgrounds";
 
+static const char* kSignature = "application/x-vnd.Haiku-Backgrounds";
 
+
 class BackgroundsWindow : public BWindow {
        public:
                BackgroundsWindow();
@@ -29,7 +29,7 @@
                virtual bool QuitRequested();
                virtual void WorkspaceActivated(int32 oldWorkspaces, bool 
active);
 
-               BackgroundsView *fBackgroundsView;
+               BackgroundsView* fBackgroundsView;
 };
 
 
@@ -61,6 +61,7 @@
        fWindow->RefsReceived(message);
 }
 
+
 //     #pragma mark -
 
 

Modified: haiku/trunk/src/preferences/backgrounds/BackgroundsView.cpp
===================================================================
--- haiku/trunk/src/preferences/backgrounds/BackgroundsView.cpp 2009-11-05 
19:40:52 UTC (rev 33909)
+++ haiku/trunk/src/preferences/backgrounds/BackgroundsView.cpp 2009-11-05 
23:39:57 UTC (rev 33910)
@@ -10,7 +10,6 @@
 
 
 #include "BackgroundsView.h"
-#include "ImageFilePanel.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -28,7 +27,9 @@
 
 #include <be_apps/Tracker/Background.h>
 
+#include "ImageFilePanel.h"
 
+
 static const uint32 kMsgApplySettings = 'aply';
 static const uint32 kMsgRevertSettings = 'rvrt';
 
@@ -162,7 +163,7 @@
        
        fPreview->AddChild(view);
 
-       BBox *rightbox = new BBox("rightbox");
+       BBox* rightbox = new BBox("rightbox");
 
        fWorkspaceMenu = new BPopUpMenu("pick one");
        fWorkspaceMenu->AddItem(new BMenuItem("All Workspaces",
@@ -178,7 +179,7 @@
        fWorkspaceMenu->AddItem(new BMenuItem("Other folder" B_UTF8_ELLIPSIS,
                new BMessage(kMsgOtherFolder)));
 
-       BMenuField *workspaceMenuField = new BMenuField(BRect(0, 0, 130, 18),
+       BMenuField* workspaceMenuField = new BMenuField(BRect(0, 0, 130, 18),
                "workspaceMenuField", NULL, fWorkspaceMenu, true);
        workspaceMenuField->ResizeToPreferred();
        rightbox->SetLabel(workspaceMenuField);
@@ -190,7 +191,7 @@
        fImageMenu->AddItem(new BMenuItem("Other" B_UTF8_ELLIPSIS,
                new BMessage(kMsgOtherImage)));
 
-       BMenuField *imageMenuField = new BMenuField(NULL, fImageMenu);
+       BMenuField* imageMenuField = new BMenuField(NULL, fImageMenu);
        imageMenuField->SetAlignment(B_ALIGN_RIGHT);
        imageMenuField->ResizeToPreferred();
 
@@ -204,7 +205,7 @@
        fPlacementMenu->AddItem(new BMenuItem("Tile",
                new BMessage(kMsgTilePlacement)));
 
-       BMenuField *placementMenuField = new BMenuField(NULL, fPlacementMenu);
+       BMenuField* placementMenuField = new BMenuField(NULL, fPlacementMenu);
        placementMenuField->SetAlignment(B_ALIGN_RIGHT);
 
        fIconLabelOutline = new BCheckBox("Icon label outline",
@@ -319,7 +320,7 @@
 
 
 void
-BackgroundsView::MessageReceived(BMessage *msg)
+BackgroundsView::MessageReceived(BMessage* msg)
 {
        switch (msg->what) {
                case B_SIMPLE_DATA:
@@ -527,7 +528,7 @@
        }
 
        for (int32 i = fImageList.CountItems() - 1; i >= 0; i--) {
-               BMessage *message = new BMessage(kMsgImageSelected);
+               BMessage* message = new BMessage(kMsgImageSelected);
                AddItem(new BGImageMenuItem(GetImage(i)->GetName(), i, 
message));
        }
 
@@ -594,8 +595,8 @@
 void
 BackgroundsView::Save()
 {
-       bool textWidgetLabelOutline =
-               fIconLabelOutline->Value() == B_CONTROL_ON;
+       bool textWidgetLabelOutline
+               = fIconLabelOutline->Value() == B_CONTROL_ON;
 
        BackgroundImage::Mode mode = FindPlacementMode();
        BPoint offset(atoi(fXPlacementText->Text()), 
atoi(fYPlacementText->Text()));
@@ -631,8 +632,8 @@
                                                fCurrentInfo->fCacheMode);
                                        fCurrent->Add(fCurrentInfo);
                                } else if (fCurrentInfo->fWorkspace == 
workspaceMask) {
-                                       fCurrentInfo->fTextWidgetLabelOutline =
-                                               textWidgetLabelOutline;
+                                       fCurrentInfo->fTextWidgetLabelOutline
+                                               = textWidgetLabelOutline;
                                        fCurrentInfo->fMode = mode;
                                        if (fCurrentInfo->fMode == 
BackgroundImage::kAtOffset)
                                                fCurrentInfo->fOffset = offset;
@@ -759,9 +760,9 @@
 
 
 int32
-BackgroundsView::NotifyThread(void *data)
+BackgroundsView::NotifyThread(void* data)
 {
-       BackgroundsView *view = (BackgroundsView*)data;
+       BackgroundsView* view = (BackgroundsView*)data;
 
        view->NotifyServer();
        return B_OK;
@@ -842,7 +843,7 @@
                int32 i = AddPath(path);
                BString s;
                s << "Folder: " << path.Leaf();
-               BMenuItem *item = new BMenuItem(s.String(),
+               BMenuItem* item = new BMenuItem(s.String(),
                        new BMessage(kMsgFolderSelected));
                fWorkspaceMenu->AddItem(item, -i - 1 + 6);
                index++;
@@ -893,10 +894,10 @@
 
        int32 index = 
((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex();
        if (index >= 0) {
-               BBitmap *bitmap = GetImage(index)->GetBitmap();
+               BBitmap* bitmap = GetImage(index)->GetBitmap();
                if (bitmap) {
-                       BackgroundImage::BackgroundImageInfo *info =
-                               new BackgroundImage::BackgroundImageInfo(0, 
index,
+                       BackgroundImage::BackgroundImageInfo* info
+                               = new BackgroundImage::BackgroundImageInfo(0, 
index,
                                        FindPlacementMode(), 
BPoint(atoi(fXPlacementText->Text()),
                                                atoi(fYPlacementText->Text())),
                                        fIconLabelOutline->Value() == 
B_CONTROL_ON, 0, 0);
@@ -944,20 +945,21 @@
                && fPicker->ValueAsColor() != BScreen().DesktopColor()) {
                hasChanged = true;
        } else if (fCurrentInfo) {
-               if ((fIconLabelOutline->Value() == B_CONTROL_ON) ^
-                       fCurrentInfo->fTextWidgetLabelOutline) {
+               if ((fIconLabelOutline->Value() == B_CONTROL_ON)
+                       ^ fCurrentInfo->fTextWidgetLabelOutline) {
                        hasChanged = true;
                } else if (FindPlacementMode() != fCurrentInfo->fMode) {
                        hasChanged = true;
-               } else if (fCurrentInfo->fImageIndex !=
-                       
((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex()) {
+               } else if (fCurrentInfo->fImageIndex
+                       != 
((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex()) {
                        hasChanged = true;
                } else if (fCurrent->IsDesktop()
                        && ((fCurrentInfo->fWorkspace != B_ALL_WORKSPACES)
-                               ^ 
(fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()))) {
+                               ^ 
(fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked())))
+               {
                        hasChanged = true;
-               } else if (fCurrentInfo->fImageIndex > -1 &&
-                       fCurrentInfo->fMode == BackgroundImage::kAtOffset) {
+               } else if (fCurrentInfo->fImageIndex > -1
+                       && fCurrentInfo->fMode == BackgroundImage::kAtOffset) {
                        BString oldString, newString;
                        oldString << (int)fCurrentInfo->fOffset.x;
                        if (oldString != BString(fXPlacementText->Text())) {
@@ -981,7 +983,7 @@
 
 
 void
-BackgroundsView::RefsReceived(BMessage *msg)
+BackgroundsView::RefsReceived(BMessage* msg)
 {
        if (!msg->HasRef("refs") && msg->HasRef("dir_ref")) {
                entry_ref dirRef;
@@ -1007,7 +1009,7 @@
                        if (!imageType.Contains(&refType))
                                continue;
 
-                       BGImageMenuItem *item;
+                       BGImageMenuItem* item;
                        int32 index = AddImage(path);
                        if (index >= 0) {
                                item = FindImageItem(index);
@@ -1036,7 +1038,7 @@
                                
BMessenger(this).SendMessage(kMsgCurrentWorkspace);
                                break;
                        }
-                       BMenuItem *item;
+                       BMenuItem* item;
                        int32 index = AddPath(path);
                        if (index >= 0) {
                                item = fWorkspaceMenu->ItemAt(index + 6);
@@ -1066,7 +1068,7 @@
        int32 count = fPathList.CountItems();
        int32 index = 0;
        for (; index < count; index++) {
-               BPath *p = fPathList.ItemAt(index);
+               BPath* p = fPathList.ItemAt(index);
                int c = BString(p->Path()).ICompare(path.Path());
                if (c == 0)
                        return index;
@@ -1085,7 +1087,7 @@
        int32 count = fImageList.CountItems();
        int32 index = 0;
        for (; index < count; index++) {
-               Image *image = fImageList.ItemAt(index);
+               Image* image = fImageList.ItemAt(index);
                if (image->GetPath() == path)
                        return index;
        }
@@ -1106,12 +1108,12 @@
 BackgroundsView::FindImageItem(const int32 imageIndex)
 {
        if (imageIndex < 0)
-               return (BGImageMenuItem *)fImageMenu->ItemAt(0);
+               return (BGImageMenuItem*)fImageMenu->ItemAt(0);
 
        int32 count = fImageMenu->CountItems() - 2;
        int32 index = 2;
        for (; index < count; index++) {
-               BGImageMenuItem *image = (BGImageMenuItem 
*)fImageMenu->ItemAt(index);
+               BGImageMenuItem* image = 
(BGImageMenuItem*)fImageMenu->ItemAt(index);
                if (image->ImageIndex() == imageIndex)
                        return image;
        }
@@ -1120,7 +1122,7 @@
 
 
 bool
-BackgroundsView::AddItem(BGImageMenuItem *item)
+BackgroundsView::AddItem(BGImageMenuItem* item)
 {
        int32 count = fImageMenu->CountItems() - 2;
        int32 index = 2;
@@ -1130,7 +1132,7 @@
        }
 
        for (; index < count; index++) {
-               BGImageMenuItem* image = (BGImageMenuItem 
*)fImageMenu->ItemAt(index);
+               BGImageMenuItem* image = 
(BGImageMenuItem*)fImageMenu->ItemAt(index);
                int c = 
(BString(image->Label()).ICompare(BString(item->Label())));
                if (c > 0)
                        break;
@@ -1217,7 +1219,7 @@
 
 
 void
-PreView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
+PreView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
 {
        if (IsEnabled())
                SetViewCursor(&fMoveHandCursor);
@@ -1279,8 +1281,8 @@
 //     #pragma mark -
 
 
-BGImageMenuItem::BGImageMenuItem(const char *label, int32 imageIndex,
-       BMessage *message, char shortcut, uint32 modifiers)
+BGImageMenuItem::BGImageMenuItem(const char* label, int32 imageIndex,
+       BMessage* message, char shortcut, uint32 modifiers)
        : BMenuItem(label, message, shortcut, modifiers),
        fImageIndex(imageIndex)
 {

Modified: haiku/trunk/src/preferences/backgrounds/BackgroundsView.h
===================================================================
--- haiku/trunk/src/preferences/backgrounds/BackgroundsView.h   2009-11-05 
19:40:52 UTC (rev 33909)
+++ haiku/trunk/src/preferences/backgrounds/BackgroundsView.h   2009-11-05 
23:39:57 UTC (rev 33910)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
+ * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -9,8 +9,6 @@
 #define BACKGROUNDS_VIEW_H
 
 
-#include "BackgroundImage.h"
-
 #include <View.h>
 #include <ColorControl.h>
 #include <Message.h>
@@ -31,20 +29,25 @@
 #include <StringView.h>
 #include <Cursor.h>
 
-#define SETTINGS_FILE                                  "Backgrounds_settings"
+#include "BackgroundImage.h"
 
+
+#define SETTINGS_FILE          "Backgrounds_settings"
+
+
 class ImageFilePanel;
 
 
 class BGImageMenuItem : public BMenuItem {
-       public:
-               BGImageMenuItem(const char *label, int32 imageIndex, BMessage 
*message,
-                       char shortcut = 0, uint32 modifiers = 0);
+public:
+                                                       BGImageMenuItem(const 
char* label, int32 imageIndex,
+                                                               BMessage* 
message, char shortcut = 0,
+                                                               uint32 
modifiers = 0);
 
-               int32 ImageIndex() { return fImageIndex; }
+                       int32                   ImageIndex() { return 
fImageIndex; }
 
-       private:
-               int32 fImageIndex;
+private:
+                       int32                   fImageIndex;
 };
 
 
@@ -61,107 +64,118 @@
 
 
 class FramePart : public BView {
-       public:
-               FramePart(int32 part);
+public:
+                                                       FramePart(int32 part);
 
-               void Draw(BRect rect);
-               void SetDesktop(bool isDesktop);
+                       void                    Draw(BRect rect);
+                       void                    SetDesktop(bool isDesktop);
 
-       private:
-               void _SetSizeAndAlignment();
+private:
+                       void                    _SetSizeAndAlignment();
 
-               int32 fFramePart;
-               bool fIsDesktop;
+                       int32                   fFramePart;
+                       bool                    fIsDesktop;
 };
 
 
 class PreView : public BControl {
-       public:
-               PreView();
+public:
+                                                       PreView();
 
-               BPoint fPoint;
-               BRect fImageBounds;
+                       BPoint                  fPoint;
+                       BRect                   fImageBounds;
 
-       protected:
-               void MouseDown(BPoint point);
-               void MouseUp(BPoint point);
-               void MouseMoved(BPoint point, uint32 transit, const BMessage 
*message);
-               void AttachedToWindow();
+protected:
+                       void                    MouseDown(BPoint point);
+                       void                    MouseUp(BPoint point);
+                       void                    MouseMoved(BPoint point, uint32 
transit,
+                                                               const BMessage* 
message);
+                       void                    AttachedToWindow();
 
-               BPoint fOldPoint;
-               float x_ratio, y_ratio;
-               display_mode mode;
+                       BPoint                  fOldPoint;
+                       float                   x_ratio;
+                       float                   y_ratio;
+                       display_mode    mode;
 
-               BCursor fMoveHandCursor;
+                       BCursor                 fMoveHandCursor;
 };
 
 
 class BackgroundsView : public BBox {
-       public:
-               BackgroundsView();
-               ~BackgroundsView();
+public:
+                                                       BackgroundsView();
+                                                       ~BackgroundsView();
 
-               void RefsReceived(BMessage* msg);
+                       void                    RefsReceived(BMessage* msg);
 
-               void SaveSettings();
-               void WorkspaceActivated(uint32 oldWorkspaces, bool active);
-               int32 AddImage(BPath path);
-               Image* GetImage(int32 imageIndex);
+                       void                    SaveSettings();
+                       void                    WorkspaceActivated(uint32 
oldWorkspaces,
+                                                               bool active);
+                       int32                   AddImage(BPath path);
+                       Image*                  GetImage(int32 imageIndex);
 
-               bool FoundPositionSetting();
+                       bool                    FoundPositionSetting();
 
-       protected:
-               void Save();
-               void NotifyServer();
-               void LoadSettings();
-               void AllAttached();
-               void MessageReceived(BMessage *msg);
-               void LoadDesktopFolder();
-               void LoadDefaultFolder();
-               void LoadFolder(bool isDesktop);
-               void LoadRecentFolder(BPath path);
-               void UpdateWithCurrent();
-               void UpdatePreview();
-               void UpdateButtons();
-               void SetDesktop(bool isDesktop);
-               int32 AddPath(BPath path);
+protected:
+                       void                    Save();
+                       void                    NotifyServer();
+                       void                    LoadSettings();
+                       void                    AllAttached();
+                       void                    MessageReceived(BMessage* msg);
+                       void                    LoadDesktopFolder();
+                       void                    LoadDefaultFolder();
+                       void                    LoadFolder(bool isDesktop);
+                       void                    LoadRecentFolder(BPath path);
+                       void                    UpdateWithCurrent();
+                       void                    UpdatePreview();
+                       void                    UpdateButtons();
+                       void                    SetDesktop(bool isDesktop);
+                       int32                   AddPath(BPath path);
 
-               static int32 NotifyThread(void *data);
+       static  int32                   NotifyThread(void* data);
 
-               BGImageMenuItem *FindImageItem(const int32 imageIndex);
-               bool AddItem(BGImageMenuItem *item);
+                       BGImageMenuItem*        FindImageItem(const int32 
imageIndex);
 
-               BackgroundImage::Mode FindPlacementMode();
+                       bool                    AddItem(BGImageMenuItem* item);
 
-               BColorControl *fPicker;                 // color picker
-               BButton *fApply, *fRevert;              // apply and revert 
buttons
-               BCheckBox *fIconLabelOutline;   // label ckeckbox
-               BMenu* fPlacementMenu, *fImageMenu, *fWorkspaceMenu;    // the 
three comboboxes
-               BTextControl *fXPlacementText, *fYPlacementText;                
// x and y textboxes
-               PreView *fPreView;                              // the view for 
previewing the result
-               BBox *fPreview;                                 // the box 
which draws a computer/folder
-               BFilePanel *fFolderPanel;               // the file panels for 
folders
-               ImageFilePanel *fPanel;                 // the file panels for 
images
+                       BackgroundImage::Mode   FindPlacementMode();
 
-               BackgroundImage *fCurrent;              // the current 
BackgroundImage object
-               BackgroundImage::BackgroundImageInfo *fCurrentInfo;//the 
current BackgroundImageInfo object
-               entry_ref fCurrentRef;                  // the entry for the 
node which holds current
-               int32 fLastImageIndex, fLastWorkspaceIndex;             // last 
indexes for cancel
-               BMessage fSettings;                             // settings 
loaded from settings directory
+                       BColorControl*  fPicker;
+                       BButton*                fApply;
+                       BButton*                fRevert;
+                       BCheckBox*              fIconLabelOutline;
+                       BMenu*                  fPlacementMenu;
+                       BMenu*                  fImageMenu;
+                       BMenu*                  fWorkspaceMenu;
+                       BTextControl*   fXPlacementText;
+                       BTextControl*   fYPlacementText;
+                       PreView*                fPreView;
+                       BBox*                   fPreview;
+                       BFilePanel*             fFolderPanel;

[... truncated: 272 lines follow ...]

Other related posts:

  • » [haiku-commits] r33910 - haiku/trunk/src/preferences/backgrounds - jonas