mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 04:09:30 +02:00
IDE: toggle form: when on include serach unit
git-svn-id: trunk@33148 -
This commit is contained in:
parent
286cff9902
commit
dc4d739171
@ -80,8 +80,8 @@ const
|
||||
function ExtractFileNameOnly(const AFilename: string): string;
|
||||
function ExtractFileNameWithoutExt(const AFilename: string): string;
|
||||
function CompareFileExt(const Filename, Ext: string;
|
||||
CaseSensitive: boolean): integer;
|
||||
function CompareFileExt(const Filename, Ext: string): integer;
|
||||
CaseSensitive: boolean): integer; overload;
|
||||
function CompareFileExt(const Filename, Ext: string): integer; overload;
|
||||
function FilenameIsPascalUnit(const Filename: string): boolean;
|
||||
function AppendPathDelim(const Path: string): string;
|
||||
function ChompPathDelim(const Path: string): string;
|
||||
|
@ -91,7 +91,7 @@ var
|
||||
Info : Stat;
|
||||
begin
|
||||
// first check AFilename is not a directory and then check if executable
|
||||
Result:= (FpStat(AFilename,info)<>-1) and FPS_ISREG(info.st_mode) and
|
||||
Result:= (FpStat(AFilename,info{%H-})<>-1) and FPS_ISREG(info.st_mode) and
|
||||
(BaseUnix.FpAccess(AFilename,BaseUnix.X_OK)=0);
|
||||
end;
|
||||
|
||||
@ -111,7 +111,7 @@ function FileSize(const Filename: string): int64;
|
||||
var
|
||||
st: baseunix.stat;
|
||||
begin
|
||||
if not fpstat(pointer(Filename),st)>=0 then
|
||||
if not fpstat(pointer(Filename),st{%H-})>=0 then
|
||||
exit(-1);
|
||||
Result:=st.st_size;
|
||||
end;
|
||||
@ -131,7 +131,7 @@ var
|
||||
mode: mode_t;
|
||||
begin
|
||||
Result:='';
|
||||
if not (FpStat(AFilename,info)=0) then exit;
|
||||
if not (FpStat(AFilename,info{%H-})=0) then exit;
|
||||
|
||||
// permissions
|
||||
// file type
|
||||
|
13
ide/main.pp
13
ide/main.pp
@ -17578,8 +17578,21 @@ end;
|
||||
|
||||
function TMainIDE.GetDesignerFormOfSource(AnUnitInfo: TUnitInfo; LoadForm: boolean
|
||||
): TCustomForm;
|
||||
var
|
||||
UnitCodeBuf: TCodeBuffer;
|
||||
begin
|
||||
Result:=nil;
|
||||
if (AnUnitInfo.Component=nil)
|
||||
and (AnUnitInfo.Source<>nil)
|
||||
and (CompareFileExt(AnUnitInfo.Filename,'.inc',false)=0) then begin
|
||||
// include file => get unit
|
||||
UnitCodeBuf:=CodeToolBoss.GetMainCode(AnUnitInfo.Source);
|
||||
if UnitCodeBuf<>nil then begin
|
||||
AnUnitInfo:=Project1.ProjectUnitWithFilename(UnitCodeBuf.Filename);
|
||||
if AnUnitInfo=nil then exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if AnUnitInfo.Component<>nil then
|
||||
Result:=FormEditor1.GetDesignerForm(AnUnitInfo.Component);
|
||||
if ((Result=nil) or (Result.Designer=nil)) and LoadForm
|
||||
|
@ -5288,16 +5288,17 @@ var
|
||||
CurFilename, ShortFileName: String;
|
||||
ASrcEdit: TSourceEditor;
|
||||
|
||||
procedure MaybeAddPopup(const ASuffix: String; ANewOnClick: TNotifyEvent = nil;
|
||||
Filename: string = '');
|
||||
function MaybeAddPopup(const ASuffix: String; ANewOnClick: TNotifyEvent = nil;
|
||||
Filename: string = ''): TIDEMenuItem;
|
||||
begin
|
||||
Result:=nil;
|
||||
if ANewOnClick=nil then
|
||||
ANewOnClick:=@OnPopupMenuOpenFile;
|
||||
if Filename='' then Filename:=CurFilename;
|
||||
Filename:=ChangeFileExt(Filename,ASuffix);
|
||||
if not FileExistsCached(Filename) then exit;
|
||||
Filename:=CreateRelativePath(Filename,ExtractFilePath(ASrcEdit.FileName));
|
||||
AddContextPopupMenuItem(Format(lisOpenLfm,[Filename]), true, ANewOnClick);
|
||||
Result:=AddContextPopupMenuItem(Format(lisOpenLfm,[Filename]), true, ANewOnClick);
|
||||
end;
|
||||
|
||||
{$IFnDEF SingleSrcWindow}
|
||||
|
Loading…
Reference in New Issue
Block a user