IDE: removed obsolete custom components

git-svn-id: trunk@56781 -
This commit is contained in:
mattias 2017-12-18 17:20:19 +00:00
parent 0e22f592cb
commit 7394ed2c35
13 changed files with 0 additions and 1042 deletions

5
.gitattributes vendored
View File

@ -1088,7 +1088,6 @@ components/compilers/javascript/examples/ReadJSClassesXML.ico -text svneol=unset
components/compilers/javascript/examples/ReadJSClassesXML.lpi svneol=native#text/plain
components/compilers/javascript/examples/ReadJSClassesXML.lpr svneol=native#text/plain
components/compilers/javascript/examples/jsclassxmlread.pas svneol=native#text/plain
components/custom/README.txt svneol=native#text/plain
components/customdrawn/build_resources.sh svneol=native#text/plain
components/customdrawn/customdrawn.lpk svneol=native#text/plain
components/customdrawn/customdrawn.pas svneol=native#text/pascal
@ -10106,10 +10105,6 @@ packager/missingpkgfilesdlg.lfm svneol=native#text/plain
packager/missingpkgfilesdlg.pas svneol=native#text/plain
packager/newpkgcomponentdlg.lfm svneol=native#text/plain
packager/newpkgcomponentdlg.pas svneol=native#text/pascal
packager/oldcustomcompadddlg.lfm svneol=native#text/plain
packager/oldcustomcompadddlg.pas svneol=native#text/pascal
packager/oldcustomcompdlg.lfm svneol=native#text/plain
packager/oldcustomcompdlg.pas svneol=native#text/pascal
packager/openinstalledpkgdlg.lfm svneol=native#text/plain
packager/openinstalledpkgdlg.pas svneol=native#text/pascal
packager/packagedefs.pas svneol=native#text/pascal

2
.gitignore vendored
View File

@ -26,8 +26,6 @@ components/codetools/examples/units
components/codetools/languages/*.bak
components/codetools/languages/units
components/codetools/units
components/custom/*.bak
components/custom/units
components/customform/*.bak
components/customform/demo/*.bak
components/customform/demo/units

View File

@ -1,48 +0,0 @@
OBSOLETE - OBSOLETE - OBSOLETE - OBSOLETE - OBSOLETE - OBSOLETE - OBSOLETE
How to add extra components to the lazarus IDE
==============================================
Use the customidecomps.pas.template file and read the instructions carefully.
Some notes for component developers:
--------------------------------------------------------------------------------
Components at design time:
- csDesigning is set in ComponentState
- The component should be passive at design time. That means it should ignore
most user events.
- csAcceptsControls in ControlStyle controls if the user can put components
onto the component. Include or exclude this flag in the constructor.
--------------------------------------------------------------------------------
Providing an icon for a component:
The IDE searches for an XPM resource with the classname of the component. It
should not be bigger than 23x23 pixels.
For example:
Adding an icon for TCheckBook in checkbook.pas:
Use your favourite paint program to create a transparent image of size 23x23
or smaller. Save it as <classname>.xpm, where <classname> is the classname of
the component (e.g. TCheckBook.xpm). You can write it lowercase tcheckbook.xpm
or TCheckBook.xpm or whatever you like. Then use the tools/lazres program to
convert it into a lazarus resource file:
lazres checkbookicon.lrs TCheckBook.xpm
The name of the new resource file is up to you. Put this file into the
components/custom/ directory where the checkbook.pas is. Then include the
resource file in the initialization section of checkbook.pas:
initialization
{$I checkbookicon.lrs}
!!! IMPORTANT: If there is already a resource file, then add your new file
behind it. The IDE expects the first include file as the main
resource file, where it stores the form data.
Hint:
You can also copy the code from checkbookicon.lrs to the initialization
section. This way you can provide your component in one file (checkbook.pas).
--------------------------------------------------------------------------------

View File

@ -1,75 +0,0 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
THIS IS OBSOLETE.
Use this unit to add components to the lazarus IDE.
For example:
To add TCheckBook from checkbook.pas to the IDE do the following:
1. If not already done, copy or rename this file to
components/custom/customidecomps.pas.
2. Copy checkbook.pas into the same directory.
3. Add checkbook to the uses section of the customidecomps.pas (*A).
4. Add the following line to RegisterCustomComponents (*B):
RegisterComponent('Extra','CheckBook',[TCheckBook]);
5. Add -dCustomIDEComps to Tools-> Configure "Build Lazarus" -> Options.
This flag will tell the compiler to use customidecomps.pas.
6. Rebuild lazarus.
}
unit CustomIDEComps;
{$mode objfpc}{$H+}
interface
uses
Classes
{ (*A) Add your units here }
;
type
TRegisterComponentProc = procedure(const Page, UnitName:ShortString;
ComponentClass: TComponentClass);
// this procedure is called by the IDE on startup,
// if it is compiled with -dCustomIDEComps
procedure RegisterCustomComponents(RegisterComponent: TRegisterComponentProc);
implementation
procedure RegisterCustomComponents(RegisterComponent: TRegisterComponentProc);
begin
{ (*B) Add your component registrations here }
{ Example:
RegisterComponent('PageName','UnitName',TCustomComp1);
RegisterComponent('Extra','CheckBook',TCheckBook);
For further examples see idecomp.pp -> RegisterStandardComponents
}
end;
end.

View File

@ -25,9 +25,6 @@ interface
uses
Classes, SysUtils, typinfo, Laz_AVL_Tree, fgl,
{$IFDEF CustomIDEComps}
CustomIDEComps,
{$ENDIF}
Controls, Laz2_XMLCfg, LCLProc;
type
@ -266,9 +263,6 @@ type
procedure RemoveHandlerComponentAdded(OnComponentAddedEvent: TComponentAddedEvent);
procedure AddHandlerSelectionChanged(OnSelectionChangedEvent: TPaletteHandlerEvent);
procedure RemoveHandlerSelectionChanged(OnSelectionChangedEvent: TPaletteHandlerEvent);
{$IFDEF CustomIDEComps}
procedure RegisterCustomIDEComponents(RegisterProc: RegisterUnitComponentProc);
{$ENDIF}
public
property Pages: TBaseComponentPageList read fPages;
property Comps: TRegisteredComponentList read fComps;
@ -1152,14 +1146,5 @@ begin
RemoveHandler(cphtSelectionChanged,TMethod(OnSelectionChangedEvent));
end;
//
{$IFDEF CustomIDEComps}
procedure TBaseComponentPalette.RegisterCustomIDEComponents(
RegisterProc: RegisterUnitComponentProc);
begin
CustomIDEComps.RegisterCustomComponents(RegisterProc);
end;
{$ENDIF}
end.

View File

@ -328,9 +328,6 @@ type
itmPkgPkgGraph: TIDEMenuCommand;
itmPkgPackageLinks: TIDEMenuCommand;
itmPkgEditInstallPkgs: TIDEMenuCommand;
{$IFDEF CustomIDEComps}
itmCompsConfigCustomComps: TIDEMenuCommand;
{$ENDIF}
// tools menu
//mnuTools: TIDEMenuSection;

View File

@ -1366,10 +1366,6 @@ begin
CreateMenuItem(ParentMI,itmPkgPkgGraph,'itmPkgPkgGraph',lisMenuPackageGraph+' ...','pkg_graph');
CreateMenuItem(ParentMI,itmPkgPackageLinks,'itmPkgPackageLinks',lisMenuPackageLinks);
CreateMenuItem(ParentMI,itmPkgEditInstallPkgs,'itmPkgEditInstallPkgs',lisMenuEditInstallPkgs,'pkg_properties');
{$IFDEF CustomIDEComps}
CreateMenuItem(ParentMI,itmCompsConfigCustomComps,'itmCompsConfigCustomComps',lisMenuConfigCustomComps);
{$ENDIF}
end;
end;
@ -1706,9 +1702,6 @@ begin
itmPkgPkgGraph.Command:=GetCommand(ecPackageGraph);
itmPkgPackageLinks.Command:=GetCommand(ecPackageLinks);
itmPkgEditInstallPkgs.Command:=GetCommand(ecEditInstallPkgs);
{$IFDEF CustomIDEComps}
itmCompsConfigCustomComps.Command:=GetCommand(ecConfigCustomComps);
{$ENDIF}
// tools menu
itmEnvGeneralOptions.Command:=GetCommand(ecEnvironmentOptions);

View File

@ -1,47 +0,0 @@
object FrmAddComponent: TFrmAddComponent
CAPTION = 'Select components to add'
CLIENTHEIGHT = 256
CLIENTWIDTH = 228
HORZSCROLLBAR.PAGE = 229
VERTSCROLLBAR.PAGE = 257
LEFT = 415
HEIGHT = 256
TOP = 176
WIDTH = 228
object ListCompAdd: TLISTBOX
ANCHORS = [aktop, akleft]
MULTISELECT = True
SORTED = True
TABSTOP = True
TOPINDEX = -1
HEIGHT = 216
WIDTH = 228
end
object Bitbtn1: TBITBTN
KIND = bkcancel
SPACING = 3
ANCHORS = [aktop, akleft]
MODALRESULT = 2
CAPTION = 'Cancel'
TABSTOP = True
TABORDER = 1
LEFT = 144
HEIGHT = 25
TOP = 224
WIDTH = 75
end
object Bitbtn2: TBITBTN
KIND = bkok
SPACING = 3
ANCHORS = [aktop, akleft]
DEFAULT = True
MODALRESULT = 1
CAPTION = '&OK'
TABSTOP = True
TABORDER = 2
LEFT = 56
HEIGHT = 25
TOP = 224
WIDTH = 75
end
end

View File

@ -1,50 +0,0 @@
{ $Id$ }
{***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
Author: Anthony Maro
}
unit OldCustomCompAddDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons;
type
TFrmAddComponent = class(TForm)
Bitbtn1: TBitBtn;
Bitbtn2: TBitBtn;
ListCompAdd: TListBox;
private
public
end;
var
FrmAddComponent: TFrmAddComponent = nil;
implementation
{$R *.lfm}
end.

View File

@ -1,228 +0,0 @@
object FrmComponentMan: TFrmComponentMan
Left = 304
Height = 310
Top = 355
Width = 515
HelpType = htKeyword
Caption = 'Component Manager for Lazarus'
ClientHeight = 310
ClientWidth = 515
Constraints.MinHeight = 310
Constraints.MinWidth = 514
OnCreate = FrmMainCREATE
OnDestroy = FrmMainDESTROY
OnShow = FrmMainSHOW
LCLVersion = '0.9.29'
object Label1: TLabel
Left = 12
Height = 14
Top = 8
Width = 109
HelpType = htKeyword
Caption = 'Installed Components:'
ParentColor = False
end
object Label2: TLabel
Left = 399
Height = 14
Top = 20
Width = 90
HelpType = htKeyword
Anchors = [akTop, akRight]
Caption = 'Component Name:'
ParentColor = False
end
object Label3: TLabel
Left = 306
Height = 14
Top = 165
Width = 57
HelpType = htKeyword
Anchors = [akTop, akRight]
Caption = 'Pascal Unit:'
ParentColor = False
end
object Label4: TLabel
Left = 318
Height = 14
Top = 96
Width = 29
HelpType = htKeyword
Anchors = [akTop, akRight]
Caption = 'Page:'
ParentColor = False
end
object LblComponent: TLabel
Left = 427
Height = 14
Top = 56
Width = 69
HelpType = htKeyword
Anchors = [akTop, akRight]
Caption = 'LblComponent'
ParentColor = False
end
object LblUnit: TLabel
Left = 432
Height = 14
Top = 208
Width = 33
HelpType = htKeyword
Anchors = [akTop, akRight]
Caption = 'LblUnit'
ParentColor = False
end
object ListComps: TListBox
Left = 12
Height = 215
Top = 40
Width = 240
HelpType = htKeyword
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
OnClick = ListCompsCLICK
Sorted = True
TabOrder = 0
end
object BtnCancel: TBitBtn
Left = 392
Height = 31
Top = 267
Width = 97
HelpType = htKeyword
Anchors = [akRight, akBottom]
Caption = 'Cancel'
Kind = bkCancel
ModalResult = 2
NumGlyphs = 0
OnClick = BtnCancelCLICK
TabOrder = 1
end
object Bitbtn2: TBitBtn
Left = 293
Height = 31
Top = 267
Width = 81
HelpType = htKeyword
Anchors = [akRight, akBottom]
Caption = 'Save'
Default = True
Kind = bkOK
ModalResult = 1
NumGlyphs = 0
OnClick = Bitbtn2CLICK
TabOrder = 2
end
object TxtPage: TEdit
Left = 264
Height = 21
Top = 128
Width = 232
HelpType = htKeyword
Anchors = [akTop, akRight]
OnChange = TxtPageCHANGE
TabOrder = 3
end
object Button1: TBitBtn
Left = 24
Height = 31
Top = 267
Width = 75
HelpType = htKeyword
Anchors = [akLeft, akBottom]
Caption = 'Add New'
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF0041924E233D8F497D3A8C44DB368940F332873CF32F84
37DB2C81337D287F3023FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0049995853459653E6419950FF7DC28FFF96D0A6FF96CFA6FF78BE
89FF368D42FF2C8134E6297F3053FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00519F61534D9C5DF464B478FFA8DBB5FF87CC98FF66BC7DFF64BA7CFF86CB
98FFA5D9B4FF58AA6BFF2C8134F4297F3053FFFFFF00FFFFFF00FFFFFF0059A6
6B2256A366E56AB97DFFA8DBB2FF60BC77FF5CBA73FF59B870FF59B56FFF58B5
6FFF5BB774FFA5D9B3FF5AAA6CFF2C8234E5297F3022FFFFFF00FFFFFF005DA9
707E53AB68FFAADDB4FF64C179FF5FBE71FF60BC77FFFFFFFFFFFFFFFFFF59B8
70FF58B56EFF5CB774FFA6DAB4FF388F43FF2C82347EFFFFFF00FFFFFF0061AC
75DB8ACC98FF89D396FF6BC67AFF63C170FF55AB65FFFFFFFFFFFFFFFFFF59B8
70FF59B870FF5BB972FF85CC97FF7BBE8DFF308539DBFFFFFF00FFFFFF0065AF
7AF6A9DDB3FF7DCF8AFF75CC81FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF59B870FF67BE7DFF9CD4ABFF34883DF6FFFFFF00FFFFFF0069B2
7EF6B6E2BEFF8BD597FF7AC986FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF59B870FF69C17EFF9DD4AAFF388B42F6FFFFFF00FFFFFF006DB5
83DBACDDB6FFA6DFAFFF81CB8CFF7CC986FF6EBD79FFFFFFFFFFFFFFFFFF5BAC
6AFF60BC77FF5CBA73FF8BD199FF80C592FF3C8E47DBFFFFFF00FFFFFF0070B8
877E85C797FFD2EED7FF95D9A0FF8AD394FF7FC889FFFFFFFFFFFFFFFFFF79CD
85FF6BC37CFF6FC77EFFACDFB5FF459E57FF40914C7EFFFFFF00FFFFFF0073BA
8A2270B887E5AADAB7FFD8F1DCFF92D89DFF88CD93FF84CC8EFF8BD496FF8AD4
95FF83D28EFFAFE0B7FF6BB97DFF489856E544945122FFFFFF00FFFFFF00FFFF
FF0073BB8B5370B887F4AFDCBBFFDCF2E0FFB6E4BDFF9BDBA5FF96D9A0FFA5DF
AFFFC0E8C5FF79C28AFF509E5FF44C9B5B53FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF0073BB8B5371B887E694CEA4FFC3E6CBFFCFEBD4FFC9E9CEFFAFDD
B8FF6DB97FFF58A569E654A16553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF0074BB8B2371B9887D6EB684DB6AB380F367B17CF363AE
77DB60AB737D5CA86E23FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = Button1CLICK
TabOrder = 4
end
object BtnRemove: TBitBtn
Left = 128
Height = 31
Top = 267
Width = 75
HelpType = htKeyword
Anchors = [akLeft, akBottom]
Caption = 'Remove'
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF003F54C3233A50C27D3853BEDB3551BDF3304BBCF32E4E
B8DB2B4CB77D2748B523FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF004658C8534255C6E63C52CCFF757AE8FF8F92EEFF8F92EEFF7178
E4FF334DC1FF2B4AB7E6294BB553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF004D5ACD534959CBF45C65E0FFA1A6F5FF7E86EFFF5B63E9FF595DE7FF7D84
EEFF9EA0F4FF515DD7FF2B4AB7F4294BB553FFFFFF00FFFFFF00FFFFFF00545F
D2225361CFE5616BE3FFA1ACF5FF545FECFF505CEAFF4D59E9FF4E59E6FF4C56
E6FF5056E6FF9EA2F4FF5460D6FF2A4AB8E5294BB522FFFFFF00FFFFFF005860
D47E4B56DBFFA2ABF6FF5664F0FF5266EEFF4D59E9FF4D59E9FF4D59E9FF4D59
E9FF4C58E6FF525AE6FF9FA3F5FF3450C4FF2A4AB87EFFFFFF00FFFFFF005C62
D7DB818CEEFF7E91F7FF5D73F3FF4D59E9FF4D59E9FF4D59E9FF4D59E9FF4D59
E9FF4D59E9FF4F5BE9FF7B83F0FF757BE2FF2E4BBADBFFFFFF00FFFFFF005F63
DAF6A1ABF7FF7086F8FF6882F6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF4D59E9FF5C66EAFF969CF1FF3250BCF6FFFFFF00FFFFFF006469
DBF6AFB9F9FF7F93FAFF7085F0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFF4D59E9FF5E6AEEFF969DF1FF364FBEF6FFFFFF00FFFFFF00676A
DEDBA5AFF5FF9DABFAFF778CF0FF545FECFF545FECFF545FECFF545FECFF545F
ECFF545FECFF6377F2FF818EF4FF787FE9FF3A53C0DBFFFFFF00FFFFFF006A69
E07E7D83EAFFCDD4FCFF8B9DFAFF7E93F7FF758AEEFF6C84F6FF6C84F6FF6C84
F6FF6C84F6FF6379F3FFA4AFF8FF3E4FD0FF3E54C27EFFFFFF00FFFFFF006C6C
E1226A69E0E5A3A7F3FFD4DBFDFF879AFAFF7F91F0FF7A8EF1FF7F94F8FF7E92
F9FF768CF8FFA8B6F8FF636EE3FF4557C7E54156C522FFFFFF00FFFFFF00FFFF
FF006D6CE3536A69E0F4AAADF2FFD8DCFDFFAEBAFAFF91A3FAFF8B9DFAFF9CA9
FBFFBAC7FCFF707BE9FF4C5BCCF44858CA53FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF006D6CE3536A6ADFE68E93EDFFBEC3F8FFCCD3F9FFC4CBF9FFAAB4
F4FF6670E2FF535ED1E6505DCE53FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF006D6DE2236B6AE17D686ADDDB6364DCF36164DAF35D63
D9DB5B63D67D5862D423FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
NumGlyphs = 0
OnClick = BtnRemoveCLICK
TabOrder = 5
end
object DlgLoad: TOpenDialog
Filter = '*.pp|*.pas'
FilterIndex = 0
left = 208
top = 272
end
end

View File

@ -1,515 +0,0 @@
{***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
* *
***************************************************************************
Author: Anthony Maro
}
unit OldCustomCompDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, LazFileUtils, lazutf8classes, LazUTF8, IDEProcs, OldCustomCompAddDlg;
Type
TRComponent = class(TObject)
public
Name: String;
Page: String;
unit_name: String;
end;
type
{ TFrmComponentMan }
TFrmComponentMan = class(TForm)
BtnCancel: TBitBtn;
Bitbtn2: TBitBtn;
BtnRemove: TBitBtn;
Button1: TBitBtn;
DlgLoad: TOpenDialog;
TxtPage: TEDIT;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
LblUnit: TLabel;
LblComponent: TLabel;
ListComps: TListBox;
procedure Bitbtn2CLICK(Sender: TObject);
procedure BtnCancelCLICK(Sender: TObject);
procedure BtnRemoveCLICK(Sender: TObject);
procedure Button1CLICK(Sender: TObject);
procedure FrmMainCREATE(Sender: TObject);
procedure FrmMainDESTROY(Sender: TObject);
procedure FrmMainSHOW(Sender: TObject);
procedure ListCompsCLICK(Sender: TObject);
procedure PopulateList;
procedure ParseRegister(ALine: String);
procedure TxtPageCHANGE(Sender: TObject);
procedure MakeHeader;
procedure MakeUses;
procedure MakeRegister;
function CountComponents: Integer;
function GetComponent(I: Integer): String;
function FindUnitName: String;
private
FLazPath: String;
MyFile: TStringListUTF8;
procedure SetLazPath(const AValue: String);
public
property LazPath: String read FLazPath write SetLazPath;
end;
function ShowConfigureCustomComponentDlg(const LazarusDir: string): TModalResult;
implementation
{$R *.lfm}
function ShowConfigureCustomComponentDlg(
const LazarusDir: string): TModalResult;
var
FrmComponentMan: TFrmComponentMan;
begin
FrmComponentMan:=TFrmComponentMan.Create(nil);
FrmComponentMan.SetLazPath(LazarusDir);
Result:=FrmComponentMan.ShowModal;
FrmComponentMan.Free;
end;
{ TFrmComponentMan }
procedure TFrmComponentMan.BtnCancelCLICK(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
procedure TFrmComponentMan.BtnRemoveCLICK(Sender: TObject);
var
MyObj: TRComponent;
begin
if ListComps.ItemIndex > -1 then begin
MyObj := ListComps.Items.Objects[ListComps.ItemIndex] as TRComponent;
if assigned(MyObj) then MyObj.Free;
ListComps.Items.Delete(ListComps.ItemIndex);
end;
end;
procedure TFrmComponentMan.Button1CLICK(Sender: TObject);
var
I, J, NewCompCnt: Integer;
Found: Boolean;
MyObj: TRComponent;
begin
DlgLoad.InitialDir := AppendPathDelim(FLazPath)+'components/custom';
if DlgLoad.Execute then begin
// load in and parse the source
try
MyFile.Clear;
MyFile.LoadFromFile(DlgLoad.Filename);
except
MessageDlg('Error loading unit: '+DlgLoad.Filename,mtError,[mbCancel],0);
exit;
end;
NewCompCnt:=CountComponents;
//MessageDlg('Found '+inttostr(NewCompCnt), mtInformation,[mbOk],0);
if NewCompCnt > 30 then begin
// just to save face if something goes wrong...
MessageDlg('More than 30 components is not supported.', mtError, [mbCancel],0);
exit;
end;
if NewCompCnt<1 then begin
MessageDlg('No components found.', mtError, [mbCancel],0);
exit;
end;
if FrmAddComponent=nil then
FrmAddComponent := TFrmAddComponent.Create(Self);
FrmAddComponent.ListCompAdd.Clear;
for I := 1 to NewCompCnt do begin
//MessageDlg(GetComponent(I),mtInformation,[mbOk],0);
// only add if not already in the list
Found := False;
if FrmAddComponent.ListCompAdd.Items.Count > 0 then begin
for J := 0 to FrmAddComponent.ListCompAdd.Items.Count -1 do begin
if uppercase(FrmAddComponent.ListCompAdd.Items[J]) = uppercase(trim(GetComponent(I)))
then Found := True;
end;
end;
if not(Found) then FrmAddComponent.ListCompAdd.Items.Add(trim(GetComponent(I)));
end;
if FrmAddComponent.ShowModal = mrOk then begin
// add selected items...
for I := 0 to FrmAddComponent.ListCompAdd.Items.Count-1 do begin
if FrmAddComponent.ListCompAdd.Selected[i] then begin
// add this one if not already there...
Found := False;
if ListComps.Items.Count > 0 then begin
for J := 0 to ListComps.Items.Count -1 do begin
if Uppercase(FrmAddComponent.ListCompAdd.Items[i]) = uppercase(ListComps.Items[J]) then Found := True;
end;
end; // if listcomps contains items already
if not(Found) then begin
MyObj := TRComponent.Create;
MyObj.Name := FrmAddComponent.ListCompAdd.Items[i];
MyObj.Page := 'Custom';
MyObj.unit_name := FindUnitName;
ListComps.Items.AddObject(MyObj.Name, MyObj);
end; // if not found
end; // if listcompadd selected
end; // for I
end; // if showmodal
end;
end;
procedure TFrmComponentMan.Bitbtn2CLICK(Sender: TObject);
begin
// save the file...
MyFile.Clear;
MakeHeader;
MakeUses;
MakeRegister;
try
MyFile.SaveToFile(FLazPath+'components/custom/customidecomps.pas');
except
MessageDlg('Error saving customidecomps.pas!',mtError,[mbCancel],0);
exit;
end;
MessageDlg('Changes saved. Now return to Lazarus and Build the IDE',mtInformation,[mbOk],0);
ModalResult:=mrOk;
end;
procedure TFrmComponentMan.FrmMainCREATE(Sender: TObject);
begin
MyFile := TStringListUTF8.Create;
Caption:='Custom Component Manager (No packages!)';
Label1.Caption:='Installed Custom Components';
end;
procedure TFrmComponentMan.FrmMainDESTROY(Sender: TObject);
begin
MyFile.Free;
end;
procedure TFrmComponentMan.FrmMainSHOW(Sender: TObject);
var
RegisterFilename: String;
begin
LblComponent.Caption := '';
TxtPage.Text := '';
LblUnit.Caption := '';
// try to load the current customidecomps files
RegisterFilename:=
AppendPathDelim(FLazPath)+'components/custom/customidecomps.pas';
try
MyFile.LoadFromFile(RegisterFilename);
except
on E: Exception do begin
if messagedlg('Error loading '+RegisterFilename+': '+E.Message+#13#10+
'Will start with blank file.', mtError, [mbOk,mbAbort],0)
<>mrOk
then begin
ModalResult:=mrCancel;
end;
MyFile.Clear;
exit;
end;
end;
if ((MyFile.Count < 1)
or (MyFile[0] <> '{ CustomIDEComps generated by Component Manager'))
then begin
if MessageDlg('This appears to be the first time you have used Component Manager.'+#13#10+
'Your original file will be backed up.',
mtConfirmation, [mbOk,mbAbort],0)
<>mrOk
then begin
ModalResult:=mrCancel;
MyFile.Clear;
exit;
end;
MyFile.SaveToFile(ChangeFileExt(RegisterFilename,'.orig'));
end;
// okay got a good file here...
PopulateList;
ListCompsClick(Self);
end;
procedure TFrmComponentMan.ListCompsCLICK(Sender: TObject);
var
MyObj: TRComponent;
begin
if ListComps.ItemIndex < 0 then exit;
MyObj := ListComps.Items.Objects[ListComps.ItemIndex] as TRComponent;
if assigned(MyObj) then begin
LblComponent.Caption := Myobj.Name;
TxtPage.Text := MyObj.Page;
LblUnit.Caption := MyObj.unit_name;
end;
end;
procedure TFrmComponentMan.PopulateList;
var
I: Integer;
begin
// search the file for the REGISTER entry and list all components found
for I := 0 to MyFile.Count - 1 do begin
if uppercase(copy(trim(MyFile[I]),1,18)) = 'REGISTERCOMPONENT(' then begin
// got the start here... parse it
ParseRegister(MyFile[I]);
end
end;
end;
procedure TFrmComponentMan.ParseRegister(ALine: String);
var
MyObj: TRComponent;
CompName, CompUnit, CompPage, TempStr, TempLine: String;
begin
// given a line, parse and add the object to the list
TempLine := Trim(ALine);
if copy(TempLine,1,18) = 'RegisterComponent(' then begin
TempStr := copy(TempLine,20,255);
CompPage := copy(TempStr,1,pos('''', TempStr)-1);
TempStr := copy(TempStr,pos('''', TempStr)+3,255);
CompUnit := copy(TempStr,1,pos('''', TempStr)-1);
TempStr := copy(TempStr,pos('''', TempStr)+2,255);
CompName := copy(TempStr,1,pos(')', TempStr)-1);
MyObj := TRComponent.Create;
MyObj.Name := CompName;
MyObj.Page := CompPage;
MyObj.Unit_Name := CompUnit;
ListComps.Items.AddObject(CompName, MyObj);
end;
end;
procedure TFrmComponentMan.TxtPageCHANGE(Sender: TObject);
var
MyObj: TRComponent;
begin
if ListComps.ItemIndex >= 0 then begin
MyObj := ListComps.Items.Objects[ListComps.ItemIndex] as TRComponent;
if assigned(MyObj) then begin
MyObj.Page := TxtPage.Text;
end;
end;
end;
procedure TFrmComponentMan.MakeHeader;
begin
with MyFile do begin
Add('{ CustomIDEComps generated by Component Manager');
Add(' Last generated '+formatdatetime('MM/DD/YYYY', Now()));
Add(' Component Manager written by Anthony Maro');
Add(' http://tony.maro.net/ tony@maro.net');
Add('}');
Add('');
Add('unit CustomIDEComps;');
Add('');
Add('{$mode objfpc}{$H+}');
Add('');
Add('interface');
Add('');
end;
end;
procedure TFrmComponentMan.MakeUses;
var
I, J: Integer;
MyObj, MyObj2: TRComponent;
Found: Boolean;
begin
with MyFile do begin
Add('//USES SECTION');
Add('uses');
if ListComps.Items.Count > 0 then begin
Add(' Classes,');
for I := 0 to ListComps.Items.Count-1 do begin
MyObj := ListComps.Items.Objects[I] as TRComponent;
if assigned(MyObj) then begin
Found := False;
if I > 0 then begin
for J := 0 to I-1 do begin
// see if we already got this one...
MyObj2 := ListComps.Items.Objects[J] as TRComponent;
//messagedlg('Comparing object '+MyObj.Name+' at '+inttostr(I)+' with '+MyObj2.Name, mtInformation,[mbOk],0);
if assigned(MyOBj2) then begin
Found := CompareText(MyObj2.Unit_Name,Myobj.Unit_Name)=0;
end; // if assigned
end; // for J
end; // For I
if not(Found) then add(' '+MyObj.Unit_Name+',');
end;
end; // for I
// remove last comma
MyFile[MyFile.Count-1] := copy(MyFile[MyFile.Count-1],1,length(MyFile[MyFile.Count-1])-1);
end else add(' Classes');
Add(' ;');
Add('');
Add('type');
Add(' TRegisterComponentProc = procedure(const Page, TheUnitName:ShortString;');
Add(' ComponentClass: TComponentClass);');
Add('');
Add('procedure RegisterCustomComponents(RegisterComponent: TRegisterComponentProc);');
Add('');
Add('implementation');
Add('');
Add('procedure RegisterCustomComponents(RegisterComponent: TRegisterComponentProc);');
Add('begin');
Add('');
end; // with MyFile
end;
procedure TFrmComponentMan.MakeRegister;
var
I: Integer;
MyObj: TRComponent;
begin
MyFile.Add('//REGISTER');
if ListComps.Items.Count > 0 then begin
for I := 0 to ListComps.Items.Count - 1 do begin
MyObj := ListComps.Items.Objects[I] as TRComponent;
if assigned(MyObj) then begin
MyFile.Add(' RegisterComponent('''+MyObj.Page+''','''+MyObj.unit_name+''','+MyObj.Name+');');
end;
end;
end;
MyFile.Add('//ENDREGISTER');
MyFile.Add('');
MyFile.Add('end;');
MyFile.Add('');
MyFile.Add('end.');
end;
function TFrmComponentMan.CountComponents: Integer;
var
I, J: integer;
Count: Integer;
begin
Count := 0;
Result := 0;
if MyFile.Count < 0 then
exit;
for I := 0 to MyFile.Count -1 do begin
// find start of TYPE
if pos('TYPE', uppercase(MyFile[i])) > 0 then begin
//messagedlg('Found TYPE at '+inttostr(i),mtInformation,[mbOk],0);
for J := I+1 to MyFile.Count -1 do begin
if ((pos('= CLASS', uppercase(MyFile[j])) > 0) or
(pos('=CLASS', uppercase(MyFile[j])) > 0)) then begin
// found one!
//messagedlg('Found CLASS'+#13#10+MyFile[J],mtInformation,[mbOk],0);
Count := Count + 1;
end; // if class
if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin
// that's it
//messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0);
exit(Count);
end;
end; // For J
exit(Count);
end; // if pos('TYPE');
end; // for I
end;
function TFrmComponentMan.GetComponent(I: Integer): String;
var
K, J: integer;
Count: Integer;
begin
Result := '';
Count := 0;
if MyFile.Count < 0 then
exit;
for K := 0 to MyFile.Count -1 do begin
// find start of TYPE
if pos('TYPE', uppercase(MyFile[K])) > 0 then begin
for J := K+1 to MyFile.Count -1 do begin
if ((pos('= CLASS', uppercase(MyFile[j])) > 0) or
(pos('=CLASS', uppercase(MyFile[j])) > 0)) then begin
// found one!
Count := Count + 1;
if Count = I then
exit(Trim(copy(MyFile[J],1,pos('=',MyFile[j])-1)));
end; // if class
if 'IMPLEMENTATION' = uppercase(MyFile[J]) then begin
// that's it
//messagedlg('Found IMPLEMENTATION at '+inttostr(J),mtInformation,[mbOk],0);
exit;
end;
end; // For J
exit;
end; // if pos('TYPE');
end; // for I
end;
function TFrmComponentMan.FindUnitName: String;
var
I: Integer;
TempStr: String;
begin
Result := '';
if MyFile.Count < 1 then exit;
for I := 0 to MyFile.Count - 1 do begin
if uppercase(copy(MyFile[i],1,4)) = 'UNIT' then begin
TempStr := copy(MyFile[i],5,64);
TempStr := trim(TempStr);
if copy(TempStr,length(TempStr),1) = ';' then TempStr := copy(TempStr,1,length(TempStr)-1);
exit(TempStr);
end; // if UNIT found
end; // for I
end;
procedure TFrmComponentMan.SetLazPath(const AValue: String);
begin
if FLazPath=AValue then exit;
FLazPath:=AValue;
end;
end.

View File

@ -178,7 +178,6 @@ type
FAbortRegistration: boolean;
fChanged: boolean;
FCodeToolsPackage: TLazPackage;
FDefaultPackage: TLazPackage;
FErrorMsg: string;
FFCLPackage: TLazPackage;
FIDEIntfPackage: TLazPackage;
@ -424,8 +423,6 @@ type
procedure RegisterStaticBasePackages;
procedure RegisterStaticPackage(APackage: TLazPackage;
RegisterProc: TRegisterProc);
procedure RegisterDefaultPackageComponent(const Page, AUnitName: ShortString;
ComponentClass: TComponentClass);
procedure CallRegisterProc(RegisterProc: TRegisterProc);
public
// dependency handling
@ -466,7 +463,6 @@ type
property DebuggerIntfPackage: TLazPackage read FDebuggerIntfPackage;
property LazDebuggerGdbmiPackage: TLazPackage read FLazDebuggerGdbmiPackage;
property LazarusBasePackages: TFPList read FLazarusBasePackages;
property DefaultPackage: TLazPackage read FDefaultPackage;// fall back package for buggy/obsoleted stuff
// events
property OnAddPackage: TPkgAddedEvent read FOnAddPackage write FOnAddPackage;
@ -508,12 +504,6 @@ procedure WarnSuspiciousCompilerOptions(ViewCaption, Target, CompilerParams: str
implementation
procedure RegisterCustomIDEComponent(const Page, AUnitName: ShortString;
ComponentClass: TComponentClass);
begin
PackageGraph.RegisterDefaultPackageComponent(Page,AUnitName,ComponentClass);
end;
procedure RegisterComponentsGlobalHandler(const Page: string;
ComponentClasses: array of TComponentClass);
begin
@ -1089,7 +1079,6 @@ begin
if OnGetAllRequiredPackages=@GetAllRequiredPackages then
OnGetAllRequiredPackages:=nil;
Clear;
FreeAndNil(FDefaultPackage);
FreeAndNil(FLazarusBasePackages);
FreeAndNil(FItems);
FreeAndNil(FTree);
@ -2216,9 +2205,6 @@ begin
LoadLazarusBasePackage('LazDebuggerGdbmi');
LoadLazarusBasePackage('LazControls');
LoadLazarusBasePackage('CodeTools');
// the default package will be added on demand
if FDefaultPackage=nil then
FDefaultPackage:=CreateDefaultPackage;
SortAutoInstallDependencies;
@ -5449,20 +5435,6 @@ begin
// IDE built-in packages
if Assigned(OnTranslatePackage) then OnTranslatePackage(CodeToolsPackage);
// register custom IDE components
RegistrationPackage:=DefaultPackage;
{$IFDEF CustomIDEComps}
if IDEComponentPalette<>nil then
IDEComponentPalette.RegisterCustomIDEComponents(@RegisterCustomIDEComponent);
{$ENDIF}
if DefaultPackage.FileCount=0 then begin
FreeThenNil(FDefaultPackage);
end else begin
DefaultPackage.Name:=CreateUniquePkgName('DefaultPackage',DefaultPackage);
AddPackage(DefaultPackage);
end;
RegistrationPackage:=nil;
EndUpdate;
end;
@ -5479,22 +5451,6 @@ begin
RegistrationPackage:=nil;
end;
procedure TLazPackageGraph.RegisterDefaultPackageComponent(const Page,
AUnitName: ShortString; ComponentClass: TComponentClass);
var
PkgFile: TPkgFile;
NewPkgFilename: String;
begin
PkgFile:=FDefaultPackage.FindUnit(AUnitName,true);
if PkgFile=nil then begin
NewPkgFilename:=AUnitName+'.pas';
PkgFile:=FDefaultPackage.AddFile(NewPkgFilename,AUnitName,pftUnit,[],
cpOptional);
end;
FRegistrationFile:=PkgFile;
RegisterComponentsHandler(Page,[ComponentClass]);
end;
procedure TLazPackageGraph.CallRegisterProc(RegisterProc: TRegisterProc);
begin
if AbortRegistration then exit;

View File

@ -3011,9 +3011,6 @@ begin
itmPkgPkgGraph.OnClick:=@MainIDEitmPkgPkgGraphClick;
itmPkgPackageLinks.OnClick:=@MainIDEitmPackageLinksClicked;
itmPkgEditInstallPkgs.OnClick:=@MainIDEitmPkgEditInstallPkgsClick;
{$IFDEF CustomIDEComps}
itmCompsConfigCustomComps.OnClick :=@MainIDEitmConfigCustomCompsClicked;
{$ENDIF}
end;
SetRecentPackagesMenu;