mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 21:00:23 +02:00
EditorMacros: Add a warning / Show warning if PascalScript self-test failed.
git-svn-id: trunk@62178 -
This commit is contained in:
parent
dfef4effb0
commit
094a2938ea
@ -457,6 +457,15 @@ var
|
||||
DefaultBindingClass: TEditorMacroKeyBindingClass = nil;
|
||||
EditorMacroPlayerClass: TEditorMacroClass = nil;
|
||||
|
||||
function GetMacroListViewerWarningText: String;
|
||||
procedure SetMacroListViewerWarningText(AValue: String);
|
||||
function GetMacroListViewerWarningChanged: TNotifyProcedure;
|
||||
procedure SetMacroListViewerWarningChanged(AValue: TNotifyProcedure);
|
||||
|
||||
property MacroListViewerWarningText: string read GetMacroListViewerWarningText write SetMacroListViewerWarningText;
|
||||
property MacroListViewerWarningChanged: TNotifyProcedure read GetMacroListViewerWarningChanged write SetMacroListViewerWarningChanged;
|
||||
|
||||
|
||||
type
|
||||
{ TIDEInteractiveStringValue }
|
||||
|
||||
@ -745,6 +754,36 @@ begin
|
||||
CheckStateAndActivated;
|
||||
end;
|
||||
|
||||
var
|
||||
FMacroListViewerWarningText: String;
|
||||
FMacroListViewerWarningChanged: TNotifyProcedure;
|
||||
|
||||
function GetMacroListViewerWarningText: String;
|
||||
begin
|
||||
Result := FMacroListViewerWarningText;
|
||||
end;
|
||||
|
||||
procedure SetMacroListViewerWarningText(AValue: String);
|
||||
begin
|
||||
FMacroListViewerWarningText := AValue;
|
||||
if FMacroListViewerWarningChanged <> nil then
|
||||
FMacroListViewerWarningChanged(nil);
|
||||
end;
|
||||
|
||||
function GetMacroListViewerWarningChanged: TNotifyProcedure;
|
||||
begin
|
||||
Result := FMacroListViewerWarningChanged;
|
||||
end;
|
||||
|
||||
procedure SetMacroListViewerWarningChanged(AValue: TNotifyProcedure);
|
||||
begin
|
||||
FMacroListViewerWarningChanged := AValue;
|
||||
if (FMacroListViewerWarningChanged <> nil) and
|
||||
(FMacroListViewerWarningText <> '')
|
||||
then
|
||||
FMacroListViewerWarningChanged(nil);
|
||||
end;
|
||||
|
||||
{ TEditorMacro }
|
||||
|
||||
{ TSourceEditorInterface }
|
||||
|
@ -17,6 +17,7 @@ resourcestring
|
||||
EMSBtnTestAgain = 'Test again';
|
||||
EMSNotSupported = 'Scripting not active. Not supported on this platform or CPU.';
|
||||
EMSNotActive = 'Scripting not active. Selftest failed.';
|
||||
EMSNotActiveVerbose = 'EditorMacroScript failed its self-test and is not active. Some macros may not work.';
|
||||
EMSActive = 'Scripting active.';
|
||||
EMSPending = 'Scripting not active. Selftest will run next time the IDE is '
|
||||
+'started.';
|
||||
|
@ -28,6 +28,10 @@ msgstr "Script de macro de l'éditeur"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Script inactif. L'autotest a échoué."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Script inactif. Non supporté par cette plateforme ou ce CPU."
|
||||
|
@ -27,6 +27,10 @@ msgstr "Szerkesztő Makrószkript"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Szkriptek használata kikapcsolva. Az önellenőrzés sikertelen volt."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Szkriptek használata kikapcsolva. Nem támogatott platform vagy CPU."
|
||||
|
@ -26,6 +26,10 @@ msgstr "Editor di Macro Script"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Lo scripting non è attivo. L'autotest è fallito."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Lo scripting non è attivo. Non supportato su questa piattaforma o CPU."
|
||||
|
@ -28,6 +28,10 @@ msgstr "Makrokomandos scenarijaus rengyklė"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Scenarijaus rengimas nevyksta. Savasis testas nepavyko."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Scenarijaus rengimas nevyksta. Ši platforma ar procesorius nėra palaikomi."
|
||||
|
@ -17,6 +17,10 @@ msgstr ""
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr ""
|
||||
|
@ -27,6 +27,10 @@ msgstr "Editor Macro Script"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Scripting não ativo. Autoteste falhou."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Scripting não ativo. Não é suportado nesta plataforma ou CPU."
|
||||
|
@ -25,6 +25,10 @@ msgstr "Сценарии редактора"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Сценарии отключены. Не прошло самотестирование."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Сценарии отключены. Они не поддерживаются на данной платформе."
|
||||
|
@ -29,6 +29,10 @@ msgstr "Сценарії редактора"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Сценарії не активні. Не пройшло самотестування."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Сценарії не активні. Вони не підтримуються на даній платформі або ЦП."
|
||||
|
@ -28,6 +28,10 @@ msgstr "编辑器宏脚本"
|
||||
msgid "Scripting not active. Selftest failed."
|
||||
msgstr "Scripting非激活状态.自检失败."
|
||||
|
||||
#: emsstrings.emsnotactiveverbose
|
||||
msgid "EditorMacroScript failed its self-test and is not active. Some macros may not work."
|
||||
msgstr ""
|
||||
|
||||
#: emsstrings.emsnotsupported
|
||||
msgid "Scripting not active. Not supported on this platform or CPU."
|
||||
msgstr "Scripting非活跃状态.不支持这个平台或者CPU."
|
||||
|
@ -43,6 +43,7 @@ begin
|
||||
MessageDlg(EmsSelfTestErrCaption,
|
||||
format(EmsSelfTestFailedLastTime, [LineEnding]),
|
||||
mtError, [mbOK], 0);
|
||||
MacroListViewerWarningText := EMSNotActiveVerbose;
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -56,6 +57,7 @@ begin
|
||||
mtError, [mbOK], 0);
|
||||
end;
|
||||
if conf.SelfTestFailed >= EMSVersion then begin
|
||||
MacroListViewerWarningText := EMSNotActiveVerbose;
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -76,6 +78,8 @@ begin
|
||||
MessageDlg(EmsSelfTestErrCaption,
|
||||
format(EmsSelfTestFailed, [LineEnding, SelfTestErrorMsg]),
|
||||
mtError, [mbOK], 0);
|
||||
|
||||
MacroListViewerWarningText := EMSNotActiveVerbose;
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
@ -10,11 +10,11 @@ object MacroListView: TMacroListView
|
||||
Constraints.MinWidth = 300
|
||||
OnActivate = FormActivate
|
||||
OnDeactivate = FormActivate
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Panel1: TPanel
|
||||
AnchorSideRight.Control = pnlButtons
|
||||
Left = 6
|
||||
Height = 335
|
||||
Height = 313
|
||||
Top = 6
|
||||
Width = 295
|
||||
Align = alLeft
|
||||
@ -23,12 +23,12 @@ object MacroListView: TMacroListView
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 335
|
||||
ClientHeight = 313
|
||||
ClientWidth = 295
|
||||
TabOrder = 0
|
||||
object lbMacroView: TListView
|
||||
Left = 0
|
||||
Height = 288
|
||||
Height = 266
|
||||
Top = 22
|
||||
Width = 295
|
||||
Align = alClient
|
||||
@ -103,7 +103,7 @@ object MacroListView: TMacroListView
|
||||
object ToolBar2: TToolBar
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 313
|
||||
Top = 291
|
||||
Width = 295
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
@ -116,20 +116,20 @@ object MacroListView: TMacroListView
|
||||
Left = 1
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 54
|
||||
Width = 52
|
||||
Align = alLeft
|
||||
Caption = 'lbMoveTo'
|
||||
Layout = tlCenter
|
||||
ParentColor = False
|
||||
end
|
||||
object tbMoveProject: TToolButton
|
||||
Left = 55
|
||||
Left = 53
|
||||
Top = 0
|
||||
Caption = 'tbMoveProject'
|
||||
OnClick = tbMoveProjectClick
|
||||
end
|
||||
object tbMoveIDE: TToolButton
|
||||
Left = 141
|
||||
Left = 139
|
||||
Top = 0
|
||||
Caption = 'tbMoveIDE'
|
||||
OnClick = tbMoveIDEClick
|
||||
@ -155,13 +155,13 @@ object MacroListView: TMacroListView
|
||||
end
|
||||
object pnlButtons: TPanel
|
||||
Left = 307
|
||||
Height = 341
|
||||
Height = 319
|
||||
Top = 0
|
||||
Width = 117
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 341
|
||||
ClientHeight = 319
|
||||
ClientWidth = 117
|
||||
Constraints.MinHeight = 250
|
||||
TabOrder = 1
|
||||
@ -212,7 +212,7 @@ object MacroListView: TMacroListView
|
||||
AnchorSideBottom.Control = PanelRepeat
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 200
|
||||
Top = 178
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
@ -232,7 +232,7 @@ object MacroListView: TMacroListView
|
||||
AnchorSideBottom.Control = btnRecordStop
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 285
|
||||
Top = 263
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
@ -253,7 +253,7 @@ object MacroListView: TMacroListView
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 316
|
||||
Top = 294
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
@ -332,7 +332,7 @@ object MacroListView: TMacroListView
|
||||
AnchorSideBottom.Control = btnRecord
|
||||
Left = 6
|
||||
Height = 54
|
||||
Top = 228
|
||||
Top = 206
|
||||
Width = 105
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
@ -384,6 +384,49 @@ object MacroListView: TMacroListView
|
||||
end
|
||||
end
|
||||
end
|
||||
object PanelWarnings: TPanel
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 319
|
||||
Width = 424
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 22
|
||||
ClientWidth = 424
|
||||
TabOrder = 3
|
||||
Visible = False
|
||||
object LabelWarning: TLabel
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 401
|
||||
Align = alClient
|
||||
Font.Color = clRed
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
end
|
||||
object PnlWarnClose: TPanel
|
||||
Left = 401
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 23
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 22
|
||||
ClientWidth = 23
|
||||
TabOrder = 0
|
||||
object BtnWarnClose: TSpeedButton
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 23
|
||||
OnClick = BtnWarnCloseClick
|
||||
end
|
||||
end
|
||||
end
|
||||
object PopupMenu1: TPopupMenu
|
||||
left = 144
|
||||
top = 72
|
||||
|
@ -8,7 +8,7 @@ uses
|
||||
Classes, SysUtils,
|
||||
// LCL
|
||||
LCLType, Forms, Controls, Dialogs, StdCtrls, ButtonPanel, ComCtrls, ExtCtrls,
|
||||
Spin, Menus,
|
||||
Spin, Menus, Buttons,
|
||||
// LazUtils
|
||||
LazFileUtils, Laz2_XMLCfg, LazUTF8, LazLoggerBase,
|
||||
// SynEdit
|
||||
@ -181,18 +181,22 @@ type
|
||||
ButtonPanel1: TButtonPanel;
|
||||
chkRepeat: TCheckBox;
|
||||
GroupBox1: TGroupBox;
|
||||
LabelWarning: TLabel;
|
||||
lbMoveTo: TLabel;
|
||||
lbMacroView: TListView;
|
||||
mnExport: TMenuItem;
|
||||
mnImport: TMenuItem;
|
||||
OpenDialog1: TOpenDialog;
|
||||
Panel1: TPanel;
|
||||
PnlWarnClose: TPanel;
|
||||
PanelWarnings: TPanel;
|
||||
PanelRepeat: TPanel;
|
||||
pnlButtons: TPanel;
|
||||
PopupMenu1: TPopupMenu;
|
||||
RenameButton: TPanelBitBtn;
|
||||
edRepeat: TSpinEdit;
|
||||
SaveDialog1: TSaveDialog;
|
||||
BtnWarnClose: TSpeedButton;
|
||||
ToolBar1: TToolBar;
|
||||
tbRecorded: TToolButton;
|
||||
tbProject: TToolButton;
|
||||
@ -210,6 +214,7 @@ type
|
||||
procedure btnRenameClick(Sender: TObject);
|
||||
procedure btnSelectClick(Sender: TObject);
|
||||
procedure btnSetKeysClick(Sender: TObject);
|
||||
procedure BtnWarnCloseClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure HelpButtonClick(Sender: TObject);
|
||||
procedure lbMacroViewSelectItem(Sender: TObject; {%H-}Item: TListItem; {%H-}Selected: Boolean);
|
||||
@ -282,6 +287,17 @@ begin
|
||||
if MacroListView = nil then
|
||||
MacroListView := TMacroListView.Create(Application);
|
||||
Result := MacroListView;
|
||||
|
||||
MacroListView.LabelWarning.Caption := MacroListViewerWarningText;
|
||||
MacroListView.PanelWarnings.Visible := MacroListViewerWarningText <> '';
|
||||
end;
|
||||
|
||||
procedure DoMacroListViewerWarningChanged(ASender: TObject);
|
||||
begin
|
||||
if MacroListView <> nil then begin
|
||||
MacroListView.LabelWarning.Caption := MacroListViewerWarningText;
|
||||
MacroListView.PanelWarnings.Visible := MacroListViewerWarningText <> '';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ShowMacroListViewer;
|
||||
@ -1199,6 +1215,11 @@ begin
|
||||
if OnKeyMapReloaded <> nil then OnKeyMapReloaded();
|
||||
end;
|
||||
|
||||
procedure TMacroListView.BtnWarnCloseClick(Sender: TObject);
|
||||
begin
|
||||
PanelWarnings.Visible := False;
|
||||
end;
|
||||
|
||||
procedure TMacroListView.DoMacroStateChanged(Sender: TObject);
|
||||
begin
|
||||
if OnEditorMacroStateChange <> nil then
|
||||
@ -1482,6 +1503,9 @@ begin
|
||||
FImageErr := IDEImages.LoadImage('state_error');
|
||||
FIsPlaying := False;
|
||||
|
||||
BtnWarnClose.Images := IDEImages.Images_16;
|
||||
BtnWarnClose.ImageIndex := IDEImages.LoadImage('menu_close');
|
||||
|
||||
UpdateDisplay;
|
||||
end;
|
||||
|
||||
@ -1632,6 +1656,8 @@ initialization
|
||||
EditorMacroListGlob := TEditorMacroList.Create;
|
||||
CurrentEditorMacroList := EditorMacroListRec;
|
||||
|
||||
MacroListViewerWarningChanged := @DoMacroListViewerWarningChanged;
|
||||
|
||||
finalization
|
||||
CurrentEditorMacroList := nil;
|
||||
FreeAndNil(EditorMacroListRec);
|
||||
|
Loading…
Reference in New Issue
Block a user