mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:19:16 +02:00
IDE: fixed reopening main unit in correct page and window
git-svn-id: trunk@26137 -
This commit is contained in:
parent
fd4c367e8d
commit
5325e801a8
22
ide/main.pp
22
ide/main.pp
@ -794,7 +794,7 @@ type
|
|||||||
function DoSaveAll(Flags: TSaveFlags): TModalResult;
|
function DoSaveAll(Flags: TSaveFlags): TModalResult;
|
||||||
procedure DoRestart;
|
procedure DoRestart;
|
||||||
procedure DoExecuteRemoteControl;
|
procedure DoExecuteRemoteControl;
|
||||||
function DoOpenMainUnit(Flags: TOpenFlags): TModalResult;
|
function DoOpenMainUnit(PageIndex, WindowIndex: integer; Flags: TOpenFlags): TModalResult;
|
||||||
function DoRevertMainUnit: TModalResult;
|
function DoRevertMainUnit: TModalResult;
|
||||||
function DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
function DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
|
||||||
function DoSelectFrame: TComponentClass;
|
function DoSelectFrame: TComponentClass;
|
||||||
@ -3810,7 +3810,7 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.mnuViewProjectSourceClicked(Sender: TObject);
|
procedure TMainIDE.mnuViewProjectSourceClicked(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoOpenMainUnit([]);
|
DoOpenMainUnit(-1,-1,[]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.mnuProjectOptionsClicked(Sender: TObject);
|
procedure TMainIDE.mnuProjectOptionsClicked(Sender: TObject);
|
||||||
@ -7659,6 +7659,7 @@ var
|
|||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
AShareEditor: TSourceEditor;
|
AShareEditor: TSourceEditor;
|
||||||
begin
|
begin
|
||||||
|
//debugln(['TMainIDE.DoOpenFileInSourceEditor ',AnEditorInfo.UnitInfo.Filename,' Window=',WindowIndex,'/',SourceEditorManager.SourceWindowCount,' Page=',PageIndex]);
|
||||||
AnUnitInfo := AnEditorInfo.UnitInfo;
|
AnUnitInfo := AnEditorInfo.UnitInfo;
|
||||||
AFilename:=AnUnitInfo.Filename;
|
AFilename:=AnUnitInfo.Filename;
|
||||||
if (WindowIndex < 0) then
|
if (WindowIndex < 0) then
|
||||||
@ -8428,7 +8429,7 @@ var
|
|||||||
begin
|
begin
|
||||||
{$IFDEF IDE_VERBOSE}
|
{$IFDEF IDE_VERBOSE}
|
||||||
DebugLn('');
|
DebugLn('');
|
||||||
DebugLn('*** TMainIDE.DoOpenEditorFile START "',AFilename,'" ',OpenFlagsToString(Flags));
|
DebugLn(['*** TMainIDE.DoOpenEditorFile START "',AFilename,'" ',OpenFlagsToString(Flags),' Window=',WindowIndex,' Page=',PageIndex]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenEditorFile START');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenEditorFile START');{$ENDIF}
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
@ -8477,7 +8478,7 @@ begin
|
|||||||
and (CompareFilenames(Project1.MainFilename,AFilename,
|
and (CompareFilenames(Project1.MainFilename,AFilename,
|
||||||
not (ofVirtualFile in Flags))=0)
|
not (ofVirtualFile in Flags))=0)
|
||||||
then begin
|
then begin
|
||||||
Result:=DoOpenMainUnit(Flags);
|
Result:=DoOpenMainUnit(PageIndex,WindowIndex,Flags);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -8535,7 +8536,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (not (ofProjectLoading in Flags)) and (NewEditorInfo.EditorComponent <> nil) then
|
if (not (ofProjectLoading in Flags)) and (NewEditorInfo.EditorComponent <> nil) then
|
||||||
begin
|
begin
|
||||||
//DebugLn('TMainIDE.DoOpenEditorFile file already open ',NewUnitInfo.Filename);
|
//DebugLn(['TMainIDE.DoOpenEditorFile file already open ',NewUnitInfo.Filename,' WindowIndex=',NewEditorInfo.WindowIndex,' PageIndex=',NewEditorInfo.PageIndex]);
|
||||||
// file already open -> change source notebook page
|
// file already open -> change source notebook page
|
||||||
SourceEditorManager.ActiveSourceWindowIndex := NewEditorInfo.WindowIndex;
|
SourceEditorManager.ActiveSourceWindowIndex := NewEditorInfo.WindowIndex;
|
||||||
SourceEditorManager.ActiveSourceWindow.PageIndex:= NewEditorInfo.PageIndex;
|
SourceEditorManager.ActiveSourceWindow.PageIndex:= NewEditorInfo.PageIndex;
|
||||||
@ -8671,7 +8672,8 @@ begin
|
|||||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenEditorFile END');{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoOpenEditorFile END');{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoOpenMainUnit(Flags: TOpenFlags): TModalResult;
|
function TMainIDE.DoOpenMainUnit(PageIndex, WindowIndex: integer;
|
||||||
|
Flags: TOpenFlags): TModalResult;
|
||||||
var MainUnitInfo: TUnitInfo;
|
var MainUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
{$IFDEF IDE_VERBOSE}
|
{$IFDEF IDE_VERBOSE}
|
||||||
@ -8692,7 +8694,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// open file in source notebook
|
// open file in source notebook
|
||||||
Result:=DoOpenFileInSourceEditor(MainUnitInfo.GetClosedOrNewEditorInfo, -1,-1,Flags);
|
Result:=DoOpenFileInSourceEditor(MainUnitInfo.GetClosedOrNewEditorInfo, PageIndex,WindowIndex,Flags);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
|
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
@ -8865,7 +8867,7 @@ begin
|
|||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if Project1.MainUnitInfo = AnUnitInfo then
|
if Project1.MainUnitInfo = AnUnitInfo then
|
||||||
Result:=DoOpenMainUnit([])
|
Result:=DoOpenMainUnit(-1,-1,[])
|
||||||
else
|
else
|
||||||
Result:=DoOpenEditorFile(AnUnitInfo.Filename,-1,-1,[ofOnlyIfExists]);
|
Result:=DoOpenEditorFile(AnUnitInfo.Filename,-1,-1,[ofOnlyIfExists]);
|
||||||
if Result=mrAbort then exit;
|
if Result=mrAbort then exit;
|
||||||
@ -13640,8 +13642,8 @@ begin
|
|||||||
FIDECodeToolsDefines:=ctdReady;
|
FIDECodeToolsDefines:=ctdReady;
|
||||||
//DebugLn('TMainIDE.CodeToolBossPrepareTree CompilerGraphStamp=',dbgs(CompilerGraphStamp));
|
//DebugLn('TMainIDE.CodeToolBossPrepareTree CompilerGraphStamp=',dbgs(CompilerGraphStamp));
|
||||||
{$IFDEF VerboseAddProjPkg}
|
{$IFDEF VerboseAddProjPkg}
|
||||||
DebugLn(['TMainIDE.CodeToolBossPrepareTree AAA1 "',CodeToolBoss.GetUnitPathForDirectory('',true),'"']);
|
DebugLn(['TMainIDE.CodeToolBossPrepareTree 1 "',CodeToolBoss.GetUnitPathForDirectory('',true),'"']);
|
||||||
DebugLn(['TMainIDE.CodeToolBossPrepareTree AAA2 "',CodeToolBoss.GetUnitPathForDirectory('',false),'"']);
|
DebugLn(['TMainIDE.CodeToolBossPrepareTree 2 "',CodeToolBoss.GetUnitPathForDirectory('',false),'"']);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user