Sfoglia il codice sorgente

Handle SCN_UPDATEUI's new TSCNotification.updated. Did not attempt to make TCompileForm.MemoUpdateUI smart about content vs selection changes.

Martijn Laan 1 anno fa
parent
commit
834fd4c527
3 ha cambiato i file con 11 aggiunte e 6 eliminazioni
  1. 6 3
      Components/ScintEdit.pas
  2. 5 2
      Projects/Src/CompForm.pas
  3. 0 1
      Projects/Src/CompScintEdit.pas

+ 6 - 3
Components/ScintEdit.pas

@@ -30,6 +30,9 @@ type
     var Info: TScintHintInfo) of object;
   TScintEditMarginClickEvent = procedure(Sender: TObject; MarginNumber: Integer;
     Line: Integer) of object;
+  TScintEditUpdate = (suContent, suSelection, suVScroll, suHScroll);
+  TScintEditUpdates = set of TScintEditUpdate;
+  TScintEditUpdateUIEvent = procedure(Sender: TObject; Updated: TScintEditUpdates) of object;
   TScintFindOption = (sfoMatchCase, sfoWholeWord);
   TScintFindOptions = set of TScintFindOption;
   TScintIndentationGuides = (sigNone, sigReal, sigLookForward, sigLookBoth);
@@ -87,7 +90,7 @@ type
     FOnHintShow: TScintEditHintShowEvent;
     FOnMarginClick: TScintEditMarginClickEvent;
     FOnModifiedChange: TNotifyEvent;
-    FOnUpdateUI: TNotifyEvent;
+    FOnUpdateUI: TScintEditUpdateUIEvent;
     FOnZoom: TNotifyEvent;
     FReportCaretPositionToStyler: Boolean;
     FStyler: TScintCustomStyler;
@@ -334,7 +337,7 @@ type
     property OnMouseDown;
     property OnMouseMove;
     property OnMouseUp;
-    property OnUpdateUI: TNotifyEvent read FOnUpdateUI write FOnUpdateUI;
+    property OnUpdateUI: TScintEditUpdateUIEvent read FOnUpdateUI write FOnUpdateUI;
     property OnZoom: TNotifyEvent read FOnZoom write FOnZoom;
   end;
 
@@ -1133,7 +1136,7 @@ begin
     SCN_UPDATEUI:
       begin
         if Assigned(FOnUpdateUI) then
-          FOnUpdateUI(Self);
+          FOnUpdateUI(Self, TScintEditUpdates(Byte(N.updated)));
       end;
     SCN_ZOOM:
       begin

+ 5 - 2
Projects/Src/CompForm.pas

@@ -488,7 +488,7 @@ type
       Line: Integer);
     procedure MemoModifiedChange(Sender: TObject);
     function MemoToTabIndex(const AMemo: TCompScintEdit): Integer;
-    procedure MemoUpdateUI(Sender: TObject);
+    procedure MemoUpdateUI(Sender: TObject; Updated: TScintEditUpdates);
     procedure MemoZoom(Sender: TObject);
     procedure UpdateReopenTabMenu(const Menu: TMenuItem);
     procedure ModifyMRUMainFilesList(const AFilename: String; const AddNewItem: Boolean);
@@ -4096,7 +4096,7 @@ begin
   UpdateBevel1Visibility;
 end;
 
-procedure TCompileForm.MemoUpdateUI(Sender: TObject);
+procedure TCompileForm.MemoUpdateUI(Sender: TObject; Updated: TScintEditUpdates);
 
   procedure UpdatePendingSquiggly(const AMemo: TCompScintEdit);
   var
@@ -4158,6 +4158,9 @@ procedure TCompileForm.MemoUpdateUI(Sender: TObject);
   end;
 
 begin
+  if Updated * [suContent, suSelection] = [] then
+    Exit;
+
   var Memo := Sender as TCompScintEdit;
 
   if (Memo = FErrorMemo) and ((FErrorMemo.ErrorLine < 0) or (FErrorMemo.CaretPosition <> FErrorMemo.ErrorCaretPosition)) then

+ 0 - 1
Projects/Src/CompScintEdit.pas

@@ -150,7 +150,6 @@ begin
      "The INDICATOR_* values used for dividing up indicators were previously
       INDIC_CONTAINER, INDIC_IME, INDIC_IME_MAX, and INDIC_MAX"
      Once it does replace our use of these INDIC_* with INDICATOR_*.
-    -2.2.4: Update TCompForm.MemoUpdateUI to check the type of update sent by SCN_UPDATEUI
     -2.2.6: Replace: INDIC_ROUNDBOX -> INDIC_STRAIGHTBOX
     -2.2.8: Review using SCI_MARKERDEFINERGBAIMAGE instead of SCI_MARKERDEFINEPIXMAP,
             but note INDIC_SQUIGGLEPIXMAP below