Partial clean-up.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33910 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2009-11-05 23:39:57 +00:00
parent abf272eedb
commit dca191e9b7
8 changed files with 316 additions and 271 deletions
+25 -16
View File
@@ -35,8 +35,14 @@ All rights reserved.
// Classes used for setting up and managing background images // Classes used for setting up and managing background images
// //
#include "BackgroundImage.h"
#include <new>
#include <stdlib.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Debug.h> #include <Debug.h>
#include <fs_attr.h>
#include <Node.h> #include <Node.h>
#include <TranslationKit.h> #include <TranslationKit.h>
#include <View.h> #include <View.h>
@@ -47,14 +53,8 @@ All rights reserved.
#include <Screen.h> #include <Screen.h>
#include <String.h> #include <String.h>
#include <fs_attr.h>
#include <stdlib.h>
#include "BackgroundImage.h"
#include "BackgroundsView.h" #include "BackgroundsView.h"
#include <new>
const char* kBackgroundImageInfo = "be:bgndimginfo"; const char* kBackgroundImageInfo = "be:bgndimginfo";
const char* kBackgroundImageInfoOffset = "be:bgndimginfooffset"; const char* kBackgroundImageInfoOffset = "be:bgndimginfooffset";
@@ -104,7 +104,8 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
if (isDesktop) { if (isDesktop) {
container.FindInt32(kBackgroundImageSetPeriod, (int32*)&imageSetPeriod); container.FindInt32(kBackgroundImageSetPeriod, (int32*)&imageSetPeriod);
container.FindInt32(kBackgroundImageCacheMode, (int32 *)&globalCacheMode); container.FindInt32(kBackgroundImageCacheMode,
(int32*)&globalCacheMode);
container.FindBool(kBackgroundImageRandomChange, &randomChange); container.FindBool(kBackgroundImageRandomChange, &randomChange);
} }
@@ -118,7 +119,8 @@ BackgroundImage::GetBackgroundImage(const BNode *node, bool isDesktop,
uint32 cacheMode = 0; uint32 cacheMode = 0;
int32 imageIndex = -1; int32 imageIndex = -1;
if (container.FindString(kBackgroundImageInfoPath, index, &path) == B_OK) { if (container.FindString(kBackgroundImageInfoPath, index, &path)
== B_OK) {
if (strcmp(path, "")) { if (strcmp(path, "")) {
BPath bpath(path); BPath bpath(path);
imageIndex = view->AddImage(bpath); imageIndex = view->AddImage(bpath);
@@ -191,7 +193,8 @@ BackgroundImage::BackgroundImageInfo::~BackgroundImageInfo()
// #pragma mark - // #pragma mark -
BackgroundImage::BackgroundImage(const BNode *node, bool desktop, BackgroundsView* view) BackgroundImage::BackgroundImage(const BNode* node, bool desktop,
BackgroundsView* view)
: :
fIsDesktop(desktop), fIsDesktop(desktop),
fDefinedByNode(*node), fDefinedByNode(*node),
@@ -249,7 +252,8 @@ BackgroundImage::Show(BView *view, int32 workspace)
if (info) { if (info) {
/*BPoseView* poseView = dynamic_cast<BPoseView*>(fView); /*BPoseView* poseView = dynamic_cast<BPoseView*>(fView);
if (poseView) if (poseView)
poseView->SetEraseWidgetTextBackground(info->fTextWidgetLabelOutline);*/ poseView
->SetEraseWidgetTextBackground(info->fTextWidgetLabelOutline);*/
Show(info, fView); Show(info, fView);
} }
} }
@@ -258,7 +262,8 @@ 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;
@@ -287,7 +292,8 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
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);
break; break;
} }
// else fall thru // else fall thru
@@ -304,7 +310,8 @@ BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
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 Tracker doesn't do that
//if (fIsDesktop) { //if (fIsDesktop) {
destinationBitmapBounds.OffsetBy( destinationBitmapBounds.OffsetBy(
(viewBounds.Width() - destinationBitmapBounds.Width()) / 2, (viewBounds.Width() - destinationBitmapBounds.Width()) / 2,
@@ -416,8 +423,8 @@ BackgroundImage::ScreenChanged(BRect, color_space)
(viewBounds.Width() - bitmapBounds.Width()) / 2, (viewBounds.Width() - bitmapBounds.Width()) / 2,
(viewBounds.Height() - bitmapBounds.Height()) / 2); (viewBounds.Height() - bitmapBounds.Height()) / 2);
fView->SetViewBitmap(fShowingBitmap->fBitmap, bitmapBounds, destinationBitmapBounds, fView->SetViewBitmap(fShowingBitmap->fBitmap, bitmapBounds,
B_FOLLOW_NONE, 0); destinationBitmapBounds, B_FOLLOW_NONE, 0);
fView->Invalidate(); fView->Invalidate();
}*/ }*/
} }
@@ -437,7 +444,8 @@ BackgroundImage::SetBackgroundImage(BNode *node)
info->fTextWidgetLabelOutline); info->fTextWidgetLabelOutline);
if (fBackgroundsView->GetImage(info->fImageIndex) != NULL) { if (fBackgroundsView->GetImage(info->fImageIndex) != NULL) {
container.AddString(kBackgroundImageInfoPath, container.AddString(kBackgroundImageInfoPath,
fBackgroundsView->GetImage(info->fImageIndex)->GetPath().Path()); fBackgroundsView
->GetImage(info->fImageIndex)->GetPath().Path());
} else } else
container.AddString(kBackgroundImageInfoPath, ""); container.AddString(kBackgroundImageInfoPath, "");
@@ -535,3 +543,4 @@ Image::GetBitmap()
return fBitmap; return fBitmap;
} }
@@ -38,13 +38,14 @@ All rights reserved.
#ifndef __BACKGROUND_IMAGE__ #ifndef __BACKGROUND_IMAGE__
#define __BACKGROUND_IMAGE__ #define __BACKGROUND_IMAGE__
#include "String.h"
#include "ObjectList.h"
#include <GraphicsDefs.h> #include <GraphicsDefs.h>
#include <Node.h> #include <Node.h>
#include <Path.h> #include <Path.h>
#include "ObjectList.h"
#include "String.h"
class BView; class BView;
class BBitmap; class BBitmap;
@@ -170,3 +171,4 @@ private:
}; };
#endif #endif
+4 -3
View File
@@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -8,13 +8,13 @@
*/ */
#include "BackgroundsView.h"
#include <Application.h> #include <Application.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <TrackerAddOnAppLaunch.h> #include <TrackerAddOnAppLaunch.h>
#include <Window.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";
@@ -61,6 +61,7 @@ BackgroundsApplication::RefsReceived(BMessage* message)
fWindow->RefsReceived(message); fWindow->RefsReceived(message);
} }
// #pragma mark - // #pragma mark -
+16 -14
View File
@@ -10,7 +10,6 @@
#include "BackgroundsView.h" #include "BackgroundsView.h"
#include "ImageFilePanel.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -28,6 +27,8 @@
#include <be_apps/Tracker/Background.h> #include <be_apps/Tracker/Background.h>
#include "ImageFilePanel.h"
static const uint32 kMsgApplySettings = 'aply'; static const uint32 kMsgApplySettings = 'aply';
static const uint32 kMsgRevertSettings = 'rvrt'; static const uint32 kMsgRevertSettings = 'rvrt';
@@ -594,8 +595,8 @@ BackgroundsView::UpdateWithCurrent(void)
void void
BackgroundsView::Save() BackgroundsView::Save()
{ {
bool textWidgetLabelOutline = bool textWidgetLabelOutline
fIconLabelOutline->Value() == B_CONTROL_ON; = fIconLabelOutline->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()));
@@ -631,8 +632,8 @@ BackgroundsView::Save()
fCurrentInfo->fCacheMode); fCurrentInfo->fCacheMode);
fCurrent->Add(fCurrentInfo); fCurrent->Add(fCurrentInfo);
} else if (fCurrentInfo->fWorkspace == workspaceMask) { } else if (fCurrentInfo->fWorkspace == workspaceMask) {
fCurrentInfo->fTextWidgetLabelOutline = fCurrentInfo->fTextWidgetLabelOutline
textWidgetLabelOutline; = textWidgetLabelOutline;
fCurrentInfo->fMode = mode; fCurrentInfo->fMode = mode;
if (fCurrentInfo->fMode == BackgroundImage::kAtOffset) if (fCurrentInfo->fMode == BackgroundImage::kAtOffset)
fCurrentInfo->fOffset = offset; fCurrentInfo->fOffset = offset;
@@ -895,8 +896,8 @@ 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())),
fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0); fIconLabelOutline->Value() == B_CONTROL_ON, 0, 0);
@@ -944,20 +945,21 @@ BackgroundsView::UpdateButtons()
&& fPicker->ValueAsColor() != BScreen().DesktopColor()) { && fPicker->ValueAsColor() != BScreen().DesktopColor()) {
hasChanged = true; hasChanged = true;
} else if (fCurrentInfo) { } else if (fCurrentInfo) {
if ((fIconLabelOutline->Value() == B_CONTROL_ON) ^ if ((fIconLabelOutline->Value() == B_CONTROL_ON)
fCurrentInfo->fTextWidgetLabelOutline) { ^ fCurrentInfo->fTextWidgetLabelOutline) {
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())))
{
hasChanged = true; hasChanged = true;
} else if (fCurrentInfo->fImageIndex > -1 && } else if (fCurrentInfo->fImageIndex > -1
fCurrentInfo->fMode == BackgroundImage::kAtOffset) { && fCurrentInfo->fMode == BackgroundImage::kAtOffset) {
BString oldString, newString; BString oldString, newString;
oldString << (int)fCurrentInfo->fOffset.x; oldString << (int)fCurrentInfo->fOffset.x;
if (oldString != BString(fXPlacementText->Text())) { if (oldString != BString(fXPlacementText->Text())) {
+36 -22
View File
@@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -9,8 +9,6 @@
#define BACKGROUNDS_VIEW_H #define BACKGROUNDS_VIEW_H
#include "BackgroundImage.h"
#include <View.h> #include <View.h>
#include <ColorControl.h> #include <ColorControl.h>
#include <Message.h> #include <Message.h>
@@ -31,15 +29,20 @@
#include <StringView.h> #include <StringView.h>
#include <Cursor.h> #include <Cursor.h>
#include "BackgroundImage.h"
#define SETTINGS_FILE "Backgrounds_settings" #define SETTINGS_FILE "Backgrounds_settings"
class ImageFilePanel; 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,
char shortcut = 0, uint32 modifiers = 0); BMessage* message, char shortcut = 0,
uint32 modifiers = 0);
int32 ImageIndex() { return fImageIndex; } int32 ImageIndex() { return fImageIndex; }
@@ -85,11 +88,13 @@ class PreView : public BControl {
protected: protected:
void MouseDown(BPoint point); void MouseDown(BPoint point);
void MouseUp(BPoint point); void MouseUp(BPoint point);
void MouseMoved(BPoint point, uint32 transit, const BMessage *message); void MouseMoved(BPoint point, uint32 transit,
const BMessage* message);
void AttachedToWindow(); void AttachedToWindow();
BPoint fOldPoint; BPoint fOldPoint;
float x_ratio, y_ratio; float x_ratio;
float y_ratio;
display_mode mode; display_mode mode;
BCursor fMoveHandCursor; BCursor fMoveHandCursor;
@@ -104,7 +109,8 @@ class BackgroundsView : public BBox {
void RefsReceived(BMessage* msg); void RefsReceived(BMessage* msg);
void SaveSettings(); void SaveSettings();
void WorkspaceActivated(uint32 oldWorkspaces, bool active); void WorkspaceActivated(uint32 oldWorkspaces,
bool active);
int32 AddImage(BPath path); int32 AddImage(BPath path);
Image* GetImage(int32 imageIndex); Image* GetImage(int32 imageIndex);
@@ -129,25 +135,33 @@ class BackgroundsView : public BBox {
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; // color picker BColorControl* fPicker;
BButton *fApply, *fRevert; // apply and revert buttons BButton* fApply;
BCheckBox *fIconLabelOutline; // label ckeckbox BButton* fRevert;
BMenu* fPlacementMenu, *fImageMenu, *fWorkspaceMenu; // the three comboboxes BCheckBox* fIconLabelOutline;
BTextControl *fXPlacementText, *fYPlacementText; // x and y textboxes BMenu* fPlacementMenu;
PreView *fPreView; // the view for previewing the result BMenu* fImageMenu;
BBox *fPreview; // the box which draws a computer/folder BMenu* fWorkspaceMenu;
BFilePanel *fFolderPanel; // the file panels for folders BTextControl* fXPlacementText;
ImageFilePanel *fPanel; // the file panels for images BTextControl* fYPlacementText;
PreView* fPreView;
BBox* fPreview;
BFilePanel* fFolderPanel;
ImageFilePanel* fPanel;
BackgroundImage *fCurrent; // the current BackgroundImage object BackgroundImage* fCurrent;
BackgroundImage::BackgroundImageInfo *fCurrentInfo;//the current BackgroundImageInfo object
entry_ref fCurrentRef; // the entry for the node which holds current BackgroundImage::BackgroundImageInfo* fCurrentInfo;
int32 fLastImageIndex, fLastWorkspaceIndex; // last indexes for cancel
BMessage fSettings; // settings loaded from settings directory entry_ref fCurrentRef;
int32 fLastImageIndex;
int32 fLastWorkspaceIndex;
BMessage fSettings;
BObjectList<BPath> fPathList; BObjectList<BPath> fPathList;
BObjectList<Image> fImageList; BObjectList<Image> fImageList;
+39 -28
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2005, Haiku, Inc. All Rights Reserved. * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -43,34 +43,42 @@ 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")
background->FindView("CountVw")->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); ->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
background->FindView("VScrollBar")->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); background->FindView("CountVw")
background->FindView("HScrollBar")->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP); ->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
background->FindView("VScrollBar")
->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
background->FindView("HScrollBar")
->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_TOP);
Window()->ResizeBy(0, 70); Window()->ResizeBy(0, 70);
background->FindView("PoseView")->SetResizingMode(poseViewResizingMode); background->FindView("PoseView")->SetResizingMode(poseViewResizingMode);
background->FindView("CountVw")->SetResizingMode(countVwResizingMode); background->FindView("CountVw")->SetResizingMode(countVwResizingMode);
background->FindView("VScrollBar")->SetResizingMode(vScrollBarResizingMode); background->FindView("VScrollBar")
background->FindView("HScrollBar")->SetResizingMode(hScrollBarResizingMode); ->SetResizingMode(vScrollBarResizingMode);
background->FindView("HScrollBar")
->SetResizingMode(hScrollBarResizingMode);
BRect rect(background->Bounds().left + 15, background->Bounds().bottom - 94, BRect rect(background->Bounds().left + 15,
background->Bounds().left + 122, background->Bounds().bottom - 15); background->Bounds().bottom - 94, background->Bounds().left + 122,
fImageView = new BView(rect, "ImageView", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, background->Bounds().bottom - 15);
B_SUBPIXEL_PRECISE); fImageView = new BView(rect, "ImageView",
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, 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().right, background->Bounds().bottom - 65); background->Bounds().bottom - 85, 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);
@@ -104,19 +112,22 @@ 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;
+17 -10
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2005, Haiku, Inc. All Rights Reserved. * Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -9,8 +9,9 @@
#define IMAGE_FILE_PANEL_H #define IMAGE_FILE_PANEL_H
#include <Node.h>
#include <FilePanel.h> #include <FilePanel.h>
#include <Node.h>
class BStringView; class BStringView;
class BView; class BView;
@@ -21,25 +22,30 @@ class CustomRefFilter : public BRefFilter {
CustomRefFilter(bool imageFiltering); CustomRefFilter(bool imageFiltering);
virtual ~CustomRefFilter() {}; virtual ~CustomRefFilter() {};
bool Filter(const entry_ref *ref, BNode* node, struct stat_beos *st, bool Filter(const entry_ref* ref, BNode* node,
const char *filetype); struct stat_beos* st, const char* filetype);
protected: protected:
bool fImageFiltering; // true for images only, false for directory only bool fImageFiltering;
// true for images
// false for directory
}; };
class ImageFilePanel : public BFilePanel { class ImageFilePanel : public BFilePanel {
public: public:
ImageFilePanel(file_panel_mode mode = B_OPEN_PANEL, ImageFilePanel(file_panel_mode mode = B_OPEN_PANEL,
BMessenger* target = NULL, const entry_ref* startDirectory = NULL, BMessenger* target = NULL,
uint32 nodeFlavors = 0, bool allowMultipleSelection = true, const entry_ref* startDirectory = NULL,
BMessage* message = NULL, BRefFilter* filter = NULL, uint32 nodeFlavors = 0,
bool modal = false, bool hideWhenDone = true); bool allowMultipleSelection = true,
BMessage* message = NULL,
BRefFilter* filter = NULL,
bool modal = false,
bool hideWhenDone = true);
~ImageFilePanel(); ~ImageFilePanel();
virtual void SelectionChanged(); virtual void SelectionChanged();
void Show(); void Show();
protected: protected:
@@ -49,3 +55,4 @@ class ImageFilePanel : public BFilePanel {
}; };
#endif // IMAGE_FILE_PANEL_H #endif // IMAGE_FILE_PANEL_H
-1
View File
@@ -13,4 +13,3 @@ Preference Backgrounds :
: Backgrounds.rdef : Backgrounds.rdef
; ;