diff --git a/Projects/SAMufasaGUI/framescript.pas b/Projects/SAMufasaGUI/framescript.pas index 15f44ee..ec9f03d 100644 --- a/Projects/SAMufasaGUI/framescript.pas +++ b/Projects/SAMufasaGUI/framescript.pas @@ -1,3 +1,25 @@ +{ + This file is part of the Mufasa Macro Library (MML) + Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer + + MML is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + MML is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with MML. If not, see . + + See the file COPYING, included in this distribution, + for details about the copyright. + + framescript for the Mufasa Macro Library +} unit framescript; {$mode objfpc}{$H+} @@ -120,9 +142,9 @@ procedure TScriptFrame.ErrorThread(ErrorAtLine, ErrorPosition: integer; begin MakeActiveScriptFrame; ScriptErrorLine:= ErrorAtLine; + SynEdit.Invalidate; SynEdit.SelStart:= ErrorPosition; Writeln(Format('Error: %s at line %d',[errorstr,erroratline])); - SynEdit.Invalidate; end; procedure TScriptFrame.MakeActiveScriptFrame; @@ -133,6 +155,7 @@ begin if OwnerPage.Pages[i] = OwnerSheet then begin; OwnerPage.TabIndex := i; + OwnerSheet.SetFocus; exit; end; end; diff --git a/Projects/SAMufasaGUI/project1.lpi b/Projects/SAMufasaGUI/project1.lpi index b2a749c..e387c10 100644 --- a/Projects/SAMufasaGUI/project1.lpi +++ b/Projects/SAMufasaGUI/project1.lpi @@ -7,7 +7,7 @@ <UseXPManifest Value="True"/> - <ActiveEditorIndexAtStart Value="7"/> + <ActiveEditorIndexAtStart Value="1"/> </General> <VersionInfo> <ProjectVersion Value=""/> @@ -33,16 +33,14 @@ <PackageName Value="LCL"/> </Item2> </RequiredPackages> - <Units Count="167"> + <Units Count="170"> <Unit0> <Filename Value="project1.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="project1"/> <CursorPos X="43" Y="35"/> <TopLine Value="1"/> - <EditorIndex Value="10"/> <UsageCount Value="205"/> - <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="unit1.pas"/> @@ -170,8 +168,8 @@ <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> <UnitName Value="TestUnit"/> - <CursorPos X="120" Y="12"/> - <TopLine Value="1"/> + <CursorPos X="31" Y="489"/> + <TopLine Value="486"/> <EditorIndex Value="1"/> <UsageCount Value="202"/> <Loaded Value="True"/> @@ -227,8 +225,8 @@ <Filename Value="../../Units/MMLCore/client.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="Client"/> - <CursorPos X="79" Y="41"/> - <TopLine Value="23"/> + <CursorPos X="28" Y="34"/> + <TopLine Value="25"/> <EditorIndex Value="0"/> <UsageCount Value="201"/> <Loaded Value="True"/> @@ -314,18 +312,14 @@ <UnitName Value="mmlpsthread"/> <CursorPos X="20" Y="236"/> <TopLine Value="218"/> - <EditorIndex Value="9"/> <UsageCount Value="202"/> - <Loaded Value="True"/> </Unit37> <Unit38> <Filename Value="../../Units/PascalScript/uPSComponent.pas"/> <UnitName Value="uPSComponent"/> <CursorPos X="42" Y="625"/> <TopLine Value="625"/> - <EditorIndex Value="13"/> <UsageCount Value="38"/> - <Loaded Value="True"/> </Unit38> <Unit39> <Filename Value="../../../FPC/FPCCheckout/rtl/objpas/classes/classesh.inc"/> @@ -377,17 +371,15 @@ <Unit46> <Filename Value="../../../lazarus/components/synedit/synedit.pp"/> <UnitName Value="SynEdit"/> - <CursorPos X="127" Y="1949"/> - <TopLine Value="1933"/> + <CursorPos X="19" Y="6368"/> + <TopLine Value="6343"/> <UsageCount Value="14"/> </Unit46> <Unit47> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/> <CursorPos X="73" Y="81"/> <TopLine Value="63"/> - <EditorIndex Value="11"/> <UsageCount Value="74"/> - <Loaded Value="True"/> </Unit47> <Unit48> <Filename Value="../../../FPC/FPCCheckout/rtl/win/tthread.inc"/> @@ -399,9 +391,7 @@ <Filename Value="../../../FPC/FPCCheckout/rtl/inc/objpash.inc"/> <CursorPos X="21" Y="184"/> <TopLine Value="156"/> - <EditorIndex Value="2"/> <UsageCount Value="36"/> - <Loaded Value="True"/> </Unit49> <Unit50> <Filename Value="../../Units/MMLCore/bitmaps.pas"/> @@ -483,7 +473,7 @@ <UnitName Value="IntfGraphics"/> <CursorPos X="84" Y="1334"/> <TopLine Value="1334"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </Unit61> <Unit62> <Filename Value="../../../lazarus/lcl/graphtype.pp"/> @@ -574,7 +564,7 @@ <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/mouse.inc"/> <CursorPos X="1" Y="1"/> <TopLine Value="1"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </Unit75> <Unit76> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/> @@ -587,9 +577,7 @@ <UnitName Value="uPSCompiler"/> <CursorPos X="3" Y="1696"/> <TopLine Value="1686"/> - <EditorIndex Value="12"/> <UsageCount Value="31"/> - <Loaded Value="True"/> </Unit77> <Unit78> <Filename Value="../../Units/MMLCore/macro/ColorSame.inc"/> @@ -614,9 +602,7 @@ <UnitName Value="uPSRuntime"/> <CursorPos X="1" Y="5864"/> <TopLine Value="5854"/> - <EditorIndex Value="15"/> <UsageCount Value="17"/> - <Loaded Value="True"/> </Unit81> <Unit82> <Filename Value="../../Units/MMLAddon/plugins.pas"/> @@ -679,9 +665,11 @@ <Unit91> <Filename Value="../../../lazarus/lcl/controls.pp"/> <UnitName Value="Controls"/> - <CursorPos X="14" Y="1371"/> - <TopLine Value="1356"/> - <UsageCount Value="8"/> + <CursorPos X="15" Y="1937"/> + <TopLine Value="1926"/> + <EditorIndex Value="2"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> </Unit91> <Unit92> <Filename Value="../../../lazarus/lcl/include/control.inc"/> @@ -716,14 +704,14 @@ <UnitName Value="dtm"/> <CursorPos X="34" Y="141"/> <TopLine Value="113"/> - <UsageCount Value="190"/> + <UsageCount Value="192"/> </Unit96> <Unit97> <Filename Value="../../../cogat/Units/CogatUnits/comppicker.pas"/> <UnitName Value="CompPicker"/> <CursorPos X="47" Y="240"/> <TopLine Value="213"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </Unit97> <Unit98> <Filename Value="../../Units/MMLAddon/colourpicker.pas"/> @@ -731,7 +719,7 @@ <UnitName Value="colourpicker"/> <CursorPos X="26" Y="198"/> <TopLine Value="191"/> - <UsageCount Value="186"/> + <UsageCount Value="188"/> </Unit98> <Unit99> <Filename Value="../../../cogat/Units/CogatUnits/compdragger.pas"/> @@ -756,29 +744,27 @@ <UnitName Value="windowselector"/> <CursorPos X="32" Y="12"/> <TopLine Value="31"/> - <UsageCount Value="176"/> + <UsageCount Value="178"/> </Unit101> <Unit102> <Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/objpas/classes/classesh.inc"/> <CursorPos X="3" Y="319"/> <TopLine Value="319"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </Unit102> <Unit103> <Filename Value="../../../lazarus/lcl/forms.pp"/> <UnitName Value="Forms"/> <CursorPos X="17" Y="285"/> <TopLine Value="276"/> - <EditorIndex Value="8"/> <UsageCount Value="16"/> - <Loaded Value="True"/> </Unit103> <Unit104> <Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/unix/cthreads.pp"/> <UnitName Value="cthreads"/> <CursorPos X="28" Y="1077"/> <TopLine Value="1070"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </Unit104> <Unit105> <Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/inc/threadh.inc"/> @@ -792,14 +778,14 @@ <UnitName Value="dtmutil"/> <CursorPos X="32" Y="18"/> <TopLine Value="1"/> - <UsageCount Value="163"/> + <UsageCount Value="165"/> </Unit106> <Unit107> <Filename Value="../../../cogat/Units/CogatUnits/compmaths.pas"/> <UnitName Value="CompMaths"/> <CursorPos X="15" Y="640"/> <TopLine Value="636"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </Unit107> <Unit108> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/dtm.inc"/> @@ -834,7 +820,7 @@ <UnitName Value="mmath"/> <CursorPos X="32" Y="42"/> <TopLine Value="16"/> - <UsageCount Value="143"/> + <UsageCount Value="145"/> </Unit112> <Unit113> <Filename Value="../../../Documents/fpc/rtl/objpas/types.pp"/> @@ -870,7 +856,7 @@ <UnitName Value="ocr"/> <CursorPos X="43" Y="42"/> <TopLine Value="5"/> - <UsageCount Value="113"/> + <UsageCount Value="115"/> </Unit117> <Unit118> <Filename Value="../../Units/PascalScript/uPSR_extctrls.pas"/> @@ -885,7 +871,7 @@ <UnitName Value="project"/> <CursorPos X="46" Y="15"/> <TopLine Value="1"/> - <UsageCount Value="110"/> + <UsageCount Value="112"/> </Unit119> <Unit120> <Filename Value="../../../FPC/FPCCheckout/rtl/inc/heap.inc"/> @@ -977,9 +963,7 @@ <UnitName Value="ComCtrls"/> <CursorPos X="15" Y="283"/> <TopLine Value="265"/> - <EditorIndex Value="3"/> <UsageCount Value="22"/> - <Loaded Value="True"/> </Unit134> <Unit135> <Filename Value="../../../lazarus/lcl/imglist.pp"/> @@ -993,9 +977,7 @@ <UnitName Value="uPSDebugger"/> <CursorPos X="3" Y="450"/> <TopLine Value="450"/> - <EditorIndex Value="14"/> <UsageCount Value="17"/> - <Loaded Value="True"/> </Unit136> <Unit137> <Filename Value="../../Units/MMLCore/web.pas"/> @@ -1003,7 +985,7 @@ <UnitName Value="web"/> <CursorPos X="90" Y="16"/> <TopLine Value="1"/> - <UsageCount Value="38"/> + <UsageCount Value="40"/> </Unit137> <Unit138> <Filename Value="../../../lazarus/lcl/lazhelphtml.pas"/> @@ -1122,9 +1104,7 @@ <Filename Value="../../../FPC/FPCCheckout/rtl/inc/system.inc"/> <CursorPos X="38" Y="913"/> <TopLine Value="906"/> - <EditorIndex Value="16"/> <UsageCount Value="17"/> - <Loaded Value="True"/> </Unit152> <Unit153> <Filename Value="../../../Compilertje/PascalScript/Samples/Lazarus/unit1.pas"/> @@ -1204,10 +1184,10 @@ <ComponentName Value="ScriptFrame"/> <ResourceBaseClass Value="Frame"/> <UnitName Value="framescript"/> - <CursorPos X="65" Y="151"/> - <TopLine Value="114"/> - <EditorIndex Value="7"/> - <UsageCount Value="31"/> + <CursorPos X="26" Y="125"/> + <TopLine Value="107"/> + <EditorIndex Value="4"/> + <UsageCount Value="33"/> <Loaded Value="True"/> </Unit162> <Unit163> @@ -1220,148 +1200,166 @@ <Filename Value="../../../lazarus/lcl/include/pagecontrol.inc"/> <CursorPos X="15" Y="58"/> <TopLine Value="56"/> - <EditorIndex Value="4"/> <UsageCount Value="14"/> - <Loaded Value="True"/> </Unit164> <Unit165> <Filename Value="../../../lazarus/lcl/extctrls.pp"/> <UnitName Value="ExtCtrls"/> <CursorPos X="14" Y="211"/> <TopLine Value="193"/> - <EditorIndex Value="5"/> <UsageCount Value="14"/> - <Loaded Value="True"/> </Unit165> <Unit166> <Filename Value="../../../lazarus/lcl/include/customnotebook.inc"/> <CursorPos X="122" Y="456"/> <TopLine Value="446"/> - <EditorIndex Value="6"/> <UsageCount Value="14"/> - <Loaded Value="True"/> </Unit166> + <Unit167> + <Filename Value="../../../lazarus/components/synedit/syneditpointclasses.pas"/> + <UnitName Value="SynEditPointClasses"/> + <CursorPos X="36" Y="515"/> + <TopLine Value="513"/> + <UsageCount Value="10"/> + </Unit167> + <Unit168> + <Filename Value="../../../lazarus/components/synedit/synedittextbase.pas"/> + <UnitName Value="SynEditTextBase"/> + <CursorPos X="3" Y="405"/> + <TopLine Value="399"/> + <EditorIndex Value="5"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit168> + <Unit169> + <Filename Value="../../../lazarus/lcl/include/wincontrol.inc"/> + <CursorPos X="3" Y="5295"/> + <TopLine Value="5288"/> + <EditorIndex Value="3"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit169> </Units> <JumpHistory Count="30" HistoryIndex="29"> <Position1> <Filename Value="testunit.pas"/> - <Caret Line="596" Column="3" TopLine="594"/> + <Caret Line="677" Column="26" TopLine="638"/> </Position1> <Position2> <Filename Value="testunit.pas"/> - <Caret Line="278" Column="1" TopLine="230"/> + <Caret Line="159" Column="15" TopLine="131"/> </Position2> <Position3> <Filename Value="testunit.pas"/> - <Caret Line="593" Column="25" TopLine="591"/> + <Caret Line="12" Column="120" TopLine="1"/> </Position3> <Position4> <Filename Value="framescript.pas"/> - <Caret Line="41" Column="6" TopLine="15"/> + <Caret Line="124" Column="17" TopLine="78"/> </Position4> <Position5> - <Filename Value="testunit.pas"/> - <Caret Line="236" Column="138" TopLine="217"/> + <Filename Value="../../../lazarus/components/synedit/synedittextbase.pas"/> + <Caret Line="396" Column="25" TopLine="392"/> </Position5> <Position6> <Filename Value="testunit.pas"/> - <Caret Line="4" Column="143" TopLine="1"/> + <Caret Line="72" Column="38" TopLine="72"/> </Position6> <Position7> <Filename Value="testunit.pas"/> - <Caret Line="173" Column="25" TopLine="145"/> + <Caret Line="362" Column="7" TopLine="360"/> </Position7> <Position8> <Filename Value="testunit.pas"/> - <Caret Line="174" Column="25" TopLine="145"/> + <Caret Line="290" Column="16" TopLine="286"/> </Position8> <Position9> <Filename Value="testunit.pas"/> - <Caret Line="337" Column="28" TopLine="309"/> + <Caret Line="52" Column="21" TopLine="36"/> </Position9> <Position10> <Filename Value="testunit.pas"/> - <Caret Line="359" Column="28" TopLine="309"/> + <Caret Line="367" Column="10" TopLine="365"/> </Position10> <Position11> <Filename Value="testunit.pas"/> - <Caret Line="361" Column="13" TopLine="309"/> + <Caret Line="4" Column="69" TopLine="1"/> </Position11> <Position12> <Filename Value="testunit.pas"/> - <Caret Line="554" Column="13" TopLine="526"/> + <Caret Line="528" Column="9" TopLine="526"/> </Position12> <Position13> <Filename Value="testunit.pas"/> - <Caret Line="641" Column="21" TopLine="613"/> + <Caret Line="336" Column="18" TopLine="329"/> </Position13> <Position14> <Filename Value="testunit.pas"/> - <Caret Line="686" Column="19" TopLine="658"/> + <Caret Line="530" Column="9" TopLine="528"/> </Position14> <Position15> <Filename Value="testunit.pas"/> - <Caret Line="348" Column="13" TopLine="337"/> + <Caret Line="344" Column="27" TopLine="329"/> </Position15> <Position16> <Filename Value="testunit.pas"/> - <Caret Line="173" Column="26" TopLine="129"/> + <Caret Line="343" Column="30" TopLine="329"/> </Position16> <Position17> <Filename Value="testunit.pas"/> - <Caret Line="18" Column="124" TopLine="12"/> + <Caret Line="349" Column="14" TopLine="347"/> </Position17> <Position18> <Filename Value="testunit.pas"/> - <Caret Line="51" Column="121" TopLine="44"/> + <Caret Line="208" Column="28" TopLine="196"/> </Position18> <Position19> <Filename Value="testunit.pas"/> - <Caret Line="228" Column="40" TopLine="192"/> + <Caret Line="209" Column="28" TopLine="196"/> </Position19> <Position20> - <Filename Value="framescript.pas"/> - <Caret Line="47" Column="54" TopLine="22"/> + <Filename Value="testunit.pas"/> + <Caret Line="208" Column="28" TopLine="196"/> </Position20> <Position21> - <Filename Value="framescript.pas"/> - <Caret Line="16" Column="127" TopLine="7"/> + <Filename Value="testunit.pas"/> + <Caret Line="209" Column="28" TopLine="196"/> </Position21> <Position22> - <Filename Value="framescript.pas"/> - <Caret Line="76" Column="14" TopLine="48"/> + <Filename Value="testunit.pas"/> + <Caret Line="210" Column="28" TopLine="196"/> </Position22> <Position23> <Filename Value="testunit.pas"/> - <Caret Line="281" Column="1" TopLine="249"/> + <Caret Line="23" Column="108" TopLine="1"/> </Position23> <Position24> <Filename Value="testunit.pas"/> - <Caret Line="165" Column="1" TopLine="137"/> + <Caret Line="587" Column="73" TopLine="558"/> </Position24> <Position25> <Filename Value="testunit.pas"/> - <Caret Line="518" Column="19" TopLine="490"/> + <Caret Line="567" Column="29" TopLine="547"/> </Position25> <Position26> <Filename Value="testunit.pas"/> - <Caret Line="366" Column="1" TopLine="323"/> + <Caret Line="562" Column="18" TopLine="554"/> </Position26> <Position27> <Filename Value="testunit.pas"/> - <Caret Line="568" Column="9" TopLine="565"/> + <Caret Line="558" Column="20" TopLine="555"/> </Position27> <Position28> <Filename Value="testunit.pas"/> - <Caret Line="36" Column="3" TopLine="8"/> + <Caret Line="575" Column="18" TopLine="566"/> </Position28> <Position29> <Filename Value="testunit.pas"/> - <Caret Line="677" Column="26" TopLine="638"/> + <Caret Line="553" Column="33" TopLine="546"/> </Position29> <Position30> <Filename Value="testunit.pas"/> - <Caret Line="159" Column="15" TopLine="131"/> + <Caret Line="499" Column="27" TopLine="486"/> </Position30> </JumpHistory> </ProjectOptions> diff --git a/Projects/SAMufasaGUI/testunit.lfm b/Projects/SAMufasaGUI/testunit.lfm index e015522..5588d13 100644 --- a/Projects/SAMufasaGUI/testunit.lfm +++ b/Projects/SAMufasaGUI/testunit.lfm @@ -1,7 +1,7 @@ object Form1: TForm1 - Left = 251 + Left = 356 Height = 553 - Top = 340 + Top = 220 Width = 723 Caption = 'Mufasa v2' ClientHeight = 533 @@ -1352,7 +1352,21 @@ object Form1: TForm1 left = 464 end object TrayPopup: TPopupMenu + Images = Mufasa_Image_List left = 600 + object TrayStop: TMenuItem + Caption = 'Stop' + OnClick = TrayStopClick + end + object TrayPause: TMenuItem + Caption = 'Pause' + Enabled = False + OnClick = TrayPauseClick + end + object TrayPlay: TMenuItem + Caption = 'Play' + OnClick = TrayPlayClick + end object MenuItemShow: TMenuItem Caption = 'Show' OnClick = MenuItemShowClick diff --git a/Projects/SAMufasaGUI/testunit.lrs b/Projects/SAMufasaGUI/testunit.lrs index 7a9ecd8..bb48c52 100644 --- a/Projects/SAMufasaGUI/testunit.lrs +++ b/Projects/SAMufasaGUI/testunit.lrs @@ -1,5 +1,7 @@ +{ This is an automatically generated lazarus resource file } + LazarusResources.Add('TForm1','FORMDATA',[ - 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#251#0#6'Height'#3')'#2#3'Top'#3'T'#1#5'Wi' + 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'd'#1#6'Height'#3')'#2#3'Top'#3#220#0#5'Wi' +'dth'#3#211#2#7'Caption'#6#9'Mufasa v2'#12'ClientHeight'#3#21#2#11'ClientWid' +'th'#3#211#2#4'Menu'#7#9'MainMenu1'#7'OnClose'#7#9'FormClose'#8'OnCreate'#7 +#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#8'Position'#7#14'poScreenCent' @@ -1440,7 +1442,11 @@ LazarusResources.Add('TForm1','FORMDATA',[ +#0#0#0#0#0#0#0#240#0#0#0#224#0#0#0#224#0#0#0#224#0#0#0#224#0#0#0#224#0#0#0 +#224#0#0#0#240#0#0#0#240#1#0#0#240#3#0#0#240#7#0#0#248#15#0#0#254#31#0#0#255 +#255#0#0#7'Visible'#9#7'OnClick'#7#6'NoTray'#4'left'#3#208#1#0#0#10'TPopupMe' - +'nu'#9'TrayPopup'#4'left'#3'X'#2#0#9'TMenuItem'#12'MenuItemShow'#7'Caption'#6 - +#4'Show'#7'OnClick'#7#17'MenuItemShowClick'#0#0#9'TMenuItem'#12'MenuItemExit' - +#7'Caption'#6#4'Exit'#7'OnClick'#7#17'MenuItemExitClick'#0#0#0#0 + +'nu'#9'TrayPopup'#6'Images'#7#17'Mufasa_Image_List'#4'left'#3'X'#2#0#9'TMenu' + +'Item'#8'TrayStop'#7'Caption'#6#4'Stop'#7'OnClick'#7#13'TrayStopClick'#0#0#9 + +'TMenuItem'#9'TrayPause'#7'Caption'#6#5'Pause'#7'Enabled'#8#7'OnClick'#7#14 + +'TrayPauseClick'#0#0#9'TMenuItem'#8'TrayPlay'#7'Caption'#6#4'Play'#7'OnClick' + +#7#13'TrayPlayClick'#0#0#9'TMenuItem'#12'MenuItemShow'#7'Caption'#6#4'Show'#7 + +'OnClick'#7#17'MenuItemShowClick'#0#0#9'TMenuItem'#12'MenuItemExit'#7'Captio' + +'n'#6#4'Exit'#7'OnClick'#7#17'MenuItemExitClick'#0#0#0#0 ]); diff --git a/Projects/SAMufasaGUI/testunit.pas b/Projects/SAMufasaGUI/testunit.pas index 0e4cf55..aab523b 100644 --- a/Projects/SAMufasaGUI/testunit.pas +++ b/Projects/SAMufasaGUI/testunit.pas @@ -62,6 +62,9 @@ type Memo1: TMemo; MenuFile: TMenuItem; MenuEdit: TMenuItem; + TrayPlay: TMenuItem; + TrayStop: TMenuItem; + TrayPause: TMenuItem; MenuItemPause: TMenuItem; MenuItemStop: TMenuItem; MenuItemShow: TMenuItem; @@ -137,6 +140,9 @@ type procedure ButtonStopClick(Sender: TObject); procedure ButtonTrayClick(Sender: TObject); procedure MenuItemUndoClick(Sender: TObject); + procedure TrayPauseClick(Sender: TObject); + procedure TrayPlayClick(Sender: TObject); + procedure TrayStopClick(Sender: TObject); private function GetScriptState: TScriptState; procedure SetScriptState(const State: TScriptState); @@ -205,6 +211,7 @@ begin Writeln('The script hasn''t stopped yet, so we cannot start a new one.'); exit; end; + ScriptErrorLine:= -1; CurrentSyncInfo.SyncMethod:= @Self.SafeCallThread; ScriptThread := TMMLPSThread.Create(True,@CurrentSyncInfo); ScriptThread.SetPSScript(CurrScript.SynEdit.Lines.Text); @@ -340,6 +347,8 @@ begin StatusBar.Panels[Panel_ScriptName].Text:= Script.ScriptName; StatusBar.Panels[Panel_ScriptPath].text:= Script.ScriptFile; SetScriptState(Tab.ScriptFrame.FScriptState);//To set the buttons right + if Self.Showing then + CurrScript.SynEdit.SetFocus; end; procedure TForm1.ButtonRunClick(Sender: TObject); @@ -477,6 +486,7 @@ end; procedure TForm1.MenuItemShowClick(Sender: TObject); begin Self.Show; + Self.WindowState := wsNormal; end; procedure TForm1.MenuItemStopClick(Sender: TObject); @@ -544,6 +554,21 @@ begin CurrScript.Undo; end; +procedure TForm1.TrayPauseClick(Sender: TObject); +begin + Self.PauseScript; +end; + +procedure TForm1.TrayPlayClick(Sender: TObject); +begin + Self.RunScript; +end; + +procedure TForm1.TrayStopClick(Sender: TObject); +begin + Self.StopScript; +end; + function TForm1.GetScriptState: TScriptState; begin result := CurrScript.FScriptState; @@ -554,10 +579,26 @@ begin CurrScript.FScriptState:= State; with Self.StatusBar.panels[Panel_State] do case state of - ss_Running : begin Text := 'Running'; TB_Run.Enabled:= False; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} TB_Stop.ImageIndex := Image_Stop; TB_Stop.Enabled:= True; end; - ss_Paused : begin Text := 'Paused'; TB_Run.Enabled:= True; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} TB_Stop.ImageIndex := Image_Stop; 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_None : begin Text := 'Done'; TB_Run.Enabled:= True; TB_Pause.Enabled:= False; TB_Stop.Enabled:= False; TB_Stop.ImageIndex := Image_Stop end; + ss_Running : begin Text := 'Running'; TB_Run.Enabled:= False; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} + TB_Stop.ImageIndex := Image_Stop; TB_Stop.Enabled:= True; + TrayPlay.Checked := True; TrayPlay.Enabled := False; {$ifdef MSWindows}TrayPause.Checked := false; TrayPause.Enabled := True;{$endif} + TrayStop.Enabled:= True; TrayStop.Checked:= False; + end; + ss_Paused : begin Text := 'Paused'; TB_Run.Enabled:= True; {$ifdef MSWindows}TB_Pause.Enabled:= True; {$endif} + TB_Stop.ImageIndex := Image_Stop; TB_Stop.Enabled:= True; + TrayPlay.Checked := false; TrayPlay.Enabled := True; {$ifdef MSWindows}TrayPause.Checked := True; TrayPause.Enabled := True;{$endif} + TrayStop.Enabled:= True; TrayStop.Checked:= False; + end; + ss_Stopping: begin Text := 'Stopping';TB_Run.Enabled:= False; TB_Pause.Enabled:= False; TB_Stop.Enabled:= True; + TB_Stop.ImageIndex := Image_Terminate; + TrayPlay.Checked := False; TrayPlay.Enabled := False; {$ifdef MSWindows}TrayPause.Checked := false; TrayPause.Enabled := False;{$endif} + TrayStop.Enabled:= True; TrayStop.Checked:= True; + end; + ss_None : begin Text := 'Done'; TB_Run.Enabled:= True; TB_Pause.Enabled:= False; TB_Stop.Enabled:= False; + TB_Stop.ImageIndex := Image_Stop; + TrayPlay.Checked := false; TrayPlay.Enabled := True; {$ifdef MSWindows}TrayPause.Checked := false; TrayPause.Enabled := False;{$endif} + TrayStop.Enabled:= false; TrayStop.Checked:= False; + end; end; end;