IdeIntf: Remove "const" from an event. Add HookGetCheckboxForBoolean handler in OI only once.

git-svn-id: trunk@64300 -
This commit is contained in:
juha 2020-12-29 22:47:34 +00:00
parent 5610156d9f
commit 943e4e4ff7
10 changed files with 37 additions and 41 deletions

View File

@ -139,7 +139,7 @@ type
procedure lstActionNameDblClick(Sender: TObject); procedure lstActionNameDblClick(Sender: TObject);
protected protected
procedure OnComponentRenamed(AComponent: TComponent); procedure OnComponentRenamed(AComponent: TComponent);
procedure OnComponentSelection(const NewSelection: TPersistentSelectionList); procedure OnComponentSelection(NewSelection: TPersistentSelectionList);
procedure OnComponentDelete(APersistent: TPersistent); procedure OnComponentDelete(APersistent: TPersistent);
procedure OnRefreshPropertyValues; procedure OnRefreshPropertyValues;
function GetSelectedAction: TContainedAction; function GetSelectedAction: TContainedAction;
@ -477,8 +477,7 @@ begin
lstActionName.Items[i] := AComponent.Name; lstActionName.Items[i] := AComponent.Name;
end; end;
procedure TActionListEditor.OnComponentSelection( procedure TActionListEditor.OnComponentSelection(NewSelection: TPersistentSelectionList);
const NewSelection: TPersistentSelectionList);
var var
CurAct: TContainedAction; CurAct: TContainedAction;
tmpCategory: String; tmpCategory: String;

View File

@ -81,8 +81,8 @@ type
procedure SelectionChanged(AOrderChanged: Boolean = false); procedure SelectionChanged(AOrderChanged: Boolean = false);
procedure OnComponentRenamed(AComponent: TComponent); procedure OnComponentRenamed(AComponent: TComponent);
procedure OnPersistentDeleting(APersistent: TPersistent); procedure OnPersistentDeleting(APersistent: TPersistent);
procedure OnGetSelection(const ASelection: TPersistentSelectionList); procedure OnGetSelection(ASelection: TPersistentSelectionList);
procedure OnSetSelection(const ASelection: TPersistentSelectionList); procedure OnSetSelection(ASelection: TPersistentSelectionList);
procedure OnPersistentAdded(APersistent: TPersistent; Select: boolean); procedure OnPersistentAdded(APersistent: TPersistent; Select: boolean);
private private
LinkDataset: TDataset; LinkDataset: TDataset;
@ -450,8 +450,7 @@ begin
FieldsListBox.Items.Delete(i); FieldsListBox.Items.Delete(i);
end; end;
procedure TDSFieldsEditorFrm.OnGetSelection( procedure TDSFieldsEditorFrm.OnGetSelection(ASelection: TPersistentSelectionList);
const ASelection: TPersistentSelectionList);
var i: integer; var i: integer;
begin begin
if Not Assigned(ASelection) then exit; if Not Assigned(ASelection) then exit;
@ -461,8 +460,7 @@ begin
ASelection.Add(TPersistent(FieldsListBox.Items.Objects[i])); ASelection.Add(TPersistent(FieldsListBox.Items.Objects[i]));
end; end;
procedure TDSFieldsEditorFrm.OnSetSelection( procedure TDSFieldsEditorFrm.OnSetSelection(ASelection: TPersistentSelectionList);
const ASelection: TPersistentSelectionList);
var i, j: integer; var i, j: integer;
begin begin
if Assigned(ASelection) then begin if Assigned(ASelection) then begin

View File

@ -764,10 +764,11 @@ type
function PersistentToString(APersistent: TPersistent): string; function PersistentToString(APersistent: TPersistent): string;
procedure AddPersistentToList(APersistent: TPersistent; List: TStrings); procedure AddPersistentToList(APersistent: TPersistent; List: TStrings);
procedure HookLookupRootChange; procedure HookLookupRootChange;
procedure HookRefreshPropertyValues;
procedure FillPersistentComboBox; procedure FillPersistentComboBox;
procedure SetAvailComboBoxText; procedure SetAvailComboBoxText;
procedure HookGetSelection(const ASelection: TPersistentSelectionList); procedure HookGetSelection(ASelection: TPersistentSelectionList);
procedure HookSetSelection(const ASelection: TPersistentSelectionList); procedure HookSetSelection(ASelection: TPersistentSelectionList);
procedure DestroyNoteBook; procedure DestroyNoteBook;
procedure CreateNoteBook; procedure CreateNoteBook;
procedure ShowNextPage(Delta: integer); procedure ShowNextPage(Delta: integer);
@ -821,7 +822,6 @@ type
function GetCurRowDefaultValue(var DefaultStr: string): Boolean; function GetCurRowDefaultValue(var DefaultStr: string): Boolean;
function HasParentCandidates: Boolean; function HasParentCandidates: Boolean;
procedure ChangeParent; procedure ChangeParent;
procedure HookRefreshPropertyValues;
procedure ActivateGrid(Grid: TOICustomPropertyGrid); procedure ActivateGrid(Grid: TOICustomPropertyGrid);
procedure FocusGrid(Grid: TOICustomPropertyGrid = nil); procedure FocusGrid(Grid: TOICustomPropertyGrid = nil);
public public
@ -1385,7 +1385,6 @@ procedure TOICustomPropertyGrid.SetPropertyEditorHook(
begin begin
if FPropertyEditorHook=NewPropertyEditorHook then exit; if FPropertyEditorHook=NewPropertyEditorHook then exit;
FPropertyEditorHook:=NewPropertyEditorHook; FPropertyEditorHook:=NewPropertyEditorHook;
FPropertyEditorHook.AddHandlerGetCheckboxForBoolean(@HookGetCheckboxForBoolean);
IncreaseChangeStep; IncreaseChangeStep;
SetSelection(FSelection); SetSelection(FSelection);
end; end;
@ -4501,7 +4500,12 @@ begin
Selection := nil; Selection := nil;
for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do for Page:=Low(TObjectInspectorPage) to High(TObjectInspectorPage) do
if GridControl[Page]<>nil then if GridControl[Page]<>nil then
begin
if Page=oipgpProperties then // Add HookGetCheckboxForBoolean only once.
FPropertyEditorHook.AddHandlerGetCheckboxForBoolean(
@GridControl[Page].HookGetCheckboxForBoolean);
GridControl[Page].PropertyEditorHook:=FPropertyEditorHook; GridControl[Page].PropertyEditorHook:=FPropertyEditorHook;
end;
OldSelection:=TPersistentSelectionList.Create; OldSelection:=TPersistentSelectionList.Create;
try try
FPropertyEditorHook.GetSelection(OldSelection); FPropertyEditorHook.GetSelection(OldSelection);
@ -4612,6 +4616,11 @@ begin
FillComponentList(True); FillComponentList(True);
end; end;
procedure TObjectInspectorDlg.HookRefreshPropertyValues;
begin
RefreshPropertyValues;
end;
procedure TObjectInspectorDlg.ChangeCompZOrderInList(APersistent: TPersistent; procedure TObjectInspectorDlg.ChangeCompZOrderInList(APersistent: TPersistent;
AZOrder: TZOrderDelete); AZOrder: TZOrderDelete);
begin begin
@ -5250,13 +5259,13 @@ begin
end; end;
end; end;
procedure TObjectInspectorDlg.HookGetSelection(const ASelection: TPersistentSelectionList); procedure TObjectInspectorDlg.HookGetSelection(ASelection: TPersistentSelectionList);
begin begin
if ASelection=nil then exit; if ASelection=nil then exit;
ASelection.Assign(FSelection); ASelection.Assign(FSelection);
end; end;
procedure TObjectInspectorDlg.HookSetSelection(const ASelection: TPersistentSelectionList); procedure TObjectInspectorDlg.HookSetSelection(ASelection: TPersistentSelectionList);
begin begin
Selection := ASelection; Selection := ASelection;
end; end;
@ -6052,11 +6061,6 @@ begin
RestrictedGrid.Filter := Filter + [tkMethod]; RestrictedGrid.Filter := Filter + [tkMethod];
end; end;
procedure TObjectInspectorDlg.HookRefreshPropertyValues;
begin
RefreshPropertyValues;
end;
procedure TObjectInspectorDlg.ActivateGrid(Grid: TOICustomPropertyGrid); procedure TObjectInspectorDlg.ActivateGrid(Grid: TOICustomPropertyGrid);
begin begin
if Grid=PropertyGrid then NoteBook.PageIndex:=0 if Grid=PropertyGrid then NoteBook.PageIndex:=0

View File

@ -1360,10 +1360,8 @@ type
TPropHookPersistentDeleting = procedure(APersistent: TPersistent) of object; TPropHookPersistentDeleting = procedure(APersistent: TPersistent) of object;
TPropHookPersistentDeleted = procedure of object; TPropHookPersistentDeleted = procedure of object;
TPropHookDeletePersistent = procedure(var APersistent: TPersistent) of object; TPropHookDeletePersistent = procedure(var APersistent: TPersistent) of object;
TPropHookGetSelection = procedure(const ASelection: TPersistentSelectionList TPropHookGetSelection = procedure(ASelection: TPersistentSelectionList) of object;
) of object; TPropHookSetSelection = procedure(ASelection: TPersistentSelectionList) of object;
TPropHookSetSelection = procedure(const ASelection: TPersistentSelectionList
) of object;
TPropHookAddDependency = procedure(const AClass: TClass; TPropHookAddDependency = procedure(const AClass: TClass;
const AnUnitName: shortstring) of object; const AnUnitName: shortstring) of object;
// persistent objects // persistent objects

View File

@ -71,7 +71,7 @@ type
procedure RefreshSearchResult; procedure RefreshSearchResult;
procedure UpdateComponentsList; procedure UpdateComponentsList;
procedure OnDesignSetSelection(const ASelection: TPersistentSelectionList); procedure OnDesignSetSelection(ASelection: TPersistentSelectionList);
public public
constructor Create(AOwner: TComponent; AParent: TWinControl; AIgnoreRoot: Boolean = False); reintroduce; constructor Create(AOwner: TComponent; AParent: TWinControl; AIgnoreRoot: Boolean = False); reintroduce;
destructor Destroy; override; destructor Destroy; override;
@ -609,7 +609,7 @@ begin
RefreshSearchResult; RefreshSearchResult;
end; end;
procedure TComponentsPalette.OnDesignSetSelection(const ASelection: TPersistentSelectionList); procedure TComponentsPalette.OnDesignSetSelection(ASelection: TPersistentSelectionList);
begin begin
// to replace original components palette // to replace original components palette
if not FIgnoreRoot or (csDestroying in ComponentState) then if not FIgnoreRoot or (csDestroying in ComponentState) then

View File

@ -66,10 +66,10 @@ type
function FindChild(ACandidate: TPersistent; out AIndex: Integer): Boolean; function FindChild(ACandidate: TPersistent; out AIndex: Integer): Boolean;
procedure MoveSelection(AStart, ADir: Integer); procedure MoveSelection(AStart, ADir: Integer);
procedure OnComponentRenamed(AComponent: TComponent); procedure OnComponentRenamed(AComponent: TComponent);
procedure OnGetSelection(const ASelection: TPersistentSelectionList); procedure OnGetSelection(ASelection: TPersistentSelectionList);
procedure OnPersistentAdded(APersistent: TPersistent; ASelect: Boolean); procedure OnPersistentAdded(APersistent: TPersistent; ASelect: Boolean);
procedure OnPersistentDeleting(APersistent: TPersistent); procedure OnPersistentDeleting(APersistent: TPersistent);
procedure OnSetSelection(const ASelection: TPersistentSelectionList); procedure OnSetSelection(ASelection: TPersistentSelectionList);
procedure RefreshList; procedure RefreshList;
procedure SelectionChanged(AOrderChanged: Boolean = false); procedure SelectionChanged(AOrderChanged: Boolean = false);
protected protected
@ -298,8 +298,7 @@ begin
BuildCaption; BuildCaption;
end; end;
procedure TComponentListEditorForm.OnGetSelection( procedure TComponentListEditorForm.OnGetSelection(ASelection: TPersistentSelectionList);
const ASelection: TPersistentSelectionList);
var var
i: Integer; i: Integer;
begin begin
@ -336,8 +335,7 @@ begin
end; end;
end; end;
procedure TComponentListEditorForm.OnSetSelection( procedure TComponentListEditorForm.OnSetSelection(ASelection: TPersistentSelectionList);
const ASelection: TPersistentSelectionList);
var var
i, j: Integer; i, j: Integer;
begin begin

View File

@ -183,7 +183,7 @@ type
FSideControls: array[TAnchorKind] of TAnchorDesignerSideControls; FSideControls: array[TAnchorKind] of TAnchorDesignerSideControls;
procedure Refresh; procedure Refresh;
procedure OnRefreshPropertyValues; procedure OnRefreshPropertyValues;
procedure OnSetSelection(const ASelection: TPersistentSelectionList); procedure OnSetSelection(ASelection: TPersistentSelectionList);
function GetSelectedControls: TList; function GetSelectedControls: TList;
function FindSibling(const Sibling: string): TControl; function FindSibling(const Sibling: string): TControl;
procedure FillComboBoxWithSiblings(AComboBox: TComboBox); procedure FillComboBoxWithSiblings(AComboBox: TComboBox);
@ -1167,8 +1167,7 @@ begin
end; end;
end; end;
procedure TAnchorDesigner.OnSetSelection( procedure TAnchorDesigner.OnSetSelection(ASelection: TPersistentSelectionList);
const ASelection: TPersistentSelectionList);
begin begin
if FSelection.IsEqual(ASelection) then exit; if FSelection.IsEqual(ASelection) then exit;
Refresh; Refresh;

View File

@ -90,7 +90,7 @@ type
procedure HidePopupAssignmentsInfo; procedure HidePopupAssignmentsInfo;
procedure InitializeStatisticVars; procedure InitializeStatisticVars;
procedure LoadFixedButtonGlyphs; procedure LoadFixedButtonGlyphs;
procedure OnDesignerSetSelection(const ASelection: TPersistentSelectionList); procedure OnDesignerSetSelection(ASelection: TPersistentSelectionList);
procedure ProcessForPopup(aControl: TControl); procedure ProcessForPopup(aControl: TControl);
procedure SetupPopupAssignmentsDisplay; procedure SetupPopupAssignmentsDisplay;
public public
@ -279,7 +279,7 @@ begin
OpenURL(helpPath); OpenURL(helpPath);
end; end;
procedure TMenuDesignerForm.OnDesignerSetSelection(const ASelection: TPersistentSelectionList); procedure TMenuDesignerForm.OnDesignerSetSelection(ASelection: TPersistentSelectionList);
var var
mnu: TMenu; mnu: TMenu;
mi, tmp: TMenuItem; mi, tmp: TMenuItem;

View File

@ -70,7 +70,7 @@ type
procedure PersistentAdded({%H-}APersistent: TPersistent; {%H-}Select: boolean); procedure PersistentAdded({%H-}APersistent: TPersistent; {%H-}Select: boolean);
procedure PersistentDeleting({%H-}APersistent: TPersistent); procedure PersistentDeleting({%H-}APersistent: TPersistent);
procedure DeletePersistent(var {%H-}APersistent: TPersistent); procedure DeletePersistent(var {%H-}APersistent: TPersistent);
procedure SetSelection(const ASelection: TPersistentSelectionList); procedure SetSelection(ASelection: TPersistentSelectionList);
end; end;
{ TTabOrderPropEditor } { TTabOrderPropEditor }
@ -436,7 +436,7 @@ begin
SomethingChanged; SomethingChanged;
end; end;
procedure TTabOrderDialog.SetSelection(const ASelection: TPersistentSelectionList); procedure TTabOrderDialog.SetSelection(ASelection: TPersistentSelectionList);
// Select item also in TreeView when selection in Designer changes. // Select item also in TreeView when selection in Designer changes.
function FindSelection: TTreeNode; function FindSelection: TTreeNode;

View File

@ -580,7 +580,7 @@ type
procedure ControlSelectionChanged(Sender: TObject; ForceUpdate: Boolean); procedure ControlSelectionChanged(Sender: TObject; ForceUpdate: Boolean);
procedure ControlSelectionPropsChanged(Sender: TObject); procedure ControlSelectionPropsChanged(Sender: TObject);
procedure ControlSelectionFormChanged(Sender: TObject; OldForm, NewForm: TCustomForm); procedure ControlSelectionFormChanged(Sender: TObject; OldForm, NewForm: TCustomForm);
procedure GetDesignerSelection(const ASelection: TPersistentSelectionList); procedure GetDesignerSelection(ASelection: TPersistentSelectionList);
// project inspector event handlers // project inspector event handlers
function ProjInspectorAddUnitToProject(Sender: TObject; function ProjInspectorAddUnitToProject(Sender: TObject;
@ -9485,7 +9485,7 @@ begin
MainIDEBar.UpdateIDEComponentPalette(true); MainIDEBar.UpdateIDEComponentPalette(true);
end; end;
procedure TMainIDE.GetDesignerSelection(const ASelection: TPersistentSelectionList); procedure TMainIDE.GetDesignerSelection(ASelection: TPersistentSelectionList);
begin begin
if TheControlSelection=nil then exit; if TheControlSelection=nil then exit;
TheControlSelection.GetSelection(ASelection); TheControlSelection.GetSelection(ASelection);