mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 13:09:28 +02:00
MG: fixes for open lpi files and improved jump points
git-svn-id: trunk@1608 -
This commit is contained in:
parent
029bb35f4a
commit
1b493c7b2a
42
ide/main.pp
42
ide/main.pp
@ -2787,12 +2787,13 @@ var
|
||||
PreReadBuf: TCodeBuffer;
|
||||
begin
|
||||
Handled:=false;
|
||||
Ext:=lowercase(ExtractFilename(AFilename));
|
||||
Ext:=lowercase(ExtractFileExt(AFilename));
|
||||
|
||||
if (not (ofProjectLoading in Flags)) and (ToolStatus=itNone)
|
||||
and (Ext='.lpi') then begin
|
||||
// this is a project info file -> load whole project
|
||||
Result:=DoOpenProjectFile(AFilename);
|
||||
Handled:=true;
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -3226,7 +3227,7 @@ begin
|
||||
NewSrcEdit.EditorComponent.TopLine:=AnUnitInfo.TopLine;
|
||||
NewSrcEdit.EditorComponent.LeftChar:=1;
|
||||
NewSrcEdit.ReadOnly:=AnUnitInfo.ReadOnly;
|
||||
|
||||
|
||||
// mark unit as loaded
|
||||
AnUnitInfo.Loaded:=true;
|
||||
|
||||
@ -3478,8 +3479,8 @@ var
|
||||
NewUnitInfo:TUnitInfo;
|
||||
NewBuf: TCodeBuffer;
|
||||
begin
|
||||
writeln('');
|
||||
writeln('*** TMainIDE.DoOpenEditorFile START "',AFilename,'"');
|
||||
writeln('');
|
||||
writeln('*** TMainIDE.DoOpenEditorFile START "',AFilename,'"');
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeap(IntToStr(GetMem_Cnt));{$ENDIF}
|
||||
Result:=mrCancel;
|
||||
if ExtractFilenameOnly(AFilename)='' then exit;
|
||||
@ -3533,19 +3534,19 @@ writeln('*** TMainIDE.DoOpenEditorFile START "',AFilename,'"');
|
||||
end;
|
||||
|
||||
// check readonly
|
||||
NewUnitInfo.ReadOnly:=NewUnitInfo.ReadOnly
|
||||
NewUnitInfo.ReadOnly:=NewUnitInfo.ReadOnly
|
||||
or (not FileIsWritable(NewUnitInfo.Filename));
|
||||
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.DoOpenEditorFile] B');
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.DoOpenEditorFile] B');
|
||||
{$ENDIF}
|
||||
// open file in source notebook
|
||||
Result:=DoOpenFileInSourceNoteBook(NewUnitInfo,Flags);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.DoOpenEditorFile] C');
|
||||
{$ENDIF}
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TMainIDE.DoOpenEditorFile] C');
|
||||
{$ENDIF}
|
||||
|
||||
// read form data
|
||||
if FilenameIsPascalUnit(AFilename) then begin
|
||||
@ -3555,7 +3556,7 @@ writeln('[TMainIDE.DoOpenEditorFile] C');
|
||||
end;
|
||||
|
||||
Result:=mrOk;
|
||||
writeln('TMainIDE.DoOpenEditorFile END "',AFilename,'"');
|
||||
writeln('TMainIDE.DoOpenEditorFile END "',AFilename,'"');
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeap(IntToStr(GetMem_Cnt));{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -3563,7 +3564,7 @@ function TMainIDE.DoOpenMainUnit(ProjectLoading: boolean): TModalResult;
|
||||
var MainUnitInfo: TUnitInfo;
|
||||
OpenFlags: TOpenFlags;
|
||||
begin
|
||||
writeln('[TMainIDE.DoOpenMainUnit] A');
|
||||
writeln('[TMainIDE.DoOpenMainUnit] A');
|
||||
Result:=mrCancel;
|
||||
if Project1.MainUnit<0 then exit;
|
||||
MainUnitInfo:=Project1.MainUnitInfo;
|
||||
@ -3584,7 +3585,7 @@ writeln('[TMainIDE.DoOpenMainUnit] A');
|
||||
|
||||
// build a nice pagename for the sourcenotebook
|
||||
Result:=mrOk;
|
||||
writeln('[TMainIDE.DoOpenMainUnit] END');
|
||||
writeln('[TMainIDE.DoOpenMainUnit] END');
|
||||
end;
|
||||
|
||||
function TMainIDE.DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
||||
@ -5443,6 +5444,7 @@ begin
|
||||
// syntax error -> show error and jump
|
||||
// show error in message view
|
||||
DoArrangeSourceEditorAndMessageView;
|
||||
MessagesView.ClearTillLastSeparator;
|
||||
MessagesView.AddSeparator;
|
||||
if CodeToolBoss.ErrorCode<>nil then begin
|
||||
MessagesView.Add(Project1.RemoveProjectPathFromFilename(
|
||||
@ -5452,11 +5454,12 @@ begin
|
||||
+') Error: '+CodeToolBoss.ErrorMessage);
|
||||
end else
|
||||
MessagesView.Add(CodeToolBoss.ErrorMessage);
|
||||
|
||||
// jump to error in source editor
|
||||
if CodeToolBoss.ErrorCode<>nil then begin
|
||||
SourceNotebook.AddJumpPointClicked(Self);
|
||||
if DoOpenEditorFile(CodeToolBoss.ErrorCode.Filename,[ofOnlyIfExists])=mrOk then
|
||||
begin
|
||||
if DoOpenEditorFile(CodeToolBoss.ErrorCode.Filename,[ofOnlyIfExists])=mrOk
|
||||
then begin
|
||||
ActiveSrcEdit:=SourceNoteBook.GetActiveSE;
|
||||
with ActiveSrcEdit.EditorComponent do begin
|
||||
SetFocus;
|
||||
@ -5677,7 +5680,7 @@ begin
|
||||
ACaretXY,ATopLine);
|
||||
if DeleteForwardHistory then Project1.JumpHistory.DeleteForwardHistory;
|
||||
Project1.JumpHistory.InsertSmart(Project1.JumpHistory.HistoryIndex+1,
|
||||
NewJumpPoint);
|
||||
NewJumpPoint);
|
||||
if Project1.JumpHistory.HistoryIndex=Project1.JumpHistory.Count-2 then
|
||||
Project1.JumpHistory.HistoryIndex:=Project1.JumpHistory.Count-1;
|
||||
//writeln('[TMainIDE.OnSrcNoteBookAddJumpPoint] END Line=',ACaretXY.Y,',DeleteForwardHistory=',DeleteForwardHistory,' Count=',Project1.JumpHistory.Count,',HistoryIndex=',Project1.JumpHistory.HistoryIndex);
|
||||
@ -6218,6 +6221,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.278 2002/04/15 10:56:05 lazarus
|
||||
MG: fixes for open lpi files and improved jump points
|
||||
|
||||
Revision 1.277 2002/04/12 16:36:07 lazarus
|
||||
MG: FPC unitlinks are now saved
|
||||
|
||||
|
@ -43,10 +43,11 @@ type
|
||||
Function GetSelectedLineIndex : Integer;
|
||||
public
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
Procedure Add(const Texts : String);
|
||||
Procedure AddSeparator;
|
||||
procedure Add(const Texts : String);
|
||||
procedure AddSeparator;
|
||||
procedure ClearTillLastSeparator;
|
||||
function MsgCount: integer;
|
||||
Procedure Clear;
|
||||
procedure Clear;
|
||||
property Message : String read GetMessage;
|
||||
property SelectedMessageIndex : Integer read GetSelectedLineIndex;
|
||||
property OnSelectionChanged : TNotifyEvent read FOnSelectionChanged write FOnSelectionChanged;
|
||||
@ -58,6 +59,8 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
const SeparatorLine = '----------------------------';
|
||||
|
||||
{ TMessagesView }
|
||||
|
||||
|
||||
@ -96,8 +99,22 @@ end;
|
||||
|
||||
Procedure TMessagesView.AddSeparator;
|
||||
begin
|
||||
if MsgCount>0 then
|
||||
Add('----------------------------');
|
||||
Add(SeparatorLine);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.ClearTillLastSeparator;
|
||||
var LastSeparator: integer;
|
||||
begin
|
||||
with MessageView do begin
|
||||
LastSeparator:=Items.Count-1;
|
||||
while (LastSeparator>=0) and (Items[LastSeparator]<>SeparatorLine) do
|
||||
dec(LastSeparator);
|
||||
if LastSeparator>=0 then begin
|
||||
while (Items.Count>LastSeparator) do begin
|
||||
Items.Delete(Items.Count-1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMessagesView.MsgCount: integer;
|
||||
|
@ -797,15 +797,23 @@ end;
|
||||
|
||||
procedure TProjectJumpHistory.InsertSmart(Index: integer;
|
||||
APosition: TProjectJumpHistoryPosition);
|
||||
// insert if item after or in front of Index is not equal to APosition
|
||||
// insert if item after or in front of Index is not similar to APosition
|
||||
// else replace the similar with the new updated version
|
||||
begin
|
||||
if Index<0 then Index:=Count;
|
||||
if (Index<=Count)
|
||||
and ((Index<1) or (not Items[Index-1].IsSimilar(APosition)))
|
||||
and ((Index=Count) or (not Items[Index].IsSimilar(APosition))) then
|
||||
Insert(Index,APosition)
|
||||
else
|
||||
if (Index<=Count) then begin
|
||||
if (Index>0) and Items[Index-1].IsSimilar(APosition) then begin
|
||||
Items[Index-1]:=APosition;
|
||||
APosition.Free;
|
||||
end else if (Index<Count) and Items[Index].IsSimilar(APosition) then begin
|
||||
Items[Index]:=APosition;
|
||||
APosition.Free;
|
||||
end else begin
|
||||
Insert(Index,APosition);
|
||||
end;
|
||||
end else begin
|
||||
APosition.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TProjectJumpHistory.DeleteForwardHistory;
|
||||
|
@ -153,6 +153,8 @@ type
|
||||
ErrorMsgs : TStrings;
|
||||
Procedure ReParent(AParent : TWinControl);
|
||||
|
||||
Procedure ProcessCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: char; Data: pointer);
|
||||
Procedure ProcessUserCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: char; Data: pointer);
|
||||
Procedure UserCommandProcessed(Sender: TObject;
|
||||
@ -716,6 +718,20 @@ begin
|
||||
FEditor.ReadOnly:=NewValue;
|
||||
end;
|
||||
|
||||
Procedure TSourceEditor.ProcessCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: char; Data: pointer);
|
||||
begin
|
||||
case Command of
|
||||
|
||||
ecSelEditorTop, ecSelEditorBottom, ecEditorTop, ecEditorBottom:
|
||||
begin
|
||||
if FaOwner<>nil then
|
||||
TSourceNotebook(FaOwner).AddJumpPointClicked(Self);
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TSourceEditor.ProcessUserCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: char; Data: pointer);
|
||||
var
|
||||
@ -726,6 +742,7 @@ var
|
||||
Begin
|
||||
Handled:=true;
|
||||
case Command of
|
||||
|
||||
ecIdentCompletion :
|
||||
if TCustomSynEdit(Sender).ReadOnly=false then begin
|
||||
CurrentCompletionType:=ctIdentCompletion;
|
||||
@ -816,9 +833,13 @@ var Handled: boolean;
|
||||
begin
|
||||
Handled:=true;
|
||||
case Command of
|
||||
|
||||
ecNone: ;
|
||||
|
||||
ecUndo:
|
||||
if (FEditor.Modified=false) and (CodeBuffer<>nil) then
|
||||
CodeBuffer.Assign(FEditor.Lines);
|
||||
|
||||
else
|
||||
begin
|
||||
Handled:=false;
|
||||
@ -1152,6 +1173,7 @@ writeln('TSourceEditor.CreateEditor A ');
|
||||
Align := alClient;
|
||||
BookMarkOptions.EnableKeys := false;
|
||||
OnStatusChange := @EditorStatusChanged;
|
||||
OnProcessCommand := @ProcessCommand;
|
||||
OnProcessUserCommand := @ProcessUserCommand;
|
||||
OnCommandProcessed := @UserCommandProcessed;
|
||||
OnReplaceText := @OnReplace;
|
||||
@ -3027,7 +3049,7 @@ begin
|
||||
if Assigned(FOnProcessUserCommand) then begin
|
||||
Handled:=false;
|
||||
FOnProcessUserCommand(Self,Command,Handled);
|
||||
if Handled then begin
|
||||
if Handled or (Command=ecNone) then begin
|
||||
FProcessingCommand:=false;
|
||||
exit;
|
||||
end;
|
||||
@ -3035,6 +3057,7 @@ begin
|
||||
|
||||
Handled:=true;
|
||||
case Command of
|
||||
|
||||
ecNextEditor:
|
||||
NextEditor;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user