From 859081d3468728f70a013bec00665f190e06c93d Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 2 Oct 2005 10:02:06 +0000 Subject: [PATCH] component palette popup menu now searches for virtual units git-svn-id: trunk@7883 - --- components/interbase/interbaselaz.pas | 7 +++---- ide/componentpalette.pas | 10 ++++++++-- ide/debugmanager.pas | 2 +- ide/mainintf.pas | 11 ----------- ideintf/lazideintf.pas | 12 ++++++++++++ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/components/interbase/interbaselaz.pas b/components/interbase/interbaselaz.pas index 797be0795b..71edb3dd5c 100644 --- a/components/interbase/interbaselaz.pas +++ b/components/interbase/interbaselaz.pas @@ -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. diff --git a/ide/componentpalette.pas b/ide/componentpalette.pas index b54e9209e0..8b7390abdc 100644 --- a/ide/componentpalette.pas +++ b/ide/componentpalette.pas @@ -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; diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 2777a5bd00..051a145e0d 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -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, diff --git a/ide/mainintf.pas b/ide/mainintf.pas index 7cdaeb948e..90f67eb4ee 100644 --- a/ide/mainintf.pas +++ b/ide/mainintf.pas @@ -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; diff --git a/ideintf/lazideintf.pas b/ideintf/lazideintf.pas index 8bfde31e71..4dcf7c2a57 100644 --- a/ideintf/lazideintf.pas +++ b/ideintf/lazideintf.pas @@ -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;