mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-07 02:30:19 -05:00
Moar settings
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@383 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
ef804714c4
commit
de92bc6604
File diff suppressed because it is too large
Load Diff
@ -1,32 +1,34 @@
|
||||
object SettingsForm: TSettingsForm
|
||||
Left = 600
|
||||
Height = 559
|
||||
Top = 138
|
||||
Width = 342
|
||||
Left = 563
|
||||
Height = 558
|
||||
Top = 173
|
||||
Width = 360
|
||||
ActiveControl = SettingsTreeView
|
||||
Caption = 'Simba Settings'
|
||||
ClientHeight = 559
|
||||
ClientWidth = 342
|
||||
ClientHeight = 558
|
||||
ClientWidth = 360
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '0.9.29'
|
||||
object SettingsTreeView: TTreeView
|
||||
Left = 16
|
||||
Height = 474
|
||||
Height = 473
|
||||
Top = 16
|
||||
Width = 306
|
||||
Width = 324
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
DefaultItemHeight = 19
|
||||
ReadOnly = True
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 0
|
||||
OnDblClick = SettingsTreeViewDblClick
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
object SettingsFormButtonOK: TButton
|
||||
Left = 247
|
||||
Left = 265
|
||||
Height = 25
|
||||
Top = 512
|
||||
Top = 511
|
||||
Width = 75
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'OK'
|
||||
OnClick = SettingsFormButtonOKClick
|
||||
TabOrder = 1
|
||||
@ -34,8 +36,9 @@ object SettingsForm: TSettingsForm
|
||||
object SettingsFormButtonCancel: TButton
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 512
|
||||
Top = 511
|
||||
Width = 75
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Cancel'
|
||||
OnClick = SettingsFormButtonCancelClick
|
||||
TabOrder = 2
|
||||
|
@ -1,19 +1,20 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TSettingsForm','FORMDATA',[
|
||||
'TPF0'#13'TSettingsForm'#12'SettingsForm'#4'Left'#3'X'#2#6'Height'#3'/'#2#3'T'
|
||||
+'op'#3#138#0#5'Width'#3'V'#1#13'ActiveControl'#7#16'SettingsTreeView'#7'Capt'
|
||||
+'ion'#6#14'Simba Settings'#12'ClientHeight'#3'/'#2#11'ClientWidth'#3'V'#1#8
|
||||
'TPF0'#13'TSettingsForm'#12'SettingsForm'#4'Left'#3'3'#2#6'Height'#3'.'#2#3'T'
|
||||
+'op'#3#173#0#5'Width'#3'h'#1#13'ActiveControl'#7#16'SettingsTreeView'#7'Capt'
|
||||
+'ion'#6#14'Simba Settings'#12'ClientHeight'#3'.'#2#11'ClientWidth'#3'h'#1#8
|
||||
+'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'LCLVersion'#6#6
|
||||
+'0.9.29'#0#9'TTreeView'#16'SettingsTreeView'#4'Left'#2#16#6'Height'#3#218#1#3
|
||||
+'Top'#2#16#5'Width'#3'2'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akB'
|
||||
+'0.9.29'#0#9'TTreeView'#16'SettingsTreeView'#4'Left'#2#16#6'Height'#3#217#1#3
|
||||
+'Top'#2#16#5'Width'#3'D'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akB'
|
||||
+'ottom'#0#17'DefaultItemHeight'#2#19#8'ReadOnly'#9#10'ScrollBars'#7#10'ssAut'
|
||||
+'oBoth'#8'TabOrder'#2#0#7'Options'#11#17'tvoAutoItemHeight'#16'tvoHideSelect'
|
||||
+'ion'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#14'tvoShowButtons'#12'tvoSho'
|
||||
+'wLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#7'TButton'#20'SettingsFormBut'
|
||||
+'tonOK'#4'Left'#3#247#0#6'Height'#2#25#3'Top'#3#0#2#5'Width'#2'K'#7'Caption'
|
||||
+#6#2'OK'#7'OnClick'#7#25'SettingsFormButtonOKClick'#8'TabOrder'#2#1#0#0#7'TB'
|
||||
+'utton'#24'SettingsFormButtonCancel'#4'Left'#2#16#6'Height'#2#25#3'Top'#3#0#2
|
||||
+#5'Width'#2'K'#7'Caption'#6#6'Cancel'#7'OnClick'#7#29'SettingsFormButtonCanc'
|
||||
+'elClick'#8'TabOrder'#2#2#0#0#0
|
||||
+'oBoth'#8'TabOrder'#2#0#10'OnDblClick'#7#24'SettingsTreeViewDblClick'#7'Opti'
|
||||
+'ons'#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'
|
||||
+#11'tvoReadOnly'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoT'
|
||||
+'oolTips'#0#0#0#7'TButton'#20'SettingsFormButtonOK'#4'Left'#3#9#1#6'Height'#2
|
||||
+#25#3'Top'#3#255#1#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Ca'
|
||||
+'ption'#6#2'OK'#7'OnClick'#7#25'SettingsFormButtonOKClick'#8'TabOrder'#2#1#0
|
||||
+#0#7'TButton'#24'SettingsFormButtonCancel'#4'Left'#2#16#6'Height'#2#25#3'Top'
|
||||
+#3#255#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6
|
||||
+'Cancel'#7'OnClick'#7#29'SettingsFormButtonCancelClick'#8'TabOrder'#2#2#0#0#0
|
||||
]);
|
||||
|
@ -24,6 +24,7 @@ type
|
||||
procedure SettingsFormButtonOKClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure SettingsTreeViewDblClick(Sender: TObject);
|
||||
{ private declarations }
|
||||
public
|
||||
procedure SaveCurrent;
|
||||
@ -75,6 +76,26 @@ begin
|
||||
Settings.Free;
|
||||
end;
|
||||
|
||||
procedure TSettingsForm.SettingsTreeViewDblClick(Sender: TObject);
|
||||
var
|
||||
p, pp: TPoint;
|
||||
N: TTreeNode;
|
||||
Path, NewVal: String;
|
||||
|
||||
begin
|
||||
p := Mouse.CursorPos;
|
||||
pp := TSettingsForm(Sender).ScreenToClient(p);
|
||||
N := SettingsTreeView.GetNodeAt(pp.x, pp.y);
|
||||
if N <> nil then
|
||||
if (N.Text = 'Value') and (N.Parent <> nil) then
|
||||
begin
|
||||
Path := Settings.GetNodePath(N.Parent);
|
||||
NewVal := InputBox('Change Setting', 'Change value for ' + N.Parent.Text,
|
||||
Settings.GetKeyValue(Path));
|
||||
Settings.SetKeyValue(Path, NewVal);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSettingsForm.SaveCurrent;
|
||||
begin
|
||||
Settings.SaveToXML('settings.xml');
|
||||
|
@ -1,7 +1,7 @@
|
||||
object Form1: TForm1
|
||||
Left = 593
|
||||
Left = 273
|
||||
Height = 557
|
||||
Top = 261
|
||||
Top = 233
|
||||
Width = 734
|
||||
ActiveControl = ScriptPanel
|
||||
Caption = 'THA FUKING MUFASA'
|
||||
@ -357,10 +357,10 @@ object Form1: TForm1
|
||||
EditLabel.AnchorSideTop.Side = asrCenter
|
||||
EditLabel.AnchorSideRight.Control = LabeledEditSearch
|
||||
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
|
||||
EditLabel.Left = 65
|
||||
EditLabel.Left = 67
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 10
|
||||
EditLabel.Width = 36
|
||||
EditLabel.Width = 34
|
||||
EditLabel.Caption = 'Find: '
|
||||
EditLabel.ParentColor = False
|
||||
LabelPosition = lpLeft
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -422,7 +422,7 @@ procedure TForm1.SplitterFunctionListCanResize(Sender: TObject; var NewSize: Int
|
||||
var Accept: Boolean);
|
||||
begin
|
||||
if(NewSize > ScriptPanel.Width div 2)then
|
||||
NewSize := ScriptPanel.Width div 2
|
||||
NewSize := ScriptPanel.Width div 2;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateButtonClick(Sender: TObject);
|
||||
@ -432,15 +432,33 @@ begin
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateTimerCheck(Sender: TObject);
|
||||
var
|
||||
chk: String;
|
||||
time:integer;
|
||||
begin
|
||||
|
||||
chk := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
||||
'Settings/Updater/CheckForUpdates',
|
||||
'True', SimbaSettingsFile
|
||||
);
|
||||
|
||||
if chk <> 'True' then
|
||||
Exit;
|
||||
|
||||
if SimbaUpdateForm.CanUpdate then
|
||||
begin;
|
||||
UpdateButton.Visible:=True;
|
||||
formWriteln('A new update of Simba is available!');
|
||||
end;
|
||||
{ Only check once, at startup }
|
||||
UpdateTimer.Interval:= 30 {mins} * 60 {secs} * 1000 {ms};//Every half hour
|
||||
// UpdateTimer.Enabled:=False;
|
||||
|
||||
time := StrToIntDef(SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
||||
'Settings/Updater/CheckEveryXMinutes',
|
||||
'30', SimbaSettingsFile
|
||||
), 30);
|
||||
|
||||
|
||||
|
||||
UpdateTimer.Interval:= time {mins} * 60 {secs} * 1000 {ms};//Every half hour
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateMenuButtonClick(Sender: TObject);
|
||||
@ -517,16 +535,14 @@ begin
|
||||
// Copy our current fonts
|
||||
if not assigned(Self.OCR_Fonts) then
|
||||
begin
|
||||
Self.OCR_Fonts :=TMOCR.Create(ScriptThread.Client);
|
||||
Self.OCR_Fonts := TMOCR.Create(ScriptThread.Client);
|
||||
|
||||
if not SettingsForm.Settings.KeyExists('Settings/Fonts/Path') then
|
||||
saveAfterSetting := True;
|
||||
|
||||
fontPath := SettingsForm.Settings.GetSetDefaultKeyValue('Settings/Fonts/Path',
|
||||
IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
|
||||
|
||||
if saveAfterSetting then
|
||||
SettingsForm.Settings.SaveToXML('settings.xml');
|
||||
fontPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
|
||||
'Settings/Fonts/Path',
|
||||
IncludeTrailingPathDelimiter(ExpandFileName(MainDir
|
||||
+DS + '..' + DS + '..' + ds)) + 'Fonts' + DS,
|
||||
SimbaSettingsFile
|
||||
);
|
||||
|
||||
if DirectoryExists(fontPath) then
|
||||
begin
|
||||
|
@ -18,4 +18,4 @@ LazarusResources.Add('TSimbaUpdateForm','FORMDATA',[
|
||||
+#2#3#0#0#5'TMemo'#9'UpdateLog'#4'Left'#2#24#6'Height'#3#183#0#3'Top'#3#144#0
|
||||
+#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8
|
||||
+'TabOrder'#2#4#0#0#0
|
||||
]);
|
||||
]);
|
@ -49,8 +49,16 @@ type
|
||||
procedure SetKeyValue(KeyName: String; KeyValue: String);
|
||||
function CreateKey(KeyName: String; CreatePath: Boolean = False): Boolean;
|
||||
function GetKeyValue(KeyName: String): String;
|
||||
|
||||
// Horrible name
|
||||
function GetSetDefaultKeyValue(KeyName, defVal: String): String;
|
||||
|
||||
// /facepalm
|
||||
function GetSetLoadSaveDefaultKeyValue(KeyName, defVal, fileName: String): String;
|
||||
|
||||
// AAAAAAAAAAAHG??
|
||||
function GetSetLoadSaveDefaultKeyValueIfNotExists(KeyName, defVal, fileName: String): String;
|
||||
|
||||
public
|
||||
procedure LoadFromXML(fileName: String);
|
||||
procedure SaveToXML(fileName: String);
|
||||
@ -311,6 +319,21 @@ begin
|
||||
Exit(Res);
|
||||
end;
|
||||
|
||||
function TMMLSettings.GetSetLoadSaveDefaultKeyValue(KeyName, defVal, fileName: String): String;
|
||||
begin
|
||||
LoadFromXML(fileName);
|
||||
Result := GetSetDefaultKeyValue(KeyName, defVal);
|
||||
SaveToXML(fileName);
|
||||
end;
|
||||
|
||||
function TMMLSettings.GetSetLoadSaveDefaultKeyValueIfNotExists(KeyName, defVal, fileName: String): String;
|
||||
begin
|
||||
if KeyExists(KeyName) then
|
||||
exit(GetSetDefaultKeyValue(KeyName, defVal))
|
||||
else
|
||||
Exit(GetSetLoadSaveDefaultKeyValue(KeyName, defVal, fileName));
|
||||
end;
|
||||
|
||||
function TMMLSettings.CreateKey(KeyName: String; CreatePath: Boolean = False): Boolean;
|
||||
var
|
||||
N, newN, nParent: TTreeNode;
|
||||
|
Loading…
Reference in New Issue
Block a user