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:
Matthew Wilber
2003-11-27 15:00:07 +00:00
parent 6e6e1d6443
commit 1f62b22aa0
2 changed files with 35 additions and 0 deletions
+34
View File
@@ -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
+1
View File
@@ -129,6 +129,7 @@ private:
void AnimateSelection(bool a);
void Notify(const char* status);
void AddToRecentDocuments();
void AddWhiteRect(BRect &rect);
void GetSelMergeRects(BRect &srcBits, BRect &destRect);
void MergeSelection();
void DeleteScaler();