Fixed Edit-->Clear to leave behind a white box if the selection box is not moved after it is made, added Undo capability for Cut and Clear actions
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5719 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0552c71396
commit
75238186d7
@ -1594,19 +1594,37 @@ ShowImageView::AddWhiteRect(BRect &rect)
|
||||
delete bitmap;
|
||||
}
|
||||
|
||||
void
|
||||
ShowImageView::RemoveSelection(bool bToClipboard)
|
||||
{
|
||||
if (HasSelection()) {
|
||||
BRect rect = fSelectionRect;
|
||||
bool bCutBackground = (fSelBitmap) ? false : true;
|
||||
BBitmap *selection, *restore = NULL;
|
||||
selection = CopySelection();
|
||||
|
||||
if (bToClipboard)
|
||||
CopySelectionToClipboard();
|
||||
SetHasSelection(false);
|
||||
|
||||
if (bCutBackground) {
|
||||
// If the user hasn't dragged the selection,
|
||||
// paint a white rectangle where the selection was
|
||||
restore = CopyFromRect(rect);
|
||||
AddWhiteRect(rect);
|
||||
}
|
||||
|
||||
fUndo.SetTo(rect, restore, selection);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
// Copy the selection to the clipboard,
|
||||
// then remove it
|
||||
RemoveSelection(true);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1661,10 +1679,9 @@ ShowImageView::SelectAll()
|
||||
void
|
||||
ShowImageView::ClearSelection()
|
||||
{
|
||||
if (HasSelection()) {
|
||||
SetHasSelection(false);
|
||||
Invalidate();
|
||||
}
|
||||
// Remove the selection,
|
||||
// DON'T copy it to the clipboard
|
||||
RemoveSelection(false);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -129,6 +129,7 @@ private:
|
||||
};
|
||||
void InitPatterns();
|
||||
void RotatePatterns();
|
||||
void RemoveSelection(bool bToClipboard);
|
||||
bool HasSelection() { return fHasSelection; }
|
||||
void SetHasSelection(bool bHasSelection);
|
||||
void AnimateSelection(bool a);
|
||||
|
Loading…
Reference in New Issue
Block a user