Skip to content

Commit

Permalink
Folding -> UseFolding. Just like TScintEdit's UseStyleAttributes it d…
Browse files Browse the repository at this point in the history
…oesn't mean it stops keeping track of folding but just that you can't see anything about it. Todo: test fully once there's a GUI option.
  • Loading branch information
martijnlaan committed Jun 16, 2024
1 parent 5789351 commit 1ade41e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Projects/Src/CompScintEdit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ interface

TCompScintEdit = class(TScintEdit)
private
FFolding: Boolean;
FUseFolding: Boolean;
FTheme: TTheme;
FOpeningFile: Boolean;
FUsed: Boolean; { The IDE only shows 1 memo at a time so can't use .Visible to check if a memo is used }
FIndicatorCount: array[TCompScintIndicatorNumber] of Integer;
FIndicatorHash: array[TCompScintIndicatorNumber] of String;
procedure SetFolding(const Value: Boolean);
procedure SetUseFolding(const Value: Boolean);
protected
procedure CreateWnd; override;
public
Expand All @@ -73,7 +73,7 @@ TCompScintEdit = class(TScintEdit)
RightBlankMarginWidth, SquigglyWidth: Integer);
procedure UpdateThemeColorsAndStyleAttributes;
published
property Folding: Boolean read FFolding write SetFolding default True;
property UseFolding: Boolean read FUseFolding write SetUseFolding default True;
end;

TCompScintFileEdit = class(TCompScintEdit)
Expand Down Expand Up @@ -144,7 +144,7 @@ implementation
constructor TCompScintEdit.Create(AOwner: TComponent);
begin
inherited;
FFolding := True;
FUseFolding := True;
end;

procedure TCompScintEdit.CreateWnd;
Expand Down Expand Up @@ -251,14 +251,16 @@ procedure TCompScintEdit.CreateWnd;
Call(SCI_MARKERSETBACK, mmLineStep, clBlue); { May be overwritten by UpdateThemeColorsAndStyleAttributes }
end;

procedure TCompScintEdit.SetFolding(const Value: Boolean);
procedure TCompScintEdit.SetUseFolding(const Value: Boolean);
begin
if FFolding <> Value then begin
FFolding := Value;
if FUseFolding <> Value then begin
FUseFolding := Value;
{ If FFolding is True then caller must set the margin width using
UpdateMarginsAndSquigglyWidths else we set it to 0 now }
if not FFolding then
if not FUseFolding then begin
Call(SCI_FOLDALL, SC_FOLDACTION_EXPAND, 0);
Call(SCI_SETMARGINWIDTHN, 3, 0);
end;
end;
end;

Expand Down Expand Up @@ -316,7 +318,7 @@ procedure TCompScintEdit.UpdateMarginsAndSquigglyWidths(const IconMarkersWidth,
Call(SCI_SETMARGINWIDTHN, 2, ChangeHistoryWidth);

var FolderMarkersWidth: Integer;
if FFolding then
if FUseFolding then
FolderMarkersWidth := BaseFolderMarkersWidth
else
FolderMarkersWidth := 0;
Expand Down

0 comments on commit 1ade41e

Please sign in to comment.