mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 01:47:43 +02:00
SourceEditor: Sort Tabs in popup
git-svn-id: trunk@36231 -
This commit is contained in:
parent
e84b3bad31
commit
a6dd9b4d8d
@ -5416,6 +5416,7 @@ var
|
||||
EditorCur: TSourceEditor;
|
||||
P: TIDEPackage;
|
||||
RecMenu, M: TIDEMenuSection;
|
||||
EdList: TStringList;
|
||||
begin
|
||||
PopM:=TPopupMenu(Sender);
|
||||
SourceTabMenuRoot.MenuItem:=PopM.Items;
|
||||
@ -5457,17 +5458,26 @@ begin
|
||||
SrcEditMenuMoveEditorFirst.MenuItem.Enabled:= (PageCount>1) and (PageIndex>0);
|
||||
SrcEditMenuMoveEditorLast.MenuItem.Enabled:= (PageCount>1) and (PageIndex<(PageCount-1));
|
||||
|
||||
|
||||
SrcEditMenuSectionEditors.Clear;
|
||||
if Manager <> nil then begin
|
||||
EdList := TStringList.Create;
|
||||
EdList.OwnsObjects := False;
|
||||
EdList.Sorted := True;
|
||||
// sort
|
||||
for i := 0 to EditorCount - 1 do
|
||||
EdList.AddObject(ExtractFileName(Editors[i].FileName)+' '+Editors[i].FileName, Editors[i]);
|
||||
|
||||
|
||||
RecMenu := RegisterIDESubMenu(SrcEditMenuSectionEditors, lisRecentTabs, lisRecentTabs);
|
||||
RecMenu.Visible := False;
|
||||
RegisterIDESubMenu(SrcEditMenuSectionEditors, dlgEnvProject, dlgEnvProject).Visible := False;
|
||||
RegisterIDESubMenu(SrcEditMenuSectionEditors, lisMEOther, lisMEOther).Visible := False;
|
||||
|
||||
//first add all pages in the correct order since the editor order can be different from the tab order
|
||||
for i := 0 to EditorCount - 1 do
|
||||
for i := 0 to EdList.Count - 1 do
|
||||
begin
|
||||
EditorCur := FindSourceEditorWithPageIndex(i);
|
||||
EditorCur := TSourceEditor(EdList.Objects[i]);
|
||||
s := lisMEOther;
|
||||
if (EditorCur.GetProjectFile <> nil) and (EditorCur.GetProjectFile.IsPartOfProject) then
|
||||
s := dlgEnvProject
|
||||
@ -5486,6 +5496,8 @@ begin
|
||||
AddEditorToMenuSection(EditorCur, M, i);
|
||||
end;
|
||||
|
||||
EdList.Free;
|
||||
|
||||
// add recent tabs. skip 0 since that is the active tab
|
||||
for i := 1 to Min(10, FHistoryList.Count-1) do
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user