mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-08 04:37:23 +01:00
IDE: added source editor tabs to the Window menu, if the source editor notebook doesn't have the PageListPopup capability from Benito (part of issue #11562)
git-svn-id: trunk@16001 -
This commit is contained in:
parent
11038348f3
commit
9ca6edefb0
@ -112,6 +112,7 @@ type
|
||||
procedure SetToolStatus(const AValue: TIDEToolStatus); virtual;
|
||||
|
||||
procedure mnuWindowItemClick(Sender: TObject); virtual;
|
||||
procedure mnuWindowSourceItemClick(Sender: TObject); virtual;
|
||||
procedure OnMainBarDestroy(Sender: TObject); virtual;
|
||||
|
||||
procedure ConnectOutputFilter;
|
||||
@ -196,6 +197,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDEBase.mnuWindowSourceItemClick(Sender: TObject);
|
||||
var page: longint;
|
||||
begin
|
||||
page:=(sender as TIDEMenuCommand).tag;
|
||||
if (SourceNotebook = nil) or (page<0) or (page>=SourceNotebook.Count) then
|
||||
exit;
|
||||
SourceEditorWindow.BringToFront;
|
||||
SourceNotebook.ActiveEditor:=SourceNotebook.Editors[page];
|
||||
end;
|
||||
|
||||
procedure TMainIDEBase.OnMainBarDestroy(Sender: TObject);
|
||||
begin
|
||||
//writeln('TMainIDEBase.OnMainBarDestroy');
|
||||
@ -987,7 +998,7 @@ end;
|
||||
procedure TMainIDEBase.UpdateWindowMenu;
|
||||
var
|
||||
WindowsList: TFPList;
|
||||
i: Integer;
|
||||
i, ItemCount: Integer;
|
||||
CurMenuItem: TIDEMenuItem;
|
||||
AForm: TForm;
|
||||
begin
|
||||
@ -1013,21 +1024,49 @@ begin
|
||||
end;
|
||||
|
||||
// create menuitems
|
||||
ItemCount := WindowsList.Count;
|
||||
for i:=0 to WindowsList.Count-1 do begin
|
||||
if mnuWindow.Count>i then
|
||||
CurMenuItem:=mnuWindow.Items[i]
|
||||
else begin
|
||||
else
|
||||
CurMenuItem:=RegisterIDEMenuCommand(mnuWindow.GetPath,
|
||||
'Window'+IntToStr(i),'');
|
||||
CurMenuItem.OnClick:=@mnuWindowItemClick;
|
||||
end;
|
||||
|
||||
CurMenuItem.Caption:=TCustomForm(WindowsList[i]).Caption;
|
||||
CurMenuItem.MenuItem.Checked := Screen.ActiveCustomForm = TCustomForm(WindowsList[i]);
|
||||
CurMenuItem.OnClick:=@mnuWindowItemClick;
|
||||
end;
|
||||
|
||||
//create source page menuitems
|
||||
|
||||
if (SourceNotebook<>nil) and (SourceNotebook.Notebook<>nil) and not (nbcPageListPopup in SourceNotebook.Notebook.GetCapabilities) then begin
|
||||
if mnuWindow.Count > ItemCount then
|
||||
CurMenuItem := mnuWindow.Items[ItemCount]
|
||||
else
|
||||
CurMenuItem:=RegisterIDEMenuCommand(mnuWindow.GetPath,
|
||||
'Window'+IntToStr(ItemCount),'');
|
||||
CurMenuItem.OnClick:=nil;
|
||||
CurMenuItem.Caption:='-';
|
||||
ItemCount:=ItemCount+1;
|
||||
for i:=0 to SourceNotebook.EditorCount-1 do begin
|
||||
if mnuWindow.Count>i+ItemCount then
|
||||
CurMenuItem:=mnuWindow.Items[i+ItemCount]
|
||||
else
|
||||
CurMenuItem:=RegisterIDEMenuCommand(mnuWindow.GetPath,
|
||||
'Window'+IntToStr(i+ItemCount),'');
|
||||
|
||||
CurMenuItem.Caption:=SourceNotebook.Editors[i].PageName;
|
||||
CurMenuItem.MenuItem.Checked := SourceNotebook.ActiveEditor = SourceNotebook.Editors[i] ;
|
||||
CurMenuItem.OnClick:=@mnuWindowSourceItemClick;
|
||||
CurMenuItem.Tag:=i;
|
||||
end;
|
||||
ItemCount := ItemCount + SourceNotebook.EditorCount;
|
||||
end;
|
||||
// remove unused menuitems
|
||||
while mnuWindow.Count>WindowsList.Count do
|
||||
while mnuWindow.Count>ItemCount do
|
||||
mnuWindow.Items[mnuWindow.Count-1].Free;
|
||||
// clean up
|
||||
|
||||
// clean up
|
||||
WindowsList.Free;
|
||||
end;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user