SynEdit: Fixed , make TAction regard ReadOnly state (Allow CanUndo, CanPaste from app-code, even if read only)

git-svn-id: trunk@39394 -
This commit is contained in:
martin 2012-11-27 16:59:23 +00:00
parent 7804a0b9f1
commit 7bea250603

View File

@ -4910,18 +4910,17 @@ end;
function TCustomSynEdit.GetCanUndo: Boolean;
begin
result := fUndoList.CanUndo and (not ReadOnly);
result := fUndoList.CanUndo;
end;
function TCustomSynEdit.GetCanRedo: Boolean;
begin
result := fRedoList.CanUndo and (not ReadOnly);
result := fRedoList.CanUndo;
end;
function TCustomSynEdit.GetCanPaste:Boolean;
begin
Result := (not ReadOnly) and
(Clipboard.HasFormat(CF_TEXT) or
Result := (Clipboard.HasFormat(CF_TEXT) or
Clipboard.HasFormat(TSynClipboardStream.ClipboardFormatId)
)
end;
@ -8050,11 +8049,11 @@ begin
else if (TheAction is TEditCopy) then
TEditAction(TheAction).Enabled := SelAvail
else if TheAction is TEditPaste then
TEditAction(TheAction).Enabled := CanPaste
TEditAction(TheAction).Enabled := CanPaste and (not ReadOnly)
else if TheAction is TEditDelete then
TEditAction(TheAction).Enabled := (not ReadOnly)
else if TheAction is TEditUndo then
TEditAction(TheAction).Enabled := CanUndo
TEditAction(TheAction).Enabled := CanUndo and (not ReadOnly)
else if TheAction is TEditSelectAll then
TEditAction(TheAction).Enabled := TRUE;
end;