mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: Use class name instead of component name in "session.ini", so that every form instance has the same settings.
This commit is contained in:
parent
432ce2323f
commit
ae1a3d2488
2 changed files with 29 additions and 5 deletions
|
|
@ -77,19 +77,24 @@ type
|
|||
TIniPropStorageEx = class(TCustomIniPropStorage)
|
||||
private
|
||||
FPercentSize: Integer;
|
||||
function ChangeIdent(const Ident: String): String;
|
||||
protected
|
||||
function IniFileClass: TIniFileClass; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure Restore; override;
|
||||
function DoReadString(const Section, Ident, default: string): string; override;
|
||||
procedure DoWriteString(const Section, Ident, Value: string); override;
|
||||
|
||||
property PercentSize: Integer read FPercentSize write FPercentSize;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses Forms, uOSUtils;
|
||||
uses
|
||||
Forms, uOSUtils, uDCUtils;
|
||||
|
||||
{ TFileStreamEx}
|
||||
{ TFileStreamEx }
|
||||
|
||||
constructor TFileStreamEx.Create(const AFileName: UTF8String; Mode: Word);
|
||||
begin
|
||||
|
|
@ -252,4 +257,23 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
function TIniPropStorageEx.DoReadString(const Section, Ident, default: string): string;
|
||||
begin
|
||||
Result := inherited DoReadString(Section, ChangeIdent(Ident), default);
|
||||
end;
|
||||
|
||||
procedure TIniPropStorageEx.DoWriteString(const Section, Ident, Value: string);
|
||||
begin
|
||||
inherited DoWriteString(Section, ChangeIdent(Ident), Value);
|
||||
end;
|
||||
|
||||
function TIniPropStorageEx.ChangeIdent(const Ident: String): String;
|
||||
begin
|
||||
// Change component name to class name.
|
||||
if StrBegins(Ident, Owner.Name) then
|
||||
Result := Owner.ClassName + Copy(Ident, 1 + Length(Owner.Name), MaxInt)
|
||||
else
|
||||
Result := Ident;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
@ -374,7 +374,7 @@ begin
|
|||
begin
|
||||
sWidth:= IntToStr(Monitor.Width);
|
||||
sHeight:= IntToStr(Monitor.Height);
|
||||
Result.IniSection:= Name + '(' + sWidth + 'x' + sHeight + ')';
|
||||
Result.IniSection:= ClassName + '(' + sWidth + 'x' + sHeight + ')';
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
@ -908,4 +908,4 @@ initialization
|
|||
|
||||
finalization
|
||||
DeInitGlobs;
|
||||
end.
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue