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