Changed Cut behavior to match Be's version so that if the user Cuts a selection before moving it, the selection is cut, and a white rectangle is left in its place. If the selection is dragged before the Cut command is used, a white rectangle is not drawn.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5489 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1411,11 +1411,45 @@ ShowImageView::PageCount()
|
|||||||
return fDocumentCount;
|
return fDocumentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ShowImageView::AddWhiteRect(BRect &rect)
|
||||||
|
{
|
||||||
|
// Paint white rectangle, using rect, into the background image
|
||||||
|
BView view(fBitmap->Bounds(), NULL, B_FOLLOW_NONE, B_WILL_DRAW);
|
||||||
|
BBitmap *bitmap = new BBitmap(fBitmap->Bounds(), fBitmap->ColorSpace(), true);
|
||||||
|
if (bitmap == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (bitmap->Lock()) {
|
||||||
|
bitmap->AddChild(&view);
|
||||||
|
view.DrawBitmap(fBitmap, fBitmap->Bounds());
|
||||||
|
|
||||||
|
view.FillRect(rect, B_SOLID_LOW);
|
||||||
|
// draw white rect
|
||||||
|
|
||||||
|
view.Sync();
|
||||||
|
bitmap->RemoveChild(&view);
|
||||||
|
bitmap->Unlock();
|
||||||
|
|
||||||
|
DeleteBitmap();
|
||||||
|
fBitmap = bitmap;
|
||||||
|
} else
|
||||||
|
delete bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::Cut()
|
ShowImageView::Cut()
|
||||||
{
|
{
|
||||||
|
BRect rect = fSelectionRect;
|
||||||
|
bool bCutBackground = (fSelBitmap) ? false : true;
|
||||||
|
|
||||||
CopySelectionToClipboard();
|
CopySelectionToClipboard();
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
|
|
||||||
|
if (bCutBackground)
|
||||||
|
// If the user hasn't dragged the selection,
|
||||||
|
// paint a white rectangle where the selection was
|
||||||
|
AddWhiteRect(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ private:
|
|||||||
void AnimateSelection(bool a);
|
void AnimateSelection(bool a);
|
||||||
void Notify(const char* status);
|
void Notify(const char* status);
|
||||||
void AddToRecentDocuments();
|
void AddToRecentDocuments();
|
||||||
|
void AddWhiteRect(BRect &rect);
|
||||||
void GetSelMergeRects(BRect &srcBits, BRect &destRect);
|
void GetSelMergeRects(BRect &srcBits, BRect &destRect);
|
||||||
void MergeSelection();
|
void MergeSelection();
|
||||||
void DeleteScaler();
|
void DeleteScaler();
|
||||||
|
|||||||
Reference in New Issue
Block a user