mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-22 17:22:21 -05:00
Now auto creates dirs + settings on first run. Clicking on a function in the functionlist will point you to the function in your script.
Fixed small bug with having 2 plugin folders. git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@532 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
12d34e786e
commit
d4fbc414ea
@ -1,3 +1,5 @@
|
|||||||
|
{ This is an automatically generated lazarus resource file }
|
||||||
|
|
||||||
LazarusResources.Add('TFunctionListFrame','FORMDATA',[
|
LazarusResources.Add('TFunctionListFrame','FORMDATA',[
|
||||||
'TPF0'#18'TFunctionListFrame'#17'FunctionListFrame'#4'Left'#2#0#6'Height'#3#10
|
'TPF0'#18'TFunctionListFrame'#17'FunctionListFrame'#4'Left'#2#0#6'Height'#3#10
|
||||||
+#2#3'Top'#2#0#5'Width'#3#182#0#5'Align'#7#6'alLeft'#12'ClientHeight'#3#10#2
|
+#2#3'Top'#2#0#5'Width'#3#182#0#5'Align'#7#6'alLeft'#12'ClientHeight'#3#10#2
|
||||||
|
@ -46,6 +46,12 @@ type
|
|||||||
{ public declarations }
|
{ public declarations }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TMethodInfo = record
|
||||||
|
MethodStr : PChar;
|
||||||
|
BeginPos : integer;
|
||||||
|
end;
|
||||||
|
PMethodInfo = ^TMethodInfo;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -87,7 +93,7 @@ begin
|
|||||||
if node.Level > 0 then
|
if node.Level > 0 then
|
||||||
if node.Data <> nil then
|
if node.Data <> nil then
|
||||||
begin;
|
begin;
|
||||||
Form1.CurrScript.SynEdit.InsertTextAtCaret( GetMethodName(PChar(node.Data),true));
|
Form1.CurrScript.SynEdit.InsertTextAtCaret( GetMethodName(PMethodInfo(node.Data)^.MethodStr,true));
|
||||||
Form1.RefreshTab;
|
Form1.RefreshTab;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -96,7 +102,10 @@ procedure TFunctionListFrame.FunctionListDeletion(Sender: TObject;
|
|||||||
Node: TTreeNode);
|
Node: TTreeNode);
|
||||||
begin
|
begin
|
||||||
if node.data <> nil then
|
if node.data <> nil then
|
||||||
StrDispose(PChar(Node.Data));
|
begin
|
||||||
|
StrDispose(PMethodInfo(node.data)^.MethodStr);
|
||||||
|
Freemem(node.data,sizeof(TMethodInfo));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFunctionListFrame.FunctionListLabelMouseDown(Sender: TObject;
|
procedure TFunctionListFrame.FunctionListLabelMouseDown(Sender: TObject;
|
||||||
@ -163,7 +172,12 @@ begin
|
|||||||
for i := 0 to Analyzer.MethodLen - 1 do
|
for i := 0 to Analyzer.MethodLen - 1 do
|
||||||
begin
|
begin
|
||||||
tmpNode := FunctionList.Items.AddChild(ScriptNode,Analyzer.Methods[i].Name);
|
tmpNode := FunctionList.Items.AddChild(ScriptNode,Analyzer.Methods[i].Name);
|
||||||
tmpNode.Data:= strnew(PChar(Analyzer.Methods[i].CreateMethodStr));
|
tmpNode.Data := GetMem(SizeOf(TMethodInfo));
|
||||||
|
with PMethodInfo(tmpNode.Data)^ do
|
||||||
|
begin
|
||||||
|
MethodStr:= strnew(PChar(Analyzer.Methods[i].CreateMethodStr));
|
||||||
|
BeginPos:= Analyzer.Methods[i].BeginPos;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
ScriptNode.Expand(true);
|
ScriptNode.Expand(true);
|
||||||
Analyzer.free;
|
Analyzer.free;
|
||||||
|
@ -46,7 +46,7 @@ begin
|
|||||||
Application.CreateForm(TAboutForm, AboutForm);
|
Application.CreateForm(TAboutForm, AboutForm);
|
||||||
Application.CreateForm(TDebugImgForm, DebugImgForm);
|
Application.CreateForm(TDebugImgForm, DebugImgForm);
|
||||||
Application.CreateForm(TSimbaUpdateForm, SimbaUpdateForm);
|
Application.CreateForm(TSimbaUpdateForm, SimbaUpdateForm);
|
||||||
Application.CreateForm(TSettingsForm, SettingsForm);
|
// Application.CreateForm(TSettingsForm, SettingsForm); Done in FormCreate of MainForm
|
||||||
Application.Run;
|
Application.Run;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -55,20 +55,20 @@ end;
|
|||||||
|
|
||||||
procedure TSettingsForm.SettingsFormButtonOKClick(Sender: TObject);
|
procedure TSettingsForm.SettingsFormButtonOKClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SettingsForm.Settings.SaveToXML(SimbaSettingsFile);
|
Self.Settings.SaveToXML(SimbaSettingsFile);
|
||||||
SettingsForm.ModalResult:=mrOK;
|
Self.ModalResult:=mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsForm.SettingsFormButtonCancelClick(Sender: TObject);
|
procedure TSettingsForm.SettingsFormButtonCancelClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if not FileExists(SimbaSettingsFile) then
|
if not FileExists(SimbaSettingsFile) then
|
||||||
begin
|
begin
|
||||||
SettingsForm.SettingsTreeView.Items.Clear;
|
Self.SettingsTreeView.Items.Clear;
|
||||||
SettingsForm.Settings.SaveToXML(SimbaSettingsFile);
|
Self.Settings.SaveToXML(SimbaSettingsFile);
|
||||||
SettingsForm.SettingsTreeView.Items.Clear;
|
Self.SettingsTreeView.Items.Clear;
|
||||||
SettingsForm.Settings.LoadFromXML(SimbaSettingsFile);
|
Self.Settings.LoadFromXML(SimbaSettingsFile);
|
||||||
end;
|
end;
|
||||||
SettingsForm.ModalResult:=mrOK;
|
Self.ModalResult:=mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsForm.FormDestroy(Sender: TObject);
|
procedure TSettingsForm.FormDestroy(Sender: TObject);
|
||||||
|
@ -170,6 +170,7 @@ var
|
|||||||
|
|
||||||
LastTkString : string;
|
LastTkString : string;
|
||||||
I : integer;
|
I : integer;
|
||||||
|
TempInt : integer;
|
||||||
InMethod : Boolean;
|
InMethod : Boolean;
|
||||||
ExpectingType : boolean; //Params and result
|
ExpectingType : boolean; //Params and result
|
||||||
WaitingForResult : boolean;
|
WaitingForResult : boolean;
|
||||||
@ -342,6 +343,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
TempName := Lex.Token;
|
TempName := Lex.Token;
|
||||||
|
TempInt := Lex.TokenPos;
|
||||||
Lex.NextNoJunk;
|
Lex.NextNoJunk;
|
||||||
if Lex.TokenID = tkRoundOpen then
|
if Lex.TokenID = tkRoundOpen then
|
||||||
InParams := True
|
InParams := True
|
||||||
@ -364,7 +366,7 @@ begin
|
|||||||
else
|
else
|
||||||
Method := Self.AddMethod(WaitingForResult,TempName);
|
Method := Self.AddMethod(WaitingForResult,TempName);
|
||||||
InMethod := true;
|
InMethod := true;
|
||||||
Method.BeginPos := LastPos - 5;
|
Method.Beginpos := TempInt;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 593
|
Left = 273
|
||||||
Height = 557
|
Height = 557
|
||||||
Top = 321
|
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
|
||||||
@ -201,8 +201,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 +224,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 +244,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 +264,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 +283,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 +379,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 +387,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 = 65
|
EditLabel.Left = 73
|
||||||
EditLabel.Height = 18
|
EditLabel.Height = 14
|
||||||
EditLabel.Top = 10
|
EditLabel.Top = 9
|
||||||
EditLabel.Width = 36
|
EditLabel.Width = 28
|
||||||
EditLabel.Caption = 'Find: '
|
EditLabel.Caption = 'Find: '
|
||||||
EditLabel.ParentColor = False
|
EditLabel.ParentColor = False
|
||||||
LabelPosition = lpLeft
|
LabelPosition = lpLeft
|
||||||
@ -403,9 +403,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 = 98
|
Width = 72
|
||||||
Caption = 'Match case'
|
Caption = 'Match case'
|
||||||
OnClick = CheckBoxMatchCaseClick
|
OnClick = CheckBoxMatchCaseClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@ -413,39 +413,35 @@ 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
|
||||||
OnDeletion = nil
|
OnDeletion = nil
|
||||||
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
|
||||||
@ -3013,7 +3009,6 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object UpdateTimer: TTimer
|
object UpdateTimer: TTimer
|
||||||
Interval = 10000
|
Interval = 10000
|
||||||
OnTimer = UpdateTimerCheck
|
|
||||||
left = 608
|
left = 608
|
||||||
top = 144
|
top = 144
|
||||||
end
|
end
|
||||||
|
@ -3094,8 +3094,7 @@ LazarusResources.Add('TForm1','FORMDATA',[
|
|||||||
+'Replace'#7'OnClick'#7#20'ActionReplaceExecute'#0#0#0#14'TReplaceDialog'#10
|
+'Replace'#7'OnClick'#7#20'ActionReplaceExecute'#0#0#0#14'TReplaceDialog'#10
|
||||||
+'dlgReplace'#7'Options'#11#6'frDown'#10'frFindNext'#12'frHideUpDown'#0#6'OnF'
|
+'dlgReplace'#7'Options'#11#6'frDown'#10'frFindNext'#12'frHideUpDown'#0#6'OnF'
|
||||||
+'ind'#7#14'dlgReplaceFind'#9'OnReplace'#7#17'dlgReplaceReplace'#4'left'#3'`'
|
+'ind'#7#14'dlgReplaceFind'#9'OnReplace'#7#17'dlgReplaceReplace'#4'left'#3'`'
|
||||||
+#2#3'top'#2'h'#0#0#6'TTimer'#11'UpdateTimer'#8'Interval'#3#16''''#7'OnTimer'
|
+#2#3'top'#2'h'#0#0#6'TTimer'#11'UpdateTimer'#8'Interval'#3#16''''#4'left'#3
|
||||||
+#7#16'UpdateTimerCheck'#4'left'#3'`'#2#3'top'#3#144#0#0#0#6'TTimer'#10'Mouse'
|
+'`'#2#3'top'#3#144#0#0#0#6'TTimer'#10'MouseTimer'#8'Interval'#2'd'#7'OnTimer'
|
||||||
+'Timer'#8'Interval'#2'd'#7'OnTimer'#7#17'ChangeMouseStatus'#4'left'#3#192#1#3
|
+#7#17'ChangeMouseStatus'#4'left'#3#192#1#3'top'#3#200#0#0#0#0
|
||||||
+'top'#3#200#0#0#0#0
|
|
||||||
]);
|
]);
|
||||||
|
@ -43,7 +43,7 @@ uses
|
|||||||
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
ColorBox , about, framefunctionlist, ocr, updateform, simbasettings;
|
||||||
|
|
||||||
const
|
const
|
||||||
SimbaVersion = 530;
|
SimbaVersion = 532;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -308,6 +308,7 @@ type
|
|||||||
function GetScriptState: TScriptState;
|
function GetScriptState: TScriptState;
|
||||||
procedure SetScriptState(const State: TScriptState);
|
procedure SetScriptState(const State: TScriptState);
|
||||||
function LoadSettingDef(Key : string; Def : string) : string;
|
function LoadSettingDef(Key : string; Def : string) : string;
|
||||||
|
function CreateSetting(Key : string; Value : string) : string;
|
||||||
public
|
public
|
||||||
DebugStream: String;
|
DebugStream: String;
|
||||||
SearchString : string;
|
SearchString : string;
|
||||||
@ -339,6 +340,7 @@ type
|
|||||||
procedure DoSearch(Next : boolean; HighlightAll : boolean);
|
procedure DoSearch(Next : boolean; HighlightAll : boolean);
|
||||||
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;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure formWriteln( S : String);
|
procedure formWriteln( S : String);
|
||||||
@ -478,7 +480,6 @@ var
|
|||||||
chk: String;
|
chk: String;
|
||||||
time:integer;
|
time:integer;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
chk := LoadSettingDef('Settings/Updater/CheckForUpdates','True');
|
chk := LoadSettingDef('Settings/Updater/CheckForUpdates','True');
|
||||||
|
|
||||||
if chk <> 'True' then
|
if chk <> 'True' then
|
||||||
@ -901,6 +902,34 @@ begin
|
|||||||
RefreshTab;
|
RefreshTab;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.CreateDefaultEnvironment;
|
||||||
|
var
|
||||||
|
IncludePath,FontPath,PluginsPath : string;
|
||||||
|
begin
|
||||||
|
CreateSetting('Settings/Updater/CheckForUpdates','True');
|
||||||
|
CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
|
||||||
|
CreateSetting('Settings/Interpreter/UseCPascal', 'False');
|
||||||
|
CreateSetting('Settings/Fonts/LoadOnStartUp', 'True');
|
||||||
|
CreateSetting('Settings/Tabs/OpenNextOnClose','False');
|
||||||
|
CreateSetting('Settings/ColourPicker/ShowHistoryOnPick', 'True');
|
||||||
|
CreateSetting('Settings/Updater/RemoteLink',
|
||||||
|
'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS}+'.exe'{$ENDIF});
|
||||||
|
CreateSetting('Settings/Updater/RemoteVersionLink',
|
||||||
|
'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS}+'.exe'{$ENDIF} + '.version');
|
||||||
|
{Creates the paths and returns the path}
|
||||||
|
includePath:= CreateSetting('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS));
|
||||||
|
fontPath := CreateSetting('Settings/Fonts/Path', ExpandFileName(MainDir+DS+ 'Fonts' + DS));
|
||||||
|
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
|
||||||
|
if not DirectoryExists(IncludePath) then
|
||||||
|
CreateDir(IncludePath);
|
||||||
|
if not DirectoryExists(FontPath) then
|
||||||
|
CreateDir(FontPath);
|
||||||
|
if not DirectoryExists(PluginsPath) then
|
||||||
|
CreateDir(PluginsPath);
|
||||||
|
SettingsForm.SettingsTreeView.FullExpand;
|
||||||
|
SettingsForm.SaveCurrent;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TForm1.ActionTabLastExecute(Sender: TObject);
|
procedure TForm1.ActionTabLastExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
@ -929,7 +958,7 @@ var
|
|||||||
TempThread : TMThread;
|
TempThread : TMThread;
|
||||||
begin
|
begin
|
||||||
UseCPascal := LoadSettingDef('Settings/Interpreter/UseCPascal', 'False');
|
UseCPascal := LoadSettingDef('Settings/Interpreter/UseCPascal', 'False');
|
||||||
PluginsPath := LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS));
|
PluginsPath := LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir + DS + 'Plugins'+ DS));
|
||||||
try
|
try
|
||||||
if lowercase(UseCPascal) = 'true' then
|
if lowercase(UseCPascal) = 'true' then
|
||||||
TempThread := TCPThread.Create(True,nil,PluginsPath)
|
TempThread := TCPThread.Create(True,nil,PluginsPath)
|
||||||
@ -1224,11 +1253,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FunctionListChange(Sender: TObject; Node: TTreeNode);
|
procedure TForm1.FunctionListChange(Sender: TObject; Node: TTreeNode);
|
||||||
|
var
|
||||||
|
MethodInfo : TMethodInfo;
|
||||||
begin
|
begin
|
||||||
if node = nil then
|
if node = nil then
|
||||||
exit;
|
exit;
|
||||||
if Node.Level > 0 then
|
if Node.Level > 0 then
|
||||||
StatusBar.Panels[Panel_ScriptPath].Text := PChar(Node.Data);
|
begin
|
||||||
|
MethodInfo := PMethodInfo(node.Data)^;
|
||||||
|
StatusBar.Panels[Panel_ScriptPath].Text := MethodInfo.MethodStr;
|
||||||
|
if MethodInfo.BeginPos > 0 then
|
||||||
|
begin
|
||||||
|
CurrScript.SynEdit.SelStart := MethodInfo.BeginPos;
|
||||||
|
CurrScript.SynEdit.SetFocus;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
if Node.level = 0 then
|
if Node.level = 0 then
|
||||||
StatusBar.Panels[Panel_ScriptPath].Text := 'Section: ' + Node.Text;
|
StatusBar.Panels[Panel_ScriptPath].Text := 'Section: ' + Node.Text;
|
||||||
end;
|
end;
|
||||||
@ -1323,6 +1362,14 @@ end;
|
|||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Randomize;
|
Randomize;
|
||||||
|
MainDir:= ExtractFileDir(Application.ExeName);
|
||||||
|
if FileExists(MainDir + DS + SimbaSettingsFile) then
|
||||||
|
Application.CreateForm(TSettingsForm,SettingsForm)
|
||||||
|
else begin
|
||||||
|
Application.CreateForm(TSettingsForm,SettingsForm);
|
||||||
|
Self.CreateDefaultEnvironment;
|
||||||
|
end;
|
||||||
|
UpdateTimer.OnTimer:= @UpdateTimerCheck;
|
||||||
//Show close buttons @ tabs
|
//Show close buttons @ tabs
|
||||||
PageControl1.Options:=PageControl1.Options+[nboShowCloseButtons];
|
PageControl1.Options:=PageControl1.Options+[nboShowCloseButtons];
|
||||||
PageControl1.OnCloseTabClicked:=ActionCloseTab.OnExecute;
|
PageControl1.OnCloseTabClicked:=ActionCloseTab.OnExecute;
|
||||||
@ -1332,7 +1379,6 @@ begin
|
|||||||
Manager := TIOManager.Create; //No need to load plugins for the Global manager
|
Manager := TIOManager.Create; //No need to load plugins for the Global manager
|
||||||
Picker := TMColorPicker.Create(Manager);
|
Picker := TMColorPicker.Create(Manager);
|
||||||
Selector := TMWindowSelector.Create(Manager);
|
Selector := TMWindowSelector.Create(Manager);
|
||||||
MainDir:= ExtractFileDir(Application.ExeName);
|
|
||||||
{ For writeln }
|
{ For writeln }
|
||||||
SetLength(DebugStream, 0);
|
SetLength(DebugStream, 0);
|
||||||
DebugCriticalSection := syncobjs.TCriticalSection.Create;
|
DebugCriticalSection := syncobjs.TCriticalSection.Create;
|
||||||
@ -1531,7 +1577,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false));
|
Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false));
|
||||||
Temp2Node.Data:= strnew(PChar(Methods[i].FuncDecl));
|
Temp2Node.Data := GetMem(SizeOf(TMethodInfo));
|
||||||
|
with PMethodInfo(Temp2Node.Data)^ do
|
||||||
|
begin
|
||||||
|
MethodStr:= strnew(PChar(Methods[i].FuncDecl));
|
||||||
|
BeginPos:= -1;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
Sections.free;
|
Sections.free;
|
||||||
end;
|
end;
|
||||||
@ -1735,6 +1786,11 @@ begin
|
|||||||
result := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(Key,def,SimbaSettingsFile);
|
result := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(Key,def,SimbaSettingsFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TForm1.CreateSetting(Key: string; Value: string): string;
|
||||||
|
begin
|
||||||
|
result := SettingsForm.Settings.GetSetDefaultKeyValue(Key,value);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.FunctionListShown(ShowIt: boolean);
|
procedure TForm1.FunctionListShown(ShowIt: boolean);
|
||||||
var
|
var
|
||||||
Node : TTreeNode;
|
Node : TTreeNode;
|
||||||
|
@ -539,7 +539,7 @@ begin
|
|||||||
Nodes.Clear;
|
Nodes.Clear;
|
||||||
if not fileExists(fileName) then
|
if not fileExists(fileName) then
|
||||||
begin
|
begin
|
||||||
writeln('KANKER');
|
writeln('SettingsFile hasn''t been created yet.');
|
||||||
// create file.
|
// create file.
|
||||||
SaveToXML(fileName);
|
SaveToXML(fileName);
|
||||||
end;
|
end;
|
||||||
|
@ -13,6 +13,8 @@ interface
|
|||||||
end;
|
end;
|
||||||
TGenericLibArray = array of TGenericLib;
|
TGenericLibArray = array of TGenericLib;
|
||||||
|
|
||||||
|
{ TGenericLoader }
|
||||||
|
|
||||||
TGenericLoader = class(TObject)
|
TGenericLoader = class(TObject)
|
||||||
private
|
private
|
||||||
PluginLen : integer;
|
PluginLen : integer;
|
||||||
@ -20,6 +22,7 @@ interface
|
|||||||
PluginDirs : TStringList;
|
PluginDirs : TStringList;
|
||||||
procedure FreePlugins;
|
procedure FreePlugins;
|
||||||
procedure LoadPluginsDir(DirIndex : integer);
|
procedure LoadPluginsDir(DirIndex : integer);
|
||||||
|
function VerifyPath(Path : string) : string;
|
||||||
protected
|
protected
|
||||||
function InitPlugin(plugin: TLibHandle): boolean; virtual; abstract;
|
function InitPlugin(plugin: TLibHandle): boolean; virtual; abstract;
|
||||||
public
|
public
|
||||||
@ -38,12 +41,14 @@ implementation
|
|||||||
procedure TGenericLoader.AddPath(path: string);
|
procedure TGenericLoader.AddPath(path: string);
|
||||||
var
|
var
|
||||||
idx: integer;
|
idx: integer;
|
||||||
|
verified : string;
|
||||||
begin
|
begin
|
||||||
|
verified := VerifyPath(path);
|
||||||
//IDK who changed this to loading a dir, but DON'T
|
//IDK who changed this to loading a dir, but DON'T
|
||||||
if not PluginDirs.Find(path,idx) then
|
if not PluginDirs.Find(verified,idx) then
|
||||||
begin
|
begin
|
||||||
writeln('Adding Plugin Path: ' + path);
|
writeln('Adding Plugin Path: ' + verified);
|
||||||
PluginDirs.Add(path);
|
PluginDirs.Add(verified);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -71,17 +76,9 @@ implementation
|
|||||||
begin
|
begin
|
||||||
for i := 0 to PluginDirs.Count - 1 do
|
for i := 0 to PluginDirs.Count - 1 do
|
||||||
begin;
|
begin;
|
||||||
if DirectoryExists(PluginDirs.Strings[i]) = false then
|
if DirectoryExists(PluginDirs[i]) = false then
|
||||||
raise Exception.createFMT('Directory(%s) does not exist',[PluginDirs[i]]);
|
raise Exception.createFMT('Directory(%s) does not exist',[PluginDirs[i]]);
|
||||||
TempStr := PluginDirs.Strings[i];
|
PluginDirs[i] := VerifyPath(PluginDirs[i]);
|
||||||
if (TempStr[Length(TempStr)] <> DS) then
|
|
||||||
begin;
|
|
||||||
if (TempStr[Length(TempStr)] = '\') or (TempStr[Length(TempStr)] = '/') then
|
|
||||||
TempStr[Length(TempStr)] := DS
|
|
||||||
else
|
|
||||||
TempStr := TempStr + DS;
|
|
||||||
PluginDirs.Strings[i] := TempStr;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -103,6 +100,18 @@ implementation
|
|||||||
FindClose(FileSearcher);
|
FindClose(FileSearcher);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TGenericLoader.VerifyPath(Path: string): string;
|
||||||
|
begin
|
||||||
|
Result := Path;
|
||||||
|
if (Result[Length(Result)] <> DS) then
|
||||||
|
begin;
|
||||||
|
if (Result[Length(Result)] = '\') or (Result[Length(Result)] = '/') then
|
||||||
|
Result[Length(Result)] := DS
|
||||||
|
else
|
||||||
|
Result := Result + DS;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TGenericLoader.LoadPlugin(PluginName: string): Integer;
|
function TGenericLoader.LoadPlugin(PluginName: string): Integer;
|
||||||
var
|
var
|
||||||
@ -148,6 +157,7 @@ implementation
|
|||||||
PluginLen := 0;
|
PluginLen := 0;
|
||||||
PluginDirs := TStringList.Create;
|
PluginDirs := TStringList.Create;
|
||||||
PluginDirs.CaseSensitive:= {$IFDEF LINUX}true{$ELSE}false{$ENDIF};
|
PluginDirs.CaseSensitive:= {$IFDEF LINUX}true{$ELSE}false{$ENDIF};
|
||||||
|
PluginDirs.Duplicates:= dupIgnore;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TGenericLoader.Destroy;
|
destructor TGenericLoader.Destroy;
|
||||||
|
Loading…
Reference in New Issue
Block a user