Selaa lähdekoodia

Cleanup (prexisting) can paste check.

Martijn Laan 11 kuukautta sitten
vanhempi
commit
c9a9dc56b7
2 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 6 0
      Components/ScintEdit.pas
  2. 2 2
      Projects/Src/IDE.MainForm.pas

+ 6 - 0
Components/ScintEdit.pas

@@ -254,6 +254,7 @@ type
     procedure CancelAutoComplete;
     procedure CancelAutoCompleteAndCallTip;
     procedure CancelCallTip;
+    function CanPaste: Boolean;
     function CanRedo: Boolean;
     function CanUndo: Boolean;
     procedure ChooseCaretX;
@@ -712,6 +713,11 @@ begin
   Call(SCI_CALLTIPCANCEL, 0, 0);
 end;
 
+function TScintEdit.CanPaste: Boolean;
+begin
+  Result := Call(SCI_CANPASTE, 0, 0) <> 0;
+end;
+
 function TScintEdit.CanRedo: Boolean;
 begin
   Result := Call(SCI_CANREDO, 0, 0) <> 0;

+ 2 - 2
Projects/Src/IDE.MainForm.pas

@@ -1429,7 +1429,7 @@ begin
       end;
     end;
   end else if ((Key = Ord('V')) or (Key = VK_INSERT)) and (Shift * [ssShift, ssAlt, ssCtrl] = [ssCtrl]) then begin
-    if not FActiveMemo.ReadOnly and Clipboard.HasFormat(CF_TEXT) then { Also see EMenuClick }
+    if FActiveMemo.CanPaste then
       if MultipleSelectionPasteFromClipboard(FActiveMemo) then
         Key := 0;
   end else if (Key = VK_SPACE) and (Shift * [ssShift, ssAlt, ssCtrl] = [ssShift, ssCtrl]) then begin
@@ -2864,7 +2864,7 @@ begin
   ERedo.Enabled := MemoHasFocus and FActiveMemo.CanRedo;
   ECut.Enabled := MemoHasFocus and not MemoIsReadOnly and not FActiveMemo.SelEmpty;
   ECopy.Enabled := MemoHasFocus and not FActiveMemo.SelEmpty;
-  EPaste.Enabled := MemoHasFocus and not MemoIsReadOnly and Clipboard.HasFormat(CF_TEXT); { Also see MemoKeyDown }
+  EPaste.Enabled := MemoHasFocus and FActiveMemo.CanPaste;
   EDelete.Enabled := MemoHasFocus and not FActiveMemo.SelEmpty;
   ESelectAll.Enabled := MemoHasFocus;
   ESelectNextOccurrence.Enabled := MemoHasFocus;