Ide/Project; SourceEditor: Start using SourceEditorManager (for multi-window handling)

git-svn-id: trunk@24045 -
This commit is contained in:
martin 2010-03-16 16:16:32 +00:00
parent 60698c0253
commit e1290c555d
30 changed files with 95 additions and 94 deletions

View File

@ -99,7 +99,7 @@ begin
Scanner.Name:='GCC'; Scanner.Name:='GCC';
IDEMsgScanners.RegisterType(Scanner); IDEMsgScanners.RegisterType(Scanner);
CSrcEditCompletion:=TCSrcEditCompletion.Create(nil); CSrcEditCompletion:=TCSrcEditCompletion.Create(nil);
SourceEditorWindow.RegisterCompletionPlugin(CSrcEditCompletion); SourceEditorManagerIntf.RegisterCompletionPlugin(CSrcEditCompletion);
end; end;
{ TGCCMessageScanner } { TGCCMessageScanner }

View File

@ -141,9 +141,10 @@ procedure TEditorToolbar.InitEditorToolBar;
var var
T: TJumpType; T: TJumpType;
begin begin
if not Assigned(W) then if not Assigned(W) and Assigned(SourceEditorManagerIntf.ActiveSourceWindow) then
begin begin
W := SourceEditorWindow; {$note Todo, hook SourceEditorManager to detect open/close forms}
W := SourceEditorManagerIntf.ActiveSourceWindow; // TODO: each window
TB := nil; TB := nil;
CfgButton := nil; CfgButton := nil;
CreateEditorToolBar(W, TB); CreateEditorToolBar(W, TB);
@ -284,7 +285,7 @@ end;
procedure Register; procedure Register;
begin begin
if (SourceEditorWindow <> nil) then if (SourceEditorManagerIntf <> nil) then
gEditorToolbar.InitEditorToolBar; gEditorToolbar.InitEditorToolBar;
end; end;

View File

@ -88,7 +88,7 @@ begin
,[ofRegularFile,ofUseCache]) = mrOk; ,[ofRegularFile,ofUseCache]) = mrOk;
if Result then if Result then
begin begin
SrcEditor := SourceEditorWindow.ActiveEditor; SrcEditor := SourceEditorManagerIntf.ActiveEditor;
if Assigned(SrcEditor) then if Assigned(SrcEditor) then
SrcEditor.EditorControl.SetFocus; SrcEditor.EditorControl.SetFocus;
end; end;
@ -108,7 +108,7 @@ begin
if not LazarusIDE.BeginCodeTools then if not LazarusIDE.BeginCodeTools then
Exit; //==> Exit; //==>
SrcEditor := SourceEditorWindow.ActiveEditor; SrcEditor := SourceEditorManagerIntf.ActiveEditor;
if not Assigned(SrcEditor) then if not Assigned(SrcEditor) then
Exit; //==> Exit; //==>

View File

@ -716,7 +716,7 @@ procedure TH2PasDialog.OnShowSrcEditSection(Sender: TObject);
var var
SrcEdit: TSourceEditorInterface; SrcEdit: TSourceEditorInterface;
begin begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
SrcEditSection.Visible:=(SrcEdit<>nil) SrcEditSection.Visible:=(SrcEdit<>nil)
and Converter.FileIsRelated(SrcEdit.FileName); and Converter.FileIsRelated(SrcEdit.FileName);
//DebugLn(['TH2PasDialog.OnShowSrcEditSection ',SrcEditSection.Visible]); //DebugLn(['TH2PasDialog.OnShowSrcEditSection ',SrcEditSection.Visible]);
@ -729,7 +729,7 @@ var
s: String; s: String;
begin begin
//DebugLn(['TH2PasDialog.OnAddSearchAndReplaceBeforeH2PasClick']); //DebugLn(['TH2PasDialog.OnAddSearchAndReplaceBeforeH2PasClick']);
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
MainPageControl.ActivePage:=PreH2PasTabSheet; MainPageControl.ActivePage:=PreH2PasTabSheet;
ShowOnTop; ShowOnTop;

View File

@ -114,13 +114,13 @@ end;
procedure TJcfIdeMain.DoFormatCurrentIDEWindow(Sender: TObject); procedure TJcfIdeMain.DoFormatCurrentIDEWindow(Sender: TObject);
begin begin
if (SourceEditorWindow = nil) or (SourceEditorWindow.ActiveEditor = nil) then if (SourceEditorManagerIntf= nil) or (SourceEditorManagerIntf.ActiveEditor = nil) then
begin begin
LogIdeMessage('', 'No current window', mtInputError, -1, -1); LogIdeMessage('', 'No current window', mtInputError, -1, -1);
exit; exit;
end; end;
ConvertEditor(SourceEditorWindow.ActiveEditor); ConvertEditor(SourceEditorManagerIntf.ActiveEditor);
end; end;
procedure TJcfIdeMain.ConvertEditor(const pciEditor: TSourceEditorInterface); procedure TJcfIdeMain.ConvertEditor(const pciEditor: TSourceEditorInterface);
@ -169,15 +169,15 @@ var
begin begin
MakeEditorConverter; MakeEditorConverter;
if (SourceEditorWindow = nil) then if (SourceEditorManagerIntf = nil) then
Exit; Exit;
ClearToolMessages; ClearToolMessages;
fcEditorConverter.BeforeConvert; fcEditorConverter.BeforeConvert;
for liLoop := 0 to SourceEditorWindow.Count - 1 do for liLoop := 0 to SourceEditorManagerIntf.SourceEditorCount - 1 do
begin begin
lciEditor := SourceEditorWindow.Items[liLoop]; lciEditor := SourceEditorManagerIntf.SourceEditors[liLoop];
// check that it's open, and a .pas or .dpr // check that it's open, and a .pas or .dpr
if (lciEditor <> nil) and (FileIsAllowedType(lciEditor.FileName)) then if (lciEditor <> nil) and (FileIsAllowedType(lciEditor.FileName)) then

View File

@ -169,7 +169,7 @@ begin
if IsActive and (Repo <> '') then if IsActive and (Repo <> '') then
begin begin
SrcFile := SourceEditorWindow.ActiveEditor.FileName; SrcFile := SourceEditorManagerIntf.ActiveEditor.FileName;
if LazarusIDE.ActiveProject.FindFile(SrcFile, [pfsfOnlyEditorFiles]).IsPartOfProject then if LazarusIDE.ActiveProject.FindFile(SrcFile, [pfsfOnlyEditorFiles]).IsPartOfProject then
ShowSVNDiffFrm('-r PREV', '"' + SrcFile + '"') ShowSVNDiffFrm('-r PREV', '"' + SrcFile + '"')

View File

@ -148,8 +148,8 @@ var FormMessagesComposer: TFormMessagesComposer;
BaseStart: string; BaseStart: string;
begin begin
BaseStart := EmptyStr; BaseStart := EmptyStr;
for indx := 1 to SourceEditorWindow.ActiveEditor.CursorTextXY.x- for indx := 1 to SourceEditorManagerIntf.ActiveEditor.CursorTextXY.x-
Length(SourceEditorWindow.ActiveEditor.Selection)-1 do Length(SourceEditorManagerIntf.ActiveEditor.Selection)-1 do
BaseStart := BaseStart+#32; BaseStart := BaseStart+#32;
ListSrcMessages := TStringList.Create; ListSrcMessages := TStringList.Create;
@ -168,14 +168,14 @@ var FormMessagesComposer: TFormMessagesComposer;
begin begin
Assert(Sender <> nil); // removes compiler warning Assert(Sender <> nil); // removes compiler warning
if SourceEditorWindow.ActiveEditor = nil then exit; if SourceEditorManagerIntf.ActiveEditor = nil then exit;
FormMessagesComposer := TFormMessagesComposer.Create(nil); FormMessagesComposer := TFormMessagesComposer.Create(nil);
try try
FormMessagesComposer.ShowModal; FormMessagesComposer.ShowModal;
if FormMessagesComposer.ModalResult = mrOK then begin if FormMessagesComposer.ModalResult = mrOK then begin
FormMessagesComposer.GetMessageForSource.Execute; FormMessagesComposer.GetMessageForSource.Execute;
FormatSrcMessage; FormatSrcMessage;
SourceEditorWindow.ActiveEditor.Selection := srcMessage; SourceEditorManagerIntf.ActiveEditor.Selection := srcMessage;
end; end;
finally finally
FormMessagesComposer.Free; FormMessagesComposer.Free;

View File

@ -97,7 +97,7 @@ Var
begin begin
if Sender=nil then ; if Sender=nil then ;
E:=SourceEditorWindow.ActiveEditor; E:=SourceEditorManagerIntf.ActiveEditor;
If (E=Nil) or (Not E.SelectionAvailable) then If (E=Nil) or (Not E.SelectionAvailable) then
Exit; Exit;
S1:=TStringStream.Create(E.Selection); S1:=TStringStream.Create(E.Selection);
@ -124,7 +124,7 @@ Var
begin begin
if Sender=nil then ; if Sender=nil then ;
E:=SourceEditorWindow.ActiveEditor; E:=SourceEditorManagerIntf.ActiveEditor;
If (E=Nil) then If (E=Nil) then
Exit; Exit;
S1:=TMemoryStream.Create; S1:=TMemoryStream.Create;

View File

@ -161,7 +161,7 @@ begin
exit; exit;
end; end;
// find the source editor page // find the source editor page
SrcEdit:=SourceEditorWindow.SourceEditorIntfWithFilename(Filename); SrcEdit:=SourceEditorManagerIntf.SourceEditorIntfWithFilename(Filename);
if SrcEdit=nil then begin if SrcEdit=nil then begin
DebugLn(['THideFPCHintWorker.Execute unable to find the file in the source editor of ',Filename]); DebugLn(['THideFPCHintWorker.Execute unable to find the file in the source editor of ',Filename]);
exit; exit;

View File

@ -84,9 +84,9 @@ var
R : TModalResult; R : TModalResult;
begin begin
If Not Assigned(SourceEditorWindow) or Not Assigned(SourceEditorWindow.ActiveEditor) then If Not Assigned(SourceEditorManagerIntf) or Not Assigned(SourceEditorManagerIntf.ActiveEditor) then
Exit; Exit;
If (SourceEditorWindow.ActiveEditor.Selection='') then If (SourceEditorManagerIntf.ActiveEditor.Selection='') then
R:=mrYesToAll R:=mrYesToAll
else else
R:=QuestionDlg(SPrintSources,SPrintWhat,mtInformation,[mrYesToAll,SPrintFile,mrYes,SPrintSelection,mrCancel],0); R:=QuestionDlg(SPrintSources,SPrintWhat,mtInformation,[mrYesToAll,SPrintFile,mrYes,SPrintSelection,mrCancel],0);
@ -95,8 +95,8 @@ begin
L:=TStringList.Create; L:=TStringList.Create;
try try
case R of case R of
mrYesToAll : L.Assign(SourceEditorWindow.ActiveEditor.Lines); mrYesToAll : L.Assign(SourceEditorManagerIntf.ActiveEditor.Lines);
mrYes : L.Text:=SourceEditorWindow.ActiveEditor.Selection; mrYes : L.Text:=SourceEditorManagerIntf.ActiveEditor.Selection;
end; end;
sp := TSourcePrinter.Create; sp := TSourcePrinter.Create;
try try

View File

@ -63,8 +63,8 @@ resourcestring
constructor TSQLStringsPropertyEditorDlg.Create(AOwner: TComponent); constructor TSQLStringsPropertyEditorDlg.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
SourceEditorWindow.GetEditorControlSettings(SQLEditor); SourceEditorManagerIntf.GetEditorControlSettings(SQLEditor);
SourceEditorWindow.GetHighlighterSettings(SQLHighlighter); SourceEditorManagerIntf.GetHighlighterSettings(SQLHighlighter);
EditorTabSheet.Caption := SSQLTabCaption; EditorTabSheet.Caption := SSQLTabCaption;
ResultTabSheet.Caption := SResultTabCaption; ResultTabSheet.Caption := SResultTabCaption;
end; end;

View File

@ -191,7 +191,7 @@ begin
Buf:=CodeToolBoss.LoadFile(Filename,true,false); Buf:=CodeToolBoss.LoadFile(Filename,true,false);
if not Buf.ReadOnly then begin if not Buf.ReadOnly then begin
OldEncoding:=Buf.DiskEncoding; OldEncoding:=Buf.DiskEncoding;
SrcEdit:=SourceEditorWindow.SourceEditorIntfWithFilename(Filename); SrcEdit:=SourceEditorManagerIntf.SourceEditorIntfWithFilename(Filename);
HasChanged:=true; HasChanged:=true;
if SrcEdit<>nil then begin if SrcEdit<>nil then begin
DebugLn(['TChgEncodingDialog.ApplyButtonClick changing in source editor: ',Filename]); DebugLn(['TChgEncodingDialog.ApplyButtonClick changing in source editor: ',Filename]);

View File

@ -51,7 +51,7 @@ begin
if not LazarusIDE.BeginCodeTools then exit; if not LazarusIDE.BeginCodeTools then exit;
// get active source editor // get active source editor
SrcEditor:=SourceEditorWindow.ActiveEditor; SrcEditor:=SourceEditorManagerIntf.ActiveEditor;
if SrcEditor=nil then exit; if SrcEditor=nil then exit;
CodeBuffer:=SrcEditor.CodeToolsBuffer as TCodeBuffer; CodeBuffer:=SrcEditor.CodeToolsBuffer as TCodeBuffer;

View File

@ -109,7 +109,7 @@ begin
// get cursor position // get cursor position
ErrMsg:=lisSAMCursorIsNotInAClassDeclaration; ErrMsg:=lisSAMCursorIsNotInAClassDeclaration;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);
if Code=nil then exit; if Code=nil then exit;

View File

@ -1433,8 +1433,8 @@ function TBuildManager.OnRunCompilerWithOptions(
ExtTool: TIDEExternalToolOptions; CompOptions: TBaseCompilerOptions ExtTool: TIDEExternalToolOptions; CompOptions: TBaseCompilerOptions
): TModalResult; ): TModalResult;
begin begin
if SourceEditorWindow<>nil then if SourceEditorManagerIntf<>nil then
SourceEditorWindow.ClearErrorLines; SourceEditorManagerIntf.ClearErrorLines;
Result:=EnvironmentOptions.ExternalTools.Run(ExtTool,GlobalMacroList, Result:=EnvironmentOptions.ExternalTools.Run(ExtTool,GlobalMacroList,
nil,CompOptions); nil,CompOptions);
if LazarusIDE<>nil then if LazarusIDE<>nil then

View File

@ -603,7 +603,7 @@ begin
Format(lisUseUnitInUnit, [CurUnitName, SrcEditUnitName]); Format(lisUseUnitInUnit, [CurUnitName, SrcEditUnitName]);
if (Node is TCodeBrowserNode) and (Identifier<>'') then begin if (Node is TCodeBrowserNode) and (Identifier<>'') then begin
EnableUseIdentifierInCurUnit:=true; EnableUseIdentifierInCurUnit:=true;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
UseIdentifierInCurUnitMenuItem.Caption:= UseIdentifierInCurUnitMenuItem.Caption:=
Format(lisUseIdentifierInAt, [Identifier, ExtractFilename( Format(lisUseIdentifierInAt, [Identifier, ExtractFilename(
SrcEdit.FileName), dbgs(SrcEdit.CursorScreenXY)]); SrcEdit.FileName), dbgs(SrcEdit.CursorScreenXY)]);
@ -983,7 +983,7 @@ begin
List:=TFPList.Create; List:=TFPList.Create;
CodeMarker:=nil; CodeMarker:=nil;
try try
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
InsertStartPos:=SrcEdit.CursorTextXY; InsertStartPos:=SrcEdit.CursorTextXY;
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);
@ -2567,7 +2567,7 @@ begin
FileOwner:=nil; FileOwner:=nil;
UnitCode:=nil; UnitCode:=nil;
Result:=false; Result:=false;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Code:=CodeToolBoss.GetMainCode(TCodeBuffer(SrcEdit.CodeToolsBuffer)); Code:=CodeToolBoss.GetMainCode(TCodeBuffer(SrcEdit.CodeToolsBuffer));
if Code=nil then exit; if Code=nil then exit;
@ -2589,7 +2589,7 @@ var
i: Integer; i: Integer;
begin begin
Result:=nil; Result:=nil;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Owners:=PkgBoss.GetOwnersOfUnit(SrcEdit.FileName); Owners:=PkgBoss.GetOwnersOfUnit(SrcEdit.FileName);
try try
@ -2740,7 +2740,7 @@ begin
Result:=''; Result:='';
if UseFCLAsDefault then if UseFCLAsDefault then
Result:=PackageGraph.FCLPackage.Name; Result:=PackageGraph.FCLPackage.Name;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);
if Code=nil then exit; if Code=nil then exit;

View File

@ -96,7 +96,7 @@ var
CodeContexts: TCodeContextInfo; CodeContexts: TCodeContextInfo;
begin begin
Result := False; Result := False;
LogCaretXY := SourceEditorWindow.ActiveEditor.CursorTextXY; LogCaretXY := SourceEditorManagerIntf.ActiveEditor.CursorTextXY;
CodeContexts := nil; CodeContexts := nil;
try try
if not CodeToolBoss.FindCodeContext(Code, LogCaretXY.X, LogCaretXY.Y, CodeContexts) or if not CodeToolBoss.FindCodeContext(Code, LogCaretXY.X, LogCaretXY.Y, CodeContexts) or
@ -138,14 +138,14 @@ var
begin begin
if (Key=VK_ESCAPE) and (Shift=[]) then if (Key=VK_ESCAPE) and (Shift=[]) then
Hide Hide
else if SourceEditorWindow<>nil then begin else if SourceEditorManagerIntf<>nil then begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then if SrcEdit=nil then
Hide Hide
else begin else begin
// redirect keys // redirect keys
TWinControlAccess(SrcEdit.EditorControl).KeyDown(Key,Shift); TWinControlAccess(SrcEdit.EditorControl).KeyDown(Key,Shift);
SetActiveWindow(SourceEditorWindow.Handle); SetActiveWindow(SourceEditorManagerIntf.ActiveSourceWindow.Handle);
end; end;
end; end;
end; end;
@ -166,7 +166,7 @@ var
SrcEdit: TSourceEditorInterface; SrcEdit: TSourceEditorInterface;
ASynEdit: TCustomSynEdit; ASynEdit: TCustomSynEdit;
begin begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then begin if SrcEdit=nil then begin
Hide; Hide;
end else begin end else begin
@ -220,8 +220,8 @@ begin
NewParameterIndex:=-1; NewParameterIndex:=-1;
try try
// check Source Editor // check Source Editor
if SourceEditorWindow=nil then exit; if SourceEditorManagerIntf=nil then exit;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if (SrcEdit=nil) or (SrcEdit.CodeToolsBuffer<>ProcNameCodeXYPos.Code) then if (SrcEdit=nil) or (SrcEdit.CodeToolsBuffer<>ProcNameCodeXYPos.Code) then
exit; exit;
if SrcEdit.TopLine<>FSourceEditorTopIndex then exit; if SrcEdit.TopLine<>FSourceEditorTopIndex then exit;
@ -543,7 +543,7 @@ var
DrawHeight: LongInt; DrawHeight: LongInt;
ScreenXY: TPoint; ScreenXY: TPoint;
begin begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
// calculate the position of the context in the source editor // calculate the position of the context in the source editor
@ -560,7 +560,7 @@ begin
FSourceEditorTopIndex:=SrcEdit.TopLine; FSourceEditorTopIndex:=SrcEdit.TopLine;
// calculate size of hints // calculate size of hints
DrawWidth:=SourceEditorWindow.ClientWidth; DrawWidth:=SourceEditorManagerIntf.ActiveSourceWindow.ClientWidth;
DrawHeight:=ClientXY.Y; DrawHeight:=ClientXY.Y;
DrawHints(DrawWidth,DrawHeight,false); DrawHints(DrawWidth,DrawHeight,false);
if DrawWidth<20 then DrawWidth:=20; if DrawWidth<20 then DrawWidth:=20;

View File

@ -529,7 +529,7 @@ begin
Refresh(true); Refresh(true);
exit; exit;
end; end;
ExecuteIDECommand(SourceEditorWindow,ecRenameIdentifier); ExecuteIDECommand(SourceEditorManagerIntf.ActiveSourceWindow, ecRenameIdentifier);
end; end;
procedure TCodeExplorerView.TreePopupmenuPopup(Sender: TObject); procedure TCodeExplorerView.TreePopupmenuPopup(Sender: TObject);
@ -1912,7 +1912,7 @@ begin
DebugLn(['TCodeExplorerView.JumpToSelection AAA1']); DebugLn(['TCodeExplorerView.JumpToSelection AAA1']);
if Assigned(OnJumpToCode) then if Assigned(OnJumpToCode) then
OnJumpToCode(Self,Caret.Code.Filename,Point(Caret.X,Caret.Y),NewTopLine); OnJumpToCode(Self,Caret.Code.Filename,Point(Caret.X,Caret.Y),NewTopLine);
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
DebugLn(['TCodeExplorerView.JumpToSelection AAA2 ',SrcEdit.FileName,' ',dbgs(SrcEdit.CursorTextXY),' X=',Caret.X,' Y=',Caret.Y]); DebugLn(['TCodeExplorerView.JumpToSelection AAA2 ',SrcEdit.FileName,' ',dbgs(SrcEdit.CursorTextXY),' X=',Caret.X,' Y=',Caret.Y]);
// check if jump was successful // check if jump was successful
if (SrcEdit.CodeToolsBuffer<>CodeBuffer) if (SrcEdit.CodeToolsBuffer<>CodeBuffer)
@ -1928,7 +1928,7 @@ var
xy: TPoint; xy: TPoint;
begin begin
Result:=false; Result:=false;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
xy:=SrcEdit.CursorTextXY; xy:=SrcEdit.CursorTextXY;
Result:=SelectCodePosition(TCodeBuffer(SrcEdit.CodeToolsBuffer),xy.x,xy.y); Result:=SelectCodePosition(TCodeBuffer(SrcEdit.CodeToolsBuffer),xy.x,xy.y);

View File

@ -3642,8 +3642,8 @@ begin
exit; exit;
end; end;
if SourceEditorWindow<>nil then if SourceEditorManagerIntf<>nil then
SourceEditorWindow.ClearErrorLines; SourceEditorManagerIntf.ClearErrorLines;
SplitCmdLine(Command,ProgramFilename,Params); SplitCmdLine(Command,ProgramFilename,Params);
if not FilenameIsAbsolute(ProgramFilename) then begin if not FilenameIsAbsolute(ProgramFilename) then begin

View File

@ -1360,7 +1360,7 @@ var
SE: TSourceEditor; SE: TSourceEditor;
WatchVar: String; WatchVar: String;
begin begin
SE := SourceNotebook.GetActiveSE; SE := SourceEditorManager.GetActiveSE;
if Assigned(SE) then if Assigned(SE) then
begin begin
@ -1516,24 +1516,24 @@ begin
end; end;
// unmark execution line // unmark execution line
if (FDebugger.State <> dsPause) and (SourceNotebook <> nil) if (FDebugger.State <> dsPause) and (SourceEditorManager <> nil)
then begin then begin
Editor := SourceNotebook.GetActiveSE; Editor := SourceEditorManager.GetActiveSE;
if Editor <> nil if Editor <> nil
then Editor.ExecutionLine := -1; then Editor.ExecutionLine := -1;
end; end;
if ((FDebugger.State = dsPause) or if ((FDebugger.State = dsPause) or
((FDebugger.State = dsRun) and (OldState = dsInit)) ((FDebugger.State = dsRun) and (OldState = dsInit))
) and (SourceNotebook <> nil) ) and (SourceEditorManager <> nil)
then begin then begin
Editor := SourceNotebook.GetActiveSE; Editor := SourceEditorManager.GetActiveSE;
if (Editor <> nil) and not Editor.HasExecutionMarks if (Editor <> nil) and not Editor.HasExecutionMarks
then Editor.FillExecutionMarks; then Editor.FillExecutionMarks;
end; end;
if not (FDebugger.State in [dsRun, dsPause]) and (SourceNotebook <> nil) then if not (FDebugger.State in [dsRun, dsPause]) and (SourceEditorManager <> nil) then
SourceNotebook.ClearExecutionMarks; SourceEditorManager.ClearExecutionMarks;
case FDebugger.State of case FDebugger.State of
dsError: begin dsError: begin
@ -1633,10 +1633,10 @@ begin
end; end;
// clear old error and execution lines // clear old error and execution lines
if SourceNotebook <> nil if SourceEditorManager <> nil
then begin then begin
SourceNotebook.ClearExecutionLines; SourceEditorManager.ClearExecutionLines;
SourceNotebook.ClearErrorLines; SourceEditorManager.ClearErrorLines;
end; end;
// jump editor to execution line // jump editor to execution line
FocusEditor := (FCurrentBreakPoint = nil) or (FCurrentBreakPoint.AutoContinueTime = 0); FocusEditor := (FCurrentBreakPoint = nil) or (FCurrentBreakPoint.AutoContinueTime = 0);
@ -1644,8 +1644,8 @@ begin
then exit; then exit;
// mark execution line // mark execution line
if SourceNotebook <> nil if SourceEditorManager <> nil
then Editor := SourceNotebook.GetActiveSE then Editor := SourceEditorManager.GetActiveSE
else Editor := nil; else Editor := nil;
if Editor <> nil if Editor <> nil
@ -1790,10 +1790,10 @@ var
TheDialog: TIDEInspectDlg; TheDialog: TIDEInspectDlg;
begin begin
TheDialog := TIDEInspectDlg(FDialogs[ddtInspect]); TheDialog := TIDEInspectDlg(FDialogs[ddtInspect]);
if SourceNotebook.GetActiveSE.SelectionAvailable then if SourceEditorManager.GetActiveSE.SelectionAvailable then
TheDialog.Execute(SourceNotebook.GetActiveSE.Selection) TheDialog.Execute(SourceEditorManager.GetActiveSE.Selection)
else else
TheDialog.Execute(SourceNotebook.GetActiveSE.GetOperandAtCurrentCaret); TheDialog.Execute(SourceEditorManager.GetActiveSE.GetOperandAtCurrentCaret);
end; end;
procedure TDebugManager.InitCallStackDlg; procedure TDebugManager.InitCallStackDlg;
@ -1810,10 +1810,10 @@ var
TheDialog: TEvaluateDlg; TheDialog: TEvaluateDlg;
begin begin
TheDialog := TEvaluateDlg(FDialogs[ddtEvaluate]); TheDialog := TEvaluateDlg(FDialogs[ddtEvaluate]);
if SourceNotebook.GetActiveSE.SelectionAvailable then if SourceEditorManager.GetActiveSE.SelectionAvailable then
TheDialog.FindText := SourceNotebook.GetActiveSE.Selection TheDialog.FindText := SourceEditorManager.GetActiveSE.Selection
else else
TheDialog.FindText := SourceNotebook.GetActiveSE.GetOperandAtCurrentCaret; TheDialog.FindText := SourceEditorManager.GetActiveSE.GetOperandAtCurrentCaret;
end; end;
constructor TDebugManager.Create(TheOwner: TComponent); constructor TDebugManager.Create(TheOwner: TComponent);
@ -2066,7 +2066,7 @@ var
CurBreakPoint: TIDEBreakPoint; CurBreakPoint: TIDEBreakPoint;
SrcFilename: String; SrcFilename: String;
begin begin
if (AnUnitInfo.EditorIndex < 0) or Destroying then exit; if (AnUnitInfo.EditorComponent = nil) or Destroying then exit;
ASrcEdit := TSourceEditor(AnUnitInfo.EditorComponent); ASrcEdit := TSourceEditor(AnUnitInfo.EditorComponent);
// set breakpoints for this unit // set breakpoints for this unit
SrcFilename:=AnUnitInfo.Filename; SrcFilename:=AnUnitInfo.Filename;

View File

@ -104,7 +104,7 @@ begin
// get cursor position // get cursor position
ErrMsg:=lisSAMCursorIsNotInAClassDeclaration; ErrMsg:=lisSAMCursorIsNotInAClassDeclaration;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);
if Code=nil then exit; if Code=nil then exit;

View File

@ -150,7 +150,7 @@ var
Code: TCodeBuffer; Code: TCodeBuffer;
XY: TPoint; XY: TPoint;
begin begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then if SrcEdit=nil then
exit(mrCancel); exit(mrCancel);
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);

View File

@ -103,10 +103,10 @@ begin
FHTMLHint:=''; FHTMLHint:='';
// find current completion item // find current completion item
if (SourceEditorWindow=nil) or (CodeToolBoss=nil) if (SourceEditorManagerIntf=nil) or (CodeToolBoss=nil)
or (CodeToolBoss.IdentifierList=nil) then or (CodeToolBoss.IdentifierList=nil) then
exit; exit;
Position:=SourceEditorWindow.CompletionBoxPosition; Position:=SourceEditorManagerIntf.CompletionBoxPosition;
if (Position<0) or (Position>=CodeToolBoss.IdentifierList.GetFilteredCount) then if (Position<0) or (Position>=CodeToolBoss.IdentifierList.GetFilteredCount) then
exit; exit;
Item:=CodeToolBoss.IdentifierList.FilteredItems[Position]; Item:=CodeToolBoss.IdentifierList.FilteredItems[Position];

View File

@ -3012,10 +3012,10 @@ begin
MainIDEBar.itmHelpAboutLazarus.OnClick(Self); MainIDEBar.itmHelpAboutLazarus.OnClick(Self);
ecToggleBreakPoint: ecToggleBreakPoint:
SourceNotebook.ToggleBreakpointClicked(Self); SourceEditorManager.GetActiveNotebok.ToggleBreakpointClicked(Self);
ecRemoveBreakPoint: ecRemoveBreakPoint:
SourceNotebook.DeleteBreakpointClicked(Self); SourceEditorManager.GetActiveNotebok.DeleteBreakpointClicked(Self);
ecProcedureList: ecProcedureList:
mnuSearchProcedureList(self); mnuSearchProcedureList(self);

View File

@ -338,7 +338,7 @@ begin
try try
LV.Items.Clear; LV.Items.Clear;
{ get active source editor } { get active source editor }
lSrcEditor := SourceEditorWindow.ActiveEditor; lSrcEditor := SourceEditorManagerIntf.ActiveEditor;
if lSrcEditor = nil then if lSrcEditor = nil then
Exit; //==> Exit; //==>
lCodeBuffer := lSrcEditor.CodeToolsBuffer as TCodeBuffer; lCodeBuffer := lSrcEditor.CodeToolsBuffer as TCodeBuffer;
@ -395,7 +395,7 @@ begin
cbObjects.Items.Clear; cbObjects.Items.Clear;
try try
{ get active source editor } { get active source editor }
lSrcEditor := SourceEditorWindow.ActiveEditor; lSrcEditor := SourceEditorManagerIntf.ActiveEditor;
if lSrcEditor = nil then if lSrcEditor = nil then
Exit; //==> Exit; //==>
lCodeBuffer := lSrcEditor.CodeToolsBuffer as TCodeBuffer; lCodeBuffer := lSrcEditor.CodeToolsBuffer as TCodeBuffer;
@ -541,10 +541,10 @@ end;
procedure TProcedureListForm.FormCreate(Sender: TObject); procedure TProcedureListForm.FormCreate(Sender: TObject);
begin begin
if SourceEditorWindow.ActiveEditor = nil then if SourceEditorManagerIntf.ActiveEditor = nil then
Exit; //==> Exit; //==>
FMainFilename := SourceEditorWindow.ActiveEditor.Filename; FMainFilename := SourceEditorManagerIntf.ActiveEditor.Filename;
Caption := Caption + ExtractFileName(FMainFilename); Caption := Caption + ExtractFileName(FMainFilename);
SetupGUI; SetupGUI;
PopulateObjectsCombo; PopulateObjectsCombo;

View File

@ -255,8 +255,8 @@ var
function FileIsOpenInSourceEditor: boolean; function FileIsOpenInSourceEditor: boolean;
begin begin
if not SrcEditValid then begin if not SrcEditValid then begin
if (TheFileName<>'') and (SourceEditorWindow<>nil) then if (TheFileName<>'') and (SourceEditorManagerIntf<>nil) then
SrcEdit:=SourceEditorWindow.SourceEditorIntfWithFilename(TheFileName) SrcEdit:=SourceEditorManagerIntf.SourceEditorIntfWithFilename(TheFileName)
else else
SrcEdit:=nil; SrcEdit:=nil;
SrcEditValid:=true; SrcEditValid:=true;

View File

@ -124,14 +124,14 @@ var
begin begin
if (Key=VK_ESCAPE) and (Shift=[]) then if (Key=VK_ESCAPE) and (Shift=[]) then
Hide Hide
else if SourceEditorWindow<>nil then begin else if SourceEditorManagerIntf<>nil then begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then if SrcEdit=nil then
Hide Hide
else begin else begin
// redirect keys // redirect keys
TWinControlAccess(SrcEdit.EditorControl).KeyDown(Key,Shift); TWinControlAccess(SrcEdit.EditorControl).KeyDown(Key,Shift);
SetActiveWindow(SourceEditorWindow.Handle); SetActiveWindow(SourceEditorManagerIntf.ActiveSourceWindow.Handle);
end; end;
end; end;
end; end;
@ -142,7 +142,7 @@ var
SrcEdit: TSourceEditorInterface; SrcEdit: TSourceEditorInterface;
ASynEdit: TCustomSynEdit; ASynEdit: TCustomSynEdit;
begin begin
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then begin if SrcEdit=nil then begin
Hide; Hide;
end else begin end else begin
@ -278,7 +278,7 @@ begin
end else begin end else begin
// place near the source editor caret // place near the source editor caret
CurCaret:=SrcEditCaret; CurCaret:=SrcEditCaret;
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if CurCaret.Y<1 then if CurCaret.Y<1 then
CurCaret:=SrcEdit.CursorScreenXY; CurCaret:=SrcEdit.CursorScreenXY;
CurCaret:=SrcEdit.EditorControl.ClientToScreen(SrcEdit.ScreenToPixelPosition(CurCaret)); CurCaret:=SrcEdit.EditorControl.ClientToScreen(SrcEdit.ScreenToPixelPosition(CurCaret));
@ -334,8 +334,8 @@ begin
if (AnchorForm<>nil) then begin if (AnchorForm<>nil) then begin
Result:=AnchorForm.Visible; Result:=AnchorForm.Visible;
end else begin end else begin
Result:=(SourceEditorWindow<>nil) Result:=(SourceEditorManagerIntf<>nil)
and (SourceEditorWindow.ActiveEditor<>nil); and (SourceEditorManagerIntf.ActiveEditor<>nil);
end; end;
end; end;

View File

@ -88,7 +88,7 @@ begin
if not LazarusIDE.BeginCodeTools then exit; if not LazarusIDE.BeginCodeTools then exit;
// get cursor position // get cursor position
SrcEdit:=SourceEditorWindow.ActiveEditor; SrcEdit:=SourceEditorManagerIntf.ActiveEditor;
if SrcEdit=nil then exit; if SrcEdit=nil then exit;
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer); Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);
if Code=nil then exit; if Code=nil then exit;

View File

@ -3129,8 +3129,8 @@ begin
PkgCompileTool.CmdLineParams:=EffectiveCompilerParams; PkgCompileTool.CmdLineParams:=EffectiveCompilerParams;
// clear old errors // clear old errors
if SourceEditorWindow<>nil then if SourceEditorManagerIntf<>nil then
SourceEditorWindow.ClearErrorLines; SourceEditorManagerIntf.ClearErrorLines;
// compile package // compile package
Result:=RunCompilerWithOptions(PkgCompileTool,APackage.CompilerOptions); Result:=RunCompilerWithOptions(PkgCompileTool,APackage.CompilerOptions);

View File

@ -1451,7 +1451,7 @@ begin
'FPCDIR='+EnvironmentOptions.GetFPCSourceDirectory); 'FPCDIR='+EnvironmentOptions.GetFPCSourceDirectory);
// clear old errors // clear old errors
SourceNotebook.ClearErrorLines; SourceEditorManager.ClearErrorLines;
// compile package // compile package
Result:=RunExternalTool(FPCMakeTool); Result:=RunExternalTool(FPCMakeTool);
@ -3288,7 +3288,7 @@ function TPkgManager.GetPackageOfCurrentSourceEditor: TPkgFile;
var var
SrcEdit: TSourceEditor; SrcEdit: TSourceEditor;
begin begin
SrcEdit:=SourceNotebook.GetActiveSE; SrcEdit:=SourceEditorManager.GetActiveSE;
if SrcEdit<>nil then begin if SrcEdit<>nil then begin
Result:=SearchFile(SrcEdit.Filename,[],nil); Result:=SearchFile(SrcEdit.Filename,[],nil);
end else end else