Fixed settings storing.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<MainSource>tim2view.dpr</MainSource>
|
<MainSource>tim2view.dpr</MainSource>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Release</Config>
|
<Config Condition="'$(Config)'==''">Release</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||||
<TargetedPlatforms>3</TargetedPlatforms>
|
<TargetedPlatforms>3</TargetedPlatforms>
|
||||||
<AppType>Application</AppType>
|
<AppType>Application</AppType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
BIN
tim2view.res
BIN
tim2view.res
Binary file not shown.
@@ -529,7 +529,9 @@ object frmMain: TfrmMain
|
|||||||
Height = 28
|
Height = 28
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
Caption = 'Stop Scan'
|
Caption = 'Stop Scan'
|
||||||
|
DoubleBuffered = False
|
||||||
Enabled = False
|
Enabled = False
|
||||||
|
ParentDoubleBuffered = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnClick = btnStopScanClick
|
OnClick = btnStopScanClick
|
||||||
end
|
end
|
||||||
@@ -683,6 +685,8 @@ object frmMain: TfrmMain
|
|||||||
Height = 27
|
Height = 27
|
||||||
Align = alRight
|
Align = alRight
|
||||||
Caption = 'CLUT'
|
Caption = 'CLUT'
|
||||||
|
DoubleBuffered = False
|
||||||
|
ParentDoubleBuffered = False
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnClick = btnShowClutClick
|
OnClick = btnShowClutClick
|
||||||
end
|
end
|
||||||
@@ -697,8 +701,10 @@ object frmMain: TfrmMain
|
|||||||
AutoCloseUp = True
|
AutoCloseUp = True
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
Anchors = []
|
Anchors = []
|
||||||
|
DoubleBuffered = False
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
|
ParentDoubleBuffered = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
Text = 'Real'
|
Text = 'Real'
|
||||||
OnChange = actDrawSelectedTimExecute
|
OnChange = actDrawSelectedTimExecute
|
||||||
@@ -721,8 +727,10 @@ object frmMain: TfrmMain
|
|||||||
AutoCloseUp = True
|
AutoCloseUp = True
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
Anchors = []
|
Anchors = []
|
||||||
|
DoubleBuffered = False
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
|
ParentDoubleBuffered = False
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
Text = 'Full transparence'
|
Text = 'Full transparence'
|
||||||
OnChange = cbbTranspModeChange
|
OnChange = cbbTranspModeChange
|
||||||
@@ -799,11 +807,11 @@ object frmMain: TfrmMain
|
|||||||
object N4: TMenuItem
|
object N4: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
object IMInfo1: TMenuItem
|
object mnTimInfoMain: TMenuItem
|
||||||
Action = actTimInfo
|
Action = actTimInfo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object mnConfig: TMenuItem
|
object mnOptions: TMenuItem
|
||||||
Caption = '&Options'
|
Caption = '&Options'
|
||||||
object mnAssociate: TMenuItem
|
object mnAssociate: TMenuItem
|
||||||
Action = actAssocTims
|
Action = actAssocTims
|
||||||
@@ -898,7 +906,7 @@ object frmMain: TfrmMain
|
|||||||
OnExecute = actOpenLabExecute
|
OnExecute = actOpenLabExecute
|
||||||
end
|
end
|
||||||
object actAbout: TAction
|
object actAbout: TAction
|
||||||
Caption = 'About...'
|
Caption = '&About...'
|
||||||
OnExecute = actAboutExecute
|
OnExecute = actAboutExecute
|
||||||
end
|
end
|
||||||
object actStretch: TAction
|
object actStretch: TAction
|
||||||
@@ -907,32 +915,26 @@ object frmMain: TfrmMain
|
|||||||
OnExecute = actStretchExecute
|
OnExecute = actStretchExecute
|
||||||
end
|
end
|
||||||
object actTimInfo: TAction
|
object actTimInfo: TAction
|
||||||
Caption = 'TIM Info'
|
Caption = '&TIM Info'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
OnExecute = actTimInfoExecute
|
OnExecute = actTimInfoExecute
|
||||||
end
|
end
|
||||||
object actAssocTims: TAction
|
object actAssocTims: TAction
|
||||||
Caption = 'Open TIMs with T2V'
|
Caption = '&Open TIMs with T2V'
|
||||||
OnExecute = actAssocTimsExecute
|
OnExecute = actAssocTimsExecute
|
||||||
end
|
end
|
||||||
object actExtractList: TAction
|
object actExtractList: TAction
|
||||||
Caption = 'Extract TIMs'
|
Caption = '&Extract TIMs'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
ShortCut = 112
|
ShortCut = 112
|
||||||
OnExecute = actExtractListExecute
|
OnExecute = actExtractListExecute
|
||||||
end
|
end
|
||||||
object actChangeClutIdx: TAction
|
object actChangeClutIdx: TAction
|
||||||
Caption = 'actChangeClutIdx'
|
|
||||||
end
|
|
||||||
object actChangeBackColor: TAction
|
|
||||||
Caption = '&Change Background Color'
|
|
||||||
end
|
end
|
||||||
object actReturnFocus: TAction
|
object actReturnFocus: TAction
|
||||||
Caption = 'actReturnFocus'
|
|
||||||
OnExecute = actReturnFocusExecute
|
OnExecute = actReturnFocusExecute
|
||||||
end
|
end
|
||||||
object actDrawSelectedTim: TAction
|
object actDrawSelectedTim: TAction
|
||||||
Caption = 'actDrawSelectedTim'
|
|
||||||
OnExecute = actDrawSelectedTimExecute
|
OnExecute = actDrawSelectedTimExecute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ type
|
|||||||
N3: TMenuItem;
|
N3: TMenuItem;
|
||||||
mnAbout: TMenuItem;
|
mnAbout: TMenuItem;
|
||||||
pbProgress: TProgressBar;
|
pbProgress: TProgressBar;
|
||||||
mnConfig: TMenuItem;
|
mnOptions: TMenuItem;
|
||||||
pnlStatus: TPanel;
|
pnlStatus: TPanel;
|
||||||
lblStatus: TLabel;
|
lblStatus: TLabel;
|
||||||
btnStopScan: TButton;
|
btnStopScan: TButton;
|
||||||
@@ -74,7 +74,7 @@ type
|
|||||||
actStretch: TAction;
|
actStretch: TAction;
|
||||||
actTimInfo: TAction;
|
actTimInfo: TAction;
|
||||||
mnTIMInfo: TMenuItem;
|
mnTIMInfo: TMenuItem;
|
||||||
IMInfo1: TMenuItem;
|
mnTimInfoMain: TMenuItem;
|
||||||
actAssocTims: TAction;
|
actAssocTims: TAction;
|
||||||
mnAssociate: TMenuItem;
|
mnAssociate: TMenuItem;
|
||||||
N6: TMenuItem;
|
N6: TMenuItem;
|
||||||
@@ -83,7 +83,6 @@ type
|
|||||||
pbTim: TImage;
|
pbTim: TImage;
|
||||||
btnShowClut: TButton;
|
btnShowClut: TButton;
|
||||||
cbbCLUT: TComboBox;
|
cbbCLUT: TComboBox;
|
||||||
actChangeBackColor: TAction;
|
|
||||||
actReturnFocus: TAction;
|
actReturnFocus: TAction;
|
||||||
actDrawSelectedTim: TAction;
|
actDrawSelectedTim: TAction;
|
||||||
procedure btnStopScanClick(Sender: TObject);
|
procedure btnStopScanClick(Sender: TObject);
|
||||||
@@ -682,7 +681,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
|
|||||||
var
|
var
|
||||||
hGridRect: TGridRect;
|
hGridRect: TGridRect;
|
||||||
begin
|
begin
|
||||||
Settings := TSettings.Create;
|
Settings := TSettings.Create(ExtractFilePath(ParamStr(0)));
|
||||||
Settings.LoadFromFile;
|
Settings.LoadFromFile;
|
||||||
|
|
||||||
actStretch.Checked := Settings.StretchMode;
|
actStretch.Checked := Settings.StretchMode;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ unit uSettings;
|
|||||||
type
|
type
|
||||||
TCustomSettings = class
|
TCustomSettings = class
|
||||||
private
|
private
|
||||||
|
FFileName: string;
|
||||||
procedure LoadFromStream(const Stream: TStream) ;
|
procedure LoadFromStream(const Stream: TStream) ;
|
||||||
procedure SaveToStream(const Stream: TStream) ;
|
procedure SaveToStream(const Stream: TStream) ;
|
||||||
public
|
public
|
||||||
@@ -21,31 +22,26 @@ unit uSettings;
|
|||||||
FStretchMode: Boolean;
|
FStretchMode: Boolean;
|
||||||
FLastDir: string;
|
FLastDir: string;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create(const DirPath: string);
|
||||||
published
|
published
|
||||||
property TranspMode: Integer read FTranspMode write FTranspMode;
|
property TranspMode: Integer read FTranspMode write FTranspMode;
|
||||||
property StretchMode: Boolean read FStretchMode write FStretchMode;
|
property StretchMode: Boolean read FStretchMode write FStretchMode;
|
||||||
property LastDir: string read FLastDir write FLastDir;
|
property LastDir: string read FLastDir write FLastDir;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
|
||||||
Settings: TSettings;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses TypInfo, Sysutils;
|
uses TypInfo, Sysutils;
|
||||||
|
|
||||||
const FileName = 'settings.t2v';
|
|
||||||
|
|
||||||
{ TSettings }
|
{ TSettings }
|
||||||
|
|
||||||
procedure TCustomSettings.LoadFromFile() ;
|
procedure TCustomSettings.LoadFromFile() ;
|
||||||
var
|
var
|
||||||
Stream: TStream;
|
Stream: TStream;
|
||||||
begin
|
begin
|
||||||
if not FileExists(FileName) then Exit;
|
if not FileExists(FFileName) then Exit;
|
||||||
|
|
||||||
Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite) ;
|
Stream := TFileStream.Create(FFileName, fmOpenRead or fmShareDenyWrite) ;
|
||||||
try
|
try
|
||||||
LoadFromStream(Stream) ;
|
LoadFromStream(Stream) ;
|
||||||
finally
|
finally
|
||||||
@@ -76,7 +72,7 @@ unit uSettings;
|
|||||||
var
|
var
|
||||||
Stream: TStream;
|
Stream: TStream;
|
||||||
begin
|
begin
|
||||||
Stream := TFileStream.Create(FileName, fmCreate) ;
|
Stream := TFileStream.Create(FFileName, fmCreate) ;
|
||||||
try
|
try
|
||||||
SaveToStream(Stream) ;
|
SaveToStream(Stream) ;
|
||||||
finally
|
finally
|
||||||
@@ -84,8 +80,8 @@ unit uSettings;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSettings.SaveToStream(const Stream: TStream) ;
|
procedure TCustomSettings.SaveToStream(const Stream: TStream) ;
|
||||||
var
|
var
|
||||||
PropName, PropValue: string;
|
PropName, PropValue: string;
|
||||||
cnt: Integer;
|
cnt: Integer;
|
||||||
lPropInfo: PPropInfo;
|
lPropInfo: PPropInfo;
|
||||||
@@ -93,7 +89,7 @@ unit uSettings;
|
|||||||
lPropList: PPropList;
|
lPropList: PPropList;
|
||||||
lPropType: PPTypeInfo;
|
lPropType: PPTypeInfo;
|
||||||
Writer: TWriter;
|
Writer: TWriter;
|
||||||
begin
|
begin
|
||||||
lPropCount := GetPropList(PTypeInfo(ClassInfo), lPropList) ;
|
lPropCount := GetPropList(PTypeInfo(ClassInfo), lPropList) ;
|
||||||
Writer := TWriter.Create(Stream, $FFF) ;
|
Writer := TWriter.Create(Stream, $FFF) ;
|
||||||
Stream.Size := 0;
|
Stream.Size := 0;
|
||||||
@@ -112,18 +108,15 @@ unit uSettings;
|
|||||||
|
|
||||||
Writer.WriteListEnd;
|
Writer.WriteListEnd;
|
||||||
FreeAndNil(Writer) ;
|
FreeAndNil(Writer) ;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TSettings }
|
{ TSettings }
|
||||||
|
|
||||||
constructor TSettings.Create;
|
constructor TSettings.Create(const DirPath: string);
|
||||||
begin
|
begin
|
||||||
|
FFileName := IncludeTrailingPathDelimiter(DirPath) + 'settings.t2v';
|
||||||
FTranspMode := 0;
|
FTranspMode := 0;
|
||||||
FStretchMode := False;
|
FStretchMode := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
end.
|
||||||
Settings := TSettings.Create;
|
|
||||||
finalization
|
|
||||||
FreeAndNil(Settings) ;
|
|
||||||
end.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user