2009-07-18 11:44:19 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
/// Class DIALOG_DESIGN_RULES
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __dialog_design_rules_h_
|
|
|
|
#define __dialog_design_rules_h_
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "../class_board.h"
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
#include "dialog_design_rules_base.h"
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
class BOARD_DESIGN_SETTINGS;
|
|
|
|
|
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// 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;
|
2009-07-18 11:44:19 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_EDIT_FRAME* m_Parent;
|
2009-09-10 17:28:38 +00:00
|
|
|
BOARD* m_Pcb;
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
BOARD_DESIGN_SETTINGS m_BrdSettings;
|
2009-09-10 17:28:38 +00:00
|
|
|
|
2009-11-02 05:20:58 +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;
|
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
// List of values to "customize" some tracks and vias
|
2009-10-30 17:58:15 +00:00
|
|
|
std::vector <VIA_DIMENSION> m_ViasDimensionsList;
|
2011-11-24 17:32:51 +00:00
|
|
|
std::vector <int> m_TracksWidthList;
|
2009-10-26 19:00:46 +00:00
|
|
|
|
2009-09-10 17:28:38 +00:00
|
|
|
private:
|
2009-09-27 11:00:21 +00:00
|
|
|
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 );
|
2009-11-02 05:20:58 +00:00
|
|
|
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( );
|
2009-10-06 18:58:51 +00:00
|
|
|
void InitDialogRules();
|
2009-10-21 19:16:25 +00:00
|
|
|
void InitGlobalRules();
|
2009-09-10 17:28:38 +00:00
|
|
|
void InitRulesList();
|
2009-10-26 19:00:46 +00:00
|
|
|
void InitDimensionsLists();
|
2009-09-10 17:28:38 +00:00
|
|
|
void InitializeRulesSelectionBoxes();
|
|
|
|
void CopyRulesListToBoard();
|
2009-10-26 19:00:46 +00:00
|
|
|
void CopyGlobalRulesToBoard();
|
|
|
|
void CopyDimensionsListsToBoard( );
|
2009-09-10 17:28:38 +00:00
|
|
|
void SetRoutableLayerStatus();
|
2010-09-02 13:10:48 +00:00
|
|
|
void FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl, const wxString& aNetClass );
|
2009-09-23 05:53:12 +00:00
|
|
|
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
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
void moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 17:28:38 +00:00
|
|
|
public:
|
2011-03-01 19:26:17 +00:00
|
|
|
DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent );
|
2009-09-10 17:28:38 +00:00
|
|
|
~DIALOG_DESIGN_RULES( ) { };
|
2009-07-18 11:44:19 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__dialog_design_rules_h_
|