mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-04 11:20:38 +01:00
cody: register cody window
git-svn-id: trunk@30773 -
This commit is contained in:
parent
63e53247ca
commit
0cc90bc739
@ -1,9 +1,48 @@
|
||||
object CodyWindow: TCodyWindow
|
||||
Left = 345
|
||||
Height = 310
|
||||
Height = 304
|
||||
Top = 205
|
||||
Width = 337
|
||||
Width = 272
|
||||
Caption = 'CodyWindow'
|
||||
ClientHeight = 304
|
||||
ClientWidth = 272
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.31'
|
||||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 0
|
||||
Width = 272
|
||||
Caption = 'ToolBar1'
|
||||
TabOrder = 0
|
||||
object RefreshToolButton: TToolButton
|
||||
Left = 1
|
||||
Top = 2
|
||||
Caption = 'RefreshToolButton'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
end
|
||||
object OptionsToolButton: TToolButton
|
||||
Left = 24
|
||||
Top = 2
|
||||
Caption = 'OptionsToolButton'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
end
|
||||
end
|
||||
object TreeView1: TTreeView
|
||||
Left = 0
|
||||
Height = 278
|
||||
Top = 26
|
||||
Width = 272
|
||||
Align = alClient
|
||||
DefaultItemHeight = 19
|
||||
TabOrder = 1
|
||||
end
|
||||
object ImageList1: TImageList
|
||||
left = 98
|
||||
top = 54
|
||||
end
|
||||
end
|
||||
|
||||
@ -33,26 +33,78 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
Buttons, ComCtrls,
|
||||
// codetools
|
||||
//FileProcs, CodeToolManager, SourceLog, CodeCache, EventCodeTool,
|
||||
//LinkScanner, PascalParserTool, CodeTree,
|
||||
// IDEIntf
|
||||
//LazIDEIntf, SrcEditorIntf, IDEDialogs,
|
||||
LazIDEIntf, IDEWindowIntf,
|
||||
// cody
|
||||
CodyStrConsts;
|
||||
|
||||
type
|
||||
|
||||
{ TCodyWindow }
|
||||
|
||||
TCodyWindow = class(TForm)
|
||||
ImageList1: TImageList;
|
||||
ToolBar1: TToolBar;
|
||||
RefreshToolButton: TToolButton;
|
||||
OptionsToolButton: TToolButton;
|
||||
TreeView1: TTreeView;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
private
|
||||
ImgIDRefresh: Integer;
|
||||
ImgIDOptions: Integer;
|
||||
public
|
||||
end;
|
||||
|
||||
var
|
||||
CodyWindow: TCodyWindow;
|
||||
CodyWindow: TCodyWindow = nil;
|
||||
CodyWindowCreator: TIDEWindowCreator; // set by CodyRegistration.Register
|
||||
|
||||
procedure ShowCodyWindow(Sender: TObject);
|
||||
procedure CreateCodyWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
|
||||
implementation
|
||||
|
||||
procedure ShowCodyWindow(Sender: TObject);
|
||||
begin
|
||||
IDEWindowCreators.ShowForm(CodyWindowCreator.FormName,true);
|
||||
end;
|
||||
|
||||
procedure CreateCodyWindow(Sender: TObject; aFormName: string;
|
||||
var AForm: TCustomForm; DoDisableAutoSizing: boolean);
|
||||
begin
|
||||
IDEWindowCreators.CreateForm(AForm,TCodyWindow,DoDisableAutoSizing,
|
||||
LazarusIDE.OwningComponent);
|
||||
AForm.Name:=aFormName;
|
||||
end;
|
||||
|
||||
{ TCodyWindow }
|
||||
|
||||
procedure TCodyWindow.FormCreate(Sender: TObject);
|
||||
begin
|
||||
if CodyWindow=nil then CodyWindow:=Self;
|
||||
Caption:='Cody';
|
||||
|
||||
ImgIDRefresh := Imagelist1.AddLazarusResource('laz_refresh');
|
||||
ImgIDOptions := Imagelist1.AddLazarusResource('menu_environment_options');
|
||||
ToolBar1.Images:=ImageList1;
|
||||
OptionsToolButton.Hint:=crsOptions;
|
||||
OptionsToolButton.ImageIndex:=ImgIDOptions;
|
||||
RefreshToolButton.Hint:=crsRefresh;
|
||||
RefreshToolButton.ImageIndex:=ImgIDRefresh;
|
||||
end;
|
||||
|
||||
procedure TCodyWindow.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
|
||||
if CodyWindow=Self then CodyWindow:=nil;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -30,10 +30,10 @@ unit CodyRegistration;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
IDECommands, MenuIntf,
|
||||
LResources, CodyStrConsts, CodyCtrls, PPUListDlg, AddAssignMethodDlg,
|
||||
CodyUtils, CodyNodeInfoDlg;
|
||||
Classes, SysUtils, LResources, Controls,
|
||||
IDECommands, MenuIntf, IDEWindowIntf,
|
||||
CodyStrConsts, CodyCtrls, PPUListDlg, AddAssignMethodDlg,
|
||||
CodyUtils, CodyNodeInfoDlg, CodyFrm;
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -52,6 +52,8 @@ var
|
||||
TVIconRes: TLResource;
|
||||
AddCallInheritedCommand: TIDECommand;
|
||||
ShowCodeNodeInfoCommand: TIDECommand;
|
||||
CmdCatView: TIDECommandCategory;
|
||||
ViewCodyWindowCommand: TIDECommand;
|
||||
begin
|
||||
CmdCatFileMenu:=IDECommandList.FindCategoryByName('FileMenu');
|
||||
if CmdCatFileMenu=nil then
|
||||
@ -59,9 +61,13 @@ begin
|
||||
CmdCatProjectMenu:=IDECommandList.FindCategoryByName('ProjectMenu');
|
||||
if CmdCatProjectMenu=nil then
|
||||
raise Exception.Create('cody: command category ProjectMenu not found');
|
||||
CmdCatCodeTools:=IDECommandList.FindCategoryByName('CodeTools');
|
||||
CmdCatCodeTools:=IDECommandList.FindCategoryByName(CommandCategoryCodeTools);
|
||||
if CmdCatCodeTools=nil then
|
||||
raise Exception.Create('cody: command category CodeTools not found');
|
||||
raise Exception.Create('cody: command category '+CommandCategoryCodeTools+' not found');
|
||||
CmdCatView:=IDECommandList.FindCategoryByName(CommandCategoryViewName);
|
||||
if CmdCatView=nil then
|
||||
raise Exception.Create('cody: command category '+CommandCategoryViewName+' not found');
|
||||
|
||||
|
||||
// Source menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@ -93,12 +99,6 @@ begin
|
||||
RegisterIDEMenuCommand(SrcEditSubMenuRefactor, 'DeclareVariable',
|
||||
crsDeclareVariable2, nil, nil, DeclareVariableCommand);}
|
||||
|
||||
// Show CodeTools node info
|
||||
ShowCodeNodeInfoCommand:=RegisterIDECommand(CmdCatCodeTools, 'ShowCodeNodeInfo',
|
||||
crsShowCodeToolsNodeInfo,
|
||||
CleanIDEShortCut,CleanIDEShortCut,nil,@ShowCodeNodeInfoDialog);
|
||||
RegisterIDEMenuCommand(itmViewIDEInternalsWindows, 'ShowCodeNodeInfo',
|
||||
crsShowCodeToolsNodeInfo, nil, nil, ShowCodeNodeInfoCommand);
|
||||
|
||||
// Refactor menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@ -116,10 +116,32 @@ begin
|
||||
RegisterIDEMenuCommand(SrcEditSubMenuRefactor, 'RemoveWithBlock',
|
||||
crsRemoveWithBlock, nil, nil, RemoveWithBlockCommand);
|
||||
|
||||
// components
|
||||
// IDE internals menu - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// Show CodeTools node info
|
||||
ShowCodeNodeInfoCommand:=RegisterIDECommand(CmdCatCodeTools, 'ShowCodeNodeInfo',
|
||||
crsShowCodeToolsNodeInfo,
|
||||
CleanIDEShortCut,CleanIDEShortCut,nil,@ShowCodeNodeInfoDialog);
|
||||
RegisterIDEMenuCommand(itmViewIDEInternalsWindows, 'ShowCodeNodeInfo',
|
||||
crsShowCodeToolsNodeInfo, nil, nil, ShowCodeNodeInfoCommand);
|
||||
|
||||
|
||||
// View menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ViewCodyWindowCommand:=RegisterIDECommand(CmdCatView, 'Cody',
|
||||
'Cody', CleanIDEShortCut, CleanIDEShortCut, nil, @ShowCodyWindow);
|
||||
RegisterIDEMenuCommand(itmViewMainWindows, 'ViewCody',
|
||||
'Cody', nil, nil, ViewCodyWindowCommand);
|
||||
|
||||
|
||||
// Components - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TVIconRes:=LazarusResources.Find('TTreeView');
|
||||
LazarusResources.Add(TCodyTreeView.ClassName,TVIconRes.ValueType,TVIconRes.Value);
|
||||
RegisterComponents('LazControls',[TCodyTreeView]);
|
||||
|
||||
// Windows - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CodyWindowCreator:=IDEWindowCreators.Add('CodyWindow',@CreateCodyWindow,nil,
|
||||
'80%','50%','+18%','+25%','CodeExplorer',alBottom);
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -116,6 +116,8 @@ resourcestring
|
||||
+'cursor of the source editor in an implementation of an overridden method.';
|
||||
crsCodeNodeInformation = 'Code Node Information';
|
||||
crsReport = 'Report';
|
||||
crsOptions = 'Options';
|
||||
crsRefresh = 'Refresh';
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
@ -214,6 +214,10 @@ msgstr "Nessun progetto"
|
||||
msgid "No unit selected"
|
||||
msgstr "Nessuna unit selezionata"
|
||||
|
||||
#: codystrconsts.crsoptions
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crspackage
|
||||
msgid "Package"
|
||||
msgstr "Pacchetto"
|
||||
@ -242,6 +246,10 @@ msgstr "Il progetto non ha un sorgente principale."
|
||||
msgid "Project output"
|
||||
msgstr "Output del progetto"
|
||||
|
||||
#: codystrconsts.crsrefresh
|
||||
msgid "Refresh"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crsremovewithblock
|
||||
msgid "Remove With block"
|
||||
msgstr ""
|
||||
|
||||
@ -205,6 +205,10 @@ msgstr ""
|
||||
msgid "No unit selected"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crsoptions
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crspackage
|
||||
msgid "Package"
|
||||
msgstr ""
|
||||
@ -233,6 +237,10 @@ msgstr ""
|
||||
msgid "Project output"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crsrefresh
|
||||
msgid "Refresh"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crsremovewithblock
|
||||
msgid "Remove With block"
|
||||
msgstr ""
|
||||
|
||||
@ -213,6 +213,10 @@ msgstr "Nenhum projeto"
|
||||
msgid "No unit selected"
|
||||
msgstr "Nenhuma unidade selecionada"
|
||||
|
||||
#: codystrconsts.crsoptions
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crspackage
|
||||
msgid "Package"
|
||||
msgstr "Pacote"
|
||||
@ -241,6 +245,10 @@ msgstr "Projeto não tem arquivo fonte principal."
|
||||
msgid "Project output"
|
||||
msgstr "Saída do Projeto"
|
||||
|
||||
#: codystrconsts.crsrefresh
|
||||
msgid "Refresh"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crsremovewithblock
|
||||
msgid "Remove With block"
|
||||
msgstr "Remover bloco \"With\""
|
||||
|
||||
@ -213,6 +213,10 @@ msgstr "Проект отсутствует"
|
||||
msgid "No unit selected"
|
||||
msgstr "Модуль не выбран"
|
||||
|
||||
#: codystrconsts.crsoptions
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crspackage
|
||||
msgid "Package"
|
||||
msgstr "Пакет"
|
||||
@ -241,6 +245,10 @@ msgstr "В проекте отсутствует главный файл исх
|
||||
msgid "Project output"
|
||||
msgstr "Вывод проекта"
|
||||
|
||||
#: codystrconsts.crsrefresh
|
||||
msgid "Refresh"
|
||||
msgstr ""
|
||||
|
||||
#: codystrconsts.crsremovewithblock
|
||||
msgid "Remove With block"
|
||||
msgstr "Удалить блок With"
|
||||
|
||||
@ -2617,7 +2617,7 @@ begin
|
||||
AddDefault(C, 'Toggle marker 9', lisKMToggleMarker9, ecToggleMarker9);
|
||||
|
||||
// codetools
|
||||
C:=Categories[AddCategory('CodeTools',srkmCatCodeTools,IDECmdScopeSrcEditOnly)];
|
||||
C:=Categories[AddCategory(CommandCategoryCodeTools,srkmCatCodeTools,IDECmdScopeSrcEditOnly)];
|
||||
AddDefault(C, 'Code template completion', srkmecAutoCompletion, ecAutoCompletion);
|
||||
AddDefault(C, 'Word completion', srkmecWordCompletion, ecWordCompletion);
|
||||
AddDefault(C, 'Complete code', srkmecCompletecode, ecCompleteCode);
|
||||
|
||||
@ -535,6 +535,7 @@ const
|
||||
CommandCategoryCustomName = 'Custom';
|
||||
CommandCategoryTextEditingName = 'text editing commands';
|
||||
CommandCategoryViewName = 'ViewMenu';
|
||||
CommandCategoryCodeTools = 'CodeTools';
|
||||
|
||||
// register a new IDE command category (i.e. set of commands)
|
||||
function RegisterIDECommandCategory(Parent: TIDECommandCategory;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user