* Coding style cleanup

* Some cleanup in member sorting
 * Some renaming of members for improved clarity
 * Removed _HasSelection() and use fHasSelection directly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37159 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-06-16 21:29:09 +00:00
parent e48ec1b5e7
commit 4fa7e62e8d
2 changed files with 320 additions and 265 deletions
+69 -67
View File
@@ -184,34 +184,37 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
uint32 flags)
:
BView(rect, name, resizingMode, flags),
fDither(BScreen().ColorSpace() == B_CMAP8),
fDocumentIndex(1),
fDocumentCount(1),
fBitmap(NULL),
fDisplayBitmap(NULL),
fSelectionBitmap(NULL),
fZoom(1.0),
fDither(BScreen().ColorSpace() == B_CMAP8),
fScaleBilinear(true),
fScaler(NULL),
#if DELAYED_SCALING
fScalingCountDown(SCALING_DELAY_TIME),
#endif
fInverted(false),
fBitmapLocationInView(0.0, 0.0),
fShrinkToBounds(false),
fZoomToBounds(false),
fShrinkOrZoomToBounds(false),
fFullScreen(false),
fLeft(0.0),
fTop(0.0),
fMovesImage(false),
fMakesSelection(false),
fDraggingBitmap(false),
fCreatingSelection(false),
fFirstPoint(0.0, 0.0),
fAnimateSelection(true),
fHasSelection(false),
fSlideShow(false),
fSlideShowDelay(3 * 10), // 3 seconds
fSlideShowCountDown(0),
#if DELAYED_SCALING
fScalingCountDown(SCALING_DELAY_TIME),
#endif
fShowCaption(false),
fInverted(false),
fShowingPopUpMenu(false),
fHideCursorCountDown(HIDE_CURSOR_DELAY_TIME),
fIsActiveWin(true),
@@ -253,11 +256,10 @@ ShowImageView::_InitPatterns()
for (int i = 0; i <= 7; i ++) {
fPatternLeft.data[i] = p1;
fPatternRight.data[i] = p2;
if ((i / 2) % 2 == 0) {
if ((i / 2) % 2 == 0)
p = 255;
} else {
else
p = 0;
}
fPatternUp.data[i] = p;
fPatternDown.data[i] = ~p;
}
@@ -267,37 +269,33 @@ ShowImageView::_InitPatterns()
void
ShowImageView::_RotatePatterns()
{
int i;
uchar p;
bool set;
// rotate up
p = fPatternUp.data[0];
for (i = 0; i <= 6; i ++) {
fPatternUp.data[i] = fPatternUp.data[i+1];
}
uchar p = fPatternUp.data[0];
for (int i = 0; i <= 6; i ++)
fPatternUp.data[i] = fPatternUp.data[i + 1];
fPatternUp.data[7] = p;
// rotate down
p = fPatternDown.data[7];
for (i = 7; i >= 1; i --) {
fPatternDown.data[i] = fPatternDown.data[i-1];
}
for (int i = 7; i >= 1; i --)
fPatternDown.data[i] = fPatternDown.data[i - 1];
fPatternDown.data[0] = p;
// rotate to left
p = fPatternLeft.data[0];
set = (p & 0x80) != 0;
bool set = (p & 0x80) != 0;
p <<= 1;
p &= 0xfe;
if (set) p |= 1;
if (set)
p |= 1;
memset(fPatternLeft.data, p, 8);
// rotate to right
p = fPatternRight.data[0];
set = (p & 1) != 0;
p >>= 1;
if (set) p |= 0x80;
if (set)
p |= 0x80;
memset(fPatternRight.data, p, 8);
}
@@ -313,7 +311,7 @@ void
ShowImageView::Pulse()
{
// animate marching ants
if (_HasSelection() && fAnimateSelection && fIsActiveWin) {
if (fHasSelection && fAnimateSelection && fIsActiveWin) {
_RotatePatterns();
_DrawSelectionBox();
}
@@ -328,7 +326,7 @@ ShowImageView::Pulse()
}
// Hide cursor in full screen mode
if (fFullScreen && !_HasSelection() && !fShowingPopUpMenu && fIsActiveWin) {
if (fFullScreen && !fHasSelection && !fShowingPopUpMenu && fIsActiveWin) {
if (fHideCursorCountDown <= 0)
be_app->ObscureCursor();
else
@@ -537,7 +535,7 @@ ShowImageView::SetImage(const entry_ref *ref)
// and clear everything
fUndo.Clear();
_SetHasSelection(false);
fMakesSelection = false;
fCreatingSelection = false;
_DeleteBitmap();
fBitmap = newBitmap;
fCurrentRef = *ref;
@@ -818,17 +816,17 @@ ShowImageView::_AlignBitmap()
void
ShowImageView::_Setup(BRect rect)
{
fLeft = floorf(rect.left);
fTop = floorf(rect.top);
fZoom = (rect.Width()+1.0) / (fBitmap->Bounds().Width()+1.0);
fBitmapLocationInView.x = floorf(rect.left);
fBitmapLocationInView.y = floorf(rect.top);
fZoom = (rect.Width() + 1.0) / (fBitmap->Bounds().Width() + 1.0);
}
BPoint
ShowImageView::_ImageToView(BPoint p) const
{
p.x = floorf(fZoom * p.x + fLeft);
p.y = floorf(fZoom * p.y + fTop);
p.x = floorf(fZoom * p.x + fBitmapLocationInView.x);
p.y = floorf(fZoom * p.y + fBitmapLocationInView.y);
return p;
}
@@ -836,8 +834,8 @@ ShowImageView::_ImageToView(BPoint p) const
BPoint
ShowImageView::_ViewToImage(BPoint p) const
{
p.x = floorf((p.x - fLeft) / fZoom);
p.y = floorf((p.y - fTop) / fZoom);
p.x = floorf((p.x - fBitmapLocationInView.x) / fZoom);
p.y = floorf((p.y - fBitmapLocationInView.y) / fZoom);
return p;
}
@@ -1006,7 +1004,7 @@ ShowImageView::Draw(BRect updateRect)
if (fShowCaption)
_DrawCaption();
if (_HasSelection()) {
if (fHasSelection) {
if (fSelectionBitmap != NULL) {
BRect srcRect;
BRect dstRect;
@@ -1022,21 +1020,25 @@ ShowImageView::Draw(BRect updateRect)
void
ShowImageView::_DrawSelectionBox()
{
if (fSelectionRect.Height() > 0.0 && fSelectionRect.Width() > 0.0) {
BRect r(fSelectionRect);
_ConstrainToImage(r);
r = _ImageToView(r);
// draw selection box *around* selection
r.InsetBy(-1, -1);
PushState();
rgb_color white = {255, 255, 255};
SetLowColor(white);
StrokeLine(BPoint(r.left, r.top), BPoint(r.right, r.top), fPatternLeft);
StrokeLine(BPoint(r.right, r.top+1), BPoint(r.right, r.bottom-1), fPatternUp);
StrokeLine(BPoint(r.left, r.bottom), BPoint(r.right, r.bottom), fPatternRight);
StrokeLine(BPoint(r.left, r.top+1), BPoint(r.left, r.bottom-1), fPatternDown);
PopState();
}
if (fSelectionRect.Height() <= 0.0 || fSelectionRect.Width() <= 0.0)
return;
BRect r(fSelectionRect);
_ConstrainToImage(r);
r = _ImageToView(r);
// draw selection box *around* selection
r.InsetBy(-1, -1);
PushState();
SetLowColor(255, 255, 255);
StrokeLine(BPoint(r.left, r.top), BPoint(r.right, r.top),
fPatternLeft);
StrokeLine(BPoint(r.right, r.top + 1), BPoint(r.right, r.bottom - 1),
fPatternUp);
StrokeLine(BPoint(r.left, r.bottom), BPoint(r.right, r.bottom),
fPatternRight);
StrokeLine(BPoint(r.left, r.top + 1), BPoint(r.left, r.bottom - 1),
fPatternDown);
PopState();
}
@@ -1089,7 +1091,7 @@ ShowImageView::_CopySelection(uchar alpha, bool imageSize)
{
bool hasAlpha = alpha != 255;
if (!_HasSelection())
if (!fHasSelection)
return NULL;
BRect rect(0, 0, fSelectionRect.Width(), fSelectionRect.Height());
@@ -1381,7 +1383,7 @@ ShowImageView::_MoveImage()
// in case we miss MouseUp
if ((_GetMouseButtons() & B_TERTIARY_MOUSE_BUTTON) == 0)
fMovesImage = false;
fDraggingBitmap = false;
}
@@ -1467,7 +1469,7 @@ ShowImageView::_MergeWithBitmap(BBitmap* merge, BRect selection)
void
ShowImageView::_MergeSelection()
{
if (!_HasSelection())
if (!fHasSelection)
return;
if (fSelectionBitmap == NULL) {
@@ -1494,7 +1496,7 @@ ShowImageView::MouseDown(BPoint position)
point = _ViewToImage(position);
buttons = _GetMouseButtons();
if (_HasSelection() && fSelectionRect.Contains(point)
if (fHasSelection && fSelectionRect.Contains(point)
&& (buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON))) {
if (!fSelectionBitmap)
fSelectionBitmap = _CopySelection();
@@ -1536,7 +1538,7 @@ ShowImageView::MouseDown(BPoint position)
// begin new selection
_SetHasSelection(true);
fMakesSelection = true;
fCreatingSelection = true;
SetMouseEventMask(B_POINTER_EVENTS);
_ConstrainToImage(point);
fFirstPoint = point;
@@ -1548,7 +1550,7 @@ ShowImageView::MouseDown(BPoint position)
} else if (buttons == B_TERTIARY_MOUSE_BUTTON) {
// move image in window
SetMouseEventMask(B_POINTER_EVENTS);
fMovesImage = true;
fDraggingBitmap = true;
fFirstPoint = ConvertToScreen(position);
}
}
@@ -1573,7 +1575,7 @@ ShowImageView::_UpdateSelectionRect(BPoint point, bool final)
} else
_UpdateStatusText();
if (oldSelection != fCopyFromRect || !_HasSelection()) {
if (oldSelection != fCopyFromRect || !fHasSelection) {
BRect updateRect;
updateRect = oldSelection | fCopyFromRect;
updateRect = _ImageToView(updateRect);
@@ -1587,9 +1589,9 @@ void
ShowImageView::MouseMoved(BPoint point, uint32 state, const BMessage *message)
{
fHideCursorCountDown = HIDE_CURSOR_DELAY_TIME;
if (fMakesSelection) {
if (fCreatingSelection) {
_UpdateSelectionRect(point, false);
} else if (fMovesImage) {
} else if (fDraggingBitmap) {
_MoveImage();
}
}
@@ -1598,12 +1600,12 @@ ShowImageView::MouseMoved(BPoint point, uint32 state, const BMessage *message)
void
ShowImageView::MouseUp(BPoint point)
{
if (fMakesSelection) {
if (fCreatingSelection) {
_UpdateSelectionRect(point, true);
fMakesSelection = false;
} else if (fMovesImage) {
fCreatingSelection = false;
} else if (fDraggingBitmap) {
_MoveImage();
fMovesImage = false;
fDraggingBitmap = false;
}
_AnimateSelection(true);
}
@@ -2031,7 +2033,7 @@ ShowImageView::_AddWhiteRect(BRect &rect)
void
ShowImageView::_RemoveSelection(bool toClipboard, bool neverCutBackground)
{
if (!_HasSelection())
if (!fHasSelection)
return;
BRect rect = fSelectionRect;
@@ -2161,7 +2163,7 @@ ShowImageView::_SetHasSelection(bool hasSelection)
void
ShowImageView::CopySelectionToClipboard()
{
if (!_HasSelection() || !be_clipboard->Lock())
if (!fHasSelection || !be_clipboard->Lock())
return;
be_clipboard->Clear();
+251 -198
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2003-2010, Haiku, Inc. All Rights Reserved.
* Copyright 2004-2005 yellowTAB GmbH. All Rights Reserverd.
* Copyright 2006 Bernd Korz. All Rights Reserved
* Distributed under the terms of the MIT License.
@@ -26,7 +26,8 @@
#include <View.h>
// delay scaling operation, so that a sequence of zoom in/out operations works smoother
// Delay scaling operation, so that a sequence of zoom in/out operations works
// smoother
#define DELAYED_SCALING 1
// the delay time in 1/10 seconds
#define SCALING_DELAY_TIME 3
@@ -39,223 +40,275 @@
class ProgressWindow;
class ShowImageView : public BView {
public:
ShowImageView(BRect rect, const char *name, uint32 resizingMode,
uint32 flags);
virtual ~ShowImageView();
public:
ShowImageView(BRect rect, const char* name,
uint32 resizingMode, uint32 flags);
virtual ~ShowImageView();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect);
virtual void FrameResized(float width, float height);
virtual void MouseDown(BPoint point);
virtual void MouseMoved(BPoint point, uint32 state, const BMessage *message);
virtual void MouseUp(BPoint point);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void Pulse();
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void Draw(BRect updateRect);
virtual void FrameResized(float width, float height);
virtual void MouseDown(BPoint point);
virtual void MouseMoved(BPoint point, uint32 state,
const BMessage* dragMessage);
virtual void MouseUp(BPoint point);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void Pulse();
virtual void MessageReceived(BMessage *message);
virtual void WindowActivated(bool active);
virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active);
void SetTrackerMessenger(const BMessenger& trackerMessenger);
status_t SetImage(const entry_ref *ref);
const entry_ref* Image() const { return &fCurrentRef; }
void SetTrackerMessenger(
const BMessenger& trackerMessenger);
status_t SetImage(const entry_ref* ref);
const entry_ref* Image() const { return &fCurrentRef; }
void SaveToFile(BDirectory* dir, const char* name, BBitmap* bitmap,
const translation_format* format);
void SetDither(bool dither);
bool GetDither() const { return fDither; }
void SetShowCaption(bool show);
void SetShrinkToBounds(bool enable);
bool GetShrinkToBounds() const { return fShrinkToBounds; }
void SetZoomToBounds(bool enable);
bool GetZoomToBounds() const { return fZoomToBounds; }
void SetFullScreen(bool fullScreen);
BBitmap *GetBitmap();
void GetName(BString *name);
void GetPath(BString *name);
void SetScaleBilinear(bool b);
bool GetScaleBilinear() { return fScaleBilinear; }
void SaveToFile(BDirectory* dir, const char* name,
BBitmap* bitmap,
const translation_format* format);
void SetDither(bool dither);
bool GetDither() const { return fDither; }
void SetScaleBilinear(bool b);
bool GetScaleBilinear() { return fScaleBilinear; }
void SetShowCaption(bool show);
void SetShrinkToBounds(bool enable);
bool GetShrinkToBounds() const
{ return fShrinkToBounds; }
void SetZoomToBounds(bool enable);
bool GetZoomToBounds() const
{ return fZoomToBounds; }
void SetFullScreen(bool fullScreen);
void FixupScrollBar(orientation o, float bitmapLength, float viewLength);
void FixupScrollBars();
BBitmap* GetBitmap();
void GetName(BString* name);
void GetPath(BString* name);
int32 CurrentPage();
int32 PageCount();
void FixupScrollBar(enum orientation orientation,
float bitmapLength, float viewLength);
void FixupScrollBars();
void Undo();
void Cut();
void Paste();
void SelectAll();
void ClearSelection();
void Undo();
void Cut();
void Paste();
void SelectAll();
void ClearSelection();
void CopySelectionToClipboard();
void CopySelectionToClipboard();
void FirstPage();
void LastPage();
void NextPage();
void PrevPage();
void GoToPage(int32 page);
bool NextFile();
bool PrevFile();
bool HasNextFile();
bool HasPrevFile();
void SetSlideShowDelay(float seconds);
float GetSlideShowDelay() const { return fSlideShowDelay / 10.0; }
bool SlideShowStarted() const { return fSlideShow; }
void StartSlideShow();
void StopSlideShow();
void SetZoom(float zoom);
void ZoomIn();
void ZoomOut();
int32 CurrentPage();
int32 PageCount();
// Image manipulation
void Rotate(int degree); // 90 and 270 only
void Flip(bool vertical);
void Invert();
void ResizeImage(int w, int h);
void FirstPage();
void LastPage();
void NextPage();
void PrevPage();
void GoToPage(int32 page);
void SetIcon(bool clear);
bool NextFile();
bool PrevFile();
bool HasNextFile();
bool HasPrevFile();
private:
ShowImageUndo fUndo;
enum image_orientation {
k0, // 0
k90, // 1
k180, // 2
k270, // 3
k0V, // 4
k90V, // 5
k0H, // 6
k270V, // 7
kNumberOfOrientations,
};
void _InitPatterns();
void _RotatePatterns();
void _RemoveSelection(bool bToClipboard, bool neverCutBackground = false);
bool _HasSelection() { return fHasSelection; }
void _SetHasSelection(bool bHasSelection);
void _AnimateSelection(bool a);
void _SendMessageToWindow(BMessage *message);
void _SendMessageToWindow(uint32 code);
void _Notify();
void _UpdateStatusText();
void _AddToRecentDocuments();
void _AddWhiteRect(BRect &rect);
void _GetMergeRects(BBitmap *merge, BRect selection, BRect &srcBits, BRect &destRect);
void _GetSelectionMergeRects(BRect &srcBits, BRect &destRect);
status_t _SetSelection(const entry_ref *pref, BPoint point);
status_t _PasteBitmap(BBitmap *bitmap, BPoint point);
void _MergeWithBitmap(BBitmap *merge, BRect selection);
void _MergeSelection();
void _DeleteScaler();
void _DeleteBitmap();
void _DeleteSelectionBitmap();
int32 _BytesPerPixel(color_space cs) const;
void _CopyPixel(uchar* dest, int32 destX, int32 destY, int32 destBPR,
uchar* src, int32 x, int32 y, int32 bpr, int32 bpp);
void _InvertPixel(int32 x, int32 y, uchar* dest, int32 destBPR, uchar* src,
int32 bpr, int32 bpp);
void _DoImageOperation(enum ImageProcessor::operation op, bool quiet = false);
void _UserDoImageOperation(enum ImageProcessor::operation op, bool quiet = false);
BRect _AlignBitmap();
void _Setup(BRect r);
BPoint _ImageToView(BPoint p) const;
BPoint _ViewToImage(BPoint p) const;
BRect _ImageToView(BRect r) const;
bool _IsImage(const entry_ref* pref);
static int _CompareEntries(const void* a, const void* b);
void _FreeEntries(BList* entries);
void _SetTrackerSelectionToCurrent();
bool _FindNextImage(entry_ref *in_current, entry_ref *out_image,
bool next, bool rewind);
bool _ShowNextImage(bool next, bool rewind);
bool _FirstFile();
void _ConstrainToImage(BPoint &point);
void _ConstrainToImage(BRect &rect);
BBitmap* _CopyFromRect(BRect srcRect);
BBitmap* _CopySelection(uchar alpha = 255, bool imageSize = true);
bool _AddSupportedTypes(BMessage* msg, BBitmap* bitmap);
void _BeginDrag(BPoint sourcePoint);
void _SendInMessage(BMessage* msg, BBitmap* bitmap, translation_format* format);
bool _OutputFormatForType(BBitmap* bitmap, const char* type,
translation_format* format);
void _HandleDrop(BMessage* msg);
void _MoveImage();
uint32 _GetMouseButtons();
void _UpdateSelectionRect(BPoint point, bool final);
void _DrawBorder(BRect border);
void _LayoutCaption(BFont &font, BPoint &textPos, BRect &background);
void _DrawCaption();
void _UpdateCaption();
void _DrawSelectionBox();
Scaler* _GetScaler(BRect rect);
void _DrawImage(BRect rect);
float _LimitToRange(float v, orientation o, bool absolute);
void _ScrollRestricted(float x, float y, bool absolute);
void _ScrollRestrictedTo(float x, float y);
void _ScrollRestrictedBy(float x, float y);
void _MouseWheelChanged(BMessage* msg);
void _ShowPopUpMenu(BPoint screen);
void _SettingsSetBool(const char* name, bool value);
void _SetIcon(bool clear, icon_size which);
void _ToggleSlideShow();
void _ExitFullScreen();
void SetSlideShowDelay(float seconds);
float GetSlideShowDelay() const
{ return fSlideShowDelay / 10.0; }
bool SlideShowStarted() const { return fSlideShow; }
void StartSlideShow();
void StopSlideShow();
void SetZoom(float zoom);
void ZoomIn();
void ZoomOut();
BMessenger fTrackerMessenger; // of the window that this was launched from
entry_ref fCurrentRef; // of the image
bool fDither; // dither the image
int32 fDocumentIndex; // of the image in the file
int32 fDocumentCount; // number of images in the file
BBitmap *fBitmap; // the original image
BBitmap *fDisplayBitmap;
// the image to be displayed
// (== fBitmap if the bitmap can be displayed as is)
BBitmap *fSelectionBitmap; // the bitmap in the selection
float fZoom; // factor to be used to display the image
bool fScaleBilinear; // use bilinear scaling?
Scaler* fScaler; // holds the scaled image if bilinear scaling is enabled
bool fShrinkToBounds;
bool fZoomToBounds;
bool fShrinkOrZoomToBounds;
bool fFullScreen; // is the image displayed fullscreen?
float fLeft; // the origin of the image in the view
float fTop;
bool fMovesImage; // is the image being moved with the mouse
bool fMakesSelection; // is a selection being made
BPoint fFirstPoint; // first point in image space of selection
bool fAnimateSelection; // marching ants
bool fHasSelection; // is fSelectionRect valid
BRect fSelectionRect; // the current location of the selection rectangle
BRect fCopyFromRect;
// the portion of the background bitmap the selection is made from
pattern fPatternUp, fPatternDown, fPatternLeft, fPatternRight;
bool fSlideShow; // is slide show enabled?
int fSlideShowDelay; // in pulse rate units
int fSlideShowCountDown; // shows next image if it reaches zero
// Image manipulation
void Rotate(int degree); // 90 and 270 only
void Flip(bool vertical);
void Invert();
void ResizeImage(int width, int height);
void SetIcon(bool clear);
private:
enum image_orientation {
k0, // 0
k90, // 1
k180, // 2
k270, // 3
k0V, // 4
k90V, // 5
k0H, // 6
k270V, // 7
kNumberOfOrientations,
};
void _InitPatterns();
void _RotatePatterns();
void _RemoveSelection(bool bToClipboard,
bool neverCutBackground = false);
void _SetHasSelection(bool bHasSelection);
void _AnimateSelection(bool a);
void _SendMessageToWindow(BMessage *message);
void _SendMessageToWindow(uint32 code);
void _Notify();
void _UpdateStatusText();
void _AddToRecentDocuments();
void _AddWhiteRect(BRect& rect);
void _GetMergeRects(BBitmap* merge,
BRect selection, BRect& srcRect,
BRect& dstRect);
void _GetSelectionMergeRects(BRect& srcRect,
BRect& dstRect);
status_t _SetSelection(const entry_ref* ref,
BPoint point);
status_t _PasteBitmap(BBitmap* bitmap, BPoint point);
void _MergeWithBitmap(BBitmap* merge,
BRect selection);
void _MergeSelection();
void _DeleteScaler();
void _DeleteBitmap();
void _DeleteSelectionBitmap();
int32 _BytesPerPixel(color_space cs) const;
void _CopyPixel(uchar* dest, int32 destX,
int32 destY, int32 destBPR, uchar* src,
int32 x, int32 y, int32 bpr, int32 bpp);
void _InvertPixel(int32 x, int32 y, uchar* dest,
int32 destBPR, uchar* src, int32 bpr,
int32 bpp);
void _DoImageOperation(
enum ImageProcessor::operation op,
bool quiet = false);
void _UserDoImageOperation(
enum ImageProcessor::operation op,
bool quiet = false);
BRect _AlignBitmap();
void _Setup(BRect r);
BPoint _ImageToView(BPoint p) const;
BPoint _ViewToImage(BPoint p) const;
BRect _ImageToView(BRect r) const;
bool _IsImage(const entry_ref* pref);
static int _CompareEntries(const void* a, const void* b);
void _FreeEntries(BList* entries);
void _SetTrackerSelectionToCurrent();
bool _FindNextImage(entry_ref* inCurrent,
entry_ref* outImage, bool next,
bool rewind);
bool _ShowNextImage(bool next, bool rewind);
bool _FirstFile();
void _ConstrainToImage(BPoint& point);
void _ConstrainToImage(BRect& rect);
BBitmap* _CopyFromRect(BRect srcRect);
BBitmap* _CopySelection(uchar alpha = 255,
bool imageSize = true);
bool _AddSupportedTypes(BMessage* message,
BBitmap* bitmap);
void _BeginDrag(BPoint sourcePoint);
void _SendInMessage(BMessage* message,
BBitmap* bitmap,
translation_format* format);
bool _OutputFormatForType(BBitmap* bitmap,
const char* type,
translation_format* format);
void _HandleDrop(BMessage* message);
void _MoveImage();
uint32 _GetMouseButtons();
void _UpdateSelectionRect(BPoint point, bool final);
void _DrawBorder(BRect border);
void _LayoutCaption(BFont& font, BPoint& textPos,
BRect& background);
void _DrawCaption();
void _UpdateCaption();
void _DrawSelectionBox();
Scaler* _GetScaler(BRect rect);
void _DrawImage(BRect rect);
float _LimitToRange(float v, orientation o,
bool absolute);
void _ScrollRestricted(float x, float y,
bool absolute);
void _ScrollRestrictedTo(float x, float y);
void _ScrollRestrictedBy(float x, float y);
void _MouseWheelChanged(BMessage* message);
void _ShowPopUpMenu(BPoint screen);
void _SettingsSetBool(const char* name, bool value);
void _SetIcon(bool clear, icon_size which);
void _ToggleSlideShow();
void _ExitFullScreen();
private:
ShowImageUndo fUndo;
BMessenger fTrackerMessenger;
// of the window that this was launched from
entry_ref fCurrentRef;
int32 fDocumentIndex;
// of the image in the file
int32 fDocumentCount;
// number of images in the file
BBitmap* fBitmap;
BBitmap* fDisplayBitmap;
BBitmap* fSelectionBitmap;
float fZoom;
bool fDither;
bool fScaleBilinear;
Scaler* fScaler;
#if DELAYED_SCALING
int fScalingCountDown;
int fScalingCountDown;
#endif
bool fInverted;
BPoint fBitmapLocationInView;
bool fShrinkToBounds;
bool fZoomToBounds;
bool fShrinkOrZoomToBounds;
bool fFullScreen;
bool fDraggingBitmap;
bool fCreatingSelection;
BPoint fFirstPoint;
// first point in image space of selection
bool fAnimateSelection;
bool fHasSelection;
BRect fSelectionRect;
BRect fCopyFromRect;
// the portion of the background bitmap the selection is made
// from
pattern fPatternUp;
pattern fPatternDown;
pattern fPatternLeft;
pattern fPatternRight;
bool fShowCaption; // display caption?
BString fCaption; // caption text
bool fSlideShow;
int fSlideShowDelay;
// in pulse rate units
int fSlideShowCountDown;
// shows next image if it reaches zero
bool fShowCaption;
BString fCaption;
BString fImageType; // Type of image, for use in status bar and caption
BString fImageMime;
BString fImageType;
// Type of image, for use in status bar and caption
BString fImageMime;
bool fInverted;
bool fShowingPopUpMenu;
bool fShowingPopUpMenu;
int fHideCursorCountDown;
// Hides the cursor when it reaches zero
bool fIsActiveWin;
// Is the parent window the active window?
int fHideCursorCountDown; // Hides the cursor when it reaches zero
bool fIsActiveWin; // Is the parent window the active window?
ProgressWindow* fProgressWindow;
ProgressWindow* fProgressWindow;
enum image_orientation fImageOrientation;
static enum image_orientation fTransformation[
ImageProcessor::kNumberOfAffineTransformations][kNumberOfOrientations];
image_orientation fImageOrientation;
static image_orientation fTransformation[
ImageProcessor
::kNumberOfAffineTransformations]
[kNumberOfOrientations];
};
#endif // SHOW_IMAGE_VIEW_H