mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 22:39:56 +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
12
ide/main.pp
12
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;
|
||||
|
||||
@ -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;
|
||||
@ -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