mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-24 14:31:38 +02:00
Revert r51064 #c2f0586120 which fiddled with EditorMacroSript defines.
git-svn-id: trunk@52256 -
This commit is contained in:
parent
26de115dbb
commit
8e9f6b65f5
@ -3,7 +3,6 @@
|
||||
<Package Version="4">
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="EditorMacroScript"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<Author Value="M Friebe"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
@ -13,6 +12,7 @@
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<CustomOptions Value="$(IDEBuildOptions)"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Description Value="IDE-Extension: Adds PascalScript to editor-macros.
|
||||
@ -37,21 +37,22 @@ Extends the Editors macro recorder and player. Macros can be written in pascal s
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Filename Value="emsselftest.pas"/>
|
||||
<UnitName Value="EMSSelfTest"/>
|
||||
<UnitName Value="emsselftest"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="emsideoptions.pas"/>
|
||||
<UnitName Value="EMSIdeOptions"/>
|
||||
<UnitName Value="emsideoptions"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
<Filename Value="emsstrings.pas"/>
|
||||
<UnitName Value="EMSStrings"/>
|
||||
<UnitName Value="emsstrings"/>
|
||||
</Item6>
|
||||
</Files>
|
||||
<i18n>
|
||||
<EnableI18N Value="True"/>
|
||||
<OutDir Value="languages"/>
|
||||
</i18n>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="4">
|
||||
<Item1>
|
||||
<PackageName Value="synedit"/>
|
||||
|
||||
@ -130,7 +130,7 @@ end;
|
||||
|
||||
function HandleEcCommandFoo({%H-}Caller: TPSExec; p: TPSExternalProcRec; {%H-}Global, Stack: TPSStack): Boolean;
|
||||
var
|
||||
i: PtrUInt;
|
||||
i: integer;
|
||||
pt: TPoint;
|
||||
e: TEMSTPSExec;
|
||||
begin
|
||||
@ -173,7 +173,7 @@ var
|
||||
begin
|
||||
i := 0;
|
||||
if not IdentToEditorCommand(s, i) then exit;
|
||||
RegisterFunctionName(UpperCase(s), @HandleEcCommandFoo, self, Pointer(PtrInt(i)));
|
||||
RegisterFunctionName(UpperCase(s), @HandleEcCommandFoo, self, Pointer(PtrUInt(i)));
|
||||
end;
|
||||
|
||||
procedure TEMSTPSExec.AddFuncToExec;
|
||||
@ -232,7 +232,6 @@ const
|
||||
DeclInputBox = 'Function InputBox(ACaption, APrompt, ADefault: string): string';
|
||||
DeclInputQuery = 'Function InputQuery(ACaption, APrompt: string; var Value: string): Boolean';
|
||||
|
||||
{$IFnDEF PasMacroNoNativeCalls}
|
||||
FuncMessageDlg: function(Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer = @EMS_MessageDlg;
|
||||
FuncMessageDlgPos: function(Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Integer = @EMS_MessageDlgPos;
|
||||
FuncMessageDlgPosHelp: function(Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; HelpFileName: string): Integer = @EMS_MessageDlgPosHelp;
|
||||
@ -240,9 +239,9 @@ const
|
||||
FuncShowMessagePos: procedure(Msg: string; X, Y: Integer) = @EMS_ShowMessagePos;
|
||||
FuncInputBox: function(ACaption, APrompt, ADefault: string): string = @EMS_InputBox;
|
||||
FuncInputQuery: function(ACaption, APrompt: string; var Value : string): Boolean = @EMS_InputQuery;
|
||||
FuncPoint: function(AX, AY: Integer): {$IFDEF NeedTPointFix}TPoint2{$ELSE}TPoint{$ENDIF} = @EMS_Point; // @Classes.Point;
|
||||
{$ENDIF}
|
||||
|
||||
DeclPoint = 'function Point(AX, AY: Integer): TPoint;';
|
||||
FuncPoint: function(AX, AY: Integer): {$IFDEF NeedTPointFix}TPoint2{$ELSE}TPoint{$ENDIF} = @EMS_Point; // @Classes.Point;
|
||||
|
||||
procedure CompRegisterBasics(AComp: TPSPascalCompiler);
|
||||
procedure AddConst(const Name, FType: TbtString; I: Integer);
|
||||
@ -306,6 +305,7 @@ end;
|
||||
function GetVarPointFromStack(Stack: TPSStack; Idx: Integer): PPoint;
|
||||
var
|
||||
res: PPSVariant;
|
||||
data: Pointer;
|
||||
typerec: TPSTypeRec;
|
||||
begin
|
||||
if Idx < 0 then Idx := Idx + Stack.Count;
|
||||
@ -347,12 +347,14 @@ end;
|
||||
function ExecBasicHandler({%H-}Caller: TPSExec; p: TPSExternalProcRec;
|
||||
{%H-}Global, Stack: TPSStack): Boolean;
|
||||
var
|
||||
res: PPSVariant;
|
||||
data: Pointer;
|
||||
temp: TPSVariantIFC;
|
||||
s: String;
|
||||
typerec: TPSTypeRec;
|
||||
begin
|
||||
Result := True;
|
||||
case PtrUInt(p.Ext1) of
|
||||
case Longint(p.Ext1) of
|
||||
0: begin // POINT()
|
||||
if Stack.Count < 3 then raise TEMScriptBadParamException.Create('Invalid param count for "Point"');;
|
||||
data := GetVarPointFromStack(Stack, -1);
|
||||
|
||||
@ -16,6 +16,9 @@ uses
|
||||
{$ifend}
|
||||
{$if defined(cpusparc) } {$DEFINE PasScriptNotAvail } {$ifend}
|
||||
|
||||
const
|
||||
EMSSupported = {$IFDEF PasScriptNotAvail} False {$ELSE} True {$ENDIF} ;
|
||||
|
||||
type
|
||||
|
||||
{ TEMSEditorMacro }
|
||||
|
||||
@ -6,10 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, StdCtrls, IDEOptionsIntf,
|
||||
{$IFnDEF PasScriptNotAvail}
|
||||
SrcEditorIntf,
|
||||
{$ENDIF}
|
||||
EMScriptMacro, EMSStrings;
|
||||
SrcEditorIntf, EMScriptMacro, EMSStrings;
|
||||
|
||||
type
|
||||
|
||||
@ -20,12 +17,13 @@ type
|
||||
lblStatus: TLabel;
|
||||
procedure btnActivateClick(Sender: TObject);
|
||||
private
|
||||
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
function GetTitle: String; override;
|
||||
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
|
||||
procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
end;
|
||||
|
||||
@ -57,31 +55,34 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEMSIdeOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
{$IFnDEF PasScriptNotAvail}
|
||||
var
|
||||
cfg: TEMSConfig;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF PasScriptNotAvail}
|
||||
lblStatus.Caption := EMSNotSupported;
|
||||
btnActivate.Enabled := True;
|
||||
{$ELSE}
|
||||
if not EMSSupported then begin
|
||||
lblStatus.Caption := EMSNotSupported;
|
||||
btnActivate.Enabled := True;
|
||||
exit;
|
||||
end;
|
||||
|
||||
cfg := GetEMSConf;
|
||||
|
||||
if cfg.SelfTestFailed >= EMSVersion then begin
|
||||
lblStatus.Caption := EMSNotActive;
|
||||
btnActivate.Enabled := True;
|
||||
end
|
||||
else
|
||||
|
||||
if EditorMacroPlayerClass = TEMSEditorMacro then begin
|
||||
lblStatus.Caption := EMSActive;
|
||||
btnActivate.Enabled := False;
|
||||
end
|
||||
|
||||
else
|
||||
begin
|
||||
lblStatus.Caption := EMSPending;
|
||||
btnActivate.Enabled := False;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
end;
|
||||
|
||||
procedure TEMSIdeOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
|
||||
@ -9,9 +9,9 @@ interface
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, SynEdit, SynEditKeyCmds, LazLoggerBase,
|
||||
Classes, SysUtils, SynEdit, SynEditTypes, SynEditKeyCmds, LazLoggerBase,
|
||||
IDECommands, EMScriptClasses, EMScriptMacro, Clipbrd, Dialogs, Controls,
|
||||
uPSCompiler, uPSRuntime, uPSUtils;
|
||||
uPSCompiler, uPSRuntime, uPSUtils, uPSDebugger, uPSR_std, uPSC_std;
|
||||
|
||||
type
|
||||
|
||||
@ -56,7 +56,7 @@ type TPoint2 = record x,y,a,b,c: Longint; end;
|
||||
{%region RegisterSelfTests}
|
||||
|
||||
var
|
||||
//TestResultA: integer;
|
||||
TestResultA: integer;
|
||||
TestResultInt1, TestResultInt2: integer;
|
||||
TestInputInt1, TestInputInt2: integer;
|
||||
TestResultBool1, TestResultBool2: boolean;
|
||||
@ -67,13 +67,13 @@ var
|
||||
function test_ord_mt(AType: TMsgDlgType): Integer;
|
||||
begin
|
||||
Result := ord(AType);
|
||||
//TestResultA := Result;
|
||||
TestResultA := Result;
|
||||
end;
|
||||
|
||||
function test_ord_mb(ABtn: TMsgDlgBtn): Integer;
|
||||
begin
|
||||
Result := ord(ABtn);
|
||||
//TestResultA := Result;
|
||||
TestResultA := Result;
|
||||
end;
|
||||
|
||||
procedure test_int1(AValue: Integer);
|
||||
@ -188,8 +188,6 @@ const
|
||||
Decltest_getstr1 = 'function test_getstr1: String;';
|
||||
Decltest_getstr2 = 'function test_getstr2: String;';
|
||||
Decltest_varstr1 = 'procedure test_varstr1(var AValue: String);';
|
||||
|
||||
{$IFnDEF PasMacroNoNativeCalls}
|
||||
Functest_ord_mt: function(AType: TMsgDlgType): Integer = @test_ord_mt;
|
||||
Functest_ord_mb: function(ABtn: TMsgDlgBtn): Integer = @test_ord_mb;
|
||||
Proctest_int1: procedure (AValue: Integer) = @test_int1;
|
||||
@ -209,7 +207,9 @@ const
|
||||
Proctest_getstr1: function: String = @test_getstr1;
|
||||
Proctest_getstr2: function: String = @test_getstr2;
|
||||
Proctest_varstr1: procedure (var AValue: String) = @test_varstr1;
|
||||
{$ELSE}
|
||||
|
||||
{$IFDEF PasMacroNoNativeCalls}
|
||||
const
|
||||
Id_test_ord_mb = 901;
|
||||
Id_test_ord_mt = 902;
|
||||
Id_test_int1 = 910;
|
||||
@ -238,7 +238,7 @@ var
|
||||
s: TbtString;
|
||||
begin
|
||||
Result := True;
|
||||
case PtrUInt(p.Ext1) of
|
||||
case Longint(p.Ext1) of
|
||||
Id_test_ord_mb: begin // test_ord_mb(ABtn: TMsgDlgBtn): Integer;
|
||||
if Stack.Count < 2 then raise TEMScriptBadParamException.Create('Invalid param count for "test_ord_mb"');
|
||||
Stack.SetInt(-1, test_ord_mb(TMsgDlgBtn(Stack.GetUInt(-2))) );
|
||||
|
||||
@ -5,11 +5,8 @@ unit RegisterEMS;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Dialogs, IDEOptionsIntf,
|
||||
{$IFDEF PasScriptNotAvail}
|
||||
SrcEditorIntf, EMSStrings,
|
||||
{$ENDIF}
|
||||
EMScriptMacro, EMSSelfTest, EMSIdeOptions;
|
||||
Classes, SysUtils, SrcEditorIntf, IDEOptionsIntf, EMScriptMacro, EMSSelfTest,
|
||||
EMSIdeOptions, EMSStrings, Dialogs;
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -17,17 +14,16 @@ implementation
|
||||
|
||||
procedure Register;
|
||||
var
|
||||
OptionsGroup: Integer;
|
||||
{$IFDEF PasScriptNotAvail}
|
||||
conf: TEMSConfig;
|
||||
ok: Boolean;
|
||||
{$ENDIF}
|
||||
OptionsGroup: Integer;
|
||||
begin
|
||||
OptionsGroup := GetFreeIDEOptionsGroupIndex(GroupEditor);
|
||||
RegisterIDEOptionsGroup(OptionsGroup, TEMSConfig);
|
||||
RegisterIDEOptionsEditor(OptionsGroup, TEMSIdeOptionsFrame, 1);
|
||||
|
||||
{$IFDEF PasScriptNotAvail}
|
||||
if not EMSSupported then exit;
|
||||
|
||||
conf := GetEMSConf;
|
||||
try
|
||||
conf.Load;
|
||||
@ -83,7 +79,6 @@ begin
|
||||
conf.Save;
|
||||
|
||||
EditorMacroPlayerClass := TEMSEditorMacro;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user