mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 05:39:17 +02:00
IDE: move a piece of common code to TSourceEditorManager.
git-svn-id: trunk@45688 -
This commit is contained in:
parent
20b51931f7
commit
0bb3949faa
@ -1057,6 +1057,7 @@ type
|
||||
property SourceEditors[Index: integer]: TSourceEditor read GetSrcEditors; // reintroduced
|
||||
property SourceEditorsByPage[WindowIndex, PageIndex: integer]: TSourceEditor
|
||||
read GetSourceEditorsByPage;
|
||||
procedure SetWindowByIDAndPage(AWindowID, APageIndex: integer);
|
||||
function SourceEditorIntfWithFilename(const Filename: string): TSourceEditor; reintroduce;
|
||||
function FindSourceEditorWithEditorComponent(EditorComp: TComponent): TSourceEditor; // With SynEdit
|
||||
protected
|
||||
@ -9677,6 +9678,12 @@ begin
|
||||
Result := TSourceEditor(ActiveEditor);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.SetWindowByIDAndPage(AWindowID, APageIndex: integer);
|
||||
begin
|
||||
ActiveSourceWindowIndex := IndexOfSourceWindowWithID(AWindowID);
|
||||
ActiveSourceWindow.PageIndex:= APageIndex;
|
||||
end;
|
||||
|
||||
function TSourceEditorManager.SourceEditorIntfWithFilename(
|
||||
const Filename: string): TSourceEditor;
|
||||
begin
|
||||
|
@ -400,8 +400,7 @@ begin
|
||||
|
||||
if FNewUnitInfo.OpenEditorInfoCount > 0 then begin
|
||||
FNewEditorInfo := FNewUnitInfo.OpenEditorInfo[0];
|
||||
SourceEditorManager.ActiveSourceWindowIndex := SourceEditorManager.IndexOfSourceWindowWithID(FNewEditorInfo.WindowID);
|
||||
SourceEditorManager.ActiveSourceWindow.PageIndex:= FNewEditorInfo.PageIndex;
|
||||
SourceEditorManager.SetWindowByIDAndPage(FNewEditorInfo.WindowID, FNewEditorInfo.PageIndex);
|
||||
end
|
||||
else begin
|
||||
FNewEditorInfo := FNewUnitInfo.GetClosedOrNewEditorInfo;
|
||||
@ -468,7 +467,6 @@ begin
|
||||
exit(mrOK);
|
||||
end;
|
||||
|
||||
|
||||
function TFileOpenClose.PrepareFile: TModalResult;
|
||||
begin
|
||||
FUnitIndex:=Project1.IndexOfFilename(FFilename);
|
||||
@ -486,15 +484,11 @@ begin
|
||||
Result := mrOK;
|
||||
end;
|
||||
|
||||
|
||||
function TFileOpenClose.ChangeEditorPage: TModalResult;
|
||||
// file already open -> change source notebook page
|
||||
begin
|
||||
//DebugLn(['TFileOpenClose.ChangeEditorPage file already open ',FNewUnitInfo.Filename,' WindowIndex=',FNewEditorInfo.WindowID,' PageIndex=',FNewEditorInfo.PageIndex]);
|
||||
with SourceEditorManager do begin
|
||||
ActiveSourceWindowIndex := IndexOfSourceWindowWithID(FNewEditorInfo.WindowID);
|
||||
ActiveSourceWindow.PageIndex:= FNewEditorInfo.PageIndex;
|
||||
end;
|
||||
SourceEditorManager.SetWindowByIDAndPage(FNewEditorInfo.WindowID, FNewEditorInfo.PageIndex);
|
||||
if ofDoLoadResource in FFlags then
|
||||
Result:=OpenResource
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user