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);
protected
procedure OnComponentRenamed(AComponent: TComponent);
procedure OnComponentSelection(const NewSelection: TPersistentSelectionList);
procedure OnComponentSelection(NewSelection: TPersistentSelectionList);
procedure OnComponentDelete(APersistent: TPersistent);
procedure OnRefreshPropertyValues;
function GetSelectedAction: TContainedAction;
@ -477,8 +477,7 @@ begin
lstActionName.Items[i] := AComponent.Name;
end;
procedure TActionListEditor.OnComponentSelection(
const NewSelection: TPersistentSelectionList);
procedure TActionListEditor.OnComponentSelection(NewSelection: TPersistentSelectionList);
var
CurAct: TContainedAction;
tmpCategory: String;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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