Some cleanup in Backround preflet:
* rename a couple of members for imroved clarity * adjust formatting in header git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42971 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -72,10 +72,10 @@ BackgroundsView::BackgroundsView()
|
|||||||
{
|
{
|
||||||
SetBorder(B_NO_BORDER);
|
SetBorder(B_NO_BORDER);
|
||||||
|
|
||||||
fPreview = new BBox("preview");
|
fPreviewBox = new BBox("preview");
|
||||||
fPreview->SetLabel(B_TRANSLATE("Preview"));
|
fPreviewBox->SetLabel(B_TRANSLATE("Preview"));
|
||||||
|
|
||||||
fPreView = new PreView();
|
fPreview = new Preview();
|
||||||
|
|
||||||
fTopLeft = new FramePart(FRAME_TOP_LEFT);
|
fTopLeft = new FramePart(FRAME_TOP_LEFT);
|
||||||
fTop = new FramePart(FRAME_TOP);
|
fTop = new FramePart(FRAME_TOP);
|
||||||
@@ -111,7 +111,7 @@ BackgroundsView::BackgroundsView()
|
|||||||
.Add(fTop, 1, 0)
|
.Add(fTop, 1, 0)
|
||||||
.Add(fTopRight, 2, 0)
|
.Add(fTopRight, 2, 0)
|
||||||
.Add(fLeft, 0, 1)
|
.Add(fLeft, 0, 1)
|
||||||
.Add(fPreView, 1, 1)
|
.Add(fPreview, 1, 1)
|
||||||
.Add(fRight, 2, 1)
|
.Add(fRight, 2, 1)
|
||||||
.Add(fBottomLeft, 0, 2)
|
.Add(fBottomLeft, 0, 2)
|
||||||
.Add(fBottom, 1, 2)
|
.Add(fBottom, 1, 2)
|
||||||
@@ -129,7 +129,7 @@ BackgroundsView::BackgroundsView()
|
|||||||
.AddGlue()
|
.AddGlue()
|
||||||
.View();
|
.View();
|
||||||
|
|
||||||
fPreview->AddChild(view);
|
fPreviewBox->AddChild(view);
|
||||||
|
|
||||||
BBox* rightbox = new BBox("rightbox");
|
BBox* rightbox = new BBox("rightbox");
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ BackgroundsView::BackgroundsView()
|
|||||||
view = BLayoutBuilder::Group<>()
|
view = BLayoutBuilder::Group<>()
|
||||||
.AddGroup(B_VERTICAL, 10)
|
.AddGroup(B_VERTICAL, 10)
|
||||||
.AddGroup(B_HORIZONTAL, 10)
|
.AddGroup(B_HORIZONTAL, 10)
|
||||||
.Add(fPreview)
|
.Add(fPreviewBox)
|
||||||
.Add(rightbox)
|
.Add(rightbox)
|
||||||
.End()
|
.End()
|
||||||
.AddGroup(B_HORIZONTAL, 0)
|
.AddGroup(B_HORIZONTAL, 0)
|
||||||
@@ -306,8 +306,8 @@ BackgroundsView::MessageReceived(BMessage* msg)
|
|||||||
case kMsgUpdatePreviewPlacement:
|
case kMsgUpdatePreviewPlacement:
|
||||||
{
|
{
|
||||||
BString xstring, ystring;
|
BString xstring, ystring;
|
||||||
xstring << (int)fPreView->fPoint.x;
|
xstring << (int)fPreview->fPoint.x;
|
||||||
ystring << (int)fPreView->fPoint.y;
|
ystring << (int)fPreview->fPoint.y;
|
||||||
fXPlacementText->SetText(xstring.String());
|
fXPlacementText->SetText(xstring.String());
|
||||||
fYPlacementText->SetText(ystring.String());
|
fYPlacementText->SetText(ystring.String());
|
||||||
_UpdatePreview();
|
_UpdatePreview();
|
||||||
@@ -865,7 +865,7 @@ BackgroundsView::_UpdatePreview()
|
|||||||
fXPlacementText->TextView()->MakeEditable(textEnabled);
|
fXPlacementText->TextView()->MakeEditable(textEnabled);
|
||||||
fYPlacementText->TextView()->MakeEditable(textEnabled);
|
fYPlacementText->TextView()->MakeEditable(textEnabled);
|
||||||
|
|
||||||
fPreView->ClearViewBitmap();
|
fPreview->ClearViewBitmap();
|
||||||
|
|
||||||
int32 index = ((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex();
|
int32 index = ((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex();
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@@ -877,22 +877,22 @@ BackgroundsView::_UpdatePreview()
|
|||||||
atoi(fYPlacementText->Text())),
|
atoi(fYPlacementText->Text())),
|
||||||
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
|
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
|
||||||
if (info->fMode == BackgroundImage::kAtOffset) {
|
if (info->fMode == BackgroundImage::kAtOffset) {
|
||||||
fPreView->SetEnabled(true);
|
fPreview->SetEnabled(true);
|
||||||
fPreView->fPoint.x = atoi(fXPlacementText->Text());
|
fPreview->fPoint.x = atoi(fXPlacementText->Text());
|
||||||
fPreView->fPoint.y = atoi(fYPlacementText->Text());
|
fPreview->fPoint.y = atoi(fYPlacementText->Text());
|
||||||
} else
|
} else
|
||||||
fPreView->SetEnabled(false);
|
fPreview->SetEnabled(false);
|
||||||
|
|
||||||
fPreView->fImageBounds = BRect(bitmap->Bounds());
|
fPreview->fImageBounds = BRect(bitmap->Bounds());
|
||||||
fCurrent->Show(info, fPreView);
|
fCurrent->Show(info, fPreview);
|
||||||
|
|
||||||
delete info;
|
delete info;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
fPreView->SetEnabled(false);
|
fPreview->SetEnabled(false);
|
||||||
|
|
||||||
fPreView->SetViewColor(fPicker->ValueAsColor());
|
fPreview->SetViewColor(fPicker->ValueAsColor());
|
||||||
fPreView->Invalidate();
|
fPreview->Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1144,7 +1144,7 @@ BackgroundsView::FoundPositionSetting()
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
PreView::PreView()
|
Preview::Preview()
|
||||||
:
|
:
|
||||||
BControl("PreView", NULL, NULL, B_WILL_DRAW | B_SUBPIXEL_PRECISE)
|
BControl("PreView", NULL, NULL, B_WILL_DRAW | B_SUBPIXEL_PRECISE)
|
||||||
{
|
{
|
||||||
@@ -1159,7 +1159,7 @@ PreView::PreView()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PreView::AttachedToWindow()
|
Preview::AttachedToWindow()
|
||||||
{
|
{
|
||||||
rgb_color color = ViewColor();
|
rgb_color color = ViewColor();
|
||||||
BControl::AttachedToWindow();
|
BControl::AttachedToWindow();
|
||||||
@@ -1168,7 +1168,7 @@ PreView::AttachedToWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PreView::MouseDown(BPoint point)
|
Preview::MouseDown(BPoint point)
|
||||||
{
|
{
|
||||||
if (IsEnabled() && Bounds().Contains(point)) {
|
if (IsEnabled() && Bounds().Contains(point)) {
|
||||||
uint32 buttons;
|
uint32 buttons;
|
||||||
@@ -1190,7 +1190,7 @@ PreView::MouseDown(BPoint point)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PreView::MouseUp(BPoint point)
|
Preview::MouseUp(BPoint point)
|
||||||
{
|
{
|
||||||
if (IsTracking()) {
|
if (IsTracking()) {
|
||||||
SetTracking(false);
|
SetTracking(false);
|
||||||
@@ -1201,7 +1201,7 @@ 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 (!IsTracking()) {
|
if (!IsTracking()) {
|
||||||
BCursor cursor(IsEnabled()
|
BCursor cursor(IsEnabled()
|
||||||
|
|||||||
@@ -65,116 +65,116 @@ enum frame_parts {
|
|||||||
|
|
||||||
class FramePart : public BView {
|
class FramePart : public BView {
|
||||||
public:
|
public:
|
||||||
FramePart(int32 part);
|
FramePart(int32 part);
|
||||||
|
|
||||||
void Draw(BRect rect);
|
void Draw(BRect rect);
|
||||||
void SetDesktop(bool isDesktop);
|
void SetDesktop(bool isDesktop);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _SetSizeAndAlignment();
|
void _SetSizeAndAlignment();
|
||||||
|
|
||||||
int32 fFramePart;
|
int32 fFramePart;
|
||||||
bool fIsDesktop;
|
bool fIsDesktop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PreView : public BControl {
|
class Preview : public BControl {
|
||||||
public:
|
public:
|
||||||
PreView();
|
Preview();
|
||||||
|
|
||||||
BPoint fPoint;
|
BPoint fPoint;
|
||||||
BRect fImageBounds;
|
BRect fImageBounds;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void MouseDown(BPoint point);
|
void MouseDown(BPoint point);
|
||||||
void MouseUp(BPoint point);
|
void MouseUp(BPoint point);
|
||||||
void MouseMoved(BPoint point, uint32 transit,
|
void MouseMoved(BPoint point, uint32 transit,
|
||||||
const BMessage* message);
|
const BMessage* message);
|
||||||
void AttachedToWindow();
|
void AttachedToWindow();
|
||||||
|
|
||||||
BPoint fOldPoint;
|
BPoint fOldPoint;
|
||||||
float fXRatio;
|
float fXRatio;
|
||||||
float fYRatio;
|
float fYRatio;
|
||||||
display_mode fMode;
|
display_mode fMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BackgroundsView : public BBox {
|
class BackgroundsView : public BBox {
|
||||||
public:
|
public:
|
||||||
BackgroundsView();
|
BackgroundsView();
|
||||||
~BackgroundsView();
|
~BackgroundsView();
|
||||||
|
|
||||||
void AllAttached();
|
void AllAttached();
|
||||||
void MessageReceived(BMessage* msg);
|
void MessageReceived(BMessage* msg);
|
||||||
|
|
||||||
void RefsReceived(BMessage* msg);
|
void RefsReceived(BMessage* msg);
|
||||||
|
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
void WorkspaceActivated(uint32 oldWorkspaces,
|
void WorkspaceActivated(uint32 oldWorkspaces,
|
||||||
bool active);
|
bool active);
|
||||||
int32 AddImage(BPath path);
|
int32 AddImage(BPath path);
|
||||||
Image* GetImage(int32 imageIndex);
|
Image* GetImage(int32 imageIndex);
|
||||||
|
|
||||||
bool FoundPositionSetting();
|
bool FoundPositionSetting();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _Save();
|
void _Save();
|
||||||
void _NotifyServer();
|
void _NotifyServer();
|
||||||
void _LoadSettings();
|
void _LoadSettings();
|
||||||
void _LoadDesktopFolder();
|
void _LoadDesktopFolder();
|
||||||
void _LoadDefaultFolder();
|
void _LoadDefaultFolder();
|
||||||
void _LoadFolder(bool isDesktop);
|
void _LoadFolder(bool isDesktop);
|
||||||
void _LoadRecentFolder(BPath path);
|
void _LoadRecentFolder(BPath path);
|
||||||
void _UpdateWithCurrent();
|
void _UpdateWithCurrent();
|
||||||
void _UpdatePreview();
|
void _UpdatePreview();
|
||||||
void _UpdateButtons();
|
void _UpdateButtons();
|
||||||
void _SetDesktop(bool isDesktop);
|
void _SetDesktop(bool isDesktop);
|
||||||
int32 _AddPath(BPath path);
|
int32 _AddPath(BPath path);
|
||||||
|
|
||||||
static int32 _NotifyThread(void* data);
|
static int32 _NotifyThread(void* data);
|
||||||
|
|
||||||
BGImageMenuItem* _FindImageItem(const int32 imageIndex);
|
BGImageMenuItem* _FindImageItem(const int32 imageIndex);
|
||||||
|
|
||||||
bool _AddItem(BGImageMenuItem* item);
|
bool _AddItem(BGImageMenuItem* item);
|
||||||
|
|
||||||
BackgroundImage::Mode _FindPlacementMode();
|
BackgroundImage::Mode _FindPlacementMode();
|
||||||
|
|
||||||
BColorControl* fPicker;
|
BColorControl* fPicker;
|
||||||
BButton* fApply;
|
BButton* fApply;
|
||||||
BButton* fRevert;
|
BButton* fRevert;
|
||||||
BCheckBox* fIconLabelOutline;
|
BCheckBox* fIconLabelOutline;
|
||||||
BMenu* fPlacementMenu;
|
BMenu* fPlacementMenu;
|
||||||
BMenu* fImageMenu;
|
BMenu* fImageMenu;
|
||||||
BMenu* fWorkspaceMenu;
|
BMenu* fWorkspaceMenu;
|
||||||
BTextControl* fXPlacementText;
|
BTextControl* fXPlacementText;
|
||||||
BTextControl* fYPlacementText;
|
BTextControl* fYPlacementText;
|
||||||
PreView* fPreView;
|
Preview* fPreview;
|
||||||
BBox* fPreview;
|
BBox* fPreviewBox;
|
||||||
BFilePanel* fFolderPanel;
|
BFilePanel* fFolderPanel;
|
||||||
ImageFilePanel* fPanel;
|
ImageFilePanel* fPanel;
|
||||||
|
|
||||||
BackgroundImage* fCurrent;
|
BackgroundImage* fCurrent;
|
||||||
|
|
||||||
BackgroundImage::BackgroundImageInfo* fCurrentInfo;
|
BackgroundImage::BackgroundImageInfo* fCurrentInfo;
|
||||||
|
|
||||||
entry_ref fCurrentRef;
|
entry_ref fCurrentRef;
|
||||||
int32 fLastImageIndex;
|
int32 fLastImageIndex;
|
||||||
int32 fLastWorkspaceIndex;
|
int32 fLastWorkspaceIndex;
|
||||||
BMessage fSettings;
|
BMessage fSettings;
|
||||||
|
|
||||||
BObjectList<BPath> fPathList;
|
BObjectList<BPath> fPathList;
|
||||||
BObjectList<Image> fImageList;
|
BObjectList<Image> fImageList;
|
||||||
|
|
||||||
FramePart* fTopLeft;
|
FramePart* fTopLeft;
|
||||||
FramePart* fTop;
|
FramePart* fTop;
|
||||||
FramePart* fTopRight;
|
FramePart* fTopRight;
|
||||||
FramePart* fLeft;
|
FramePart* fLeft;
|
||||||
FramePart* fRight;
|
FramePart* fRight;
|
||||||
FramePart* fBottomLeft;
|
FramePart* fBottomLeft;
|
||||||
FramePart* fBottom;
|
FramePart* fBottom;
|
||||||
FramePart* fBottomRight;
|
FramePart* fBottomRight;
|
||||||
|
|
||||||
bool fFoundPositionSetting;
|
bool fFoundPositionSetting;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BACKGROUNDS_VIEW_H
|
#endif // BACKGROUNDS_VIEW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user