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 ()
 
void LoadIcons ()
 

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 44 of file project_tree.cpp.

44 :
45 wxTreeCtrl( parent, ID_PROJECT_TREE, wxDefaultPosition, wxDefaultSize,
46 PLATFORM_STYLE | wxTR_HAS_BUTTONS | wxTR_MULTIPLE, wxDefaultValidator,
47 wxT( "EDATreeCtrl" ) ),
48 m_imageList( nullptr )
49{
50 m_projectTreePane = parent;
51
52 // Make sure the GUI font scales properly on GTK
53 SetFont( KIUI::GetControlFont( this ) );
54
55 LoadIcons();
56}
PROJECT_TREE_PANE * m_projectTreePane
Definition: project_tree.h:43
void LoadIcons()
wxImageList * m_imageList
Definition: project_tree.h:44
@ ID_PROJECT_TREE
Definition: kicad_id.h:58
wxFont GetControlFont(wxWindow *aWindow)
Definition: ui_common.cpp:150
#define PLATFORM_STYLE

References KIUI::GetControlFont(), LoadIcons(), and m_projectTreePane.

◆ ~PROJECT_TREE()

PROJECT_TREE::~PROJECT_TREE ( )

Definition at line 59 of file project_tree.cpp.

60{
61 delete m_imageList;
62}

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; }

References m_projectTreePane.

◆ LoadIcons()

void PROJECT_TREE::LoadIcons ( )

Definition at line 65 of file project_tree.cpp.

66{
67 delete m_imageList;
68
69 // icons size is not know (depending on they are built)
70 // so get it:
71 wxSize iconsize;
73 iconsize.x = dummy.GetWidth();
74 iconsize.y = dummy.GetHeight();
75
76 // Make an image list containing small icons
77 m_imageList = new wxImageList( iconsize.x, iconsize.y, true,
78 static_cast<int>( TREE_FILE_TYPE::MAX ) );
79
80 m_imageList->Add( KiBitmap( BITMAPS::project ) ); // TREE_LEGACY_PROJECT
81 m_imageList->Add( KiBitmap( BITMAPS::project_kicad ) ); // TREE_JSON_PROJECT
82 m_imageList->Add( KiBitmap( BITMAPS::icon_eeschema_24 ) ); // TREE_LEGACY_SCHEMATIC
83 m_imageList->Add( KiBitmap( BITMAPS::icon_eeschema_24 ) ); // TREE_SEXPR_SCHEMATIC
84 m_imageList->Add( KiBitmap( BITMAPS::icon_pcbnew_24 ) ); // TREE_LEGACY_PCB
85 m_imageList->Add( KiBitmap( BITMAPS::icon_pcbnew_24 ) ); // TREE_SEXPR_PCB
86 m_imageList->Add( KiBitmap( BITMAPS::icon_gerbview_24 ) ); // TREE_GERBER
87 m_imageList->Add( KiBitmap( BITMAPS::file_gerber_job ) ); // TREE_GERBER_JOB_FILE (.gbrjob)
88 m_imageList->Add( KiBitmap( BITMAPS::file_html ) ); // TREE_HTML
89 m_imageList->Add( KiBitmap( BITMAPS::file_pdf ) ); // TREE_PDF
90 m_imageList->Add( KiBitmap( BITMAPS::editor ) ); // TREE_TXT
91 m_imageList->Add( KiBitmap( BITMAPS::editor ) ); // TREE_MD
92 m_imageList->Add( KiBitmap( BITMAPS::netlist ) ); // TREE_NET
93 m_imageList->Add( KiBitmap( BITMAPS::unknown ) ); // TREE_UNKNOWN
94 m_imageList->Add( KiBitmap( BITMAPS::directory ) ); // TREE_DIRECTORY
95 m_imageList->Add( KiBitmap( BITMAPS::icon_cvpcb_24 ) ); // TREE_CMP_LINK
96 m_imageList->Add( KiBitmap( BITMAPS::tools ) ); // TREE_REPORT
97 m_imageList->Add( KiBitmap( BITMAPS::file_pos ) ); // TREE_POS
98 m_imageList->Add( KiBitmap( BITMAPS::file_drl ) ); // TREE_DRILL
99 m_imageList->Add( KiBitmap( BITMAPS::file_drl ) ); // TREE_DRILL_NC (similar TREE_DRILL)
100 m_imageList->Add( KiBitmap( BITMAPS::file_drl ) ); // TREE_DRILL_XNC (similar TREE_DRILL)
101 m_imageList->Add( KiBitmap( BITMAPS::file_svg ) ); // TREE_SVG
102 m_imageList->Add( KiBitmap( BITMAPS::icon_pagelayout_editor_24 ) ); // TREE_PAGE_LAYOUT_DESCR
103 m_imageList->Add( KiBitmap( BITMAPS::module ) ); // TREE_FOOTPRINT_FILE
104 m_imageList->Add( KiBitmap( BITMAPS::library ) ); // TREE_SCHEMATIC_LIBFILE
105 m_imageList->Add( KiBitmap( BITMAPS::library ) ); // TREE_SEXPR_SYMBOL_LIB_FILE
106 m_imageList->Add( KiBitmap( BITMAPS::editor ) ); // DESIGN_RULES
107 m_imageList->Add( KiBitmap( BITMAPS::zip ) ); // ZIP_ARCHIVE
108
109 SetImageList( m_imageList );
110}
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:105
@ icon_pcbnew_24
@ icon_eeschema_24
@ icon_pagelayout_editor_24
@ file_gerber_job
@ project_kicad
@ icon_cvpcb_24
@ icon_gerbview_24
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74

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, MAX, module, netlist, project, project_kicad, tools, unknown, and zip.

Referenced by PROJECT_TREE_PANE::onThemeChanged(), and PROJECT_TREE().

◆ OnCompareItems()

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

Definition at line 113 of file project_tree.cpp.

114{
115 PROJECT_TREE_ITEM* myitem1 = (PROJECT_TREE_ITEM*) GetItemData( item1 );
116 PROJECT_TREE_ITEM* myitem2 = (PROJECT_TREE_ITEM*) GetItemData( item2 );
117
118 if( !myitem1 || !myitem2 )
119 return 0;
120
121 if( myitem1->GetType() == TREE_FILE_TYPE::DIRECTORY
122 && myitem2->GetType() != TREE_FILE_TYPE::DIRECTORY )
123 return -1;
124
125 if( myitem2->GetType() == TREE_FILE_TYPE::DIRECTORY
126 && myitem1->GetType() != TREE_FILE_TYPE::DIRECTORY )
127 return 1;
128
129 if( myitem1->IsRootFile() && !myitem2->IsRootFile() )
130 return -1;
131
132 if( myitem2->IsRootFile() && !myitem1->IsRootFile() )
133 return 1;
134
135 return myitem1->GetFileName().CmpNoCase( myitem2->GetFileName() );
136}
Handle one item (a file or a directory name) for the tree file.
const wxString & GetFileName() const
TREE_FILE_TYPE GetType() const
bool IsRootFile() const

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 LoadIcons(), 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: