From ff7228ba704c36d572b65b0e34f3e59a55801019 Mon Sep 17 00:00:00 2001 From: Merlijn Wajer Date: Wed, 23 Feb 2011 13:09:05 +0100 Subject: [PATCH] Simba: External editor now works. --- Projects/Simba/framescript.pas | 18 +++++++++++++++--- Projects/Simba/simbaunit.pas | 1 - 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Projects/Simba/framescript.pas b/Projects/Simba/framescript.pas index 5639c01..313c6f6 100644 --- a/Projects/Simba/framescript.pas +++ b/Projects/Simba/framescript.pas @@ -597,6 +597,7 @@ begin Command := ACmd; end; end; + constructor TScriptFrame.Create(TheOwner: TComponent); const AdditionalFolds:TPascalCodeFoldBlockTypes = [cfbtSlashComment,cfbtBorCommand,cfbtAnsiComment]; @@ -618,6 +619,9 @@ begin FScriptState:= ss_None; ScriptErrorLine:= -1; OwnerSheet.Caption:= ScriptName; + + SynEdit.Enabled := True; // For some reason we need this? + SynEdit.Highlighter := SimbaForm.CurrHighlighter; SynEdit.Options := SynEdit.Options + [eoTabIndent, eoKeepCaretX, eoDragDropEditing] - [eoSmartTabs]; SynEdit.Options2 := SynEdit.Options2 + [eoCaretSkipsSelection]; @@ -668,15 +672,23 @@ var begin try ExternScript := TFileStream.Create(ScriptFile, fmOpenRead); - ExternScript.Read(NewScript, ExternScript.Size); - - SynEdit.Lines.SetText(PChar(NewScript)); except on EFOpenError do begin formWriteln('Could not open extern script :' + ScriptFile); + exit; end; end; + + try + SetLength(NewScript, ExternScript.Size); + ExternScript.Read(NewScript[1], ExternScript.Size); + + SynEdit.Lines.SetText(PChar(NewScript)); + SetLength(NewScript, 0); + finally + ExternScript.Free; + end; end; initialization diff --git a/Projects/Simba/simbaunit.pas b/Projects/Simba/simbaunit.pas index 7985352..1f4bb92 100644 --- a/Projects/Simba/simbaunit.pas +++ b/Projects/Simba/simbaunit.pas @@ -2584,7 +2584,6 @@ begin CloseTabs(PopupTab); end; - procedure TSimbaForm.MenuItemReadOnlyTabClick(Sender: TObject); var Tab: TMufasaTab;