fixing indenting style issues
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20243 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -69,7 +69,7 @@ const char *kBackgroundImageCacheMode = "be:bgndimgcachemode";
|
|||||||
|
|
||||||
|
|
||||||
BackgroundImage *
|
BackgroundImage *
|
||||||
BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
|
BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
|
||||||
BackgroundsView* view)
|
BackgroundsView* view)
|
||||||
{
|
{
|
||||||
BackgroundImage *result = new BackgroundImage(node, isDesktop, view);
|
BackgroundImage *result = new BackgroundImage(node, isDesktop, view);
|
||||||
@@ -80,7 +80,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
|
|||||||
BMessage container;
|
BMessage container;
|
||||||
char *buffer = new char [info.size];
|
char *buffer = new char [info.size];
|
||||||
|
|
||||||
status_t error = node->ReadAttr(kBackgroundImageInfo, info.type, 0, buffer,
|
status_t error = node->ReadAttr(kBackgroundImageInfo, info.type, 0, buffer,
|
||||||
(size_t)info.size);
|
(size_t)info.size);
|
||||||
if (error == info.size)
|
if (error == info.size)
|
||||||
error = container.Unflatten(buffer);
|
error = container.Unflatten(buffer);
|
||||||
@@ -119,22 +119,22 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
|
|||||||
if (imageIndex < 0)
|
if (imageIndex < 0)
|
||||||
imageIndex = -imageIndex - 1;
|
imageIndex = -imageIndex - 1;
|
||||||
|
|
||||||
container.FindInt32(kBackgroundImageInfoWorkspaces, index,
|
container.FindInt32(kBackgroundImageInfoWorkspaces, index,
|
||||||
(int32 *)&workspaces);
|
(int32 *)&workspaces);
|
||||||
container.FindInt32(kBackgroundImageInfoMode, index, (int32 *)&mode);
|
container.FindInt32(kBackgroundImageInfoMode, index, (int32 *)&mode);
|
||||||
container.FindBool(kBackgroundImageInfoEraseText, index,
|
container.FindBool(kBackgroundImageInfoEraseText, index,
|
||||||
&eraseTextWidgetBackground);
|
&eraseTextWidgetBackground);
|
||||||
container.FindPoint(kBackgroundImageInfoOffset, index, &offset);
|
container.FindPoint(kBackgroundImageInfoOffset, index, &offset);
|
||||||
|
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
container.FindInt32(kBackgroundImageInfoSet, index,
|
container.FindInt32(kBackgroundImageInfoSet, index,
|
||||||
(int32 *)&imageSet);
|
(int32 *)&imageSet);
|
||||||
container.FindInt32(kBackgroundImageInfoCacheMode, index,
|
container.FindInt32(kBackgroundImageInfoCacheMode, index,
|
||||||
(int32 *)&cacheMode);
|
(int32 *)&cacheMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundImage::BackgroundImageInfo *imageInfo = new
|
BackgroundImage::BackgroundImageInfo *imageInfo = new
|
||||||
BackgroundImage::BackgroundImageInfo(workspaces, imageIndex,
|
BackgroundImage::BackgroundImageInfo(workspaces, imageIndex,
|
||||||
mode, offset, eraseTextWidgetBackground, imageSet, cacheMode);
|
mode, offset, eraseTextWidgetBackground, imageSet, cacheMode);
|
||||||
|
|
||||||
//imageInfo->UnloadBitmap(globalCacheMode);
|
//imageInfo->UnloadBitmap(globalCacheMode);
|
||||||
@@ -151,7 +151,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
|
|||||||
result->fImageSetPeriod = imageSetPeriod;
|
result->fImageSetPeriod = imageSetPeriod;
|
||||||
result->fCacheMode = globalCacheMode;
|
result->fCacheMode = globalCacheMode;
|
||||||
if (result->fImageSetCount > 1)
|
if (result->fImageSetCount > 1)
|
||||||
result->fShowingImageSet = random()%result->fImageSetCount;
|
result->fShowingImageSet = random() % result->fImageSetCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -159,7 +159,7 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
|
|||||||
|
|
||||||
|
|
||||||
BackgroundImage::BackgroundImageInfo::BackgroundImageInfo(uint32 workspaces,
|
BackgroundImage::BackgroundImageInfo::BackgroundImageInfo(uint32 workspaces,
|
||||||
int32 imageIndex, Mode mode, BPoint offset, bool eraseTextWidget,
|
int32 imageIndex, Mode mode, BPoint offset, bool eraseTextWidget,
|
||||||
uint32 imageSet, uint32 cacheMode)
|
uint32 imageSet, uint32 cacheMode)
|
||||||
:
|
:
|
||||||
fWorkspace(workspaces),
|
fWorkspace(workspaces),
|
||||||
@@ -203,14 +203,14 @@ BackgroundImage::~BackgroundImage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::Add(BackgroundImageInfo *info)
|
BackgroundImage::Add(BackgroundImageInfo *info)
|
||||||
{
|
{
|
||||||
fBitmapForWorkspaceList.AddItem(info);
|
fBitmapForWorkspaceList.AddItem(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::Remove(BackgroundImageInfo *info)
|
BackgroundImage::Remove(BackgroundImageInfo *info)
|
||||||
{
|
{
|
||||||
fBitmapForWorkspaceList.RemoveItem(info);
|
fBitmapForWorkspaceList.RemoveItem(info);
|
||||||
@@ -230,7 +230,7 @@ BackgroundImage::RemoveAll()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::Show(BView *view, int32 workspace)
|
BackgroundImage::Show(BView *view, int32 workspace)
|
||||||
{
|
{
|
||||||
fView = view;
|
fView = view;
|
||||||
@@ -245,10 +245,10 @@ BackgroundImage::Show(BView *view, int32 workspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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)
|
if (!bitmap)
|
||||||
return;
|
return;
|
||||||
@@ -289,16 +289,16 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
|
|||||||
}
|
}
|
||||||
// else fall thru
|
// else fall thru
|
||||||
case kAtOffset:
|
case kAtOffset:
|
||||||
{
|
{
|
||||||
destinationBitmapBounds.OffsetTo(offset);
|
destinationBitmapBounds.OffsetTo(offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kTiled:
|
case kTiled:
|
||||||
// Original Backgrounds Preferences center the tiled paper but the Tracker don't do that
|
// Original Backgrounds Preferences center the tiled paper but the Tracker don't do that
|
||||||
//if (fIsDesktop) {
|
//if (fIsDesktop) {
|
||||||
destinationBitmapBounds.OffsetBy(
|
destinationBitmapBounds.OffsetBy(
|
||||||
(viewBounds.Width() - destinationBitmapBounds.Width()) / 2,
|
(viewBounds.Width() - destinationBitmapBounds.Width()) / 2,
|
||||||
(viewBounds.Height() - destinationBitmapBounds.Height()) / 2);
|
(viewBounds.Height() - destinationBitmapBounds.Height()) / 2);
|
||||||
//}
|
//}
|
||||||
tile = B_TILE_BITMAP;
|
tile = B_TILE_BITMAP;
|
||||||
break;
|
break;
|
||||||
@@ -317,7 +317,7 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::Remove()
|
BackgroundImage::Remove()
|
||||||
{
|
{
|
||||||
if (fShowingBitmap) {
|
if (fShowingBitmap) {
|
||||||
@@ -359,12 +359,12 @@ BackgroundImage::ImageInfoForWorkspace(int32 workspace) const
|
|||||||
} else
|
} else
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state)
|
BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state)
|
||||||
{
|
{
|
||||||
if (!fIsDesktop) {
|
if (!fIsDesktop) {
|
||||||
@@ -392,7 +392,7 @@ BackgroundImage::WorkspaceActivated(BView *view, int32 workspace, bool state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::ScreenChanged(BRect, color_space)
|
BackgroundImage::ScreenChanged(BRect, color_space)
|
||||||
{
|
{
|
||||||
if (!fIsDesktop || !fShowingBitmap)
|
if (!fIsDesktop || !fShowingBitmap)
|
||||||
@@ -440,7 +440,7 @@ BackgroundImage::SetBackgroundImage(BNode *node)
|
|||||||
PRINT_OBJECT(container);
|
PRINT_OBJECT(container);
|
||||||
|
|
||||||
size_t flattenedSize = container.FlattenedSize();
|
size_t flattenedSize = container.FlattenedSize();
|
||||||
char* buffer = new (std::nothrow) char[flattenedSize];
|
char* buffer = new(std::nothrow) char[flattenedSize];
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ BackgroundImage::Refresh(BackgroundImage *oldBackgroundImage,
|
|||||||
oldBackgroundImage->Remove();
|
oldBackgroundImage->Remove();
|
||||||
delete oldBackgroundImage;
|
delete oldBackgroundImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundImage *result = GetBackgroundImage(fromNode, desktop);
|
BackgroundImage *result = GetBackgroundImage(fromNode, desktop);
|
||||||
if (result && poseView->ViewMode() != kListMode)
|
if (result && poseView->ViewMode() != kListMode)
|
||||||
result->Show(poseView, current_workspace());
|
result->Show(poseView, current_workspace());
|
||||||
@@ -477,7 +477,7 @@ BackgroundImage::Refresh(BackgroundImage *oldBackgroundImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundImage::ChangeImageSet(BPoseView *poseView)
|
BackgroundImage::ChangeImageSet(BPoseView *poseView)
|
||||||
{
|
{
|
||||||
if(fRandomChange) {
|
if(fRandomChange) {
|
||||||
@@ -492,7 +492,7 @@ BackgroundImage::ChangeImageSet(BPoseView *poseView)
|
|||||||
if(fShowingImageSet > fImageSetCount - 1)
|
if(fShowingImageSet > fImageSetCount - 1)
|
||||||
fShowingImageSet = 0;
|
fShowingImageSet = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Show(poseView, current_workspace());
|
this->Show(poseView, current_workspace());
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|||||||
@@ -66,92 +66,92 @@ const uint32 kRestoreBackgroundImage = 'Tbgr';
|
|||||||
const uint32 kChangeBackgroundImage = 'Cbgr';
|
const uint32 kChangeBackgroundImage = 'Cbgr';
|
||||||
|
|
||||||
class BackgroundImage {
|
class BackgroundImage {
|
||||||
// This class knows everything about which bitmap to use for a given
|
// This class knows everything about which bitmap to use for a given
|
||||||
// view and how.
|
// view and how.
|
||||||
// Unlike other windows, the Desktop window can have different backgrounds
|
// Unlike other windows, the Desktop window can have different backgrounds
|
||||||
// for each workspace
|
// 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:
|
public:
|
||||||
BackgroundImageInfo(uint32 workspace, int32 imageIndex, Mode mode,
|
|
||||||
BPoint offset, bool eraseTextWidget, uint32 imageSet,
|
|
||||||
uint32 cacheMode);
|
|
||||||
~BackgroundImageInfo();
|
|
||||||
|
|
||||||
void LoadBitmap();
|
|
||||||
void UnloadBitmap(uint32 globalCacheMode);
|
|
||||||
|
|
||||||
uint32 fWorkspace;
|
enum Mode {
|
||||||
int32 fImageIndex;
|
kAtOffset,
|
||||||
Mode fMode;
|
kCentered, // only works on Desktop
|
||||||
BPoint fOffset;
|
kScaledToFit, // only works on Desktop
|
||||||
bool fEraseTextWidgetBackground;
|
kTiled
|
||||||
uint32 fImageSet;
|
};
|
||||||
uint32 fCacheMode; // image cache strategy (0 cache , 1 no cache)
|
|
||||||
};
|
class BackgroundImageInfo {
|
||||||
|
// element of the per-workspace list
|
||||||
static BackgroundImage *GetBackgroundImage(const BNode *node,
|
public:
|
||||||
bool isDesktop, BackgroundsView* view);
|
BackgroundImageInfo(uint32 workspace, int32 imageIndex, Mode mode,
|
||||||
|
BPoint offset, bool eraseTextWidget, uint32 imageSet,
|
||||||
|
uint32 cacheMode);
|
||||||
|
~BackgroundImageInfo();
|
||||||
|
|
||||||
|
void LoadBitmap();
|
||||||
|
void UnloadBitmap(uint32 globalCacheMode);
|
||||||
|
|
||||||
|
uint32 fWorkspace;
|
||||||
|
int32 fImageIndex;
|
||||||
|
Mode fMode;
|
||||||
|
BPoint fOffset;
|
||||||
|
bool fEraseTextWidgetBackground;
|
||||||
|
uint32 fImageSet;
|
||||||
|
uint32 fCacheMode; // image cache strategy (0 cache , 1 no cache)
|
||||||
|
};
|
||||||
|
|
||||||
|
static BackgroundImage *GetBackgroundImage(const BNode *node,
|
||||||
|
bool isDesktop, BackgroundsView* view);
|
||||||
// create a BackgroundImage object by reading it from a node
|
// 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
|
// display the right background for a given workspace
|
||||||
void Remove();
|
void Remove();
|
||||||
// remove the background from it's current view
|
// 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
|
// 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
|
// respond to a screen size change
|
||||||
/*static BackgroundImage *Refresh(BackgroundImage *oldBackgroundImage,
|
/*static BackgroundImage *Refresh(BackgroundImage *oldBackgroundImage,
|
||||||
const BNode *fromNode, bool desktop, BPoseView *poseView);
|
const BNode *fromNode, bool desktop, BPoseView *poseView);
|
||||||
// respond to a background image setting change
|
// respond to a background image setting change
|
||||||
void ChangeImageSet(BPoseView *poseView);
|
void ChangeImageSet(BPoseView *poseView);
|
||||||
// change to the next imageSet if any, no refresh*/
|
// change to the next imageSet if any, no refresh*/
|
||||||
BackgroundImageInfo *ImageInfoForWorkspace(int32) const;
|
BackgroundImageInfo *ImageInfoForWorkspace(int32) const;
|
||||||
|
|
||||||
// return fIsDesktop
|
|
||||||
bool IsDesktop() { return fIsDesktop;}
|
|
||||||
|
|
||||||
status_t SetBackgroundImage(BNode *node);
|
|
||||||
|
|
||||||
void Show(BackgroundImageInfo *, BView *view);
|
|
||||||
|
|
||||||
uint32 GetShowingImageSet() { return fShowingImageSet; }
|
|
||||||
|
|
||||||
void Add(BackgroundImageInfo *);
|
|
||||||
void Remove(BackgroundImageInfo *);
|
|
||||||
void RemoveAll();
|
|
||||||
|
|
||||||
private:
|
// return fIsDesktop
|
||||||
BackgroundImage(const BNode *node, bool isDesktop, BackgroundsView* view);
|
bool IsDesktop() { return fIsDesktop;}
|
||||||
|
|
||||||
|
status_t SetBackgroundImage(BNode *node);
|
||||||
|
|
||||||
|
void Show(BackgroundImageInfo *, BView *view);
|
||||||
|
|
||||||
|
uint32 GetShowingImageSet() { return fShowingImageSet; }
|
||||||
|
|
||||||
|
void Add(BackgroundImageInfo *);
|
||||||
|
void Remove(BackgroundImageInfo *);
|
||||||
|
void RemoveAll();
|
||||||
|
|
||||||
|
private:
|
||||||
|
BackgroundImage(const BNode *node, bool isDesktop, BackgroundsView* view);
|
||||||
// no public constructor, GetBackgroundImage factory function is
|
// no public constructor, GetBackgroundImage factory function is
|
||||||
// used instead
|
// used instead
|
||||||
|
|
||||||
bool fIsDesktop;
|
bool fIsDesktop;
|
||||||
BNode fDefinedByNode;
|
BNode fDefinedByNode;
|
||||||
BView *fView;
|
BView *fView;
|
||||||
BackgroundsView* fBackgroundsView;
|
BackgroundsView* fBackgroundsView;
|
||||||
BackgroundImageInfo *fShowingBitmap;
|
BackgroundImageInfo *fShowingBitmap;
|
||||||
|
|
||||||
BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList;
|
BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList;
|
||||||
|
|
||||||
uint32 fImageSetPeriod; // period between imagesets, 0 if none
|
uint32 fImageSetPeriod; // period between imagesets, 0 if none
|
||||||
uint32 fShowingImageSet; // current imageset
|
uint32 fShowingImageSet; // current imageset
|
||||||
uint32 fImageSetCount; // imageset count
|
uint32 fImageSetCount; // imageset count
|
||||||
uint32 fCacheMode;// image cache strategy (0 all, 1 none, 2 own strategy)
|
uint32 fCacheMode;// image cache strategy (0 all, 1 none, 2 own strategy)
|
||||||
bool fRandomChange; // random or sequential change
|
bool fRandomChange; // random or sequential change
|
||||||
};
|
};
|
||||||
|
|
||||||
class Image {
|
class Image {
|
||||||
@@ -159,7 +159,7 @@ class Image {
|
|||||||
public:
|
public:
|
||||||
Image(BPath path);
|
Image(BPath path);
|
||||||
~Image();
|
~Image();
|
||||||
|
|
||||||
void UnloadBitmap();
|
void UnloadBitmap();
|
||||||
const char* GetName() {return name.String();}
|
const char* GetName() {return name.String();}
|
||||||
BBitmap* GetBitmap();
|
BBitmap* GetBitmap();
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ BackgroundsApplication::BackgroundsApplication()
|
|||||||
|
|
||||||
|
|
||||||
BackgroundsWindow::BackgroundsWindow(BRect frame, bool standalone)
|
BackgroundsWindow::BackgroundsWindow(BRect frame, bool standalone)
|
||||||
: BWindow(frame, "Backgrounds", B_TITLED_WINDOW,
|
: BWindow(frame, "Backgrounds", B_TITLED_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES),
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES),
|
||||||
fIsStandalone(standalone)
|
fIsStandalone(standalone)
|
||||||
{
|
{
|
||||||
fBackgroundsView = new BackgroundsView(Bounds(), "BackgroundsView",
|
fBackgroundsView = new BackgroundsView(Bounds(), "BackgroundsView",
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW);
|
B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
@@ -87,7 +87,7 @@ BackgroundsWindow::WorkspaceActivated(int32 oldWorkspaces, bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsWindow::ProcessRefs(entry_ref dir, BMessage* refs)
|
BackgroundsWindow::ProcessRefs(entry_ref dir, BMessage* refs)
|
||||||
{
|
{
|
||||||
fBackgroundsView->ProcessRefs(dir, refs);
|
fBackgroundsView->ProcessRefs(dir, refs);
|
||||||
|
|||||||
@@ -51,44 +51,44 @@ static const uint32 kMsgUpdatePreviewPlacement = 'pvpl';
|
|||||||
const uint8 kHandCursorData[68] = {
|
const uint8 kHandCursorData[68] = {
|
||||||
16, 1, 2, 2,
|
16, 1, 2, 2,
|
||||||
|
|
||||||
0,0, // 0000000000000000
|
0, 0, // 0000000000000000
|
||||||
7,128, // 0000011110000000
|
7, 128, // 0000011110000000
|
||||||
61,112, // 0011110101110000
|
61, 112, // 0011110101110000
|
||||||
37,40, // 0010010100101000
|
37, 40, // 0010010100101000
|
||||||
36,168, // 0010010010101000
|
36, 168, // 0010010010101000
|
||||||
18,148, // 0001001010010100
|
18, 148, // 0001001010010100
|
||||||
18,84, // 0001001001010100
|
18, 84, // 0001001001010100
|
||||||
9,42, // 0000100100101010
|
9, 42, // 0000100100101010
|
||||||
8,1, // 0000100000000001
|
8, 1, // 0000100000000001
|
||||||
60,1, // 0011110000000001
|
60, 1, // 0011110000000001
|
||||||
76,1, // 0100110000000001
|
76, 1, // 0100110000000001
|
||||||
66,1, // 0100001000000001
|
66, 1, // 0100001000000001
|
||||||
48,1, // 0011000000000001
|
48, 1, // 0011000000000001
|
||||||
12,1, // 0000110000000001
|
12, 1, // 0000110000000001
|
||||||
2,0, // 0000001000000000
|
2, 0, // 0000001000000000
|
||||||
1,0, // 0000000100000000
|
1, 0, // 0000000100000000
|
||||||
|
|
||||||
0,0, // 0000000000000000
|
0, 0, // 0000000000000000
|
||||||
7,128, // 0000011110000000
|
7, 128, // 0000011110000000
|
||||||
63,240, // 0011111111110000
|
63, 240, // 0011111111110000
|
||||||
63,248, // 0011111111111000
|
63, 248, // 0011111111111000
|
||||||
63,248, // 0011111111111000
|
63, 248, // 0011111111111000
|
||||||
31,252, // 0001111111111100
|
31, 252, // 0001111111111100
|
||||||
31,252, // 0001111111111100
|
31, 252, // 0001111111111100
|
||||||
15,254, // 0000111111111110
|
15, 254, // 0000111111111110
|
||||||
15,255, // 0000111111111111
|
15, 255, // 0000111111111111
|
||||||
63,255, // 0011111111111111
|
63, 255, // 0011111111111111
|
||||||
127,255, // 0111111111111111
|
127, 255, // 0111111111111111
|
||||||
127,255, // 0111111111111111
|
127, 255, // 0111111111111111
|
||||||
63,255, // 0011111111111111
|
63, 255, // 0011111111111111
|
||||||
15,255, // 0000111111111111
|
15, 255, // 0000111111111111
|
||||||
3,254, // 0000001111111110
|
3, 254, // 0000001111111110
|
||||||
1,248 // 0000000111111000
|
1, 248 // 0000000111111000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
||||||
int32 flags)
|
int32 flags)
|
||||||
: BBox(frame, name, resize, flags | B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER),
|
: BBox(frame, name, resize, flags | B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER),
|
||||||
fCurrent(NULL),
|
fCurrent(NULL),
|
||||||
fCurrentInfo(NULL),
|
fCurrentInfo(NULL),
|
||||||
@@ -100,16 +100,16 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
|
|
||||||
BMenuItem *menuItem;
|
BMenuItem *menuItem;
|
||||||
fWorkspaceMenu = new BPopUpMenu("pick one");
|
fWorkspaceMenu = new BPopUpMenu("pick one");
|
||||||
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("All Workspaces",
|
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("All Workspaces",
|
||||||
new BMessage(kMsgAllWorkspaces)));
|
new BMessage(kMsgAllWorkspaces)));
|
||||||
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("Current Workspace",
|
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("Current Workspace",
|
||||||
new BMessage(kMsgCurrentWorkspace)));
|
new BMessage(kMsgCurrentWorkspace)));
|
||||||
menuItem->SetMarked(true);
|
menuItem->SetMarked(true);
|
||||||
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(fWorkspaceMenu->FindMarked());
|
fLastWorkspaceIndex = fWorkspaceMenu->IndexOf(fWorkspaceMenu->FindMarked());
|
||||||
fWorkspaceMenu->AddSeparatorItem();
|
fWorkspaceMenu->AddSeparatorItem();
|
||||||
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("Default folder",
|
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("Default folder",
|
||||||
new BMessage(kMsgDefaultFolder)));
|
new BMessage(kMsgDefaultFolder)));
|
||||||
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("Other folder" B_UTF8_ELLIPSIS,
|
fWorkspaceMenu->AddItem(menuItem = new BMenuItem("Other folder" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(kMsgOtherFolder)));
|
new BMessage(kMsgOtherFolder)));
|
||||||
|
|
||||||
BMenuField *workspaceMenuField = new BMenuField(BRect(0, 0, 130, 18),
|
BMenuField *workspaceMenuField = new BMenuField(BRect(0, 0, 130, 18),
|
||||||
@@ -129,7 +129,7 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
AddChild(fPreview);
|
AddChild(fPreview);
|
||||||
|
|
||||||
BRect rect(10, fPreview->Bounds().bottom - 30, 70, fPreview->Bounds().bottom - 10);
|
BRect rect(10, fPreview->Bounds().bottom - 30, 70, fPreview->Bounds().bottom - 10);
|
||||||
fXPlacementText = new BTextControl(rect, "xPlacementText", "X:", NULL,
|
fXPlacementText = new BTextControl(rect, "xPlacementText", "X:", NULL,
|
||||||
new BMessage(kMsgImagePlacement), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
new BMessage(kMsgImagePlacement), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
fXPlacementText->SetDivider(fXPlacementText->StringWidth(fXPlacementText->Label()) + 4.0f);
|
fXPlacementText->SetDivider(fXPlacementText->StringWidth(fXPlacementText->Label()) + 4.0f);
|
||||||
fXPlacementText->TextView()->SetMaxBytes(5);
|
fXPlacementText->TextView()->SetMaxBytes(5);
|
||||||
@@ -141,7 +141,7 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
fPreview->AddChild(fXPlacementText);
|
fPreview->AddChild(fXPlacementText);
|
||||||
|
|
||||||
rect.OffsetBy(70, delta);
|
rect.OffsetBy(70, delta);
|
||||||
fYPlacementText = new BTextControl(rect, "yPlacementText", "Y:", NULL,
|
fYPlacementText = new BTextControl(rect, "yPlacementText", "Y:", NULL,
|
||||||
new BMessage(kMsgImagePlacement), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
new BMessage(kMsgImagePlacement), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
fYPlacementText->SetDivider(fYPlacementText->StringWidth(fYPlacementText->Label()) + 4.0f);
|
fYPlacementText->SetDivider(fYPlacementText->StringWidth(fYPlacementText->Label()) + 4.0f);
|
||||||
fYPlacementText->TextView()->SetMaxBytes(5);
|
fYPlacementText->TextView()->SetMaxBytes(5);
|
||||||
@@ -155,7 +155,7 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fPreView = new PreView(BRect(15, 25, 135, 115), "preView",
|
fPreView = new PreView(BRect(15, 25, 135, 115), "preView",
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_SUBPIXEL_PRECISE);
|
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_SUBPIXEL_PRECISE);
|
||||||
fPreview->AddChild(fPreView);
|
fPreview->AddChild(fPreView);
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
fImageMenu->AddSeparatorItem();
|
fImageMenu->AddSeparatorItem();
|
||||||
fImageMenu->AddItem(new BMenuItem("Other" B_UTF8_ELLIPSIS, new BMessage(kMsgOtherImage)));
|
fImageMenu->AddItem(new BMenuItem("Other" B_UTF8_ELLIPSIS, new BMessage(kMsgOtherImage)));
|
||||||
|
|
||||||
BMenuField *imageMenuField = new BMenuField(rect, "imageMenuField",
|
BMenuField *imageMenuField = new BMenuField(rect, "imageMenuField",
|
||||||
"Image:", fImageMenu);
|
"Image:", fImageMenu);
|
||||||
imageMenuField->SetDivider(offset);
|
imageMenuField->SetDivider(offset);
|
||||||
imageMenuField->SetAlignment(B_ALIGN_RIGHT);
|
imageMenuField->SetAlignment(B_ALIGN_RIGHT);
|
||||||
@@ -189,13 +189,13 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
rightbox->AddChild(imageMenuField);
|
rightbox->AddChild(imageMenuField);
|
||||||
|
|
||||||
fPlacementMenu = new BPopUpMenu("pick one");
|
fPlacementMenu = new BPopUpMenu("pick one");
|
||||||
fPlacementMenu->AddItem(new BMenuItem("Manual",
|
fPlacementMenu->AddItem(new BMenuItem("Manual",
|
||||||
new BMessage(kMsgManualPlacement)));
|
new BMessage(kMsgManualPlacement)));
|
||||||
fPlacementMenu->AddItem(new BMenuItem("Center",
|
fPlacementMenu->AddItem(new BMenuItem("Center",
|
||||||
new BMessage(kMsgCenterPlacement)));
|
new BMessage(kMsgCenterPlacement)));
|
||||||
fPlacementMenu->AddItem(new BMenuItem("Scale to fit",
|
fPlacementMenu->AddItem(new BMenuItem("Scale to fit",
|
||||||
new BMessage(kMsgScalePlacement)));
|
new BMessage(kMsgScalePlacement)));
|
||||||
fPlacementMenu->AddItem(new BMenuItem("Tile",
|
fPlacementMenu->AddItem(new BMenuItem("Tile",
|
||||||
new BMessage(kMsgTilePlacement)));
|
new BMessage(kMsgTilePlacement)));
|
||||||
|
|
||||||
rect.OffsetBy(0, imageMenuField->Bounds().Height() + 5);
|
rect.OffsetBy(0, imageMenuField->Bounds().Height() + 5);
|
||||||
@@ -207,14 +207,14 @@ BackgroundsView::BackgroundsView(BRect frame, const char *name, int32 resize,
|
|||||||
rightbox->AddChild(placementMenuField);
|
rightbox->AddChild(placementMenuField);
|
||||||
|
|
||||||
rect.OffsetBy(offset, placementMenuField->Bounds().Height() + 5);
|
rect.OffsetBy(offset, placementMenuField->Bounds().Height() + 5);
|
||||||
fIconLabelBackground = new BCheckBox(rect, "iconLabelBackground",
|
fIconLabelBackground = new BCheckBox(rect, "iconLabelBackground",
|
||||||
"Icon label background", new BMessage(kMsgIconLabelBackground));
|
"Icon label background", new BMessage(kMsgIconLabelBackground));
|
||||||
fIconLabelBackground->SetValue(B_CONTROL_ON);
|
fIconLabelBackground->SetValue(B_CONTROL_ON);
|
||||||
fIconLabelBackground->ResizeToPreferred();
|
fIconLabelBackground->ResizeToPreferred();
|
||||||
rightbox->AddChild(fIconLabelBackground);
|
rightbox->AddChild(fIconLabelBackground);
|
||||||
|
|
||||||
rect.top += fIconLabelBackground->Bounds().Height() + 15;
|
rect.top += fIconLabelBackground->Bounds().Height() + 15;
|
||||||
fPicker = new BColorControl(BPoint(10, rect.top), B_CELLS_32x8, 5.0, "Picker",
|
fPicker = new BColorControl(BPoint(10, rect.top), B_CELLS_32x8, 5.0, "Picker",
|
||||||
new BMessage(kMsgUpdateColor));
|
new BMessage(kMsgUpdateColor));
|
||||||
rightbox->AddChild(fPicker);
|
rightbox->AddChild(fPicker);
|
||||||
|
|
||||||
@@ -278,11 +278,11 @@ BackgroundsView::AllAttached()
|
|||||||
fApply->SetTarget(this);
|
fApply->SetTarget(this);
|
||||||
fRevert->SetTarget(this);
|
fRevert->SetTarget(this);
|
||||||
|
|
||||||
fPanel = new ImageFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
|
fPanel = new ImageFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
|
||||||
B_FILE_NODE, false, NULL, new CustomRefFilter(true));
|
B_FILE_NODE, false, NULL, new CustomRefFilter(true));
|
||||||
fPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
fPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
|
|
||||||
fFolderPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
|
fFolderPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL,
|
||||||
B_DIRECTORY_NODE, false, NULL, new CustomRefFilter(false));
|
B_DIRECTORY_NODE, false, NULL, new CustomRefFilter(false));
|
||||||
fFolderPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
fFolderPanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ BackgroundsView::MessageReceived(BMessage *msg)
|
|||||||
if (pointer == fPanel) {
|
if (pointer == fPanel) {
|
||||||
if (fLastImageIndex >= 0)
|
if (fLastImageIndex >= 0)
|
||||||
FindImageItem(fLastImageIndex)->SetMarked(true);
|
FindImageItem(fLastImageIndex)->SetMarked(true);
|
||||||
else
|
else
|
||||||
fImageMenu->ItemAt(0)->SetMarked(true);
|
fImageMenu->ItemAt(0)->SetMarked(true);
|
||||||
} else if (pointer == fFolderPanel) {
|
} else if (pointer == fFolderPanel) {
|
||||||
if (fLastWorkspaceIndex >= 0)
|
if (fLastWorkspaceIndex >= 0)
|
||||||
@@ -524,10 +524,10 @@ BackgroundsView::UpdateWithCurrent(void)
|
|||||||
cmd = kMsgManualPlacement;
|
cmd = kMsgManualPlacement;
|
||||||
xtext << (int)fCurrentInfo->fOffset.x;
|
xtext << (int)fCurrentInfo->fOffset.x;
|
||||||
ytext << (int)fCurrentInfo->fOffset.y;
|
ytext << (int)fCurrentInfo->fOffset.y;
|
||||||
break;
|
break;
|
||||||
case BackgroundImage::kTiled:
|
case BackgroundImage::kTiled:
|
||||||
cmd = kMsgTilePlacement;
|
cmd = kMsgTilePlacement;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd != 0)
|
if (cmd != 0)
|
||||||
@@ -557,14 +557,14 @@ BackgroundsView::UpdateWithCurrent(void)
|
|||||||
void
|
void
|
||||||
BackgroundsView::Save()
|
BackgroundsView::Save()
|
||||||
{
|
{
|
||||||
bool eraseTextWidgetBackground =
|
bool eraseTextWidgetBackground =
|
||||||
fIconLabelBackground->Value() == B_CONTROL_ON;
|
fIconLabelBackground->Value() == B_CONTROL_ON;
|
||||||
BackgroundImage::Mode mode = FindPlacementMode();
|
BackgroundImage::Mode mode = FindPlacementMode();
|
||||||
BPoint offset(atoi(fXPlacementText->Text()), atoi(fYPlacementText->Text()));
|
BPoint offset(atoi(fXPlacementText->Text()), atoi(fYPlacementText->Text()));
|
||||||
|
|
||||||
if (!fCurrent->IsDesktop()) {
|
if (!fCurrent->IsDesktop()) {
|
||||||
if (fCurrentInfo == NULL) {
|
if (fCurrentInfo == NULL) {
|
||||||
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(B_ALL_WORKSPACES,
|
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(B_ALL_WORKSPACES,
|
||||||
fLastImageIndex, mode, offset, eraseTextWidgetBackground, 0, 0);
|
fLastImageIndex, mode, offset, eraseTextWidgetBackground, 0, 0);
|
||||||
fCurrent->Add(fCurrentInfo);
|
fCurrent->Add(fCurrentInfo);
|
||||||
} else {
|
} else {
|
||||||
@@ -583,12 +583,12 @@ BackgroundsView::Save()
|
|||||||
if (fCurrentInfo != NULL) {
|
if (fCurrentInfo != NULL) {
|
||||||
if (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
|
if (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
|
||||||
if (fCurrentInfo->fWorkspace != workspaceMask) {
|
if (fCurrentInfo->fWorkspace != workspaceMask) {
|
||||||
fCurrentInfo->fWorkspace = fCurrentInfo->fWorkspace
|
fCurrentInfo->fWorkspace = fCurrentInfo->fWorkspace
|
||||||
^ workspaceMask;
|
^ workspaceMask;
|
||||||
if (fLastImageIndex > -1) {
|
if (fLastImageIndex > -1) {
|
||||||
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
||||||
workspaceMask, fLastImageIndex, mode, offset,
|
workspaceMask, fLastImageIndex, mode, offset,
|
||||||
eraseTextWidgetBackground, fCurrentInfo->fImageSet,
|
eraseTextWidgetBackground, fCurrentInfo->fImageSet,
|
||||||
fCurrentInfo->fCacheMode);
|
fCurrentInfo->fCacheMode);
|
||||||
fCurrent->Add(fCurrentInfo);
|
fCurrent->Add(fCurrentInfo);
|
||||||
}
|
}
|
||||||
@@ -599,7 +599,7 @@ BackgroundsView::Save()
|
|||||||
fCurrentInfo->fMode = mode;
|
fCurrentInfo->fMode = mode;
|
||||||
if (fCurrentInfo->fMode == BackgroundImage::kAtOffset)
|
if (fCurrentInfo->fMode == BackgroundImage::kAtOffset)
|
||||||
fCurrentInfo->fOffset = offset;
|
fCurrentInfo->fOffset = offset;
|
||||||
|
|
||||||
fCurrentInfo->fImageIndex = fLastImageIndex;
|
fCurrentInfo->fImageIndex = fLastImageIndex;
|
||||||
} else {
|
} else {
|
||||||
fCurrent->Remove(fCurrentInfo);
|
fCurrent->Remove(fCurrentInfo);
|
||||||
@@ -609,7 +609,7 @@ BackgroundsView::Save()
|
|||||||
} else if (fLastImageIndex > -1) {
|
} else if (fLastImageIndex > -1) {
|
||||||
fCurrent->RemoveAll();
|
fCurrent->RemoveAll();
|
||||||
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
||||||
B_ALL_WORKSPACES, fLastImageIndex, mode, offset,
|
B_ALL_WORKSPACES, fLastImageIndex, mode, offset,
|
||||||
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(),
|
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(),
|
||||||
fCurrentInfo->fCacheMode);
|
fCurrentInfo->fCacheMode);
|
||||||
fCurrent->Add(fCurrentInfo);
|
fCurrent->Add(fCurrentInfo);
|
||||||
@@ -617,12 +617,12 @@ BackgroundsView::Save()
|
|||||||
} else if (fLastImageIndex > -1) {
|
} else if (fLastImageIndex > -1) {
|
||||||
if (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
|
if (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
|
||||||
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
||||||
workspaceMask, fLastImageIndex, mode, offset,
|
workspaceMask, fLastImageIndex, mode, offset,
|
||||||
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(), 0);
|
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(), 0);
|
||||||
} else {
|
} else {
|
||||||
fCurrent->RemoveAll();
|
fCurrent->RemoveAll();
|
||||||
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
fCurrentInfo = new BackgroundImage::BackgroundImageInfo(
|
||||||
B_ALL_WORKSPACES, fLastImageIndex, mode, offset,
|
B_ALL_WORKSPACES, fLastImageIndex, mode, offset,
|
||||||
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(), 0);
|
eraseTextWidgetBackground, fCurrent->GetShowingImageSet(), 0);
|
||||||
}
|
}
|
||||||
fCurrent->Add(fCurrentInfo);
|
fCurrent->Add(fCurrentInfo);
|
||||||
@@ -630,7 +630,7 @@ BackgroundsView::Save()
|
|||||||
|
|
||||||
if (!fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
|
if (!fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()) {
|
||||||
for (int32 i = 0; i < count_workspaces(); i++) {
|
for (int32 i = 0; i < count_workspaces(); i++) {
|
||||||
BScreen().SetDesktopColor(fPicker->ValueAsColor(), i, true);
|
BScreen().SetDesktopColor(fPicker->ValueAsColor(), i, true);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
BScreen().SetDesktopColor(fPicker->ValueAsColor(), true);
|
BScreen().SetDesktopColor(fPicker->ValueAsColor(), true);
|
||||||
@@ -655,13 +655,13 @@ BackgroundsView::NotifyServer()
|
|||||||
tracker.SendMessage(new BMessage(B_RESTORE_BACKGROUND_IMAGE));
|
tracker.SendMessage(new BMessage(B_RESTORE_BACKGROUND_IMAGE));
|
||||||
} else {
|
} else {
|
||||||
int32 i = -1;
|
int32 i = -1;
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
int32 err;
|
int32 err;
|
||||||
BEntry currentEntry(&fCurrentRef);
|
BEntry currentEntry(&fCurrentRef);
|
||||||
BPath currentPath(¤tEntry);
|
BPath currentPath(¤tEntry);
|
||||||
bool isCustomFolder = !fWorkspaceMenu->FindItem(kMsgDefaultFolder)->IsMarked();
|
bool isCustomFolder = !fWorkspaceMenu->FindItem(kMsgDefaultFolder)->IsMarked();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
BMessage msg(B_GET_PROPERTY);
|
BMessage msg(B_GET_PROPERTY);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
@@ -692,7 +692,7 @@ BackgroundsView::NotifyServer()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (isCustomFolder) {
|
if (isCustomFolder) {
|
||||||
// found a window with poses, ask for its path
|
// found a window with poses, ask for its path
|
||||||
msg.MakeEmpty();
|
msg.MakeEmpty();
|
||||||
msg.what = B_GET_PROPERTY;
|
msg.what = B_GET_PROPERTY;
|
||||||
msg.AddSpecifier("Path");
|
msg.AddSpecifier("Path");
|
||||||
@@ -702,7 +702,7 @@ BackgroundsView::NotifyServer()
|
|||||||
reply.MakeEmpty();
|
reply.MakeEmpty();
|
||||||
tracker.SendMessage(&msg, &reply);
|
tracker.SendMessage(&msg, &reply);
|
||||||
|
|
||||||
// go on with the next if this din't have a path
|
// go on with the next if this din't have a path
|
||||||
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD)
|
if (reply.what == B_MESSAGE_NOT_UNDERSTOOD)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -742,13 +742,13 @@ BackgroundsView::SaveSettings(void)
|
|||||||
BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
BFile file(path.Path(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
|
|
||||||
BPoint point = Window()->Frame().LeftTop();
|
BPoint point = Window()->Frame().LeftTop();
|
||||||
if (fSettings.ReplacePoint("pos", point)!=B_OK)
|
if (fSettings.ReplacePoint("pos", point) != B_OK)
|
||||||
fSettings.AddPoint("pos", point);
|
fSettings.AddPoint("pos", point);
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
BPath path;
|
BPath path;
|
||||||
|
|
||||||
fPanel->GetPanelDirectory(&ref);
|
fPanel->GetPanelDirectory(&ref);
|
||||||
entry.SetTo(&ref);
|
entry.SetTo(&ref);
|
||||||
entry.GetPath(&path);
|
entry.GetPath(&path);
|
||||||
@@ -803,7 +803,7 @@ BackgroundsView::LoadSettings()
|
|||||||
if (fSettings.FindString("folderpaneldir", &string) == B_OK)
|
if (fSettings.FindString("folderpaneldir", &string) == B_OK)
|
||||||
fFolderPanel->SetPanelDirectory(string.String());
|
fFolderPanel->SetPanelDirectory(string.String());
|
||||||
|
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
while (fSettings.FindString("recentfolder", index, &string) == B_OK) {
|
while (fSettings.FindString("recentfolder", index, &string) == B_OK) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
fWorkspaceMenu->AddSeparatorItem();
|
fWorkspaceMenu->AddSeparatorItem();
|
||||||
@@ -812,9 +812,9 @@ BackgroundsView::LoadSettings()
|
|||||||
int32 i = AddPath(path);
|
int32 i = AddPath(path);
|
||||||
BString s;
|
BString s;
|
||||||
s << "Folder: " << path.Leaf();
|
s << "Folder: " << path.Leaf();
|
||||||
BMenuItem *item = new BMenuItem(s.String(),
|
BMenuItem *item = new BMenuItem(s.String(),
|
||||||
new BMessage(kMsgFolderSelected));
|
new BMessage(kMsgFolderSelected));
|
||||||
fWorkspaceMenu->AddItem(item, -i-1+6);
|
fWorkspaceMenu->AddItem(item, -i - 1 + 6);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
fWorkspaceMenu->SetTargetForItems(this);
|
fWorkspaceMenu->SetTargetForItems(this);
|
||||||
@@ -866,10 +866,10 @@ BackgroundsView::UpdatePreview()
|
|||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
BBitmap *bitmap = GetImage(index)->GetBitmap();
|
BBitmap *bitmap = GetImage(index)->GetBitmap();
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
BackgroundImage::BackgroundImageInfo *info =
|
BackgroundImage::BackgroundImageInfo *info =
|
||||||
new BackgroundImage::BackgroundImageInfo(0, index,
|
new BackgroundImage::BackgroundImageInfo(0, index,
|
||||||
FindPlacementMode(), BPoint(atoi(fXPlacementText->Text()),
|
FindPlacementMode(), BPoint(atoi(fXPlacementText->Text()),
|
||||||
atoi(fYPlacementText->Text())),
|
atoi(fYPlacementText->Text())),
|
||||||
fIconLabelBackground->Value() == B_CONTROL_ON, 0, 0);
|
fIconLabelBackground->Value() == B_CONTROL_ON, 0, 0);
|
||||||
if (info->fMode == BackgroundImage::kAtOffset) {
|
if (info->fMode == BackgroundImage::kAtOffset) {
|
||||||
fPreView->SetEnabled(true);
|
fPreView->SetEnabled(true);
|
||||||
@@ -891,7 +891,7 @@ BackgroundsView::UpdatePreview()
|
|||||||
|
|
||||||
BackgroundImage::Mode
|
BackgroundImage::Mode
|
||||||
BackgroundsView::FindPlacementMode()
|
BackgroundsView::FindPlacementMode()
|
||||||
{
|
{
|
||||||
BackgroundImage::Mode mode = BackgroundImage::kAtOffset;
|
BackgroundImage::Mode mode = BackgroundImage::kAtOffset;
|
||||||
|
|
||||||
if (fPlacementMenu->FindItem(kMsgCenterPlacement)->IsMarked())
|
if (fPlacementMenu->FindItem(kMsgCenterPlacement)->IsMarked())
|
||||||
@@ -910,7 +910,7 @@ BackgroundsView::FindPlacementMode()
|
|||||||
#ifndef __HAIKU__
|
#ifndef __HAIKU__
|
||||||
inline bool operator!=(const rgb_color& x, const rgb_color& y)
|
inline bool operator!=(const rgb_color& x, const rgb_color& y)
|
||||||
{
|
{
|
||||||
return (x.red!=y.red || x.blue!=y.blue || x.green!=y.green);
|
return (x.red != y.red || x.blue != y.blue || x.green != y.green);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -923,14 +923,14 @@ BackgroundsView::UpdateButtons()
|
|||||||
&& fPicker->ValueAsColor() != BScreen().DesktopColor()) {
|
&& fPicker->ValueAsColor() != BScreen().DesktopColor()) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (fCurrentInfo) {
|
} else if (fCurrentInfo) {
|
||||||
if ((fIconLabelBackground->Value() == B_CONTROL_ON) ^
|
if ((fIconLabelBackground->Value() == B_CONTROL_ON) ^
|
||||||
fCurrentInfo->fEraseTextWidgetBackground) {
|
fCurrentInfo->fEraseTextWidgetBackground) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (FindPlacementMode() != fCurrentInfo->fMode) {
|
} else if (FindPlacementMode() != fCurrentInfo->fMode) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (fCurrentInfo->fImageIndex !=
|
} else if (fCurrentInfo->fImageIndex !=
|
||||||
((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex()) {
|
((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex()) {
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (fCurrent->IsDesktop()
|
} else if (fCurrent->IsDesktop()
|
||||||
&& ((fCurrentInfo->fWorkspace != B_ALL_WORKSPACES)
|
&& ((fCurrentInfo->fWorkspace != B_ALL_WORKSPACES)
|
||||||
^ (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()))) {
|
^ (fWorkspaceMenu->FindItem(kMsgCurrentWorkspace)->IsMarked()))) {
|
||||||
@@ -956,7 +956,7 @@ BackgroundsView::UpdateButtons()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackgroundsView::RefsReceived(BMessage *msg)
|
BackgroundsView::RefsReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -964,7 +964,7 @@ BackgroundsView::RefsReceived(BMessage *msg)
|
|||||||
BMimeType imageType("image");
|
BMimeType imageType("image");
|
||||||
BPath desktopPath;
|
BPath desktopPath;
|
||||||
find_directory(B_DESKTOP_DIRECTORY, &desktopPath);
|
find_directory(B_DESKTOP_DIRECTORY, &desktopPath);
|
||||||
|
|
||||||
while (msg->FindRef("refs", i++, &ref) == B_OK) {
|
while (msg->FindRef("refs", i++, &ref) == B_OK) {
|
||||||
BPath path;
|
BPath path;
|
||||||
BEntry entry(&ref, true);
|
BEntry entry(&ref, true);
|
||||||
@@ -987,12 +987,12 @@ BackgroundsView::RefsReceived(BMessage *msg)
|
|||||||
item = FindImageItem(index);
|
item = FindImageItem(index);
|
||||||
fLastImageIndex = index;
|
fLastImageIndex = index;
|
||||||
} else {
|
} else {
|
||||||
const char* name = GetImage(-index-1)->GetName();
|
const char* name = GetImage(-index - 1)->GetName();
|
||||||
item = new BGImageMenuItem(name, -index-1,
|
item = new BGImageMenuItem(name, -index - 1,
|
||||||
new BMessage(kMsgImageSelected));
|
new BMessage(kMsgImageSelected));
|
||||||
AddItem(item);
|
AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
fLastImageIndex = -index-1;
|
fLastImageIndex = -index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
@@ -1014,9 +1014,9 @@ BackgroundsView::RefsReceived(BMessage *msg)
|
|||||||
BString s;
|
BString s;
|
||||||
s << "Folder: " << path.Leaf();
|
s << "Folder: " << path.Leaf();
|
||||||
item = new BMenuItem(s.String(), new BMessage(kMsgFolderSelected));
|
item = new BMenuItem(s.String(), new BMessage(kMsgFolderSelected));
|
||||||
fWorkspaceMenu->AddItem(item, -index-1+6);
|
fWorkspaceMenu->AddItem(item, -index - 1 + 6);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
fLastWorkspaceIndex = -index-1 + 6;
|
fLastWorkspaceIndex = -index - 1 + 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
@@ -1031,7 +1031,7 @@ BackgroundsView::AddPath(BPath path)
|
|||||||
{
|
{
|
||||||
int32 count = fPathList.CountItems();
|
int32 count = fPathList.CountItems();
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
for(; index < count; index++) {
|
for (; index < count; index++) {
|
||||||
BPath *p = fPathList.ItemAt(index);
|
BPath *p = fPathList.ItemAt(index);
|
||||||
int c = BString(p->Path()).ICompare(path.Path());
|
int c = BString(p->Path()).ICompare(path.Path());
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
@@ -1041,7 +1041,7 @@ BackgroundsView::AddPath(BPath path)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fPathList.AddItem(new BPath(path), index);
|
fPathList.AddItem(new BPath(path), index);
|
||||||
return -index-1;
|
return -index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1050,14 +1050,14 @@ BackgroundsView::AddImage(BPath path)
|
|||||||
{
|
{
|
||||||
int32 count = fImageList.CountItems();
|
int32 count = fImageList.CountItems();
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
for(; index < count; index++) {
|
for (; index < count; index++) {
|
||||||
Image *image = fImageList.ItemAt(index);
|
Image *image = fImageList.ItemAt(index);
|
||||||
if (image->GetPath() == path)
|
if (image->GetPath() == path)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
fImageList.AddItem(new Image(path));
|
fImageList.AddItem(new Image(path));
|
||||||
return -index-1;
|
return -index - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1147,7 +1147,7 @@ PreView::MouseDown(BPoint point)
|
|||||||
if (IsEnabled() && Bounds().Contains(point)) {
|
if (IsEnabled() && Bounds().Contains(point)) {
|
||||||
uint32 buttons;
|
uint32 buttons;
|
||||||
GetMouse(&point, &buttons);
|
GetMouse(&point, &buttons);
|
||||||
if(buttons & B_PRIMARY_MOUSE_BUTTON) {
|
if (buttons & B_PRIMARY_MOUSE_BUTTON) {
|
||||||
fOldPoint = point;
|
fOldPoint = point;
|
||||||
SetTracking(true);
|
SetTracking(true);
|
||||||
BScreen().GetMode(&mode);
|
BScreen().GetMode(&mode);
|
||||||
@@ -1171,15 +1171,15 @@ PreView::MouseUp(BPoint point)
|
|||||||
void
|
void
|
||||||
PreView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
PreView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
||||||
{
|
{
|
||||||
if (IsEnabled())
|
if (IsEnabled())
|
||||||
SetViewCursor(&fMoveHandCursor);
|
SetViewCursor(&fMoveHandCursor);
|
||||||
else
|
else
|
||||||
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
|
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
|
||||||
|
|
||||||
if (IsTracking()) {
|
if (IsTracking()) {
|
||||||
float x, y;
|
float x, y;
|
||||||
x = fPoint.x + (point.x - fOldPoint.x)/ x_ratio;
|
x = fPoint.x + (point.x - fOldPoint.x) / x_ratio;
|
||||||
y = fPoint.y + (point.y - fOldPoint.y)/ y_ratio;
|
y = fPoint.y + (point.y - fOldPoint.y) / y_ratio;
|
||||||
bool min, max, mustSend = false;
|
bool min, max, mustSend = false;
|
||||||
min = (x > -fImageBounds.Width());
|
min = (x > -fImageBounds.Width());
|
||||||
max = (x < mode.virtual_width);
|
max = (x < mode.virtual_width);
|
||||||
@@ -1198,7 +1198,7 @@ PreView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
|||||||
fOldPoint.x = point.x - (x - fPoint.x) * x_ratio;
|
fOldPoint.x = point.x - (x - fPoint.x) * x_ratio;
|
||||||
mustSend = true;
|
mustSend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
min = (y > -fImageBounds.Height());
|
min = (y > -fImageBounds.Height());
|
||||||
max = (y < mode.virtual_height);
|
max = (y < mode.virtual_height);
|
||||||
@@ -1245,42 +1245,42 @@ PreviewBox::Draw(BRect rect)
|
|||||||
rgb_color color = HighColor();
|
rgb_color color = HighColor();
|
||||||
|
|
||||||
SetHighColor(LowColor());
|
SetHighColor(LowColor());
|
||||||
FillRect(BRect(9,19,141,127));
|
FillRect(BRect(9, 19, 141, 127));
|
||||||
|
|
||||||
if (fIsDesktop) {
|
if (fIsDesktop) {
|
||||||
BPoint points[] = {
|
BPoint points[] = {
|
||||||
BPoint(11,19), BPoint(139,19), BPoint(141,21),
|
BPoint(11, 19), BPoint(139, 19), BPoint(141, 21),
|
||||||
BPoint(141,119), BPoint(139,121), BPoint(118,121),
|
BPoint(141, 119), BPoint(139, 121), BPoint(118, 121),
|
||||||
BPoint(118,126), BPoint(117,127), BPoint(33,127),
|
BPoint(118, 126), BPoint(117, 127), BPoint(33, 127),
|
||||||
BPoint(32,126), BPoint(32,121),BPoint(11,121),
|
BPoint(32, 126), BPoint(32, 121), BPoint(11, 121),
|
||||||
BPoint(9,119),BPoint(9,21),BPoint(11,19)
|
BPoint(9, 119), BPoint(9, 21), BPoint(11, 19)
|
||||||
};
|
};
|
||||||
SetHighColor(184,184,184);
|
SetHighColor(184, 184, 184);
|
||||||
FillPolygon(points, 15);
|
FillPolygon(points, 15);
|
||||||
SetHighColor(96,96,96);
|
SetHighColor(96, 96, 96);
|
||||||
StrokePolygon(points, 15);
|
StrokePolygon(points, 15);
|
||||||
FillRect(BRect(107,121,111,123));
|
FillRect(BRect(107, 121, 111, 123));
|
||||||
SetHighColor(0,0,0);
|
SetHighColor(0, 0, 0);
|
||||||
StrokeRect(BRect(14,24,136,116));
|
StrokeRect(BRect(14, 24, 136, 116));
|
||||||
SetHighColor(0,255,0);
|
SetHighColor(0, 255, 0);
|
||||||
FillRect(BRect(101,122,103,123));
|
FillRect(BRect(101, 122, 103, 123));
|
||||||
} else {
|
} else {
|
||||||
SetHighColor(152,152,152);
|
SetHighColor(152, 152, 152);
|
||||||
StrokeLine(BPoint(11,13), BPoint(67,13));
|
StrokeLine(BPoint(11, 13), BPoint(67, 13));
|
||||||
StrokeLine(BPoint(67,21));
|
StrokeLine(BPoint(67, 21));
|
||||||
StrokeLine(BPoint(139,21));
|
StrokeLine(BPoint(139, 21));
|
||||||
StrokeLine(BPoint(139,119));
|
StrokeLine(BPoint(139, 119));
|
||||||
StrokeLine(BPoint(11,119));
|
StrokeLine(BPoint(11, 119));
|
||||||
StrokeLine(BPoint(11,13));
|
StrokeLine(BPoint(11, 13));
|
||||||
StrokeRect(BRect(14,24,136,116));
|
StrokeRect(BRect(14, 24, 136, 116));
|
||||||
SetHighColor(255,203,0);
|
SetHighColor(255, 203, 0);
|
||||||
FillRect(BRect(12,14,66,21));
|
FillRect(BRect(12, 14, 66, 21));
|
||||||
SetHighColor(240,240,240);
|
SetHighColor(240, 240, 240);
|
||||||
StrokeRect(BRect(12,22,137,117));
|
StrokeRect(BRect(12, 22, 137, 117));
|
||||||
StrokeLine(BPoint(138,22), BPoint(138,22));
|
StrokeLine(BPoint(138, 22), BPoint(138, 22));
|
||||||
StrokeLine(BPoint(12,118), BPoint(12,118));
|
StrokeLine(BPoint(12, 118), BPoint(12, 118));
|
||||||
SetHighColor(200,200,200);
|
SetHighColor(200, 200, 200);
|
||||||
StrokeRect(BRect(13,23,138,118));
|
StrokeRect(BRect(13, 23, 138, 118));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetHighColor(color);
|
SetHighColor(color);
|
||||||
@@ -1299,7 +1299,7 @@ PreviewBox::SetDesktop(bool isDesktop)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
BGImageMenuItem::BGImageMenuItem(const char *label, int32 imageIndex,
|
BGImageMenuItem::BGImageMenuItem(const char *label, int32 imageIndex,
|
||||||
BMessage *message, char shortcut, uint32 modifiers)
|
BMessage *message, char shortcut, uint32 modifiers)
|
||||||
: BMenuItem(label, message, shortcut, modifiers),
|
: BMenuItem(label, message, shortcut, modifiers),
|
||||||
fImageIndex(imageIndex)
|
fImageIndex(imageIndex)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class ImageFilePanel;
|
|||||||
|
|
||||||
class BGImageMenuItem : public BMenuItem {
|
class BGImageMenuItem : public BMenuItem {
|
||||||
public:
|
public:
|
||||||
BGImageMenuItem(const char *label, int32 imageIndex, BMessage *message,
|
BGImageMenuItem(const char *label, int32 imageIndex, BMessage *message,
|
||||||
char shortcut = 0, uint32 modifiers = 0);
|
char shortcut = 0, uint32 modifiers = 0);
|
||||||
|
|
||||||
int32 ImageIndex() { return fImageIndex; }
|
int32 ImageIndex() { return fImageIndex; }
|
||||||
@@ -73,7 +73,7 @@ class PreView : public BControl {
|
|||||||
void AttachedToWindow();
|
void AttachedToWindow();
|
||||||
|
|
||||||
BPoint fOldPoint;
|
BPoint fOldPoint;
|
||||||
float x_ratio,y_ratio;
|
float x_ratio, y_ratio;
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
|
|
||||||
BCursor fMoveHandCursor;
|
BCursor fMoveHandCursor;
|
||||||
@@ -128,7 +128,7 @@ class BackgroundsView : public BBox {
|
|||||||
|
|
||||||
BackgroundImage *fCurrent; // the current BackgroundImage object
|
BackgroundImage *fCurrent; // the current BackgroundImage object
|
||||||
BackgroundImage::BackgroundImageInfo *fCurrentInfo;//the current BackgroundImageInfo object
|
BackgroundImage::BackgroundImageInfo *fCurrentInfo;//the current BackgroundImageInfo object
|
||||||
entry_ref fCurrentRef; // the entry for the node which holds current
|
entry_ref fCurrentRef; // the entry for the node which holds current
|
||||||
int32 fLastImageIndex, fLastWorkspaceIndex; // last indexes for cancel
|
int32 fLastImageIndex, fLastWorkspaceIndex; // last indexes for cancel
|
||||||
BMessage fSettings; // settings loaded from settings directory
|
BMessage fSettings; // settings loaded from settings directory
|
||||||
|
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ ImageFilePanel::Show()
|
|||||||
if (fImageView == NULL) {
|
if (fImageView == NULL) {
|
||||||
Window()->Lock();
|
Window()->Lock();
|
||||||
BView *background = Window()->ChildAt(0);
|
BView *background = Window()->ChildAt(0);
|
||||||
uint32 poseViewResizingMode =
|
uint32 poseViewResizingMode =
|
||||||
background->FindView("PoseView")->ResizingMode();
|
background->FindView("PoseView")->ResizingMode();
|
||||||
uint32 countVwResizingMode =
|
uint32 countVwResizingMode =
|
||||||
background->FindView("CountVw")->ResizingMode();
|
background->FindView("CountVw")->ResizingMode();
|
||||||
uint32 vScrollBarResizingMode =
|
uint32 vScrollBarResizingMode =
|
||||||
background->FindView("VScrollBar")->ResizingMode();
|
background->FindView("VScrollBar")->ResizingMode();
|
||||||
uint32 hScrollBarResizingMode =
|
uint32 hScrollBarResizingMode =
|
||||||
background->FindView("HScrollBar")->ResizingMode();
|
background->FindView("HScrollBar")->ResizingMode();
|
||||||
|
|
||||||
background->FindView("PoseView")->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
background->FindView("PoseView")->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
|
||||||
@@ -57,19 +57,19 @@ ImageFilePanel::Show()
|
|||||||
|
|
||||||
BRect rect(background->Bounds().left + 15, background->Bounds().bottom - 94,
|
BRect rect(background->Bounds().left + 15, background->Bounds().bottom - 94,
|
||||||
background->Bounds().left + 122, background->Bounds().bottom - 15);
|
background->Bounds().left + 122, background->Bounds().bottom - 15);
|
||||||
fImageView = new BView(rect, "ImageView", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
fImageView = new BView(rect, "ImageView", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
|
||||||
B_SUBPIXEL_PRECISE);
|
B_SUBPIXEL_PRECISE);
|
||||||
fImageView->SetViewColor(background->ViewColor());
|
fImageView->SetViewColor(background->ViewColor());
|
||||||
background->AddChild(fImageView);
|
background->AddChild(fImageView);
|
||||||
|
|
||||||
rect = BRect(background->Bounds().left + 132, background->Bounds().bottom - 85,
|
rect = BRect(background->Bounds().left + 132, background->Bounds().bottom - 85,
|
||||||
background->Bounds().right, background->Bounds().bottom - 65);
|
background->Bounds().right, background->Bounds().bottom - 65);
|
||||||
fResolutionView = new BStringView(rect, "ResolutionView", NULL,
|
fResolutionView = new BStringView(rect, "ResolutionView", NULL,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
background->AddChild(fResolutionView);
|
background->AddChild(fResolutionView);
|
||||||
|
|
||||||
rect.OffsetBy(0, -16);
|
rect.OffsetBy(0, -16);
|
||||||
fImageTypeView = new BStringView(rect, "ImageTypeView", NULL,
|
fImageTypeView = new BStringView(rect, "ImageTypeView", NULL,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
|
||||||
background->AddChild(fImageTypeView);
|
background->AddChild(fImageTypeView);
|
||||||
|
|
||||||
@@ -96,20 +96,20 @@ ImageFilePanel::SelectionChanged()
|
|||||||
|
|
||||||
if (bitmap != NULL) {
|
if (bitmap != NULL) {
|
||||||
BRect dest(fImageView->Bounds());
|
BRect dest(fImageView->Bounds());
|
||||||
if (bitmap->Bounds().Width()>bitmap->Bounds().Height()) {
|
if (bitmap->Bounds().Width() > bitmap->Bounds().Height()) {
|
||||||
dest.InsetBy(0, (dest.Height()+1 -
|
dest.InsetBy(0, (dest.Height() + 1 -
|
||||||
((bitmap->Bounds().Height()+1) /
|
((bitmap->Bounds().Height() + 1) /
|
||||||
(bitmap->Bounds().Width()+1) * (dest.Width()+1)))/2);
|
(bitmap->Bounds().Width() + 1) *(dest.Width() + 1))) / 2);
|
||||||
} else {
|
} else {
|
||||||
dest.InsetBy((dest.Width()+1 -
|
dest.InsetBy((dest.Width() + 1 -
|
||||||
((bitmap->Bounds().Width()+1) /
|
((bitmap->Bounds().Width() + 1) /
|
||||||
(bitmap->Bounds().Height()+1) * (dest.Height()+1)))/2, 0);
|
(bitmap->Bounds().Height() + 1) *(dest.Height() + 1))) / 2, 0);
|
||||||
}
|
}
|
||||||
fImageView->SetViewBitmap(bitmap, bitmap->Bounds(), dest,
|
fImageView->SetViewBitmap(bitmap, bitmap->Bounds(), dest,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, 0);
|
B_FOLLOW_LEFT | B_FOLLOW_TOP, 0);
|
||||||
|
|
||||||
BString resolution;
|
BString resolution;
|
||||||
resolution << "Resolution: " << (int)(bitmap->Bounds().Width() + 1)
|
resolution << "Resolution: " << (int)(bitmap->Bounds().Width() + 1)
|
||||||
<< "x" << (int)(bitmap->Bounds().Height() + 1);
|
<< "x" << (int)(bitmap->Bounds().Height() + 1);
|
||||||
fResolutionView->SetText(resolution.String());
|
fResolutionView->SetText(resolution.String());
|
||||||
delete bitmap;
|
delete bitmap;
|
||||||
@@ -120,13 +120,13 @@ ImageFilePanel::SelectionChanged()
|
|||||||
if (nodeInfo.GetType(type) == B_OK) {
|
if (nodeInfo.GetType(type) == B_OK) {
|
||||||
BMimeType mimeType(type);
|
BMimeType mimeType(type);
|
||||||
mimeType.GetShortDescription(type);
|
mimeType.GetShortDescription(type);
|
||||||
// if this fails, the MIME type will be displayed
|
// if this fails, the MIME type will be displayed
|
||||||
fImageTypeView->SetText(type);
|
fImageTypeView->SetText(type);
|
||||||
} else {
|
} else {
|
||||||
BMimeType refType;
|
BMimeType refType;
|
||||||
if (BMimeType::GuessMimeType(&ref, &refType) == B_OK) {
|
if (BMimeType::GuessMimeType(&ref, &refType) == B_OK) {
|
||||||
refType.GetShortDescription(type);
|
refType.GetShortDescription(type);
|
||||||
// if this fails, the MIME type will be displayed
|
// if this fails, the MIME type will be displayed
|
||||||
fImageTypeView->SetText(type);
|
fImageTypeView->SetText(type);
|
||||||
} else
|
} else
|
||||||
fImageTypeView->SetText("");
|
fImageTypeView->SetText("");
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class CustomRefFilter : public BRefFilter {
|
|||||||
CustomRefFilter(bool imageFiltering);
|
CustomRefFilter(bool imageFiltering);
|
||||||
virtual ~CustomRefFilter() {};
|
virtual ~CustomRefFilter() {};
|
||||||
|
|
||||||
bool Filter(const entry_ref *ref, BNode* node, struct stat *st,
|
bool Filter(const entry_ref *ref, BNode* node, struct stat *st,
|
||||||
const char *filetype);
|
const char *filetype);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -44,7 +44,7 @@ class ImageFilePanel : public BFilePanel {
|
|||||||
protected:
|
protected:
|
||||||
BView* fImageView;
|
BView* fImageView;
|
||||||
BStringView* fResolutionView;
|
BStringView* fResolutionView;
|
||||||
BStringView* fImageTypeView;
|
BStringView* fImageTypeView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IMAGE_FILE_PANEL_H
|
#endif // IMAGE_FILE_PANEL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user