todolist: menu item for package editors

git-svn-id: trunk@26161 -
This commit is contained in:
mattias 2010-06-17 17:19:15 +00:00
parent 7db6376b93
commit dcedf3e519
4 changed files with 31 additions and 4 deletions

View File

@ -30,8 +30,8 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, StdCtrls, Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, TodoList, ToDoListStrConsts, Buttons, ButtonPanel, MenuIntf, ExtCtrls, TodoList, ToDoListStrConsts, Buttons, ButtonPanel, Menus, MenuIntf,
SrcEditorIntf, IDECommands, LCLType, IDEWindowIntf, LazIDEIntf; PackageIntf, SrcEditorIntf, IDECommands, LCLType, IDEWindowIntf, LazIDEIntf;
type type
@ -77,7 +77,6 @@ var
Cat: TIDECommandCategory; Cat: TIDECommandCategory;
begin begin
// mattias: move icon resource item_todo to package // mattias: move icon resource item_todo to package
// mattias: add package intf for files and main file
// mattias: add menu item to package editor // mattias: add menu item to package editor
// mattias: test short cut // mattias: test short cut
@ -104,6 +103,10 @@ begin
RegisterIDEMenuCommand(itmViewMainWindows, 'ViewToDoList', RegisterIDEMenuCommand(itmViewMainWindows, 'ViewToDoList',
lisToDoList, nil, nil, ViewToDoListCmd, 'item_todo'); lisToDoList, nil, nil, ViewToDoListCmd, 'item_todo');
// add a menu item in the package editor
RegisterIDEMenuCommand(PkgEditMenuSectionMisc, 'ViewPkgToDoList',
lisToDoList, nil, nil, ViewToDoListCmd, 'item_todo');
// register window creator // register window creator
IDEWindowCreators.Add(ToDoWindowName,@CreateIDEToDoWindow,nil,'250','250','',''); IDEWindowCreators.Add(ToDoWindowName,@CreateIDEToDoWindow,nil,'250','250','','');
end; end;
@ -126,8 +129,13 @@ begin
end; end;
procedure ViewToDoList(Sender: TObject); procedure ViewToDoList(Sender: TObject);
var
Pkg: TIDEPackage;
begin begin
IDEWindowCreators.ShowForm(ToDoWindowName,true); IDEWindowCreators.ShowForm(ToDoWindowName,true);
Pkg:=PackageEditingInterface.GetPackageOfEditorItem(Sender);
if Pkg<>nil then
IDETodoWindow.OwnerFilename:=Pkg.Filename;
end; end;
procedure CreateIDEToDoWindow(Sender: TObject; aFormName: string; procedure CreateIDEToDoWindow(Sender: TObject; aFormName: string;

View File

@ -79,7 +79,8 @@
- on show again: restore a default layout - on show again: restore a default layout
- close button for pages - close button for pages
} }
{ TODO : RRR1
}
unit AnchorDocking; unit AnchorDocking;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}

View File

@ -223,6 +223,9 @@ type
function GetPackages(Index: integer): TIDEPackage; virtual; abstract; function GetPackages(Index: integer): TIDEPackage; virtual; abstract;
function FindPackageWithName(const PkgName: string): TIDEPackage; virtual; abstract; function FindPackageWithName(const PkgName: string): TIDEPackage; virtual; abstract;
// package editors
function GetPackageOfEditorItem(Sender: TObject): TIDEPackage; virtual; abstract;
// events // events
procedure RemoveAllHandlersOfObject(AnObject: TObject); procedure RemoveAllHandlersOfObject(AnObject: TObject);
procedure AddHandlerOnGraphChanged(const OnGraphChanged: TNotifyEvent; procedure AddHandlerOnGraphChanged(const OnGraphChanged: TNotifyEvent;

View File

@ -283,6 +283,7 @@ type
function WarnAboutMissingPackageFiles(APackage: TLazPackage): TModalResult; function WarnAboutMissingPackageFiles(APackage: TLazPackage): TModalResult;
function AddPackageDependency(APackage: TLazPackage; const ReqPackage: string; function AddPackageDependency(APackage: TLazPackage; const ReqPackage: string;
OnlyTestIfPossible: boolean = false): TModalResult; override; OnlyTestIfPossible: boolean = false): TModalResult; override;
function GetPackageOfEditorItem(Sender: TObject): TIDEPackage; override;
// package compilation // package compilation
@ -3671,6 +3672,20 @@ begin
end; end;
end; end;
function TPkgManager.GetPackageOfEditorItem(Sender: TObject): TIDEPackage;
begin
Result:=nil;
while (Sender is TMenuItem) and (TMenuItem(Sender).Parent<>nil) do
Sender:=TMenuItem(Sender).Parent;
if (Sender is TMenuItem) and (TMenuItem(Sender).Menu<>nil)
then
Sender:=TMenuItem(Sender).Menu;
if (Sender is TComponent) and (TComponent(Sender).Owner is TCustomForm) then
Sender:=TCustomForm(TComponent(Sender).Owner);
if Sender is TPackageEditorForm then
Result:=TPackageEditorForm(Sender).LazPackage;
end;
function TPkgManager.DoInstallPackage(APackage: TLazPackage): TModalResult; function TPkgManager.DoInstallPackage(APackage: TLazPackage): TModalResult;
var var
PkgList: TFPList; PkgList: TFPList;