@@ -14,7 +14,8 @@ interface
1414 Winapi.Windows,
1515 Winapi.Messages,
1616 RipGrepper.Settings.RipGrepperSettings,
17- RipGrepper.Settings.SettingVariant;
17+ RipGrepper.Settings.SettingVariant,
18+ RipGrepper.Common.SimpleTypes;
1819
1920type
2021
@@ -222,6 +223,7 @@ TCustomOptionsBase = class(TCustomPanel)
222223 procedure setColumns (const _value : Integer);
223224
224225 protected
226+ FSearchFormLayout : TSearchFormLayout;
225227 procedure Resize ; override;
226228
227229 public
@@ -271,8 +273,8 @@ TCustomCheckOptions = class(TCustomOptionsBase)
271273 procedure CalculateActualWidths (const _itemWidth, _firstControlWidth : Integer;
272274 out _actualFirstWidth, _actualSecondWidth : Integer);
273275 procedure PositionItemPanel (const _item : TCustomCheckItem; const _itemIndex, _itemWidth, _itemHeight : Integer);
274- procedure PositionItemControls (const _item : TCustomCheckItem; const
275- _itemIndex, _actualFirstWidth, _actualSecondWidth : Integer);
276+ procedure PositionItemControls (const _item : TCustomCheckItem;
277+ const _itemIndex, _actualFirstWidth, _actualSecondWidth : Integer);
276278 // Helper methods for positioning different control types
277279 procedure PositionCheckBoxOnly (const _item : TCustomCheckItem; const _itemIndex, _actualFirstWidth, _itemHeight : Integer);
278280 procedure PositionCheckBoxWithCombo (const _item : TCustomCheckItem; const _itemIndex, _actualFirstWidth, _actualSecondWidth,
@@ -306,7 +308,7 @@ TCustomCheckOptions = class(TCustomOptionsBase)
306308 function GetItemByCaption (const _caption : string) : TCustomCheckItem;
307309 procedure SetItemControlEnabled (_itemIdx : Integer; _controlIdx : ESubItemIndex; _enabled : Boolean);
308310 function GetMinimumWidth () : Integer;
309- procedure ShowExpertItems (const _bShow : Boolean = True );
311+ procedure UpdateLayout (const _layout : TSearchFormLayout );
310312 procedure SetDefaultValues ();
311313 property EventsEnabled : Boolean read FEventsEnabled write FEventsEnabled;
312314 property SelectedItems : TArray<TCustomCheckItem> read getSelectedItems;
@@ -322,9 +324,10 @@ implementation
322324uses
323325 Math,
324326 RipGrepper.Common.IDEContextValues,
325- RipGrepper.Common.SimpleTypes,
327+
326328 Spring,
327- RipGrepper.Tools.DebugUtils;
329+ RipGrepper.Tools.DebugUtils,
330+ RipGrepper.Common.Constants;
328331
329332{ TCustomCheckItemsEnumerator }
330333
@@ -1221,7 +1224,8 @@ procedure TCustomCheckOptions.CalculateActualWidths(const _itemWidth, _firstCont
12211224end ;
12221225
12231226procedure TCustomCheckOptions.PositionItemPanel (const _item : TCustomCheckItem; const _itemIndex, _itemWidth, _itemHeight : Integer);
1224- var col, row : Integer;
1227+ var
1228+ col, row : Integer;
12251229 baseLeft, itemHeight : Integer;
12261230begin
12271231 col := _itemIndex mod Columns;
@@ -1260,7 +1264,8 @@ procedure TCustomCheckOptions.PositionCheckBoxOnly(const _item : TCustomCheckIte
12601264 iTextWidth := Canvas.TextWidth(_item.CheckBox.Caption) + CHECKBOX_MARGIN;
12611265 if UseFlowLayout then begin
12621266 // Flow layout: calculate width based on caption text width using parent's canvas
1263- var checkboxWidth : integer := Canvas.TextWidth(_item.CheckBox.Caption) + CHECKBOX_MARGIN;
1267+ var
1268+ checkboxWidth : integer := Canvas.TextWidth(_item.CheckBox.Caption) + CHECKBOX_MARGIN;
12641269 if (FItems.Count = 1 ) then begin
12651270 _item.CheckBox.Width := Max(checkboxWidth, iTextWidth);
12661271 end else begin
@@ -1854,11 +1859,13 @@ procedure TCustomCheckOptions.SetSettings(const Value : TRipGrepperSettings);
18541859 FSettings := Value ;
18551860end ;
18561861
1857- procedure TCustomCheckOptions.ShowExpertItems (const _bShow : Boolean = True );
1862+ procedure TCustomCheckOptions.UpdateLayout (const _layout : TSearchFormLayout );
18581863begin
1859- for var item in Items do begin
1860- if item.ShowInExpertModeOnly then begin
1861- item.ParentPanel.Visible := _bShow;
1864+ if FSearchFormLayout = _layout then begin
1865+ for var item in Items do begin
1866+ if item.ShowInExpertModeOnly then begin
1867+ item.ParentPanel.Visible := sflExpert in FSearchFormLayout;
1868+ end ;
18621869 end ;
18631870 end ;
18641871end ;
@@ -1874,7 +1881,7 @@ procedure TCustomCheckOptions.SetDefaultValues();
18741881
18751882procedure Register ;
18761883begin
1877- RegisterComponents(' Custom ' , [TCustomCheckOptions]);
1884+ RegisterComponents(DRIPGREPPER_APPNAME , [TCustomCheckOptions]);
18781885end ;
18791886
18801887class function TAutoSetReset.New (var _bValue : Boolean; const _bInitValue : Boolean = True) : TAutoSetReset;
0 commit comments