Removed unneeded calls to Invalidate(), changed minimum size for selection rectangle so that users can click in an empty section of the window to unselect the selection
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5641 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -188,7 +188,7 @@ ShowImageView::ShowImageView(BRect rect, const char *name, uint32 resizingMode,
|
|||||||
fDocumentIndex = 1;
|
fDocumentIndex = 1;
|
||||||
fDocumentCount = 1;
|
fDocumentCount = 1;
|
||||||
fAnimateSelection = true;
|
fAnimateSelection = true;
|
||||||
fbHasSelection = false;
|
fHasSelection = false;
|
||||||
fShrinkToBounds = false;
|
fShrinkToBounds = false;
|
||||||
fZoomToBounds = false;
|
fZoomToBounds = false;
|
||||||
fHasBorder = true;
|
fHasBorder = true;
|
||||||
@@ -1020,10 +1020,8 @@ ShowImageView::MoveImage()
|
|||||||
fFirstPoint = point;
|
fFirstPoint = point;
|
||||||
ScrollRestrictedBy(delta.x, delta.y);
|
ScrollRestrictedBy(delta.x, delta.y);
|
||||||
// in case we miss MouseUp
|
// in case we miss MouseUp
|
||||||
if ((GetMouseButtons() & B_TERTIARY_MOUSE_BUTTON) == 0) {
|
if ((GetMouseButtons() & B_TERTIARY_MOUSE_BUTTON) == 0)
|
||||||
fMovesImage = false;
|
fMovesImage = false;
|
||||||
Invalidate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
@@ -1167,12 +1165,12 @@ ShowImageView::MouseDown(BPoint position)
|
|||||||
SetMouseEventMask(B_POINTER_EVENTS);
|
SetMouseEventMask(B_POINTER_EVENTS);
|
||||||
fMovesImage = true;
|
fMovesImage = true;
|
||||||
fFirstPoint = ConvertToScreen(position);
|
fFirstPoint = ConvertToScreen(position);
|
||||||
Invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::UpdateSelectionRect(BPoint point, bool final) {
|
ShowImageView::UpdateSelectionRect(BPoint point, bool final)
|
||||||
|
{
|
||||||
BRect oldSelection = fCopyFromRect;
|
BRect oldSelection = fCopyFromRect;
|
||||||
point = ViewToImage(point);
|
point = ViewToImage(point);
|
||||||
ConstrainToImage(point);
|
ConstrainToImage(point);
|
||||||
@@ -1182,10 +1180,9 @@ ShowImageView::UpdateSelectionRect(BPoint point, bool final) {
|
|||||||
fCopyFromRect.bottom = max(fFirstPoint.y, point.y);
|
fCopyFromRect.bottom = max(fFirstPoint.y, point.y);
|
||||||
fSelectionRect = fCopyFromRect;
|
fSelectionRect = fCopyFromRect;
|
||||||
if (final) {
|
if (final) {
|
||||||
// selection must contain a few pixels
|
// selection must be at least 2 pixels wide or 2 pixels tall
|
||||||
if ((fCopyFromRect.Width()+1.0) * (fCopyFromRect.Height()+1.0) < 1) {
|
if (fCopyFromRect.Width() < 1.0 && fCopyFromRect.Height() < 1.0)
|
||||||
SetHasSelection(false);
|
SetHasSelection(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (oldSelection != fCopyFromRect || !HasSelection()) {
|
if (oldSelection != fCopyFromRect || !HasSelection()) {
|
||||||
BRect updateRect;
|
BRect updateRect;
|
||||||
@@ -1214,10 +1211,8 @@ ShowImageView::MouseUp(BPoint point)
|
|||||||
fMakesSelection = false;
|
fMakesSelection = false;
|
||||||
} else if (fMovesImage) {
|
} else if (fMovesImage) {
|
||||||
MoveImage();
|
MoveImage();
|
||||||
if (fMovesImage) {
|
if (fMovesImage)
|
||||||
fMovesImage = false;
|
fMovesImage = false;
|
||||||
Invalidate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AnimateSelection(true);
|
AnimateSelection(true);
|
||||||
}
|
}
|
||||||
@@ -1543,10 +1538,10 @@ void
|
|||||||
ShowImageView::SetHasSelection(bool bHasSelection)
|
ShowImageView::SetHasSelection(bool bHasSelection)
|
||||||
{
|
{
|
||||||
DeleteSelBitmap();
|
DeleteSelBitmap();
|
||||||
fbHasSelection = bHasSelection;
|
fHasSelection = bHasSelection;
|
||||||
|
|
||||||
BMessage msg(MSG_SELECTION);
|
BMessage msg(MSG_SELECTION);
|
||||||
msg.AddBool("has_selection", fbHasSelection);
|
msg.AddBool("has_selection", fHasSelection);
|
||||||
BMessenger msgr(Window());
|
BMessenger msgr(Window());
|
||||||
msgr.SendMessage(&msg);
|
msgr.SendMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ private:
|
|||||||
};
|
};
|
||||||
void InitPatterns();
|
void InitPatterns();
|
||||||
void RotatePatterns();
|
void RotatePatterns();
|
||||||
bool HasSelection() { return fbHasSelection; }
|
bool HasSelection() { return fHasSelection; }
|
||||||
void SetHasSelection(bool bHasSelection);
|
void SetHasSelection(bool bHasSelection);
|
||||||
void AnimateSelection(bool a);
|
void AnimateSelection(bool a);
|
||||||
void Notify(const char* status);
|
void Notify(const char* status);
|
||||||
@@ -203,7 +203,7 @@ private:
|
|||||||
bool fMakesSelection; // is a selection being made
|
bool fMakesSelection; // is a selection being made
|
||||||
BPoint fFirstPoint; // first point in image space of selection
|
BPoint fFirstPoint; // first point in image space of selection
|
||||||
bool fAnimateSelection; // marching ants
|
bool fAnimateSelection; // marching ants
|
||||||
bool fbHasSelection; // is fSelectionRect valid
|
bool fHasSelection; // is fSelectionRect valid
|
||||||
BRect fSelectionRect; // the current location of the selection rectangle
|
BRect fSelectionRect; // the current location of the selection rectangle
|
||||||
BRect fCopyFromRect;
|
BRect fCopyFromRect;
|
||||||
// the portion of the background bitmap the selection is made from
|
// the portion of the background bitmap the selection is made from
|
||||||
|
|||||||
Reference in New Issue
Block a user