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:
Oliver Tappe
2011-10-29 17:12:44 +00:00
parent d817520f98
commit 4d9b54c175
2 changed files with 93 additions and 93 deletions
+23 -23
View File
@@ -72,10 +72,10 @@ BackgroundsView::BackgroundsView()
{
SetBorder(B_NO_BORDER);
fPreview = new BBox("preview");
fPreview->SetLabel(B_TRANSLATE("Preview"));
fPreviewBox = new BBox("preview");
fPreviewBox->SetLabel(B_TRANSLATE("Preview"));
fPreView = new PreView();
fPreview = new Preview();
fTopLeft = new FramePart(FRAME_TOP_LEFT);
fTop = new FramePart(FRAME_TOP);
@@ -111,7 +111,7 @@ BackgroundsView::BackgroundsView()
.Add(fTop, 1, 0)
.Add(fTopRight, 2, 0)
.Add(fLeft, 0, 1)
.Add(fPreView, 1, 1)
.Add(fPreview, 1, 1)
.Add(fRight, 2, 1)
.Add(fBottomLeft, 0, 2)
.Add(fBottom, 1, 2)
@@ -129,7 +129,7 @@ BackgroundsView::BackgroundsView()
.AddGlue()
.View();
fPreview->AddChild(view);
fPreviewBox->AddChild(view);
BBox* rightbox = new BBox("rightbox");
@@ -227,7 +227,7 @@ BackgroundsView::BackgroundsView()
view = BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, 10)
.AddGroup(B_HORIZONTAL, 10)
.Add(fPreview)
.Add(fPreviewBox)
.Add(rightbox)
.End()
.AddGroup(B_HORIZONTAL, 0)
@@ -306,8 +306,8 @@ BackgroundsView::MessageReceived(BMessage* msg)
case kMsgUpdatePreviewPlacement:
{
BString xstring, ystring;
xstring << (int)fPreView->fPoint.x;
ystring << (int)fPreView->fPoint.y;
xstring << (int)fPreview->fPoint.x;
ystring << (int)fPreview->fPoint.y;
fXPlacementText->SetText(xstring.String());
fYPlacementText->SetText(ystring.String());
_UpdatePreview();
@@ -865,7 +865,7 @@ BackgroundsView::_UpdatePreview()
fXPlacementText->TextView()->MakeEditable(textEnabled);
fYPlacementText->TextView()->MakeEditable(textEnabled);
fPreView->ClearViewBitmap();
fPreview->ClearViewBitmap();
int32 index = ((BGImageMenuItem*)fImageMenu->FindMarked())->ImageIndex();
if (index >= 0) {
@@ -877,22 +877,22 @@ BackgroundsView::_UpdatePreview()
atoi(fYPlacementText->Text())),
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
if (info->fMode == BackgroundImage::kAtOffset) {
fPreView->SetEnabled(true);
fPreView->fPoint.x = atoi(fXPlacementText->Text());
fPreView->fPoint.y = atoi(fYPlacementText->Text());
fPreview->SetEnabled(true);
fPreview->fPoint.x = atoi(fXPlacementText->Text());
fPreview->fPoint.y = atoi(fYPlacementText->Text());
} else
fPreView->SetEnabled(false);
fPreview->SetEnabled(false);
fPreView->fImageBounds = BRect(bitmap->Bounds());
fCurrent->Show(info, fPreView);
fPreview->fImageBounds = BRect(bitmap->Bounds());
fCurrent->Show(info, fPreview);
delete info;
}
} else
fPreView->SetEnabled(false);
fPreview->SetEnabled(false);
fPreView->SetViewColor(fPicker->ValueAsColor());
fPreView->Invalidate();
fPreview->SetViewColor(fPicker->ValueAsColor());
fPreview->Invalidate();
}
@@ -1144,7 +1144,7 @@ BackgroundsView::FoundPositionSetting()
// #pragma mark -
PreView::PreView()
Preview::Preview()
:
BControl("PreView", NULL, NULL, B_WILL_DRAW | B_SUBPIXEL_PRECISE)
{
@@ -1159,7 +1159,7 @@ PreView::PreView()
void
PreView::AttachedToWindow()
Preview::AttachedToWindow()
{
rgb_color color = ViewColor();
BControl::AttachedToWindow();
@@ -1168,7 +1168,7 @@ PreView::AttachedToWindow()
void
PreView::MouseDown(BPoint point)
Preview::MouseDown(BPoint point)
{
if (IsEnabled() && Bounds().Contains(point)) {
uint32 buttons;
@@ -1190,7 +1190,7 @@ PreView::MouseDown(BPoint point)
void
PreView::MouseUp(BPoint point)
Preview::MouseUp(BPoint point)
{
if (IsTracking()) {
SetTracking(false);
@@ -1201,7 +1201,7 @@ PreView::MouseUp(BPoint point)
void
PreView::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
Preview::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
{
if (!IsTracking()) {
BCursor cursor(IsEnabled()
+70 -70
View File
@@ -65,116 +65,116 @@ enum frame_parts {
class FramePart : public BView {
public:
FramePart(int32 part);
FramePart(int32 part);
void Draw(BRect rect);
void SetDesktop(bool isDesktop);
void Draw(BRect rect);
void SetDesktop(bool isDesktop);
private:
void _SetSizeAndAlignment();
void _SetSizeAndAlignment();
int32 fFramePart;
bool fIsDesktop;
int32 fFramePart;
bool fIsDesktop;
};
class PreView : public BControl {
class Preview : public BControl {
public:
PreView();
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();
void MouseDown(BPoint point);
void MouseUp(BPoint point);
void MouseMoved(BPoint point, uint32 transit,
const BMessage* message);
void AttachedToWindow();
BPoint fOldPoint;
float fXRatio;
float fYRatio;
display_mode fMode;
BPoint fOldPoint;
float fXRatio;
float fYRatio;
display_mode fMode;
};
class BackgroundsView : public BBox {
public:
BackgroundsView();
~BackgroundsView();
BackgroundsView();
~BackgroundsView();
void AllAttached();
void MessageReceived(BMessage* msg);
void AllAttached();
void MessageReceived(BMessage* msg);
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 _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);
void _Save();
void _NotifyServer();
void _LoadSettings();
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);
bool _AddItem(BGImageMenuItem* item);
BackgroundImage::Mode _FindPlacementMode();
BColorControl* fPicker;
BButton* fApply;
BButton* fRevert;
BCheckBox* fIconLabelOutline;
BMenu* fPlacementMenu;
BMenu* fImageMenu;
BMenu* fWorkspaceMenu;
BTextControl* fXPlacementText;
BTextControl* fYPlacementText;
PreView* fPreView;
BBox* fPreview;
BFilePanel* fFolderPanel;
ImageFilePanel* fPanel;
BColorControl* fPicker;
BButton* fApply;
BButton* fRevert;
BCheckBox* fIconLabelOutline;
BMenu* fPlacementMenu;
BMenu* fImageMenu;
BMenu* fWorkspaceMenu;
BTextControl* fXPlacementText;
BTextControl* fYPlacementText;
Preview* fPreview;
BBox* fPreviewBox;
BFilePanel* fFolderPanel;
ImageFilePanel* fPanel;
BackgroundImage* fCurrent;
BackgroundImage::BackgroundImageInfo* fCurrentInfo;
entry_ref fCurrentRef;
int32 fLastImageIndex;
int32 fLastWorkspaceIndex;
BMessage fSettings;
entry_ref fCurrentRef;
int32 fLastImageIndex;
int32 fLastWorkspaceIndex;
BMessage fSettings;
BObjectList<BPath> fPathList;
BObjectList<Image> fImageList;
FramePart* fTopLeft;
FramePart* fTop;
FramePart* fTopRight;
FramePart* fLeft;
FramePart* fRight;
FramePart* fBottomLeft;
FramePart* fBottom;
FramePart* fBottomRight;
FramePart* fTopLeft;
FramePart* fTop;
FramePart* fTopRight;
FramePart* fLeft;
FramePart* fRight;
FramePart* fBottomLeft;
FramePart* fBottom;
FramePart* fBottomRight;
bool fFoundPositionSetting;
bool fFoundPositionSetting;
};
#endif // BACKGROUNDS_VIEW_H