mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 18:20:30 +02:00
MG: bugfixed event propeditor, DoJumpToMethod with searchpath
git-svn-id: trunk@321 -
This commit is contained in:
parent
22be600ffb
commit
e4749fdb14
@ -2843,17 +2843,20 @@ begin
|
|||||||
if Assigned(FOnGetMethodName) then
|
if Assigned(FOnGetMethodName) then
|
||||||
Result:=FOnGetMethodName(Method)
|
Result:=FOnGetMethodName(Method)
|
||||||
else begin
|
else begin
|
||||||
if Assigned(Method.Code) then
|
if Assigned(Method.Code) then begin
|
||||||
if Assigned(LookupRoot) then begin
|
if Assigned(LookupRoot) then begin
|
||||||
Result:=LookupRoot.MethodName(Method.Code);
|
Result:=LookupRoot.MethodName(Method.Code);
|
||||||
if Result='' then
|
if Result='' then
|
||||||
Result:='Unpublished';
|
Result:='Unpublished';
|
||||||
end else
|
end else
|
||||||
Result:='No LookupRoot';
|
Result:='No LookupRoot';
|
||||||
|
end else
|
||||||
|
Result:='';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPropertyEditorHook.GetMethods(TypeData:PTypeData; Proc:TGetStringProc);
|
procedure TPropertyEditorHook.GetMethods(TypeData:PTypeData;
|
||||||
|
Proc:TGetStringProc);
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnGetMethods) then
|
if Assigned(FOnGetMethods) then
|
||||||
FOnGetMethods(TypeData,Proc);
|
FOnGetMethods(TypeData,Proc);
|
||||||
@ -2864,7 +2867,7 @@ begin
|
|||||||
if Assigned(FOnMethodExists) then
|
if Assigned(FOnMethodExists) then
|
||||||
Result:=FOnMethodExists(Name)
|
Result:=FOnMethodExists(Name)
|
||||||
else
|
else
|
||||||
Result:=false;
|
Result:=Assigned(LookupRoot) and (LookupRoot.MethodAddress(Name)<>nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPropertyEditorHook.RenameMethod(const CurName, NewName:ShortString);
|
procedure TPropertyEditorHook.RenameMethod(const CurName, NewName:ShortString);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
}
|
}
|
||||||
unit CodeTemplateDialog;
|
unit CodeTemplateDialog;
|
||||||
|
|
||||||
{$mode objfpc}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
80
ide/main.pp
80
ide/main.pp
@ -2038,7 +2038,7 @@ var Ext,ACaption,AText:string;
|
|||||||
TempForm: TCustomForm;
|
TempForm: TCustomForm;
|
||||||
sl: TStringList;
|
sl: TStringList;
|
||||||
begin
|
begin
|
||||||
writeln('TMainIDE.DoOpenEditorFile "',AFilename,'"');
|
//writeln('TMainIDE.DoOpenEditorFile "',AFilename,'"');
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if AFileName='' then exit;
|
if AFileName='' then exit;
|
||||||
Ext:=lowercase(ExtractFileExt(AFilename));
|
Ext:=lowercase(ExtractFileExt(AFilename));
|
||||||
@ -2222,14 +2222,14 @@ writeln('TMainIDE.DoOpenEditorFile "',AFilename,'"');
|
|||||||
PropertyEditorHook1.LookupRoot := TForm(CInterface.Control);
|
PropertyEditorHook1.LookupRoot := TForm(CInterface.Control);
|
||||||
TDesigner(TempForm.Designer).SelectOnlyThisComponent(TempForm);
|
TDesigner(TempForm.Designer).SelectOnlyThisComponent(TempForm);
|
||||||
end;
|
end;
|
||||||
writeln('TMainIDE.DoOpenEditorFile LFM end');
|
//writeln('TMainIDE.DoOpenEditorFile LFM end');
|
||||||
finally
|
finally
|
||||||
BinLFMStream.Free;
|
BinLFMStream.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
writeln('TMainIDE.DoOpenEditorFile END "',AFilename,'"');
|
//writeln('TMainIDE.DoOpenEditorFile END "',AFilename,'"');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoOpenMainUnit(ProjectLoading: boolean): TModalResult;
|
function TMainIDE.DoOpenMainUnit(ProjectLoading: boolean): TModalResult;
|
||||||
@ -2239,7 +2239,7 @@ var MainUnitInfo: TUnitInfo;
|
|||||||
ProgramNameStart,ProgramNameEnd: integer;
|
ProgramNameStart,ProgramNameEnd: integer;
|
||||||
sl: TStringList;
|
sl: TStringList;
|
||||||
begin
|
begin
|
||||||
writeln('[TMainIDE.DoOpenMainUnit] A');
|
//writeln('[TMainIDE.DoOpenMainUnit] A');
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if Project.MainUnit<0 then exit;
|
if Project.MainUnit<0 then exit;
|
||||||
MainUnitInfo:=Project.Units[Project.MainUnit];
|
MainUnitInfo:=Project.Units[Project.MainUnit];
|
||||||
@ -2276,7 +2276,7 @@ writeln('[TMainIDE.DoOpenMainUnit] A');
|
|||||||
NewSrcEdit.EditorComponent.CaretXY:=MainUnitInfo.CursorPos;
|
NewSrcEdit.EditorComponent.CaretXY:=MainUnitInfo.CursorPos;
|
||||||
NewSrcEdit.EditorComponent.TopLine:=MainUnitInfo.TopLine;
|
NewSrcEdit.EditorComponent.TopLine:=MainUnitInfo.TopLine;
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
writeln('[TMainIDE.DoOpenMainUnit] END');
|
//writeln('[TMainIDE.DoOpenMainUnit] END');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
function TMainIDE.DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
||||||
@ -2625,7 +2625,7 @@ var Ext,AText,ACaption,LPIFilename:string;
|
|||||||
SrcStream: TMemoryStream;
|
SrcStream: TMemoryStream;
|
||||||
NewSource: string;
|
NewSource: string;
|
||||||
begin
|
begin
|
||||||
writeln('TMainIDE.DoOpenProjectFile A "'+AFileName+'"');
|
//writeln('TMainIDE.DoOpenProjectFile A "'+AFileName+'"');
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if AFileName='' then exit;
|
if AFileName='' then exit;
|
||||||
AFilename:=ExpandFileName(AFilename);
|
AFilename:=ExpandFileName(AFilename);
|
||||||
@ -2714,7 +2714,7 @@ writeln('TMainIDE.DoOpenProjectFile A "'+AFileName+'"');
|
|||||||
Project.Modified:=false;
|
Project.Modified:=false;
|
||||||
EnvironmentOptions.LastSavedProjectFile:=Project.ProjectInfoFile;
|
EnvironmentOptions.LastSavedProjectFile:=Project.ProjectInfoFile;
|
||||||
EnvironmentOptions.Save(false);
|
EnvironmentOptions.Save(false);
|
||||||
writeln('TMainIDE.DoOpenProjectFile end ');
|
//writeln('TMainIDE.DoOpenProjectFile end ');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoCreateProjectForProgram(ProgramFilename
|
function TMainIDE.DoCreateProjectForProgram(ProgramFilename
|
||||||
@ -3334,8 +3334,53 @@ end;
|
|||||||
|
|
||||||
function TMainIDE.DoJumpToCompilerMessage(Index:integer;
|
function TMainIDE.DoJumpToCompilerMessage(Index:integer;
|
||||||
FocusEditor: boolean): boolean;
|
FocusEditor: boolean): boolean;
|
||||||
|
|
||||||
|
function SearchFile(const AFilename: string): string;
|
||||||
|
var OldCurrDir, SearchPath, Delimiter, ProjectDir: string;
|
||||||
|
PathStart, PathEnd: integer;
|
||||||
|
begin
|
||||||
|
if FilenameIsAbsolute(AFilename) then begin
|
||||||
|
Result:=AFileName;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
// search file in project directory
|
||||||
|
ProjectDir:=ExtractFilePath(Project.ProjectFile);
|
||||||
|
Result:=ProjectDir+AFilename;
|
||||||
|
if FileExists(Result) then exit;
|
||||||
|
// search file with unit search path
|
||||||
|
OldCurrDir:=GetCurrentDir;
|
||||||
|
try
|
||||||
|
SetCurrentDir(ProjectDir);
|
||||||
|
SearchPath:=Project.CompilerOptions.OtherUnitFiles;
|
||||||
|
Delimiter:=';';
|
||||||
|
PathStart:=1;
|
||||||
|
while (PathStart<=length(SearchPath)) do begin
|
||||||
|
while (PathStart<=length(SearchPath))
|
||||||
|
and (Pos(SearchPath[PathStart],Delimiter)>0) do
|
||||||
|
inc(PathStart);
|
||||||
|
PathEnd:=PathStart;
|
||||||
|
while (PathEnd<=length(SearchPath))
|
||||||
|
and (Pos(SearchPath[PathEnd],Delimiter)<1) do
|
||||||
|
inc(PathEnd);
|
||||||
|
if PathEnd>PathStart then begin
|
||||||
|
Result:=ExpandFileName(copy(SearchPath,PathStart,PathEnd-PathStart));
|
||||||
|
if Result<>'' then begin
|
||||||
|
if Result[length(Result)]<>OSDirSeparator then
|
||||||
|
Result:=Result+OSDirSeparator;
|
||||||
|
Result:=Result+AFileName;
|
||||||
|
if FileExists(Result) then exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
PathStart:=PathEnd;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
SetCurrentDir(OldCurrDir);
|
||||||
|
end;
|
||||||
|
Result:='';
|
||||||
|
end;
|
||||||
|
|
||||||
var MaxMessages: integer;
|
var MaxMessages: integer;
|
||||||
Filename, Ext: string;
|
Filename, Ext, SearchedFilename: string;
|
||||||
CaretXY: TPoint;
|
CaretXY: TPoint;
|
||||||
TopLine: integer;
|
TopLine: integer;
|
||||||
MsgType: TErrorType;
|
MsgType: TErrorType;
|
||||||
@ -3359,14 +3404,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
if Compiler1.GetSourcePosition(MessagesView.MessageView.Items[Index],
|
if Compiler1.GetSourcePosition(MessagesView.MessageView.Items[Index],
|
||||||
Filename,CaretXY,MsgType) then begin
|
Filename,CaretXY,MsgType) then begin
|
||||||
// search the file
|
SearchedFilename:=SearchFile(Filename);
|
||||||
if not FilenameIsAbsolute(Filename) then begin
|
if SearchedFilename<>'' then begin
|
||||||
Filename:=ExtractFilePath(Project.ProjectFile)+Filename;
|
|
||||||
end;
|
|
||||||
// open the file in the source editor
|
// open the file in the source editor
|
||||||
Ext:=lowercase(ExtractFileExt(Filename));
|
Ext:=lowercase(ExtractFileExt(SearchedFilename));
|
||||||
if (Ext<>'.lfm') or (Ext='.lpi') then begin
|
if (Ext<>'.lfm') or (Ext='.lpi') then begin
|
||||||
Result:=(DoOpenEditorFile(Filename,false)=mrOk);
|
Result:=(DoOpenEditorFile(SearchedFilename,false)=mrOk);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
// set caret position
|
// set caret position
|
||||||
SrcEdit:=SourceNoteBook.GetActiveSE;
|
SrcEdit:=SourceNoteBook.GetActiveSE;
|
||||||
@ -3383,6 +3426,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end else begin
|
||||||
|
MessageDlg('Unable to find file "'+Filename+'".'
|
||||||
|
+' Check search path in'
|
||||||
|
+' Project->Compiler Options...->Search Paths->Other Unit Files',
|
||||||
|
mtInformation,[mbOk],0);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3598,6 +3647,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.111 2001/07/29 20:33:23 lazarus
|
||||||
|
MG: bugfixed event propeditor, DoJumpToMethod with searchpath
|
||||||
|
|
||||||
Revision 1.110 2001/07/10 10:44:15 lazarus
|
Revision 1.110 2001/07/10 10:44:15 lazarus
|
||||||
MG: save unit only if modified
|
MG: save unit only if modified
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user