1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-11 03:45:06 -05:00

Added tabs... TEST THIS OUT!

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@163 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2009-10-31 21:44:13 +00:00
parent 7e06e85bee
commit 8755708b3a
8 changed files with 3287 additions and 2755 deletions

View File

@ -0,0 +1,726 @@
object ScriptFrame: TScriptFrame
Left = 0
Height = 300
Top = 0
Width = 400
ClientHeight = 300
ClientWidth = 400
TabOrder = 0
DesignLeft = 775
DesignTop = 204
object SynEdit: TSynEdit
Left = 0
Height = 300
Top = 0
Width = 400
Align = alClient
Font.Height = -13
Font.Name = 'Courier New'
Font.Pitch = fpFixed
Font.Quality = fqNonAntialiased
ParentColor = False
ParentFont = False
TabOrder = 0
BookMarkOptions.OnChange = nil
Gutter.Width = 57
Gutter.MouseActions = <
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 13
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbRight
ClickCount = ccSingle
ClickDir = cdUp
Command = 12
MoveCaret = False
Option = 0
Priority = 0
end>
Highlighter = SynFreePascalSyn1
Keystrokes = <
item
Command = ecUp
ShortCut = 38
end
item
Command = ecSelUp
ShortCut = 8230
end
item
Command = ecScrollUp
ShortCut = 16422
end
item
Command = ecDown
ShortCut = 40
end
item
Command = ecSelDown
ShortCut = 8232
end
item
Command = ecScrollDown
ShortCut = 16424
end
item
Command = ecLeft
ShortCut = 37
end
item
Command = ecSelLeft
ShortCut = 8229
end
item
Command = ecWordLeft
ShortCut = 16421
end
item
Command = ecSelWordLeft
ShortCut = 24613
end
item
Command = ecRight
ShortCut = 39
end
item
Command = ecSelRight
ShortCut = 8231
end
item
Command = ecWordRight
ShortCut = 16423
end
item
Command = ecSelWordRight
ShortCut = 24615
end
item
Command = ecPageDown
ShortCut = 34
end
item
Command = ecSelPageDown
ShortCut = 8226
end
item
Command = ecPageBottom
ShortCut = 16418
end
item
Command = ecSelPageBottom
ShortCut = 24610
end
item
Command = ecPageUp
ShortCut = 33
end
item
Command = ecSelPageUp
ShortCut = 8225
end
item
Command = ecPageTop
ShortCut = 16417
end
item
Command = ecSelPageTop
ShortCut = 24609
end
item
Command = ecLineStart
ShortCut = 36
end
item
Command = ecSelLineStart
ShortCut = 8228
end
item
Command = ecEditorTop
ShortCut = 16420
end
item
Command = ecSelEditorTop
ShortCut = 24612
end
item
Command = ecLineEnd
ShortCut = 35
end
item
Command = ecSelLineEnd
ShortCut = 8227
end
item
Command = ecEditorBottom
ShortCut = 16419
end
item
Command = ecSelEditorBottom
ShortCut = 24611
end
item
Command = ecToggleMode
ShortCut = 45
end
item
Command = ecCopy
ShortCut = 16429
end
item
Command = ecPaste
ShortCut = 8237
end
item
Command = ecDeleteChar
ShortCut = 46
end
item
Command = ecCut
ShortCut = 8238
end
item
Command = ecDeleteLastChar
ShortCut = 8
end
item
Command = ecDeleteLastChar
ShortCut = 8200
end
item
Command = ecDeleteLastWord
ShortCut = 16392
end
item
Command = ecUndo
ShortCut = 32776
end
item
Command = ecRedo
ShortCut = 40968
end
item
Command = ecLineBreak
ShortCut = 13
end
item
Command = ecSelectAll
ShortCut = 16449
end
item
Command = ecCopy
ShortCut = 16451
end
item
Command = ecBlockIndent
ShortCut = 24649
end
item
Command = ecLineBreak
ShortCut = 16461
end
item
Command = ecInsertLine
ShortCut = 16462
end
item
Command = ecDeleteWord
ShortCut = 16468
end
item
Command = ecBlockUnindent
ShortCut = 24661
end
item
Command = ecPaste
ShortCut = 16470
end
item
Command = ecCut
ShortCut = 16472
end
item
Command = ecDeleteLine
ShortCut = 16473
end
item
Command = ecDeleteEOL
ShortCut = 24665
end
item
Command = ecUndo
ShortCut = 16474
end
item
Command = ecRedo
ShortCut = 24666
end
item
Command = ecGotoMarker0
ShortCut = 16432
end
item
Command = ecGotoMarker1
ShortCut = 16433
end
item
Command = ecGotoMarker2
ShortCut = 16434
end
item
Command = ecGotoMarker3
ShortCut = 16435
end
item
Command = ecGotoMarker4
ShortCut = 16436
end
item
Command = ecGotoMarker5
ShortCut = 16437
end
item
Command = ecGotoMarker6
ShortCut = 16438
end
item
Command = ecGotoMarker7
ShortCut = 16439
end
item
Command = ecGotoMarker8
ShortCut = 16440
end
item
Command = ecGotoMarker9
ShortCut = 16441
end
item
Command = ecSetMarker0
ShortCut = 24624
end
item
Command = ecSetMarker1
ShortCut = 24625
end
item
Command = ecSetMarker2
ShortCut = 24626
end
item
Command = ecSetMarker3
ShortCut = 24627
end
item
Command = ecSetMarker4
ShortCut = 24628
end
item
Command = ecSetMarker5
ShortCut = 24629
end
item
Command = ecSetMarker6
ShortCut = 24630
end
item
Command = ecSetMarker7
ShortCut = 24631
end
item
Command = ecSetMarker8
ShortCut = 24632
end
item
Command = ecSetMarker9
ShortCut = 24633
end
item
Command = EcFoldLevel1
ShortCut = 41009
end
item
Command = EcFoldLevel2
ShortCut = 41010
end
item
Command = EcFoldLevel1
ShortCut = 41011
end
item
Command = EcFoldLevel1
ShortCut = 41012
end
item
Command = EcFoldLevel1
ShortCut = 41013
end
item
Command = EcFoldLevel6
ShortCut = 41014
end
item
Command = EcFoldLevel7
ShortCut = 41015
end
item
Command = EcFoldLevel8
ShortCut = 41016
end
item
Command = EcFoldLevel9
ShortCut = 41017
end
item
Command = EcFoldLevel0
ShortCut = 41008
end
item
Command = EcFoldCurrent
ShortCut = 41005
end
item
Command = EcUnFoldCurrent
ShortCut = 41003
end
item
Command = EcToggleMarkupWord
ShortCut = 32845
end
item
Command = ecNormalSelect
ShortCut = 24654
end
item
Command = ecColumnSelect
ShortCut = 24643
end
item
Command = ecLineSelect
ShortCut = 24652
end
item
Command = ecTab
ShortCut = 9
end
item
Command = ecShiftTab
ShortCut = 8201
end
item
Command = ecMatchBracket
ShortCut = 24642
end
item
Command = ecColSelUp
ShortCut = 40998
end
item
Command = ecColSelDown
ShortCut = 41000
end
item
Command = ecColSelLeft
ShortCut = 40997
end
item
Command = ecColSelRight
ShortCut = 40999
end
item
Command = ecColSelPageDown
ShortCut = 40994
end
item
Command = ecColSelPageBottom
ShortCut = 57378
end
item
Command = ecColSelPageUp
ShortCut = 40993
end
item
Command = ecColSelPageTop
ShortCut = 57377
end
item
Command = ecColSelLineStart
ShortCut = 40996
end
item
Command = ecColSelLineEnd
ShortCut = 40995
end
item
Command = ecColSelEditorTop
ShortCut = 57380
end
item
Command = ecColSelEditorBottom
ShortCut = 57379
end>
MouseActions = <
item
Shift = []
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 1
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = [ssShift]
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 1
MoveCaret = True
Option = 1
Priority = 0
end
item
Shift = [ssAlt]
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 3
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = [ssShift, ssAlt]
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 3
MoveCaret = True
Option = 1
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbRight
ClickCount = ccSingle
ClickDir = cdUp
Command = 12
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccDouble
ClickDir = cdDown
Command = 6
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccTriple
ClickDir = cdDown
Command = 7
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccQuad
ClickDir = cdDown
Command = 8
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbMiddle
ClickCount = ccSingle
ClickDir = cdDown
Command = 10
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = [ssCtrl]
ShiftMask = [ssShift, ssAlt, ssCtrl]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdUp
Command = 11
MoveCaret = False
Option = 0
Priority = 0
end>
MouseSelActions = <
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 9
MoveCaret = False
Option = 0
Priority = 0
end>
Lines.Strings = (
'program new;'
'begin'
'end.'
)
BracketHighlightStyle = sbhsBoth
OnChange = SynEditChange
OnProcessCommand = SynEditProcessCommand
OnSpecialLineColors = SynEditSpecialLineColors
object TSynGutterPartList
object TSynGutterMarks
Width = 23
end
object TSynGutterLineNumber
Width = 17
MouseActions = <>
MarkupInfo.Background = clBtnFace
MarkupInfo.Foreground = clNone
DigitCount = 2
ShowOnlyLineNumbersMultiplesOf = 1
ZeroStart = False
LeadingZeros = False
end
object TSynGutterChanges
Width = 4
ModifiedColor = 59900
SavedColor = clGreen
end
object TSynGutterSeparator
Width = 2
end
object TSynGutterCodeFolding
MouseActions = <
item
Shift = []
ShiftMask = []
Button = mbRight
ClickCount = ccSingle
ClickDir = cdUp
Command = 16
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = [ssShift]
Button = mbMiddle
ClickCount = ccAny
ClickDir = cdDown
Command = 14
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = [ssShift]
ShiftMask = [ssShift]
Button = mbMiddle
ClickCount = ccAny
ClickDir = cdDown
Command = 14
MoveCaret = False
Option = 1
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 0
MoveCaret = False
Option = 0
Priority = 0
end>
MarkupInfo.Background = clNone
MarkupInfo.Foreground = clGray
MouseActionsExpanded = <
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 14
MoveCaret = False
Option = 0
Priority = 0
end>
MouseActionsCollapsed = <
item
Shift = [ssCtrl]
ShiftMask = [ssCtrl]
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 15
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = [ssCtrl]
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 15
MoveCaret = False
Option = 1
Priority = 0
end>
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

View File

@ -0,0 +1,151 @@
LazarusResources.Add('TScriptFrame','FORMDATA',[
'TPF0'#12'TScriptFrame'#11'ScriptFrame'#4'Left'#2#0#6'Height'#3','#1#3'Top'#2
+#0#5'Width'#3#144#1#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#8'TabOrd'
+'er'#2#0#10'DesignLeft'#3#7#3#9'DesignTop'#3#204#0#0#8'TSynEdit'#7'SynEdit'#4
+'Left'#2#0#6'Height'#3','#1#3'Top'#2#0#5'Width'#3#144#1#5'Align'#7#8'alClien'
+'t'#11'Font.Height'#2#243#9'Font.Name'#6#11'Courier New'#10'Font.Pitch'#7#7
+'fpFixed'#12'Font.Quality'#7#16'fqNonAntialiased'#11'ParentColor'#8#10'Paren'
+'tFont'#8#8'TabOrder'#2#0#24'BookMarkOptions.OnChange'#13#12'Gutter.Width'#2
+'9'#19'Gutter.MouseActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7
+#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#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'ClickDir'#7#4'cd'
+'Up'#7'Command'#2#12#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#11'Hig'
+'hlighter'#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'ShortCut'#2
+'('#0#1#7'Command'#7#9'ecSelDown'#8'ShortCut'#3'( '#0#1#7'Command'#7#12'ecSc'
+'rollDown'#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'ecWordLeft'
+#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'ecSelRight'#8'S'
+'hortCut'#3''' '#0#1#7'Command'#7#11'ecWordRight'#8'ShortCut'#3'''@'#0#1#7'C'
+'ommand'#7#14'ecSelWordRight'#8'ShortCut'#3'''`'#0#1#7'Command'#7#10'ecPageD'
+'own'#8'ShortCut'#2'"'#0#1#7'Command'#7#13'ecSelPageDown'#8'ShortCut'#3'" '#0
+#1#7'Command'#7#12'ecPageBottom'#8'ShortCut'#3'"@'#0#1#7'Command'#7#15'ecSel'
+'PageBottom'#8'ShortCut'#3'"`'#0#1#7'Command'#7#8'ecPageUp'#8'ShortCut'#2'!'
+#0#1#7'Command'#7#11'ecSelPageUp'#8'ShortCut'#3'! '#0#1#7'Command'#7#9'ecPag'
+'eTop'#8'ShortCut'#3'!@'#0#1#7'Command'#7#12'ecSelPageTop'#8'ShortCut'#3'!`'
+#0#1#7'Command'#7#11'ecLineStart'#8'ShortCut'#2'$'#0#1#7'Command'#7#14'ecSel'
+'LineStart'#8'ShortCut'#3'$ '#0#1#7'Command'#7#11'ecEditorTop'#8'ShortCut'#3
+'$@'#0#1#7'Command'#7#14'ecSelEditorTop'#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'ecEditorBottom'#8'ShortCut'#3'#@'#0#1#7'Command'#7
+#17'ecSelEditorBottom'#8'ShortCut'#3'#`'#0#1#7'Command'#7#12'ecToggleMode'#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'ecDelete'
+'LastChar'#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'Comma'
+'nd'#7#6'ecUndo'#8'ShortCut'#4#8#128#0#0#0#1#7'Command'#7#6'ecRedo'#8'ShortC'
+'ut'#4#8#160#0#0#0#1#7'Command'#7#11'ecLineBreak'#8'ShortCut'#2#13#0#1#7'Com'
+'mand'#7#11'ecSelectAll'#8'ShortCut'#3'A@'#0#1#7'Command'#7#6'ecCopy'#8'Shor'
+'tCut'#3'C@'#0#1#7'Command'#7#13'ecBlockIndent'#8'ShortCut'#3'I`'#0#1#7'Comm'
+'and'#7#11'ecLineBreak'#8'ShortCut'#3'M@'#0#1#7'Command'#7#12'ecInsertLine'#8
+'ShortCut'#3'N@'#0#1#7'Command'#7#12'ecDeleteWord'#8'ShortCut'#3'T@'#0#1#7'C'
+'ommand'#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'ShortCut'#3'X@'#0#1#7'Command'
+#7#12'ecDeleteLine'#8'ShortCut'#3'Y@'#0#1#7'Command'#7#11'ecDeleteEOL'#8'Sho'
+'rtCut'#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'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'Short'
+'Cut'#3'3@'#0#1#7'Command'#7#13'ecGotoMarker4'#8'ShortCut'#3'4@'#0#1#7'Comma'
+'nd'#7#13'ecGotoMarker5'#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'ecGotoMa'
+'rker9'#8'ShortCut'#3'9@'#0#1#7'Command'#7#12'ecSetMarker0'#8'ShortCut'#3'0`'
+#0#1#7'Command'#7#12'ecSetMarker1'#8'ShortCut'#3'1`'#0#1#7'Command'#7#12'ecS'
+'etMarker2'#8'ShortCut'#3'2`'#0#1#7'Command'#7#12'ecSetMarker3'#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'ShortCu'
+'t'#3'6`'#0#1#7'Command'#7#12'ecSetMarker7'#8'ShortCut'#3'7`'#0#1#7'Command'
+#7#12'ecSetMarker8'#8'ShortCut'#3'8`'#0#1#7'Command'#7#12'ecSetMarker9'#8'Sh'
+'ortCut'#3'9`'#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut'#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'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'Co'
+'mmand'#7#12'EcFoldLevel7'#8'ShortCut'#4'7'#160#0#0#0#1#7'Command'#7#12'EcFo'
+'ldLevel8'#8'ShortCut'#4'8'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel9'#8'Shor'
+'tCut'#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'EcToggle'
+'MarkupWord'#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'S'
+'hortCut'#2#9#0#1#7'Command'#7#10'ecShiftTab'#8'ShortCut'#3#9' '#0#1#7'Comma'
+'nd'#7#14'ecMatchBracket'#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'Co'
+'mmand'#7#13'ecColSelRight'#8'ShortCut'#4''''#160#0#0#0#1#7'Command'#7#16'ec'
+'ColSelPageDown'#8'ShortCut'#4'"'#160#0#0#0#1#7'Command'#7#18'ecColSelPageBo'
+'ttom'#8'ShortCut'#4'"'#224#0#0#0#1#7'Command'#7#14'ecColSelPageUp'#8'ShortC'
+'ut'#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'Com'
+'mand'#7#15'ecColSelLineEnd'#8'ShortCut'#4'#'#160#0#0#0#1#7'Command'#7#17'ec'
+'ColSelEditorTop'#8'ShortCut'#4'$'#224#0#0#0#1#7'Command'#7#20'ecColSelEdito'
+'rBottom'#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'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'S'
+'hift'#11#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#0#8'Priority'#2#0#0#1#5'Shift'#11#7'ssShift'#5'ssA'
+'lt'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickC'
+'ount'#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'ShiftMa'
+'sk'#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'S'
+'hift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccTri'
+'ple'#8'ClickDir'#7#6'cdDown'#7'Command'#2#7#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#6'ccQuad'#8'ClickDir'#7#6'cdDown'#7'Command'#2#8#9'MoveCaret'
+#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Butto'
+'n'#7#8'mbMiddle'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Com'
+'mand'#2#10#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#6's'
+'sCtrl'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#6'ssCtrl'#0#6'Button'#7#6'mbLe'
+'ft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#11#9'Mo'
+'veCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#15'MouseSelActions'#14#1#5'Shi'
+'ft'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingl'
+'e'#8'ClickDir'#7#6'cdDown'#7'Command'#2#9#9'MoveCaret'#8#6'Option'#2#0#8'Pr'
+'iority'#2#0#0#0#13'Lines.Strings'#1#6#12'program new;'#6#5'begin'#6#4'end.'
+#0#21'BracketHighlightStyle'#7#8'sbhsBoth'#8'OnChange'#7#13'SynEditChange'#16
+'OnProcessCommand'#7#21'SynEditProcessCommand'#19'OnSpecialLineColors'#7#24
+'SynEditSpecialLineColors'#0#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
]);

View File

@ -0,0 +1,169 @@
unit framescript;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, SynHighlighterPas, SynEdit, mmlpsthread,ComCtrls, SynEditKeyCmds, LCLType, SynEditMarkupSpecialLine, Graphics;
type
TScriptState = (ss_None,ss_Running,ss_Paused,ss_Stopping);
{
ss_None: Means the script either hasn't been run yet, or it has ended (Succesfully or terminated)
ss_Running: Means the script is running as we speak :-)
ss_Paused: Means the script is currently in pause modus.
ss_Stopping: Means we've asked PS-Script politely to stop the script (next time we press the stop button we won't be that nice).
}
{ TScriptFrame }
TScriptFrame = class(TFrame)
SynEdit: TSynEdit;
SynFreePascalSyn1: TSynFreePascalSyn;
procedure SynEditChange(Sender: TObject);
procedure SynEditProcessCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
procedure SynEditSpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
private
OwnerPage : TPageControl;
OwnerSheet : TTabSheet;//The owner TTabsheet -> For title setting
public
ScriptErrorLine : integer; //Highlight the error line!
ScriptFile : string;//The path to the saved/opened file currently in the SynEdit
StartText : string;//The text synedit holds upon start/open/save
ScriptName : string;//The name of the currently opened/saved file.
ScriptDefault : string;//The default script e.g. program new; begin end.
ScriptChanged : boolean;//We need this for that little * (edited star).
ScriptThread : TMMLPSThread;//Just one thread for now..
FScriptState : TScriptState;//Stores the ScriptState, if you want the Run/Pause/Start buttons to change accordingly, acces through Form1
procedure undo;
procedure redo;
procedure ErrorThread(ErrorAtLine,ErrorPosition : integer; ErrorStr : string; ErrorType : TErrorType);
procedure MakeActiveScriptFrame;
procedure ScriptThreadTerminate(Sender: TObject);
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
{ public declarations }
end;
implementation
uses
TestUnit;
{ TScriptFrame }
procedure TScriptFrame.SynEditChange(Sender: TObject);
begin
ScriptErrorLine:= -1;
if not ScriptChanged then
begin;
ScriptChanged:= True;
Form1.Caption:= Format(WindowTitle,[ScriptName + '*']);
OwnerSheet.Caption:=ScriptName + '*';
end;
end;
procedure TScriptFrame.SynEditProcessCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
begin
if Command = ecUndo then
begin;
Command:= ecNone;
Self.Undo;
end else
if Command = ecRedo then
begin;
Command := ecNone;
Self.Redo;
end;
end;
procedure TScriptFrame.SynEditSpecialLineColors(Sender: TObject;
Line: integer; var Special: boolean; var FG, BG: TColor);
begin
if line = ScriptErrorLine then
begin;
Special := true;
BG := $50a0ff;
FG := 0;
end;
end;
procedure TScriptFrame.undo;
begin
SynEdit.Undo;
if ScriptChanged then
if SynEdit.Lines.Text = StartText then
begin;
Form1.Caption:= format(WindowTitle,[ScriptName]);
OwnerSheet.Caption:= ScriptName;
ScriptChanged := false;
end;
end;
procedure TScriptFrame.redo;
begin
SynEdit.Redo;
if ScriptChanged then
if SynEdit.Lines.Text = StartText then
begin;
Form1.Caption:= format(WindowTitle,[ScriptName]);
OwnerSheet.Caption := ScriptName;
ScriptChanged := false;
end;
end;
procedure TScriptFrame.ErrorThread(ErrorAtLine, ErrorPosition: integer;
ErrorStr: string; ErrorType: TErrorType);
begin
MakeActiveScriptFrame;
ScriptErrorLine:= ErrorAtLine;
SynEdit.SelStart:= ErrorPosition;
Writeln(Format('Error: %s at line %d',[errorstr,erroratline]));
SynEdit.Invalidate;
end;
procedure TScriptFrame.MakeActiveScriptFrame;
var
i : integer;
begin
for i := 0 to OwnerPage.PageCount - 1 do
if OwnerPage.Pages[i] = OwnerSheet then
begin;
OwnerPage.TabIndex := i;
exit;
end;
end;
procedure TScriptFrame.ScriptThreadTerminate(Sender: TObject);
begin
FScriptState:= ss_None;
Form1.RefreshTab;
end;
constructor TScriptFrame.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
OwnerSheet := TTabSheet(TheOwner);
OwnerPage := TPageControl(OwnerSheet.Owner);
StartText:= SynEdit.Lines.text;
ScriptDefault:= StartText;
ScriptName:= 'Untitled';
ScriptChanged := false;
FScriptState:= ss_None;
ScriptErrorLine:= -1;
OwnerSheet.Caption:= ScriptName;
end;
destructor TScriptFrame.Destroy;
begin
inherited Destroy;
end;
initialization
{$I framescript.lrs}
end.

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ uses
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, LResources, Window, files, MufasaTypes, Client, TestUnit, finder, Forms, LResources, Window, files, MufasaTypes, Client, TestUnit, finder,
mmlpsthread, bitmaps, colour_conv, plugins, DTM, colourpicker, mmlpsthread, bitmaps, colour_conv, plugins, DTM, colourpicker,
windowselector, dtmutil, mmath, ocr; windowselector, dtmutil, mmath, ocr, web;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}

View File

@ -1,9 +1,8 @@
object Form1: TForm1 object Form1: TForm1
Left = 457 Left = 251
Height = 553 Height = 553
Top = 155 Top = 340
Width = 723 Width = 723
ActiveControl = PanelSynedit
Caption = 'Mufasa v2' Caption = 'Mufasa v2'
ClientHeight = 533 ClientHeight = 533
ClientWidth = 723 ClientWidth = 723
@ -61,16 +60,16 @@ object Form1: TForm1
Hint = 'Open a new tab' Hint = 'Open a new tab'
Top = 2 Top = 2
Caption = 'TB_NewTab' Caption = 'TB_NewTab'
Enabled = False
ImageIndex = 15 ImageIndex = 15
OnClick = ButtonNewTabClick
end end
object TB_CloseTab: TToolButton object TB_CloseTab: TToolButton
Left = 168 Left = 168
Hint = 'Close this tab' Hint = 'Close this tab'
Top = 2 Top = 2
Caption = 'TB_CloseTab' Caption = 'TB_CloseTab'
Enabled = False
ImageIndex = 16 ImageIndex = 16
OnClick = ButtonCloseTabClick
end end
object ToolButton4: TToolButton object ToolButton4: TToolButton
Left = 191 Left = 191
@ -186,716 +185,6 @@ object Form1: TForm1
end> end>
SimplePanel = False SimplePanel = False
end end
object PanelSynedit: TPanel
Left = 0
Height = 331
Top = 24
Width = 723
Align = alClient
ClientHeight = 331
ClientWidth = 723
TabOrder = 2
object SynEdit1: TSynEdit
Left = 1
Height = 329
Top = 1
Width = 721
Align = alClient
Font.Height = -13
Font.Name = 'Courier New'
Font.Pitch = fpFixed
Font.Quality = fqNonAntialiased
ParentColor = False
ParentFont = False
TabOrder = 0
BookMarkOptions.OnChange = nil
Gutter.Width = 57
Gutter.MouseActions = <
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 13
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbRight
ClickCount = ccSingle
ClickDir = cdUp
Command = 12
MoveCaret = False
Option = 0
Priority = 0
end>
Highlighter = SynFreePascalSyn1
Keystrokes = <
item
Command = ecUp
ShortCut = 38
end
item
Command = ecSelUp
ShortCut = 8230
end
item
Command = ecScrollUp
ShortCut = 16422
end
item
Command = ecDown
ShortCut = 40
end
item
Command = ecSelDown
ShortCut = 8232
end
item
Command = ecScrollDown
ShortCut = 16424
end
item
Command = ecLeft
ShortCut = 37
end
item
Command = ecSelLeft
ShortCut = 8229
end
item
Command = ecWordLeft
ShortCut = 16421
end
item
Command = ecSelWordLeft
ShortCut = 24613
end
item
Command = ecRight
ShortCut = 39
end
item
Command = ecSelRight
ShortCut = 8231
end
item
Command = ecWordRight
ShortCut = 16423
end
item
Command = ecSelWordRight
ShortCut = 24615
end
item
Command = ecPageDown
ShortCut = 34
end
item
Command = ecSelPageDown
ShortCut = 8226
end
item
Command = ecPageBottom
ShortCut = 16418
end
item
Command = ecSelPageBottom
ShortCut = 24610
end
item
Command = ecPageUp
ShortCut = 33
end
item
Command = ecSelPageUp
ShortCut = 8225
end
item
Command = ecPageTop
ShortCut = 16417
end
item
Command = ecSelPageTop
ShortCut = 24609
end
item
Command = ecLineStart
ShortCut = 36
end
item
Command = ecSelLineStart
ShortCut = 8228
end
item
Command = ecEditorTop
ShortCut = 16420
end
item
Command = ecSelEditorTop
ShortCut = 24612
end
item
Command = ecLineEnd
ShortCut = 35
end
item
Command = ecSelLineEnd
ShortCut = 8227
end
item
Command = ecEditorBottom
ShortCut = 16419
end
item
Command = ecSelEditorBottom
ShortCut = 24611
end
item
Command = ecToggleMode
ShortCut = 45
end
item
Command = ecCopy
ShortCut = 16429
end
item
Command = ecPaste
ShortCut = 8237
end
item
Command = ecDeleteChar
ShortCut = 46
end
item
Command = ecCut
ShortCut = 8238
end
item
Command = ecDeleteLastChar
ShortCut = 8
end
item
Command = ecDeleteLastChar
ShortCut = 8200
end
item
Command = ecDeleteLastWord
ShortCut = 16392
end
item
Command = ecUndo
ShortCut = 32776
end
item
Command = ecRedo
ShortCut = 40968
end
item
Command = ecLineBreak
ShortCut = 13
end
item
Command = ecSelectAll
ShortCut = 16449
end
item
Command = ecCopy
ShortCut = 16451
end
item
Command = ecBlockIndent
ShortCut = 24649
end
item
Command = ecLineBreak
ShortCut = 16461
end
item
Command = ecInsertLine
ShortCut = 16462
end
item
Command = ecDeleteWord
ShortCut = 16468
end
item
Command = ecBlockUnindent
ShortCut = 24661
end
item
Command = ecPaste
ShortCut = 16470
end
item
Command = ecCut
ShortCut = 16472
end
item
Command = ecDeleteLine
ShortCut = 16473
end
item
Command = ecDeleteEOL
ShortCut = 24665
end
item
Command = ecUndo
ShortCut = 16474
end
item
Command = ecRedo
ShortCut = 24666
end
item
Command = ecGotoMarker0
ShortCut = 16432
end
item
Command = ecGotoMarker1
ShortCut = 16433
end
item
Command = ecGotoMarker2
ShortCut = 16434
end
item
Command = ecGotoMarker3
ShortCut = 16435
end
item
Command = ecGotoMarker4
ShortCut = 16436
end
item
Command = ecGotoMarker5
ShortCut = 16437
end
item
Command = ecGotoMarker6
ShortCut = 16438
end
item
Command = ecGotoMarker7
ShortCut = 16439
end
item
Command = ecGotoMarker8
ShortCut = 16440
end
item
Command = ecGotoMarker9
ShortCut = 16441
end
item
Command = ecSetMarker0
ShortCut = 24624
end
item
Command = ecSetMarker1
ShortCut = 24625
end
item
Command = ecSetMarker2
ShortCut = 24626
end
item
Command = ecSetMarker3
ShortCut = 24627
end
item
Command = ecSetMarker4
ShortCut = 24628
end
item
Command = ecSetMarker5
ShortCut = 24629
end
item
Command = ecSetMarker6
ShortCut = 24630
end
item
Command = ecSetMarker7
ShortCut = 24631
end
item
Command = ecSetMarker8
ShortCut = 24632
end
item
Command = ecSetMarker9
ShortCut = 24633
end
item
Command = EcFoldLevel1
ShortCut = 41009
end
item
Command = EcFoldLevel2
ShortCut = 41010
end
item
Command = EcFoldLevel1
ShortCut = 41011
end
item
Command = EcFoldLevel1
ShortCut = 41012
end
item
Command = EcFoldLevel1
ShortCut = 41013
end
item
Command = EcFoldLevel6
ShortCut = 41014
end
item
Command = EcFoldLevel7
ShortCut = 41015
end
item
Command = EcFoldLevel8
ShortCut = 41016
end
item
Command = EcFoldLevel9
ShortCut = 41017
end
item
Command = EcFoldLevel0
ShortCut = 41008
end
item
Command = EcFoldCurrent
ShortCut = 41005
end
item
Command = EcUnFoldCurrent
ShortCut = 41003
end
item
Command = EcToggleMarkupWord
ShortCut = 32845
end
item
Command = ecNormalSelect
ShortCut = 24654
end
item
Command = ecColumnSelect
ShortCut = 24643
end
item
Command = ecLineSelect
ShortCut = 24652
end
item
Command = ecTab
ShortCut = 9
end
item
Command = ecShiftTab
ShortCut = 8201
end
item
Command = ecMatchBracket
ShortCut = 24642
end
item
Command = ecColSelUp
ShortCut = 40998
end
item
Command = ecColSelDown
ShortCut = 41000
end
item
Command = ecColSelLeft
ShortCut = 40997
end
item
Command = ecColSelRight
ShortCut = 40999
end
item
Command = ecColSelPageDown
ShortCut = 40994
end
item
Command = ecColSelPageBottom
ShortCut = 57378
end
item
Command = ecColSelPageUp
ShortCut = 40993
end
item
Command = ecColSelPageTop
ShortCut = 57377
end
item
Command = ecColSelLineStart
ShortCut = 40996
end
item
Command = ecColSelLineEnd
ShortCut = 40995
end
item
Command = ecColSelEditorTop
ShortCut = 57380
end
item
Command = ecColSelEditorBottom
ShortCut = 57379
end>
MouseActions = <
item
Shift = []
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 1
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = [ssShift]
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 1
MoveCaret = True
Option = 1
Priority = 0
end
item
Shift = [ssAlt]
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 3
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = [ssShift, ssAlt]
ShiftMask = [ssShift, ssAlt]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 3
MoveCaret = True
Option = 1
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbRight
ClickCount = ccSingle
ClickDir = cdUp
Command = 12
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccDouble
ClickDir = cdDown
Command = 6
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccTriple
ClickDir = cdDown
Command = 7
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccQuad
ClickDir = cdDown
Command = 8
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbMiddle
ClickCount = ccSingle
ClickDir = cdDown
Command = 10
MoveCaret = True
Option = 0
Priority = 0
end
item
Shift = [ssCtrl]
ShiftMask = [ssShift, ssAlt, ssCtrl]
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdUp
Command = 11
MoveCaret = False
Option = 0
Priority = 0
end>
MouseSelActions = <
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccSingle
ClickDir = cdDown
Command = 9
MoveCaret = False
Option = 0
Priority = 0
end>
Lines.Strings = (
'program new;'
'begin'
'end.'
)
BracketHighlightStyle = sbhsBoth
OnChange = OnSyneditChange
OnProcessCommand = SynEditProcessCommand
OnSpecialLineColors = SynEdit1SpecialLineColors
object TSynGutterPartList
object TSynGutterMarks
Width = 23
end
object TSynGutterLineNumber
Width = 17
MouseActions = <>
MarkupInfo.Background = clBtnFace
MarkupInfo.Foreground = clNone
DigitCount = 2
ShowOnlyLineNumbersMultiplesOf = 1
ZeroStart = False
LeadingZeros = False
end
object TSynGutterChanges
Width = 4
ModifiedColor = 59900
SavedColor = clGreen
end
object TSynGutterSeparator
Width = 2
end
object TSynGutterCodeFolding
MouseActions = <
item
Shift = []
ShiftMask = []
Button = mbRight
ClickCount = ccSingle
ClickDir = cdUp
Command = 16
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = [ssShift]
Button = mbMiddle
ClickCount = ccAny
ClickDir = cdDown
Command = 14
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = [ssShift]
ShiftMask = [ssShift]
Button = mbMiddle
ClickCount = ccAny
ClickDir = cdDown
Command = 14
MoveCaret = False
Option = 1
Priority = 0
end
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 0
MoveCaret = False
Option = 0
Priority = 0
end>
MarkupInfo.Background = clNone
MarkupInfo.Foreground = clGray
MouseActionsExpanded = <
item
Shift = []
ShiftMask = []
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 14
MoveCaret = False
Option = 0
Priority = 0
end>
MouseActionsCollapsed = <
item
Shift = [ssCtrl]
ShiftMask = [ssCtrl]
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 15
MoveCaret = False
Option = 0
Priority = 0
end
item
Shift = []
ShiftMask = [ssCtrl]
Button = mbLeft
ClickCount = ccAny
ClickDir = cdDown
Command = 15
MoveCaret = False
Option = 1
Priority = 0
end>
end
end
end
end
object PanelMemo: TPanel object PanelMemo: TPanel
Left = 0 Left = 0
Height = 150 Height = 150
@ -905,7 +194,7 @@ object Form1: TForm1
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
ClientHeight = 150 ClientHeight = 150
ClientWidth = 723 ClientWidth = 723
TabOrder = 3 TabOrder = 2
object Memo1: TMemo object Memo1: TMemo
Left = 1 Left = 1
Height = 148 Height = 148
@ -926,6 +215,15 @@ object Form1: TForm1
Align = alBottom Align = alBottom
ResizeAnchor = akBottom ResizeAnchor = akBottom
end end
object PageControl1: TPageControl
Left = 0
Height = 331
Top = 24
Width = 723
Align = alClient
TabOrder = 4
OnChange = PageControl1Change
end
object MainMenu1: TMainMenu object MainMenu1: TMainMenu
left = 560 left = 560
object MenuFile: TMenuItem object MenuFile: TMenuItem
@ -2053,20 +1351,6 @@ object Form1: TForm1
OnClick = NoTray OnClick = NoTray
left = 464 left = 464
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 = 424
end
object TrayPopup: TPopupMenu object TrayPopup: TPopupMenu
left = 600 left = 600
object MenuItemShow: TMenuItem object MenuItemShow: TMenuItem

File diff suppressed because it is too large Load Diff

View File

@ -35,19 +35,27 @@ uses
MufasaTypes, MufasaTypes,
mmlpsthread, mmlpsthread,
window, // for the comp picker and selector window, // for the comp picker and selector
colourpicker, colourpicker, framescript,
windowselector, windowselector,
lcltype lcltype
, SynEditKeyCmds,SynEditHighlighter, SynEditMarkupSpecialLine, SynEditMiscClasses; , SynEditKeyCmds,SynEditHighlighter, SynEditMarkupSpecialLine, SynEditMiscClasses;
type type
TScriptState = (ss_None,ss_Running,ss_Paused,ss_Stopping);
{ { TMufasaTab }
ss_None: Means the script either hasn't been run yet, or it has ended (Succesfully or terminated)
ss_Running: Means the script is running as we speak :-) TMufasaTab = class(Tobject)
ss_Paused: Means the script is currently in pause modus. private
ss_Stopping: Means we've asked PS-Script politely to stop the script (next time we press the stop button we won't be that nice). PageCtrl : TPageControl;
} public
TabSheet : TTabsheet;
ScriptFrame : TScriptFrame;
procedure Clear;//This will 'reset' the ScriptFrame
constructor Create(Page : TPageControl);
destructor Destroy; override;
end;
// Tab
{ TForm1 } { TForm1 }
TForm1 = class(TForm) TForm1 = class(TForm)
@ -70,13 +78,11 @@ type
MainMenu1: TMainMenu; MainMenu1: TMainMenu;
MenuItemScript: TMenuItem; MenuItemScript: TMenuItem;
MenuItemRun: TMenuItem; MenuItemRun: TMenuItem;
PanelSynedit: TPanel; PageControl1: TPageControl;
PanelMemo: TPanel; PanelMemo: TPanel;
SplitterMemoSynedit: TSplitter; SplitterMemoSynedit: TSplitter;
TrayPopup: TPopupMenu; TrayPopup: TPopupMenu;
StatusBar: TStatusBar; StatusBar: TStatusBar;
SynEdit1: TSynEdit;
SynFreePascalSyn1: TSynFreePascalSyn;
ToolBar1: TToolBar; ToolBar1: TToolBar;
TB_Run: TToolButton; TB_Run: TToolButton;
TB_Pause: TToolButton; TB_Pause: TToolButton;
@ -97,14 +103,14 @@ type
ToolButton8: TToolButton; ToolButton8: TToolButton;
TB_Convert: TToolButton; TB_Convert: TToolButton;
MTrayIcon: TTrayIcon; MTrayIcon: TTrayIcon;
procedure ButtonDragClick(Sender: TObject); procedure ButtonCloseTabClick(Sender: TObject);
procedure ButtonNewClick(Sender: TObject); procedure ButtonNewClick(Sender: TObject);
procedure ButtonNewTabClick(Sender: TObject);
procedure ButtonOpenClick(Sender: TObject); procedure ButtonOpenClick(Sender: TObject);
procedure ButtonPauseClick(Sender: TObject); procedure ButtonPauseClick(Sender: TObject);
procedure ButtonRunClick(Sender: TObject); procedure ButtonRunClick(Sender: TObject);
procedure ButtonSaveClick(Sender: TObject); procedure ButtonSaveClick(Sender: TObject);
procedure ButtonClearClick(Sender: TObject); procedure ButtonClearClick(Sender: TObject);
procedure ErrorThread(ErrorAtLine,ErrorPosition : integer; ErrorStr : string; ErrorType : TErrorType);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@ -122,35 +128,26 @@ type
procedure MenuItemShowClick(Sender: TObject); procedure MenuItemShowClick(Sender: TObject);
procedure MenuItemStopClick(Sender: TObject); procedure MenuItemStopClick(Sender: TObject);
procedure OnLinePSScript(Sender: TObject); procedure OnLinePSScript(Sender: TObject);
procedure OnSyneditChange(Sender: TObject);
procedure ButtonPickClick(Sender: TObject); procedure ButtonPickClick(Sender: TObject);
procedure MenuItemRedoClick(Sender: TObject); procedure MenuItemRedoClick(Sender: TObject);
procedure ButtonSelectorDown(Sender: TObject; Button: TMouseButton; procedure ButtonSelectorDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); Shift: TShiftState; X, Y: Integer);
procedure NoTray(Sender: TObject); procedure NoTray(Sender: TObject);
procedure ScriptThreadTerminate(Sender: TObject); procedure PageControl1Change(Sender: TObject);
procedure SynEdit1SpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
procedure SynEditProcessCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
procedure ButtonStopClick(Sender: TObject); procedure ButtonStopClick(Sender: TObject);
procedure ButtonTrayClick(Sender: TObject); procedure ButtonTrayClick(Sender: TObject);
procedure MenuItemUndoClick(Sender: TObject); procedure MenuItemUndoClick(Sender: TObject);
private private
ScriptErrorLine : integer; //Highlight the error line! function GetScriptState: TScriptState;
ScriptFile : string;//The path to the saved/opened file currently in the SynEdit
StartText : string;//The text synedit holds upon start/open/save
ScriptName : string;//The name of the currently opened/saved file.
ScriptDefault : string;//The default script e.g. program new; begin end.
ScriptChanged : boolean;//We need this for that little * (edited star).
ScriptThread : TMMLPSThread;//Just one thread for now..
FScriptState : TScriptState;//Defines the "state" of the current script. (Acces through property for form updates).
procedure SetScriptState(const State: TScriptState); procedure SetScriptState(const State: TScriptState);
public public
CurrScript : TScriptFrame; //The current scriptframe
CurrTab : TMufasaTab; //The current TMufasaTab
Tabs : TList;
Window: TMWindow; Window: TMWindow;
Picker: TMColorPicker; Picker: TMColorPicker;
Selector: TMWindowSelector; Selector: TMWindowSelector;
property ScriptState : TScriptState read FScriptState write SetScriptState; property ScriptState : TScriptState read GetScriptState write SetScriptState;
procedure SafeCallThread; procedure SafeCallThread;
function OpenScript : boolean; function OpenScript : boolean;
function SaveCurrentScript : boolean; function SaveCurrentScript : boolean;
@ -160,11 +157,16 @@ type
procedure RunScript; procedure RunScript;
procedure PauseScript; procedure PauseScript;
procedure StopScript; procedure StopScript;
procedure undo;
procedure redo;
procedure Cut; procedure Cut;
procedure Paste; procedure Paste;
procedure AddTab;
function DeleteTab( TabIndex : integer; CloseLast : boolean) : boolean;
procedure ClearTab( TabIndex : integer);
procedure RefreshTab;//Refreshes all the form items that depend on the Script (Panels, title etc.)
end; end;
{$ifdef mswindows}
procedure Writeln( S : String);
{$endif}
const const
WindowTitle = 'Mufasa v2 - %s';//Title, where %s = the place of the filename. WindowTitle = 'Mufasa v2 - %s';//Title, where %s = the place of the filename.
Panel_State = 0; Panel_State = 0;
@ -190,108 +192,154 @@ end;
procedure TForm1.RunScript; procedure TForm1.RunScript;
begin begin
if ScriptState = ss_Paused then with CurrScript do
begin; begin
if ScriptState = ss_Paused then
begin;
ScriptThread.Resume;
ScriptState := ss_Running;
Exit;
end else
if ScriptState <> ss_None then
begin;
Writeln('The script hasn''t stopped yet, so we cannot start a new one.');
exit;
end;
CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread;
ScriptThread := TMMLPSThread.Create(True,@CurrentSyncInfo);
ScriptThread.SetPSScript(CurrScript.SynEdit.Lines.Text);
ScriptThread.SetDebug(Self.Memo1);
ScriptThread.OnError:=@ErrorThread;
if ScriptFile <> '' then
ScriptThread.SetPaths( ExtractFileDir(ScriptFile) + DS,IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)))
else
ScriptThread.SetPaths('', IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)));
// This doesn't actually set the Client's MWindow to the passed window, it
// only copies the current set window handle.
ScriptThread.Client.MWindow.SetWindow(Self.Window);
ScriptThread.OnTerminate:=@ScriptThreadTerminate;
ScriptState:= ss_Running;
//Lets run it!
ScriptThread.Resume; ScriptThread.Resume;
ScriptState := ss_Running;
Exit;
end else
if ScriptState <> ss_None then
begin;
Writeln('The script hasn''t stopped yet, so we cannot start a new one.');
exit;
end; end;
CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread;
ScriptThread := TMMLPSThread.Create(True,@CurrentSyncInfo);
ScriptThread.SetPSScript(Self.SynEdit1.Lines.Text);
ScriptThread.SetDebug(Self.Memo1);
ScriptThread.OnError:=@ErrorThread;
if ScriptFile <> '' then
ScriptThread.SetPaths( ExtractFileDir(ScriptFile) + DS,IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)))
else
ScriptThread.SetPaths('', IncludeTrailingPathDelimiter(ExpandFileName(MainDir +DS + '..' + DS + '..' + ds)));
// This doesn't actually set the Client's MWindow to the passed window, it
// only copies the current set window handle.
ScriptThread.Client.MWindow.SetWindow(Self.Window);
ScriptThread.OnTerminate:=@ScriptThreadTerminate;
ScriptState:= ss_Running;
//Lets run it!
ScriptThread.Resume;
end; end;
procedure TForm1.PauseScript; procedure TForm1.PauseScript;
begin begin
if ScriptState = ss_Running then with CurrScript do
begin; begin;
{$ifdef MSWindows} if ScriptState = ss_Running then
ScriptThread.Suspended:= True; begin;
ScriptState:= ss_Paused; {$ifdef MSWindows}
{$else} ScriptThread.Suspended:= True;
Writeln('Linux users are screwed, no pause button for u!'); ScriptState:= ss_Paused;
{$endif} {$else}
end else if ScriptState = ss_Paused then Writeln('Linux users are screwed, no pause button for u!');
begin; {$endif}
ScriptThread.Resume; end else if ScriptState = ss_Paused then
ScriptState := ss_Running; begin;
ScriptThread.Resume;
ScriptState := ss_Running;
end;
end; end;
end; end;
procedure TForm1.StopScript; procedure TForm1.StopScript;
begin begin
case ScriptState of with CurrScript do
ss_Stopping: begin;
begin //Terminate the thread the tough way. case ScriptState of
writeln('Terminating the Scriptthread'); ss_Stopping:
KillThread(ScriptThread.Handle); begin //Terminate the thread the tough way.
ScriptThread.Free; writeln('Terminating the Scriptthread');
ScriptState := ss_None; KillThread(ScriptThread.Handle);
end; ScriptThread.Free;
ss_Running: ScriptState := ss_None;
begin end;
ScriptThread.PSScript.Stop; ss_Running:
ScriptState := ss_Stopping; begin
end; ScriptThread.PSScript.Stop;
ss_Paused: ScriptState := ss_Stopping;
begin end;
ScriptThread.Resume; ss_Paused:
ScriptThread.PSScript.Stop; begin
ScriptState:= ss_Stopping; ScriptThread.Resume;
end; ScriptThread.PSScript.Stop;
ScriptState:= ss_Stopping;
end;
end;
end; end;
end; end;
procedure TForm1.Undo;
begin
SynEdit1.Undo;
if ScriptChanged then
if SynEdit1.Lines.Text = StartText then
begin;
Self.Caption:= format(WindowTitle,[ScriptName]);
ScriptChanged := false;
end;
end;
procedure TForm1.Redo;
begin
SynEdit1.Redo;
if ScriptChanged then
if SynEdit1.Lines.Text = StartText then
begin;
Self.Caption:= format(WindowTitle,[ScriptName]);
ScriptChanged := false;
end;
end;
procedure TForm1.Cut; procedure TForm1.Cut;
begin begin
SynEdit1.CutToClipboard; CurrScript.SynEdit.CutToClipboard;
end; end;
procedure TForm1.Paste; procedure TForm1.Paste;
begin begin
SynEdit1.PasteFromClipboard; CurrScript.SynEdit.PasteFromClipboard;
end;
procedure TForm1.AddTab;
var
Tab : TMufasaTab;
begin;
Tab := TMufasaTab.Create(Self.PageControl1);
Tabs.Add(Tab);
PageControl1.TabIndex:= Tabs.Count - 1;
RefreshTab;
end;
function TForm1.DeleteTab(TabIndex: integer; CloseLast : boolean) : boolean;
var
Tab : TMufasaTab;
begin
PageControl1.TabIndex:= TabIndex;
//ScriptFrame now is now correct ;-D
result := CanExitOrOpen;
if not result then
exit;
Tab := TMufasaTab(Tabs[TabIndex]);
if (Tabs.Count = 1) and (not CloseLast) then
Tab.Clear
else
begin;
Tab.Free;
Tabs.Delete(TabIndex);
end;
end;
procedure TForm1.ClearTab(TabIndex: integer);
begin
TMufasaTab(Tabs[TabIndex]).Clear;
end;
procedure TForm1.RefreshTab;
var
Tab : TMufasaTab;
Script : TScriptFrame;
NewTab : integer;
begin
NewTab := PageControl1.TabIndex;
Tab := TMufasaTab(Tabs[Newtab]);
Script := Tab.ScriptFrame;
Self.CurrScript := Script;
Self.CurrTab := Tab;
if Script.ScriptChanged then
begin;
Tab.TabSheet.Caption:= Script.ScriptName + '*';
Self.Caption := Format(WindowTitle,[Script.ScriptName + '*'])
end else
begin;
Self.Caption := Format(WindowTitle,[Script.ScriptName]);
Tab.TabSheet.Caption:= Script.ScriptName;
end;
StatusBar.Panels[Panel_ScriptName].Text:= Script.ScriptName;
StatusBar.Panels[Panel_ScriptPath].text:= Script.ScriptFile;
SetScriptState(Tab.ScriptFrame.FScriptState);//To set the buttons right
end; end;
procedure TForm1.ButtonRunClick(Sender: TObject); procedure TForm1.ButtonRunClick(Sender: TObject);
@ -309,9 +357,14 @@ begin
Self.ClearScript; Self.ClearScript;
end; end;
procedure TForm1.ButtonDragClick(Sender: TObject); procedure TForm1.ButtonNewTabClick(Sender: TObject);
begin begin;
AddTab;
end;
procedure TForm1.ButtonCloseTabClick(Sender: TObject);
begin
DeleteTab( PageControl1.TabIndex,false);
end; end;
procedure TForm1.ButtonOpenClick(Sender: TObject); procedure TForm1.ButtonOpenClick(Sender: TObject);
@ -329,40 +382,37 @@ begin
Memo1.Clear; Memo1.Clear;
end; end;
procedure TForm1.ErrorThread(ErrorAtLine,ErrorPosition : integer; ErrorStr : string; ErrorType : TErrorType);
begin
ScriptErrorLine:= ErrorAtLine;
SynEdit1.SelStart:= ErrorPosition;
Writeln(Format('Error: %s at line %d',[errorstr,erroratline]));
SynEdit1.Invalidate;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
var
i : integer;
begin begin
if not CanExitOrOpen then for i := Tabs.Count - 1 downto 0 do
CloseAction := caNone; if not DeleteTab(i,true) then
begin;
CloseAction := caNone;
exit
end;
end; end;
procedure TForm1.FormCreate(Sender: TObject); procedure TForm1.FormCreate(Sender: TObject);
begin begin
Tabs := TList.Create;
AddTab;//Give it alteast 1 tab ;-).
Window := TMWindow.Create; Window := TMWindow.Create;
Picker := TMColorPicker.Create(Window); Picker := TMColorPicker.Create(Window);
Selector := TMWindowSelector.Create(Window); Selector := TMWindowSelector.Create(Window);
StartText:= SynEdit1.Lines.text;
ScriptDefault:= StartText;
Caption := Format(WindowTitle,['Untitled']);
ScriptName:= 'Untitled';
ScriptChanged := false;
ScriptState:= ss_None;
ScriptErrorLine:= -1;
MainDir:= ExtractFileDir(Application.ExeName); MainDir:= ExtractFileDir(Application.ExeName);
PluginsGlob := TMPlugins.Create; PluginsGlob := TMPlugins.Create;
PluginsGlob.PluginDirs.Add(ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS)); PluginsGlob.PluginDirs.Add(ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS));
// SynMemo1.sc
end; end;
procedure TForm1.FormDestroy(Sender: TObject); procedure TForm1.FormDestroy(Sender: TObject);
var
i : integer;
begin begin
for i := Tabs.Count - 1 downto 0 do
TMufasaTab(Tabs[i]).Free;
Tabs.free;
Selector.Free; Selector.Free;
Picker.Free; Picker.Free;
Window.Free; Window.Free;
@ -442,15 +492,7 @@ begin
{$ENDIF} {$ENDIF}
end; end;
procedure TForm1.OnSyneditChange(Sender: TObject);
begin
ScriptErrorLine:= -1;
if not ScriptChanged then
begin;
ScriptChanged:= True;
Self.Caption:= Format(WindowTitle,[ScriptName + '*']);
end;
end;
procedure TForm1.ButtonPickClick(Sender: TObject); procedure TForm1.ButtonPickClick(Sender: TObject);
var var
@ -463,7 +505,7 @@ end;
procedure TForm1.MenuItemRedoClick(Sender: TObject); procedure TForm1.MenuItemRedoClick(Sender: TObject);
begin begin
Self.redo; CurrScript.redo;
end; end;
procedure TForm1.ButtonSelectorDown(Sender: TObject; Button: TMouseButton; procedure TForm1.ButtonSelectorDown(Sender: TObject; Button: TMouseButton;
@ -481,36 +523,9 @@ begin
Form1.Hide; Form1.Hide;
end; end;
procedure TForm1.ScriptThreadTerminate(Sender: TObject); procedure TForm1.PageControl1Change(Sender: TObject);
begin begin
ScriptState:= ss_None; RefreshTab();
end;
procedure TForm1.SynEdit1SpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
begin
if line = ScriptErrorLine then
begin;
Special := true;
BG := $50a0ff;
FG := 0;
end;
end;
procedure TForm1.SynEditProcessCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
begin
if Command = ecUndo then
begin;
Command:= ecNone;
Self.Undo;
end else
if Command = ecRedo then
begin;
Command := ecNone;
Self.Redo;
end;
end; end;
procedure TForm1.ButtonStopClick(Sender: TObject); procedure TForm1.ButtonStopClick(Sender: TObject);
@ -526,14 +541,19 @@ end;
procedure TForm1.MenuItemUndoClick(Sender: TObject); procedure TForm1.MenuItemUndoClick(Sender: TObject);
begin begin
Self.Undo; CurrScript.Undo;
end;
function TForm1.GetScriptState: TScriptState;
begin
result := CurrScript.FScriptState;
end; end;
procedure TForm1.SetScriptState(const State: TScriptState); procedure TForm1.SetScriptState(const State: TScriptState);
begin begin
FScriptState:= State; CurrScript.FScriptState:= State;
with Self.StatusBar.panels[Panel_State] do with Self.StatusBar.panels[Panel_State] do
case FScriptState of case state of
ss_Running : begin Text := 'Running'; TB_Run.Enabled:= False; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} TB_Stop.Enabled:= True; end; ss_Running : begin Text := 'Running'; TB_Run.Enabled:= False; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} TB_Stop.Enabled:= True; end;
ss_Paused : begin Text := 'Paused'; TB_Run.Enabled:= True; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} TB_Stop.Enabled:= True; end; ss_Paused : begin Text := 'Paused'; TB_Run.Enabled:= True; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} TB_Stop.Enabled:= True; end;
ss_Stopping: begin Text := 'Stopping';TB_Run.Enabled:= False; TB_Pause.Enabled:= False; TB_Stop.Enabled:= True; TB_Stop.ImageIndex := Image_Terminate end; ss_Stopping: begin Text := 'Stopping';TB_Run.Enabled:= False; TB_Pause.Enabled:= False; TB_Stop.Enabled:= True; TB_Stop.ImageIndex := Image_Terminate end;
@ -566,16 +586,17 @@ begin;
if Execute then if Execute then
if FileExists(FileName) then if FileExists(FileName) then
begin; begin;
SynEdit1.Lines.LoadFromFile(FileName); with CurrScript do
StartText := SynEdit1.Lines.text; begin
ScriptName:= ExtractFileNameOnly(FileName); SynEdit.Lines.LoadFromFile(FileName);
WriteLn('Script name will be: ' + ScriptName); StartText := SynEdit.Lines.text;
ScriptFile:= FileName; ScriptName:= ExtractFileNameOnly(FileName);
StatusBar.Panels[Panel_ScriptName].Text:= ScriptName; WriteLn('Script name will be: ' + ScriptName);
StatusBar.Panels[Panel_ScriptPath].text:= FileName; ScriptFile:= FileName;
Self.Caption:= Format(WindowTitle,[ScriptName]); ScriptChanged := false;
ScriptChanged := false; RefreshTab();
Result := True; Result := True;
end;
end; end;
finally finally
Free; Free;
@ -584,49 +605,53 @@ end;
function TForm1.SaveCurrentScript: boolean; function TForm1.SaveCurrentScript: boolean;
begin begin
Result := (ScriptFile <> ''); with CurrScript do
if Result then begin
begin; Result := (ScriptFile <> '');
ScriptChanged := false; if Result then
SynEdit1.Lines.SaveToFile(ScriptFile); begin;
StartText:= SynEdit1.Lines.Text; ScriptChanged := false;
SynEdit1.MarkTextAsSaved; SynEdit.Lines.SaveToFile(ScriptFile);
Self.Caption:= Format(WindowTitle,[ScriptName]); StartText:= SynEdit.Lines.Text;
end SynEdit.MarkTextAsSaved;
else Self.Caption:= Format(WindowTitle,[ScriptName]);
result := SaveCurrentScriptAs; end
else
result := SaveCurrentScriptAs;
end;
end; end;
function TForm1.SaveCurrentScriptAs: boolean; function TForm1.SaveCurrentScriptAs: boolean;
begin begin
Result := false; with CurrScript do
with TSaveDialog.Create(nil) do
try
Filter:= 'Mufasa files|*.cogat;*.mufa;*.pas;*.txt|Any Files|*.*';
if Execute then
begin;
if ExtractFileExt(FileName) = '' then
begin;
ScriptFile := FileName + '.mufa';
end else
ScriptFile := FileName;
SynEdit1.Lines.SaveToFile(ScriptFile);
ScriptName:= ExtractFileNameOnly(ScriptFile);
StatusBar.Panels[Panel_ScriptName].Text:= ScriptName;
StatusBar.Panels[Panel_ScriptPath].text := ScriptFile;
Self.Caption:= Format(WindowTitle,[ScriptName]);
WriteLn('Script name will be: ' + ScriptName);
Result := True;
end;
finally
Free;
end;
if result then
begin; begin;
Writeln('Succesfully saved: ' + ScriptFile); Result := false;
StartText:= SynEdit1.Lines.Text; with TSaveDialog.Create(nil) do
SynEdit1.MarkTextAsSaved; try
ScriptChanged := false; Filter:= 'Mufasa files|*.cogat;*.mufa;*.pas;*.txt|Any Files|*.*';
if Execute then
begin;
if ExtractFileExt(FileName) = '' then
begin;
ScriptFile := FileName + '.mufa';
end else
ScriptFile := FileName;
SynEdit.Lines.SaveToFile(ScriptFile);
ScriptName:= ExtractFileNameOnly(ScriptFile);
WriteLn('Script name will be: ' + ScriptName);
RefreshTab();
Result := True;
end;
finally
Free;
end;
if result then
begin;
Writeln('Succesfully saved: ' + ScriptFile);
StartText:= SynEdit.Lines.Text;
SynEdit.MarkTextAsSaved;
ScriptChanged := false;
end;
end; end;
end; end;
@ -636,7 +661,23 @@ var
begin; begin;
Self.Enabled := False;//We HAVE to answer the popup Self.Enabled := False;//We HAVE to answer the popup
Result := True; Result := True;
if StartText <> Synedit1.Lines.text then if ScriptState <> ss_None then
begin
if ScriptState <> ss_Stopping then
begin
result := False;
Case MessageBox(0,pchar('Do you want to stop the script?'), Pchar('Script is still running.'),
MB_YESNOCANCEL or MB_ICONQUESTION) of
IDYES : StopScript;
end;
end else
Case MessageBox(0,pchar('Do you want to terminate the script?'), Pchar('Script is stopping.'),
MB_YESNOCANCEL or MB_ICONQUESTION) of
IDNO,IDCancel: Result := false;
IDYES : StopScript;
end;
end;
if Result and (CurrScript.StartText <> CurrScript.SynEdit.Lines.text) then
Case MessageBox(0,pchar('Do you want to save the script?'), Pchar('Script has been modified.'), Case MessageBox(0,pchar('Do you want to save the script?'), Pchar('Script has been modified.'),
MB_YESNOCANCEL or MB_ICONQUESTION) of MB_YESNOCANCEL or MB_ICONQUESTION) of
IDCANCEL : Result := False; IDCANCEL : Result := False;
@ -650,20 +691,43 @@ function TForm1.ClearScript: boolean;
begin begin
if CanExitOrOpen then if CanExitOrOpen then
begin; begin;
ScriptFile:= ''; CurrTab.Clear;
ScriptName:= 'Untitled'; RefreshTab();
StartText:= ScriptDefault;
SynEdit1.Lines.Text:= ScriptDefault;
StatusBar.Panels[Panel_ScriptName].Text:= 'Untitled';
StatusBar.Panels[Panel_ScriptPath].Text:= '';
Self.Caption := Format(WindowTitle,['Untitled']);
ScriptChanged:= false;
end; end;
end; end;
{ TMufasaTab }
procedure TMufasaTab.Clear;
begin
ScriptFrame.Free;
ScriptFrame := TScriptFrame.Create(Tabsheet);
ScriptFrame.Parent := Tabsheet;
ScriptFrame.Align:= alClient;
end;
constructor TMufasaTab.Create(Page: TPageControl);
begin
inherited Create;
PageCtrl := Page;
Tabsheet := TTabSheet.Create(Page);
Tabsheet.PageControl := Page;
ScriptFrame := TScriptFrame.Create(Tabsheet);
ScriptFrame.Parent := Tabsheet;
ScriptFrame.Align:= alClient;
end;
destructor TMufasaTab.Destroy;
begin
ScriptFrame.Free;
TabSheet.Free;
inherited Destroy;
end;
initialization initialization
{$I testunit.lrs} {$I testunit.lrs}
end. end.