diff --git a/Extensions/test.sex b/Extensions/test.sex index 3c4ae0e..ac088f2 100644 --- a/Extensions/test.sex +++ b/Extensions/test.sex @@ -10,10 +10,32 @@ begin Writeln('Free your extension here'); end; -procedure Attach; +function GetNumbers(const str : string) : string; +var + i : integer; begin; - Settings.SetKeyValue('TestSetting','1337'); - Writeln('Your extension has been enabled, do stuff here'); + for i := 1 to length(str) do + case str[i] of + '0'..'9': result := result + str[i]; + end; +end; +procedure Attach; +var + Fonts : string; + Contents : string; + newvers :integer; + Vers : integer; +begin; + Vers := StrToIntDef(Settings.GetKeyValueDef('FontVersion','-1'),-1); + newvers := strtointdef(GetNumbers(getpage('http://simba.villavu.com/bin/Fonts/Version')),-1); + if newVers > vers then + begin; + Writeln('Updating your fonts!'); + fonts := GetPage('http://simba.villavu.com/bin/Fonts/Fonts.tar.bz2'); + if DecompressBZip2(Fonts,Contents,4096) then + UnTarEx(Contents,FontPath,true); + Settings.SetKeyValue('FontVersion',inttostr(newvers)); + end; end; Procedure Detach; @@ -24,7 +46,7 @@ end; //Called to retrieve the name of your extension function GetName : string; begin; - result := 'Test Extension'; + result := 'Font updater example'; end; //Called to retrieve the version of your extension diff --git a/Projects/SAMufasaGUI/extensionmanager.pas b/Projects/SAMufasaGUI/extensionmanager.pas index f63e311..e9ca5c0 100644 --- a/Projects/SAMufasaGUI/extensionmanager.pas +++ b/Projects/SAMufasaGUI/extensionmanager.pas @@ -5,7 +5,7 @@ unit extensionmanager; interface uses - Classes, SysUtils,virtualextension,psextension,mufasabase,mufasatypes; + Classes, SysUtils,virtualextension,psextension,mufasabase; type TExtension = TVirtualSimbaExtension; @@ -38,7 +38,7 @@ var implementation uses - TestUnit, settingssandbox,simbasettings; + TestUnit, settingssandbox,simbasettings,MufasaTypes; procedure TExtensionManager.SetOnchange(const AValue: TNotifyEvent); var diff --git a/Projects/SAMufasaGUI/framescript.lfm b/Projects/SAMufasaGUI/framescript.lfm index cb8b4e4..f0ad4a6 100644 --- a/Projects/SAMufasaGUI/framescript.lfm +++ b/Projects/SAMufasaGUI/framescript.lfm @@ -52,7 +52,6 @@ object ScriptFrame: TScriptFrame Option = 0 Priority = 0 end> - Highlighter = SynFreePascalSyn1 Keystrokes = < item Command = ecUp @@ -710,19 +709,4 @@ object ScriptFrame: TScriptFrame end end end - object SynFreePascalSyn1: TSynFreePascalSyn - Enabled = False - CommentAttri.Foreground = clBlue - CommentAttri.Style = [fsBold] - IdentifierAttri.Foreground = clDefault - NumberAttri.Foreground = clNavy - StringAttri.Foreground = clBlue - SymbolAttri.Foreground = clRed - DirectiveAttri.Foreground = clRed - DirectiveAttri.Style = [fsBold] - CompilerMode = pcmObjFPC - NestedComments = True - left = 320 - top = 16 - end end diff --git a/Projects/SAMufasaGUI/framescript.lrs b/Projects/SAMufasaGUI/framescript.lrs index f103b62..4ade7fe 100644 --- a/Projects/SAMufasaGUI/framescript.lrs +++ b/Projects/SAMufasaGUI/framescript.lrs @@ -16,144 +16,137 @@ LazarusResources.Add('TScriptFrame','FORMDATA',[ +'mand'#2#13#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9 +'ShiftMask'#11#0#6'Button'#7#7'mbRight'#10'ClickCount'#7#8'ccSingle'#8'Click' +'Dir'#7#4'cdUp'#7'Command'#2#12#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0 - +#0#0#11'Highlighter'#7#17'SynFreePascalSyn1'#10'Keystrokes'#14#1#7'Command'#7 - +#4'ecUp'#8'ShortCut'#2'&'#0#1#7'Command'#7#7'ecSelUp'#8'ShortCut'#3'& '#0#1#7 - +'Command'#7#10'ecScrollUp'#8'ShortCut'#3'&@'#0#1#7'Command'#7#6'ecDown'#8'Sh' - +'ortCut'#2'('#0#1#7'Command'#7#9'ecSelDown'#8'ShortCut'#3'( '#0#1#7'Command' - +#7#12'ecScrollDown'#8'ShortCut'#3'(@'#0#1#7'Command'#7#6'ecLeft'#8'ShortCut' - +#2'%'#0#1#7'Command'#7#9'ecSelLeft'#8'ShortCut'#3'% '#0#1#7'Command'#7#10'ec' - +'WordLeft'#8'ShortCut'#3'%@'#0#1#7'Command'#7#13'ecSelWordLeft'#8'ShortCut'#3 - +'%`'#0#1#7'Command'#7#7'ecRight'#8'ShortCut'#2''''#0#1#7'Command'#7#10'ecSel' - +'Right'#8'ShortCut'#3''' '#0#1#7'Command'#7#11'ecWordRight'#8'ShortCut'#3'''' - +'@'#0#1#7'Command'#7#14'ecSelWordRight'#8'ShortCut'#3'''`'#0#1#7'Command'#7 - +#10'ecPageDown'#8'ShortCut'#2'"'#0#1#7'Command'#7#13'ecSelPageDown'#8'ShortC' - +'ut'#3'" '#0#1#7'Command'#7#12'ecPageBottom'#8'ShortCut'#3'"@'#0#1#7'Command' - +#7#15'ecSelPageBottom'#8'ShortCut'#3'"`'#0#1#7'Command'#7#8'ecPageUp'#8'Shor' - +'tCut'#2'!'#0#1#7'Command'#7#11'ecSelPageUp'#8'ShortCut'#3'! '#0#1#7'Command' - +#7#9'ecPageTop'#8'ShortCut'#3'!@'#0#1#7'Command'#7#12'ecSelPageTop'#8'ShortC' - +'ut'#3'!`'#0#1#7'Command'#7#11'ecLineStart'#8'ShortCut'#2'$'#0#1#7'Command'#7 - +#14'ecSelLineStart'#8'ShortCut'#3'$ '#0#1#7'Command'#7#11'ecEditorTop'#8'Sho' - +'rtCut'#3'$@'#0#1#7'Command'#7#14'ecSelEditorTop'#8'ShortCut'#3'$`'#0#1#7'Co' - +'mmand'#7#9'ecLineEnd'#8'ShortCut'#2'#'#0#1#7'Command'#7#12'ecSelLineEnd'#8 - +'ShortCut'#3'# '#0#1#7'Command'#7#14'ecEditorBottom'#8'ShortCut'#3'#@'#0#1#7 - +'Command'#7#17'ecSelEditorBottom'#8'ShortCut'#3'#`'#0#1#7'Command'#7#12'ecTo' - +'ggleMode'#8'ShortCut'#2'-'#0#1#7'Command'#7#6'ecCopy'#8'ShortCut'#3'-@'#0#1 - +#7'Command'#7#7'ecPaste'#8'ShortCut'#3'- '#0#1#7'Command'#7#12'ecDeleteChar' - +#8'ShortCut'#2'.'#0#1#7'Command'#7#5'ecCut'#8'ShortCut'#3'. '#0#1#7'Command' - +#7#16'ecDeleteLastChar'#8'ShortCut'#2#8#0#1#7'Command'#7#16'ecDeleteLastChar' - +#8'ShortCut'#3#8' '#0#1#7'Command'#7#16'ecDeleteLastWord'#8'ShortCut'#3#8'@' - +#0#1#7'Command'#7#6'ecUndo'#8'ShortCut'#4#8#128#0#0#0#1#7'Command'#7#6'ecRed' - +'o'#8'ShortCut'#4#8#160#0#0#0#1#7'Command'#7#11'ecLineBreak'#8'ShortCut'#2#13 - +#0#1#7'Command'#7#11'ecSelectAll'#8'ShortCut'#3'A@'#0#1#7'Command'#7#6'ecCop' - +'y'#8'ShortCut'#3'C@'#0#1#7'Command'#7#13'ecBlockIndent'#8'ShortCut'#3'I@'#0 - +#1#7'Command'#7#11'ecLineBreak'#8'ShortCut'#3'M@'#0#1#7'Command'#7#15'ecBloc' - +'kUnindent'#8'ShortCut'#3'U@'#0#1#7'Command'#7#7'ecPaste'#8'ShortCut'#3'V@'#0 - +#1#7'Command'#7#5'ecCut'#8'ShortCut'#3'X@'#0#1#7'Command'#7#12'ecDeleteLine' - +#8'ShortCut'#3'Y@'#0#1#7'Command'#7#11'ecDeleteEOL'#8'ShortCut'#3'Y`'#0#1#7 - +'Command'#7#6'ecUndo'#8'ShortCut'#3'Z@'#0#1#7'Command'#7#6'ecRedo'#8'ShortCu' - +'t'#3'Z`'#0#1#7'Command'#7#13'ecGotoMarker0'#8'ShortCut'#3'0@'#0#1#7'Command' - +#7#13'ecGotoMarker1'#8'ShortCut'#3'1@'#0#1#7'Command'#7#13'ecGotoMarker2'#8 - +'ShortCut'#3'2@'#0#1#7'Command'#7#13'ecGotoMarker3'#8'ShortCut'#3'3@'#0#1#7 - +'Command'#7#13'ecGotoMarker4'#8'ShortCut'#3'4@'#0#1#7'Command'#7#13'ecGotoMa' - +'rker5'#8'ShortCut'#3'5@'#0#1#7'Command'#7#13'ecGotoMarker6'#8'ShortCut'#3'6' - +'@'#0#1#7'Command'#7#13'ecGotoMarker7'#8'ShortCut'#3'7@'#0#1#7'Command'#7#13 - +'ecGotoMarker8'#8'ShortCut'#3'8@'#0#1#7'Command'#7#13'ecGotoMarker9'#8'Short' - +'Cut'#3'9@'#0#1#7'Command'#7#12'ecSetMarker0'#8'ShortCut'#3'0`'#0#1#7'Comman' - +'d'#7#12'ecSetMarker1'#8'ShortCut'#3'1`'#0#1#7'Command'#7#12'ecSetMarker2'#8 - +'ShortCut'#3'2`'#0#1#7'Command'#7#12'ecSetMarker3'#8'ShortCut'#3'3`'#0#1#7'C' - +'ommand'#7#12'ecSetMarker4'#8'ShortCut'#3'4`'#0#1#7'Command'#7#12'ecSetMarke' - +'r5'#8'ShortCut'#3'5`'#0#1#7'Command'#7#12'ecSetMarker6'#8'ShortCut'#3'6`'#0 - +#1#7'Command'#7#12'ecSetMarker7'#8'ShortCut'#3'7`'#0#1#7'Command'#7#12'ecSet' - +'Marker8'#8'ShortCut'#3'8`'#0#1#7'Command'#7#12'ecSetMarker9'#8'ShortCut'#3 - ,'9`'#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut'#4'1'#160#0#0#0#1#7'Comman' - +'d'#7#12'EcFoldLevel2'#8'ShortCut'#4'2'#160#0#0#0#1#7'Command'#7#12'EcFoldLe' - +'vel1'#8'ShortCut'#4'3'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut' - +#4'4'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut'#4'5'#160#0#0#0#1 - +#7'Command'#7#12'EcFoldLevel6'#8'ShortCut'#4'6'#160#0#0#0#1#7'Command'#7#12 - +'EcFoldLevel7'#8'ShortCut'#4'7'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel8'#8 - +'ShortCut'#4'8'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel9'#8'ShortCut'#4'9' - +#160#0#0#0#1#7'Command'#7#12'EcFoldLevel0'#8'ShortCut'#4'0'#160#0#0#0#1#7'Co' - +'mmand'#7#13'EcFoldCurrent'#8'ShortCut'#4'-'#160#0#0#0#1#7'Command'#7#15'EcU' - +'nFoldCurrent'#8'ShortCut'#4'+'#160#0#0#0#1#7'Command'#7#18'EcToggleMarkupWo' - +'rd'#8'ShortCut'#4'M'#128#0#0#0#1#7'Command'#7#14'ecNormalSelect'#8'ShortCut' - +#3'N`'#0#1#7'Command'#7#14'ecColumnSelect'#8'ShortCut'#3'C`'#0#1#7'Command'#7 - +#12'ecLineSelect'#8'ShortCut'#3'L`'#0#1#7'Command'#7#5'ecTab'#8'ShortCut'#2#9 - +#0#1#7'Command'#7#10'ecShiftTab'#8'ShortCut'#3#9' '#0#1#7'Command'#7#14'ecMa' - +'tchBracket'#8'ShortCut'#3'B`'#0#1#7'Command'#7#10'ecColSelUp'#8'ShortCut'#4 - +'&'#160#0#0#0#1#7'Command'#7#12'ecColSelDown'#8'ShortCut'#4'('#160#0#0#0#1#7 - +'Command'#7#12'ecColSelLeft'#8'ShortCut'#4'%'#160#0#0#0#1#7'Command'#7#13'ec' - +'ColSelRight'#8'ShortCut'#4''''#160#0#0#0#1#7'Command'#7#16'ecColSelPageDown' - +#8'ShortCut'#4'"'#160#0#0#0#1#7'Command'#7#18'ecColSelPageBottom'#8'ShortCut' - +#4'"'#224#0#0#0#1#7'Command'#7#14'ecColSelPageUp'#8'ShortCut'#4'!'#160#0#0#0 - +#1#7'Command'#7#15'ecColSelPageTop'#8'ShortCut'#4'!'#224#0#0#0#1#7'Command'#7 - +#17'ecColSelLineStart'#8'ShortCut'#4'$'#160#0#0#0#1#7'Command'#7#15'ecColSel' - +'LineEnd'#8'ShortCut'#4'#'#160#0#0#0#1#7'Command'#7#17'ecColSelEditorTop'#8 - +'ShortCut'#4'$'#224#0#0#0#1#7'Command'#7#20'ecColSelEditorBottom'#8'ShortCut' - +#4'#'#224#0#0#0#0#12'MouseActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#7'ssSh' - +'ift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'ClickD' - +'ir'#7#6'cdDown'#7'Command'#2#1#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0 - +#0#1#5'Shift'#11#7'ssShift'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button' - +#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command' - +#2#1#9'MoveCaret'#9#6'Option'#2#1#8'Priority'#2#0#0#1#5'Shift'#11#5'ssAlt'#0 - +#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7 - +#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#3#9'MoveCaret'#9#6'Option' - +#2#0#8'Priority'#2#0#0#1#5'Shift'#11#7'ssShift'#5'ssAlt'#0#9'ShiftMask'#11#7 - +'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'Cl' - +'ickDir'#7#6'cdDown'#7'Command'#2#3#9'MoveCaret'#9#6'Option'#2#1#8'Priority' - +#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#7'mbRight'#10'ClickCoun' - +'t'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#12#9'MoveCaret'#8#6'Opt' - +'ion'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6 - +'mbLeft'#10'ClickCount'#7#8'ccDouble'#8'ClickDir'#7#6'cdDown'#7'Command'#2#6 - +#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask' - +#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccTriple'#8'ClickDir'#7#6'cdD' - +'own'#7'Command'#2#7#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shif' - +'t'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#6'ccQuad'#8 - +'ClickDir'#7#6'cdDown'#7'Command'#2#8#9'MoveCaret'#9#6'Option'#2#0#8'Priorit' - +'y'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#8'mbMiddle'#10'Click' - +'Count'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#10#9'MoveCaret'#9 - +#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#6'ssCtrl'#0#9'ShiftMask'#11#7 - +'ssShift'#5'ssAlt'#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSi' - +'ngle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#11#9'MoveCaret'#8#6'Option'#2#0#8 - +'Priority'#2#0#0#0#15'MouseSelActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6 + +#0#0#10'Keystrokes'#14#1#7'Command'#7#4'ecUp'#8'ShortCut'#2'&'#0#1#7'Command' + +#7#7'ecSelUp'#8'ShortCut'#3'& '#0#1#7'Command'#7#10'ecScrollUp'#8'ShortCut'#3 + +'&@'#0#1#7'Command'#7#6'ecDown'#8'ShortCut'#2'('#0#1#7'Command'#7#9'ecSelDow' + +'n'#8'ShortCut'#3'( '#0#1#7'Command'#7#12'ecScrollDown'#8'ShortCut'#3'(@'#0#1 + +#7'Command'#7#6'ecLeft'#8'ShortCut'#2'%'#0#1#7'Command'#7#9'ecSelLeft'#8'Sho' + +'rtCut'#3'% '#0#1#7'Command'#7#10'ecWordLeft'#8'ShortCut'#3'%@'#0#1#7'Comman' + +'d'#7#13'ecSelWordLeft'#8'ShortCut'#3'%`'#0#1#7'Command'#7#7'ecRight'#8'Shor' + +'tCut'#2''''#0#1#7'Command'#7#10'ecSelRight'#8'ShortCut'#3''' '#0#1#7'Comman' + +'d'#7#11'ecWordRight'#8'ShortCut'#3'''@'#0#1#7'Command'#7#14'ecSelWordRight' + +#8'ShortCut'#3'''`'#0#1#7'Command'#7#10'ecPageDown'#8'ShortCut'#2'"'#0#1#7'C' + +'ommand'#7#13'ecSelPageDown'#8'ShortCut'#3'" '#0#1#7'Command'#7#12'ecPageBot' + +'tom'#8'ShortCut'#3'"@'#0#1#7'Command'#7#15'ecSelPageBottom'#8'ShortCut'#3'"' + +'`'#0#1#7'Command'#7#8'ecPageUp'#8'ShortCut'#2'!'#0#1#7'Command'#7#11'ecSelP' + +'ageUp'#8'ShortCut'#3'! '#0#1#7'Command'#7#9'ecPageTop'#8'ShortCut'#3'!@'#0#1 + +#7'Command'#7#12'ecSelPageTop'#8'ShortCut'#3'!`'#0#1#7'Command'#7#11'ecLineS' + +'tart'#8'ShortCut'#2'$'#0#1#7'Command'#7#14'ecSelLineStart'#8'ShortCut'#3'$ ' + +#0#1#7'Command'#7#11'ecEditorTop'#8'ShortCut'#3'$@'#0#1#7'Command'#7#14'ecSe' + +'lEditorTop'#8'ShortCut'#3'$`'#0#1#7'Command'#7#9'ecLineEnd'#8'ShortCut'#2'#' + +#0#1#7'Command'#7#12'ecSelLineEnd'#8'ShortCut'#3'# '#0#1#7'Command'#7#14'ecE' + +'ditorBottom'#8'ShortCut'#3'#@'#0#1#7'Command'#7#17'ecSelEditorBottom'#8'Sho' + +'rtCut'#3'#`'#0#1#7'Command'#7#12'ecToggleMode'#8'ShortCut'#2'-'#0#1#7'Comma' + +'nd'#7#6'ecCopy'#8'ShortCut'#3'-@'#0#1#7'Command'#7#7'ecPaste'#8'ShortCut'#3 + +'- '#0#1#7'Command'#7#12'ecDeleteChar'#8'ShortCut'#2'.'#0#1#7'Command'#7#5'e' + +'cCut'#8'ShortCut'#3'. '#0#1#7'Command'#7#16'ecDeleteLastChar'#8'ShortCut'#2 + +#8#0#1#7'Command'#7#16'ecDeleteLastChar'#8'ShortCut'#3#8' '#0#1#7'Command'#7 + +#16'ecDeleteLastWord'#8'ShortCut'#3#8'@'#0#1#7'Command'#7#6'ecUndo'#8'ShortC' + +'ut'#4#8#128#0#0#0#1#7'Command'#7#6'ecRedo'#8'ShortCut'#4#8#160#0#0#0#1#7'Co' + +'mmand'#7#11'ecLineBreak'#8'ShortCut'#2#13#0#1#7'Command'#7#11'ecSelectAll'#8 + +'ShortCut'#3'A@'#0#1#7'Command'#7#6'ecCopy'#8'ShortCut'#3'C@'#0#1#7'Command' + +#7#13'ecBlockIndent'#8'ShortCut'#3'I@'#0#1#7'Command'#7#11'ecLineBreak'#8'Sh' + +'ortCut'#3'M@'#0#1#7'Command'#7#15'ecBlockUnindent'#8'ShortCut'#3'U@'#0#1#7 + +'Command'#7#7'ecPaste'#8'ShortCut'#3'V@'#0#1#7'Command'#7#5'ecCut'#8'ShortCu' + +'t'#3'X@'#0#1#7'Command'#7#12'ecDeleteLine'#8'ShortCut'#3'Y@'#0#1#7'Command' + +#7#11'ecDeleteEOL'#8'ShortCut'#3'Y`'#0#1#7'Command'#7#6'ecUndo'#8'ShortCut'#3 + +'Z@'#0#1#7'Command'#7#6'ecRedo'#8'ShortCut'#3'Z`'#0#1#7'Command'#7#13'ecGoto' + +'Marker0'#8'ShortCut'#3'0@'#0#1#7'Command'#7#13'ecGotoMarker1'#8'ShortCut'#3 + +'1@'#0#1#7'Command'#7#13'ecGotoMarker2'#8'ShortCut'#3'2@'#0#1#7'Command'#7#13 + +'ecGotoMarker3'#8'ShortCut'#3'3@'#0#1#7'Command'#7#13'ecGotoMarker4'#8'Short' + +'Cut'#3'4@'#0#1#7'Command'#7#13'ecGotoMarker5'#8'ShortCut'#3'5@'#0#1#7'Comma' + +'nd'#7#13'ecGotoMarker6'#8'ShortCut'#3'6@'#0#1#7'Command'#7#13'ecGotoMarker7' + +#8'ShortCut'#3'7@'#0#1#7'Command'#7#13'ecGotoMarker8'#8'ShortCut'#3'8@'#0#1#7 + +'Command'#7#13'ecGotoMarker9'#8'ShortCut'#3'9@'#0#1#7'Command'#7#12'ecSetMar' + +'ker0'#8'ShortCut'#3'0`'#0#1#7'Command'#7#12'ecSetMarker1'#8'ShortCut'#3'1`' + +#0#1#7'Command'#7#12'ecSetMarker2'#8'ShortCut'#3'2`'#0#1#7'Command'#7#12'ecS' + +'etMarker3'#8'ShortCut'#3'3`'#0#1#7'Command'#7#12'ecSetMarker4'#8'ShortCut'#3 + +'4`'#0#1#7'Command'#7#12'ecSetMarker5'#8'ShortCut'#3'5`'#0#1#7'Command'#7#12 + +'ecSetMarker6'#8'ShortCut'#3'6`'#0#1#7'Command'#7#12'ecSetMarker7'#8'ShortCu' + +'t'#3'7`'#0#1#7'Command'#7#12'ecSetMarker8'#8'ShortCut'#3'8`'#0#1#7'Command' + +#7#12'ecSetMarker9'#8'ShortCut'#3'9`'#0#1#7'Command'#7#12'EcFoldLevel1'#8'Sh' + ,'ortCut'#4'1'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel2'#8'ShortCut'#4'2'#160 + +#0#0#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut'#4'3'#160#0#0#0#1#7'Comman' + +'d'#7#12'EcFoldLevel1'#8'ShortCut'#4'4'#160#0#0#0#1#7'Command'#7#12'EcFoldLe' + +'vel1'#8'ShortCut'#4'5'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel6'#8'ShortCut' + +#4'6'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel7'#8'ShortCut'#4'7'#160#0#0#0#1 + +#7'Command'#7#12'EcFoldLevel8'#8'ShortCut'#4'8'#160#0#0#0#1#7'Command'#7#12 + +'EcFoldLevel9'#8'ShortCut'#4'9'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel0'#8 + +'ShortCut'#4'0'#160#0#0#0#1#7'Command'#7#13'EcFoldCurrent'#8'ShortCut'#4'-' + +#160#0#0#0#1#7'Command'#7#15'EcUnFoldCurrent'#8'ShortCut'#4'+'#160#0#0#0#1#7 + +'Command'#7#18'EcToggleMarkupWord'#8'ShortCut'#4'M'#128#0#0#0#1#7'Command'#7 + +#14'ecNormalSelect'#8'ShortCut'#3'N`'#0#1#7'Command'#7#14'ecColumnSelect'#8 + +'ShortCut'#3'C`'#0#1#7'Command'#7#12'ecLineSelect'#8'ShortCut'#3'L`'#0#1#7'C' + +'ommand'#7#5'ecTab'#8'ShortCut'#2#9#0#1#7'Command'#7#10'ecShiftTab'#8'ShortC' + +'ut'#3#9' '#0#1#7'Command'#7#14'ecMatchBracket'#8'ShortCut'#3'B`'#0#1#7'Comm' + +'and'#7#10'ecColSelUp'#8'ShortCut'#4'&'#160#0#0#0#1#7'Command'#7#12'ecColSel' + +'Down'#8'ShortCut'#4'('#160#0#0#0#1#7'Command'#7#12'ecColSelLeft'#8'ShortCut' + +#4'%'#160#0#0#0#1#7'Command'#7#13'ecColSelRight'#8'ShortCut'#4''''#160#0#0#0 + +#1#7'Command'#7#16'ecColSelPageDown'#8'ShortCut'#4'"'#160#0#0#0#1#7'Command' + +#7#18'ecColSelPageBottom'#8'ShortCut'#4'"'#224#0#0#0#1#7'Command'#7#14'ecCol' + +'SelPageUp'#8'ShortCut'#4'!'#160#0#0#0#1#7'Command'#7#15'ecColSelPageTop'#8 + +'ShortCut'#4'!'#224#0#0#0#1#7'Command'#7#17'ecColSelLineStart'#8'ShortCut'#4 + +'$'#160#0#0#0#1#7'Command'#7#15'ecColSelLineEnd'#8'ShortCut'#4'#'#160#0#0#0#1 + +#7'Command'#7#17'ecColSelEditorTop'#8'ShortCut'#4'$'#224#0#0#0#1#7'Command'#7 + +#20'ecColSelEditorBottom'#8'ShortCut'#4'#'#224#0#0#0#0#12'MouseActions'#14#1 + +#5'Shift'#11#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10 + +'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#1#9'MoveCare' + +'t'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#7'ssShift'#0#9'ShiftMask' + +#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle' + +#8'ClickDir'#7#6'cdDown'#7'Command'#2#1#9'MoveCaret'#9#6'Option'#2#1#8'Prior' + +'ity'#2#0#0#1#5'Shift'#11#5'ssAlt'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6 +'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7 - +'Command'#2#9#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#13'Lines.Stri' - +'ngs'#1#6#12'program new;'#6#5'begin'#6#4'end.'#0#7'Options'#11#12'eoAutoInd' - +'ent'#11'eoGroupUndo'#15'eoScrollPastEol'#11'eoSmartTabs'#11'eoTabIndent'#14 - +'eoTabsToSpaces'#20'eoTrimTrailingSpaces'#18'eoBracketHighlight'#0#21'Bracke' - +'tHighlightStyle'#7#8'sbhsBoth'#8'OnChange'#7#13'SynEditChange'#18'OnCommand' - +'Processed'#7#23'SynEditCommandProcessed'#16'OnProcessCommand'#7#21'SynEditP' - +'rocessCommand'#20'OnProcessUserCommand'#7#25'SynEditProcessUserCommand'#19 - +'OnSpecialLineColors'#7#24'SynEditSpecialLineColors'#14'OnStatusChange'#7#19 - +'SynEditStatusChange'#0#244#18'TSynGutterPartList'#0#0#15'TSynGutterMarks'#0 - +#5'Width'#2#23#0#0#20'TSynGutterLineNumber'#0#5'Width'#2#17#12'MouseActions' - +#14#0#21'MarkupInfo.Background'#7#9'clBtnFace'#21'MarkupInfo.Foreground'#7#6 - +'clNone'#10'DigitCount'#2#2#30'ShowOnlyLineNumbersMultiplesOf'#2#1#9'ZeroSta' - +'rt'#8#12'LeadingZeros'#8#0#0#17'TSynGutterChanges'#0#5'Width'#2#4#13'Modifi' - ,'edColor'#4#252#233#0#0#10'SavedColor'#7#7'clGreen'#0#0#19'TSynGutterSeparat' - +'or'#0#5'Width'#2#2#0#0#21'TSynGutterCodeFolding'#0#12'MouseActions'#14#1#5 - +'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#7'mbRight'#10'ClickCount'#7#8'ccS' - +'ingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#16#9'MoveCaret'#8#6'Option'#2#0#8 - +'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#7'ssShift'#0#6'Button'#7#8 - +'mbMiddle'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14 - +#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#7'ssShift'#0#9 - +'ShiftMask'#11#7'ssShift'#0#6'Button'#7#8'mbMiddle'#10'ClickCount'#7#5'ccAny' - +#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#1#8'Prio' - +'rity'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'Clic' - +'kCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#0#9'MoveCaret'#8#6 - +'Option'#2#0#8'Priority'#2#0#0#0#21'MarkupInfo.Background'#7#6'clNone'#21'Ma' - +'rkupInfo.Foreground'#7#6'clGray'#20'MouseActionsExpanded'#14#1#5'Shift'#11#0 - +#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDi' - +'r'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0 - +#0#0#21'MouseActionsCollapsed'#14#1#5'Shift'#11#6'ssCtrl'#0#9'ShiftMask'#11#6 - +'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'c' - +'dDown'#7'Command'#2#15#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'S' - +'hift'#11#0#9'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCount' - +#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#15#9'MoveCaret'#8#6'Option' - +#2#1#8'Priority'#2#0#0#0#0#0#0#0#17'TSynFreePascalSyn'#17'SynFreePascalSyn1' - +#7'Enabled'#8#23'CommentAttri.Foreground'#7#6'clBlue'#18'CommentAttri.Style' - +#11#6'fsBold'#0#26'IdentifierAttri.Foreground'#7#9'clDefault'#22'NumberAttri' - +'.Foreground'#7#6'clNavy'#22'StringAttri.Foreground'#7#6'clBlue'#22'SymbolAt' - +'tri.Foreground'#7#5'clRed'#25'DirectiveAttri.Foreground'#7#5'clRed'#20'Dire' - +'ctiveAttri.Style'#11#6'fsBold'#0#12'CompilerMode'#7#9'pcmObjFPC'#14'NestedC' - +'omments'#9#4'left'#3'@'#1#3'top'#2#16#0#0#0 + +'Command'#2#3#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#7 + +'ssShift'#5'ssAlt'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbL' + +'eft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#3#9 + +'MoveCaret'#9#6'Option'#2#1#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11 + +#0#6'Button'#7#7'mbRight'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp' + +#7'Command'#2#12#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11 + +#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccDouble'#8'Cl' + +'ickDir'#7#6'cdDown'#7'Command'#2#6#9'MoveCaret'#9#6'Option'#2#0#8'Priority' + +#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount' + +#7#8'ccTriple'#8'ClickDir'#7#6'cdDown'#7'Command'#2#7#9'MoveCaret'#9#6'Optio' + +'n'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mb' + +'Left'#10'ClickCount'#7#6'ccQuad'#8'ClickDir'#7#6'cdDown'#7'Command'#2#8#9'M' + +'oveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11 + +#0#6'Button'#7#8'mbMiddle'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDo' + +'wn'#7'Command'#2#10#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shif' + +'t'#11#6'ssCtrl'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#6'ssCtrl'#0#6'Button' + +#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2 + +#11#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#15'MouseSelActions'#14#1 + +#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'cc' + +'Single'#8'ClickDir'#7#6'cdDown'#7'Command'#2#9#9'MoveCaret'#8#6'Option'#2#0 + +#8'Priority'#2#0#0#0#13'Lines.Strings'#1#6#12'program new;'#6#5'begin'#6#4'e' + +'nd.'#0#7'Options'#11#12'eoAutoIndent'#11'eoGroupUndo'#15'eoScrollPastEol'#11 + +'eoSmartTabs'#11'eoTabIndent'#14'eoTabsToSpaces'#20'eoTrimTrailingSpaces'#18 + +'eoBracketHighlight'#0#21'BracketHighlightStyle'#7#8'sbhsBoth'#8'OnChange'#7 + +#13'SynEditChange'#18'OnCommandProcessed'#7#23'SynEditCommandProcessed'#16'O' + +'nProcessCommand'#7#21'SynEditProcessCommand'#20'OnProcessUserCommand'#7#25 + +'SynEditProcessUserCommand'#19'OnSpecialLineColors'#7#24'SynEditSpecialLineC' + +'olors'#14'OnStatusChange'#7#19'SynEditStatusChange'#0#244#18'TSynGutterPart' + +'List'#0#0#15'TSynGutterMarks'#0#5'Width'#2#23#0#0#20'TSynGutterLineNumber'#0 + +#5'Width'#2#17#12'MouseActions'#14#0#21'MarkupInfo.Background'#7#9'clBtnFace' + +#21'MarkupInfo.Foreground'#7#6'clNone'#10'DigitCount'#2#2#30'ShowOnlyLineNum' + +'bersMultiplesOf'#2#1#9'ZeroStart'#8#12'LeadingZeros'#8#0#0#17'TSynGutterCha' + +'nges'#0#5'Width'#2#4#13'ModifiedColor'#4#252#233#0#0#10'SavedColor'#7#7'clG' + ,'reen'#0#0#19'TSynGutterSeparator'#0#5'Width'#2#2#0#0#21'TSynGutterCodeFoldi' + +'ng'#0#12'MouseActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#7'm' + +'bRight'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#16#9 + +'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11 + +#7'ssShift'#0#6'Button'#7#8'mbMiddle'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7 + +#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5 + +'Shift'#11#7'ssShift'#0#9'ShiftMask'#11#7'ssShift'#0#6'Button'#7#8'mbMiddle' + +#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCar' + +'et'#8#6'Option'#2#1#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'B' + +'utton'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Comm' + +'and'#2#0#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#21'MarkupInfo.Bac' + +'kground'#7#6'clNone'#21'MarkupInfo.Foreground'#7#6'clGray'#20'MouseActionsE' + +'xpanded'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'Clic' + +'kCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6 + +'Option'#2#0#8'Priority'#2#0#0#0#21'MouseActionsCollapsed'#14#1#5'Shift'#11#6 + +'ssCtrl'#0#9'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7 + +#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#15#9'MoveCaret'#8#6'Option'#2 + +#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7 + +#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#15 + +#9'MoveCaret'#8#6'Option'#2#1#8'Priority'#2#0#0#0#0#0#0#0#0 ]); diff --git a/Projects/SAMufasaGUI/framescript.pas b/Projects/SAMufasaGUI/framescript.pas index 16abd9c..e1e7f48 100644 --- a/Projects/SAMufasaGUI/framescript.pas +++ b/Projects/SAMufasaGUI/framescript.pas @@ -46,7 +46,6 @@ type TScriptFrame = class(TFrame) SynEdit: TSynEdit; - SynFreePascalSyn1: TSynFreePascalSyn; procedure SynEditChange(Sender: TObject); procedure SynEditClickLink(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); @@ -608,8 +607,8 @@ begin FScriptState:= ss_None; ScriptErrorLine:= -1; OwnerSheet.Caption:= ScriptName; - SynEdit.Options:= SynEdit.Options + [eoTabIndent] - [{eoGroupUndo,} eoSmartTabs]; - //SynEdit.Options:= SynEdit.Options + [eoTabIndent]; + SynEdit.Highlighter := Form1.CurrHighlighter; + SynEdit.Options:= SynEdit.Options + [eoTabIndent] - [eoSmartTabs]; SynEdit.IncrementColor.Background := $30D070; SynEdit.HighlightAllColor.Background:= clYellow; SynEdit.HighlightAllColor.Foreground:= clDefault; diff --git a/Projects/SAMufasaGUI/psextension.pas b/Projects/SAMufasaGUI/psextension.pas index 14fd367..9f24c6f 100644 --- a/Projects/SAMufasaGUI/psextension.pas +++ b/Projects/SAMufasaGUI/psextension.pas @@ -49,7 +49,7 @@ uses uPSC_extctrls,uPSC_menus, //Compile libs uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms, uPSR_extctrls,uPSR_menus, //Runtime-libs - testunit,updateform,settingssandbox,bitmaps//Writeln + testunit,updateform,settingssandbox,bitmaps,mmisc//Writeln ; function TSimbaPSExtension.HookExists(HookName: String): Boolean; @@ -116,8 +116,18 @@ end; procedure TSimbaPSExtension.RegisterMyMethods(Sender: TPSScript); begin + Sender.Comp.AddTypes('TStringArray','Array of String'); + Sender.Comp.AddConstantN('AppPath','string').SetString(MainDir + DirectorySeparator); + Sender.Comp.AddConstantN('IncludePath','string').SetString(Form1.IncludePath); + Sender.Comp.AddConstantN('PluginPath','string').SetString(Form1.PluginPath); + Sender.Comp.AddConstantN('FontPath','string').SetString(form1.FontPath); + Sender.Comp.AddConstantN('ExtPath','string').SetString(form1.ExtPath); Sender.AddFunction(@formWritelnEx,'procedure Writeln(s : string)'); - Sender.AddFunction(@ext_GetPage,'function GetPage(url : string) : string'); + Sender.AddFunction(@ext_GetPage,'function GetPage(const url : string) : string'); + Sender.AddFunction(@ext_DecompressBZip2,'function DecompressBZip2(const input: string;out output : string; const BlockSize: Cardinal): boolean;'); + Sender.AddFunction(@ext_UnTar,'function UnTar(const Input : string; out Content : TStringArray) : boolean;'); + Sender.AddFunction(@ext_UnTarEx,'function UnTarEx(const Input : string;const outputdir : string; overwrite : boolean): boolean;'); + Sender.AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox'); Sender.AddRegisteredVariable('Simba','TForm'); Sender.AddRegisteredVariable('Simba_MainMenu','TMainMenu'); diff --git a/Projects/SAMufasaGUI/testunit.lfm b/Projects/SAMufasaGUI/testunit.lfm index 720d54e..e358802 100644 --- a/Projects/SAMufasaGUI/testunit.lfm +++ b/Projects/SAMufasaGUI/testunit.lfm @@ -28,14 +28,14 @@ object Form1: TForm1 ShowHint = True TabOrder = 0 object TB_Run: TToolButton - Left = 168 + Left = 170 Hint = 'Run' Top = 2 Action = ActionRunScript ImageIndex = 6 end object TB_Pause: TToolButton - Left = 191 + Left = 193 Hint = 'Pause' Top = 2 Action = ActionPauseScript @@ -43,7 +43,7 @@ object Form1: TForm1 ImageIndex = 5 end object TB_Stop: TToolButton - Left = 214 + Left = 216 Hint = 'Stop' Top = 2 Action = ActionStopScript @@ -51,39 +51,39 @@ object Form1: TForm1 ImageIndex = 7 end object ToolButton1: TToolButton - Left = 237 + Left = 239 Top = 2 - Width = 3 + Width = 4 Caption = 'ToolButton1' Style = tbsDivider end object TB_NewTab: TToolButton - Left = 240 + Left = 243 Hint = 'Add tab' Top = 2 Action = ActionNewTab end object TB_CloseTab: TToolButton - Left = 263 + Left = 266 Hint = 'Close tab' Top = 2 Action = ActionCloseTab end object ToolButton4: TToolButton - Left = 286 + Left = 289 Top = 2 - Width = 3 + Width = 4 Caption = 'ToolButton4' Style = tbsDivider end object TB_ClearDebug: TToolButton - Left = 289 + Left = 293 Hint = 'Clear debug box' Top = 2 Action = ActionClearDebug end object TB_PickColour: TToolButton - Left = 312 + Left = 316 Hint = 'Pick a color' Top = 2 Caption = 'TB_PickColour' @@ -91,7 +91,7 @@ object Form1: TForm1 OnClick = ButtonPickClick end object TB_SelectClient: TToolButton - Left = 335 + Left = 339 Hint = 'Select a client' Top = 2 Caption = 'TB_SelectClient' @@ -99,14 +99,14 @@ object Form1: TForm1 OnMouseDown = ButtonSelectorDown end object ToolButton8: TToolButton - Left = 358 + Left = 362 Top = 2 - Width = 3 + Width = 4 Caption = 'ToolButton8' Style = tbsDivider end object TB_ReloadPlugins: TToolButton - Left = 361 + Left = 366 Hint = 'Reload plugins' Top = 2 Caption = 'TB_ReloadPlugins' @@ -114,7 +114,7 @@ object Form1: TForm1 ImageIndex = 13 end object TB_Tray: TToolButton - Left = 384 + Left = 389 Hint = 'Minimize to tray' Top = 2 Caption = 'TB_Tray' @@ -132,7 +132,7 @@ object Form1: TForm1 object ToolButton2: TToolButton Left = 93 Top = 2 - Width = 3 + Width = 4 Caption = 'ToolButton2' Style = tbsDivider end @@ -158,14 +158,14 @@ object Form1: TForm1 Enabled = False end object ToolButton3: TToolButton - Left = 430 + Left = 435 Top = 2 - Width = 3 + Width = 4 Caption = 'ToolButton3' Style = tbsDivider end object TT_Update: TToolButton - Left = 433 + Left = 439 Hint = 'A new update is available' Top = 2 Caption = 'TT_Update' @@ -173,33 +173,33 @@ object Form1: TForm1 OnClick = TT_UpdateClick end object TT_Cut: TToolButton - Left = 96 + Left = 97 Top = 2 Caption = 'Cu&t' ImageIndex = 3 OnClick = ActionCutExecute end object TT_Copy: TToolButton - Left = 119 + Left = 120 Top = 2 Caption = '&Copy' ImageIndex = 22 OnClick = ActionCopyExecute end object TT_Paste: TToolButton - Left = 142 + Left = 143 Top = 2 Action = ActionPaste end object ToolButton9: TToolButton - Left = 165 + Left = 166 Top = 2 - Width = 3 + Width = 4 Caption = 'ToolButton9' Style = tbsDivider end object TT_Console: TToolButton - Left = 407 + Left = 412 Hint = 'Hide/Show Console' Top = 2 Action = ActionConsole @@ -396,10 +396,10 @@ object Form1: TForm1 EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideRight.Control = LabeledEditSearch EditLabel.AnchorSideBottom.Control = LabeledEditSearch - EditLabel.Left = 71 - EditLabel.Height = 16 - EditLabel.Top = 8 - EditLabel.Width = 30 + EditLabel.Left = 73 + EditLabel.Height = 14 + EditLabel.Top = 9 + EditLabel.Width = 28 EditLabel.Caption = 'Find: ' EditLabel.ParentColor = False LabelPosition = lpLeft @@ -3085,4 +3085,30 @@ object Form1: TForm1 left = 488 top = 200 end + object LazHighlighter: TSynFreePascalSyn + Enabled = False + CommentAttri.Foreground = clBlue + CommentAttri.Style = [fsBold] + IdentifierAttri.Foreground = clDefault + NumberAttri.Foreground = clNavy + StringAttri.Foreground = clBlue + SymbolAttri.Foreground = clRed + DirectiveAttri.Foreground = clRed + DirectiveAttri.Style = [fsBold] + CompilerMode = pcmObjFPC + NestedComments = True + left = 528 + top = 200 + end + object SCARHighlighter: TSynFreePascalSyn + Enabled = False + CommentAttri.Foreground = clGreen + CommentAttri.Style = [] + NumberAttri.Foreground = clHotLight + StringAttri.Foreground = clFuchsia + CompilerMode = pcmObjFPC + NestedComments = True + left = 568 + top = 200 + end end diff --git a/Projects/SAMufasaGUI/testunit.lrs b/Projects/SAMufasaGUI/testunit.lrs index e60271b..1e11cb5 100644 --- a/Projects/SAMufasaGUI/testunit.lrs +++ b/Projects/SAMufasaGUI/testunit.lrs @@ -10,50 +10,50 @@ LazarusResources.Add('TForm1','FORMDATA',[ +'Visible'#9#0#8'TToolBar'#8'ToolBar1'#4'Left'#2#0#6'Height'#2#24#3'Top'#2#0#5 +'Width'#3#154#2#7'Caption'#6#8'ToolBar1'#6'Images'#7#17'Mufasa_Image_List'#14 +'ParentShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#0#0#11'TToolButton'#6'TB_Run' - +#4'Left'#3#168#0#4'Hint'#6#3'Run'#3'Top'#2#2#6'Action'#7#15'ActionRunScript' - +#10'ImageIndex'#2#6#0#0#11'TToolButton'#8'TB_Pause'#4'Left'#3#191#0#4'Hint'#6 + +#4'Left'#3#170#0#4'Hint'#6#3'Run'#3'Top'#2#2#6'Action'#7#15'ActionRunScript' + +#10'ImageIndex'#2#6#0#0#11'TToolButton'#8'TB_Pause'#4'Left'#3#193#0#4'Hint'#6 +#5'Pause'#3'Top'#2#2#6'Action'#7#17'ActionPauseScript'#7'Enabled'#8#10'Image' - +'Index'#2#5#0#0#11'TToolButton'#7'TB_Stop'#4'Left'#3#214#0#4'Hint'#6#4'Stop' + +'Index'#2#5#0#0#11'TToolButton'#7'TB_Stop'#4'Left'#3#216#0#4'Hint'#6#4'Stop' +#3'Top'#2#2#6'Action'#7#16'ActionStopScript'#7'Enabled'#8#10'ImageIndex'#2#7 - +#0#0#11'TToolButton'#11'ToolButton1'#4'Left'#3#237#0#3'Top'#2#2#5'Width'#2#3 + +#0#0#11'TToolButton'#11'ToolButton1'#4'Left'#3#239#0#3'Top'#2#2#5'Width'#2#4 +#7'Caption'#6#11'ToolButton1'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#9 - +'TB_NewTab'#4'Left'#3#240#0#4'Hint'#6#7'Add tab'#3'Top'#2#2#6'Action'#7#12'A' - +'ctionNewTab'#0#0#11'TToolButton'#11'TB_CloseTab'#4'Left'#3#7#1#4'Hint'#6#9 + +'TB_NewTab'#4'Left'#3#243#0#4'Hint'#6#7'Add tab'#3'Top'#2#2#6'Action'#7#12'A' + +'ctionNewTab'#0#0#11'TToolButton'#11'TB_CloseTab'#4'Left'#3#10#1#4'Hint'#6#9 +'Close tab'#3'Top'#2#2#6'Action'#7#14'ActionCloseTab'#0#0#11'TToolButton'#11 - +'ToolButton4'#4'Left'#3#30#1#3'Top'#2#2#5'Width'#2#3#7'Caption'#6#11'ToolBut' + +'ToolButton4'#4'Left'#3'!'#1#3'Top'#2#2#5'Width'#2#4#7'Caption'#6#11'ToolBut' +'ton4'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#13'TB_ClearDebug'#4'Lef' - +'t'#3'!'#1#4'Hint'#6#15'Clear debug box'#3'Top'#2#2#6'Action'#7#16'ActionCle' - +'arDebug'#0#0#11'TToolButton'#13'TB_PickColour'#4'Left'#3'8'#1#4'Hint'#6#12 + +'t'#3'%'#1#4'Hint'#6#15'Clear debug box'#3'Top'#2#2#6'Action'#7#16'ActionCle' + +'arDebug'#0#0#11'TToolButton'#13'TB_PickColour'#4'Left'#3'<'#1#4'Hint'#6#12 +'Pick a color'#3'Top'#2#2#7'Caption'#6#13'TB_PickColour'#10'ImageIndex'#2#0#7 +'OnClick'#7#15'ButtonPickClick'#0#0#11'TToolButton'#15'TB_SelectClient'#4'Le' - +'ft'#3'O'#1#4'Hint'#6#15'Select a client'#3'Top'#2#2#7'Caption'#6#15'TB_Sele' + +'ft'#3'S'#1#4'Hint'#6#15'Select a client'#3'Top'#2#2#7'Caption'#6#15'TB_Sele' +'ctClient'#10'ImageIndex'#2#2#11'OnMouseDown'#7#18'ButtonSelectorDown'#0#0#11 - +'TToolButton'#11'ToolButton8'#4'Left'#3'f'#1#3'Top'#2#2#5'Width'#2#3#7'Capti' + +'TToolButton'#11'ToolButton8'#4'Left'#3'j'#1#3'Top'#2#2#5'Width'#2#4#7'Capti' +'on'#6#11'ToolButton8'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#16'TB_R' - +'eloadPlugins'#4'Left'#3'i'#1#4'Hint'#6#14'Reload plugins'#3'Top'#2#2#7'Capt' + +'eloadPlugins'#4'Left'#3'n'#1#4'Hint'#6#14'Reload plugins'#3'Top'#2#2#7'Capt' +'ion'#6#16'TB_ReloadPlugins'#7'Enabled'#8#10'ImageIndex'#2#13#0#0#11'TToolBu' - +'tton'#7'TB_Tray'#4'Left'#3#128#1#4'Hint'#6#16'Minimize to tray'#3'Top'#2#2#7 + +'tton'#7'TB_Tray'#4'Left'#3#133#1#4'Hint'#6#16'Minimize to tray'#3'Top'#2#2#7 +'Caption'#6#7'TB_Tray'#10'ImageIndex'#2#17#7'OnClick'#7#15'ButtonTrayClick'#0 +#0#11'TToolButton'#6'TB_New'#4'Left'#2#1#4'Hint'#6#3'New'#3'Top'#2#2#6'Actio' +'n'#7#15'ActionNewScript'#14'ParentShowHint'#8#8'ShowHint'#9#0#0#11'TToolBut' - +'ton'#11'ToolButton2'#4'Left'#2']'#3'Top'#2#2#5'Width'#2#3#7'Caption'#6#11'T' + +'ton'#11'ToolButton2'#4'Left'#2']'#3'Top'#2#2#5'Width'#2#4#7'Caption'#6#11'T' +'oolButton2'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButton'#7'TB_Open'#4'Left' +#2#24#4'Hint'#6#4'Open'#3'Top'#2#2#6'Action'#7#16'ActionOpenScript'#14'Paren' +'tShowHint'#8#8'ShowHint'#9#0#0#11'TToolButton'#7'TB_Save'#4'Left'#2'/'#4'Hi' +'nt'#6#4'Save'#3'Top'#2#2#6'Action'#7#16'ActionSaveScript'#0#0#11'TToolButto' +'n'#10'TB_SaveAll'#4'Left'#2'F'#4'Hint'#6#8'Save all'#3'Top'#2#2#6'Action'#7 +#13'ActionSaveAll'#7'Enabled'#8#0#0#11'TToolButton'#11'ToolButton3'#4'Left'#3 - +#174#1#3'Top'#2#2#5'Width'#2#3#7'Caption'#6#11'ToolButton3'#5'Style'#7#10'tb' - +'sDivider'#0#0#11'TToolButton'#9'TT_Update'#4'Left'#3#177#1#4'Hint'#6#25'A n' + +#179#1#3'Top'#2#2#5'Width'#2#4#7'Caption'#6#11'ToolButton3'#5'Style'#7#10'tb' + +'sDivider'#0#0#11'TToolButton'#9'TT_Update'#4'Left'#3#183#1#4'Hint'#6#25'A n' +'ew update is available'#3'Top'#2#2#7'Caption'#6#9'TT_Update'#10'ImageIndex' +#2#1#7'OnClick'#7#14'TT_UpdateClick'#0#0#11'TToolButton'#6'TT_Cut'#4'Left'#2 - +'`'#3'Top'#2#2#7'Caption'#6#4'Cu&t'#10'ImageIndex'#2#3#7'OnClick'#7#16'Actio' - +'nCutExecute'#0#0#11'TToolButton'#7'TT_Copy'#4'Left'#2'w'#3'Top'#2#2#7'Capti' + +'a'#3'Top'#2#2#7'Caption'#6#4'Cu&t'#10'ImageIndex'#2#3#7'OnClick'#7#16'Actio' + +'nCutExecute'#0#0#11'TToolButton'#7'TT_Copy'#4'Left'#2'x'#3'Top'#2#2#7'Capti' +'on'#6#5'&Copy'#10'ImageIndex'#2#22#7'OnClick'#7#17'ActionCopyExecute'#0#0#11 - +'TToolButton'#8'TT_Paste'#4'Left'#3#142#0#3'Top'#2#2#6'Action'#7#11'ActionPa' - +'ste'#0#0#11'TToolButton'#11'ToolButton9'#4'Left'#3#165#0#3'Top'#2#2#5'Width' - +#2#3#7'Caption'#6#11'ToolButton9'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButt' - +'on'#10'TT_Console'#4'Left'#3#151#1#4'Hint'#6#17'Hide/Show Console'#3'Top'#2 + +'TToolButton'#8'TT_Paste'#4'Left'#3#143#0#3'Top'#2#2#6'Action'#7#11'ActionPa' + +'ste'#0#0#11'TToolButton'#11'ToolButton9'#4'Left'#3#166#0#3'Top'#2#2#5'Width' + +#2#4#7'Caption'#6#11'ToolButton9'#5'Style'#7#10'tbsDivider'#0#0#11'TToolButt' + +'on'#10'TT_Console'#4'Left'#3#156#1#4'Hint'#6#17'Hide/Show Console'#3'Top'#2 +#2#6'Action'#7#13'ActionConsole'#0#0#0#10'TStatusBar'#9'StatusBar'#4'Left'#2 +#0#6'Height'#2#23#3'Top'#3#2#2#5'Width'#3#154#2#6'Panels'#14#1#5'Width'#2'<' +#0#1#4'Text'#6#8'MouseBla'#5'Width'#2'd'#0#1#4'Text'#6#8'Untitled'#5'Width'#2 @@ -150,8 +150,8 @@ LazarusResources.Add('TForm1','FORMDATA',[ +#7#17'LabeledEditSearch'#31'EditLabel.AnchorSideTop.Control'#7#17'LabeledEdi' +'tSearch'#28'EditLabel.AnchorSideTop.Side'#7#9'asrCenter!EditLabel.AnchorSid' +'eRight.Control'#7#17'LabeledEditSearch"EditLabel.AnchorSideBottom.Control'#7 - +#17'LabeledEditSearch'#14'EditLabel.Left'#2'G'#16'EditLabel.Height'#2#16#13 - +'EditLabel.Top'#2#8#15'EditLabel.Width'#2#30#17'EditLabel.Caption'#6#6'Find:' + +#17'LabeledEditSearch'#14'EditLabel.Left'#2'I'#16'EditLabel.Height'#2#14#13 + +'EditLabel.Top'#2#9#15'EditLabel.Width'#2#28#17'EditLabel.Caption'#6#6'Find:' +' '#21'EditLabel.ParentColor'#8#13'LabelPosition'#7#6'lpLeft'#8'TabOrder'#2#0 +#8'OnChange'#7#16'EditSearchChange'#7'OnEnter'#7#22'LabeledEditSearchEnter'#6 +'OnExit'#7#21'LabeledEditSearchExit'#9'OnKeyDown'#7#24'LabeledEditSearchKeyD' @@ -3142,5 +3142,15 @@ LazarusResources.Add('TForm1','FORMDATA',[ +'UpdateTimer'#8'Interval'#3#16''''#4'left'#3'`'#2#3'top'#3#144#0#0#0#6'TTime' +'r'#10'MouseTimer'#8'Interval'#2'd'#7'OnTimer'#7#17'ChangeMouseStatus'#4'lef' +'t'#3#192#1#3'top'#3#200#0#0#0#6'TTimer'#9'NewsTimer'#8'Interval'#3#244#1#7 - +'OnTimer'#7#14'NewsTimerTimer'#4'left'#3#232#1#3'top'#3#200#0#0#0#0 + +'OnTimer'#7#14'NewsTimerTimer'#4'left'#3#232#1#3'top'#3#200#0#0#0#17'TSynFre' + +'ePascalSyn'#14'LazHighlighter'#7'Enabled'#8#23'CommentAttri.Foreground'#7#6 + +'clBlue'#18'CommentAttri.Style'#11#6'fsBold'#0#26'IdentifierAttri.Foreground' + +#7#9'clDefault'#22'NumberAttri.Foreground'#7#6'clNavy'#22'StringAttri.Foregr' + +'ound'#7#6'clBlue'#22'SymbolAttri.Foreground'#7#5'clRed'#25'DirectiveAttri.F' + +'oreground'#7#5'clRed'#20'DirectiveAttri.Style'#11#6'fsBold'#0#12'CompilerMo' + +'de'#7#9'pcmObjFPC'#14'NestedComments'#9#4'left'#3#16#2#3'top'#3#200#0#0#0#17 + +'TSynFreePascalSyn'#15'SCARHighlighter'#7'Enabled'#8#23'CommentAttri.Foregro' + +'und'#7#7'clGreen'#18'CommentAttri.Style'#11#0#22'NumberAttri.Foreground'#7 + +#10'clHotLight'#22'StringAttri.Foreground'#7#9'clFuchsia'#12'CompilerMode'#7 + +#9'pcmObjFPC'#14'NestedComments'#9#4'left'#3'8'#2#3'top'#3#200#0#0#0#0 ]); diff --git a/Projects/SAMufasaGUI/testunit.pas b/Projects/SAMufasaGUI/testunit.pas index eef3fa6..04ea1f7 100644 --- a/Projects/SAMufasaGUI/testunit.pas +++ b/Projects/SAMufasaGUI/testunit.pas @@ -96,6 +96,7 @@ type ActionTabNext: TAction; ActionList: TActionList; CheckBoxMatchCase: TCheckBox; + LazHighlighter: TSynFreePascalSyn; frmFunctionList: TFunctionListFrame; LabeledEditSearch: TLabeledEdit; MainMenu: TMainMenu; @@ -116,6 +117,7 @@ type MenuItemDivider9: TMenuItem; MouseTimer: TTimer; NewsTimer: TTimer; + SCARHighlighter: TSynFreePascalSyn; TT_Console: TToolButton; TT_Cut: TToolButton; TT_Copy: TToolButton; @@ -327,12 +329,18 @@ type SearchStart : TPoint; LastTab : integer; UpdatingFonts : boolean; + function GetExtPath: string; function GetFontPath: String; + function GetHighlighter: TSynCustomHighlighter; function GetIncludePath: String; + function GetPluginPath: string; function GetScriptState: TScriptState; function GetShowHintAuto: boolean; + function GetSimbaNews: String; + procedure SetExtPath(const AValue: string); procedure SetFontPath(const AValue: String); procedure SetIncludePath(const AValue: String); + procedure SetPluginPath(const AValue: string); procedure SetShowHintAuto(const AValue: boolean); procedure SetScriptState(const State: TScriptState); function LoadSettingDef(const Key, Def : string) : string; @@ -382,6 +390,7 @@ type procedure CreateDefaultEnvironment; procedure LoadFormSettings; procedure SaveFormSettings; + procedure LoadExtensions; procedure AddRecentFile(const filename : string); procedure InitalizeTMThread(var Thread : TMThread); procedure HandleParameters; @@ -389,6 +398,9 @@ type property ShowHintAuto : boolean read GetShowHintAuto write SetShowHintAuto; property IncludePath : String read GetIncludePath write SetIncludePath; property FontPath : String read GetFontPath write SetFontPath; + property PluginPath : string read GetPluginPath write SetPluginPath; + property ExtPath : string read GetExtPath write SetExtPath; + property CurrHighlighter : TSynCustomHighlighter read GetHighlighter; end; { TProcThread } @@ -996,12 +1008,16 @@ begin CreateSetting('Settings/MainForm/NormalSize','739:555'); CreateSetting('Settings/FunctionList/ShowOnStart','True'); CreateSetting('Settings/CodeHints/ShowAutomatically','True'); + CreateSetting('Settings/SourceEditor/LazColors','True'); + CreateSetting('Settings/Extensions/FileExtension','sex'); CreateSetting('Settings/Updater/RemoteLink',SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF}); CreateSetting('Settings/Updater/RemoteVersionLink',SimbaURL + 'Version'); CreateSetting('Settings/Fonts/VersionLink', FontURL + 'Version'); CreateSetting('Settings/Fonts/UpdateLink', FontURL + 'Fonts.tar.bz2'); + CreateSetting('Settings/News/URL', 'http://simba.villavu.com/bin/news'); + {Creates the paths and returns the path} PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS)); extensionsPath := CreateSetting('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS)); @@ -1027,41 +1043,6 @@ begin end; procedure TForm1.LoadFormSettings; -var - extCount : integer; - function LoadExtension(Number : integer) : boolean; - var - Path : string; - ExtPath : string; - ExtEnabled : boolean; - begin; - result := false; - if (number < 0) or (number >= extCount) then - exit; - path := 'Extensions/Extension' + inttostr(number); - if SettingExtists(Path) = false then - exit; - ExtPath := LoadSettingDef(Path + '/Path',''); - if ExtPath = '' then - exit; - ExtEnabled := StrToBoolDef(LoadSettingDef(Path + '/Enabled','false'),false); - if ExtManager.LoadPSExtension(ExtPath,ExtEnabled) = false then - exit; - Result := true; - end; - procedure DeleteExtension(number : integer); - var - i : integer; - path : string; - begin; - path := 'Extensions/Extension'; - SettingsForm.Settings.DeleteKey(path + inttostr(number)); - for i := number + 1 to extCount - 1 do - SettingsForm.Settings.RenameKey(path + inttostr(i),'Extension' + inttostr(i-1)); - SetSetting('Extensions/ExtensionCount',inttostr(extCount - 1),true); - dec(extCount); - end; - var str,str2 : string; Data : TStringArray; @@ -1105,14 +1086,6 @@ begin else ShowConsole(false); {$endif} - extCount := StrToIntDef(LoadSettingDef('Extensions/ExtensionCount/','0'),0); - for i := 0 to extCount - 1 do - while (i < extCount) and not LoadExtension(i) do - DeleteExtension(i); - SetSetting('Extensions/ExtensionCount',inttostr(extCount)); - str := LoadSettingDef('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS)); - str2 := LoadSettingDef('Settings/Extensions/FileExtension','sex'); - ExtManager.LoadPSExtensionsDir(str,str2); end; procedure TForm1.SaveFormSettings; @@ -1161,6 +1134,56 @@ begin end; end; +procedure TForm1.LoadExtensions; +var + extCount : integer; + function LoadExtension(Number : integer) : boolean; + var + Path : string; + ExtPath : string; + ExtEnabled : boolean; + begin; + result := false; + if (number < 0) or (number >= extCount) then + exit; + path := 'Extensions/Extension' + inttostr(number); + if SettingExtists(Path) = false then + exit; + ExtPath := LoadSettingDef(Path + '/Path',''); + if ExtPath = '' then + exit; + ExtEnabled := StrToBoolDef(LoadSettingDef(Path + '/Enabled','false'),false); + if ExtManager.LoadPSExtension(ExtPath,ExtEnabled) = false then + exit; + Result := true; + end; + procedure DeleteExtension(number : integer); + var + i : integer; + path : string; + begin; + path := 'Extensions/Extension'; + SettingsForm.Settings.DeleteKey(path + inttostr(number)); + for i := number + 1 to extCount - 1 do + SettingsForm.Settings.RenameKey(path + inttostr(i),'Extension' + inttostr(i-1)); + SetSetting('Extensions/ExtensionCount',inttostr(extCount - 1),true); + dec(extCount); + end; + +var + str,str2 : string; + i : integer; +begin + extCount := StrToIntDef(LoadSettingDef('Extensions/ExtensionCount/','0'),0); + for i := 0 to extCount - 1 do + while (i < extCount) and not LoadExtension(i) do + DeleteExtension(i); + SetSetting('Extensions/ExtensionCount',inttostr(extCount)); + str := LoadSettingDef('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS)); + str2 := LoadSettingDef('Settings/Extensions/FileExtension','sex'); + ExtManager.LoadPSExtensionsDir(str,str2); +end; + procedure TForm1.AddRecentFile(const filename: string); var MaxRecentFiles : integer; @@ -1189,22 +1212,20 @@ procedure TForm1.InitalizeTMThread(var Thread: TMThread); var DbgImgInfo : TDbgImgInfo; AppPath : string; - pluginspath: string; ScriptPath : string; UseCPascal: String; Se: TMMLSettingsSandbox; loadFontsOnScriptStart: boolean; begin AppPath:= MainDir + DS; - PluginsPath := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS))); CurrScript.ScriptErrorLine:= -1; CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread; UseCPascal := LoadSettingDef('Settings/Interpreter/UseCPascal', 'False'); try if lowercase(UseCPascal) = 'true' then - Thread := TCPThread.Create(True,@CurrentSyncInfo,PluginsPath) + Thread := TCPThread.Create(True,@CurrentSyncInfo,PluginPath) else - Thread := TPSThread.Create(True,@CurrentSyncInfo,PluginsPath); + Thread := TPSThread.Create(True,@CurrentSyncInfo,PluginPath); except mDebugLn('Failed to initialise the library!'); Exit; @@ -1227,15 +1248,15 @@ begin if CurrScript.ScriptFile <> '' then ScriptPath := IncludeTrailingPathDelimiter(ExtractFileDir(CurrScript.ScriptFile)); - if DirectoryExists(PluginsPath) then - PluginsGlob.AddPath(PluginsPath); + if DirectoryExists(PluginPath) then + PluginsGlob.AddPath(PluginPath); if not DirectoryExists(IncludePath) then if FirstRun then FormWritelnEx('Warning: The include directory specified in the Settings isn''t valid.'); if not DirectoryExists(fontPath) then if FirstRun then FormWritelnEx('Warning: The font directory specified in the Settings isn''t valid. Can''t load fonts now'); - Thread.SetPaths(ScriptPath,AppPath,Includepath,PluginsPath,fontPath); + Thread.SetPaths(ScriptPath,AppPath,Includepath,PluginPath,fontPath); if selector.haspicked then Thread.Client.IOManager.SetTarget(Selector.LastPick); @@ -1924,6 +1945,8 @@ begin //Fill the codeinsight buffer FillThread.Resume; + //Load the extensions + LoadExtensions; end; procedure TForm1.FormDestroy(Sender: TObject); @@ -2029,7 +2052,7 @@ var SynExporterHTML : TSynExporterHTML; begin; SynExporterHTML := TSynExporterHTML.Create(nil); - SynExporterHTML.Highlighter := CurrScript.SynFreePascalSyn1; + SynExporterHTML.Highlighter := CurrHighlighter; SynExporterHTML.ExportAsText:= True; with TSaveDialog.Create(nil) do try @@ -2175,12 +2198,12 @@ begin FunctionListShown(not MenuItemFunctionList.Checked); end; -function GetSimbaNews: String; +function TForm1.GetSimbaNews: String; var t: TDownloadThread; begin t := TDownloadThread.Create(true); - t.InputURL:='http://simba.villavu.com/bin/news'; + t.InputURL:=LoadSettingDef('Settings/News/URL', 'http://simba.villavu.com/bin/news'); t.Resume; while not t.done do begin @@ -2190,6 +2213,11 @@ begin Exit(t.ResultStr); end; +procedure TForm1.SetExtPath(const AValue: string); +begin + SetSetting('Settings/Extensions/Path',AValue,true); +end; + procedure TForm1.NewsTimerTimer(Sender: TObject); var s: String; @@ -2343,16 +2371,39 @@ begin Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Fonts/Path', ExpandFileName(MainDir+DS+'Fonts' + DS))); end; +function TForm1.GetExtPath: string; +begin + result :=IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Extensions/Path', ExpandFileName(MainDir+DS+'Extensions' + DS))); +end; + +function TForm1.GetHighlighter: TSynCustomHighlighter; +begin + if lowercase(LoadSettingDef('Settings/SourceEditor/LazColors','True')) = 'true' then + result := LazHighlighter + else + result := SCARHighlighter; +end; + function TForm1.GetIncludePath: String; begin Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS))); end; +function TForm1.GetPluginPath: string; +begin + Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+DS+'Plugins' + DS))); +end; + procedure TForm1.SetIncludePath(const AValue: String); begin SetSetting('Settings/Includes/Path',AValue,true); end; +procedure TForm1.SetPluginPath(const AValue: string); +begin + SetSetting('Settings/Plugins/Path',AValue,true); +end; + procedure TForm1.SetScriptState(const State: TScriptState); begin CurrScript.FScriptState:= State; @@ -2545,7 +2596,8 @@ begin Exit; with TOpenDialog.Create(nil) do try - Filter:= 'Simba Files|*.simb;*.cogat;*.mufa;*.txt|Any files|*.*'; + Filter:= 'Simba Files|*.simba;*.simb;*.cogat;*.mufa;*.txt;*.' +LoadSettingDef('Settings/Extensions/FileExtension','sex')+ + '|Any files|*.*'; if Execute then if FileExists(filename) then result := LoadScriptFile(filename); @@ -2626,12 +2678,14 @@ begin Result := false; with TSaveDialog.Create(nil) do try - Filter:= 'Simba files|*.simb;*.cogat;*.mufa;*.pas;*.txt|Any Files|*.*'; + filter := 'Simba Files|*.simba;*.simb;*.cogat;*.mufa;*.txt;*.' + + LoadSettingDef('Settings/Extensions/FileExtension','sex')+ + '|Any files|*.*'; if Execute then begin; if ExtractFileExt(FileName) = '' then begin; - ScriptFile := FileName + '.simb'; + ScriptFile := FileName + '.simba'; end else ScriptFile := FileName; CurrScript.SynEdit.Lines.SaveToFile(ScriptFile); diff --git a/Units/MMLAddon/PSInc/Wrappers/extensions.inc b/Units/MMLAddon/PSInc/Wrappers/extensions.inc index cad4cfa..a38b9ef 100644 --- a/Units/MMLAddon/PSInc/Wrappers/extensions.inc +++ b/Units/MMLAddon/PSInc/Wrappers/extensions.inc @@ -21,18 +21,74 @@ extensions.inc for the Mufasa Macro Library } +type + TStringArray = array of string; +function ext_UnTar(const Input : string; out Content : TStringArray) : boolean; +var + Stream : TStringStream; +begin + result := false; + try + Stream := TStringStream.Create(Input); + content := UnTar(Stream); + result := (length(content) > 0); + finally + stream.free; + end; +end; -function ext_GetPage(url : string) : string; +function ext_UnTarEx(const Input : string;const outputdir : string; overwrite : boolean): boolean; +var + Stream : TStringStream; + MS : TMemoryStream; +begin + result := false; + try + Stream := TStringStream.Create(Input); + result := UnTar(stream,outputdir,overwrite); + finally + stream.free; + end; +end; +function ext_DecompressBZip2(const input: string;out output : string; const BlockSize: Cardinal): boolean; +var + Stream : TStringStream; + MS : TMemoryStream; +begin + result := false; + try + Stream := TStringStream.Create(Input); + ms := DecompressBZip2(Stream,blocksize); + if ms.size > 0 then + begin + ms.Position:= 0; + SetLength(output,ms.Size); + MS.Read(output[1],MS.size); + ms.free; + result := true; + end; + finally + stream.free; + end; +end; + +function ext_GetPage(const url : string) : string; var t: TDownloadThread; begin - t := TDownloadThread.Create(true); - t.InputURL:='url'; - t.Resume; - while not t.done do - begin - Application.ProcessMessages; - Sleep(25); + result := ''; + try + t := TDownloadThread.Create(true); + t.InputURL:=url; + t.Resume; + while not t.done do + begin + Application.ProcessMessages; + Sleep(25); + end; + Exit(t.ResultStr); + except + on e : exception do + mDebugLn('Exception in GetPage in Extensions: ' + e.message); end; - Exit(t.ResultStr); end;