Commit e7c9ae2b authored by charras's avatar charras

First work about net classes. This is a work in progress and a moving target

parent ff58b0a8
......@@ -4,6 +4,13 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-july-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
First work about net classes. This is a work in progress and a moving target.
Manual routing and DRC do not used yet this feature
2009-Jul-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
......
......@@ -61,6 +61,7 @@ set(PCB_COMMON_SRCS
../pcbnew/class_drawsegment.cpp
../pcbnew/class_drc_item.cpp
../pcbnew/class_edge_mod.cpp
../pcbnew/class_netclass.cpp
../pcbnew/class_netinfo_item.cpp
../pcbnew/class_netinfolist.cpp
../pcbnew/class_marker.cpp
......
......@@ -728,7 +728,7 @@ enum main_id {
ID_PCB_USER_GRID_SETUP,
ID_PCB_DISPLAY_FOOTPRINT_DOC,
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
ID_PCBUNUSED3,
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
ID_PCBUNUSED4,
ID_PCBUNUSED5,
ID_PCBUNUSED6,
......
......@@ -431,6 +431,11 @@ public:
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** function ShowDesignRulesEditor
* Display the Design Rules Editor.
*/
void ShowDesignRulesEditor( wxCommandEvent& event );
/**
* Function UpdateToolbarLayerInfo
* updates the currently selected layer in the layer listbox and
......
No preview for this file type
This diff is collapsed.
......@@ -32,6 +32,8 @@ set(PCBNEW_SRCS
deltrack.cpp
dialog_copper_zones.cpp
dialog_copper_zones_base.cpp
dialog_design_rules.cpp
dialog_design_rules_base.cpp
dialog_display_options.cpp
dialog_display_options_base.cpp
dialog_drc_base.cpp
......
......@@ -36,6 +36,11 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Layer[layer].m_Name = ReturnPcbLayerName( layer, true );
m_Layer[layer].m_Type = LT_SIGNAL;
}
// Add the default Netclass to list
m_NetClassesList.m_Parent = this;
NETCLASS * default_netclass = new NETCLASS(this);
m_NetClassesList.AddNetclass( default_netclass );
}
......@@ -929,6 +934,9 @@ bool BOARD::Save( FILE* aFile ) const
bool rc = false;
BOARD_ITEM* item;
// save the netclasses
m_NetClassesList.Save( aFile );
// save the nets
for( unsigned ii = 0; ii < m_NetInfo->GetNetsCount(); ii++ )
if( !m_NetInfo->GetNetItem( ii )->Save( aFile ) )
......
......@@ -22,7 +22,7 @@ enum LAYER_T {
LT_SIGNAL,
LT_POWER,
LT_MIXED,
LT_JUMPER,
LT_JUMPER
};
......@@ -97,7 +97,8 @@ public:
std::vector<RATSNEST_ITEM> m_LocalRatsnest; /* Rastnest list relative to a given footprint
* (used while moving a footprint) */
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
NETCLASS_LIST m_NetClassesList; // List of current netclasses. There is always the default netclass
ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
BOARD( EDA_BaseStruct* aParent, WinEDA_BasePcbFrame* frame );
~BOARD();
......@@ -335,6 +336,17 @@ public:
*/
int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
/**
* Function TransfertDesignRulesToNets
* Copy Netclass parameters to each net, corresponding to its net class
* Must be called after a Design Rules edition, or after reading a netlist (or editing the list of nets)
* Also this function remove the non existing nets in netclasses and add net nets in default netclass
* (this happens after reading a netlist)
* @param none
* @return none
*/
void TransfertDesignRulesToNets( );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
......
/*************************************/
/* class to handle Net Classes */
/**************************************/
#include "fctsys.h"
#include "common.h"
#include "kicad_string.h"
#include "pcbnew.h"
NET_DESIGN_PARAMS::NET_DESIGN_PARAMS()
{
m_TracksWidth = 170; // "Default" value for tracks thickness used to route this net
m_TracksMinWidth = 150; // Minimum value for tracks thickness (used in DRC)
m_ViasSize = 550; // "Default" value for vias sizes used to route this net
m_ViasMinSize = 400; // Minimum value for vias sizes (used in DRC)
m_Clearance = 140; // "Default" clearance when routing
m_MinClearance = 110; // Minimum value for clearance (used in DRC)
}
/* A NETCLASS handles a list of nets and the parameters used to route or test (in DRC) these nets
* This is mainly used in autotouters like Freeroute, but this can be also used in manual routing
*/
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName )
{
m_Parent = aParent;
m_Name = aName; // Name of the net class
}
NETCLASS::~NETCLASS()
{
}
NETCLASS_LIST::NETCLASS_LIST( BOARD* aParent )
{
m_Parent = aParent;
std::vector <NETCLASS*> m_Netclass_List;
}
NETCLASS_LIST::~NETCLASS_LIST()
{
ClearList();
}
void NETCLASS_LIST::ClearList()
{
// the NETCLASS_LIST is owner of its items, so delete them
for( unsigned ii = 0; ii < m_Netclass_List.size(); ii++ )
delete m_Netclass_List[ii];
m_Netclass_List.clear();
}
/** Function AddNetclass()
* @param aNetclass = a pointer to the netclass to add
* @return true if Ok, false if cannot be added (mainly because a netclass with the same name exists)
*/
bool NETCLASS_LIST::AddNetclass( NETCLASS* aNetclass )
{
// Test for an existing netclass:
for( unsigned ii = 0; ii < m_Netclass_List.size(); ii++ )
{
if( m_Netclass_List[ii]->m_Name.CmpNoCase( aNetclass->m_Name ) == 0 )
return false; // this netclass already exists
}
m_Netclass_List.push_back( aNetclass );
return true;
}
/**
* Function TransfertDesignRulesToNets
* Copy Netclass parameters to each net, corresponding to its net class
* Must be called after a Design Rules edition, or after reading a netlist (or editing the list of nets)
* Also this function remove the non existing nets in netclasses and add net nets in default netclass
* (this happens after reading a netlist)
* @param none
* @return none
*/
void BOARD::TransfertDesignRulesToNets()
{
// Clear .m_Flag member of nets (used to detect not in netclass list nets)
for( unsigned ii = 1; ; ii++ )
{
NETINFO_ITEM* net = FindNet( ii );
if( net == NULL )
break;
net->m_Flag = 0;
}
for( unsigned ii = 0; ii < m_NetClassesList.m_Netclass_List.size(); ii++ )
{
//Transfert rules and netclass name to nets:
NETCLASS* netclass = m_NetClassesList.m_Netclass_List[ii];
for( unsigned jj = 0; jj < netclass->GetMembersCount(); jj++ )
{
wxString netname = netclass->GetMemberName( jj );
NETINFO_ITEM* net = FindNet( netname );
if( net == NULL ) // This net does not exists: remove it
{
netclass->m_MembersNetNames.RemoveAt( jj );
jj--;
}
else
{
net->SetClass( *netclass );
net->m_Flag = 1;
}
}
}
// Now, set nets that do not have yet a netclass to default netclass
NETCLASS* defaultnetclass = m_NetClassesList.m_Netclass_List[0];
for( unsigned ii = 1; ; ii++ )
{
NETINFO_ITEM* net = FindNet( ii );
if( net == NULL )
break;
if( net->m_Flag == 0 )
{
net->SetClass( *defaultnetclass );
defaultnetclass->AddMember( net->GetNetname() );
}
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool NETCLASS_LIST::Save( FILE* aFile ) const
{
bool success = true;
for( unsigned ii = 0; ii < m_Netclass_List.size(); ii++ )
{
success = m_Netclass_List[ii]->Save( aFile );
if( !success )
break;
}
return success;
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool NETCLASS::Save( FILE* aFile ) const
{
bool success = true;
fprintf( aFile, "$NETCLASS\n" );
fprintf( aFile, "Name \"%s\"\n", CONV_TO_UTF8( m_Name ) );
// Write parameters
success = m_NetParams.Save( aFile );
// Write members list:
for( unsigned ii = 0; ii < GetMembersCount(); ii++ )
fprintf( aFile, "AddNet \"%s\"\n", CONV_TO_UTF8( GetMemberName( ii ) ) );
fprintf( aFile, "$EndNETCLASS\n" );
return success;
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool NET_DESIGN_PARAMS::Save( FILE* aFile ) const
{
bool success = true;
fprintf( aFile, "$PARAMS_START\n" );
fprintf( aFile, "TracksWidth %d\n", m_TracksWidth );
fprintf( aFile, "TracksMinWidth %d\n", m_TracksMinWidth );
fprintf( aFile, "ViasSize %d\n", m_ViasSize );
fprintf( aFile, "ViasMinSize %d\n", m_ViasMinSize );
fprintf( aFile, "Clearance %d\n", m_Clearance );
fprintf( aFile, "MinClearance %d\n", m_MinClearance );
fprintf( aFile, "$PARAMS_END\n" );
return success;
}
/**
* Function ReadDescr
* reads the data structures for this object from a FILE in "*.brd" format.
* @param aFile The FILE to read to.
* @return bool - true if success reading else false.
*/
bool NET_DESIGN_PARAMS::ReadDescr( FILE* aFile, int* aLineNum )
{
bool success = true;
char Line[1024];
while( GetLine( aFile, Line, aLineNum, 1024 ) != NULL )
{
if( strnicmp( Line, "$PARAMS_END", 11 ) == 0 )
return success;
if( strnicmp( Line, "TracksWidth", 11 ) == 0 )
{
m_TracksWidth = atoi( Line + 11 );
continue;
}
if( strnicmp( Line, "TracksMinWidth", 14 ) == 0 )
{
m_TracksMinWidth = atoi( Line + 14 );
continue;
}
if( strnicmp( Line, "ViasSize", 8 ) == 0 )
{
m_ViasSize = atoi( Line + 8 );
continue;
}
if( strnicmp( Line, "ViasMinSize", 11 ) == 0 )
{
m_ViasMinSize = atoi( Line + 11 );
continue;
}
if( strnicmp( Line, "Clearance", 9 ) == 0 )
{
m_Clearance = atoi( Line + 9 );
continue;
}
if( strnicmp( Line, "MinClearance", 12 ) == 0 )
{
m_MinClearance = atoi( Line + 12 );
continue;
}
}
return success;
}
/**
* Function ReadDescr
* reads the data structures for this object from a FILE in "*.brd" format.
* @param aFile The FILE to read to.
* @return bool - true if success reading else false.
*/
bool NETCLASS::ReadDescr( FILE* aFile, int* aLineNum )
{
bool success = true;
char Line[1024];
char Buffer[1024];
while( GetLine( aFile, Line, aLineNum, 1024 ) != NULL )
{
if( strnicmp( Line, "$endNETCLASS", 6 ) == 0 )
return success;
if( strnicmp( Line, "$PARAMS_START", 13 ) == 0 )
{
m_NetParams.ReadDescr( aFile, aLineNum );
continue;
}
if( strnicmp( Line, "Name", 4 ) == 0 )
{
ReadDelimitedText( Buffer, Line + 4, sizeof(Buffer) );
m_Name = CONV_FROM_UTF8( Buffer );
}
if( strnicmp( Line, "AddNet", 6 ) == 0 )
{
ReadDelimitedText( Buffer, Line + 6, sizeof(Buffer) );
wxString netname = CONV_FROM_UTF8( Buffer );
AddMember( netname );
}
}
return success;
}
/*************************************/
/* class to Net Classes */
/**************************************/
#ifndef CLASS_NETCLASS_H
#define CLASS_NETCLASS_H
/* this small class NET_DESIGN_PARAMS handles netclass parameters.
* This is a separate class because these parameters are also duplicated
* (for calculation time consideration) in each NETINFO_ITEM when making tests DRC and routing
*/
class NET_DESIGN_PARAMS
{
public:
int m_TracksWidth; // "Default" value for tracks thickness used to route this net
int m_TracksMinWidth; // Minimum value for tracks thickness (used in DRC)
int m_ViasSize; // "Default" value for vias sizes used to route this net
int m_ViasMinSize; // Minimum value for vias sizes (used in DRC)
int m_Clearance; // "Default" clearance when routing
int m_MinClearance; // Minimum value for clearance (used in DRC)
public:
NET_DESIGN_PARAMS();
~NET_DESIGN_PARAMS() {}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
/**
* Function ReadDescr
* reads the data structures for this object from a FILE in "*.brd" format.
* @param aFile The FILE to read to.
* @return bool - true if success reading else false.
*/
bool ReadDescr( FILE* aFile, int* aLineNum );
};
/**
* @info A NETCLASS handles a list of nets and the parameters used to route or test these nets
*/
class NETCLASS
{
public:
BOARD* m_Parent;
wxString m_Name; // Name of the net class
wxArrayString m_MembersNetNames; // List of nets members of this class
NET_DESIGN_PARAMS m_NetParams; // values of net classes parameters
public:
NETCLASS( BOARD* aParent, const wxString& aName = wxT( "default" ) );
~NETCLASS();
/** Function GetMembersCount
*@return the number of nets using this rule
*/
unsigned GetMembersCount() const
{
return m_MembersNetNames.GetCount();
}
void ClearMembersList()
{
m_MembersNetNames.Clear();
}
void AddMember( const wxString& aNetname )
{
m_MembersNetNames.Add( aNetname );
}
wxString GetMemberName( unsigned aIdx ) const
{
if( aIdx < GetMembersCount() )
return m_MembersNetNames[aIdx];
else
return wxEmptyString;
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
/**
* Function ReadDescr
* reads the data structures for this object from a FILE in "*.brd" format.
* @param aFile The FILE to read to.
* @return bool - true if success reading else false.
*/
bool ReadDescr( FILE* aFile, int* aLineNum );
};
/* This NETCLASS_LIST handles the list of NETCLASS for the board
* Note: the NETCLASS_LIST is owner of all NETCLASS in list
*/
class NETCLASS_LIST
{
public:
BOARD* m_Parent;
std::vector <NETCLASS*> m_Netclass_List;
public:
NETCLASS_LIST( BOARD* aParent = NULL );
~NETCLASS_LIST();
void ClearList();
/** Function GetNetClassCount()
* @return the number of existing netclasses
*/
unsigned GetNetClassCount()
{
return m_Netclass_List.size();
}
/** Function GetNetClass()
* @param aIdx = the index in netclass list
* @return a NETCLASS* pointer on the netclass
*/
NETCLASS* GetNetClass( unsigned aIdx )
{
if( GetNetClassCount() && aIdx < GetNetClassCount() )
return m_Netclass_List[aIdx];
else
return NULL;
}
/** Function AddNetclass()
* @param aNetclass = a pointer to the netclass to add
* @return true if Ok, false if cannot be added (mainly because a netclass with the same name exists)
*/
bool AddNetclass( NETCLASS* aNetclass );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
};
#endif // #ifndef CLASS_NETCLASS_H
......@@ -9,6 +9,8 @@
#ifndef __CLASSES_NETINFO__
#define __CLASSES_NETINFO__
#include "class_netclass.h"
// Forward declaration:
class NETINFO_ITEM;
......@@ -147,17 +149,21 @@ private:
class NETINFO_ITEM
{
private:
int m_NetCode; // this is a number equivalent to the net name
// Used for fast comparisons in rastnest and DRC computations.
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by eeschema
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
int m_NetCode; // this is a number equivalent to the net name
// Used for fast comparisons in rastnest and DRC computations.
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by eeschema
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
wxString m_NetClassName; /* Net Class name. if void this is equivalent to "default" (the first
* item of the net classes list
*/
NET_DESIGN_PARAMS m_NetParams; // values of net classes parameters
public:
int m_NbNodes; // Pads count for this net
int m_NbNodes; // Pads count for this net
int m_NbLink; // Ratsnets count for this net
int m_NbNoconn; // Ratsnets remaining to route count
int m_ForceWidth; // specific width (0 = default width)
int m_Flag; // used in some calculations. Had no special meaning
std::vector <D_PAD*> m_ListPad; // List of pads connected to this net
unsigned m_RatsnestStartIdx; /* Starting point of ratsnests of this net (included)
* in a general buffer of ratsnest (a vector<RATSNEST_ITEM*> buffer)
......@@ -168,7 +174,86 @@ public:
~NETINFO_ITEM();
/* Readind and writing data on files */
/** Functions SetClassParameters
* copy the class parameters in the locale buffer m_NetParams
*/
void SetClassParameters(const NET_DESIGN_PARAMS& aParams )
{
m_NetParams = aParams;
}
/** Functions SetClass
* copy the class Name and class parmeters
*/
void SetClass(const NETCLASS& aNetclass )
{
m_NetParams = aNetclass.m_NetParams;
m_NetClassName = aNetclass.m_Name;
}
/** Functions GetClassName
* @return the class Name
*/
wxString GetClassName( ) const
{
return m_NetClassName;
}
/** function GetTracksWidth()
* @return the "default" value for tracks thickness used to route this net
*/
int GetTracksWidth()
{
return m_NetParams.m_TracksWidth;
}
/** Function GetTracksMinWidth()
* @return the Minimum value for tracks thickness (used in DRC)
*/
int GetTracksMinWidth()
{
return m_NetParams.m_TracksMinWidth = 150;
}
/** Function
* @return the "Default" value for vias sizes used to route this net
*/
int GetViasSize()
{
return m_NetParams.m_ViasSize;
}
/** Function GetViasMinSize()
* @return the Minimum value for vias sizes (used in DRC)
*/
int GetViasMinSize()
{
return m_NetParams.m_ViasMinSize;
}
/** Function GetClearance()
* @return the "Default" clearance when routing
*/
int GetClearance()
{
return m_NetParams.m_Clearance;
}
/** Function GetMinClearance()
* @return the Minimum value for clearance (used in DRC)
*/
int GetMinClearance()
{
return m_NetParams.m_MinClearance;
}
/* Reading and writing data on files */
int ReadDescr( FILE* File, int* LineNum );
/**
......
......@@ -17,8 +17,10 @@
NETINFO_ITEM::NETINFO_ITEM( BOARD_ITEM* aParent )
{
SetNet( 0 );
m_NbNodes = m_NbLink = m_NbNoconn = 0;
m_ForceWidth = 0;
m_NbNodes = 0;
m_NbLink = 0;
m_NbNoconn = 0;
m_Flag = 0;
m_RatsnestStartIdx = 0; // Starting point of ratsnests of this net in a general buffer of ratsnest
m_RatsnestEndIdx = 0; // Ending point of ratsnests of this net
}
......@@ -58,10 +60,10 @@ int NETINFO_ITEM:: ReadDescr( FILE* File, int* LineNum )
continue;
}
if( strncmp( Line, "Lw", 2 ) == 0 ) /* Texte */
if( strncmp( Line, "NetClass", 8 ) == 0 ) /* Net Class */
{
sscanf( Line + 2, " %d", &tmp );
m_ForceWidth = tmp;
ReadDelimitedText( Ltmp, Line + 8, sizeof(Ltmp) );
m_NetClassName = CONV_FROM_UTF8( Ltmp );
continue;
}
}
......@@ -70,9 +72,9 @@ int NETINFO_ITEM:: ReadDescr( FILE* File, int* LineNum )
}
/**************************************/
/*******************************************/
bool NETINFO_ITEM::Save( FILE* aFile ) const
/**************************************/
/*******************************************/
/** Note: the old name of class NETINFO_ITEM was EQUIPOT
* so in Save (and read) functions, for compatibility, we use EQUIPOT as keyword
......@@ -84,8 +86,7 @@ bool NETINFO_ITEM::Save( FILE* aFile ) const
fprintf( aFile, "Na %d \"%s\"\n", GetNet(), CONV_TO_UTF8( m_Netname ) );
fprintf( aFile, "St %s\n", "~" );
if( m_ForceWidth )
fprintf( aFile, "Lw %d\n", m_ForceWidth );
fprintf( aFile, "NetClass \"%s\"\n", CONV_TO_UTF8(m_NetClassName) );
if( fprintf( aFile, "$EndEQUIPOT\n" ) != sizeof("$EndEQUIPOT\n") - 1 )
goto out;
......
......@@ -125,6 +125,7 @@ void NETINFO_LIST::BuildListOfNets()
}
m_Parent->m_NbNodes = nodes_count;
m_Parent->TransfertDesignRulesToNets( );
m_Parent->m_Status_Pcb |= NET_CODES_OK;
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DESIGN_RULES
///////////////////////////////////////////////////////////////////////////////
#ifndef __dialog_design_rules_h_
#define __dialog_design_rules_h_
#include "dialog_design_rules_base.h"
class DIALOG_DESIGN_RULES : public DIALOG_DESIGN_RULES_BASE
{
private:
WinEDA_PcbFrame * m_Parent;
int m_ActivesLayersCount;
BOARD * m_Pcb;
int m_Changes;
LAYER_T m_LayersType[4];
wxString m_LayersTypeName[4];
std::vector<NETINFO_ITEM*> m_StockNets; // full list of nets on board
std::vector<int> m_NetsLinkToClasses; // index to affect each net to an existing net class
private:
void OnLayerCountClick( wxCommandEvent& event );
void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
void OnCancelButtonClick( wxCommandEvent& event );
void OnOkButtonClick( wxCommandEvent& event );
void OnAddNetclassClick( wxCommandEvent& event );
void OnRemoveNetclassClick( wxCommandEvent& event );
void OnLeftCBSelection( wxCommandEvent& event );
void OnRightCBSelection( wxCommandEvent& event );
void OnRightToLeftCopyButton( wxCommandEvent& event );
void OnLeftToRightCopyButton( wxCommandEvent& event );
void OnLeftSelectAllButton( wxCommandEvent& event );
void OnRightSelectAllButton( wxCommandEvent& event );
void Init();
void InitRulesList();
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
void SetRoutableLayerStatus( );
void FillListBoxWithNetsNames(wxListBox* aListBox, int aNetclassIndex);
public:
DIALOG_DESIGN_RULES( WinEDA_PcbFrame* parent );
~DIALOG_DESIGN_RULES( ) { };
};
#endif //__dialog_design_rules_h_
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_design_rules_base__
#define __dialog_design_rules_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/grid.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/listbox.h>
#include <wx/stattext.h>
#include <wx/html/htmlwin.h>
#include <wx/notebook.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_LAYERS_COUNT_SELECTION 1000
#define ID_LAYERS_PROPERTIES 1001
#define wxID_ADD_NETCLASS 1002
#define wxID_REMOVE_NETCLASS 1003
#define ID_LEFT_CHOICE_CLICK 1004
#define ID_LEFT_TO_RIGHT_COPY 1005
#define ID_RIGHT_TO_LEFT_COPY 1006
#define ID_RIGHT_CHOICE_CLICK 1007
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DESIGN_RULES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DESIGN_RULES_BASE : public wxDialog
{
private:
protected:
wxNotebook* m_notebook;
wxPanel* m_panelLayers;
wxRadioBox* m_LayersCountSelection;
wxGrid* m_gridLayersProperties;
wxPanel* m_panelNetClasses;
wxGrid* m_gridNetClassesProperties;
wxButton* m_buttonADD;
wxButton* m_buttonRemove;
wxChoice* m_CBoxLeftSelection;
wxListBox* m_listBoxLeftNetSelect;
wxButton* m_buttonRightToLeft;
wxButton* m_buttonLeftToRight;
wxButton* m_buttonLeftSelAll;
wxButton* m_buttonRightSelAll;
wxChoice* m_CBoxRightSelection;
wxListBox* m_listBoxRightNetSelect;
wxStaticText* m_staticTextMsg;
wxHtmlWindow* m_MessagesList;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnLayerCountClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLayerGridLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnLayerGridRighttClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesGridLeftClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnNetClassesGridRightClick( wxGridEvent& event ){ event.Skip(); }
virtual void OnAddNetclassClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRemoveNetclassClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftCBSelection( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRightToLeftCopyButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftToRightCopyButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnLeftSelectAllButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRightSelectAllButton( wxCommandEvent& event ){ event.Skip(); }
virtual void OnRightCBSelection( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnOkButtonClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Design Rules Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 684,486 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DESIGN_RULES_BASE();
};
#endif //__dialog_design_rules_base__
......@@ -410,7 +410,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
g_DesignSettings.m_ViasMinSize = atoi( data );
continue;
}
if( stricmp( Line, "MicroViaSize" ) == 0 )
{
g_DesignSettings.m_CurrentMicroViaSize = atoi( data );
......@@ -776,7 +776,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
/** ReadPcbFile
* Read a board file <file>.brd
* @param Append if 0: a previoulsy loaded boar is delete before loadin the file.
* @param Append if 0: a previoulsy loaded board is deleted before loading the file.
* else all items of the board file are added to the existing board
*/
{
......@@ -790,6 +790,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
NbDraw = NbTrack = NbZone = NbMod = NbNets = -1;
GetBoard()->m_Status_Pcb = 0;
GetBoard()->m_NetClassesList.ClearList();
while( GetLine( File, Line, &LineNum ) != NULL )
{
......@@ -831,6 +832,15 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
continue;
}
if( strnicmp( Line, "$NETCLASS", 8 ) == 0 )
{
NETCLASS* netclass = new NETCLASS( GetBoard() );
netclass->ReadDescr( File, &LineNum );
if( ! GetBoard()->m_NetClassesList.AddNetclass( netclass ) )
delete netclass;
continue;
}
if( strnicmp( Line, "$CZONE_OUTLINE", 7 ) == 0 )
{
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(GetBoard());
......@@ -913,6 +923,15 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
BestZoom();
// One netclass *must* exists (the default netclass)
if( GetBoard()->m_NetClassesList.GetNetClassCount() == 0 )
{
NETCLASS* ncdefault = new NETCLASS(GetBoard());
GetBoard()->m_NetClassesList.AddNetclass( ncdefault );
}
GetBoard()->TransfertDesignRulesToNets( );
GetBoard()->m_Status_Pcb = 0;
return 1;
}
......
......@@ -205,6 +205,13 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
configmenu->AppendSeparator();
AddHotkeyConfigMenu( configmenu );
// Add acces to the Design Rules Dialog:
wxMenu* designRulesMenu = new wxMenu;
item = new wxMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
_( "Design Rules" ), _( "Open the design rules dialog editor" ) );
item->SetBitmap( hammer_xpm );
designRulesMenu->Append( item );
/////////////////////////////
// Ajustage de dimensions: //
/////////////////////////////
......@@ -319,6 +326,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( designRulesMenu, _( "&Design Rules" ) );
menuBar->Append( sizes_menu, _( "&Dimensions" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
menuBar->Append( postprocess_menu, _( "P&ostprocess" ) );
......
......@@ -38,6 +38,9 @@ static wxMenu* Append_Track_Width_List()
trackwidth_menu = new wxMenu;
ADD_MENUITEM( trackwidth_menu, ID_PCB_TRACK_SIZE_SETUP,
_( "New Width/Size" ), showtrack_xpm );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH,
_( "Auto Width" ),
_(
......
......@@ -16,6 +16,8 @@
#include "3d_viewer.h"
#include "kbool/include/kbool/booleng.h"
#include "dialog_design_rules.h"
// Keys used in read/write config
#define PCB_CURR_GRID wxT( "PcbCurrGrid" )
#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" )
......@@ -116,6 +118,9 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
// Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
// Menu Get Design Rules Editor
EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, WinEDA_PcbFrame::ShowDesignRulesEditor )
// Horizontal toolbar
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
......@@ -639,3 +644,17 @@ void WinEDA_PcbFrame::Show3D_Frame( wxCommandEvent& event )
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
m_Draw3DFrame->Show( TRUE );
}
/**
* Display the Design Rules Editor.
*/
void WinEDA_PcbFrame::ShowDesignRulesEditor( wxCommandEvent& event )
{
DIALOG_DESIGN_RULES dR_editor( this );
int change = dR_editor.ShowModal( );
if ( change )
{
ReCreateLayerBox( NULL );
GetScreen()->SetModify();
}
}
......@@ -678,9 +678,6 @@ void WinEDA_PcbFrame::UpdateToolbarLayerInfo()
WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
/**************************************************************************/
{
// wxASSERT("ReCreateLayerBox"==""); // get a stack trace, who is calling me and from where
D(printf("ReCreateLayerBox\n");)
if( m_SelLayerBox == NULL )
{
if( parent == NULL )
......
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