Commit 7a19adfc authored by charras's avatar charras

Kicad: files renaming and code cleaning

parent a70a5805
...@@ -5,6 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ...@@ -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
...@@ -13,8 +14,7 @@ set(KICAD_SRCS ...@@ -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)
......
/***************/ /*
/* treeprj.cpp */ * file class_treeprojectfiles.cpp
/***************/ */
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
#include <pyhandler.h> #include <pyhandler.h>
...@@ -14,6 +14,8 @@ ...@@ -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"
...@@ -22,10 +24,10 @@ ...@@ -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,
...@@ -51,7 +53,7 @@ WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) : ...@@ -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;
...@@ -64,7 +66,7 @@ WinEDA_TreePrj::~WinEDA_TreePrj() ...@@ -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 );
...@@ -235,7 +237,7 @@ void TreePrjItemData::Move( TreePrjItemData* dest ) ...@@ -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 );
} }
} }
...@@ -262,7 +264,7 @@ bool TreePrjItemData::Rename( const wxString& name, bool check ) ...@@ -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 );
...@@ -339,7 +341,7 @@ bool TreePrjItemData::Delete( bool check ) ...@@ -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();
...@@ -434,7 +436,7 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) ...@@ -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() ) );
} }
...@@ -57,7 +57,7 @@ static void WinEDAClear() ...@@ -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 ) );
} }
...@@ -78,7 +78,7 @@ object WinEDA_MainFrame::ToWx() ...@@ -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;
} }
...@@ -107,36 +107,36 @@ void WinEDA_MainFrame::AddFastLaunchPy( object& button ) ...@@ -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 ) ) ) );
} }
...@@ -146,7 +146,7 @@ object WinEDA_PrjFrame::GetCurrentMenu() ...@@ -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 )
/*****************************************************************************/ /*****************************************************************************/
...@@ -163,7 +163,7 @@ void WinEDA_PrjFrame::NewFilePy( const str& name, ...@@ -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;
...@@ -181,7 +181,7 @@ void WinEDA_PrjFrame::AddFilePy( const str& file, object& root ) ...@@ -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;
...@@ -269,53 +269,53 @@ static void py_kicad_init() ...@@ -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" )
......
...@@ -6,11 +6,6 @@ ...@@ -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"
...@@ -24,6 +19,7 @@ ...@@ -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"
...@@ -47,7 +43,7 @@ void ShowLogo( char* FonteFileName ); ...@@ -47,7 +43,7 @@ void ShowLogo( char* FonteFileName );
// Create a new application object // Create a new application object
IMPLEMENT_APP( WinEDA_App ) IMPLEMENT_APP( WinEDA_App )
/* MacOSX: Needed for file association /* MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics * http://wiki.wxwidgets.org/WxMac-specific_topics
*/ */
void WinEDA_App::MacOpenFile(const wxString &fileName) { void WinEDA_App::MacOpenFile(const wxString &fileName) {
......
...@@ -20,8 +20,8 @@ ...@@ -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;
/** /**
...@@ -67,7 +67,7 @@ class WinEDA_MainFrame : public WinEDA_BasicFrame ...@@ -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;
...@@ -140,7 +140,7 @@ public: ...@@ -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
...@@ -247,7 +247,7 @@ public: ...@@ -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()
{ {
...@@ -271,132 +271,4 @@ public: ...@@ -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
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "macros.h" #include "macros.h"
#include "kicad.h" #include "kicad.h"
#include "tree_project_frame.h"
static const wxString TreeFrameWidthEntry( wxT( "LeftWinWidth" ) ); static const wxString TreeFrameWidthEntry( wxT( "LeftWinWidth" ) );
...@@ -62,7 +63,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent, ...@@ -62,7 +63,7 @@ WinEDA_MainFrame::WinEDA_MainFrame( wxWindow* parent,
clientsize = GetClientSize(); clientsize = GetClientSize();
// Left window: is the box which display tree project // Left window: is the box which display tree project
m_LeftWin = new WinEDA_PrjFrame( this ); m_LeftWin = new TREE_PROJECT_FRAME( this );
// Bottom Window: box to display messages // Bottom Window: box to display messages
m_RightWin = new RIGHT_KM_FRAME( this ); m_RightWin = new RIGHT_KM_FRAME( this );
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "gestfich.h" #include "gestfich.h"
#include "prjconfig.h" #include "prjconfig.h"
#include "kicad.h" #include "kicad.h"
#include "tree_project_frame.h"
#include "build_version.h" #include "build_version.h"
......
/*
* file tree_project_frame.h
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2009 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef TREEPRJ_FRAME_H
#define TREEPRJ_FRAME_H
/** class TREE_PROJECT_FRAME
* Window to display the tree files
*/
class TREE_PROJECT_FRAME : 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;
TREEPROJECTFILES* m_TreeProject;
wxTreeItemId m_root;
public:
static wxString GetFileExt( TreeFileType type );
static wxString GetFileWildcard( TreeFileType type );
TREE_PROJECT_FRAME( WinEDA_MainFrame* parent );
~TREE_PROJECT_FRAME();
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();
TREE_PROJECT_FRAME()
{
}
TREE_PROJECT_FRAME( const TREE_PROJECT_FRAME& )
{
}
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()
};
#endif // TREEPRJ_FRAME_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment