mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 13:58:23 +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;
|
EditorCur: TSourceEditor;
|
||||||
P: TIDEPackage;
|
P: TIDEPackage;
|
||||||
RecMenu, M: TIDEMenuSection;
|
RecMenu, M: TIDEMenuSection;
|
||||||
|
EdList: TStringList;
|
||||||
begin
|
begin
|
||||||
PopM:=TPopupMenu(Sender);
|
PopM:=TPopupMenu(Sender);
|
||||||
SourceTabMenuRoot.MenuItem:=PopM.Items;
|
SourceTabMenuRoot.MenuItem:=PopM.Items;
|
||||||
@ -5457,17 +5458,26 @@ begin
|
|||||||
SrcEditMenuMoveEditorFirst.MenuItem.Enabled:= (PageCount>1) and (PageIndex>0);
|
SrcEditMenuMoveEditorFirst.MenuItem.Enabled:= (PageCount>1) and (PageIndex>0);
|
||||||
SrcEditMenuMoveEditorLast.MenuItem.Enabled:= (PageCount>1) and (PageIndex<(PageCount-1));
|
SrcEditMenuMoveEditorLast.MenuItem.Enabled:= (PageCount>1) and (PageIndex<(PageCount-1));
|
||||||
|
|
||||||
|
|
||||||
SrcEditMenuSectionEditors.Clear;
|
SrcEditMenuSectionEditors.Clear;
|
||||||
if Manager <> nil then begin
|
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 := RegisterIDESubMenu(SrcEditMenuSectionEditors, lisRecentTabs, lisRecentTabs);
|
||||||
RecMenu.Visible := False;
|
RecMenu.Visible := False;
|
||||||
RegisterIDESubMenu(SrcEditMenuSectionEditors, dlgEnvProject, dlgEnvProject).Visible := False;
|
RegisterIDESubMenu(SrcEditMenuSectionEditors, dlgEnvProject, dlgEnvProject).Visible := False;
|
||||||
RegisterIDESubMenu(SrcEditMenuSectionEditors, lisMEOther, lisMEOther).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
|
//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
|
begin
|
||||||
EditorCur := FindSourceEditorWithPageIndex(i);
|
EditorCur := TSourceEditor(EdList.Objects[i]);
|
||||||
s := lisMEOther;
|
s := lisMEOther;
|
||||||
if (EditorCur.GetProjectFile <> nil) and (EditorCur.GetProjectFile.IsPartOfProject) then
|
if (EditorCur.GetProjectFile <> nil) and (EditorCur.GetProjectFile.IsPartOfProject) then
|
||||||
s := dlgEnvProject
|
s := dlgEnvProject
|
||||||
@ -5486,6 +5496,8 @@ begin
|
|||||||
AddEditorToMenuSection(EditorCur, M, i);
|
AddEditorToMenuSection(EditorCur, M, i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
EdList.Free;
|
||||||
|
|
||||||
// add recent tabs. skip 0 since that is the active tab
|
// add recent tabs. skip 0 since that is the active tab
|
||||||
for i := 1 to Min(10, FHistoryList.Count-1) do
|
for i := 1 to Min(10, FHistoryList.Count-1) do
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user