diff --git a/components/lazreport/source/lr_desgn.pas b/components/lazreport/source/lr_desgn.pas index 51a92fe2b7..82a11b65d4 100644 --- a/components/lazreport/source/lr_desgn.pas +++ b/components/lazreport/source/lr_desgn.pas @@ -2387,7 +2387,7 @@ begin ObjInsp := TObjectInspector.Create(Self); ObjInsp.SetInitialBounds(10,10,220,400); ObjInsp.ShowComponentTree := False; - ObjInsp.ShowFavouritePage := False; + ObjInsp.ShowFavoritePage := False; ObjInsp.PropertyEditorHook := PropHook; {$ELSE} ObjInsp := TFrObjectInspector.Create(Self); diff --git a/designer/objinspext.pas b/designer/objinspext.pas index 6452993915..90c175ed77 100644 --- a/designer/objinspext.pas +++ b/designer/objinspext.pas @@ -14,7 +14,7 @@ Abstract: Extension for the Object Inspector. - - Favourites properties + - Favorites properties } unit ObjInspExt; @@ -31,9 +31,9 @@ uses LazarusIDEStrConsts; type - { TOIAddRemoveFavouriteDlg } + { TOIAddRemoveFavoriteDlg } - TOIAddRemoveFavouriteDlg = class(TForm) + TOIAddRemoveFavoriteDlg = class(TForm) NoteLabel: TLabel; ClassCombobox: TComboBox; OkButton: TButton; @@ -58,17 +58,17 @@ type end; const - DefaultOIFavouriteConfigFilename = 'objectinspectorfavourites.xml'; + DefaultOIFavoriteConfigFilename = 'objectinspectorfavorites.xml'; var - DefaultOIFavouriteProperties: TOIFavouriteProperties; + DefaultOIFavoriteProperties: TOIFavoriteProperties; -function ShowAddRemoveFavouriteDialog(ObjInspector: TObjectInspectorDlg; +function ShowAddRemoveFavoriteDialog(ObjInspector: TObjectInspectorDlg; Add: Boolean): TModalResult; -function CreateDefaultOIFavouriteProperties: TOIFavouriteProperties; -function LoadOIFavouriteProperties: TOIFavouriteProperties; -procedure SaveOIFavouriteProperties(Favourites: TOIFavouriteProperties); -function GetOIFavouriteConfigFilename: string; +function CreateDefaultOIFavoriteProperties: TOIFavoriteProperties; +function LoadOIFavoriteProperties: TOIFavoriteProperties; +procedure SaveOIFavoriteProperties(Favorites: TOIFavoriteProperties); +function GetOIFavoriteConfigFilename: string; function FindDeclarationOfOIProperty(AnInspector: TObjectInspectorDlg; Row: TOIPropertyGridRow; out Code: TCodeBuffer; out Caret: TPoint; @@ -77,15 +77,15 @@ function FindDeclarationOfOIProperty(AnInspector: TObjectInspectorDlg; implementation -function CreateDefaultOIFavouriteProperties: TOIFavouriteProperties; +function CreateDefaultOIFavoriteProperties: TOIFavoriteProperties; procedure Add(ABaseClass: TPersistentClass; const APropertyName: string); begin - Result.Add(TOIFavouriteProperty.Create(ABaseClass,APropertyName,true)); + Result.Add(TOIFavoriteProperty.Create(ABaseClass,APropertyName,true)); end; begin - Result:=TOIFavouriteProperties.Create; + Result:=TOIFavoriteProperties.Create; // TControl Add(TComponent,'Name'); Add(TComponent,'Caption'); @@ -130,88 +130,88 @@ begin Result.DeleteDoubles; end; -function ShowAddRemoveFavouriteDialog(ObjInspector: TObjectInspectorDlg; +function ShowAddRemoveFavoriteDialog(ObjInspector: TObjectInspectorDlg; Add: Boolean): TModalResult; var - OIAddRemoveFavouriteDlg: TOIAddRemoveFavouriteDlg; + OIAddRemoveFavoriteDlg: TOIAddRemoveFavoriteDlg; begin - OIAddRemoveFavouriteDlg:=TOIAddRemoveFavouriteDlg.Create(nil); - OIAddRemoveFavouriteDlg.ObjectInspector:=ObjInspector; - OIAddRemoveFavouriteDlg.AddMode:=Add; - Result:=OIAddRemoveFavouriteDlg.ShowModal; - OIAddRemoveFavouriteDlg.Free; + OIAddRemoveFavoriteDlg:=TOIAddRemoveFavoriteDlg.Create(nil); + OIAddRemoveFavoriteDlg.ObjectInspector:=ObjInspector; + OIAddRemoveFavoriteDlg.AddMode:=Add; + Result:=OIAddRemoveFavoriteDlg.ShowModal; + OIAddRemoveFavoriteDlg.Free; end; -function LoadOIFavouriteProperties: TOIFavouriteProperties; +function LoadOIFavoriteProperties: TOIFavoriteProperties; var ConfigStore: TConfigStorage; begin - Result:=DefaultOIFavouriteProperties.CreateCopy; - {$IFDEF DebugFavouriteroperties} - debugln('LoadOIFavouriteProperties A FileExistsUTF8(GetOIFavouriteConfigFilename)=',dbgs(FileExistsUTF8(GetOIFavouriteConfigFilename))); + Result:=DefaultOIFavoriteProperties.CreateCopy; + {$IFDEF DebugFavoriteroperties} + debugln('LoadOIFavoriteProperties A FileExistsUTF8(GetOIFavoriteConfigFilename)=',dbgs(FileExistsUTF8(GetOIFavoriteConfigFilename))); Result.WriteDebugReport; {$ENDIF} - if not FileExistsUTF8(GetOIFavouriteConfigFilename) then exit; + if not FileExistsUTF8(GetOIFavoriteConfigFilename) then exit; try - ConfigStore:=DefaultConfigClass.Create(GetOIFavouriteConfigFilename,true); + ConfigStore:=DefaultConfigClass.Create(GetOIFavoriteConfigFilename,true); try - Result.MergeConfig(ConfigStore,'ObjectInspector/Favourites/'); + Result.MergeConfig(ConfigStore,'ObjectInspector/Favorites/'); Result.Modified:=false; finally ConfigStore.Free; end; except on E: Exception do begin - debugln('Error: LoadOIFavouriteProperties: unable to read ', - GetOIFavouriteConfigFilename); + debugln('Error: LoadOIFavoriteProperties: unable to read ', + GetOIFavoriteConfigFilename); end; end; end; -procedure SaveOIFavouriteProperties(Favourites: TOIFavouriteProperties); +procedure SaveOIFavoriteProperties(Favorites: TOIFavoriteProperties); var ConfigStore: TConfigStorage; - DefaultFavourites: TOIFavouriteProperties; + DefaultFavorites: TOIFavoriteProperties; begin - {$IFDEF DebugFavouriteroperties} - debugln('SaveOIFavouriteProperties Favourites.Modified=',dbgs(Favourites.Modified), - ' FileExistsUTF8(GetOIFavouriteConfigFilename)=',dbgs(FileExistsUTF8(GetOIFavouriteConfigFilename))); + {$IFDEF DebugFavoriteroperties} + debugln('SaveOIFavoriteProperties Favorites.Modified=',dbgs(Favorites.Modified), + ' FileExistsUTF8(GetOIFavoriteConfigFilename)=',dbgs(FileExistsUTF8(GetOIFavoriteConfigFilename))); {$ENDIF} - if (not Favourites.Modified) and FileExistsUTF8(GetOIFavouriteConfigFilename) + if (not Favorites.Modified) and FileExistsUTF8(GetOIFavoriteConfigFilename) then exit; - DefaultFavourites:=CreateDefaulTOIFavouriteProperties; + DefaultFavorites:=CreateDefaulTOIFavoriteProperties; try - if DefaultFavourites.IsEqual(Favourites) then exit; - {$IFDEF DebugFavouriteroperties} - debugln('SaveOIFavouriteProperties is not default'); - DefaultFavourites.WriteDebugReport; - Favourites.WriteDebugReport; + if DefaultFavorites.IsEqual(Favorites) then exit; + {$IFDEF DebugFavoriteroperties} + debugln('SaveOIFavoriteProperties is not default'); + DefaultFavorites.WriteDebugReport; + Favorites.WriteDebugReport; {$ENDIF} try - ConfigStore:=DefaultConfigClass.Create(GetOIFavouriteConfigFilename,false); + ConfigStore:=DefaultConfigClass.Create(GetOIFavoriteConfigFilename,false); try - Favourites.SaveNewItemsToConfig(ConfigStore,'ObjectInspector/Favourites/', - DefaultFavourites); + Favorites.SaveNewItemsToConfig(ConfigStore,'ObjectInspector/Favorites/', + DefaultFavorites); ConfigStore.WriteToDisk; - Favourites.Modified:=false; + Favorites.Modified:=false; finally ConfigStore.Free; end; except on E: Exception do begin - debugln('Error: LoadOIFavouriteProperties: unable to write ', - GetOIFavouriteConfigFilename); + debugln('Error: LoadOIFavoriteProperties: unable to write ', + GetOIFavoriteConfigFilename); end; end; finally - DefaultFavourites.Free; + DefaultFavorites.Free; end; end; -function GetOIFavouriteConfigFilename: string; +function GetOIFavoriteConfigFilename: string; begin - Result:=AppendPathDelim(GetPrimaryConfigPath)+DefaultOIFavouriteConfigFilename; + Result:=AppendPathDelim(GetPrimaryConfigPath)+DefaultOIFavoriteConfigFilename; end; function FindDeclarationOfOIProperty(AnInspector: TObjectInspectorDlg; @@ -312,13 +312,13 @@ begin Result:=true; end; -{ TOIAddRemoveFavouriteDlg } +{ TOIAddRemoveFavoriteDlg } -procedure TOIAddRemoveFavouriteDlg.OkButtonClick(Sender: TObject); +procedure TOIAddRemoveFavoriteDlg.OkButtonClick(Sender: TObject); var NewClassName: String; CurClass: TClass; - NewFavourite: TOIFavouriteProperty; + NewFavorite: TOIFavoriteProperty; begin NewClassName:=ClassCombobox.Text; if (ObjectInspector<>nil) and (ObjectInspector.Selection<>nil) @@ -326,11 +326,11 @@ begin CurClass:=ObjectInspector.Selection[0].ClassType; while CurClass.InheritsFrom(TPersistent) do begin if CompareText(NewClassName,CurClass.ClassName)=0 then begin - NewFavourite:=TOIFavouriteProperty.Create(TPersistentClass(CurClass), + NewFavorite:=TOIFavoriteProperty.Create(TPersistentClass(CurClass), PropertyName,AddMode); - ObjectInspector.Favourites.DeleteConstraints(NewFavourite); - ObjectInspector.Favourites.Add(NewFavourite); - ObjectInspector.FavouriteGrid.BuildPropertyList; + ObjectInspector.Favorites.DeleteConstraints(NewFavorite); + ObjectInspector.Favorites.Add(NewFavorite); + ObjectInspector.FavoriteGrid.BuildPropertyList; ModalResult:=mrOk; exit; end; @@ -342,7 +342,7 @@ begin [mbOk],0); end; -procedure TOIAddRemoveFavouriteDlg.SetObjectInspector(const AValue: TObjectInspectorDlg); +procedure TOIAddRemoveFavoriteDlg.SetObjectInspector(const AValue: TObjectInspectorDlg); var CurRow: TOIPropertyGridRow; begin @@ -355,20 +355,20 @@ begin UpdateComboBox; end; -procedure TOIAddRemoveFavouriteDlg.SetAddMode(const AValue: Boolean); +procedure TOIAddRemoveFavoriteDlg.SetAddMode(const AValue: Boolean); begin if FAddMode=AValue then exit; FAddMode:=AValue; UpdateMode; end; -procedure TOIAddRemoveFavouriteDlg.UpdateLabel; +procedure TOIAddRemoveFavoriteDlg.UpdateLabel; begin - NoteLabel.Caption:=Format(lisOIFChooseABaseClassForTheFavouriteProperty, [ + NoteLabel.Caption:=Format(lisOIFChooseABaseClassForTheFavoriteProperty, [ '"', PropertyName, '"']); end; -procedure TOIAddRemoveFavouriteDlg.UpdateComboBox; +procedure TOIAddRemoveFavoriteDlg.UpdateComboBox; var CurClass: TClass; NewItems: TStringList; @@ -391,22 +391,22 @@ begin NewItems.Free; end; -procedure TOIAddRemoveFavouriteDlg.UpdateMode; +procedure TOIAddRemoveFavoriteDlg.UpdateMode; begin if AddMode then begin - Caption:=lisOIFAddToFavouriteProperties; + Caption:=lisOIFAddToFavoriteProperties; OkButton.Caption:=lisAdd; end else begin - Caption:=lisOIFRemoveFromFavouriteProperties; + Caption:=lisOIFRemoveFromFavoriteProperties; OkButton.Caption:=lisRemove; end; end; -constructor TOIAddRemoveFavouriteDlg.Create(TheOwner: TComponent); +constructor TOIAddRemoveFavoriteDlg.Create(TheOwner: TComponent); begin inherited CreateNew(TheOwner); - Name:='OIAddToFavouriteDlg'; + Name:='OIAddToFavoriteDlg'; Width:=300; Height:=150; Position:=poScreenCenter; @@ -450,10 +450,10 @@ begin end; initialization - DefaultOIFavouriteProperties:=CreateDefaultOIFavouriteProperties; + DefaultOIFavoriteProperties:=CreateDefaultOIFavoriteProperties; finalization - FreeAndNil(DefaultOIFavouriteProperties) + FreeAndNil(DefaultOIFavoriteProperties) end. diff --git a/ide/lazarus.ico b/ide/lazarus.ico index 0096e65b11..0341321b5d 100644 Binary files a/ide/lazarus.ico and b/ide/lazarus.ico differ diff --git a/ide/lazarus.res b/ide/lazarus.res index 14794b7081..250b005670 100644 Binary files a/ide/lazarus.res and b/ide/lazarus.res differ diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index f8b964028d..c34d329e44 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -4458,10 +4458,10 @@ resourcestring lisNPSelectAProjectType = 'Select a project type'; lisNPCreateANewProject = 'Create a new project'; lisNPCreate = 'Create'; - lisOIFChooseABaseClassForTheFavouriteProperty = 'Choose a base class for ' - +'the favourite property %s%s%s.'; - lisOIFAddToFavouriteProperties = 'Add to favourite properties'; - lisOIFRemoveFromFavouriteProperties = 'Remove from favourite properties'; + lisOIFChooseABaseClassForTheFavoriteProperty = 'Choose a base class for ' + +'the favorite property %s%s%s.'; + lisOIFAddToFavoriteProperties = 'Add to favorite properties'; + lisOIFRemoveFromFavoriteProperties = 'Remove from favorite properties'; lisReplacingSelectionFailed = 'Replacing selection failed.'; lisUnableToFindInLFMStream = 'Unable to find %s in LFM Stream.'; lisErrorParsingLfmComponentStream = 'Error parsing lfm component stream.'; diff --git a/ide/main.pp b/ide/main.pp index 98608631f4..c41eac14a4 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -483,8 +483,8 @@ type procedure OIOnAutoShow(Sender: TObject); procedure OIRemainingKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure OIOnAddToFavourites(Sender: TObject); - procedure OIOnRemoveFromFavourites(Sender: TObject); + procedure OIOnAddToFavorites(Sender: TObject); + procedure OIOnRemoveFromFavorites(Sender: TObject); procedure OIOnFindDeclarationOfProperty(Sender: TObject); procedure OIOnSelectionChange(Sender: TObject); function OIOnPropertyHint(Sender: TObject; PointedRow: TOIPropertyGridRow; @@ -1650,16 +1650,16 @@ begin OnExecuteIDEShortCut(Sender,Key,Shift,nil); end; -procedure TMainIDE.OIOnAddToFavourites(Sender: TObject); +procedure TMainIDE.OIOnAddToFavorites(Sender: TObject); begin if ObjectInspector1=nil then exit; - ShowAddRemoveFavouriteDialog(ObjectInspector1,true); + ShowAddRemoveFavoriteDialog(ObjectInspector1,true); end; -procedure TMainIDE.OIOnRemoveFromFavourites(Sender: TObject); +procedure TMainIDE.OIOnRemoveFromFavorites(Sender: TObject); begin if ObjectInspector1=nil then exit; - ShowAddRemoveFavouriteDialog(ObjectInspector1,false); + ShowAddRemoveFavoriteDialog(ObjectInspector1,false); end; procedure TMainIDE.OIOnFindDeclarationOfProperty(Sender: TObject); @@ -5015,9 +5015,9 @@ begin SaveDesktopSettings(EnvironmentOptions); EnvironmentOptions.Save(false); EditorMacroListViewer.SaveGlobalInfo; - //debugln('TMainIDE.SaveEnvironment A ',dbgsName(ObjectInspector1.Favourites)); - if (ObjectInspector1<>nil) and (ObjectInspector1.Favourites<>nil) then - SaveOIFavouriteProperties(ObjectInspector1.Favourites); + //debugln('TMainIDE.SaveEnvironment A ',dbgsName(ObjectInspector1.Favorites)); + if (ObjectInspector1<>nil) and (ObjectInspector1.Favorites<>nil) then + SaveOIFavoriteProperties(ObjectInspector1.Favorites); end; function TMainIDE.DoOpenComponent(const UnitFilename: string; @@ -9895,7 +9895,7 @@ begin if EnvironmentOptions.CreateComponentFocusNameProperty and (ObjectInspector1<>nil) then begin if (ObjectInspector1.ShowFavorites) and (EnvironmentOptions.SwitchToFavoritesOITab) then - Grid:=ObjectInspector1.FavouriteGrid + Grid:=ObjectInspector1.FavoriteGrid else Grid:=ObjectInspector1.PropertyGrid; ObjectInspector1.ActivateGrid(Grid); @@ -12751,13 +12751,13 @@ begin ObjectInspector1.Name:=DefaultObjectInspectorName; ObjectInspector1.ShowFavorites:=True; ObjectInspector1.ShowRestricted:=True; - ObjectInspector1.Favourites:=LoadOIFavouriteProperties; + ObjectInspector1.Favorites:=LoadOIFavoriteProperties; ObjectInspector1.FindDeclarationPopupmenuItem.Visible:=true; - ObjectInspector1.OnAddToFavourites:=@OIOnAddToFavourites; + ObjectInspector1.OnAddToFavorites:=@OIOnAddToFavorites; ObjectInspector1.OnFindDeclarationOfProperty:=@OIOnFindDeclarationOfProperty; ObjectInspector1.OnUpdateRestricted := @OIOnUpdateRestricted; ObjectInspector1.OnRemainingKeyDown:=@OIRemainingKeyDown; - ObjectInspector1.OnRemoveFromFavourites:=@OIOnRemoveFromFavourites; + ObjectInspector1.OnRemoveFromFavorites:=@OIOnRemoveFromFavorites; ObjectInspector1.OnSelectPersistentsInOI:=@OIOnSelectPersistents; ObjectInspector1.OnShowOptions:=@OIOnShowOptions; ObjectInspector1.OnViewRestricted:=@OIOnViewRestricted; diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas index 9353299d5b..2b4968390e 100644 --- a/ide/sourcefilemanager.pas +++ b/ide/sourcefilemanager.pas @@ -2862,7 +2862,7 @@ begin and (ObjectInspector1.PropertyEditorHook.LookupRoot=AnUnitInfo.Component) then begin ObjectInspector1.EventGrid.ItemIndex:=-1; - ObjectInspector1.FavouriteGrid.ItemIndex:=-1; + ObjectInspector1.FavoriteGrid.ItemIndex:=-1; end; //debugln('TLazSourceFileManager.RemoveDanglingEvents ',AnUnitInfo.Filename,' ',dbgsName(AnUnitInfo.Component)); // remove dangling methods @@ -2874,7 +2874,7 @@ begin and (ObjectInspector1.PropertyEditorHook.LookupRoot=AnUnitInfo.Component) then begin ObjectInspector1.EventGrid.RefreshPropertyValues; - ObjectInspector1.FavouriteGrid.RefreshPropertyValues; + ObjectInspector1.FavoriteGrid.RefreshPropertyValues; end; end; diff --git a/ideintf/fpmake.pp b/ideintf/fpmake.pp index 258afb19e2..f74964987f 100644 --- a/ideintf/fpmake.pp +++ b/ideintf/fpmake.pp @@ -88,7 +88,7 @@ begin t.Dependencies.AddUnit('newitemintf'); t.Dependencies.AddUnit('objectinspector'); t.Dependencies.AddUnit('objinspstrconsts'); - t.Dependencies.AddUnit('oifavouriteproperties'); + t.Dependencies.AddUnit('oifavoriteproperties'); t.Dependencies.AddUnit('packageintf'); t.Dependencies.AddUnit('projectintf'); t.Dependencies.AddUnit('projectresourcesintf'); @@ -140,7 +140,7 @@ begin T:=P.Targets.AddUnit('newitemintf.pas'); T:=P.Targets.AddUnit('objectinspector.pp'); T:=P.Targets.AddUnit('objinspstrconsts.pas'); - T:=P.Targets.AddUnit('oifavouriteproperties.pas'); + T:=P.Targets.AddUnit('oifavoriteproperties.pas'); T:=P.Targets.AddUnit('packageintf.pas'); T:=P.Targets.AddUnit('projectintf.pas'); T:=P.Targets.AddUnit('projectresourcesintf.pas'); diff --git a/ideintf/objectinspector.pp b/ideintf/objectinspector.pp index 439ba7bb26..5eefb07560 100644 --- a/ideintf/objectinspector.pp +++ b/ideintf/objectinspector.pp @@ -71,7 +71,7 @@ type TObjectInspectorPage = ( oipgpProperties, oipgpEvents, - oipgpFavourite, + oipgpFavorite, oipgpRestricted ); TObjectInspectorPages = set of TObjectInspectorPage; @@ -277,7 +277,7 @@ type FDragging: boolean; FExpandedProperties: TStringList;// used to restore expanded state when switching selected component(s) FExpandingRow: TOIPropertyGridRow; - FFavourites: TOIFavouriteProperties; + FFavorites: TOIFavoriteProperties; FFilter: TTypeKinds; FIndent: integer; FItemIndex: integer; @@ -326,7 +326,7 @@ type procedure SetColumn(const AValue: TOICustomPropertyGridColumn); procedure SetCurrentEditValue(const NewValue: string); procedure SetDrawHorzGridLines(const AValue: Boolean); - procedure SetFavourites(const AValue: TOIFavouriteProperties); + procedure SetFavorites(const AValue: TOIFavoriteProperties); procedure SetFilter(const AValue: TTypeKinds); procedure SetGutterColor(const AValue: TColor); procedure SetGutterEdgeColor(const AValue: TColor); @@ -498,8 +498,8 @@ type property ShowGutter: Boolean read FShowGutter write SetShowGutter default True; property SplitterX: integer read FSplitterX write SetSplitterX default 100; property TopY: integer read FTopY write SetTopY default 0; - property Favourites: TOIFavouriteProperties read FFavourites - write SetFavourites; + property Favorites: TOIFavoriteProperties read FFavorites + write SetFavorites; property Filter : TTypeKinds read FFilter write SetFilter; end; @@ -590,7 +590,7 @@ type CutPopupmenuItem: TMenuItem; DeletePopupmenuItem: TMenuItem; EventGrid: TOICustomPropertyGrid; - FavouriteGrid: TOICustomPropertyGrid; + FavoriteGrid: TOICustomPropertyGrid; RestrictedGrid: TOICustomPropertyGrid; RestrictedPanel: TPanel; RestrictedInnerPanel: TPanel; @@ -643,17 +643,17 @@ type procedure DoViewRestricted; private FAutoShow: Boolean; - FFavourites: TOIFavouriteProperties; + FFavorites: TOIFavoriteProperties; FInfoBoxHeight: integer; FOnPropertyHint: TOIPropertyHint; FOnSelectionChange: TNotifyEvent; FRestricted: TOIRestrictedProperties; - FOnAddToFavourites: TNotifyEvent; + FOnAddToFavorites: TNotifyEvent; FOnFindDeclarationOfProperty: TNotifyEvent; FOnOIKeyDown: TKeyEvent; FOnRemainingKeyDown: TKeyEvent; FOnRemainingKeyUp: TKeyEvent; - FOnRemoveFromFavourites: TNotifyEvent; + FOnRemoveFromFavorites: TNotifyEvent; FOnUpdateRestricted: TNotifyEvent; FOnViewRestricted: TNotifyEvent; FSelection: TPersistentSelectionList; @@ -675,7 +675,7 @@ type FComponentEditor: TBaseComponentEditor; function GetGridControl(Page: TObjectInspectorPage): TOICustomPropertyGrid; procedure SetComponentEditor(const AValue: TBaseComponentEditor); - procedure SetFavourites(const AValue: TOIFavouriteProperties); + procedure SetFavorites(const AValue: TOIFavoriteProperties); procedure SetComponentTreeHeight(const AValue: integer); procedure SetDefaultItemHeight(const AValue: integer); procedure SetInfoBoxHeight(const AValue: integer); @@ -747,14 +747,14 @@ type write SetDefaultItemHeight; property EnableHookGetSelection: boolean read FEnableHookGetSelection write SetEnableHookGetSelection; - property Favourites: TOIFavouriteProperties read FFavourites write SetFavourites; + property Favorites: TOIFavoriteProperties read FFavorites write SetFavorites; property GridControl[Page: TObjectInspectorPage]: TOICustomPropertyGrid read GetGridControl; property InfoBoxHeight: integer read GetInfoBoxHeight write SetInfoBoxHeight; property OnAddAvailPersistent: TOnAddAvailablePersistent read FOnAddAvailablePersistent write FOnAddAvailablePersistent; - property OnAddToFavourites: TNotifyEvent read FOnAddToFavourites - write FOnAddToFavourites; + property OnAddToFavorites: TNotifyEvent read FOnAddToFavorites + write FOnAddToFavorites; property OnAutoShow: TNotifyEvent read FOnAutoShow write FOnAutoShow; property OnFindDeclarationOfProperty: TNotifyEvent read FOnFindDeclarationOfProperty write FOnFindDeclarationOfProperty; @@ -765,8 +765,8 @@ type write FOnRemainingKeyDown; property OnRemainingKeyUp: TKeyEvent read FOnRemainingKeyUp write FOnRemainingKeyUp; - property OnRemoveFromFavourites: TNotifyEvent read FOnRemoveFromFavourites - write FOnRemoveFromFavourites; + property OnRemoveFromFavorites: TNotifyEvent read FOnRemoveFromFavorites + write FOnRemoveFromFavorites; property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange; property OnSelectPersistentsInOI: TNotifyEvent read FOnSelectPersistentsInOI write FOnSelectPersistentsInOI; @@ -810,13 +810,13 @@ const DefaultOIPageNames: array[TObjectInspectorPage] of shortstring = ( 'PropertyPage', 'EventPage', - 'FavouritePage', + 'FavoritePage', 'RestrictedPage' ); DefaultOIGridNames: array[TObjectInspectorPage] of shortstring = ( 'PropertyGrid', 'EventGrid', - 'FavouriteGrid', + 'FavoriteGrid', 'RestrictedGrid' ); @@ -1689,11 +1689,11 @@ var WidgetSets: TLCLPlatforms; begin WidgetSets := []; - if Favourites<>nil then begin + if Favorites<>nil then begin //debugln('TOICustomPropertyGrid.AddPropertyEditor A ',PropEditor.GetName); - if Favourites is TOIRestrictedProperties then + if Favorites is TOIRestrictedProperties then begin - WidgetSets := (Favourites as TOIRestrictedProperties).AreRestricted( + WidgetSets := (Favorites as TOIRestrictedProperties).AreRestricted( Selection,PropEditor.GetName); if WidgetSets = [] then begin @@ -1702,7 +1702,7 @@ begin end; end else - if not Favourites.AreFavourites(Selection,PropEditor.GetName) then begin + if not Favorites.AreFavorites(Selection,PropEditor.GetName) then begin PropEditor.Free; exit; end; @@ -2951,12 +2951,12 @@ begin Invalidate; end; -procedure TOICustomPropertyGrid.SetFavourites( - const AValue: TOIFavouriteProperties); +procedure TOICustomPropertyGrid.SetFavorites( + const AValue: TOIFavoriteProperties); begin - //debugln('TOICustomPropertyGrid.SetFavourites ',dbgsName(Self)); - if FFavourites=AValue then exit; - FFavourites:=AValue; + //debugln('TOICustomPropertyGrid.SetFavorites ',dbgsName(Self)); + if FFavorites=AValue then exit; + FFavorites:=AValue; BuildPropertyList; end; @@ -4048,7 +4048,7 @@ begin FreeAndNil(FSelection); FreeAndNil(FComponentEditor); inherited Destroy; - FreeAndNil(FFavourites); + FreeAndNil(FFavorites); end; procedure TObjectInspectorDlg.SetPropertyEditorHook(NewValue:TPropertyEditorHook); @@ -4148,7 +4148,7 @@ begin if FRestricted = AValue then exit; //DebugLn('TObjectInspectorDlg.SetRestricted Count: ', DbgS(AValue.Count)); FRestricted := AValue; - RestrictedGrid.Favourites := FRestricted; + RestrictedGrid.Favorites := FRestricted; end; procedure TObjectInspectorDlg.SetOnShowOptions(const AValue: TNotifyEvent); @@ -4253,7 +4253,7 @@ begin case NoteBook.PageIndex of 0: Result:=PropertyGrid; 1: Result:=EventGrid; - 2: Result:=FavouriteGrid; + 2: Result:=FavoriteGrid; 3: Result:=RestrictedGrid; end; end; @@ -4544,14 +4544,14 @@ end; procedure TObjectInspectorDlg.OnAddToFavoritesPopupmenuItemClick(Sender: TObject); begin - //debugln('TObjectInspectorDlg.OnAddToFavouritePopupmenuItemClick'); - if Assigned(OnAddToFavourites) then OnAddToFavourites(Self); + //debugln('TObjectInspectorDlg.OnAddToFavoritePopupmenuItemClick'); + if Assigned(OnAddToFavorites) then OnAddToFavorites(Self); end; procedure TObjectInspectorDlg.OnRemoveFromFavoritesPopupmenuItemClick( Sender: TObject); begin - if Assigned(OnRemoveFromFavourites) then OnRemoveFromFavourites(Self); + if Assigned(OnRemoveFromFavorites) then OnRemoveFromFavorites(Self); end; procedure TObjectInspectorDlg.OnViewRestrictionsPopupmenuItemClick(Sender: TObject); @@ -4866,7 +4866,7 @@ begin NoteBook.Visible:=false; FreeAndNil(PropertyGrid); FreeAndNil(EventGrid); - FreeAndNil(FavouriteGrid); + FreeAndNil(FavoriteGrid); FreeAndNil(RestrictedGrid); FreeAndNil(NoteBook); end; @@ -4928,7 +4928,7 @@ begin AddPage(DefaultOIPageNames[oipgpEvents],oisEvents); - APage:=AddPage(DefaultOIPageNames[oipgpFavourite],oisFavorites); + APage:=AddPage(DefaultOIPageNames[oipgpFavorite],oisFavorites); APage.TabVisible := ShowFavorites; APage:=AddPage(DefaultOIPageNames[oipgpRestricted],oisRestricted); @@ -4939,8 +4939,8 @@ begin PropertyGrid := CreateGrid(PROPS, oipgpProperties, 0); EventGrid := CreateGrid([tkMethod], oipgpEvents, 1); - FavouriteGrid := CreateGrid(PROPS + [tkMethod], oipgpFavourite, 2); - FavouriteGrid.Favourites := FFavourites; + FavoriteGrid := CreateGrid(PROPS + [tkMethod], oipgpFavorite, 2); + FavoriteGrid.Favorites := FFavorites; RestrictedGrid := CreateGrid(PROPS + [tkMethod], oipgpRestricted, 3); RestrictedPanel := TPanel.Create(Self); @@ -5195,17 +5195,17 @@ begin SetDefaultPopupMenuItem.Caption := oisSetToDefaultValue; AddToFavoritesPopupMenuItem.Visible := - (Favourites <> nil) and + (Favorites <> nil) and ShowFavorites and - (GetActivePropertyGrid <> FavouriteGrid) and - Assigned(OnAddToFavourites) and + (GetActivePropertyGrid <> FavoriteGrid) and + Assigned(OnAddToFavorites) and (GetActivePropertyRow <> nil); RemoveFromFavoritesPopupMenuItem.Visible := - (Favourites<>nil) and + (Favorites<>nil) and ShowFavorites and - (GetActivePropertyGrid = FavouriteGrid) and - Assigned(OnRemoveFromFavourites) and + (GetActivePropertyGrid = FavoriteGrid) and + Assigned(OnRemoveFromFavorites) and (GetActivePropertyRow <> nil); CurGrid := GetActivePropertyGrid; @@ -5339,7 +5339,7 @@ procedure TObjectInspectorDlg.ActivateGrid(Grid: TOICustomPropertyGrid); begin if Grid=PropertyGrid then NoteBook.PageIndex:=0 else if Grid=EventGrid then NoteBook.PageIndex:=1 - else if Grid=FavouriteGrid then NoteBook.PageIndex:=2 + else if Grid=FavoriteGrid then NoteBook.PageIndex:=2 else if Grid=RestrictedGrid then NoteBook.PageIndex:=3; end; @@ -5364,7 +5364,7 @@ function TObjectInspectorDlg.GetGridControl(Page: TObjectInspectorPage ): TOICustomPropertyGrid; begin case Page of - oipgpFavourite: Result:=FavouriteGrid; + oipgpFavorite: Result:=FavoriteGrid; oipgpEvents: Result:=EventGrid; oipgpRestricted: Result:=RestrictedGrid; else Result:=PropertyGrid; @@ -5380,12 +5380,12 @@ begin end; end; -procedure TObjectInspectorDlg.SetFavourites(const AValue: TOIFavouriteProperties); +procedure TObjectInspectorDlg.SetFavorites(const AValue: TOIFavoriteProperties); begin - //debugln('TObjectInspectorDlg.SetFavourites ',dbgsName(Self)); - if FFavourites=AValue then exit; - FFavourites:=AValue; - FavouriteGrid.Favourites:=FFavourites; + //debugln('TObjectInspectorDlg.SetFavorites ',dbgsName(Self)); + if FFavorites=AValue then exit; + FFavorites:=AValue; + FavoriteGrid.Favorites:=FFavorites; end; { TCustomPropertiesGrid } diff --git a/ideintf/oifavouriteproperties.pas b/ideintf/oifavouriteproperties.pas index 9dace71cd9..7bf724d16f 100644 --- a/ideintf/oifavouriteproperties.pas +++ b/ideintf/oifavouriteproperties.pas @@ -1,4 +1,3 @@ -{ $Id: oifavouriteproperties.pas 17395 2008-11-15 03:53:22Z paul $} { ***************************************************************************** * * @@ -26,9 +25,9 @@ uses type TWidgetSetRestrictionsArray = array [TLCLPlatform] of Integer; - { TOIFavouriteProperty + { TOIFavoriteProperty BaseClassName } - TOIFavouriteProperty = class + TOIFavoriteProperty = class protected BaseClass: TPersistentClass; BaseClassname: string; @@ -37,18 +36,18 @@ type public constructor Create(ABaseClass: TPersistentClass; const APropertyName: string; TheInclude: boolean); - function Constrains(AnItem: TOIFavouriteProperty): boolean; - function IsFavourite(AClass: TPersistentClass; + function Constrains(AnItem: TOIFavoriteProperty): boolean; + function IsFavorite(AClass: TPersistentClass; const APropertyName: string): boolean; - function Compare(AFavourite: TOIFavouriteProperty): integer; + function Compare(AFavorite: TOIFavoriteProperty): integer; procedure SaveToConfig(ConfigStore: TConfigStorage; const Path: string); - procedure Assign(Src: TOIFavouriteProperty); virtual; - function CreateCopy: TOIFavouriteProperty; + procedure Assign(Src: TOIFavoriteProperty); virtual; + function CreateCopy: TOIFavoriteProperty; function DebugReportAsString: string; end; { TOIRestrictedProperty} - TOIRestrictedProperty = class(TOIFavouriteProperty) + TOIRestrictedProperty = class(TOIFavoriteProperty) protected FWidgetSets: TLCLPlatforms; public @@ -61,55 +60,55 @@ type property WidgetSets: TLCLPlatforms read FWidgetSets write FWidgetSets; end; - { TOIFavouriteProperties } + { TOIFavoriteProperties } - TOIFavouriteProperties = class + TOIFavoriteProperties = class private - FItems: TFPList; // list of TOIFavouriteProperty + FItems: TFPList; // list of TOIFavoriteProperty FModified: Boolean; FSorted: Boolean; FDoublesDeleted: Boolean; protected function GetCount: integer; virtual; - function GetItems(Index: integer): TOIFavouriteProperty; virtual; + function GetItems(Index: integer): TOIFavoriteProperty; virtual; public constructor Create; destructor Destroy; override; procedure Clear; virtual; - procedure Assign(Src: TOIFavouriteProperties); virtual; - function CreateCopy: TOIFavouriteProperties; - function Contains(AnItem: TOIFavouriteProperty): Boolean; virtual; - procedure Add(NewItem: TOIFavouriteProperty); virtual; - procedure AddNew(NewItem: TOIFavouriteProperty); - procedure Remove(AnItem: TOIFavouriteProperty); virtual; - procedure DeleteConstraints(AnItem: TOIFavouriteProperty); virtual; - function IsFavourite( + procedure Assign(Src: TOIFavoriteProperties); virtual; + function CreateCopy: TOIFavoriteProperties; + function Contains(AnItem: TOIFavoriteProperty): Boolean; virtual; + procedure Add(NewItem: TOIFavoriteProperty); virtual; + procedure AddNew(NewItem: TOIFavoriteProperty); + procedure Remove(AnItem: TOIFavoriteProperty); virtual; + procedure DeleteConstraints(AnItem: TOIFavoriteProperty); virtual; + function IsFavorite( AClass: TPersistentClass; const PropertyName: string): boolean; - function AreFavourites( + function AreFavorites( Selection: TPersistentSelectionList; const PropertyName: string): boolean; procedure LoadFromConfig(ConfigStore: TConfigStorage; const Path: string); procedure SaveToConfig(ConfigStore: TConfigStorage; const Path: string); procedure MergeConfig(ConfigStore: TConfigStorage; const Path: string); procedure SaveNewItemsToConfig( ConfigStore: TConfigStorage; - const Path: string; BaseFavourites: TOIFavouriteProperties); + const Path: string; BaseFavorites: TOIFavoriteProperties); procedure Sort; virtual; procedure DeleteDoubles; virtual; - function IsEqual(TheFavourites: TOIFavouriteProperties): boolean; - function GetSubtractList(FavouritesToSubtract: TOIFavouriteProperties): TList; + function IsEqual(TheFavorites: TOIFavoriteProperties): boolean; + function GetSubtractList(FavoritesToSubtract: TOIFavoriteProperties): TList; procedure WriteDebugReport; public - property Items[Index: integer]: TOIFavouriteProperty read GetItems; default; + property Items[Index: integer]: TOIFavoriteProperty read GetItems; default; property Count: integer read GetCount; property Modified: Boolean read FModified write FModified; property Sorted: Boolean read FSorted; property DoublesDeleted: boolean read FDoublesDeleted; end; - TOIFavouritePropertiesClass = class of TOIFavouriteProperties; + TOIFavoritePropertiesClass = class of TOIFavoriteProperties; { TOIRestrictedProperties } - TOIRestrictedProperties = class(TOIFavouriteProperties) + TOIRestrictedProperties = class(TOIFavoriteProperties) public WidgetSetRestrictions: TWidgetSetRestrictionsArray; constructor Create; @@ -122,41 +121,41 @@ type implementation -function CompareOIFavouriteProperties(Data1, Data2: Pointer): integer; +function CompareOIFavoriteProperties(Data1, Data2: Pointer): integer; var - Favourite1: TOIFavouriteProperty; - Favourite2: TOIFavouriteProperty; + Favorite1: TOIFavoriteProperty; + Favorite2: TOIFavoriteProperty; begin - Favourite1:=TOIFavouriteProperty(Data1); - Favourite2:=TOIFavouriteProperty(Data2); - Result:=Favourite1.Compare(Favourite2) + Favorite1:=TOIFavoriteProperty(Data1); + Favorite2:=TOIFavoriteProperty(Data2); + Result:=Favorite1.Compare(Favorite2) end; -{ TOIFavouriteProperties } +{ TOIFavoriteProperties } -function TOIFavouriteProperties.GetCount: integer; +function TOIFavoriteProperties.GetCount: integer; begin Result:=FItems.Count; end; -function TOIFavouriteProperties.GetItems(Index: integer): TOIFavouriteProperty; +function TOIFavoriteProperties.GetItems(Index: integer): TOIFavoriteProperty; begin - Result:=TOIFavouriteProperty(FItems[Index]); + Result:=TOIFavoriteProperty(FItems[Index]); end; -constructor TOIFavouriteProperties.Create; +constructor TOIFavoriteProperties.Create; begin FItems:=TFPList.Create; end; -destructor TOIFavouriteProperties.Destroy; +destructor TOIFavoriteProperties.Destroy; begin Clear; FreeAndNil(FItems); inherited Destroy; end; -procedure TOIFavouriteProperties.Clear; +procedure TOIFavoriteProperties.Clear; var i: Integer; begin @@ -166,7 +165,7 @@ begin FSorted:=true; end; -procedure TOIFavouriteProperties.Assign(Src: TOIFavouriteProperties); +procedure TOIFavoriteProperties.Assign(Src: TOIFavoriteProperties); var i: Integer; begin @@ -178,13 +177,13 @@ begin FSorted:=Src.Sorted; end; -function TOIFavouriteProperties.CreateCopy: TOIFavouriteProperties; +function TOIFavoriteProperties.CreateCopy: TOIFavoriteProperties; begin - Result:=TOIFavouriteProperties.Create; + Result:=TOIFavoriteProperties.Create; Result.Assign(Self); end; -function TOIFavouriteProperties.Contains(AnItem: TOIFavouriteProperty +function TOIFavoriteProperties.Contains(AnItem: TOIFavoriteProperty ): Boolean; var i: Integer; @@ -198,7 +197,7 @@ begin Result:=false; end; -procedure TOIFavouriteProperties.Add(NewItem: TOIFavouriteProperty); +procedure TOIFavoriteProperties.Add(NewItem: TOIFavoriteProperty); begin FItems.Add(NewItem); FSorted:=(Count<=1) @@ -208,7 +207,7 @@ begin Modified:=true; end; -procedure TOIFavouriteProperties.AddNew(NewItem: TOIFavouriteProperty); +procedure TOIFavoriteProperties.AddNew(NewItem: TOIFavoriteProperty); begin if Contains(NewItem) then NewItem.Free @@ -216,17 +215,17 @@ begin Add(NewItem); end; -procedure TOIFavouriteProperties.Remove(AnItem: TOIFavouriteProperty); +procedure TOIFavoriteProperties.Remove(AnItem: TOIFavoriteProperty); begin Modified:=FItems.Remove(AnItem)>=0; end; -procedure TOIFavouriteProperties.DeleteConstraints( - AnItem: TOIFavouriteProperty); +procedure TOIFavoriteProperties.DeleteConstraints( + AnItem: TOIFavoriteProperty); // delete all items, that would constrain AnItem var i: Integer; - CurItem: TOIFavouriteProperty; + CurItem: TOIFavoriteProperty; begin for i:=Count-1 downto 0 do begin CurItem:=Items[i]; @@ -238,12 +237,12 @@ begin end; end; -function TOIFavouriteProperties.IsFavourite(AClass: TPersistentClass; +function TOIFavoriteProperties.IsFavorite(AClass: TPersistentClass; const PropertyName: string): boolean; var i: Integer; - CurItem: TOIFavouriteProperty; - BestItem: TOIFavouriteProperty; + CurItem: TOIFavoriteProperty; + BestItem: TOIFavoriteProperty; begin if (AClass=nil) or (PropertyName='') then begin Result:=false; @@ -252,17 +251,17 @@ begin BestItem:=nil; for i:=0 to Count-1 do begin CurItem:=Items[i]; - if not CurItem.IsFavourite(AClass,PropertyName) then continue; + if not CurItem.IsFavorite(AClass,PropertyName) then continue; if (BestItem=nil) or (AClass.InheritsFrom(BestItem.BaseClass)) then begin - //debugln('TOIFavouriteProperties.IsFavourite ',AClass.ClassName,' ',PropertyName); + //debugln('TOIFavoriteProperties.IsFavorite ',AClass.ClassName,' ',PropertyName); BestItem:=CurItem; end; end; Result:=(BestItem<>nil) and BestItem.Include; end; -function TOIFavouriteProperties.AreFavourites( +function TOIFavoriteProperties.AreFavorites( Selection: TPersistentSelectionList; const PropertyName: string): boolean; var i: Integer; @@ -270,7 +269,7 @@ begin Result:=(Selection<>nil) and (Selection.Count>0); if not Result then exit; for i:=0 to Selection.Count-1 do begin - if not IsFavourite(TPersistentClass(Selection[i].ClassType),PropertyName) + if not IsFavorite(TPersistentClass(Selection[i].ClassType),PropertyName) then begin Result:=false; exit; @@ -278,12 +277,12 @@ begin end; end; -procedure TOIFavouriteProperties.LoadFromConfig(ConfigStore: TConfigStorage; +procedure TOIFavoriteProperties.LoadFromConfig(ConfigStore: TConfigStorage; const Path: string); var NewCount: LongInt; i: Integer; - NewItem: TOIFavouriteProperty; + NewItem: TOIFavoriteProperty; p: String; NewPropertyName: String; NewInclude: Boolean; @@ -302,18 +301,18 @@ begin if (NewBaseClassname='') or (not IsValidIdent(NewBaseClassname)) then continue; NewBaseClass:=GetClass(NewBaseClassname); - NewItem:=TOIFavouriteProperty.Create(NewBaseClass,NewPropertyName, + NewItem:=TOIFavoriteProperty.Create(NewBaseClass,NewPropertyName, NewInclude); NewItem.BaseClassName:=NewBaseClassname; Add(NewItem); end; - {$IFDEF DebugFavouriteroperties} - debugln('TOIFavouriteProperties.LoadFromConfig END'); + {$IFDEF DebugFavoriteroperties} + debugln('TOIFavoriteProperties.LoadFromConfig END'); WriteDebugReport; {$ENDIF} end; -procedure TOIFavouriteProperties.SaveToConfig(ConfigStore: TConfigStorage; +procedure TOIFavoriteProperties.SaveToConfig(ConfigStore: TConfigStorage; const Path: string); var i: Integer; @@ -323,52 +322,52 @@ begin Items[i].SaveToConfig(ConfigStore,Path+'Item'+IntToStr(i)+'/'); end; -procedure TOIFavouriteProperties.MergeConfig(ConfigStore: TConfigStorage; +procedure TOIFavoriteProperties.MergeConfig(ConfigStore: TConfigStorage; const Path: string); var - NewFavourites: TOIFavouriteProperties; - OldItem: TOIFavouriteProperty; - NewItem: TOIFavouriteProperty; + NewFavorites: TOIFavoriteProperties; + OldItem: TOIFavoriteProperty; + NewItem: TOIFavoriteProperty; cmp: LongInt; NewIndex: Integer; OldIndex: Integer; begin - NewFavourites:=TOIFavouritePropertiesClass(ClassType).Create; - {$IFDEF DebugFavouriteroperties} - debugln('TOIFavouriteProperties.MergeConfig ',dbgsName(NewFavourites),' ',dbgsName(NewFavourites.FItems)); + NewFavorites:=TOIFavoritePropertiesClass(ClassType).Create; + {$IFDEF DebugFavoriteroperties} + debugln('TOIFavoriteProperties.MergeConfig ',dbgsName(NewFavorites),' ',dbgsName(NewFavorites.FItems)); {$ENDIF} try // load config - NewFavourites.LoadFromConfig(ConfigStore,Path); + NewFavorites.LoadFromConfig(ConfigStore,Path); // sort both to see the differences - NewFavourites.DeleteDoubles; // descending + NewFavorites.DeleteDoubles; // descending DeleteDoubles; // descending - // add all new things from NewFavourites + // add all new things from NewFavorites NewIndex:=0; OldIndex:=0; - while (NewIndex=Count then begin // item only exists in config -> move to this list - NewFavourites.FItems[NewIndex]:=nil; + NewFavorites.FItems[NewIndex]:=nil; inc(NewIndex); FItems.Insert(OldIndex,NewItem); inc(OldIndex); end else begin OldItem:=Items[OldIndex]; cmp:=OldItem.Compare(NewItem); - //debugln('TOIFavouriteProperties.MergeConfig cmp=',dbgs(cmp),' OldItem=[',OldItem.DebugReportAsString,'] NewItem=[',NewItem.DebugReportAsString,']'); + //debugln('TOIFavoriteProperties.MergeConfig cmp=',dbgs(cmp),' OldItem=[',OldItem.DebugReportAsString,'] NewItem=[',NewItem.DebugReportAsString,']'); if cmp=0 then begin // item already exists in this list inc(NewIndex); inc(OldIndex); end else if cmp<0 then begin - // item exists only in old favourites + // item exists only in old favorites // -> next old inc(OldIndex); end else begin // item only exists in config -> move to this list - NewFavourites.FItems[NewIndex]:=nil; + NewFavorites.FItems[NewIndex]:=nil; inc(NewIndex); FItems.Insert(OldIndex,NewItem); inc(OldIndex); @@ -376,34 +375,34 @@ begin end; end; finally - NewFavourites.Free; + NewFavorites.Free; end; - {$IFDEF DebugFavouriteroperties} - debugln('TOIFavouriteProperties.MergeConfig END'); + {$IFDEF DebugFavoriteroperties} + debugln('TOIFavoriteProperties.MergeConfig END'); WriteDebugReport; {$ENDIF} end; -procedure TOIFavouriteProperties.SaveNewItemsToConfig( +procedure TOIFavoriteProperties.SaveNewItemsToConfig( ConfigStore: TConfigStorage; const Path: string; - BaseFavourites: TOIFavouriteProperties); -// Save all items, that are in this list and not in BaseFavourites -// It does not save, if an item in BaseFavourites is missing in this list + BaseFavorites: TOIFavoriteProperties); +// Save all items, that are in this list and not in BaseFavorites +// It does not save, if an item in BaseFavorites is missing in this list var SubtractList: TList; i: Integer; - CurItem: TOIFavouriteProperty; + CurItem: TOIFavoriteProperty; begin - SubtractList:=GetSubtractList(BaseFavourites); + SubtractList:=GetSubtractList(BaseFavorites); try ConfigStore.SetDeleteValue(Path+'Count',SubtractList.Count,0); - {$IFDEF DebugFavouriteroperties} - debugln('TOIFavouriteProperties.SaveNewItemsToConfig A Count=',dbgs(SubtractList.Count)); + {$IFDEF DebugFavoriteroperties} + debugln('TOIFavoriteProperties.SaveNewItemsToConfig A Count=',dbgs(SubtractList.Count)); {$ENDIF} for i:=0 to SubtractList.Count-1 do begin - CurItem:=TOIFavouriteProperty(SubtractList[i]); + CurItem:=TOIFavoriteProperty(SubtractList[i]); CurItem.SaveToConfig(ConfigStore,Path+'Item'+IntToStr(i)+'/'); - {$IFDEF DebugFavouriteroperties} + {$IFDEF DebugFavoriteroperties} debugln(' i=',dbgs(i),' ',CurItem.DebugReportAsString); {$ENDIF} end; @@ -412,13 +411,13 @@ begin end; end; -procedure TOIFavouriteProperties.Sort; +procedure TOIFavoriteProperties.Sort; begin if FSorted then exit; - FItems.Sort(@CompareOIFavouriteProperties); + FItems.Sort(@CompareOIFavoriteProperties); end; -procedure TOIFavouriteProperties.DeleteDoubles; +procedure TOIFavoriteProperties.DeleteDoubles; // This also sorts var i: Integer; @@ -434,72 +433,72 @@ begin FDoublesDeleted:=true; end; -function TOIFavouriteProperties.IsEqual(TheFavourites: TOIFavouriteProperties +function TOIFavoriteProperties.IsEqual(TheFavorites: TOIFavoriteProperties ): boolean; var i: Integer; begin Result:=false; DeleteDoubles; - TheFavourites.DeleteDoubles; - if Count<>TheFavourites.Count then exit; + TheFavorites.DeleteDoubles; + if Count<>TheFavorites.Count then exit; for i:=Count-1 downto 1 do - if Items[i].Compare(TheFavourites.Items[i])<>0 then exit; + if Items[i].Compare(TheFavorites.Items[i])<>0 then exit; Result:=true; end; -function TOIFavouriteProperties.GetSubtractList( - FavouritesToSubtract: TOIFavouriteProperties): TList; -// create a list of TOIFavouriteProperty of all items in this list -// and not in FavouritesToSubtract +function TOIFavoriteProperties.GetSubtractList( + FavoritesToSubtract: TOIFavoriteProperties): TList; +// create a list of TOIFavoriteProperty of all items in this list +// and not in FavoritesToSubtract var SelfIndex: Integer; SubtractIndex: Integer; - CurItem: TOIFavouriteProperty; + CurItem: TOIFavoriteProperty; cmp: LongInt; begin Result:=TList.Create; DeleteDoubles; // this also sorts descending - FavouritesToSubtract.DeleteDoubles; // this also sorts descending + FavoritesToSubtract.DeleteDoubles; // this also sorts descending SelfIndex:=0; SubtractIndex:=0; while SelfIndex=FavouritesToSubtract.Count then begin + if SubtractIndex>=FavoritesToSubtract.Count then begin // item does not exist in SubtractIndex -> add it Result.Add(CurItem); inc(SelfIndex); end else begin - cmp:=CurItem.Compare(FavouritesToSubtract[SubtractIndex]); - //debugln('TOIFavouriteProperties.GetSubtractList cmp=',dbgs(cmp),' CurItem=[',CurItem.DebugReportAsString,'] SubtractItem=[',FavouritesToSubtract[SubtractIndex].DebugReportAsString,']'); + cmp:=CurItem.Compare(FavoritesToSubtract[SubtractIndex]); + //debugln('TOIFavoriteProperties.GetSubtractList cmp=',dbgs(cmp),' CurItem=[',CurItem.DebugReportAsString,'] SubtractItem=[',FavoritesToSubtract[SubtractIndex].DebugReportAsString,']'); if cmp=0 then begin // item exists in SubtractIndex -> skip inc(SubtractIndex); inc(SelfIndex); end else if cmp>0 then begin - // item does not exist in FavouritesToSubtract -> add it + // item does not exist in FavoritesToSubtract -> add it Result.Add(CurItem); inc(SelfIndex); end else begin - // item exists only in FavouritesToSubtract -> skip + // item exists only in FavoritesToSubtract -> skip inc(SubtractIndex); end; end; end; end; -procedure TOIFavouriteProperties.WriteDebugReport; +procedure TOIFavoriteProperties.WriteDebugReport; var i: Integer; begin - debugln('TOIFavouriteProperties.WriteDebugReport Count=',dbgs(Count)); + debugln('TOIFavoriteProperties.WriteDebugReport Count=',dbgs(Count)); for i:=0 to Count-1 do debugln(' i=',dbgs(i),' ',Items[i].DebugReportAsString); end; -{ TOIFavouriteProperty } +{ TOIFavoriteProperty } -constructor TOIFavouriteProperty.Create(ABaseClass: TPersistentClass; +constructor TOIFavoriteProperty.Create(ABaseClass: TPersistentClass; const APropertyName: string; TheInclude: boolean); begin BaseClass:=ABaseClass; @@ -507,7 +506,7 @@ begin Include:=TheInclude; end; -function TOIFavouriteProperty.Constrains(AnItem: TOIFavouriteProperty +function TOIFavoriteProperty.Constrains(AnItem: TOIFavoriteProperty ): boolean; // true if this item constrains AnItem // This item constrains AnItem, if this is the opposite (Include) and @@ -518,37 +517,37 @@ begin and (BaseClass.InheritsFrom(AnItem.BaseClass)); end; -function TOIFavouriteProperty.IsFavourite(AClass: TPersistentClass; +function TOIFavoriteProperty.IsFavorite(AClass: TPersistentClass; const APropertyName: string): boolean; begin Result:=(CompareText(PropertyName,APropertyName)=0) and (AClass.InheritsFrom(BaseClass)); end; -function TOIFavouriteProperty.Compare(AFavourite: TOIFavouriteProperty +function TOIFavoriteProperty.Compare(AFavorite: TOIFavoriteProperty ): integer; function CompareBaseClass: integer; begin if BaseClass<>nil then begin - if AFavourite.BaseClass<>nil then - Result:=ComparePointers(BaseClass,AFavourite.BaseClass) + if AFavorite.BaseClass<>nil then + Result:=ComparePointers(BaseClass,AFavorite.BaseClass) else - Result:=CompareText(BaseClass.ClassName,AFavourite.BaseClassName); + Result:=CompareText(BaseClass.ClassName,AFavorite.BaseClassName); end else begin - if AFavourite.BaseClass<>nil then - Result:=CompareText(BaseClassName,AFavourite.BaseClass.ClassName) + if AFavorite.BaseClass<>nil then + Result:=CompareText(BaseClassName,AFavorite.BaseClass.ClassName) else - Result:=CompareText(BaseClassName,AFavourite.BaseClassName); + Result:=CompareText(BaseClassName,AFavorite.BaseClassName); end; end; begin // first compare PropertyName - Result:=CompareText(PropertyName,AFavourite.PropertyName); + Result:=CompareText(PropertyName,AFavorite.PropertyName); if Result<>0 then exit; // then compare Include - if Include<>AFavourite.Include then begin + if Include<>AFavorite.Include then begin if Include then Result:=1 else @@ -559,7 +558,7 @@ begin Result:=CompareBaseClass; end; -procedure TOIFavouriteProperty.SaveToConfig(ConfigStore: TConfigStorage; +procedure TOIFavoriteProperty.SaveToConfig(ConfigStore: TConfigStorage; const Path: string); begin if BaseClass<>nil then @@ -570,7 +569,7 @@ begin ConfigStore.SetDeleteValue(Path+'Include',Include,true); end; -procedure TOIFavouriteProperty.Assign(Src: TOIFavouriteProperty); +procedure TOIFavoriteProperty.Assign(Src: TOIFavoriteProperty); begin BaseClassName:=Src.BaseClassName; BaseClass:=Src.BaseClass; @@ -578,13 +577,13 @@ begin Include:=Src.Include; end; -function TOIFavouriteProperty.CreateCopy: TOIFavouriteProperty; +function TOIFavoriteProperty.CreateCopy: TOIFavoriteProperty; begin - Result:=TOIFavouriteProperty.Create(BaseClass,PropertyName,Include); + Result:=TOIFavoriteProperty.Create(BaseClass,PropertyName,Include); Result.BaseClass:=BaseClass; end; -function TOIFavouriteProperty.DebugReportAsString: string; +function TOIFavoriteProperty.DebugReportAsString: string; begin Result:='PropertyName="'+PropertyName+'"' +' Include='+dbgs(Include)