2
*****************************************************************************
4
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
5
* for details about the copyright. *
7
* This program is distributed in the hope that it will be useful, *
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
11
*****************************************************************************
16
This unit installs the TemplateName window in the Lazarus IDE.
18
unit TemplateIDEDockableWindow;
26
Classes, SysUtils, LazLogger, FileUtil, Forms, Controls, Graphics, Dialogs,
27
LCLType, IDECommands, IDEWindowIntf, LazIDEIntf, MenuIntf
33
TTemplateName = class(TForm)
35
{ private declarations }
37
{ public declarations }
41
TemplateName: TTemplateName;
42
TemplateNameCreator: TIDEWindowCreator; // set by Register procedure
44
procedure ShowTemplateName(Sender: TObject);
45
procedure Register; // Check the "Register Unit" of this unit in the package editor.
48
// ImplementationStart
53
procedure ShowTemplateName(Sender: TObject);
55
IDEWindowCreators.ShowForm(TemplateNameCreator.FormName,true);
58
procedure CreateTemplateName(Sender: TObject; aFormName: string;
59
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
61
// sanity check to avoid clashing with another package that has registered a window with the same name
62
if CompareText(aFormName,'TemplateName')<>0 then begin
63
DebugLn(['ERROR: CreateTemplateName: there is already a form with this name']);
66
IDEWindowCreators.CreateForm(AForm,TTemplateName,DoDisableAutoSizing,
67
LazarusIDE.OwningComponent);
68
AForm.Name:=aFormName;
69
TemplateName:=AForm as TTemplateName;
74
CmdCatViewMenu: TIDECommandCategory;
75
ViewTemplateNameCommand: TIDECommand;
76
MenuItemCaption: String;
78
// register shortcut and menu item
79
MenuItemCaption:='Caption of TemplateName'; // <- this caption should be replaced by a resourcestring
80
// search shortcut category
81
CmdCatViewMenu:=IDECommandList.FindCategoryByName(CommandCategoryViewName);
83
ViewTemplateNameCommand:=RegisterIDECommand(CmdCatViewMenu,
86
IDEShortCut(VK_UNKNOWN,[]), // <- set here your default shortcut
87
CleanIDEShortCut,nil,@ShowTemplateName);
88
// register menu item in View menu
89
RegisterIDEMenuCommand(itmViewMainWindows,
91
MenuItemCaption, nil, nil, ViewTemplateNameCommand);
93
// register dockable Window
94
TemplateNameCreator:=IDEWindowCreators.Add(
96
@CreateTemplateName,nil,
97
'100','100','300','300' // default place at left=100, top=100, width=300, height=300
98
// you can also define percentage values of screen or relative positions, see wiki