KiCad PCB EDA Suite
TREEPROJECTFILES Class Reference

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

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.

43  : wxTreeCtrl( parent, ID_PROJECT_TREE, wxDefaultPosition, wxDefaultSize,
44  wxTR_HAS_BUTTONS | wxTR_MULTIPLE, wxDefaultValidator, wxT( "EDATreeCtrl" ) )
45 {
46  m_Parent = parent;
47 
48  // icons size is not know (depending on they are built)
49  // so get it:
50  wxSize iconsize;
51  wxBitmap dummy = KiBitmap( eeschema_xpm );
52  iconsize.x = dummy.GetWidth();
53  iconsize.y = dummy.GetHeight();
54 
55  // Make an image list containing small icons
56  m_ImageList = new wxImageList( iconsize.x, iconsize.y, true, TREE_MAX );
57 
58  m_ImageList->Add( KiBitmap( new_project_xpm ) ); // TREE_LEGACY_PROJECT
59  m_ImageList->Add( KiBitmap( new_project_xpm ) ); // TREE_JSON_PROJECT
60  m_ImageList->Add( KiBitmap( eeschema_xpm ) ); // TREE_LEGACY_SCHEMATIC
61  m_ImageList->Add( KiBitmap( eeschema_xpm ) ); // TREE_SEXPR_SCHEMATIC
62  m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_LEGACY_PCB
63  m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_SEXPR_PCB
64  m_ImageList->Add( KiBitmap( icon_gerbview_small_xpm ) ); // TREE_GERBER
65  m_ImageList->Add( KiBitmap( gerber_job_file_xpm ) ); // TREE_GERBER_JOB_FILE (.gbrjob)
66  m_ImageList->Add( KiBitmap( html_xpm ) ); // TREE_HTML
67  m_ImageList->Add( KiBitmap( datasheet_xpm ) ); // TREE_PDF
68  m_ImageList->Add( KiBitmap( editor_xpm ) ); // TREE_TXT
69  m_ImageList->Add( KiBitmap( netlist_xpm ) ); // TREE_NET
70  m_ImageList->Add( KiBitmap( unknown_xpm ) ); // TREE_UNKNOWN
71  m_ImageList->Add( KiBitmap( directory_xpm ) ); // TREE_DIRECTORY
72  m_ImageList->Add( KiBitmap( icon_cvpcb_small_xpm ) ); // TREE_CMP_LINK
73  m_ImageList->Add( KiBitmap( tools_xpm ) ); // TREE_REPORT
74  m_ImageList->Add( KiBitmap( post_compo_xpm ) ); // TREE_POS
75  m_ImageList->Add( KiBitmap( post_drill_xpm ) ); // TREE_DRILL
76  m_ImageList->Add( KiBitmap( post_drill_xpm ) ); // TREE_DRILL_NC (similar TREE_DRILL)
77  m_ImageList->Add( KiBitmap( post_drill_xpm ) ); // TREE_DRILL_XNC (similar TREE_DRILL)
78  m_ImageList->Add( KiBitmap( svg_file_xpm ) ); // TREE_SVG
79  m_ImageList->Add( KiBitmap( pagelayout_load_xpm ) ); // TREE_PAGE_LAYOUT_DESCR
80  m_ImageList->Add( KiBitmap( module_xpm ) ); // TREE_FOOTPRINT_FILE
81  m_ImageList->Add( KiBitmap( library_xpm ) ); // TREE_SCHEMATIC_LIBFILE
82  m_ImageList->Add( KiBitmap( library_xpm ) ); // TREE_SEXPR_SYMBOL_LIB_FILE
83 
84  SetImageList( m_ImageList );
85 }
const BITMAP_OPAQUE module_xpm[1]
Definition: module.cpp:29
const BITMAP_OPAQUE icon_cvpcb_small_xpm[1]
const BITMAP_OPAQUE editor_xpm[1]
Definition: editor.cpp:83
const BITMAP_OPAQUE new_project_xpm[1]
Definition: new_project.cpp:32
wxImageList * m_ImageList
const BITMAP_OPAQUE pagelayout_load_xpm[1]
const BITMAP_OPAQUE gerber_job_file_xpm[1]
const BITMAP_OPAQUE svg_file_xpm[1]
Definition: svg_file.cpp:68
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
const BITMAP_OPAQUE datasheet_xpm[1]
Definition: datasheet.cpp:76
const BITMAP_OPAQUE library_xpm[1]
Definition: library.cpp:71
const BITMAP_OPAQUE html_xpm[1]
Definition: html.cpp:65
const BITMAP_OPAQUE pcbnew_xpm[1]
const BITMAP_OPAQUE tools_xpm[1]
Definition: tools.cpp:113
const BITMAP_OPAQUE directory_xpm[1]
Definition: directory.cpp:30
const BITMAP_OPAQUE unknown_xpm[1]
Definition: unknown.cpp:60
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
const BITMAP_OPAQUE netlist_xpm[1]
const BITMAP_OPAQUE eeschema_xpm[1]
TREE_PROJECT_FRAME * m_Parent
const BITMAP_OPAQUE post_drill_xpm[1]
Definition: post_drill.cpp:61
const BITMAP_OPAQUE icon_gerbview_small_xpm[1]
const BITMAP_OPAQUE post_compo_xpm[1]
Definition: post_compo.cpp:96

References datasheet_xpm, directory_xpm, dummy(), editor_xpm, eeschema_xpm, gerber_job_file_xpm, html_xpm, icon_cvpcb_small_xpm, icon_gerbview_small_xpm, KiBitmap(), library_xpm, module_xpm, netlist_xpm, new_project_xpm, pagelayout_load_xpm, pcbnew_xpm, post_compo_xpm, post_drill_xpm, svg_file_xpm, tools_xpm, TREE_MAX, and unknown_xpm.

◆ ~TREEPROJECTFILES()

TREEPROJECTFILES::~TREEPROJECTFILES ( )

Definition at line 88 of file treeprojectfiles.cpp.

89 {
90  delete m_ImageList;
91 }
wxImageList * m_ImageList

References m_ImageList.

Member Function Documentation

◆ GetParent()

TREE_PROJECT_FRAME* TREEPROJECTFILES::GetParent ( void  ) 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 94 of file treeprojectfiles.cpp.

95 {
96  TREEPROJECT_ITEM* myitem1 = (TREEPROJECT_ITEM*) GetItemData( item1 );
97  TREEPROJECT_ITEM* myitem2 = (TREEPROJECT_ITEM*) GetItemData( item2 );
98 
99  if( !myitem1 || !myitem2 )
100  return 0;
101 
102  if( myitem1->GetType() == TREE_DIRECTORY && myitem2->GetType() != TREE_DIRECTORY )
103  return -1;
104 
105  if( myitem2->GetType() == TREE_DIRECTORY && myitem1->GetType() != TREE_DIRECTORY )
106  return 1;
107 
108  if( myitem1->IsRootFile() && !myitem2->IsRootFile() )
109  return -1;
110 
111  if( myitem2->IsRootFile() && !myitem1->IsRootFile() )
112  return 1;
113 
114  return myitem1->GetFileName().CmpNoCase( myitem2->GetFileName() );
115 }
bool IsRootFile() const
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: