component palette popup menu now searches for virtual units

git-svn-id: trunk@7883 -
This commit is contained in:
mattias 2005-10-02 10:02:06 +00:00
parent 00692af0ed
commit 859081d346
5 changed files with 24 additions and 18 deletions

View File

@ -1,6 +1,5 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install
the package InterbaseLaz 1.0.
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit InterbaseLaz;
@ -18,5 +17,5 @@ begin
end;
initialization
RegisterPackage('InterbaseLaz', @Register)
RegisterPackage('InterbaseLaz', @Register);
end.

View File

@ -40,7 +40,7 @@ interface
uses
Classes, SysUtils, LCLProc, Controls, Dialogs, Graphics, ExtCtrls, Buttons,
Menus, LResources, AVL_Tree,
PropEdits, FormEditingIntf,
PropEdits, FormEditingIntf, LazIDEIntf,
{$IFDEF CustomIDEComps}
CustomIDEComps,
{$ENDIF}
@ -162,6 +162,7 @@ procedure TComponentPalette.PopupMenuPopup(Sender: TObject);
var
PkgComponent: TPkgComponent;
APackage: TLazPackage;
UnitFilename: String;
begin
PkgComponent:=TPkgComponent(FindButton(PopupMenu.PopupComponent));
APackage:=nil;
@ -173,8 +174,13 @@ begin
end else begin
OpenPackageMenuItem.Caption:='Open Package '+APackage.IDAsString;
OpenPackageMenuItem.Visible:=true;
OpenUnitMenuItem.Caption:='Open Unit '+PkgComponent.PkgFile.Filename;
UnitFilename:=PkgComponent.PkgFile.Filename;
if not FileExists(UnitFilename) then
UnitFilename:=LazarusIDE.FindSourceFile(ExtractFilename(UnitFilename),
APackage.Directory,[]);
OpenUnitMenuItem.Caption:='Open Unit '+UnitFilename;
OpenUnitMenuItem.Visible:=true;
OpenUnitMenuItem.Enabled:=FileExists(UnitFilename);
end;
end;

View File

@ -42,7 +42,7 @@ uses
Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileUtil, LCLProc,
Laz_XMLCfg,
SynEdit, CodeCache, CodeToolManager,
MenuIntf, IDECommands,
MenuIntf, IDECommands, LazIDEIntf,
LazConf, DebugOptionsFrm,
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor,
Project, IDEProcs, InputHistory, Debugger,

View File

@ -117,14 +117,6 @@ type
);
TCodeToolsFlags = set of TCodeToolsFlag;
// find source flags
TFindSourceFlag = (
fsfSearchForProject,
fsfUseIncludePaths,
fsfUseDebugPath
);
TFindSourceFlags = set of TFindSourceFlag;
{ TMainIDEInterface }
TMainIDEInterface = class(TLazIDEInterface)
@ -145,9 +137,6 @@ type
procedure HideIDE; virtual; abstract;
procedure UnhideIDE; virtual; abstract;
function FindUnitFile(const AFilename: string): string; virtual; abstract;
function FindSourceFile(const AFilename, BaseDirectory: string;
Flags: TFindSourceFlags): string; virtual; abstract;
procedure GetCurrentUnitInfo(var ActiveSourceEditor: TSourceEditorInterface;
var ActiveUnitInfo: TUnitInfo); virtual; abstract;
procedure GetUnitInfoForDesigner(ADesigner: TIDesigner;

View File

@ -76,6 +76,14 @@ type
);
TSearchIDEFileFlags = set of TSearchIDEFileFlag;
// find source flags
TFindSourceFlag = (
fsfSearchForProject,
fsfUseIncludePaths,
fsfUseDebugPath
);
TFindSourceFlags = set of TFindSourceFlag;
{ TLazIDEInterface }
TLazIDEInterface = class(TComponent)
@ -85,6 +93,10 @@ type
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function FindUnitFile(const AFilename: string): string; virtual; abstract;
function FindSourceFile(const AFilename, BaseDirectory: string;
Flags: TFindSourceFlags): string; virtual; abstract;
function DoNewEditorFile(NewFileDescriptor: TProjectFileDescriptor;
NewFilename: string; const NewSource: string;
NewFlags: TNewFlags): TModalResult;