1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-04 16:35:15 -05:00

Uhm ScriptSetProp and ScriptGetProp now work with an Enum, ctrl + alt + s is a global shorcut (on windows). f2 is a non-local shortcut to stop the script. Console now hides without losing the information, changed compiler setting for windows, added define mDebug for if you want a more extensive debug.

This commit is contained in:
Raymond 2010-03-22 15:58:30 +01:00
parent 4697f46d39
commit 51b3c3cf94
15 changed files with 265 additions and 180 deletions

View File

@ -1,3 +1,5 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TScriptFrame','FORMDATA',[
'TPF0'#12'TScriptFrame'#11'ScriptFrame'#4'Left'#2#0#6'Height'#3'H'#1#3'Top'#2
+#0#5'Width'#3#141#1#12'ClientHeight'#3'H'#1#11'ClientWidth'#3#141#1#8'TabOrd'

View File

@ -255,11 +255,6 @@
<Debugging>
<GenerateDebugInfo Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dUseCThreads

View File

@ -11,6 +11,9 @@ uses
type
{ TSimbaPSEventExtension }
TSimbaPSEventExtension = class(TVirtualSimbaExtension)
public
constructor Create(FileName: String);
@ -31,6 +34,7 @@ type
procedure RegisterPSCComponents(Sender: TObject; x: TPSPascalCompiler);
procedure RegisterPSRComponents(Sender: TObject; se: TPSExec; x: TPSRuntimeClassImporter);
procedure RegisterMyMethods(Sender: TPSScript);
procedure OnPSExecute(Sender: TPSScript);
end;
@ -38,9 +42,10 @@ type
implementation
uses
uPSC_std, uPSC_controls,uPSC_classes,uPSC_graphics,uPSC_stdctrls,uPSC_forms,
uPSC_extctrls, //Compile libs
uPSC_extctrls,uPSC_menus, //Compile libs
uPSR_std, uPSR_controls,uPSR_classes,uPSR_graphics,uPSR_stdctrls,uPSR_forms,
uPSR_extctrls //Runtime-libs
uPSR_extctrls,uPSR_menus, //Runtime-libs
testunit//Writeln
;
procedure createf;
@ -97,27 +102,27 @@ begin
PSInstance.OnCompImport:=@RegisterPSCComponents;
PSInstance.OnExecImport:=@RegisterPSRComponents;
PSInstance.OnCompile:=@RegisterMyMethods;
PSInstance.OnExecute:=@OnPSExecute;
Writeln(Format('%s: Script: %s', [FileName, Self.Script.Text]));
formWritelnEx(Format('%s: Script: %s', [FileName, Self.Script.Text]));
try
FEnabled := PSInstance.Compile;
finally
if FEnabled then
writeln('Extension Enabled')
formWritelnEx('Extension Enabled')
else
begin
writeln('Extension Disabled - Did not compile');
formWritelnEx('Extension Disabled - Did not compile');
OutputMessages;
end;
end;
FEnabled := InitScript();
if FEnabled then
writeln('It exists')
formWritelnEx('It exists')
else
writeln('It does not exist - or something went wrong while executing it.');
//writeln(PSInstance.ExecuteFunction([], 'test'));
formWritelnEx('It does not exist - or something went wrong while executing it.');
end;
function TSimbaPSEventExtension.InitScript: Boolean;
@ -137,6 +142,15 @@ end;
procedure TSimbaPSEventExtension.RegisterMyMethods(Sender: TPSScript);
begin
Sender.AddFunction(@createf, 'procedure createf;');
Sender.AddFunction(@formWritelnEx,'procedure Writeln(s : string)');
Sender.AddRegisteredVariable('Simba','TForm');
Sender.AddRegisteredVariable('Simba_MainMenu','TMainMenu');
end;
procedure TSimbaPSEventExtension.OnPSExecute(Sender: TPSScript);
begin
Sender.SetVarToInstance('simba',Form1);
Sender.SetVarToInstance('Simba_MainMenu',Form1.MainMenu);
end;
procedure TSimbaPSEventExtension.RegisterPSCComponents(Sender: TObject; x: TPSPascalCompiler);
@ -148,6 +162,7 @@ begin
SIRegister_stdctrls(x);
SIRegister_Forms(x);
SIRegister_ExtCtrls(x);
SIRegister_Menus(x);
end;
procedure TSimbaPSEventExtension.RegisterPSRComponents(Sender: TObject; se: TPSExec; x: TPSRuntimeClassImporter);
@ -159,6 +174,7 @@ begin
RIRegister_stdctrls(x);
RIRegister_Forms(x);
RIRegister_ExtCtrls(x);
RIRegister_Menus(x);
end;
destructor TSimbaPSEventExtension.Destroy;
@ -167,7 +183,7 @@ begin
FreeAndNil(PSInstance);
WriteLn('Closing extension');
formWritelnEx('Closing extension');
inherited;
end;
@ -185,14 +201,14 @@ begin
begin
b := True;
with PSInstance.CompilerMessages[l] do
writeln(MessageToString);
formWritelnEx(MessageToString);
{if OnError <> nil then
with PSInstance.CompilerMessages[l] do
HandleError(Row, Col, Pos, MessageToString,errCompile, ModuleName)
else }
writeln(PSInstance.CompilerErrorToStr(l) + ' at line ' + inttostr(PSInstance.CompilerMessages[l].Row));
formWritelnEx(PSInstance.CompilerErrorToStr(l) + ' at line ' + inttostr(PSInstance.CompilerMessages[l].Row));
end else
Writeln(PSInstance.CompilerErrorToStr(l) + ' at line ' + inttostr(PSInstance.CompilerMessages[l].Row));
formWritelnEx(PSInstance.CompilerErrorToStr(l) + ' at line ' + inttostr(PSInstance.CompilerMessages[l].Row));
end;
end;

View File

@ -1,12 +1,12 @@
object Form1: TForm1
Left = 331
Left = 345
Height = 555
Top = 150
Top = 260
Width = 739
ActiveControl = ScriptPanel
AllowDropFiles = True
Caption = 'THA FUKING SIMBA'
ClientHeight = 530
ClientHeight = 535
ClientWidth = 739
KeyPreview = True
Menu = MainMenu
@ -207,8 +207,8 @@ object Form1: TForm1
end
object StatusBar: TStatusBar
Left = 0
Height = 21
Top = 509
Height = 23
Top = 512
Width = 739
Panels = <
item
@ -230,7 +230,7 @@ object Form1: TForm1
object PanelMemo: TPanel
Left = 0
Height = 154
Top = 355
Top = 358
Width = 739
Align = alBottom
ClientHeight = 154
@ -250,19 +250,19 @@ object Form1: TForm1
Cursor = crVSplit
Left = 0
Height = 5
Top = 350
Top = 353
Width = 739
Align = alBottom
ResizeAnchor = akBottom
end
object ScriptPanel: TPanel
Left = 0
Height = 326
Height = 329
Top = 24
Width = 739
Align = alClient
BevelOuter = bvNone
ClientHeight = 326
ClientHeight = 329
ClientWidth = 739
DockSite = True
TabOrder = 4
@ -270,7 +270,7 @@ object Form1: TForm1
OnDockOver = ScriptPanelDockOver
object PageControl1: TPageControl
Left = 155
Height = 291
Height = 294
Top = 0
Width = 584
Align = alClient
@ -289,7 +289,7 @@ object Form1: TForm1
object SearchPanel: TPanel
Left = 0
Height = 35
Top = 291
Top = 294
Width = 739
Align = alBottom
BevelOuter = bvSpace
@ -385,7 +385,7 @@ object Form1: TForm1
end
object LabeledEditSearch: TLabeledEdit
Left = 104
Height = 27
Height = 21
Top = 6
Width = 174
EditLabel.AnchorSideLeft.Control = LabeledEditSearch
@ -393,10 +393,10 @@ object Form1: TForm1
EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEditSearch
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
EditLabel.Left = 67
EditLabel.Height = 18
EditLabel.Top = 10
EditLabel.Width = 34
EditLabel.Left = 73
EditLabel.Height = 14
EditLabel.Top = 9
EditLabel.Width = 28
EditLabel.Caption = 'Find: '
EditLabel.ParentColor = False
LabelPosition = lpLeft
@ -409,9 +409,9 @@ object Form1: TForm1
end
object CheckBoxMatchCase: TCheckBox
Left = 320
Height = 22
Height = 17
Top = 7
Width = 97
Width = 72
Caption = 'Match case'
OnClick = CheckBoxMatchCaseClick
TabOrder = 1
@ -419,38 +419,34 @@ object Form1: TForm1
end
object SplitterFunctionList: TSplitter
Left = 150
Height = 291
Height = 294
Top = 0
Width = 5
OnCanResize = SplitterFunctionListCanResize
Visible = False
end
inline frmFunctionList: TFunctionListFrame
Height = 291
Height = 294
Width = 150
ClientHeight = 291
ClientHeight = 294
ClientWidth = 150
OnEndDock = nil
TabOrder = 3
inherited FunctionList: TTreeView
Height = 242
Top = 22
Height = 255
Width = 150
DefaultItemHeight = 19
OnChange = FunctionListChange
OnEnter = FunctionListEnter
OnExit = FunctionListExit
end
inherited editSearchList: TEdit
Height = 27
Top = 264
Top = 273
Width = 150
OnExit = editSearchListExit
OnKeyDown = editSearchListKeyDown
OnKeyPress = editSearchListKeyPress
end
inherited FunctionListLabel: TLabel
Height = 18
Width = 146
end
end
@ -2697,6 +2693,7 @@ object Form1: TForm1
object ActionStopScript: TAction
Caption = '&Stop'
OnExecute = ActionStopExecute
ShortCut = 113
end
object ActionSaveAll: TAction
Caption = 'Save All'

View File

@ -1,9 +1,9 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'K'#1#6'Height'#3'+'#2#3'Top'#3#150#0#5'Wi'
+'dth'#3#227#2#13'ActiveControl'#7#11'ScriptPanel'#14'AllowDropFiles'#9#7'Cap'
+'tion'#6#16'THA FUKING SIMBA'#12'ClientHeight'#3#23#2#11'ClientWidth'#3#227#2
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'Y'#1#6'Height'#3'+'#2#3'Top'#3#4#1#5'Widt'
+'h'#3#227#2#13'ActiveControl'#7#11'ScriptPanel'#14'AllowDropFiles'#9#7'Capti'
+'on'#6#16'THA FUKING SIMBA'#12'ClientHeight'#3#23#2#11'ClientWidth'#3#227#2
+#10'KeyPreview'#9#4'Menu'#7#8'MainMenu'#7'OnClose'#7#9'FormClose'#8'OnCreate'
+#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#11'OnDropFiles'#7#13'FormDr'
+'opFiles'#10'OnShortCut'#7#13'FormShortCuts'#10'LCLVersion'#6#6'0.9.29'#7'Vi'
@ -2814,77 +2814,77 @@ LazarusResources.Add('TForm1','FORMDATA',[
+#15'ActionRunScript'#7'Caption'#6#4'&Run'#9'OnExecute'#7#16'ActionRunExecute'
+#8'ShortCut'#2'x'#0#0#7'TAction'#17'ActionPauseScript'#7'Caption'#6#6'&Pause'
+#9'OnExecute'#7#18'ActionPauseExecute'#0#0#7'TAction'#16'ActionStopScript'#7
+'Caption'#6#5'&Stop'#9'OnExecute'#7#17'ActionStopExecute'#0#0#7'TAction'#13
+'ActionSaveAll'#7'Caption'#6#8'Save All'#10'ImageIndex'#2#21#9'OnExecute'#7
+#20'ActionSaveAllExecute'#8'ShortCut'#3'S`'#0#0#7'TAction'#16'ActionClearDeb'
,'ug'#7'Caption'#6#5'Clear'#10'ImageIndex'#2#4#9'OnExecute'#7#23'ActionClearD'
+'ebugExecute'#0#0#7'TAction'#15'ActionFindStart'#7'Caption'#6#9'&Find ...'#10
+'ImageIndex'#2#26#9'OnExecute'#7#22'ActionFindstartExecute'#8'ShortCut'#3'F@'
+#0#0#7'TAction'#9'ActionCut'#7'Caption'#6#4'Cu&t'#10'ImageIndex'#2#3#9'OnExe'
+'cute'#7#16'ActionCutExecute'#0#0#7'TAction'#10'ActionCopy'#7'Caption'#6#5'&'
+'Copy'#10'ImageIndex'#2#22#9'OnExecute'#7#17'ActionCopyExecute'#0#0#7'TActio'
+'n'#11'ActionPaste'#7'Caption'#6#6'&Paste'#10'ImageIndex'#2#11#9'OnExecute'#7
+#18'ActionPasteExecute'#0#0#7'TAction'#12'ActionDelete'#7'Caption'#6#7'&Dele'
+'te'#10'ImageIndex'#2#23#9'OnExecute'#7#19'ActionDeleteExecute'#8'ShortCut'#2
+'.'#0#0#7'TAction'#15'ActionSelectAll'#7'Caption'#6#11'&Select All'#9'OnExec'
+'ute'#7#22'ActionSelectAllExecute'#8'ShortCut'#3'A@'#0#0#7'TAction'#10'Actio'
+'nUndo'#7'Caption'#6#5'&Undo'#10'ImageIndex'#2#18#9'OnExecute'#7#17'ActionUn'
+'doExecute'#8'ShortCut'#3'Z@'#0#0#7'TAction'#10'ActionRedo'#7'Caption'#6#5'&'
+'Redo'#10'ImageIndex'#2#12#9'OnExecute'#7#17'ActionRedoExecute'#8'ShortCut'#3
+'Y@'#0#0#7'TAction'#14'ActionFindNext'#7'Caption'#6#10'Find &next'#9'OnExecu'
+'te'#7#21'ActionFindNextExecute'#8'ShortCut'#2'r'#0#0#7'TAction'#13'ActionRe'
+'place'#7'Caption'#6#11'R&eplace...'#9'OnExecute'#7#20'ActionReplaceExecute'
+#8'ShortCut'#3'R@'#0#0#7'TAction'#10'ActionExit'#7'Caption'#6#5'&Exit'#10'Im'
+'ageIndex'#2#25#9'OnExecute'#7#17'ActionExitExecute'#0#0#7'TAction'#19'Actio'
+'nCompileScript'#7'Caption'#6#19'ActionCompileScript'#9'OnExecute'#7#26'Acti'
+'onCompileScriptExecute'#8'ShortCut'#3'x@'#0#0#7'TAction'#16'ActionNormalSiz'
+'e'#7'Caption'#6#16'ActionNormalSize'#9'OnExecute'#7#23'ActionNormalSizeExec'
+'ute'#8'ShortCut'#3'B@'#0#0#7'TAction'#13'ActionConsole'#7'Caption'#6#13'Act'
+'ionConsole'#10'ImageIndex'#2#27#9'OnExecute'#7#20'ActionConsoleExecute'#0#0
+#0#6'TTimer'#10'DebugTimer'#7'OnTimer'#7#18'ProcessDebugStream'#4'left'#3'8'
+#2#3'top'#2'h'#0#0#10'TPopupMenu'#11'ScriptPopup'#6'Images'#7#17'Mufasa_Imag'
+'e_List'#7'OnPopup'#7#16'ScriptPopupPopup'#4'left'#3'8'#2#3'top'#3#144#0#0#9
+'TMenuItem'#13'PopupItemUndo'#6'Action'#7#10'ActionUndo'#11'Bitmap.Data'#10
+':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0
+' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#24#166#195
+'i'#26#167#196'i'#0#160#196#24#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#160#196']f'#219
+#234#178#17#166#194#174#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#160#196'"C'#196#219#252
+'C'#197#216#254'#'#166#192#127#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#14#170#203
+#254']'#218#233#254'#'#166#192#239#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#160#196#255#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#158#193
+#26#2#172#200#255#136#231#242#254#17#162#194#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#5'y}'#17#0#160#196#255'v'#237#251#255#0#160#196#255#0#0#0#0#0#0#0#0#0
+#160#196'0'#0#153#185'P'#0#160#196#201'm'#230#245#255'v'#226#239#255#25#163
+#193#255#0#0#0#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196#255'v'#237#251#255'v'#237
+#251#255#0#160#196#255#0#160#196#255#0#160#196#255#0#160#196#255#1#169#196
+#255'n'#225#238#255#15#201#223#255'i'#228#242#255#26#164#192#248#0#0#0#0#0#0
+#0#0#5'y}'#17#0#160#196#255'v'#237#251#255#4#195#218#255'v'#237#251#255'i'
+#234#249#255'i'#234#249#255'i'#234#249#255'i'#234#249#255#5#221#247#255#10
+#200#223#255#7#194#216#255'o'#220#235#255#27#163#191#244#0#0#0#0#5'y~'#17#0
+#160#196#255'y'#237#251#255'2'#226#248#255','#223#244#255#4#192#214#255#4#192
+#214#255#4#192#214#255#29#210#232#255#29#210#232#255#29#210#232#255#11#200
+#223#255'j'#229#243#255#27#171#197#248#21#160#188#203#0#0#0#0#0#160#196#255
+#173#243#251#255'/'#224#246#255'2'#226#248#255'2'#226#247#255'2'#226#247#255
+'/'#224#245#255')'#219#241#255#29#210#232#255#29#210#232#255#29#210#232#255
+'6'#217#236#255'@'#205#225#255#22#161#189#202#5'y}'#10#0#0#0#0#5'y}'#10#0#160
+#196#255#173#243#251#255'/'#224#246#255'2'#226#247#255')'#219#241#255'/'#224
+#245#255')'#219#241#255#22#205#227#255'6'#217#236#255'i'#231#246#255'A'#206
+#227#254#19#163#193#228#5'y}2'#0#0#0#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196#255
+#173#243#251#255'1'#225#246#255' '#227#250#255's'#236#250#255'o'#235#250#255
+'n'#232#247#255'l'#232#247#248#20#161#188#212#20#163#193#213#5'y}'#28#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196#255#173#243#251#255'%'
+#228#251#255#0#160#196#255#0#160#196#255#19#161#190#231#21#159#187#207#27#161
+#187#164#6'z|'#11#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#5
+'y}'#17#0#160#196#255#173#243#251#255#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0
+'Caption'#6#5'&Stop'#9'OnExecute'#7#17'ActionStopExecute'#8'ShortCut'#2'q'#0
+#0#7'TAction'#13'ActionSaveAll'#7'Caption'#6#8'Save All'#10'ImageIndex'#2#21
+#9'OnExecute'#7#20'ActionSaveAllExecute'#8'ShortCut'#3'S`'#0#0#7'TAction'#16
,'ActionClearDebug'#7'Caption'#6#5'Clear'#10'ImageIndex'#2#4#9'OnExecute'#7#23
+'ActionClearDebugExecute'#0#0#7'TAction'#15'ActionFindStart'#7'Caption'#6#9
+'&Find ...'#10'ImageIndex'#2#26#9'OnExecute'#7#22'ActionFindstartExecute'#8
+'ShortCut'#3'F@'#0#0#7'TAction'#9'ActionCut'#7'Caption'#6#4'Cu&t'#10'ImageIn'
+'dex'#2#3#9'OnExecute'#7#16'ActionCutExecute'#0#0#7'TAction'#10'ActionCopy'#7
+'Caption'#6#5'&Copy'#10'ImageIndex'#2#22#9'OnExecute'#7#17'ActionCopyExecute'
+#0#0#7'TAction'#11'ActionPaste'#7'Caption'#6#6'&Paste'#10'ImageIndex'#2#11#9
+'OnExecute'#7#18'ActionPasteExecute'#0#0#7'TAction'#12'ActionDelete'#7'Capti'
+'on'#6#7'&Delete'#10'ImageIndex'#2#23#9'OnExecute'#7#19'ActionDeleteExecute'
+#8'ShortCut'#2'.'#0#0#7'TAction'#15'ActionSelectAll'#7'Caption'#6#11'&Select'
+' All'#9'OnExecute'#7#22'ActionSelectAllExecute'#8'ShortCut'#3'A@'#0#0#7'TAc'
+'tion'#10'ActionUndo'#7'Caption'#6#5'&Undo'#10'ImageIndex'#2#18#9'OnExecute'
+#7#17'ActionUndoExecute'#8'ShortCut'#3'Z@'#0#0#7'TAction'#10'ActionRedo'#7'C'
+'aption'#6#5'&Redo'#10'ImageIndex'#2#12#9'OnExecute'#7#17'ActionRedoExecute'
+#8'ShortCut'#3'Y@'#0#0#7'TAction'#14'ActionFindNext'#7'Caption'#6#10'Find &n'
+'ext'#9'OnExecute'#7#21'ActionFindNextExecute'#8'ShortCut'#2'r'#0#0#7'TActio'
+'n'#13'ActionReplace'#7'Caption'#6#11'R&eplace...'#9'OnExecute'#7#20'ActionR'
+'eplaceExecute'#8'ShortCut'#3'R@'#0#0#7'TAction'#10'ActionExit'#7'Caption'#6
+#5'&Exit'#10'ImageIndex'#2#25#9'OnExecute'#7#17'ActionExitExecute'#0#0#7'TAc'
+'tion'#19'ActionCompileScript'#7'Caption'#6#19'ActionCompileScript'#9'OnExec'
+'ute'#7#26'ActionCompileScriptExecute'#8'ShortCut'#3'x@'#0#0#7'TAction'#16'A'
+'ctionNormalSize'#7'Caption'#6#16'ActionNormalSize'#9'OnExecute'#7#23'Action'
+'NormalSizeExecute'#8'ShortCut'#3'B@'#0#0#7'TAction'#13'ActionConsole'#7'Cap'
+'tion'#6#13'ActionConsole'#10'ImageIndex'#2#27#9'OnExecute'#7#20'ActionConso'
+'leExecute'#0#0#0#6'TTimer'#10'DebugTimer'#7'OnTimer'#7#18'ProcessDebugStrea'
+'m'#4'left'#3'8'#2#3'top'#2'h'#0#0#10'TPopupMenu'#11'ScriptPopup'#6'Images'#7
+#17'Mufasa_Image_List'#7'OnPopup'#7#16'ScriptPopupPopup'#4'left'#3'8'#2#3'to'
+'p'#3#144#0#0#9'TMenuItem'#13'PopupItemUndo'#6'Action'#7#10'ActionUndo'#11'B'
+'itmap.Data'#10':'#4#0#0'6'#4#0#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0
+#0#16#0#0#0#1#0' '#0#0#0#0#0#0#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
,#0#0#157#191#20#0#160#196#255#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#24#166#195'i'#26#167#196'i'#0#160#196#24#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#7'OnClick'#7#17'ActionUndoExecute'#0#0#9'TMenuItem'#13
+#160#196']f'#219#234#178#17#166#194#174#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#160#196
+'"C'#196#219#252'C'#197#216#254'#'#166#192#127#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#14#170#203#254']'#218#233#254'#'#166#192#239#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#160#196#255#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#158#193#26#2#172#200#255#136#231#242#254#17#162#194#255#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196#255'v'#237#251#255#0#160#196#255#0#0#0
+#0#0#0#0#0#0#160#196'0'#0#153#185'P'#0#160#196#201'm'#230#245#255'v'#226#239
+#255#25#163#193#255#0#0#0#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196#255'v'#237#251
+#255'v'#237#251#255#0#160#196#255#0#160#196#255#0#160#196#255#0#160#196#255#1
+#169#196#255'n'#225#238#255#15#201#223#255'i'#228#242#255#26#164#192#248#0#0
+#0#0#0#0#0#0#5'y}'#17#0#160#196#255'v'#237#251#255#4#195#218#255'v'#237#251
+#255'i'#234#249#255'i'#234#249#255'i'#234#249#255'i'#234#249#255#5#221#247
+#255#10#200#223#255#7#194#216#255'o'#220#235#255#27#163#191#244#0#0#0#0#5'y~'
+#17#0#160#196#255'y'#237#251#255'2'#226#248#255','#223#244#255#4#192#214#255
+#4#192#214#255#4#192#214#255#29#210#232#255#29#210#232#255#29#210#232#255#11
+#200#223#255'j'#229#243#255#27#171#197#248#21#160#188#203#0#0#0#0#0#160#196
+#255#173#243#251#255'/'#224#246#255'2'#226#248#255'2'#226#247#255'2'#226#247
+#255'/'#224#245#255')'#219#241#255#29#210#232#255#29#210#232#255#29#210#232
+#255'6'#217#236#255'@'#205#225#255#22#161#189#202#5'y}'#10#0#0#0#0#5'y}'#10#0
+#160#196#255#173#243#251#255'/'#224#246#255'2'#226#247#255')'#219#241#255'/'
+#224#245#255')'#219#241#255#22#205#227#255'6'#217#236#255'i'#231#246#255'A'
+#206#227#254#19#163#193#228#5'y}2'#0#0#0#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196
+#255#173#243#251#255'1'#225#246#255' '#227#250#255's'#236#250#255'o'#235#250
+#255'n'#232#247#255'l'#232#247#248#20#161#188#212#20#163#193#213#5'y}'#28#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#5'y}'#17#0#160#196#255#173#243#251#255
+'%'#228#251#255#0#160#196#255#0#160#196#255#19#161#190#231#21#159#187#207#27
+#161#187#164#6'z|'#11#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#5'y}'#17#0#160#196#255#173#243#251#255#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
,#0#0#0#157#191#20#0#160#196#255#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#160#196#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+#0#0#0#0#0#0#0#0#0#0#0#7'OnClick'#7#17'ActionUndoExecute'#0#0#9'TMenuItem'#13
+'PopupItemRedo'#6'Action'#7#10'ActionRedo'#11'Bitmap.Data'#10':'#4#0#0'6'#4#0
+#0'BM6'#4#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#16#0#0#0#16#0#0#0#1#0' '#0#0#0#0#0#0
+#4#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#0#0#0#0#0#160#196#24

View File

@ -41,11 +41,11 @@ uses
SynExportHTML, SynEditKeyCmds, SynEditHighlighter,
SynEditMarkupHighAll, LMessages, Buttons,
stringutil,mufasatypesutil,mufasabase,
about, framefunctionlist, ocr, updateform, simbasettings,
about, framefunctionlist, ocr, updateform, simbasettings, pseventextension,
extensionmanager;
const
SimbaVersion = 585;
SimbaVersion = 587;
type
@ -188,7 +188,6 @@ type
MenuItemUndo: TMenuItem;
MenuItemSave: TMenuItem;
Mufasa_Image_List: TImageList;
MainMenu1: TMainMenu;
MenuItemScript: TMenuItem;
MenuItemRun: TMenuItem;
PanelMemo: TPanel;
@ -388,6 +387,9 @@ const
var
Form1: TForm1;
MainDir : string;
{$ifdef MSWindows}
PrevWndProc : WNDPROC;
{$endif}
CurrentSyncInfo : TSyncInfo;//We need this for SafeCallThread
implementation
@ -404,6 +406,19 @@ begin
TThread.Synchronize(nil,@Form1.Close);
Result := true;
end;
function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam;
lParam: LParam): LRESULT stdcall;
begin
if uMsg = WM_HOTKEY then
begin
Form1.ActionStopScript.Execute;
Result := 0;
end else
Result := Windows.CallWindowProc(PrevWndProc,Ahwnd, uMsg, WParam, LParam);
end;
{$endif}
var
@ -1216,9 +1231,7 @@ begin
if CurrScript.SynEdit.Focused or ScriptPopup.HandleAllocated then
CurrScript.SynEdit.CopyToClipboard
else if Memo1.Focused then
Memo1.CopyToClipboard
{ else
Writeln(Sender.ToString); }
Memo1.CopyToClipboard;
end;
procedure TForm1.ActionCutExecute(Sender: TObject);
@ -1645,11 +1658,15 @@ begin
RecentFiles := TStringList.Create;
SimbaSettingsFile := MainDir + DS + 'settings.xml';
{$ifdef MSWindows}
ConsoleVisible := False;
ConsoleVisible := True;
PrevWndProc := Windows.WNDPROC(GetWindowLong(self.handle,GWL_WNDPROC));
SetWindowLong(Self.Handle,GWL_WNDPROC,PtrInt(@WndCallback));
if not RegisterHotkey(Self.Handle,0,MOD_CONTROL or MOD_ALT,VK_S) then
mDebugLn('Unable to register ctrl + alt + s as global hotkey');
{$else}
TT_Console.Visible:= false;
InitmDebug;
{$endif}
InitmDebug;
if FileExists(SimbaSettingsFile) then
begin
Application.CreateForm(TSettingsForm,SettingsForm);
@ -1702,10 +1719,13 @@ begin
Picker.Free;
Manager.Free;
PluginsGlob.Free;
SetLength(DebugStream, 0);
RecentFiles.Free;
DebugCriticalSection.Free;
{$ifdef MSWindows}
if not UnRegisterHotkey(Self.Handle,0) then
mDebugLn('Unable to unregister ctrl + alt + s as global hotkey');
{$endif}
end;
procedure TForm1.FormShortCuts(var Msg: TLMKey; var Handled: Boolean);
@ -1961,7 +1981,6 @@ end;
procedure TForm1.OnLinePSScript(Sender: TObject);
begin
//Writeln('We just completed a line!!');
{$IFDEF ProcessMessages}
Application.ProcessMessages; //Don't think that this is neccesary though
{$ENDIF}
@ -2007,18 +2026,8 @@ begin
end;
procedure TForm1.ButtonTrayClick(Sender: TObject);
{var
Ext: TSimbaPSEventExtension; }
{ FIXME: Turning it into a test button again... }
begin
Form1.Hide;
{ try
Ext := TSimbaPSEventExtension.Create(MainDir + DS + 'Extensions' + DS + 'test.pas');
Ext.Free;
except
Writeln('Something went wrong with the Extensions.');
end; }
end;
procedure TForm1.PageControl1Changing(Sender: TObject; var AllowChange: Boolean
@ -2131,22 +2140,26 @@ function TForm1.CreateSetting(Key: string; Value: string): string;
begin
result := SettingsForm.Settings.GetSetDefaultKeyValue(Key,value);
end;
{$ifdef mswindows}
function GetConsoleWindow: HWND; stdcall; external kernel32 name 'GetConsoleWindow';
procedure TForm1.ShowConsole(ShowIt: boolean);
var
ProcessId : DWOrd;
begin
if ShowIt = ConsoleVisible then
Exit;
if showit then //Console is hidden, get it back!
//Check if the console is ours (if it's not, do not hide it!!
GetWindowThreadProcessId(GetConsoleWindow,ProcessId);
if ProcessId = GetCurrentProcessId then
begin
AllocConsole;
InitmDebug;//Make sure mDebugLn works correctly!
if showit then
ShowWindow(GetConsoleWindow,SW_SHOWNA)
else
ShowWindow(GetConsoleWindow,sw_hide);
ConsoleVisible:= ShowIt;
end else
begin
FreeConsole;
FreemDebug;
end;
ConsoleVisible:= ShowIt;
Writeln('You cannot hide the window, since its not created by Simba');
end;
{$endif}

View File

@ -222,10 +222,10 @@ begin
DownloadSpeed.Visible := false;
Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+'%... Simba did not succesfully update.');
// more detailed info
writeln('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files');
mDebugLn('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files');
if FileExists(Updater.BasePath + Updater.ReplacementFile + '_') then
begin
Writeln(Format('Deleting the ghost file (%s)',[Updater.BasePath + Updater.ReplacementFile + '_']));
Self.UpdateLog.Lines.Add(Format('Deleting the ghost file (%s)',[Updater.BasePath + Updater.ReplacementFile + '_']));
DeleteFile(Updater.BasePath + Updater.ReplacementFile + '_');
end;
end;

View File

@ -276,7 +276,9 @@ begin;
end;
function FindBitmapMaskTolerance(mask: Integer; out x, y: Integer; xs, ys, xe, ye: Integer; Tolerance, ContourTolerance: Integer): Boolean; extdecl;
begin;
{$ifdef mDebug}
mDebugLn('Better be using FindMaskTolerance in combination with CreateMaskFromBitmap, more efficient.');
{$endif}
with CurrThread.Client do
result := MFinder.FindMaskTolerance(MBitmaps[mask].CreateTMask,x,y,xs,ys,xe,ye,tolerance,contourtolerance);
end;

View File

@ -21,9 +21,14 @@
Other.inc for the Mufasa Macro Library
}
function psSetScriptProp(Name: String; Value: String): boolean;
function psSetScriptProp(prop : TSP_Property; Value: String): boolean; extdecl;
begin
Exit(CurrThread.Prop.SetProp(Name, Value));
Exit(CurrThread.Prop.SetProp(prop, Value));
end;
function psGetScriptProp(prop : TSP_Property; var Value : string) : boolean; extdecl;
begin;
exit(CurrThread.Prop.GetProp(prop,value));
end;
procedure psWait(t: Integer); extdecl;

View File

@ -55,6 +55,8 @@ Sender.Comp.AddTypeS('TStringArray','Array of string;');
Sender.Comp.AddTypeS('TMousePress', '(mouse_Down, mouse_Up);');
Sender.Comp.AddTypeS('Pointer', 'Integer');
Sender.Comp.AddTypeS('TSP_Property','(SP_WriteTimeStamp)');
Sender.Comp.AddConstantN('mouse_Right','integer').SetInt(ps_mouse_right); //0
Sender.Comp.AddConstantN('mouse_Left','integer').SetInt(ps_mouse_left);//1

View File

@ -130,7 +130,8 @@ AddFunction(@ps_Random,'function Random(Int: integer): integer;');
AddFunction(@ClearDebug,'procedure ClearDebug;');
AddFunction(@PlaySound,'procedure PlaySound( Sound : string);');
AddFunction(@StopSound,'Procedure StopSound;');
AddFunction(@psSetScriptProp, 'function psSetScriptProp(Name: String; Value: String): boolean;');
AddFunction(@psSetScriptProp, 'function SetScriptProp(Prop : TSP_Property; Value: String): boolean;');
AddFunction(@psGetScriptProp, 'function GetScriptProp(Prop : TSP_Property;var Value: String): boolean;');

View File

@ -7,22 +7,40 @@ interface
uses
Classes, SysUtils;
type
{ TScriptProperties }
TSP_Property = (
SP_WriteTimeStamp //Writes the time infront of a writeln
);
TSP_Properties = set of TSP_Property;
TScriptProperties = class(TObject)
private
FProperties : TSP_Properties;
FWriteTimeStamp : boolean;
public
constructor Create;
destructor Destroy; override;
function SetProp(Name: String; Value: String): Boolean;
constructor Create;
destructor Destroy; override;
function GetProperty(name: ansistring; var Prop : TSP_Property): boolean;
function GetProp(name: ansistring; var Value : ansistring) : Boolean;overload;
function GetProp(Prop : TSP_Property; var Value : ansistring) : Boolean;overload;
function SetProp(Name: ansistring; Value: ansistring): Boolean;overload;
function SetProp(Prop : TSP_Property; Value: ansistring): Boolean;overload;
public
WriteTimeStamp: Boolean;
property WriteTimeStamp : boolean read FWriteTimeStamp;
end;
implementation
constructor TScriptProperties.Create;
begin
inherited;
WriteTimeStamp := False;
FWriteTimeStamp := False;
FProperties := [];
{ set default values }
end;
@ -32,21 +50,61 @@ begin
inherited Destroy;
end;
function TScriptProperties.SetProp(Name: String; Value: String): Boolean;
function TScriptProperties.GetProperty(name: ansistring; var Prop : TSP_Property): boolean;
const
Names : array[TSP_Property] of ansistring = ('writetimestamp');
var
i : integer;
begin
{
Fucking hell. We can't use a String in case statement, and we cannot define
hash maps as constants, and we also cannot use variables in case statements.
}
Name := LowerCase(Name);
if Name = 'writetimestamp' then
begin
WriteTimeStamp := LowerCase(Value) = 'true';
Exit(True);
Result := false;
for i := 0 to length(names)- 1 do
if lowercase(name) = Names[TSP_Property(i)] then
begin
Prop := (TSP_Property(i));
Exit(true);
end;
end;
function TScriptProperties.GetProp(name: ansistring; var Value: ansistring): Boolean;
var
Prop : TSP_Property;
begin
Result := false;
if GetProperty(name,prop) then
Result := (GetProp(Prop,value));
end;
function TScriptProperties.GetProp(Prop: TSP_Property; var Value: ansistring
): Boolean;
begin
Result := true;
case Prop of
SP_WriteTimeStamp : Value := BoolToStr(Prop in FProperties,true);
end;
end;
function TScriptProperties.SetProp(Name: ansistring; Value: ansistring): Boolean;
var
Prop : TSP_Property;
begin
Result := false;
if GetProperty(name,prop) then
Result := (SetProp(Prop,value));
end;
function TScriptProperties.SetProp(Prop: TSP_Property; Value: ansistring): Boolean;
begin
case Prop of
SP_WriteTimeStamp : if lowercase(value) = 'true' then
begin
FWriteTimeStamp:= True;
FProperties := FProperties + [Prop];
end else
begin
FWriteTimeStamp := False;
FProperties := FProperties - [Prop];
end;
end;
{more if bla }
Result := False;
end;
end.

View File

@ -390,11 +390,13 @@ begin
end;
FreeSpots[FreeSpotsHigh] := Number;
end;
{ //Just for testing purposes
//Just for testing purposes
{$ifdef mDebug}
if ToDestroy.BmpName = '' then
TClient(Self.Client).Writeln(Format('BMP[%d] has been freed.',[number]))
mDebug(Format('BMP[%d] has been freed.',[number]))
else
TClient(Self.Client).Writeln(Format('BMP[%s] has been freed.',[ToDestroy.BmpName])); }
mDebug(Format('BMP[%s] has been freed.',[ToDestroy.BmpName]));
{$endif}
ToDestroy.Free;
BmpArray[number] := nil;
end;

View File

@ -3,6 +3,7 @@ unit mufasabase;
{$mode objfpc}
interface
{$undefine mDebug}
uses
files, Classes, SysUtils{$ifdef MSWindows},windows{$endif};
@ -30,18 +31,11 @@ end;
procedure InitmDebug;
begin
CanDebug := true;
{$ifdef MSWindows}
IsConsole:= True;
SysInitStdIO;
{$endif}
end;
procedure FreemDebug;
begin
CanDebug := false;
{$ifdef MSWindows}
IsConsole := false;
{$endif}
end;
end.

View File

@ -283,8 +283,6 @@ implementation
Rect := WindowRect;
x := x + rect.left;
y := y + rect.top;
{ if (x<0) or (y<0) then
writeln('Negative coords, what now?');}
Windows.SetCursorPos(x, y);
end;
procedure TWindow.HoldMouse(x,y: integer; button: TClickType);