KiCad PCB EDA Suite
PROJECT_TREE Class Reference

PROJECT_TREE This is the class to show (as a tree) the files in the project directory. More...

#include <project_tree.h>

Inheritance diagram for PROJECT_TREE:

Public Member Functions

PROJECT_TREE_PANEGetProjectTreePane () const
 
 PROJECT_TREE (PROJECT_TREE_PANE *parent)
 
 ~PROJECT_TREE ()
 

Private Member Functions

int OnCompareItems (const wxTreeItemId &item1, const wxTreeItemId &item2) override
 

Private Attributes

PROJECT_TREE_PANEm_projectTreePane
 
wxImageList * m_imageList
 

Detailed Description

PROJECT_TREE This is the class to show (as a tree) the files in the project directory.

Definition at line 38 of file project_tree.h.

Constructor & Destructor Documentation

◆ PROJECT_TREE()

PROJECT_TREE::PROJECT_TREE ( PROJECT_TREE_PANE parent)

Definition at line 43 of file project_tree.cpp.

43  :
44  wxTreeCtrl( parent, ID_PROJECT_TREE, wxDefaultPosition, wxDefaultSize,
45  PLATFORM_STYLE | wxTR_HAS_BUTTONS | wxTR_MULTIPLE, wxDefaultValidator,
46  wxT( "EDATreeCtrl" ) )
47 {
48  m_projectTreePane = parent;
49 
50  // icons size is not know (depending on they are built)
51  // so get it:
52  wxSize iconsize;
54  iconsize.x = dummy.GetWidth();
55  iconsize.y = dummy.GetHeight();
56 
57  // Make an image list containing small icons
58  m_imageList = new wxImageList( iconsize.x, iconsize.y, true,
59  static_cast<int>( TREE_FILE_TYPE::MAX ) );
60 
61  m_imageList->Add( KiBitmap( BITMAPS::project ) ); // TREE_LEGACY_PROJECT
62  m_imageList->Add( KiBitmap( BITMAPS::project_kicad ) ); // TREE_JSON_PROJECT
63  m_imageList->Add( KiBitmap( BITMAPS::icon_eeschema_24 ) ); // TREE_LEGACY_SCHEMATIC
64  m_imageList->Add( KiBitmap( BITMAPS::icon_eeschema_24 ) ); // TREE_SEXPR_SCHEMATIC
65  m_imageList->Add( KiBitmap( BITMAPS::icon_pcbnew_24 ) ); // TREE_LEGACY_PCB
66  m_imageList->Add( KiBitmap( BITMAPS::icon_pcbnew_24 ) ); // TREE_SEXPR_PCB
67  m_imageList->Add( KiBitmap( BITMAPS::icon_gerbview_24 ) ); // TREE_GERBER
68  m_imageList->Add( KiBitmap( BITMAPS::file_gerber_job ) ); // TREE_GERBER_JOB_FILE (.gbrjob)
69  m_imageList->Add( KiBitmap( BITMAPS::file_html ) ); // TREE_HTML
70  m_imageList->Add( KiBitmap( BITMAPS::file_pdf ) ); // TREE_PDF
71  m_imageList->Add( KiBitmap( BITMAPS::editor ) ); // TREE_TXT
72  m_imageList->Add( KiBitmap( BITMAPS::netlist ) ); // TREE_NET
73  m_imageList->Add( KiBitmap( BITMAPS::unknown ) ); // TREE_UNKNOWN
74  m_imageList->Add( KiBitmap( BITMAPS::directory ) ); // TREE_DIRECTORY
75  m_imageList->Add( KiBitmap( BITMAPS::icon_cvpcb_24 ) ); // TREE_CMP_LINK
76  m_imageList->Add( KiBitmap( BITMAPS::tools ) ); // TREE_REPORT
77  m_imageList->Add( KiBitmap( BITMAPS::file_pos ) ); // TREE_POS
78  m_imageList->Add( KiBitmap( BITMAPS::file_drl ) ); // TREE_DRILL
79  m_imageList->Add( KiBitmap( BITMAPS::file_drl ) ); // TREE_DRILL_NC (similar TREE_DRILL)
80  m_imageList->Add( KiBitmap( BITMAPS::file_drl ) ); // TREE_DRILL_XNC (similar TREE_DRILL)
81  m_imageList->Add( KiBitmap( BITMAPS::file_svg ) ); // TREE_SVG
82  m_imageList->Add( KiBitmap( BITMAPS::icon_pagelayout_editor_24 ) ); // TREE_PAGE_LAYOUT_DESCR
83  m_imageList->Add( KiBitmap( BITMAPS::module ) ); // TREE_FOOTPRINT_FILE
84  m_imageList->Add( KiBitmap( BITMAPS::library ) ); // TREE_SCHEMATIC_LIBFILE
85  m_imageList->Add( KiBitmap( BITMAPS::library ) ); // TREE_SEXPR_SYMBOL_LIB_FILE
86  m_imageList->Add( KiBitmap( BITMAPS::editor ) ); // DESIGN_RULES
87 
88  SetImageList( m_imageList );
89 }
wxImageList * m_imageList
Definition: project_tree.h:44
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
PROJECT_TREE_PANE * m_projectTreePane
Definition: project_tree.h:43
#define PLATFORM_STYLE
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104

References directory, dummy(), editor, file_drl, file_gerber_job, file_html, file_pdf, file_pos, file_svg, icon_cvpcb_24, icon_eeschema_24, icon_gerbview_24, icon_pagelayout_editor_24, icon_pcbnew_24, KiBitmap(), library, m_imageList, m_projectTreePane, MAX, module, netlist, project, project_kicad, tools, and unknown.

◆ ~PROJECT_TREE()

PROJECT_TREE::~PROJECT_TREE ( )

Definition at line 92 of file project_tree.cpp.

93 {
94  delete m_imageList;
95 }
wxImageList * m_imageList
Definition: project_tree.h:44

References m_imageList.

Member Function Documentation

◆ GetProjectTreePane()

PROJECT_TREE_PANE* PROJECT_TREE::GetProjectTreePane ( ) const
inline

Definition at line 47 of file project_tree.h.

47 { return m_projectTreePane; }
PROJECT_TREE_PANE * m_projectTreePane
Definition: project_tree.h:43

References m_projectTreePane.

◆ OnCompareItems()

int PROJECT_TREE::OnCompareItems ( const wxTreeItemId &  item1,
const wxTreeItemId &  item2 
)
overrideprivate

Definition at line 98 of file project_tree.cpp.

99 {
100  PROJECT_TREE_ITEM* myitem1 = (PROJECT_TREE_ITEM*) GetItemData( item1 );
101  PROJECT_TREE_ITEM* myitem2 = (PROJECT_TREE_ITEM*) GetItemData( item2 );
102 
103  if( !myitem1 || !myitem2 )
104  return 0;
105 
106  if( myitem1->GetType() == TREE_FILE_TYPE::DIRECTORY
107  && myitem2->GetType() != TREE_FILE_TYPE::DIRECTORY )
108  return -1;
109 
110  if( myitem2->GetType() == TREE_FILE_TYPE::DIRECTORY
111  && myitem1->GetType() != TREE_FILE_TYPE::DIRECTORY )
112  return 1;
113 
114  if( myitem1->IsRootFile() && !myitem2->IsRootFile() )
115  return -1;
116 
117  if( myitem2->IsRootFile() && !myitem1->IsRootFile() )
118  return 1;
119 
120  return myitem1->GetFileName().CmpNoCase( myitem2->GetFileName() );
121 }
const wxString & GetFileName() const
TREE_FILE_TYPE GetType() const
bool IsRootFile() const
PROJECT_TREE_ITEM handles one item (a file or a directory name) for the tree file.

References DIRECTORY, PROJECT_TREE_ITEM::GetFileName(), PROJECT_TREE_ITEM::GetType(), and PROJECT_TREE_ITEM::IsRootFile().

Member Data Documentation

◆ m_imageList

wxImageList* PROJECT_TREE::m_imageList
private

Definition at line 44 of file project_tree.h.

Referenced by PROJECT_TREE(), and ~PROJECT_TREE().

◆ m_projectTreePane

PROJECT_TREE_PANE* PROJECT_TREE::m_projectTreePane
private

Definition at line 43 of file project_tree.h.

Referenced by GetProjectTreePane(), and PROJECT_TREE().


The documentation for this class was generated from the following files: