Cleanups, mostly to make diffing it against the original file from Tracker
more easy. It's not so nice that this code is replicated, there could be refactoring to get a base-class which is used by both Tracker and Backgrounds and the Tracker version extends it for the caching, while the Background preflet extends it in other ways. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29730 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
af20d1a13e
commit
23b0de5eb2
@ -66,108 +66,107 @@ const uint32 kRestoreBackgroundImage = 'Tbgr';
|
||||
const uint32 kChangeBackgroundImage = 'Cbgr';
|
||||
|
||||
class BackgroundImage {
|
||||
// This class knows everything about which bitmap to use for a given
|
||||
// view and how.
|
||||
// Unlike other windows, the Desktop window can have different backgrounds
|
||||
// for each workspace
|
||||
// This class knows everything about which bitmap to use for a given
|
||||
// view and how.
|
||||
// Unlike other windows, the Desktop window can have different backgrounds
|
||||
// for each workspace
|
||||
public:
|
||||
|
||||
enum Mode {
|
||||
kAtOffset,
|
||||
kCentered, // only works on Desktop
|
||||
kScaledToFit, // only works on Desktop
|
||||
kTiled
|
||||
};
|
||||
|
||||
class BackgroundImageInfo {
|
||||
// element of the per-workspace list
|
||||
public:
|
||||
BackgroundImageInfo(uint32 workspace, int32 imageIndex, Mode mode,
|
||||
BPoint offset, bool textWidgetLabelOutline, uint32 imageSet,
|
||||
uint32 cacheMode);
|
||||
~BackgroundImageInfo();
|
||||
|
||||
enum Mode {
|
||||
kAtOffset,
|
||||
kCentered, // only works on Desktop
|
||||
kScaledToFit, // only works on Desktop
|
||||
kTiled
|
||||
};
|
||||
void LoadBitmap();
|
||||
void UnloadBitmap(uint32 globalCacheMode);
|
||||
|
||||
class BackgroundImageInfo {
|
||||
// element of the per-workspace list
|
||||
public:
|
||||
BackgroundImageInfo(uint32 workspace, int32 imageIndex, Mode mode,
|
||||
BPoint offset, bool textWidgetLabelOutline, uint32 imageSet,
|
||||
uint32 cacheMode);
|
||||
~BackgroundImageInfo();
|
||||
uint32 fWorkspace;
|
||||
int32 fImageIndex;
|
||||
Mode fMode;
|
||||
BPoint fOffset;
|
||||
bool fTextWidgetLabelOutline;
|
||||
uint32 fImageSet;
|
||||
uint32 fCacheMode; // image cache strategy (0 cache , 1 no cache)
|
||||
};
|
||||
|
||||
void LoadBitmap();
|
||||
void UnloadBitmap(uint32 globalCacheMode);
|
||||
|
||||
uint32 fWorkspace;
|
||||
int32 fImageIndex;
|
||||
Mode fMode;
|
||||
BPoint fOffset;
|
||||
bool fTextWidgetLabelOutline;
|
||||
uint32 fImageSet;
|
||||
uint32 fCacheMode; // image cache strategy (0 cache , 1 no cache)
|
||||
};
|
||||
|
||||
static BackgroundImage *GetBackgroundImage(const BNode *node,
|
||||
bool isDesktop, BackgroundsView* view);
|
||||
static BackgroundImage *GetBackgroundImage(const BNode *node,
|
||||
bool isDesktop, BackgroundsView* view);
|
||||
// create a BackgroundImage object by reading it from a node
|
||||
|
||||
virtual ~BackgroundImage();
|
||||
virtual ~BackgroundImage();
|
||||
|
||||
void Show(BView *view, int32 workspace);
|
||||
void Show(BView *view, int32 workspace);
|
||||
// display the right background for a given workspace
|
||||
void Remove();
|
||||
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);
|
||||
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);
|
||||
// respond to a background image setting change
|
||||
void ChangeImageSet(BPoseView *poseView);
|
||||
// change to the next imageSet if any, no refresh*/
|
||||
BackgroundImageInfo *ImageInfoForWorkspace(int32) const;
|
||||
/*static BackgroundImage *Refresh(BackgroundImage *oldBackgroundImage,
|
||||
const BNode *fromNode, bool desktop, BPoseView *poseView);
|
||||
// respond to a background image setting change
|
||||
void ChangeImageSet(BPoseView *poseView);
|
||||
// change to the next imageSet if any, no refresh*/
|
||||
BackgroundImageInfo *ImageInfoForWorkspace(int32) const;
|
||||
|
||||
// return fIsDesktop
|
||||
bool IsDesktop() { return fIsDesktop;}
|
||||
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; }
|
||||
uint32 GetShowingImageSet() { return fShowingImageSet; }
|
||||
|
||||
void Add(BackgroundImageInfo *);
|
||||
void Remove(BackgroundImageInfo *);
|
||||
void RemoveAll();
|
||||
void Add(BackgroundImageInfo *);
|
||||
void Remove(BackgroundImageInfo *);
|
||||
void RemoveAll();
|
||||
|
||||
private:
|
||||
BackgroundImage(const BNode *node, bool isDesktop, BackgroundsView* view);
|
||||
private:
|
||||
BackgroundImage(const BNode *node, bool isDesktop, BackgroundsView* view);
|
||||
// no public constructor, GetBackgroundImage factory function is
|
||||
// used instead
|
||||
|
||||
bool fIsDesktop;
|
||||
BNode fDefinedByNode;
|
||||
BView *fView;
|
||||
BackgroundsView* fBackgroundsView;
|
||||
BackgroundImageInfo *fShowingBitmap;
|
||||
bool fIsDesktop;
|
||||
BNode fDefinedByNode;
|
||||
BView *fView;
|
||||
BackgroundsView* fBackgroundsView;
|
||||
BackgroundImageInfo *fShowingBitmap;
|
||||
|
||||
BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList;
|
||||
BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList;
|
||||
|
||||
uint32 fImageSetPeriod; // period between imagesets, 0 if none
|
||||
uint32 fShowingImageSet; // current imageset
|
||||
uint32 fImageSetCount; // imageset count
|
||||
uint32 fCacheMode;// image cache strategy (0 all, 1 none, 2 own strategy)
|
||||
bool fRandomChange; // random or sequential change
|
||||
uint32 fImageSetPeriod; // period between imagesets, 0 if none
|
||||
uint32 fShowingImageSet; // current imageset
|
||||
uint32 fImageSetCount; // imageset count
|
||||
uint32 fCacheMode;// image cache strategy (0 all, 1 none, 2 own strategy)
|
||||
bool fRandomChange; // random or sequential change
|
||||
};
|
||||
|
||||
class Image {
|
||||
// element for each image
|
||||
public:
|
||||
Image(BPath path);
|
||||
~Image();
|
||||
// element for each image
|
||||
public:
|
||||
Image(BPath path);
|
||||
~Image();
|
||||
|
||||
void UnloadBitmap();
|
||||
const char* GetName() {return name.String();}
|
||||
BBitmap* GetBitmap();
|
||||
BPath GetPath() {return fPath;}
|
||||
private:
|
||||
BBitmap *fBitmap;
|
||||
BPath fPath;
|
||||
BString name;
|
||||
void UnloadBitmap();
|
||||
const char* GetName() {return name.String();}
|
||||
BBitmap* GetBitmap();
|
||||
BPath GetPath() {return fPath;}
|
||||
private:
|
||||
BBitmap *fBitmap;
|
||||
BPath fPath;
|
||||
BString name;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user