Loading kicad/CMakeLists.txt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ) ) set(KICAD_SRCS set(KICAD_SRCS class_treeprojectfiles.cpp commandframe.cpp commandframe.cpp files-io.cpp files-io.cpp kicad.cpp kicad.cpp Loading @@ -13,8 +14,7 @@ set(KICAD_SRCS menubar.cpp menubar.cpp preferences.cpp preferences.cpp prjconfig.cpp prjconfig.cpp treeprj_datas.cpp tree_project_frame.cpp) treeprj_frame.cpp) if(WIN32) if(WIN32) if(MINGW) if(MINGW) Loading kicad/treeprj_datas.cpp→kicad/class_treeprojectfiles.cpp +13 −11 Original line number Original line Diff line number Diff line /***************/ /* /* treeprj.cpp */ * file class_treeprojectfiles.cpp /***************/ */ #ifdef KICAD_PYTHON #ifdef KICAD_PYTHON #include <pyhandler.h> #include <pyhandler.h> Loading @@ -14,6 +14,8 @@ #include "bitmaps.h" #include "bitmaps.h" #include "kicad.h" #include "kicad.h" #include "tree_project_frame.h" #include "class_treeprojectfiles.h" #include "wx/image.h" #include "wx/image.h" #include "wx/imaglist.h" #include "wx/imaglist.h" Loading @@ -22,10 +24,10 @@ #include "wx/dir.h" #include "wx/dir.h" IMPLEMENT_ABSTRACT_CLASS( WinEDA_TreePrj, wxTreeCtrl ) IMPLEMENT_ABSTRACT_CLASS( TREEPROJECTFILES, wxTreeCtrl ) WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) : TREEPROJECTFILES::TREEPROJECTFILES( TREE_PROJECT_FRAME* parent ) : wxTreeCtrl( parent, ID_PROJECT_TREE, wxTreeCtrl( parent, ID_PROJECT_TREE, wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator, Loading @@ -51,7 +53,7 @@ WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) : } } WinEDA_TreePrj::~WinEDA_TreePrj() TREEPROJECTFILES::~TREEPROJECTFILES() { { if( m_ImageList ) if( m_ImageList ) delete m_ImageList; delete m_ImageList; Loading @@ -64,7 +66,7 @@ WinEDA_TreePrj::~WinEDA_TreePrj() * root file names after * root file names after * file names last by alphabetic order * file names last by alphabetic order */ */ int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) int TREEPROJECTFILES::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) { { TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 ); TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 ); TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 ); TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 ); Loading Loading @@ -235,7 +237,7 @@ void TreePrjItemData::Move( TreePrjItemData* dest ) // We should move recursively all files, but that's quite boring // We should move recursively all files, but that's quite boring // let's just refresh that's all ... TODO (change this to a better code ...) // let's just refresh that's all ... TODO (change this to a better code ...) wxCommandEvent dummy; wxCommandEvent dummy; dynamic_cast<WinEDA_TreePrj*>( m_Parent )->GetParent()->m_Parent->OnRefresh( dummy ); dynamic_cast<TREEPROJECTFILES*>( m_Parent )->GetParent()->m_Parent->OnRefresh( dummy ); } } } } Loading @@ -262,7 +264,7 @@ bool TreePrjItemData::Rename( const wxString& name, bool check ) if( newFile == m_FileName ) if( newFile == m_FileName ) return false; return false; wxString ext = WinEDA_PrjFrame::GetFileExt( GetType() ); wxString ext = TREE_PROJECT_FRAME::GetFileExt( GetType() ); wxRegEx reg( wxT ( "^.*\\" ) + ext + wxT( "$" ), wxRE_ICASE ); wxRegEx reg( wxT ( "^.*\\" ) + ext + wxT( "$" ), wxRE_ICASE ); Loading Loading @@ -339,7 +341,7 @@ bool TreePrjItemData::Delete( bool check ) /* Called under item activation */ /* Called under item activation */ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) void TreePrjItemData::Activate( TREE_PROJECT_FRAME* prjframe ) { { wxString sep = wxFileName().GetPathSeparator(); wxString sep = wxFileName().GetPathSeparator(); wxString FullFileName = GetFileName(); wxString FullFileName = GetFileName(); Loading Loading @@ -434,7 +436,7 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) } } TreePrjItemData* WinEDA_PrjFrame::GetSelectedData() TreePrjItemData* TREE_PROJECT_FRAME::GetSelectedData() { { return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) ); return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) ); } } kicad/kicad-python.cpp +27 −27 Original line number Original line Diff line number Diff line Loading @@ -57,7 +57,7 @@ static void WinEDAClear() static object GetTypeExt( enum TreeFileType type ) static object GetTypeExt( enum TreeFileType type ) { { return PyHandler::Convert( WinEDA_PrjFrame::GetFileExt( type ) ); return PyHandler::Convert( TREE_PROJECT_FRAME::GetFileExt( type ) ); } } Loading @@ -78,7 +78,7 @@ object WinEDA_MainFrame::ToWx() } } WinEDA_PrjFrame* WinEDA_MainFrame::GetTree() const TREE_PROJECT_FRAME* WinEDA_MainFrame::GetTree() const { { return m_LeftWin; return m_LeftWin; } } Loading Loading @@ -107,36 +107,36 @@ void WinEDA_MainFrame::AddFastLaunchPy( object& button ) /*****************************************************************************/ /*****************************************************************************/ // WinEDA_PrjFrame Special binding functions: // TREE_PROJECT_FRAME Special binding functions: // (one line functions are simple wrappers) // (one line functions are simple wrappers) /*****************************************************************************/ /*****************************************************************************/ // TODO To WxWidgets ? // TODO To WxWidgets ? object WinEDA_PrjFrame::ToWx() object TREE_PROJECT_FRAME::ToWx() { { return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); } } // TODO Get ? // TODO Get ? object WinEDA_PrjFrame::GetFtExPy( enum TreeFileType type ) const object TREE_PROJECT_FRAME::GetFtExPy( enum TreeFileType type ) const { { return PyHandler::Convert( GetFileExt( type ) ); return PyHandler::Convert( GetFileExt( type ) ); } } // Get python menu // Get python menu object WinEDA_PrjFrame::GetMenuPy( enum TreeFileType type ) object TREE_PROJECT_FRAME::GetMenuPy( enum TreeFileType type ) { { return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) ); } } // Get tree control // Get tree control object WinEDA_PrjFrame::GetTreeCtrl() object TREE_PROJECT_FRAME::GetTreeCtrl() { { return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) ); } } // Get current menu // Get current menu object WinEDA_PrjFrame::GetCurrentMenu() object TREE_PROJECT_FRAME::GetCurrentMenu() { { return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); } } Loading @@ -146,7 +146,7 @@ object WinEDA_PrjFrame::GetCurrentMenu() * @brief TODO * @brief TODO */ */ /*****************************************************************************/ /*****************************************************************************/ void WinEDA_PrjFrame::NewFilePy( const str& name, void TREE_PROJECT_FRAME::NewFilePy( const str& name, enum TreeFileType type, enum TreeFileType type, object& id ) object& id ) /*****************************************************************************/ /*****************************************************************************/ Loading @@ -163,7 +163,7 @@ void WinEDA_PrjFrame::NewFilePy( const str& name, * @brief Add a file to the tree under root, or m_root if conversion is wrong * @brief Add a file to the tree under root, or m_root if conversion is wrong */ */ /*****************************************************************************/ /*****************************************************************************/ void WinEDA_PrjFrame::AddFilePy( const str& file, object& root ) void TREE_PROJECT_FRAME::AddFilePy( const str& file, object& root ) /*****************************************************************************/ /*****************************************************************************/ { { wxTreeItemId* theroot = &m_root; wxTreeItemId* theroot = &m_root; Loading @@ -181,7 +181,7 @@ void WinEDA_PrjFrame::AddFilePy( const str& file, object& root ) * @brief convert wxTreeItem into TreePrjItemData * @brief convert wxTreeItem into TreePrjItemData */ */ /*****************************************************************************/ /*****************************************************************************/ TreePrjItemData* WinEDA_PrjFrame::GetItemData( const object& item ) TreePrjItemData* TREE_PROJECT_FRAME::GetItemData( const object& item ) /*****************************************************************************/ /*****************************************************************************/ { { wxTreeItemId* id = NULL; wxTreeItemId* id = NULL; Loading Loading @@ -269,53 +269,53 @@ static void py_kicad_init() .value( "MAX", TREE_MAX ); .value( "MAX", TREE_MAX ); class_<WinEDA_PrjFrame>( "TreeWindow" ) class_<TREE_PROJECT_FRAME>( "TreeWindow" ) // wx Interface // wx Interface .def( "ToWx", &WinEDA_PrjFrame::ToWx ) .def( "ToWx", &TREE_PROJECT_FRAME::ToWx ) // common features // common features .def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy ) .def( "GetContextMenu", &TREE_PROJECT_FRAME::GetMenuPy ) .def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy ) .def( "GetFileExtension", &TREE_PROJECT_FRAME::GetFtExPy ) // file filters control // file filters control .def( "AddFilter", &WinEDA_PrjFrame::AddFilter ) .def( "AddFilter", &TREE_PROJECT_FRAME::AddFilter ) .def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters ) .def( "ClearFilters", &TREE_PROJECT_FRAME::ClearFilters ) .def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy ) .def( "RemoveFilter", &TREE_PROJECT_FRAME::RemoveFilterPy ) .def( "GetFilters", &WinEDA_PrjFrame::GetFilters, .def( "GetFilters", &TREE_PROJECT_FRAME::GetFilters, return_value_policy < copy_const_reference >() ) return_value_policy < copy_const_reference >() ) .def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu ) .def( "GetCurrentMenu", &TREE_PROJECT_FRAME::GetCurrentMenu ) /** Project tree control **/ /** Project tree control **/ // AddState // AddState .def( "AddState", .def( "AddState", &WinEDA_PrjFrame::AddStatePy ) &TREE_PROJECT_FRAME::AddStatePy ) // GetTreeCtrl // GetTreeCtrl .def( "GetTreeCtrl", .def( "GetTreeCtrl", &WinEDA_PrjFrame::GetTreeCtrl ) &TREE_PROJECT_FRAME::GetTreeCtrl ) // GetItemData // GetItemData .def( "GetItemData", .def( "GetItemData", &WinEDA_PrjFrame::GetItemData, &TREE_PROJECT_FRAME::GetItemData, return_value_policy < reference_existing_object >() ) return_value_policy < reference_existing_object >() ) // FindItemData // FindItemData .def( "FindItemData", .def( "FindItemData", &WinEDA_PrjFrame::FindItemData, &TREE_PROJECT_FRAME::FindItemData, return_value_policy < reference_existing_object >() ) return_value_policy < reference_existing_object >() ) // NewFile // NewFile .def( "NewFile", .def( "NewFile", &WinEDA_PrjFrame::NewFilePy ) &TREE_PROJECT_FRAME::NewFilePy ) // AddFile // AddFile .def( "AddFile", .def( "AddFile", &WinEDA_PrjFrame::AddFilePy ) &TREE_PROJECT_FRAME::AddFilePy ) ; /* ENDOF class_<WinEDA_PrjFrame>( "TreeWindow" ) */ ; /* ENDOF class_<TREE_PROJECT_FRAME>( "TreeWindow" ) */ class_<WinEDA_MainFrame>( "MainFrame" ) class_<WinEDA_MainFrame>( "MainFrame" ) Loading kicad/kicad.cpp +2 −6 Original line number Original line Diff line number Diff line Loading @@ -6,11 +6,6 @@ */ */ /*****************************************************************************/ /*****************************************************************************/ #ifdef __GNUG__ #pragma implementation #endif #include "fctsys.h" #include "fctsys.h" #include "appl_wxstruct.h" #include "appl_wxstruct.h" #include "common.h" #include "common.h" Loading @@ -24,6 +19,7 @@ #endif #endif #include "kicad.h" #include "kicad.h" #include "tree_project_frame.h" #include "macros.h" #include "macros.h" #include "build_version.h" #include "build_version.h" Loading kicad/kicad.h +5 −133 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,8 @@ #include "appl_wxstruct.h" #include "appl_wxstruct.h" class RIGHT_KM_FRAME; class RIGHT_KM_FRAME; class WinEDA_TreePrj; class TREEPROJECTFILES; class WinEDA_PrjFrame; class TREE_PROJECT_FRAME; /** /** Loading Loading @@ -67,7 +67,7 @@ class WinEDA_MainFrame : public WinEDA_BasicFrame { { /* This class is the main entry point of the py API */ /* This class is the main entry point of the py API */ public: public: WinEDA_PrjFrame* m_LeftWin; TREE_PROJECT_FRAME* m_LeftWin; RIGHT_KM_FRAME* m_RightWin; RIGHT_KM_FRAME* m_RightWin; WinEDA_Toolbar* m_VToolBar; // Vertical toolbar (not used) WinEDA_Toolbar* m_VToolBar; // Vertical toolbar (not used) wxString m_BoardFileName; wxString m_BoardFileName; Loading Loading @@ -140,7 +140,7 @@ public: boost::python::object ToWx(); boost::python::object ToWx(); void AddFastLaunchPy( boost::python::object& button ); void AddFastLaunchPy( boost::python::object& button ); WinEDA_PrjFrame* GetTree() const; TREE_PROJECT_FRAME* GetTree() const; #endif #endif Loading Loading @@ -247,7 +247,7 @@ public: bool Rename( const wxString& name, bool check = true ); bool Rename( const wxString& name, bool check = true ); bool Delete( bool check = true ); bool Delete( bool check = true ); void Move( TreePrjItemData* dest ); void Move( TreePrjItemData* dest ); void Activate( WinEDA_PrjFrame* prjframe ); void Activate( TREE_PROJECT_FRAME* prjframe ); const wxMenu* GetMenu() const wxMenu* GetMenu() { { Loading @@ -271,132 +271,4 @@ public: #endif #endif }; }; /** class WinEDA_PrjFrame * Window to display the tree files */ class WinEDA_PrjFrame : public wxSashLayoutWindow { private: std::vector<wxMenu*> m_ContextMenus; std::vector<wxString> m_Filters; wxMenu* m_PopupMenu; wxCursor m_DragCursor; wxCursor m_Default; protected: wxMenu* GetContextMenu( int type ); void NewFile( TreeFileType type ); void NewFile( const wxString& name, TreeFileType type, wxTreeItemId& root ); TreePrjItemData* GetSelectedData(); public: WinEDA_MainFrame* m_Parent; WinEDA_TreePrj* m_TreeProject; wxTreeItemId m_root; public: static wxString GetFileExt( TreeFileType type ); static wxString GetFileWildcard( TreeFileType type ); WinEDA_PrjFrame( WinEDA_MainFrame* parent ); ~WinEDA_PrjFrame(); void OnSelect( wxTreeEvent& Event ); void OnRenameAsk( wxTreeEvent& Event ); void OnRename( wxTreeEvent& Event ); void OnDragStart( wxTreeEvent& event ); void OnDragEnd( wxTreeEvent& event ); void OnRight( wxTreeEvent& Event ); void ReCreateTreePrj(); void OnTxtEdit( wxCommandEvent& event ); void OnDeleteFile( wxCommandEvent& event ); void OnRenameFile( wxCommandEvent& event ); void OnNewFile( wxCommandEvent& event ); void OnNewDirectory( wxCommandEvent& event ); void OnNewSchFile( wxCommandEvent& event ); void OnNewBrdFile( wxCommandEvent& event ); void OnNewPyFile( wxCommandEvent& event ); void OnNewGerberFile( wxCommandEvent& event ); void OnNewTxtFile( wxCommandEvent& event ); void OnNewNetFile( wxCommandEvent& event ); void ClearFilters(); const std::vector<wxString>& GetFilters(); void RemoveFilter( const wxString& filter ); #ifdef KICAD_PYTHON boost::python::object ToWx(); WinEDA_PrjFrame() { } WinEDA_PrjFrame( const WinEDA_PrjFrame& ) { } void OnRunPy( wxCommandEvent& event ); boost::python::object GetMenuPy( TreeFileType ); boost::python::object GetFtExPy( TreeFileType ) const; void RemoveFilterPy( const boost::python::str& filter ); void AddFilter( const boost::python::str& filter ); boost::python::object GetTreeCtrl(); TreePrjItemData* GetItemData( const boost::python::object& item ); void AddFilePy( const boost::python::str& name, boost::python::object& root ); void NewFilePy( const boost::python::str& name, TreeFileType type, boost::python::object& root ); TreePrjItemData* FindItemData( const boost::python::str& name ); boost::python::object GetCurrentMenu(); int AddStatePy( boost::python::object& bitmap ); #endif bool AddFile( const wxString& name, wxTreeItemId& root ); DECLARE_EVENT_TABLE() }; /** Class TreeCtrl * This is the class to show (as a tree) the files in the project directory */ class WinEDA_TreePrj : public wxTreeCtrl { DECLARE_DYNAMIC_CLASS( WinEDA_TreePrj ) private: WinEDA_PrjFrame* m_Parent; wxImageList* m_ImageList; public: WinEDA_PrjFrame* GetParent() { return m_Parent; } WinEDA_TreePrj( WinEDA_PrjFrame* parent ); ~WinEDA_TreePrj(); private: /* overridden sort function */ int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ); }; #endif #endif Loading
kicad/CMakeLists.txt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ) ) set(KICAD_SRCS set(KICAD_SRCS class_treeprojectfiles.cpp commandframe.cpp commandframe.cpp files-io.cpp files-io.cpp kicad.cpp kicad.cpp Loading @@ -13,8 +14,7 @@ set(KICAD_SRCS menubar.cpp menubar.cpp preferences.cpp preferences.cpp prjconfig.cpp prjconfig.cpp treeprj_datas.cpp tree_project_frame.cpp) treeprj_frame.cpp) if(WIN32) if(WIN32) if(MINGW) if(MINGW) Loading
kicad/treeprj_datas.cpp→kicad/class_treeprojectfiles.cpp +13 −11 Original line number Original line Diff line number Diff line /***************/ /* /* treeprj.cpp */ * file class_treeprojectfiles.cpp /***************/ */ #ifdef KICAD_PYTHON #ifdef KICAD_PYTHON #include <pyhandler.h> #include <pyhandler.h> Loading @@ -14,6 +14,8 @@ #include "bitmaps.h" #include "bitmaps.h" #include "kicad.h" #include "kicad.h" #include "tree_project_frame.h" #include "class_treeprojectfiles.h" #include "wx/image.h" #include "wx/image.h" #include "wx/imaglist.h" #include "wx/imaglist.h" Loading @@ -22,10 +24,10 @@ #include "wx/dir.h" #include "wx/dir.h" IMPLEMENT_ABSTRACT_CLASS( WinEDA_TreePrj, wxTreeCtrl ) IMPLEMENT_ABSTRACT_CLASS( TREEPROJECTFILES, wxTreeCtrl ) WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) : TREEPROJECTFILES::TREEPROJECTFILES( TREE_PROJECT_FRAME* parent ) : wxTreeCtrl( parent, ID_PROJECT_TREE, wxTreeCtrl( parent, ID_PROJECT_TREE, wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator, wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator, Loading @@ -51,7 +53,7 @@ WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) : } } WinEDA_TreePrj::~WinEDA_TreePrj() TREEPROJECTFILES::~TREEPROJECTFILES() { { if( m_ImageList ) if( m_ImageList ) delete m_ImageList; delete m_ImageList; Loading @@ -64,7 +66,7 @@ WinEDA_TreePrj::~WinEDA_TreePrj() * root file names after * root file names after * file names last by alphabetic order * file names last by alphabetic order */ */ int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) int TREEPROJECTFILES::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) { { TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 ); TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 ); TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 ); TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 ); Loading Loading @@ -235,7 +237,7 @@ void TreePrjItemData::Move( TreePrjItemData* dest ) // We should move recursively all files, but that's quite boring // We should move recursively all files, but that's quite boring // let's just refresh that's all ... TODO (change this to a better code ...) // let's just refresh that's all ... TODO (change this to a better code ...) wxCommandEvent dummy; wxCommandEvent dummy; dynamic_cast<WinEDA_TreePrj*>( m_Parent )->GetParent()->m_Parent->OnRefresh( dummy ); dynamic_cast<TREEPROJECTFILES*>( m_Parent )->GetParent()->m_Parent->OnRefresh( dummy ); } } } } Loading @@ -262,7 +264,7 @@ bool TreePrjItemData::Rename( const wxString& name, bool check ) if( newFile == m_FileName ) if( newFile == m_FileName ) return false; return false; wxString ext = WinEDA_PrjFrame::GetFileExt( GetType() ); wxString ext = TREE_PROJECT_FRAME::GetFileExt( GetType() ); wxRegEx reg( wxT ( "^.*\\" ) + ext + wxT( "$" ), wxRE_ICASE ); wxRegEx reg( wxT ( "^.*\\" ) + ext + wxT( "$" ), wxRE_ICASE ); Loading Loading @@ -339,7 +341,7 @@ bool TreePrjItemData::Delete( bool check ) /* Called under item activation */ /* Called under item activation */ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) void TreePrjItemData::Activate( TREE_PROJECT_FRAME* prjframe ) { { wxString sep = wxFileName().GetPathSeparator(); wxString sep = wxFileName().GetPathSeparator(); wxString FullFileName = GetFileName(); wxString FullFileName = GetFileName(); Loading Loading @@ -434,7 +436,7 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) } } TreePrjItemData* WinEDA_PrjFrame::GetSelectedData() TreePrjItemData* TREE_PROJECT_FRAME::GetSelectedData() { { return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) ); return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) ); } }
kicad/kicad-python.cpp +27 −27 Original line number Original line Diff line number Diff line Loading @@ -57,7 +57,7 @@ static void WinEDAClear() static object GetTypeExt( enum TreeFileType type ) static object GetTypeExt( enum TreeFileType type ) { { return PyHandler::Convert( WinEDA_PrjFrame::GetFileExt( type ) ); return PyHandler::Convert( TREE_PROJECT_FRAME::GetFileExt( type ) ); } } Loading @@ -78,7 +78,7 @@ object WinEDA_MainFrame::ToWx() } } WinEDA_PrjFrame* WinEDA_MainFrame::GetTree() const TREE_PROJECT_FRAME* WinEDA_MainFrame::GetTree() const { { return m_LeftWin; return m_LeftWin; } } Loading Loading @@ -107,36 +107,36 @@ void WinEDA_MainFrame::AddFastLaunchPy( object& button ) /*****************************************************************************/ /*****************************************************************************/ // WinEDA_PrjFrame Special binding functions: // TREE_PROJECT_FRAME Special binding functions: // (one line functions are simple wrappers) // (one line functions are simple wrappers) /*****************************************************************************/ /*****************************************************************************/ // TODO To WxWidgets ? // TODO To WxWidgets ? object WinEDA_PrjFrame::ToWx() object TREE_PROJECT_FRAME::ToWx() { { return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) ); } } // TODO Get ? // TODO Get ? object WinEDA_PrjFrame::GetFtExPy( enum TreeFileType type ) const object TREE_PROJECT_FRAME::GetFtExPy( enum TreeFileType type ) const { { return PyHandler::Convert( GetFileExt( type ) ); return PyHandler::Convert( GetFileExt( type ) ); } } // Get python menu // Get python menu object WinEDA_PrjFrame::GetMenuPy( enum TreeFileType type ) object TREE_PROJECT_FRAME::GetMenuPy( enum TreeFileType type ) { { return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) ); } } // Get tree control // Get tree control object WinEDA_PrjFrame::GetTreeCtrl() object TREE_PROJECT_FRAME::GetTreeCtrl() { { return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) ); } } // Get current menu // Get current menu object WinEDA_PrjFrame::GetCurrentMenu() object TREE_PROJECT_FRAME::GetCurrentMenu() { { return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) ); } } Loading @@ -146,7 +146,7 @@ object WinEDA_PrjFrame::GetCurrentMenu() * @brief TODO * @brief TODO */ */ /*****************************************************************************/ /*****************************************************************************/ void WinEDA_PrjFrame::NewFilePy( const str& name, void TREE_PROJECT_FRAME::NewFilePy( const str& name, enum TreeFileType type, enum TreeFileType type, object& id ) object& id ) /*****************************************************************************/ /*****************************************************************************/ Loading @@ -163,7 +163,7 @@ void WinEDA_PrjFrame::NewFilePy( const str& name, * @brief Add a file to the tree under root, or m_root if conversion is wrong * @brief Add a file to the tree under root, or m_root if conversion is wrong */ */ /*****************************************************************************/ /*****************************************************************************/ void WinEDA_PrjFrame::AddFilePy( const str& file, object& root ) void TREE_PROJECT_FRAME::AddFilePy( const str& file, object& root ) /*****************************************************************************/ /*****************************************************************************/ { { wxTreeItemId* theroot = &m_root; wxTreeItemId* theroot = &m_root; Loading @@ -181,7 +181,7 @@ void WinEDA_PrjFrame::AddFilePy( const str& file, object& root ) * @brief convert wxTreeItem into TreePrjItemData * @brief convert wxTreeItem into TreePrjItemData */ */ /*****************************************************************************/ /*****************************************************************************/ TreePrjItemData* WinEDA_PrjFrame::GetItemData( const object& item ) TreePrjItemData* TREE_PROJECT_FRAME::GetItemData( const object& item ) /*****************************************************************************/ /*****************************************************************************/ { { wxTreeItemId* id = NULL; wxTreeItemId* id = NULL; Loading Loading @@ -269,53 +269,53 @@ static void py_kicad_init() .value( "MAX", TREE_MAX ); .value( "MAX", TREE_MAX ); class_<WinEDA_PrjFrame>( "TreeWindow" ) class_<TREE_PROJECT_FRAME>( "TreeWindow" ) // wx Interface // wx Interface .def( "ToWx", &WinEDA_PrjFrame::ToWx ) .def( "ToWx", &TREE_PROJECT_FRAME::ToWx ) // common features // common features .def( "GetContextMenu", &WinEDA_PrjFrame::GetMenuPy ) .def( "GetContextMenu", &TREE_PROJECT_FRAME::GetMenuPy ) .def( "GetFileExtension", &WinEDA_PrjFrame::GetFtExPy ) .def( "GetFileExtension", &TREE_PROJECT_FRAME::GetFtExPy ) // file filters control // file filters control .def( "AddFilter", &WinEDA_PrjFrame::AddFilter ) .def( "AddFilter", &TREE_PROJECT_FRAME::AddFilter ) .def( "ClearFilters", &WinEDA_PrjFrame::ClearFilters ) .def( "ClearFilters", &TREE_PROJECT_FRAME::ClearFilters ) .def( "RemoveFilter", &WinEDA_PrjFrame::RemoveFilterPy ) .def( "RemoveFilter", &TREE_PROJECT_FRAME::RemoveFilterPy ) .def( "GetFilters", &WinEDA_PrjFrame::GetFilters, .def( "GetFilters", &TREE_PROJECT_FRAME::GetFilters, return_value_policy < copy_const_reference >() ) return_value_policy < copy_const_reference >() ) .def( "GetCurrentMenu", &WinEDA_PrjFrame::GetCurrentMenu ) .def( "GetCurrentMenu", &TREE_PROJECT_FRAME::GetCurrentMenu ) /** Project tree control **/ /** Project tree control **/ // AddState // AddState .def( "AddState", .def( "AddState", &WinEDA_PrjFrame::AddStatePy ) &TREE_PROJECT_FRAME::AddStatePy ) // GetTreeCtrl // GetTreeCtrl .def( "GetTreeCtrl", .def( "GetTreeCtrl", &WinEDA_PrjFrame::GetTreeCtrl ) &TREE_PROJECT_FRAME::GetTreeCtrl ) // GetItemData // GetItemData .def( "GetItemData", .def( "GetItemData", &WinEDA_PrjFrame::GetItemData, &TREE_PROJECT_FRAME::GetItemData, return_value_policy < reference_existing_object >() ) return_value_policy < reference_existing_object >() ) // FindItemData // FindItemData .def( "FindItemData", .def( "FindItemData", &WinEDA_PrjFrame::FindItemData, &TREE_PROJECT_FRAME::FindItemData, return_value_policy < reference_existing_object >() ) return_value_policy < reference_existing_object >() ) // NewFile // NewFile .def( "NewFile", .def( "NewFile", &WinEDA_PrjFrame::NewFilePy ) &TREE_PROJECT_FRAME::NewFilePy ) // AddFile // AddFile .def( "AddFile", .def( "AddFile", &WinEDA_PrjFrame::AddFilePy ) &TREE_PROJECT_FRAME::AddFilePy ) ; /* ENDOF class_<WinEDA_PrjFrame>( "TreeWindow" ) */ ; /* ENDOF class_<TREE_PROJECT_FRAME>( "TreeWindow" ) */ class_<WinEDA_MainFrame>( "MainFrame" ) class_<WinEDA_MainFrame>( "MainFrame" ) Loading
kicad/kicad.cpp +2 −6 Original line number Original line Diff line number Diff line Loading @@ -6,11 +6,6 @@ */ */ /*****************************************************************************/ /*****************************************************************************/ #ifdef __GNUG__ #pragma implementation #endif #include "fctsys.h" #include "fctsys.h" #include "appl_wxstruct.h" #include "appl_wxstruct.h" #include "common.h" #include "common.h" Loading @@ -24,6 +19,7 @@ #endif #endif #include "kicad.h" #include "kicad.h" #include "tree_project_frame.h" #include "macros.h" #include "macros.h" #include "build_version.h" #include "build_version.h" Loading
kicad/kicad.h +5 −133 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,8 @@ #include "appl_wxstruct.h" #include "appl_wxstruct.h" class RIGHT_KM_FRAME; class RIGHT_KM_FRAME; class WinEDA_TreePrj; class TREEPROJECTFILES; class WinEDA_PrjFrame; class TREE_PROJECT_FRAME; /** /** Loading Loading @@ -67,7 +67,7 @@ class WinEDA_MainFrame : public WinEDA_BasicFrame { { /* This class is the main entry point of the py API */ /* This class is the main entry point of the py API */ public: public: WinEDA_PrjFrame* m_LeftWin; TREE_PROJECT_FRAME* m_LeftWin; RIGHT_KM_FRAME* m_RightWin; RIGHT_KM_FRAME* m_RightWin; WinEDA_Toolbar* m_VToolBar; // Vertical toolbar (not used) WinEDA_Toolbar* m_VToolBar; // Vertical toolbar (not used) wxString m_BoardFileName; wxString m_BoardFileName; Loading Loading @@ -140,7 +140,7 @@ public: boost::python::object ToWx(); boost::python::object ToWx(); void AddFastLaunchPy( boost::python::object& button ); void AddFastLaunchPy( boost::python::object& button ); WinEDA_PrjFrame* GetTree() const; TREE_PROJECT_FRAME* GetTree() const; #endif #endif Loading Loading @@ -247,7 +247,7 @@ public: bool Rename( const wxString& name, bool check = true ); bool Rename( const wxString& name, bool check = true ); bool Delete( bool check = true ); bool Delete( bool check = true ); void Move( TreePrjItemData* dest ); void Move( TreePrjItemData* dest ); void Activate( WinEDA_PrjFrame* prjframe ); void Activate( TREE_PROJECT_FRAME* prjframe ); const wxMenu* GetMenu() const wxMenu* GetMenu() { { Loading @@ -271,132 +271,4 @@ public: #endif #endif }; }; /** class WinEDA_PrjFrame * Window to display the tree files */ class WinEDA_PrjFrame : public wxSashLayoutWindow { private: std::vector<wxMenu*> m_ContextMenus; std::vector<wxString> m_Filters; wxMenu* m_PopupMenu; wxCursor m_DragCursor; wxCursor m_Default; protected: wxMenu* GetContextMenu( int type ); void NewFile( TreeFileType type ); void NewFile( const wxString& name, TreeFileType type, wxTreeItemId& root ); TreePrjItemData* GetSelectedData(); public: WinEDA_MainFrame* m_Parent; WinEDA_TreePrj* m_TreeProject; wxTreeItemId m_root; public: static wxString GetFileExt( TreeFileType type ); static wxString GetFileWildcard( TreeFileType type ); WinEDA_PrjFrame( WinEDA_MainFrame* parent ); ~WinEDA_PrjFrame(); void OnSelect( wxTreeEvent& Event ); void OnRenameAsk( wxTreeEvent& Event ); void OnRename( wxTreeEvent& Event ); void OnDragStart( wxTreeEvent& event ); void OnDragEnd( wxTreeEvent& event ); void OnRight( wxTreeEvent& Event ); void ReCreateTreePrj(); void OnTxtEdit( wxCommandEvent& event ); void OnDeleteFile( wxCommandEvent& event ); void OnRenameFile( wxCommandEvent& event ); void OnNewFile( wxCommandEvent& event ); void OnNewDirectory( wxCommandEvent& event ); void OnNewSchFile( wxCommandEvent& event ); void OnNewBrdFile( wxCommandEvent& event ); void OnNewPyFile( wxCommandEvent& event ); void OnNewGerberFile( wxCommandEvent& event ); void OnNewTxtFile( wxCommandEvent& event ); void OnNewNetFile( wxCommandEvent& event ); void ClearFilters(); const std::vector<wxString>& GetFilters(); void RemoveFilter( const wxString& filter ); #ifdef KICAD_PYTHON boost::python::object ToWx(); WinEDA_PrjFrame() { } WinEDA_PrjFrame( const WinEDA_PrjFrame& ) { } void OnRunPy( wxCommandEvent& event ); boost::python::object GetMenuPy( TreeFileType ); boost::python::object GetFtExPy( TreeFileType ) const; void RemoveFilterPy( const boost::python::str& filter ); void AddFilter( const boost::python::str& filter ); boost::python::object GetTreeCtrl(); TreePrjItemData* GetItemData( const boost::python::object& item ); void AddFilePy( const boost::python::str& name, boost::python::object& root ); void NewFilePy( const boost::python::str& name, TreeFileType type, boost::python::object& root ); TreePrjItemData* FindItemData( const boost::python::str& name ); boost::python::object GetCurrentMenu(); int AddStatePy( boost::python::object& bitmap ); #endif bool AddFile( const wxString& name, wxTreeItemId& root ); DECLARE_EVENT_TABLE() }; /** Class TreeCtrl * This is the class to show (as a tree) the files in the project directory */ class WinEDA_TreePrj : public wxTreeCtrl { DECLARE_DYNAMIC_CLASS( WinEDA_TreePrj ) private: WinEDA_PrjFrame* m_Parent; wxImageList* m_ImageList; public: WinEDA_PrjFrame* GetParent() { return m_Parent; } WinEDA_TreePrj( WinEDA_PrjFrame* parent ); ~WinEDA_TreePrj(); private: /* overridden sort function */ int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ); }; #endif #endif