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
@ -1595,18 +1595,36 @@ ShowImageView::AddWhiteRect(BRect &rect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShowImageView::Cut()
|
ShowImageView::RemoveSelection(bool bToClipboard)
|
||||||
{
|
{
|
||||||
|
if (HasSelection()) {
|
||||||
BRect rect = fSelectionRect;
|
BRect rect = fSelectionRect;
|
||||||
bool bCutBackground = (fSelBitmap) ? false : true;
|
bool bCutBackground = (fSelBitmap) ? false : true;
|
||||||
|
BBitmap *selection, *restore = NULL;
|
||||||
|
selection = CopySelection();
|
||||||
|
|
||||||
|
if (bToClipboard)
|
||||||
CopySelectionToClipboard();
|
CopySelectionToClipboard();
|
||||||
ClearSelection();
|
SetHasSelection(false);
|
||||||
|
|
||||||
if (bCutBackground)
|
if (bCutBackground) {
|
||||||
// If the user hasn't dragged the selection,
|
// If the user hasn't dragged the selection,
|
||||||
// paint a white rectangle where the selection was
|
// paint a white rectangle where the selection was
|
||||||
|
restore = CopyFromRect(rect);
|
||||||
AddWhiteRect(rect);
|
AddWhiteRect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
fUndo.SetTo(rect, restore, selection);
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ShowImageView::Cut()
|
||||||
|
{
|
||||||
|
// Copy the selection to the clipboard,
|
||||||
|
// then remove it
|
||||||
|
RemoveSelection(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1661,10 +1679,9 @@ ShowImageView::SelectAll()
|
|||||||
void
|
void
|
||||||
ShowImageView::ClearSelection()
|
ShowImageView::ClearSelection()
|
||||||
{
|
{
|
||||||
if (HasSelection()) {
|
// Remove the selection,
|
||||||
SetHasSelection(false);
|
// DON'T copy it to the clipboard
|
||||||
Invalidate();
|
RemoveSelection(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -129,6 +129,7 @@ private:
|
|||||||
};
|
};
|
||||||
void InitPatterns();
|
void InitPatterns();
|
||||||
void RotatePatterns();
|
void RotatePatterns();
|
||||||
|
void RemoveSelection(bool bToClipboard);
|
||||||
bool HasSelection() { return fHasSelection; }
|
bool HasSelection() { return fHasSelection; }
|
||||||
void SetHasSelection(bool bHasSelection);
|
void SetHasSelection(bool bHasSelection);
|
||||||
void AnimateSelection(bool a);
|
void AnimateSelection(bool a);
|
||||||
|
Loading…
Reference in New Issue
Block a user