mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 20:19:23 +02:00
* Applied patch from Vincent Snijders
+ Added LCLplatform implementations git-svn-id: trunk@4882 -
This commit is contained in:
parent
a3000e4875
commit
2abd22e03c
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1083,6 +1083,8 @@ packager/ucomponentmanmain.pas svneol=native#text/pascal
|
||||
packager/ufrmaddcomponent.lfm svneol=native#text/plain
|
||||
packager/ufrmaddcomponent.lrs svneol=native#text/pascal
|
||||
packager/ufrmaddcomponent.pas svneol=native#text/pascal
|
||||
tools/apiwizz/apiwizard.lfm svneol=native#text/plain
|
||||
tools/apiwizz/apiwizard.lrs svneol=native#text/pascal
|
||||
tools/apiwizz/apiwizard.pp svneol=native#text/pascal
|
||||
tools/apiwizz/apiwizz.pp svneol=native#text/pascal
|
||||
tools/check_ide_libs.sh -text svneol=native#application/x-sh
|
||||
|
136
tools/apiwizz/apiwizard.lfm
Normal file
136
tools/apiwizz/apiwizard.lfm
Normal file
@ -0,0 +1,136 @@
|
||||
object ApiWizForm: TApiWizForm
|
||||
CAPTION = 'ApiWiZZ'
|
||||
CLIENTHEIGHT = 273
|
||||
CLIENTWIDTH = 504
|
||||
ONCREATE = ApiWizFormCreate
|
||||
POSITION = podefaultposonly
|
||||
HORZSCROLLBAR.PAGE = 505
|
||||
VERTSCROLLBAR.PAGE = 274
|
||||
LEFT = 358
|
||||
HEIGHT = 273
|
||||
TOP = 185
|
||||
WIDTH = 504
|
||||
object lblDeclare: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Declaration:'
|
||||
COLOR = -2147483633
|
||||
LAYOUT = tltop
|
||||
LEFT = 4
|
||||
HEIGHT = 16
|
||||
TOP = 68
|
||||
WIDTH = 120
|
||||
end
|
||||
object lblLazarus: TLABEL
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Lazarus dir:'
|
||||
COLOR = -2147483633
|
||||
LAYOUT = tltop
|
||||
LEFT = 4
|
||||
HEIGHT = 16
|
||||
TOP = 16
|
||||
WIDTH = 120
|
||||
end
|
||||
object txtDeclare: TEDIT
|
||||
ANCHORS = [aktop, akleft, akright]
|
||||
TABSTOP = True
|
||||
TABORDER = 0
|
||||
LEFT = 4
|
||||
HEIGHT = 24
|
||||
TOP = 88
|
||||
WIDTH = 492
|
||||
end
|
||||
object cmdGenerate: TBUTTON
|
||||
ANCHORS = [akright, akbottom]
|
||||
CAPTION = 'Generate'
|
||||
TABSTOP = True
|
||||
TABORDER = 2
|
||||
ONCLICK = cmdGenerateClick
|
||||
LEFT = 421
|
||||
HEIGHT = 28
|
||||
TOP = 238
|
||||
WIDTH = 75
|
||||
end
|
||||
object txtLazarus: TEDIT
|
||||
ANCHORS = [aktop, akleft, akright]
|
||||
TABSTOP = True
|
||||
TABORDER = 1
|
||||
LEFT = 4
|
||||
HEIGHT = 24
|
||||
TOP = 36
|
||||
WIDTH = 492
|
||||
TAG = 493
|
||||
end
|
||||
object rdgApiType: TRADIOGROUP
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'Api type'
|
||||
ITEMINDEX = 0
|
||||
ITEMS.Strings = (
|
||||
'win32 compatibility'
|
||||
'LCL interface'
|
||||
)
|
||||
ONCLICK = rdgApiTypeClick
|
||||
LEFT = 176
|
||||
HEIGHT = 72
|
||||
TOP = 128
|
||||
WIDTH = 158
|
||||
end
|
||||
object Groupbox1: TGROUPBOX
|
||||
ANCHORS = [aktop, akleft]
|
||||
CAPTION = 'LCL Platform'
|
||||
CLIENTHEIGHT = 115
|
||||
CLIENTWIDTH = 160
|
||||
COLOR = -2147483633
|
||||
PARENTCOLOR = True
|
||||
PARENTCTL3D = False
|
||||
TABORDER = 6
|
||||
LEFT = 4
|
||||
HEIGHT = 138
|
||||
TOP = 128
|
||||
WIDTH = 164
|
||||
object cbgLCLPlatform: TCHECKGROUP
|
||||
ENABLED = False
|
||||
ITEMS.Strings = (
|
||||
'gtk'
|
||||
'gtk2'
|
||||
'win32'
|
||||
)
|
||||
LEFT = 26
|
||||
HEIGHT = 80
|
||||
TOP = 30
|
||||
WIDTH = 128
|
||||
Data = {
|
||||
03000000020202
|
||||
}
|
||||
end
|
||||
object rbIndependent: TRADIOBUTTON
|
||||
ANCHORS = [aktop, akleft]
|
||||
AUTOSIZE = True
|
||||
ALLOWGRAYED = True
|
||||
CAPTION = 'Independent'
|
||||
CHECKED = True
|
||||
STATE = cbchecked
|
||||
DRAGCURSOR = 0
|
||||
TABORDER = 1
|
||||
TABSTOP = True
|
||||
ONCLICK = rbPlatformDependencyClick
|
||||
LEFT = 10
|
||||
HEIGHT = 20
|
||||
TOP = 3
|
||||
WIDTH = 115
|
||||
end
|
||||
object rbDependent: TRADIOBUTTON
|
||||
ANCHORS = [aktop, akleft]
|
||||
AUTOSIZE = True
|
||||
ALLOWGRAYED = True
|
||||
CAPTION = 'Dependent'
|
||||
DRAGCURSOR = 0
|
||||
TABORDER = 2
|
||||
TABSTOP = True
|
||||
ONCLICK = rbPlatformDependencyClick
|
||||
LEFT = 10
|
||||
HEIGHT = 20
|
||||
TOP = 30
|
||||
WIDTH = 106
|
||||
end
|
||||
end
|
||||
end
|
39
tools/apiwizz/apiwizard.lrs
Normal file
39
tools/apiwizz/apiwizard.lrs
Normal file
@ -0,0 +1,39 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TApiWizForm','FORMDATA',[
|
||||
'TPF0'#11'TApiWizForm'#10'ApiWizForm'#7'CAPTION'#6#7'ApiWiZZ'#12'CLIENTHEIGHT'
|
||||
+#3#17#1#11'CLIENTWIDTH'#3#248#1#8'ONCREATE'#7#16'ApiWizFormCreate'#8'POSITIO'
|
||||
+'N'#7#16'podefaultposonly'#18'HORZSCROLLBAR.PAGE'#3#249#1#18'VERTSCROLLBAR.P'
|
||||
+'AGE'#3#18#1#4'LEFT'#3'f'#1#6'HEIGHT'#3#17#1#3'TOP'#3#185#0#5'WIDTH'#3#248#1
|
||||
+#0#6'TLABEL'#10'lblDeclare'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6
|
||||
+#12'Declaration:'#5'COLOR'#4#15#0#0#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#4#6'H'
|
||||
+'EIGHT'#2#16#3'TOP'#2'D'#5'WIDTH'#2'x'#0#0#6'TLABEL'#10'lblLazarus'#7'ANCHOR'
|
||||
+'S'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#12'Lazarus dir:'#5'COLOR'#4#15#0#0
|
||||
+#128#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#4#6'HEIGHT'#2#16#3'TOP'#2#16#5'WIDTH'#2
|
||||
+'x'#0#0#5'TEDIT'#10'txtDeclare'#7'ANCHORS'#11#5'aktop'#6'akleft'#7'akright'#0
|
||||
+#7'TABSTOP'#9#8'TABORDER'#2#0#4'LEFT'#2#4#6'HEIGHT'#2#24#3'TOP'#2'X'#5'WIDTH'
|
||||
+#3#236#1#0#0#7'TBUTTON'#11'cmdGenerate'#7'ANCHORS'#11#7'akright'#8'akbottom'
|
||||
+#0#7'CAPTION'#6#8'Generate'#7'TABSTOP'#9#8'TABORDER'#2#2#7'ONCLICK'#7#16'cmd'
|
||||
+'GenerateClick'#4'LEFT'#3#165#1#6'HEIGHT'#2#28#3'TOP'#3#238#0#5'WIDTH'#2'K'#0
|
||||
+#0#5'TEDIT'#10'txtLazarus'#7'ANCHORS'#11#5'aktop'#6'akleft'#7'akright'#0#7'T'
|
||||
+'ABSTOP'#9#8'TABORDER'#2#1#4'LEFT'#2#4#6'HEIGHT'#2#24#3'TOP'#2'$'#5'WIDTH'#3
|
||||
+#236#1#3'TAG'#3#237#1#0#0#11'TRADIOGROUP'#10'rdgApiType'#7'ANCHORS'#11#5'akt'
|
||||
+'op'#6'akleft'#0#7'CAPTION'#6#8'Api type'#9'ITEMINDEX'#2#0#13'ITEMS.Strings'
|
||||
+#1#6#19'win32 compatibility'#6#13'LCL interface'#0#7'ONCLICK'#7#15'rdgApiTyp'
|
||||
+'eClick'#4'LEFT'#3#176#0#6'HEIGHT'#2'H'#3'TOP'#3#128#0#5'WIDTH'#3#158#0#0#0#9
|
||||
+'TGROUPBOX'#9'Groupbox1'#7'ANCHORS'#11#5'aktop'#6'akleft'#0#7'CAPTION'#6#12
|
||||
+'LCL Platform'#12'CLIENTHEIGHT'#2's'#11'CLIENTWIDTH'#3#160#0#5'COLOR'#4#15#0
|
||||
+#0#128#11'PARENTCOLOR'#9#11'PARENTCTL3D'#8#8'TABORDER'#2#6#4'LEFT'#2#4#6'HEI'
|
||||
+'GHT'#3#138#0#3'TOP'#3#128#0#5'WIDTH'#3#164#0#0#11'TCHECKGROUP'#14'cbgLCLPla'
|
||||
+'tform'#7'ENABLED'#8#13'ITEMS.Strings'#1#6#3'gtk'#6#4'gtk2'#6#5'win32'#0#4'L'
|
||||
+'EFT'#2#26#6'HEIGHT'#2'P'#3'TOP'#2#30#5'WIDTH'#3#128#0#4'Data'#10#7#0#0#0#3#0
|
||||
+#0#0#2#2#2#0#0#12'TRADIOBUTTON'#13'rbIndependent'#7'ANCHORS'#11#5'aktop'#6'a'
|
||||
+'kleft'#0#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'CAPTION'#6#11'Independent'#7'CHE'
|
||||
+'CKED'#9#5'STATE'#7#9'cbchecked'#10'DRAGCURSOR'#2#0#8'TABORDER'#2#1#7'TABSTO'
|
||||
+'P'#9#7'ONCLICK'#7#25'rbPlatformDependencyClick'#4'LEFT'#2#10#6'HEIGHT'#2#20
|
||||
+#3'TOP'#2#3#5'WIDTH'#2's'#0#0#12'TRADIOBUTTON'#11'rbDependent'#7'ANCHORS'#11
|
||||
+#5'aktop'#6'akleft'#0#8'AUTOSIZE'#9#11'ALLOWGRAYED'#9#7'CAPTION'#6#9'Depende'
|
||||
+'nt'#10'DRAGCURSOR'#2#0#8'TABORDER'#2#2#7'TABSTOP'#9#7'ONCLICK'#7#25'rbPlatf'
|
||||
+'ormDependencyClick'#4'LEFT'#2#10#6'HEIGHT'#2#20#3'TOP'#2#30#5'WIDTH'#2'j'#0
|
||||
+#0#0#0
|
||||
]);
|
@ -26,133 +26,58 @@
|
||||
}
|
||||
unit APIWizard;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
{$Mode objfpc}
|
||||
|
||||
uses
|
||||
LCLIntf, buttons,
|
||||
Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
StdCtrls;
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons, ExtCtrls;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
TApiWizForm = class(TForm)
|
||||
cbgLCLPlatform: TCHECKGROUP;
|
||||
cmdGenerate: TButton;
|
||||
Groupbox1: TGROUPBOX;
|
||||
rbIndependent: TRADIOBUTTON;
|
||||
rbDependent: TRADIOBUTTON;
|
||||
rdgApiType: TRadioGroup;
|
||||
txtDeclare: TEdit;
|
||||
lblDeclare: TLabel;
|
||||
txtLazarus: TEdit;
|
||||
lblLazarus: TLabel;
|
||||
chkIndependent: TCheckBox;
|
||||
cmdGenerate: TButton;
|
||||
procedure cmdGenerateClick(Sender: TObject);
|
||||
procedure ApiWizFormCreate(Sender: TObject);
|
||||
procedure rbPlatformDependencyClick(Sender: TObject);
|
||||
procedure rdgApiTypeClick (Sender: TObject );
|
||||
private
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
TProcType = (ptFunction, ptProcedure);
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
ApiWizForm: TApiWizForm;
|
||||
|
||||
implementation
|
||||
|
||||
const
|
||||
DECL_OFFSET: array[TProctype] of Integer = (9, 10);
|
||||
|
||||
constructor TForm1.Create(AOwner: TComponent);
|
||||
{ TApiWizForm }
|
||||
|
||||
procedure TApiWizForm.ApiWizFormCreate(Sender: TObject);
|
||||
var
|
||||
n: Integer;
|
||||
S: String;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
Width := 513;
|
||||
Height := 186;
|
||||
Caption := 'ApiWiZZ';
|
||||
|
||||
lblDeclare := TLabel.Create(Self);
|
||||
with lblDeclare do
|
||||
begin
|
||||
Parent := Self;
|
||||
Left := 4;
|
||||
Top := 68;
|
||||
Width := 120;
|
||||
Height := 16;
|
||||
Caption := 'Declaration:';
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
lblLazarus := TLabel.Create(Self);
|
||||
with lblLazarus do
|
||||
begin
|
||||
Parent := Self;
|
||||
Left := 4;
|
||||
Top := 16;
|
||||
Width := 120;
|
||||
Height := 16;
|
||||
Caption := 'Lazarus dir:';
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
txtDeclare := TEdit.Create(Self);
|
||||
with txtDeclare do
|
||||
begin
|
||||
Parent := Self;
|
||||
Left := 4;
|
||||
Top := 88;
|
||||
Width := 493;
|
||||
Height := 24;
|
||||
TabOrder := 0;
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
txtLazarus := TEdit.Create(Self);
|
||||
with txtLazarus do
|
||||
begin
|
||||
Parent := Self;
|
||||
Left := 4;
|
||||
Top := 36;
|
||||
Width := 493;
|
||||
Height := 24;
|
||||
TabOrder := 1;
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
chkIndependent := TCheckBox.Create(Self);
|
||||
with chkIndependent do
|
||||
begin
|
||||
Parent := Self;
|
||||
Left := 4;
|
||||
Top := 124;
|
||||
Width := 400;
|
||||
Height := 17;
|
||||
Caption := 'Platform independent';
|
||||
TabOrder := 2;
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
cmdGenerate := TButton.Create(Self);
|
||||
with cmdGenerate do
|
||||
begin
|
||||
Parent := Self;
|
||||
Left := 420;
|
||||
Top := 120;
|
||||
Width := 75;
|
||||
Height := 25;
|
||||
Caption := 'Generate';
|
||||
TabOrder := 3;
|
||||
OnClick := @cmdGenerateClick;
|
||||
Visible := True;
|
||||
end;
|
||||
|
||||
|
||||
S := ParamStr(1);
|
||||
// find the lazarus dir
|
||||
if S = ''
|
||||
then begin
|
||||
S := ExtractFilePath(ParamStr(0));
|
||||
n := Pos('apiwizz', S);
|
||||
if n <> 0
|
||||
if n <> 0
|
||||
then S := Copy(S, 1, n - 7)
|
||||
else S := '';
|
||||
end;
|
||||
@ -164,29 +89,8 @@ begin
|
||||
if n <> 0 then S := Copy(S, 1, n - 7);
|
||||
end;
|
||||
txtLazarus.Text := S;
|
||||
|
||||
end;
|
||||
|
||||
procedure ShowMessage(const Msg: string);
|
||||
var
|
||||
pStr: PChar;
|
||||
begin
|
||||
// ShowMessagePos(Msg, -1, -1);
|
||||
pStr := StrAlloc(Length(Msg) + 1);
|
||||
try
|
||||
StrPCopy(pStr, Msg);
|
||||
MessageBox(0, pStr, '', 0);
|
||||
finally
|
||||
strDispose(pStr);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ShowMessageFmt(const Msg: string; Params: array of const);
|
||||
begin
|
||||
ShowMessage(Format(Msg, Params));
|
||||
end;
|
||||
|
||||
|
||||
function GetName(const ADeclaration: String): String;
|
||||
var
|
||||
n, NameEnd: Integer;
|
||||
@ -419,7 +323,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.cmdGenerateClick(Sender: TObject);
|
||||
procedure TApiWizForm.cmdGenerateClick(Sender: TObject);
|
||||
const
|
||||
RETURN_PROC: array[TProcType] of String = ('', ' Nothing');
|
||||
PROC_DESC: array[TProcType] of String = ('Function', 'Procedure');
|
||||
@ -427,8 +331,9 @@ const
|
||||
var
|
||||
ApiText, ProcLines, ProcParams: TStringList;
|
||||
S, DeclarationText: String;
|
||||
ProcName: String;
|
||||
n, Idx: Integer;
|
||||
ProcName, FileName, IntfBase: String;
|
||||
PlatformPrefix, PlatformDir, PlatformObject: String;
|
||||
n, Idx, PlatformIdx: Integer;
|
||||
ProcType: TProcType;
|
||||
|
||||
procedure CreateLeadingCR;
|
||||
@ -443,9 +348,17 @@ var
|
||||
end;
|
||||
begin
|
||||
DeclarationText := Trim(txtDeclare.Text);
|
||||
while DeclarationText[Length(DeclarationText)] = ';' do Delete(DeclarationText, Length(DeclarationText), 1);
|
||||
|
||||
if Trim(DeclarationText) = '' then Exit;
|
||||
while (Length(DeclarationText) > 0) and (DeclarationText[Length(DeclarationText)] in [';', ' ']) do
|
||||
begin
|
||||
Delete(DeclarationText, Length(DeclarationText), 1);
|
||||
end;
|
||||
|
||||
if Trim(DeclarationText) = ''
|
||||
then begin
|
||||
ShowMessage('No declaration specified');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
ProcParams := TStringList.Create;
|
||||
try
|
||||
@ -454,28 +367,47 @@ begin
|
||||
ShowMessage('Bad formatted declaration');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
case rdgApiType.ItemIndex of
|
||||
0: begin
|
||||
FileName := 'winapi';
|
||||
IntfBase := 'intfbasewinapi.inc';
|
||||
end;
|
||||
1: begin
|
||||
FileName := 'lclintf';
|
||||
IntfBase := 'intfbaselcl.inc';
|
||||
// if Lowercase(copy(Procname, 1, 3)) <> 'lcl'
|
||||
// then begin
|
||||
// ShowMessage('LCL interface functions should start with LCL');
|
||||
// Exit;
|
||||
// end;
|
||||
end;
|
||||
else
|
||||
ShowMessage('No API type selected');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
ApiText := TStringList.Create;
|
||||
ProcLines := TStringList.Create;
|
||||
try
|
||||
//-----------------
|
||||
// open winapih.inc
|
||||
//-----------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/include/winapih.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, 'winapih.inc', True);
|
||||
//--------------------------------
|
||||
// open winapih.inc / lclintfh.inc
|
||||
//--------------------------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/include/' + FileName + 'h.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, FileName + 'h.inc', True);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
ProcLines.Clear;
|
||||
CreateLeadingCR;
|
||||
if chkIndependent.Checked
|
||||
if rbIndependent.Checked
|
||||
then ProcLines.Add(Format('//%s %s --> independent', [LowerCase(PROC_DESC[proctype]), procname]))
|
||||
else ProcLines.Add(DeclarationText + '; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}');
|
||||
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
|
||||
if chkIndependent.Checked
|
||||
if rbIndependent.Checked
|
||||
then begin
|
||||
Idx := FindInsertPoint(ApiText, 'pi', ProcName, 'winapih.inc', True);
|
||||
Idx := FindInsertPoint(ApiText, 'pi', ProcName, FileName + 'h.inc', True);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
ProcLines.Clear;
|
||||
@ -484,15 +416,15 @@ begin
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
end;
|
||||
end;
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/include/winapih.inc');
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/include/' + FileName + 'h.inc');
|
||||
end;
|
||||
//-----------------
|
||||
// open winapi.inc
|
||||
//-----------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/include/winapi.inc');
|
||||
if chkIndependent.Checked
|
||||
//------------------------------
|
||||
// open winapi.inc / lclintf.inc
|
||||
//------------------------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/include/' + FileName + '.inc');
|
||||
if rbIndependent.Checked
|
||||
then begin
|
||||
Idx := FindInsertPoint(ApiText, 'pi', ProcName, 'winapi.inc', False);
|
||||
Idx := FindInsertPoint(ApiText, 'pi', ProcName, FileName + '.inc', False);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
with ProcLines do
|
||||
@ -520,7 +452,7 @@ begin
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, 'winapi.inc', False);
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, FileName + '.inc', False);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
|
||||
@ -547,19 +479,19 @@ begin
|
||||
if Idx <> -1
|
||||
then begin
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/include/winapi.inc');
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/include/' + FileName + '.inc');
|
||||
end;
|
||||
|
||||
// ++++++++++++++++++
|
||||
// from here only dependent stuff
|
||||
// ++++++++++++++++++
|
||||
if not chkIndependent.Checked
|
||||
// ++++++++++++++++++++++++++++++ //
|
||||
// from here only dependent stuff //
|
||||
// ++++++++++++++++++++++++++++++ //
|
||||
if rbDependent.Checked
|
||||
then begin
|
||||
//-----------------
|
||||
// open interfacebase.inc
|
||||
//-----------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/include/interfacebase.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, 'interfacebase.inc', False);
|
||||
//------------------------------------------
|
||||
// open intfbasewinapi.inc / intfbaselcl.inc
|
||||
//------------------------------------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/include/' + IntfBase);
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, IntfBase, False);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
S := DeclarationText;
|
||||
@ -581,58 +513,68 @@ begin
|
||||
Add('end;');
|
||||
end;
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/include/interfacebase.inc');
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/include/' + IntfBase);
|
||||
end;
|
||||
|
||||
//-----------------
|
||||
// open gtkwinapih.inc
|
||||
//-----------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/interfaces/gtk/gtkwinapih.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, 'gtkwinapih.inc', True);
|
||||
if IDX <> -1
|
||||
then begin
|
||||
ProcLines.Clear;
|
||||
CreateLeadingCR;
|
||||
ProcLines.Add(DeclarationText + '; override;');
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/interfaces/gtk/gtkwinapih.inc');
|
||||
end;
|
||||
|
||||
//-----------------
|
||||
// open gtkwinapi.inc
|
||||
//-----------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/interfaces/gtk/gtkwinapi.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, 'gtkwinapi.inc', False);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
S := DeclarationText;
|
||||
// Remove spaces
|
||||
while S[DECL_OFFSET[ProcType]] = ' ' do Delete(S, DECL_OFFSET[ProcType], 1);
|
||||
|
||||
System.Insert(' TGTKObject.', S, DECL_OFFSET[ProcType]);
|
||||
with ProcLines do
|
||||
begin
|
||||
Clear;
|
||||
Add('');
|
||||
Add('{------------------------------------------------------------------------------' );
|
||||
Add(' ' + PROC_DESC[ProcType] + ': ' + ProcName );
|
||||
if ProcParams.Count = 0
|
||||
then Add(' Params: none' )
|
||||
else begin
|
||||
Add(' Params: ' + ProcParams[0] + ':');
|
||||
for n := 1 to ProcParams.Count - 1 do
|
||||
Add(' ' + ProcParams[n] + ':');
|
||||
end;
|
||||
Add(' Returns:' + RETURN_PROC[ProcType] );
|
||||
Add('' );
|
||||
Add(' ------------------------------------------------------------------------------}' );
|
||||
Add(S + ';');
|
||||
Add('begin' );
|
||||
Add(' // Your code here' );
|
||||
Add('end;');
|
||||
for PlatformIdx := 0 to cbgLCLPlatform.Items.Count - 1 do
|
||||
begin
|
||||
if not cbgLCLPlatform.Checked[PlatformIdx] then Continue;
|
||||
|
||||
// for now they can all be based on the check caption
|
||||
PlatformPrefix := cbgLCLPlatform.Items[PlatformIdx];
|
||||
PlatformDir := PlatformPrefix;
|
||||
PlatformObject := 'T' + UpperCase(PlatformPrefix) + 'Object';
|
||||
|
||||
//------------------
|
||||
// open *winapih.inc
|
||||
//------------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/interfaces/' + PlatformDir + '/' + PlatformPrefix + FileName + 'h.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, PlatformPrefix + FileName + 'h.inc', True);
|
||||
if IDX <> -1
|
||||
then begin
|
||||
ProcLines.Clear;
|
||||
CreateLeadingCR;
|
||||
ProcLines.Add(DeclarationText + '; override;');
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/interfaces/' + PlatformDir + '/' + PlatformPrefix + FileName + 'h.inc');
|
||||
end;
|
||||
|
||||
//-----------------
|
||||
// open *winapi.inc
|
||||
//-----------------
|
||||
ApiText.LoadFromFile(txtLazarus.text + '/lcl/interfaces/' + PlatformDir + '/' + PlatformPrefix + FileName + '.inc');
|
||||
Idx := FindInsertPoint(ApiText, 'ps', ProcName, PlatformPrefix + FileName + '.inc', False);
|
||||
if Idx <> -1
|
||||
then begin
|
||||
S := DeclarationText;
|
||||
// Remove spaces
|
||||
while S[DECL_OFFSET[ProcType]] = ' ' do Delete(S, DECL_OFFSET[ProcType], 1);
|
||||
|
||||
System.Insert(' ' + PlatformObject + '.', S, DECL_OFFSET[ProcType]);
|
||||
with ProcLines do
|
||||
begin
|
||||
Clear;
|
||||
Add('');
|
||||
Add('{------------------------------------------------------------------------------' );
|
||||
Add(' ' + PROC_DESC[ProcType] + ': ' + ProcName );
|
||||
if ProcParams.Count = 0
|
||||
then Add(' Params: none' )
|
||||
else begin
|
||||
Add(' Params: ' + ProcParams[0] + ':');
|
||||
for n := 1 to ProcParams.Count - 1 do
|
||||
Add(' ' + ProcParams[n] + ':');
|
||||
end;
|
||||
Add(' Returns:' + RETURN_PROC[ProcType] );
|
||||
Add('' );
|
||||
Add(' ------------------------------------------------------------------------------}' );
|
||||
Add(S + ';');
|
||||
Add('begin' );
|
||||
Add(' // Your code here' );
|
||||
Add('end;');
|
||||
end;
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/interfaces/' + PlatformDir + '/' + PlatformPrefix + FileName + '.inc');
|
||||
end;
|
||||
InsertLines(Idx, ApiText, ProcLines);
|
||||
ApiText.SaveToFile(txtLazarus.text + '/lcl/interfaces/gtk/gtkwinapi.inc');
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
@ -644,10 +586,27 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TApiWizForm.rbPlatformDependencyClick (Sender: TObject );
|
||||
begin
|
||||
cbgLCLPlatform.Enabled := rbDependent.Checked;
|
||||
end;
|
||||
|
||||
procedure TApiWizForm.rdgApiTypeClick (Sender: TObject );
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I apiwizard.lrs}
|
||||
|
||||
end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.4 2003/12/13 01:12:01 marc
|
||||
* Applied patch from Vincent Snijders
|
||||
+ Added LCLplatform implementations
|
||||
|
||||
Revision 1.3 2003/09/25 23:03:13 marc
|
||||
= Changed LCLLinux to LCLIntf
|
||||
|
||||
|
@ -33,12 +33,16 @@ uses
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.CreateForm(TApiWizForm, ApiWizForm);
|
||||
Application.Run;
|
||||
end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.4 2003/12/13 01:12:01 marc
|
||||
* Applied patch from Vincent Snijders
|
||||
+ Added LCLplatform implementations
|
||||
|
||||
Revision 1.3 2003/09/25 23:03:13 marc
|
||||
= Changed LCLLinux to LCLIntf
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user