Merge branch 'OpenScriptEx' of https://github.com/Dgby714/Simba

This commit is contained in:
Merlijn Wajer 2010-12-23 14:01:29 +01:00
commit 40c93dc127
2 changed files with 32 additions and 5 deletions

View File

@ -193,6 +193,7 @@ begin
AddFunction(@ext_InputQuery,'function InputQuery(const ACaption, APrompt : String; var Value : String) : Boolean;');
AddFunction(@ext_ScriptText,'function ScriptText: string;');
AddFunction(@ext_OpenScript,'procedure OpenScript(Name, Data: string);');
AddFunction(@ext_OpenScriptEx,'procedure OpenScriptEx(FileName: string);');
AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox');
AddFunction(@ext_GetPageEx,'function GetPageEx(const URL, PostData, MimeType: string): string;');
AddFunction(@ext_GetJSONValue,'function GetJSONValue(const Data, Value: string): string;');

View File

@ -133,11 +133,37 @@ procedure ext_OpenScript(Name, Data: string);
begin
if (Name = '') then
Name := 'Untitled';
SimbaForm.AddTab;
SimbaForm.CurrScript.SynEdit.Lines.Text := Data;
SimbaForm.CurrScript.ScriptName := Name;
SimbaForm.RefreshTab;
SimbaForm.UpdateTitle;
with SimbaForm do
begin
AddTab();
with CurrScript do
begin
SynEdit.Lines.Text := Data;
ScriptName := Name;
end;
RefreshTab();
UpdateTitle();
end;
end;
procedure ext_OpenScriptEx(FileName: string);
begin
FileName := SetDirSeparators(FileName);
with SimbaForm do
begin
AddTab();
with CurrScript do
begin
SynEdit.Lines.LoadFromFile(FileName);
StartText := SynEdit.Lines.Text;
ScriptName := ExtractFileNameOnly(FileName);
ScriptFile := FileName;
ScriptChanged := False;
end;
RefreshTab();
UpdateTitle();
end;
end;
function ext_GetPageEx(const URL, PostData, MimeType: string): string;