kicad/pcbnew/dialog_design_rules.h

111 lines
3.7 KiB
C
Raw Normal View History

///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DESIGN_RULES
///////////////////////////////////////////////////////////////////////////////
#ifndef __dialog_design_rules_h_
#define __dialog_design_rules_h_
#include "dialog_design_rules_base.h"
// helper struct to handle a net and its netclass in dialog design rule editor
2009-09-10 15:22:26 +00:00
struct NETCUP
{
NETCUP( const wxString& aNet, const wxString& aClass )
{
net = aNet;
clazz = aClass;
}
2009-09-10 17:28:38 +00:00
wxString net; ///< a net name
wxString clazz; ///< a class name
2009-09-10 15:22:26 +00:00
};
2009-09-10 17:28:38 +00:00
2009-09-10 15:22:26 +00:00
typedef std::vector<NETCUP> NETCUPS;
typedef std::vector<NETCUP*> PNETCUPS;
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
{
2009-09-10 17:28:38 +00:00
private:
2009-09-10 19:42:34 +00:00
static const wxString wildCard; ///< the name of a ficticious netclass which includes all NETs
2009-09-10 17:28:38 +00:00
WinEDA_PcbFrame* m_Parent;
BOARD* m_Pcb;
BOARD_DESIGN_SETTINGS* m_BrdSettings;
2009-09-10 17:28:38 +00:00
static int s_LastTabSelection; ///< which tab user had open last
static wxSize s_LastSize; ///< last position and size
static wxPoint s_LastPos;
2009-09-10 19:42:34 +00:00
/**
* A two column table which gets filled once and never loses any elements, so it is
* basically constant, except that the NETCUP::clazz member can change for any
* given row a NET is moved in and out of a class. clazz reflects the respective
* NET's current net class.
*/
2009-09-10 17:28:38 +00:00
NETCUPS m_AllNets;
// List of values to "customize" some tracks and vias
std::vector <VIA_DIMENSION> m_ViasDimensionsList;
std::vector <int> m_TracksWidthList;
2009-09-10 17:28:38 +00:00
private:
void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesNameRightClick( wxGridEvent& event ){ event.Skip(); }
2009-09-10 17:28:38 +00:00
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );
void OnRemoveNetclassClick( wxCommandEvent& event );
void OnMoveUpSelectedNetClass( wxCommandEvent& event );
2009-09-10 17:28:38 +00:00
void OnLeftCBSelection( wxCommandEvent& event );
void OnRightCBSelection( wxCommandEvent& event );
void OnRightToLeftCopyButton( wxCommandEvent& event );
void OnLeftToRightCopyButton( wxCommandEvent& event );
void OnLeftSelectAllButton( wxCommandEvent& event );
void OnRightSelectAllButton( wxCommandEvent& event );
bool TestDataValidity( );
void InitDialogRules();
void InitGlobalRules();
2009-09-10 17:28:38 +00:00
void InitRulesList();
void InitDimensionsLists();
2009-09-10 17:28:38 +00:00
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
void CopyGlobalRulesToBoard();
void CopyDimensionsListsToBoard( );
2009-09-10 17:28:38 +00:00
void SetRoutableLayerStatus();
void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass );
void PrintCurrentSettings( );
2009-09-10 17:28:38 +00:00
/**
* Function swapNetClass
* replaces one net class name with another in the master list, m_AllNets.
*/
void swapNetClass( const wxString& oldClass, const wxString& newClass )
{
for( NETCUPS::iterator i = m_AllNets.begin(); i!=m_AllNets.end(); ++i )
2009-09-10 15:22:26 +00:00
{
2009-09-10 17:28:38 +00:00
if( i->clazz == oldClass )
i->clazz = newClass;
2009-09-10 15:22:26 +00:00
}
2009-09-10 17:28:38 +00:00
}
void makePointers( PNETCUPS* aList, const wxString& aNetClassName );
2009-09-10 15:22:26 +00:00
2009-09-10 17:28:38 +00:00
void setNetClass( const wxString& aNetName, const wxString& aClassName );
2009-09-10 15:22:26 +00:00
2009-09-10 17:28:38 +00:00
static void setRowItem( wxListCtrl* aListCtrl, int aRow, NETCUP* aNetAndClass );
2009-09-10 15:22:26 +00:00
2009-09-10 17:28:38 +00:00
void moveSelectedItems( wxListCtrl* src, const wxString& newClassName );
2009-09-10 15:22:26 +00:00
2009-09-10 17:28:38 +00:00
public:
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
~DIALOG_DESIGN_RULES( ) { };
};
#endif //__dialog_design_rules_h_