mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 17:01:35 +02:00
SynEdit: MacroRecorder: allow Stop method to interrupt playback
git-svn-id: trunk@37737 -
This commit is contained in:
parent
c5ebe15fc6
commit
7754174512
@ -207,6 +207,7 @@ type
|
|||||||
fMacroName: string;
|
fMacroName: string;
|
||||||
fSaveMarkerPos: boolean;
|
fSaveMarkerPos: boolean;
|
||||||
FStartPlayBack: boolean;
|
FStartPlayBack: boolean;
|
||||||
|
FStopRequested: Boolean;
|
||||||
function GetCommandIDs(Index: integer): TSynEditorCommand;
|
function GetCommandIDs(Index: integer): TSynEditorCommand;
|
||||||
function GetEvent(aIndex: integer): TSynMacroEvent;
|
function GetEvent(aIndex: integer): TSynMacroEvent;
|
||||||
function GetEventCount: integer;
|
function GetEventCount: integer;
|
||||||
@ -655,13 +656,17 @@ var
|
|||||||
begin
|
begin
|
||||||
if State <> msStopped then
|
if State <> msStopped then
|
||||||
Error( sCannotPlay );
|
Error( sCannotPlay );
|
||||||
|
FStopRequested := False;
|
||||||
fState := msPlaying;
|
fState := msPlaying;
|
||||||
try
|
try
|
||||||
StateChanged;
|
StateChanged;
|
||||||
for cEvent := 0 to EventCount -1 do
|
for cEvent := 0 to EventCount -1 do begin
|
||||||
Events[ cEvent ].Playback( aEditor );
|
Events[ cEvent ].Playback( aEditor );
|
||||||
|
if FStopRequested then break;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
fState := msStopped;
|
fState := msStopped;
|
||||||
|
FStopRequested := False;
|
||||||
StateChanged;
|
StateChanged;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -735,6 +740,10 @@ procedure TCustomSynMacroRecorder.Stop;
|
|||||||
begin
|
begin
|
||||||
if fState = msStopped then
|
if fState = msStopped then
|
||||||
Exit;
|
Exit;
|
||||||
|
if fState = msPlaying then begin
|
||||||
|
FStopRequested := True;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
fState := msStopped;
|
fState := msStopped;
|
||||||
fCurrentEditor := nil;
|
fCurrentEditor := nil;
|
||||||
if fEvents.Count = 0 then
|
if fEvents.Count = 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user