KiCad PCB EDA Suite
TREEPROJECTFILES Class Reference

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

#include <treeprojectfiles.h>

Inheritance diagram for TREEPROJECTFILES:

Public Member Functions

TREE_PROJECT_FRAMEGetParent () const
 
 TREEPROJECTFILES (TREE_PROJECT_FRAME *parent)
 
 ~TREEPROJECTFILES ()
 

Private Member Functions

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

Private Attributes

TREE_PROJECT_FRAMEm_Parent
 
wxImageList * m_ImageList
 

Detailed Description

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

Definition at line 41 of file treeprojectfiles.h.

Constructor & Destructor Documentation

◆ TREEPROJECTFILES()

TREEPROJECTFILES::TREEPROJECTFILES ( TREE_PROJECT_FRAME parent)

Definition at line 42 of file treeprojectfiles.cpp.

42  :
43  wxTreeCtrl( parent, ID_PROJECT_TREE,
44  wxDefaultPosition, wxDefaultSize,
45  wxTR_HAS_BUTTONS, wxDefaultValidator,
46  wxT( "EDATreeCtrl" ) )
47 {
48  m_Parent = parent;
49 
50  // icons size is not know (depending on they are built)
51  // so get it:
52  wxSize iconsize;
53  wxBitmap dummy = KiBitmap( eeschema_xpm );
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, TREE_MAX );
59 
60  m_ImageList->Add( KiBitmap( new_project_xpm ) ); // TREE_PROJECT
61  m_ImageList->Add( KiBitmap( eeschema_xpm ) ); // TREE_SCHEMA
62  m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_LEGACY_PCB
63  m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_SFMT_PCB
64  m_ImageList->Add( KiBitmap( icon_gerbview_small_xpm ) ); // TREE_GERBER
65  m_ImageList->Add( KiBitmap( html_xpm ) ); // TREE_HTML
66  m_ImageList->Add( KiBitmap( datasheet_xpm ) ); // TREE_PDF
67  m_ImageList->Add( KiBitmap( editor_xpm ) ); // TREE_TXT
68  m_ImageList->Add( KiBitmap( netlist_xpm ) ); // TREE_NET
69  m_ImageList->Add( KiBitmap( unknown_xpm ) ); // TREE_UNKNOWN
70  m_ImageList->Add( KiBitmap( directory_xpm ) ); // TREE_DIRECTORY
71  m_ImageList->Add( KiBitmap( icon_cvpcb_small_xpm ) ); // TREE_CMP_LINK
72  m_ImageList->Add( KiBitmap( tools_xpm ) ); // TREE_REPORT
73  m_ImageList->Add( KiBitmap( post_compo_xpm ) ); // TREE_POS
74  m_ImageList->Add( KiBitmap( post_drill_xpm ) ); // TREE_DRILL
75  m_ImageList->Add( KiBitmap( post_drill_xpm ) ); // TREE_DRILL_NC (similar TREE_DRILL)
76  m_ImageList->Add( KiBitmap( post_drill_xpm ) ); // TREE_DRILL_XNC (similar TREE_DRILL)
77  m_ImageList->Add( KiBitmap( svg_file_xpm ) ); // TREE_SVG
78  m_ImageList->Add( KiBitmap( pagelayout_load_xpm ) ); // TREE_PAGE_LAYOUT_DESCR
79  m_ImageList->Add( KiBitmap( module_xpm ) ); // TREE_FOOTPRINT_FILE
80  m_ImageList->Add( KiBitmap( library_xpm ) ); // TREE_SCHEMATIC_LIBFILE
81 
82  SetImageList( m_ImageList );
83 }
wxImageList * m_ImageList
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
TREE_PROJECT_FRAME * m_Parent

References dummy(), KiBitmap(), and TREE_MAX.

◆ ~TREEPROJECTFILES()

TREEPROJECTFILES::~TREEPROJECTFILES ( )

Definition at line 86 of file treeprojectfiles.cpp.

87 {
88  delete m_ImageList;
89 }
wxImageList * m_ImageList

References m_ImageList.

Member Function Documentation

◆ GetParent()

TREE_PROJECT_FRAME* TREEPROJECTFILES::GetParent ( ) const
inline

Definition at line 50 of file treeprojectfiles.h.

51  {
52  return m_Parent;
53  }
TREE_PROJECT_FRAME * m_Parent

References m_Parent.

◆ OnCompareItems()

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

Definition at line 92 of file treeprojectfiles.cpp.

93 {
94  TREEPROJECT_ITEM* myitem1 = (TREEPROJECT_ITEM*) GetItemData( item1 );
95  TREEPROJECT_ITEM* myitem2 = (TREEPROJECT_ITEM*) GetItemData( item2 );
96 
97  if( myitem1->GetType() == TREE_DIRECTORY && myitem2->GetType() != TREE_DIRECTORY )
98  return -1;
99 
100  if( myitem2->GetType() == TREE_DIRECTORY && myitem1->GetType() != TREE_DIRECTORY )
101  return 1;
102 
103  if( myitem1->IsRootFile() && !myitem2->IsRootFile() )
104  return -1;
105 
106  if( myitem2->IsRootFile() && !myitem1->IsRootFile() )
107  return 1;
108 
109  return myitem1->GetFileName().CmpNoCase( myitem2->GetFileName() );
110 }
bool IsRootFile() const
Class TREEPROJECT_ITEM handles one item (a file or a directory name) for the tree file.
TreeFileType GetType() const
const wxString & GetFileName() const

References TREEPROJECT_ITEM::GetFileName(), TREEPROJECT_ITEM::GetType(), TREEPROJECT_ITEM::IsRootFile(), and TREE_DIRECTORY.

Member Data Documentation

◆ m_ImageList

wxImageList* TREEPROJECTFILES::m_ImageList
private

Definition at line 46 of file treeprojectfiles.h.

Referenced by ~TREEPROJECTFILES().

◆ m_Parent

TREE_PROJECT_FRAME* TREEPROJECTFILES::m_Parent
private

Definition at line 45 of file treeprojectfiles.h.

Referenced by GetParent().


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