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 <class_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 class_treeprojectfiles.h.

Constructor & Destructor Documentation

TREEPROJECTFILES::TREEPROJECTFILES ( TREE_PROJECT_FRAME parent)

Definition at line 42 of file class_treeprojectfiles.cpp.

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

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( kicad_icon_small_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( icon_txt_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( svg_file_xpm ) ); // TREE_SVG
76  m_ImageList->Add( KiBitmap( pagelayout_load_default_xpm ) );// TREE_PAGE_LAYOUT_DESCR
77  m_ImageList->Add( KiBitmap( module_xpm ) ); // TREE_FOOTPRINT_FILE
78  m_ImageList->Add( KiBitmap( library_xpm ) ); // TREE_SCHEMATIC_LIBFILE
79 
80  SetImageList( m_ImageList );
81 }
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
Definition: kicad.h:72
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
TREE_PROJECT_FRAME * m_Parent
TREEPROJECTFILES::~TREEPROJECTFILES ( )

Definition at line 84 of file class_treeprojectfiles.cpp.

References m_ImageList.

85 {
86  delete m_ImageList;
87 }

Member Function Documentation

TREE_PROJECT_FRAME* TREEPROJECTFILES::GetParent ( ) const
inline

Definition at line 50 of file class_treeprojectfiles.h.

References m_Parent.

51  {
52  return m_Parent;
53  }
TREE_PROJECT_FRAME * m_Parent
int TREEPROJECTFILES::OnCompareItems ( const wxTreeItemId &  item1,
const wxTreeItemId &  item2 
)
overrideprivate

Definition at line 90 of file class_treeprojectfiles.cpp.

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

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

Member Data Documentation

wxImageList* TREEPROJECTFILES::m_ImageList
private

Definition at line 46 of file class_treeprojectfiles.h.

Referenced by ~TREEPROJECTFILES().

TREE_PROJECT_FRAME* TREEPROJECTFILES::m_Parent
private

Definition at line 45 of file class_treeprojectfiles.h.

Referenced by GetParent().


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