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;
|
||||
}
|
||||
|
||||
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
|
||||
ShowImageView::Cut()
|
||||
{
|
||||
BRect rect = fSelectionRect;
|
||||
bool bCutBackground = (fSelBitmap) ? false : true;
|
||||
|
||||
CopySelectionToClipboard();
|
||||
ClearSelection();
|
||||
|
||||
if (bCutBackground)
|
||||
// If the user hasn't dragged the selection,
|
||||
// paint a white rectangle where the selection was
|
||||
AddWhiteRect(rect);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user