EEschema: Sort Hierarchy tree

This sorts the hierarchy tree children alphabetically
This commit is contained in:
Seth Hillbrand 2020-09-21 11:16:32 -07:00
parent 456735f803
commit 975e5562a0
2 changed files with 12 additions and 3 deletions

View File

@ -34,12 +34,9 @@
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <schematic.h>
#include <wx/imaglist.h>
#include <wx/treectrl.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/sch_editor_control.h>
//#include <netlist_object.h>
#include <sch_sheet_path.h>
#include <hierarch.h>
@ -47,6 +44,8 @@
#include <kiface_i.h>
#include "eeschema_settings.h"
#include <wx/wx.h>
class HIERARCHY_NAVIG_DLG;
@ -157,6 +156,12 @@ void HIERARCHY_TREE::onChar( wxKeyEvent& event )
}
int HIERARCHY_TREE::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 )
{
return GetItemText( item1 ).CmpNoCase( GetItemText( item2 ) );
}
void HIERARCHY_NAVIG_DLG::buildHierarchyTree( SCH_SHEET_PATH* aList, wxTreeItemId* aPreviousmenu )
{
wxCHECK_RET( m_nbsheets < NB_MAX_SHEET, "Maximum number of sheets exceeded." );
@ -186,6 +191,8 @@ void HIERARCHY_NAVIG_DLG::buildHierarchyTree( SCH_SHEET_PATH* aList, wxTreeItemI
if( m_nbsheets >= NB_MAX_SHEET )
break;
}
m_Tree->SortChildren( *aPreviousmenu );
}
void HIERARCHY_NAVIG_DLG::UpdateHierarchyTree()

View File

@ -53,6 +53,8 @@ public:
// Closes the dialog on escape key
void onChar( wxKeyEvent& event );
int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) override;
};
class HIERARCHY_NAVIG_DLG : public DIALOG_SHIM