* Update paste command after cut/copy.

git-svn-id: trunk@3801 -
This commit is contained in:
daniel 2006-06-04 21:24:16 +00:00
parent c5cbdda62e
commit 86fe721eea

View File

@ -5824,35 +5824,41 @@ end;
{$endif WinClipSupported} {$endif WinClipSupported}
function TCustomCodeEditor.ClipCopy: Boolean; function TCustomCodeEditor.ClipCopy: Boolean;
var OK,ShowInfo: boolean;
var ShowInfo,CanPaste: boolean;
begin begin
Lock; Lock;
{AddGroupedAction(eaCopy); {AddGroupedAction(eaCopy);
can we undo a copy ?? can we undo a copy ??
maybe as an Undo Paste in Clipboard !! } maybe as an Undo Paste in Clipboard !! }
OK:=Clipboard<>nil; clipcopy:=false;
if OK then showinfo:=false;
ShowInfo:=SelEnd.Y-SelStart.Y>50 if (clipboard<>nil) and (clipboard<>@self) then
else begin
ShowInfo:=false; ShowInfo:=SelEnd.Y-SelStart.Y>50;
if ShowInfo then if ShowInfo then
PushInfo(msg_copyingclipboard); PushInfo(msg_copyingclipboard);
if OK then OK:=Clipboard^.InsertFrom(@Self); clipcopy:=Clipboard^.InsertFrom(@Self);
if ShowInfo then if ShowInfo then
PopInfo; PopInfo;
ClipCopy:=OK; {Enable paste command.}
CanPaste:=((Clipboard^.SelStart.X<>Clipboard^.SelEnd.X) or
(Clipboard^.SelStart.Y<>Clipboard^.SelEnd.Y));
SetCmdState(FromClipCmds,CanPaste);
end;
UnLock; UnLock;
end; end;
procedure TCustomCodeEditor.ClipCut; procedure TCustomCodeEditor.ClipCut;
var var
ShowInfo : boolean; ShowInfo,CanPaste : boolean;
begin begin
if IsReadOnly then Exit; if IsReadOnly then Exit;
Lock; Lock;
AddGroupedAction(eaCut); AddGroupedAction(eaCut);
DontConsiderShiftState:=true; DontConsiderShiftState:=true;
if Clipboard<>nil then if (clipboard<>nil) and (clipboard<>@self) then
begin begin
ShowInfo:=SelEnd.Y-SelStart.Y>50; ShowInfo:=SelEnd.Y-SelStart.Y>50;
if ShowInfo then if ShowInfo then
@ -5865,6 +5871,9 @@ begin
end; end;
if ShowInfo then if ShowInfo then
PopInfo; PopInfo;
CanPaste:=((Clipboard^.SelStart.X<>Clipboard^.SelEnd.X) or
(Clipboard^.SelStart.Y<>Clipboard^.SelEnd.Y));
SetCmdState(FromClipCmds,CanPaste);
end; end;
CloseGroupedAction(eaCut); CloseGroupedAction(eaCut);
UnLock; UnLock;