mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-26 11:43:58 +02:00
IDE: Editor-Macros window: added repeat for play
git-svn-id: trunk@37738 -
This commit is contained in:
parent
7754174512
commit
fd7b8d1b77
@ -1,36 +1,38 @@
|
||||
object MacroListView: TMacroListView
|
||||
Left = 390
|
||||
Height = 240
|
||||
Height = 270
|
||||
Top = 249
|
||||
Width = 350
|
||||
Width = 340
|
||||
Caption = 'MacroListView'
|
||||
ClientHeight = 240
|
||||
ClientWidth = 350
|
||||
ClientHeight = 270
|
||||
ClientWidth = 340
|
||||
Constraints.MinHeight = 270
|
||||
Constraints.MinWidth = 300
|
||||
LCLVersion = '1.1'
|
||||
object Panel1: TPanel
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
Left = 0
|
||||
Height = 194
|
||||
Height = 224
|
||||
Top = 0
|
||||
Width = 221
|
||||
Width = 211
|
||||
Align = alLeft
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 12
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 194
|
||||
ClientWidth = 221
|
||||
ClientHeight = 224
|
||||
ClientWidth = 211
|
||||
TabOrder = 0
|
||||
object lbRecordedView: TListView
|
||||
Left = 0
|
||||
Height = 172
|
||||
Height = 202
|
||||
Top = 22
|
||||
Width = 221
|
||||
Width = 211
|
||||
Align = alClient
|
||||
AutoWidthLastColumn = True
|
||||
BorderSpacing.Top = 6
|
||||
Columns = <
|
||||
item
|
||||
Width = 217
|
||||
Width = 207
|
||||
end>
|
||||
RowSelect = True
|
||||
ShowColumnHeaders = False
|
||||
@ -42,7 +44,7 @@ object MacroListView: TMacroListView
|
||||
Left = 0
|
||||
Height = 16
|
||||
Top = 0
|
||||
Width = 221
|
||||
Width = 211
|
||||
Align = alTop
|
||||
Caption = 'lblRecordedTitle'
|
||||
ParentColor = False
|
||||
@ -52,8 +54,8 @@ object MacroListView: TMacroListView
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 34
|
||||
Top = 200
|
||||
Width = 338
|
||||
Top = 230
|
||||
Width = 328
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
@ -66,16 +68,16 @@ object MacroListView: TMacroListView
|
||||
ShowButtons = [pbClose]
|
||||
end
|
||||
object pnlButtons: TPanel
|
||||
Left = 233
|
||||
Height = 194
|
||||
Left = 223
|
||||
Height = 224
|
||||
Top = 0
|
||||
Width = 117
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 194
|
||||
ClientHeight = 224
|
||||
ClientWidth = 117
|
||||
Constraints.MinHeight = 150
|
||||
Constraints.MinHeight = 220
|
||||
TabOrder = 2
|
||||
object btnSelect: TButton
|
||||
AnchorSideLeft.Control = pnlButtons
|
||||
@ -97,26 +99,6 @@ object MacroListView: TMacroListView
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnRename: TButton
|
||||
AnchorSideLeft.Control = pnlButtons
|
||||
AnchorSideTop.Control = btnPlay
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 68
|
||||
Width = 105
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'btnRename'
|
||||
OnClick = btnRenameClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnPlay: TButton
|
||||
AnchorSideLeft.Control = pnlButtons
|
||||
AnchorSideTop.Control = btnSelect
|
||||
AnchorSideTop.Side = asrBottom
|
||||
@ -132,6 +114,26 @@ object MacroListView: TMacroListView
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'btnRename'
|
||||
OnClick = btnRenameClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnPlay: TButton
|
||||
AnchorSideLeft.Control = pnlButtons
|
||||
AnchorSideTop.Control = btnRename
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = chkRepeat
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 85
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 3
|
||||
Caption = 'btnPlay'
|
||||
OnClick = btnPlayClick
|
||||
TabOrder = 2
|
||||
@ -142,11 +144,10 @@ object MacroListView: TMacroListView
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = pnlButtons
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
AnchorSideBottom.Control = btnRecordStop
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 163
|
||||
Top = 168
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
@ -163,20 +164,60 @@ object MacroListView: TMacroListView
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = btnRecord
|
||||
AnchorSideBottom.Control = pnlButtons
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 132
|
||||
Top = 199
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'btnRecordStop'
|
||||
OnClick = btnRecordStopClick
|
||||
TabOrder = 4
|
||||
Visible = False
|
||||
end
|
||||
object chkRepeat: TCheckBox
|
||||
AnchorSideLeft.Control = pnlButtons
|
||||
AnchorSideTop.Control = btnPlay
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = edRepeat
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 113
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 3
|
||||
Caption = 'chkRepeat'
|
||||
TabOrder = 5
|
||||
end
|
||||
object edRepeat: TSpinEdit
|
||||
AnchorSideLeft.Control = pnlButtons
|
||||
AnchorSideTop.Control = chkRepeat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = btnRecord
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 135
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = False
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 10
|
||||
MaxValue = 999
|
||||
MinValue = 1
|
||||
TabOrder = 6
|
||||
Value = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, SynMacroRecorder, SynEdit, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ButtonPanel, ComCtrls, ExtCtrls, MainBar, IDEWindowIntf, IDEImagesIntf,
|
||||
StdCtrls, ButtonPanel, ComCtrls, ExtCtrls, Spin, MainBar, IDEWindowIntf, IDEImagesIntf,
|
||||
LazarusIDEStrConsts, SrcEditorIntf;
|
||||
|
||||
type
|
||||
@ -43,11 +43,13 @@ type
|
||||
btnSelect: TButton;
|
||||
btnRename: TButton;
|
||||
ButtonPanel1: TButtonPanel;
|
||||
chkRepeat: TCheckBox;
|
||||
lblRecordedTitle: TLabel;
|
||||
lbRecordedView: TListView;
|
||||
Panel1: TPanel;
|
||||
pnlButtons: TPanel;
|
||||
RenameButton: TPanelBitBtn;
|
||||
edRepeat: TSpinEdit;
|
||||
procedure btnPlayClick(Sender: TObject);
|
||||
procedure btnRecordClick(Sender: TObject);
|
||||
procedure btnRecordStopClick(Sender: TObject);
|
||||
@ -58,6 +60,7 @@ type
|
||||
FImageRec: Integer;
|
||||
FImagePlay: Integer;
|
||||
FImageSel: Integer;
|
||||
FIsPlaying: Boolean;
|
||||
procedure DoOnMacroListChange(Sender: TObject);
|
||||
procedure UpdateDisplay;
|
||||
procedure UpdateButtons;
|
||||
@ -135,14 +138,32 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMacroListView.btnPlayClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if EditorMacroRecorder.State <> msStopped then exit;
|
||||
if lbRecordedView.ItemIndex < 0 then exit;
|
||||
|
||||
EditorMacroRecorder.AssignEventsFrom(EditorMacroList.Macros[lbRecordedView.ItemIndex]);
|
||||
EditorMacroRecorder.PlaybackMacro(TCustomSynEdit(SourceEditorManagerIntf.ActiveEditor.EditorControl));
|
||||
i := 1;
|
||||
if chkRepeat.Enabled then i := edRepeat.Value;
|
||||
FIsPlaying := True;
|
||||
UpdateButtons;
|
||||
Application.ProcessMessages;
|
||||
|
||||
try
|
||||
EditorMacroRecorder.AssignEventsFrom(EditorMacroList.Macros[lbRecordedView.ItemIndex]);
|
||||
while i > 0 do begin
|
||||
EditorMacroRecorder.PlaybackMacro(TCustomSynEdit(SourceEditorManagerIntf.ActiveEditor.EditorControl));
|
||||
Application.ProcessMessages;
|
||||
dec(i);
|
||||
if not FIsPlaying then break;
|
||||
end;
|
||||
finally
|
||||
FIsPlaying := False;
|
||||
EditorMacroRecorder.AssignEventsFrom(CurrentActiveMacro);
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
EditorMacroRecorder.AssignEventsFrom(CurrentActiveMacro);
|
||||
end;
|
||||
|
||||
procedure TMacroListView.btnRecordClick(Sender: TObject);
|
||||
@ -163,6 +184,7 @@ end;
|
||||
|
||||
procedure TMacroListView.btnRecordStopClick(Sender: TObject);
|
||||
begin
|
||||
FIsPlaying := False;
|
||||
EditorMacroRecorder.Stop;
|
||||
end;
|
||||
|
||||
@ -220,13 +242,18 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMacroListView.UpdateButtons;
|
||||
var
|
||||
IsStopped: Boolean;
|
||||
begin
|
||||
btnSelect.Enabled := (EditorMacroRecorder.State = msStopped) and (lbRecordedView.ItemIndex >= 0);
|
||||
btnRename.Enabled := (lbRecordedView.ItemIndex >= 0);
|
||||
btnPlay.Enabled := (lbRecordedView.ItemIndex >= 0);
|
||||
IsStopped := (EditorMacroRecorder.State = msStopped);
|
||||
btnSelect.Enabled := IsStopped and (lbRecordedView.ItemIndex >= 0) and (not FIsPlaying);
|
||||
btnRename.Enabled := IsStopped and (lbRecordedView.ItemIndex >= 0) and (not FIsPlaying);
|
||||
btnPlay.Enabled := IsStopped and (lbRecordedView.ItemIndex >= 0) and (not FIsPlaying);
|
||||
chkRepeat.Enabled := IsStopped and (not FIsPlaying);
|
||||
edRepeat.Enabled := IsStopped and (not FIsPlaying);
|
||||
|
||||
btnRecord.Enabled := (EditorMacroRecorder.State in [msStopped, msPaused, msRecording]);
|
||||
btnRecordStop.Visible := (EditorMacroRecorder.State in [msPaused, msRecording]);
|
||||
btnRecord.Enabled := (EditorMacroRecorder.State in [msStopped, msPaused, msRecording]) and (not FIsPlaying);
|
||||
btnRecordStop.Enabled := (not IsStopped) or FIsPlaying;
|
||||
|
||||
if (EditorMacroRecorder.State = msRecording) then
|
||||
btnRecord.Caption := lisPause
|
||||
@ -250,12 +277,14 @@ begin
|
||||
btnSelect.Caption := lisMenuSelect;
|
||||
btnRename.Caption := lisRename2;
|
||||
btnPlay.Caption := lisPlay;
|
||||
chkRepeat.Caption := lisRepeat;
|
||||
btnRecord.Caption := lisRecord;
|
||||
btnRecordStop.Caption := lisStop;
|
||||
lbRecordedView.SmallImages := IDEImages.Images_16;
|
||||
FImageRec := IDEImages.LoadImage(16, 'Record'); // red dot
|
||||
FImagePlay := IDEImages.LoadImage(16, 'menu_run'); // green triangle
|
||||
FImageSel := IDEImages.LoadImage(16, 'arrow_right');
|
||||
FIsPlaying := False;
|
||||
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
@ -5537,6 +5537,7 @@ resourcestring
|
||||
lisEditorMacros = 'Editor macros';
|
||||
lisPlay = 'Play';
|
||||
lisRecord = 'Record';
|
||||
lisRepeat = 'Repeat';
|
||||
|
||||
implementation
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user