mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-26 03:02:15 -05:00
Now saves form position + recent files.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@560 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
6c58941bc5
commit
84f0424e46
@ -38,7 +38,8 @@ implementation
|
|||||||
{ TSettingsForm }
|
{ TSettingsForm }
|
||||||
|
|
||||||
procedure TSettingsForm.FormCreate(Sender: TObject);
|
procedure TSettingsForm.FormCreate(Sender: TObject);
|
||||||
|
var
|
||||||
|
FirstNode : TTreeNode;
|
||||||
begin
|
begin
|
||||||
Settings := TMMLSettings.Create(SettingsTreeView.Items);
|
Settings := TMMLSettings.Create(SettingsTreeView.Items);
|
||||||
if not FileExists(SimbaSettingsFile) then
|
if not FileExists(SimbaSettingsFile) then
|
||||||
@ -46,9 +47,12 @@ begin
|
|||||||
SettingsTreeView.Items.Clear;
|
SettingsTreeView.Items.Clear;
|
||||||
Settings.SaveToXML(SimbaSettingsFile);
|
Settings.SaveToXML(SimbaSettingsFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
SettingsTreeView.Items.Clear;
|
SettingsTreeView.Items.Clear;
|
||||||
Settings.LoadFromXML(SimbaSettingsFile);
|
Settings.LoadFromXML(SimbaSettingsFile);
|
||||||
|
FirstNode := SettingsTreeView.Items.GetFirstNode;
|
||||||
|
if FirstNode <> nil then
|
||||||
|
if FirstNode.Text = 'Settings' then
|
||||||
|
FirstNode.Expand(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsForm.SettingsFormButtonOKClick(Sender: TObject);
|
procedure TSettingsForm.SettingsFormButtonOKClick(Sender: TObject);
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 287
|
Left = 273
|
||||||
Height = 557
|
Height = 557
|
||||||
Top = 184
|
Top = 233
|
||||||
Width = 734
|
Width = 734
|
||||||
ActiveControl = ScriptPanel
|
ActiveControl = ScriptPanel
|
||||||
Caption = 'THA FUKING SIMBA'
|
Caption = 'THA FUKING SIMBA'
|
||||||
ClientHeight = 532
|
ClientHeight = 537
|
||||||
ClientWidth = 734
|
ClientWidth = 734
|
||||||
KeyPreview = True
|
KeyPreview = True
|
||||||
Menu = MainMenu
|
Menu = MainMenu
|
||||||
@ -13,7 +13,6 @@ object Form1: TForm1
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShortCut = FormShortCuts
|
OnShortCut = FormShortCuts
|
||||||
Position = poScreenCenter
|
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.29'
|
||||||
Visible = True
|
Visible = True
|
||||||
object ToolBar1: TToolBar
|
object ToolBar1: TToolBar
|
||||||
@ -201,8 +200,8 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 511
|
Top = 514
|
||||||
Width = 734
|
Width = 734
|
||||||
Panels = <
|
Panels = <
|
||||||
item
|
item
|
||||||
@ -224,7 +223,7 @@ object Form1: TForm1
|
|||||||
object PanelMemo: TPanel
|
object PanelMemo: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 154
|
Height = 154
|
||||||
Top = 357
|
Top = 360
|
||||||
Width = 734
|
Width = 734
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ClientHeight = 154
|
ClientHeight = 154
|
||||||
@ -244,19 +243,19 @@ object Form1: TForm1
|
|||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 5
|
||||||
Top = 352
|
Top = 355
|
||||||
Width = 734
|
Width = 734
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ResizeAnchor = akBottom
|
ResizeAnchor = akBottom
|
||||||
end
|
end
|
||||||
object ScriptPanel: TPanel
|
object ScriptPanel: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 328
|
Height = 331
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 734
|
Width = 734
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 328
|
ClientHeight = 331
|
||||||
ClientWidth = 734
|
ClientWidth = 734
|
||||||
DockSite = True
|
DockSite = True
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
@ -264,7 +263,7 @@ object Form1: TForm1
|
|||||||
OnDockOver = ScriptPanelDockOver
|
OnDockOver = ScriptPanelDockOver
|
||||||
object PageControl1: TPageControl
|
object PageControl1: TPageControl
|
||||||
Left = 155
|
Left = 155
|
||||||
Height = 293
|
Height = 296
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 579
|
Width = 579
|
||||||
Align = alClient
|
Align = alClient
|
||||||
@ -283,7 +282,7 @@ object Form1: TForm1
|
|||||||
object SearchPanel: TPanel
|
object SearchPanel: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 35
|
Height = 35
|
||||||
Top = 293
|
Top = 296
|
||||||
Width = 734
|
Width = 734
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvSpace
|
BevelOuter = bvSpace
|
||||||
@ -379,7 +378,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object LabeledEditSearch: TLabeledEdit
|
object LabeledEditSearch: TLabeledEdit
|
||||||
Left = 104
|
Left = 104
|
||||||
Height = 27
|
Height = 21
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 174
|
Width = 174
|
||||||
EditLabel.AnchorSideLeft.Control = LabeledEditSearch
|
EditLabel.AnchorSideLeft.Control = LabeledEditSearch
|
||||||
@ -387,10 +386,10 @@ object Form1: TForm1
|
|||||||
EditLabel.AnchorSideTop.Side = asrCenter
|
EditLabel.AnchorSideTop.Side = asrCenter
|
||||||
EditLabel.AnchorSideRight.Control = LabeledEditSearch
|
EditLabel.AnchorSideRight.Control = LabeledEditSearch
|
||||||
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
|
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
|
||||||
EditLabel.Left = 67
|
EditLabel.Left = 73
|
||||||
EditLabel.Height = 18
|
EditLabel.Height = 14
|
||||||
EditLabel.Top = 10
|
EditLabel.Top = 9
|
||||||
EditLabel.Width = 34
|
EditLabel.Width = 28
|
||||||
EditLabel.Caption = 'Find: '
|
EditLabel.Caption = 'Find: '
|
||||||
EditLabel.ParentColor = False
|
EditLabel.ParentColor = False
|
||||||
LabelPosition = lpLeft
|
LabelPosition = lpLeft
|
||||||
@ -403,9 +402,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CheckBoxMatchCase: TCheckBox
|
object CheckBoxMatchCase: TCheckBox
|
||||||
Left = 320
|
Left = 320
|
||||||
Height = 22
|
Height = 17
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 97
|
Width = 72
|
||||||
Caption = 'Match case'
|
Caption = 'Match case'
|
||||||
OnClick = CheckBoxMatchCaseClick
|
OnClick = CheckBoxMatchCaseClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@ -413,38 +412,34 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object SplitterFunctionList: TSplitter
|
object SplitterFunctionList: TSplitter
|
||||||
Left = 150
|
Left = 150
|
||||||
Height = 293
|
Height = 296
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 5
|
Width = 5
|
||||||
OnCanResize = SplitterFunctionListCanResize
|
OnCanResize = SplitterFunctionListCanResize
|
||||||
Visible = False
|
Visible = False
|
||||||
end
|
end
|
||||||
inline frmFunctionList: TFunctionListFrame
|
inline frmFunctionList: TFunctionListFrame
|
||||||
Height = 293
|
Height = 296
|
||||||
Width = 150
|
Width = 150
|
||||||
ClientHeight = 293
|
ClientHeight = 296
|
||||||
ClientWidth = 150
|
ClientWidth = 150
|
||||||
OnEndDock = nil
|
OnEndDock = nil
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
inherited FunctionList: TTreeView
|
inherited FunctionList: TTreeView
|
||||||
Height = 244
|
Height = 257
|
||||||
Top = 22
|
|
||||||
Width = 150
|
Width = 150
|
||||||
DefaultItemHeight = 19
|
|
||||||
OnChange = FunctionListChange
|
OnChange = FunctionListChange
|
||||||
OnEnter = FunctionListEnter
|
OnEnter = FunctionListEnter
|
||||||
OnExit = FunctionListExit
|
OnExit = FunctionListExit
|
||||||
end
|
end
|
||||||
inherited editSearchList: TEdit
|
inherited editSearchList: TEdit
|
||||||
Height = 27
|
Top = 275
|
||||||
Top = 266
|
|
||||||
Width = 150
|
Width = 150
|
||||||
OnExit = editSearchListExit
|
OnExit = editSearchListExit
|
||||||
OnKeyDown = editSearchListKeyDown
|
OnKeyDown = editSearchListKeyDown
|
||||||
OnKeyPress = editSearchListKeyPress
|
OnKeyPress = editSearchListKeyPress
|
||||||
end
|
end
|
||||||
inherited FunctionListLabel: TLabel
|
inherited FunctionListLabel: TLabel
|
||||||
Height = 18
|
|
||||||
Width = 146
|
Width = 146
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -539,6 +534,9 @@ object Form1: TForm1
|
|||||||
}
|
}
|
||||||
OnClick = ActionOpenExecute
|
OnClick = ActionOpenExecute
|
||||||
end
|
end
|
||||||
|
object MenuItemOpenRecent: TMenuItem
|
||||||
|
Caption = 'Open &Recent'
|
||||||
|
end
|
||||||
object MenuItemSave: TMenuItem
|
object MenuItemSave: TMenuItem
|
||||||
Action = ActionSaveScript
|
Action = ActionSaveScript
|
||||||
Bitmap.Data = {
|
Bitmap.Data = {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -40,10 +40,11 @@ uses
|
|||||||
colourpicker, framescript, windowselector, lcltype, ActnList, StdActns,
|
colourpicker, framescript, windowselector, lcltype, ActnList, StdActns,
|
||||||
SynExportHTML, SynEditKeyCmds, SynEditHighlighter, SynEditMarkupSpecialLine,
|
SynExportHTML, SynEditKeyCmds, SynEditHighlighter, SynEditMarkupSpecialLine,
|
||||||
SynEditMarkupHighAll, SynEditMiscClasses, LMessages, Buttons, PairSplitter,
|
SynEditMarkupHighAll, SynEditMiscClasses, LMessages, Buttons, PairSplitter,
|
||||||
|
stringutil,mufasatypesutil,
|
||||||
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
||||||
|
|
||||||
const
|
const
|
||||||
SimbaVersion = 555;
|
SimbaVersion = 560;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ type
|
|||||||
MenuEdit: TMenuItem;
|
MenuEdit: TMenuItem;
|
||||||
MenuHelp: TMenuItem;
|
MenuHelp: TMenuItem;
|
||||||
MenuExtra: TMenuItem;
|
MenuExtra: TMenuItem;
|
||||||
|
MenuItemOpenRecent: TMenuItem;
|
||||||
MenuItemCompile: TMenuItem;
|
MenuItemCompile: TMenuItem;
|
||||||
MenuItemHandbook: TMenuItem;
|
MenuItemHandbook: TMenuItem;
|
||||||
MenuItemAbout: TMenuItem;
|
MenuItemAbout: TMenuItem;
|
||||||
@ -289,6 +291,7 @@ type
|
|||||||
Shift: TShiftState; X, Y: Integer);
|
Shift: TShiftState; X, Y: Integer);
|
||||||
procedure PopupItemFindClick(Sender: TObject);
|
procedure PopupItemFindClick(Sender: TObject);
|
||||||
procedure ProcessDebugStream(Sender: TObject);
|
procedure ProcessDebugStream(Sender: TObject);
|
||||||
|
procedure RecentFileItemsClick(Sender: TObject);
|
||||||
procedure ScriptPanelDockDrop(Sender: TObject; Source: TDragDockObject; X,
|
procedure ScriptPanelDockDrop(Sender: TObject; Source: TDragDockObject; X,
|
||||||
Y: Integer);
|
Y: Integer);
|
||||||
procedure ScriptPanelDockOver(Sender: TObject; Source: TDragDockObject; X,
|
procedure ScriptPanelDockOver(Sender: TObject; Source: TDragDockObject; X,
|
||||||
@ -304,6 +307,8 @@ type
|
|||||||
procedure UpdateTimerCheck(Sender: TObject);
|
procedure UpdateTimerCheck(Sender: TObject);
|
||||||
private
|
private
|
||||||
PopupTab : integer;
|
PopupTab : integer;
|
||||||
|
RecentFileItems : array of TMenuItem;
|
||||||
|
RecentFiles : TStringList;
|
||||||
FirstRun : boolean;//Only show the warnings the first run (path not existing one's)
|
FirstRun : boolean;//Only show the warnings the first run (path not existing one's)
|
||||||
SearchStart : TPoint;
|
SearchStart : TPoint;
|
||||||
LastTab : integer;
|
LastTab : integer;
|
||||||
@ -343,6 +348,9 @@ type
|
|||||||
procedure RefreshTab;//Refreshes all the form items that depend on the Script (Panels, title etc.)
|
procedure RefreshTab;//Refreshes all the form items that depend on the Script (Panels, title etc.)
|
||||||
procedure RefreshTabSender(sender : PtrInt);
|
procedure RefreshTabSender(sender : PtrInt);
|
||||||
procedure CreateDefaultEnvironment;
|
procedure CreateDefaultEnvironment;
|
||||||
|
procedure LoadFormSettings;
|
||||||
|
procedure SaveFormSettings;
|
||||||
|
procedure AddRecentFile(filename : string);
|
||||||
procedure InitalizeTMThread(var Thread : TMThread);
|
procedure InitalizeTMThread(var Thread : TMThread);
|
||||||
procedure HandleParameters;
|
procedure HandleParameters;
|
||||||
end;
|
end;
|
||||||
@ -401,6 +409,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.RecentFileItemsClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
i : integer;
|
||||||
|
begin
|
||||||
|
for i := 0 to high(RecentFileItems) do
|
||||||
|
if RecentFileItems[i] = sender then
|
||||||
|
begin;
|
||||||
|
LoadScriptFile(RecentFiles[RecentFiles.Count - 1 -i]);//Inverse order
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.ScriptPanelDockDrop(Sender: TObject; Source: TDragDockObject;
|
procedure TForm1.ScriptPanelDockDrop(Sender: TObject; Source: TDragDockObject;
|
||||||
X, Y: Integer);
|
X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
@ -878,16 +898,87 @@ begin
|
|||||||
includePath:= CreateSetting('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS));
|
includePath:= CreateSetting('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS));
|
||||||
fontPath := CreateSetting('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS));
|
fontPath := CreateSetting('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS));
|
||||||
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
|
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
|
||||||
|
CreateSetting('LastConfig/MainForm/Position','');
|
||||||
if not DirectoryExists(IncludePath) then
|
if not DirectoryExists(IncludePath) then
|
||||||
CreateDir(IncludePath);
|
CreateDir(IncludePath);
|
||||||
if not DirectoryExists(FontPath) then
|
if not DirectoryExists(FontPath) then
|
||||||
CreateDir(FontPath);
|
CreateDir(FontPath);
|
||||||
if not DirectoryExists(PluginsPath) then
|
if not DirectoryExists(PluginsPath) then
|
||||||
CreateDir(PluginsPath);
|
CreateDir(PluginsPath);
|
||||||
SettingsForm.SettingsTreeView.FullExpand;
|
SettingsForm.SettingsTreeView.Items.GetFirstNode.Expand(false);
|
||||||
SettingsForm.SaveCurrent;
|
SettingsForm.SaveCurrent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.LoadFormSettings;
|
||||||
|
var
|
||||||
|
str : string;
|
||||||
|
Data : TStringArray;
|
||||||
|
i : integer;
|
||||||
|
begin
|
||||||
|
str := LoadSettingDef('LastConfig/MainForm/Position','');
|
||||||
|
if str <> '' then
|
||||||
|
begin;
|
||||||
|
Data := Explode(':',str);
|
||||||
|
if length(Data) <> 4 then
|
||||||
|
Exit;
|
||||||
|
Self.Left:= StrToIntDef(Data[0],Self.Left);
|
||||||
|
Self.Top:= StrToIntDef(Data[1],self.top);
|
||||||
|
Self.Width:= StrToIntDef(Data[2],self.width);
|
||||||
|
Self.Height:= StrToIntDef(Data[3],self.height);
|
||||||
|
end;
|
||||||
|
str := LoadSettingDef('LastConfig/MainForm/RecentFiles','');
|
||||||
|
if str <> '' then
|
||||||
|
begin
|
||||||
|
Data := Explode(';',str);
|
||||||
|
for i := high(data) downto 0 do//First = entry should be added as last
|
||||||
|
AddRecentFile(data[i]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.SaveFormSettings;
|
||||||
|
var
|
||||||
|
Data : TStringArray;
|
||||||
|
i : integer;
|
||||||
|
begin
|
||||||
|
with SettingsForm.Settings do
|
||||||
|
begin
|
||||||
|
Data := ConvArr([inttostr(Self.left),inttostr(self.top),inttostr(self.width),inttostr(self.height)]);
|
||||||
|
SetKeyValue('LastConfig/MainForm/Position', Implode(':',Data ));
|
||||||
|
if RecentFiles.Count > 0 then
|
||||||
|
begin
|
||||||
|
SetLength(data,RecentFiles.Count);
|
||||||
|
for i := 0 to high(data) do //First entry should be the last-opened
|
||||||
|
data[high(data) - i] := RecentFiles[i];
|
||||||
|
SetKeyValue('LastConfig/MainForm/RecentFiles',implode(';',data));
|
||||||
|
end;
|
||||||
|
SaveToXML(SimbaSettingsFile);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.AddRecentFile(filename: string);
|
||||||
|
var
|
||||||
|
MaxRecentFiles : integer;
|
||||||
|
Len,i : integer;
|
||||||
|
begin
|
||||||
|
MaxRecentFiles:= StrToIntDef(LoadSettingDef('Settings/General/MaxRecentFiles','10'),10);
|
||||||
|
i := RecentFiles.IndexOf(filename);
|
||||||
|
if i <> -1 then
|
||||||
|
RecentFiles.Delete(i);
|
||||||
|
if RecentFiles.Count = MaxRecentFiles then
|
||||||
|
RecentFiles.Delete(0);
|
||||||
|
RecentFiles.Add(filename);
|
||||||
|
Len := RecentFiles.Count;
|
||||||
|
if len <> length(RecentFileItems) then //Not reached maximum yet, add those files!
|
||||||
|
begin
|
||||||
|
SetLength(RecentFileItems,len);
|
||||||
|
RecentFileItems[len-1] := TMenuItem.Create(MenuItemOpenRecent);
|
||||||
|
RecentFileItems[len-1].OnClick:=@RecentFileItemsClick;
|
||||||
|
MenuItemOpenRecent.Add(RecentFileItems[len-1]);
|
||||||
|
end;
|
||||||
|
for i := 0 to len - 1 do
|
||||||
|
RecentFileItems[len - 1-i].Caption:= ExtractFileName(RecentFiles[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.InitalizeTMThread(var Thread: TMThread);
|
procedure TForm1.InitalizeTMThread(var Thread: TMThread);
|
||||||
var
|
var
|
||||||
DbgImgInfo : TDbgImgInfo;
|
DbgImgInfo : TDbgImgInfo;
|
||||||
@ -1390,6 +1481,7 @@ procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
|
Self.SaveFormSettings;
|
||||||
for i := Tabs.Count - 1 downto 0 do
|
for i := Tabs.Count - 1 downto 0 do
|
||||||
if not DeleteTab(i,true) then
|
if not DeleteTab(i,true) then
|
||||||
begin;
|
begin;
|
||||||
@ -1403,9 +1495,13 @@ begin
|
|||||||
Randomize;
|
Randomize;
|
||||||
DecimalSeparator := '.';
|
DecimalSeparator := '.';
|
||||||
MainDir:= ExtractFileDir(Application.ExeName);
|
MainDir:= ExtractFileDir(Application.ExeName);
|
||||||
|
RecentFiles := TStringList.Create;
|
||||||
SimbaSettingsFile := MainDir + DS + 'settings.xml';
|
SimbaSettingsFile := MainDir + DS + 'settings.xml';
|
||||||
if FileExists(SimbaSettingsFile) then
|
if FileExists(SimbaSettingsFile) then
|
||||||
Application.CreateForm(TSettingsForm,SettingsForm)
|
begin
|
||||||
|
Application.CreateForm(TSettingsForm,SettingsForm);
|
||||||
|
Self.LoadFormSettings;
|
||||||
|
end
|
||||||
else begin
|
else begin
|
||||||
Application.CreateForm(TSettingsForm,SettingsForm);
|
Application.CreateForm(TSettingsForm,SettingsForm);
|
||||||
Self.CreateDefaultEnvironment;
|
Self.CreateDefaultEnvironment;
|
||||||
@ -1445,6 +1541,8 @@ var
|
|||||||
begin
|
begin
|
||||||
for i := Tabs.Count - 1 downto 0 do
|
for i := Tabs.Count - 1 downto 0 do
|
||||||
TMufasaTab(Tabs[i]).Free;
|
TMufasaTab(Tabs[i]).Free;
|
||||||
|
for i := 0 to high(RecentFileItems) do
|
||||||
|
RecentFileItems[i].Free;
|
||||||
Tabs.free;
|
Tabs.free;
|
||||||
Selector.Free;
|
Selector.Free;
|
||||||
Picker.Free;
|
Picker.Free;
|
||||||
@ -1452,6 +1550,7 @@ begin
|
|||||||
PluginsGlob.Free;
|
PluginsGlob.Free;
|
||||||
|
|
||||||
SetLength(DebugStream, 0);
|
SetLength(DebugStream, 0);
|
||||||
|
RecentFiles.Free;
|
||||||
DebugCriticalSection.Free;
|
DebugCriticalSection.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1961,6 +2060,7 @@ begin
|
|||||||
WriteLn('Script name will be: ' + ScriptName);
|
WriteLn('Script name will be: ' + ScriptName);
|
||||||
ScriptFile:= FileName;
|
ScriptFile:= FileName;
|
||||||
ScriptChanged := false;
|
ScriptChanged := false;
|
||||||
|
AddRecentFile(filename);
|
||||||
RefreshTab();
|
RefreshTab();
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
@ -416,7 +416,6 @@ end;
|
|||||||
|
|
||||||
function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant; extdecl;
|
function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant; extdecl;
|
||||||
begin
|
begin
|
||||||
Writeln('yo');
|
|
||||||
CurrThread.SyncInfo^.MethodName:= ProcName;
|
CurrThread.SyncInfo^.MethodName:= ProcName;
|
||||||
CurrThread.SyncInfo^.V:= V;
|
CurrThread.SyncInfo^.V:= V;
|
||||||
CurrThread.SyncInfo^.OldThread := CurrThread;
|
CurrThread.SyncInfo^.OldThread := CurrThread;
|
||||||
|
@ -174,6 +174,8 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
iNode := XMLDoc.DocumentElement;
|
iNode := XMLDoc.DocumentElement;
|
||||||
|
if iNode.NodeName = 'Simba' then
|
||||||
|
iNode := iNode.ChildNodes[0];
|
||||||
while iNode <> nil do
|
while iNode <> nil do
|
||||||
begin
|
begin
|
||||||
ProcessNode(iNode, nil); // Recursive
|
ProcessNode(iNode, nil); // Recursive
|
||||||
@ -224,7 +226,6 @@ begin
|
|||||||
|
|
||||||
N := Nodes.GetFirstNode;
|
N := Nodes.GetFirstNode;
|
||||||
i := 0;
|
i := 0;
|
||||||
|
|
||||||
while N <> nil do
|
while N <> nil do
|
||||||
begin
|
begin
|
||||||
if N.Text = s[i] then
|
if N.Text = s[i] then
|
||||||
@ -236,7 +237,6 @@ begin
|
|||||||
end else
|
end else
|
||||||
N := N.GetNextSibling;
|
N := N.GetNextSibling;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result := N;
|
Result := N;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -434,20 +434,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
NewPath := '';
|
NewPath := '';
|
||||||
N := nil;
|
N := nil;
|
||||||
nParent := Nodes.GetFirstNode;
|
|
||||||
|
|
||||||
Path := KeyNameToKeys(KeyName);
|
Path := KeyNameToKeys(KeyName);
|
||||||
|
|
||||||
if length(path) < 2 then
|
if length(path) < 2 then
|
||||||
begin
|
begin
|
||||||
writeln('Path too short!');
|
writeln('Path too short!');
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
|
nParent := WalkToNode(path[0]);
|
||||||
if path[0] <> nParent.Text then
|
if nParent = nil then
|
||||||
|
nParent := Nodes.Add(nil,path[0]);
|
||||||
|
{ if path[0] <> nParent.Text then
|
||||||
begin
|
begin
|
||||||
writeln('First key doesn''t match. First key should always match');
|
writeln('First key doesn''t match. First key should always match');
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;}
|
||||||
for i := 0 to length(Path) - 2 do
|
for i := 0 to length(Path) - 2 do
|
||||||
begin
|
begin
|
||||||
if Path[i] = '' then
|
if Path[i] = '' then
|
||||||
@ -592,26 +593,34 @@ end;
|
|||||||
procedure TMMLSettings.SaveToXML(fileName: String);
|
procedure TMMLSettings.SaveToXML(fileName: String);
|
||||||
var
|
var
|
||||||
XMLDoc: TXMLDocument;
|
XMLDoc: TXMLDocument;
|
||||||
RootNode: TDOMNode;
|
Simba,Settings,LastConfig: TDOMNode;
|
||||||
|
SettingsTreeNode,LastConfigTreeNode : TTreeNode;
|
||||||
C: Integer;
|
C: Integer;
|
||||||
begin
|
begin
|
||||||
XMLDoc := TXMLDocument.Create;
|
XMLDoc := TXMLDocument.Create;
|
||||||
|
|
||||||
RootNode := XMLDoc.CreateElement('Settings');
|
|
||||||
XMLDoc.AppendChild(RootNode);
|
|
||||||
|
|
||||||
RootNode := XMLDoc.DocumentElement;
|
|
||||||
|
|
||||||
C := 0;
|
C := 0;
|
||||||
if Nodes.GetFirstNode <> nil then
|
SettingsTreeNode := WalkToNode('Settings');
|
||||||
WalkTree(Nodes.GetFirstNode, RootNode, XMLDoc, C);
|
LastConfigTreeNode := WalkToNode('LastConfig');
|
||||||
|
|
||||||
|
Simba := XMLDoc.CreateElement('Simba');
|
||||||
|
Simba := XMLDoc.AppendChild(Simba);
|
||||||
|
|
||||||
|
Settings := XMLDoc.CreateElement('Settings');
|
||||||
|
LastConfig := XMLDoc.CreateElement('LastConfig');
|
||||||
|
Simba.AppendChild(Settings);
|
||||||
|
Simba.AppendChild(LastConfig);
|
||||||
|
|
||||||
|
if SettingsTreeNode <> nil then
|
||||||
|
WalkTree(SettingsTreeNode, Settings, XMLDoc, C);
|
||||||
|
|
||||||
|
if LastConfigTreeNode <> nil then
|
||||||
|
WalkTree(LastConfigTreeNode, LastConfig, XMLDoc, C);
|
||||||
try
|
try
|
||||||
WriteXMLFile(XMLDoc, fileName);
|
WriteXMLFile(XMLDoc, fileName);
|
||||||
except
|
except
|
||||||
Writeln('Failed to write ' + fileName);
|
Writeln('Failed to write ' + fileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
XMLDoc.Free;
|
XMLDoc.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ uses
|
|||||||
function ConvArr(Arr: array of TPoint): TPointArray; overload;
|
function ConvArr(Arr: array of TPoint): TPointArray; overload;
|
||||||
function ConvArr(Arr: array of TPointArray): T2DPointArray; overload;
|
function ConvArr(Arr: array of TPointArray): T2DPointArray; overload;
|
||||||
function ConvArr(Arr: array of Integer): TIntegerArray; overload;
|
function ConvArr(Arr: array of Integer): TIntegerArray; overload;
|
||||||
|
function ConvArr(Arr: array of String): TStringArray; overload;
|
||||||
|
|
||||||
function ConvTPAArr(Arr: array of TPoint): TPointArray; overload;
|
function ConvTPAArr(Arr: array of TPoint): TPointArray; overload;
|
||||||
|
|
||||||
@ -59,5 +60,16 @@ begin;
|
|||||||
Move(Arr[Low(Arr)], Result[0], Len*SizeOf(Integer));
|
Move(Arr[Low(Arr)], Result[0], Len*SizeOf(Integer));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ConvArr(Arr: array of String): TStringArray; overload;
|
||||||
|
var
|
||||||
|
Len : Integer;
|
||||||
|
I : integer;
|
||||||
|
begin;
|
||||||
|
Len := Length(Arr);
|
||||||
|
SetLength(Result, Len);
|
||||||
|
for i := 0 to Len - 1 do
|
||||||
|
result[i] := arr[i];
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user