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 @@
-
+
@@ -33,16 +33,14 @@
-
+
-
-
@@ -170,8 +168,8 @@
-
-
+
+
@@ -227,8 +225,8 @@
-
-
+
+
@@ -314,18 +312,14 @@
-
-
-
-
@@ -377,17 +371,15 @@
-
-
+
+
-
-
@@ -399,9 +391,7 @@
-
-
@@ -483,7 +473,7 @@
-
+
@@ -574,7 +564,7 @@
-
+
@@ -587,9 +577,7 @@
-
-
@@ -614,9 +602,7 @@
-
-
@@ -679,9 +665,11 @@
-
-
-
+
+
+
+
+
@@ -716,14 +704,14 @@
-
+
-
+
@@ -731,7 +719,7 @@
-
+
@@ -756,29 +744,27 @@
-
+
-
+
-
-
-
+
@@ -792,14 +778,14 @@
-
+
-
+
@@ -834,7 +820,7 @@
-
+
@@ -870,7 +856,7 @@
-
+
@@ -885,7 +871,7 @@
-
+
@@ -977,9 +963,7 @@
-
-
@@ -993,9 +977,7 @@
-
-
@@ -1003,7 +985,7 @@
-
+
@@ -1122,9 +1104,7 @@
-
-
@@ -1204,10 +1184,10 @@
-
-
-
-
+
+
+
+
@@ -1220,148 +1200,166 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
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;