Commit fd521f37 authored by charras's avatar charras

More work about Netclasses in Design Rules dialog

parent 44e588dc
......@@ -109,7 +109,7 @@ double PLOTTER::user_to_device_size( double size )
void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill )
/************************************************************************************/
{
int rayon = diametre / 2.8284;
int rayon = wxRound( diametre / 2.8284 );
int coord[10] =
{
position.x + rayon, position.y + rayon,
......
......@@ -280,7 +280,7 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T fill, int aW
double radius = aDiameter / 2;
const int delta = 3600 / 32; /* increment (in 0.1 degrees) to draw circles */
start.x = aCentre.x + radius;
start.x = aCentre.x + wxRound( radius );
start.y = aCentre.y;
set_current_line_width( aWidth );
move_to( start );
......
......@@ -251,7 +251,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
rayon = size.x / 2;
if( trace_mode == FILLED )
{
flash_pad_rect( pos, wxSize( size.x, deltaxy+pen_diameter ),
flash_pad_rect( pos, wxSize( size.x, deltaxy + wxRound( pen_diameter ) ),
orient, trace_mode );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
......@@ -262,7 +262,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
}
else /* Trace en mode SKETCH */
{
sketch_oval(pos, size, orient, pen_diameter);
sketch_oval(pos, size, orient, wxRound( pen_diameter) );
}
}
......@@ -277,11 +277,11 @@ void HPGL_PLOTTER::flash_pad_circle(wxPoint pos, int diametre,
user_to_device_coordinates( pos );
delta = pen_diameter - pen_overlap;
delta = wxRound( pen_diameter - pen_overlap ) ;
rayon = diametre / 2;
if( trace_mode != FILAIRE )
{
rayon = (diametre - pen_diameter ) / 2;
rayon = (diametre - wxRound( pen_diameter) ) / 2;
}
if( rayon < 0 )
......@@ -437,7 +437,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
wxPoint coord[4]; /* coord reelles des sommets du trapeze a tracer */
int moveX, moveY; /* variation de position plume selon axe X et Y , lors
* du remplissage du trapeze */
moveX = moveY = pen_diameter;
moveX = moveY = wxRound( pen_diameter );
size.x /= 2; size.y /= 2;
delta.x /= 2; delta.y /= 2;
......@@ -471,7 +471,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint pos, wxSize size, wxSize delta,
{
int jj;
/* Fill the shape */
moveX = moveY = pen_diameter - pen_overlap;
moveX = moveY = wxRound( pen_diameter - pen_overlap );
/* calcul de jj = hauteur du remplissage */
if( delta.y ) /* Trapeze horizontal */
{
......
......@@ -168,7 +168,7 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int rayon,
// Calcul des coord du point de depart :
user_to_device_coordinates( centre );
rayon = user_to_device_size(rayon);
rayon = wxRound( user_to_device_size(rayon) );
if( plot_orient_options == PLOT_MIROIR )
fprintf( output_file, "%d %d %d %g %g arc%d\n", centre.x, centre.y,
rayon, (double) -EndAngle / 10, (double) -StAngle / 10,
......
......@@ -399,14 +399,15 @@ LIB_DRAW_ITEM* LIB_COMPONENT::GetNextDrawItem( LIB_DRAW_ITEM* item,
return NULL;
}
/*************************************************************************/
void LIB_COMPONENT::GetPins( LIB_PIN_LIST& pins, int unit, int convert )
/*************************************************************************/
{
/* Notes:
* when unit == 0: no unit filtering
* when convert == 0: no convert (shape selection) filtering
* when .m_Unit == 0, the body item is common to units
* when .m_Convert == 0, the body item is common to shape
* when .m_Convert == 0, the body item is common to shapes
*/
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
{
......
......@@ -45,6 +45,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
/*****************************************************************/
/* Prepare le menu PullUp affich� par un click sur le bouton droit
* de la souris.
* Ce menu est ensuite compl�t� par la liste des commandes de ZOOM
......@@ -171,7 +172,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
// Many fields are inside a component. If this is the case, add the component menu
SCH_COMPONENT* Component = LocateSmallestComponent(
(SCH_SCREEN*) GetScreen() );
(SCH_SCREEN*) GetScreen() );
if( Component )
{
PopMenu->AppendSeparator();
......@@ -221,7 +222,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
wxString msg;
msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown \
DrawType %d" ),
DrawStruct->Type() );
DrawStruct->Type() );
DisplayError( this, msg );
break;
}
......@@ -235,6 +236,7 @@ DrawType %d" ),
void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
{
/*************************************************************************/
/* Add menu commands for a component field (like value, reference)
*/
if( !Field->m_Flags )
......@@ -251,6 +253,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
{
/**************************************************************************/
/* Add menu commands for a component
*/
if( Component->Type() != TYPE_SCH_COMPONENT )
......@@ -370,9 +373,10 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
{
/*******************************************************************/
/* Add menu commands for a Global Label
*/
wxMenu* menu_change_type = new wxMenu;
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !GLabel->m_Flags )
......@@ -405,14 +409,17 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
{
/*******************************************************************/
/* Add menu commands for a hierarchical Label
*/
wxMenu* menu_change_type = new wxMenu;
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !HLabel->m_Flags )
{
msg = AddHotkeyName( _( "Move Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
msg = AddHotkeyName( _(
"Move Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_MOVE_COMPONENT );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
msg, move_text_xpm );
}
......@@ -440,9 +447,10 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
{
/*****************************************************************/
/* Add menu commands for a Label
*/
wxMenu* menu_change_type = new wxMenu;
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !Label->m_Flags )
......@@ -475,6 +483,7 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
{
/*****************************************************************/
/* Add menu commands for a Text (a comment)
*/
wxMenu* menu_change_type = new wxMenu;
......@@ -515,6 +524,7 @@ void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
WinEDA_SchematicFrame* frame )
{
/*****************************************************************/
/* Add menu commands for a junction
*/
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
......@@ -546,6 +556,7 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
WinEDA_SchematicFrame* frame )
{
/*****************************************************************/
/* Add menu commands for a wire
*/
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
......@@ -591,6 +602,7 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
WinEDA_SchematicFrame* frame )
{
/*****************************************************************/
/* Add menu commands for a Bus
*/
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
......@@ -626,6 +638,7 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet )
{
/************************************************************************/
/* Add menu commands for a Sheet
*/
if( !Sheet->m_Flags )
......@@ -666,6 +679,7 @@ void AddMenusForPinSheet( wxMenu* PopMenu,
Hierarchical_PIN_Sheet_Struct* PinSheet )
{
/************************************************************************/
/* Add menu commands for a Pin Sheet (or Sheet label)
*/
if( !PinSheet->m_Flags )
......@@ -685,6 +699,7 @@ void AddMenusForPinSheet( wxMenu* PopMenu,
void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
{
/**********************************************************************/
/* Add menu commands for block
*/
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
......
......@@ -214,7 +214,7 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_ViasMinSize = 350; // vias (not micro vias) min diameter
m_ViasMinDrill = 200; // vias (not micro vias) min drill diameter
m_MicroViasMinSize = 200; // micro vias (not vias) min diameter
m_MicroViasMinDrill = 80; // micro vias (not vias) min drill diameter
m_MicroViasMinDrill = 50; // micro vias (not vias) min drill diameter
m_MaskMargin = 150; // Solder mask margin
/* Color options for screen display of the Printed Board: */
......
......@@ -190,8 +190,44 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, g_DesignSettings.m_MicroViasMinDrill, Internal_Unit );
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, g_DesignSettings.m_TrackMinWidth, Internal_Unit );
// Initialize Vias and Tracks sizes lists.
// note we display only extra values, never the current netclass value.
// (the first value in histories list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDiameterList = m_Parent->GetBoard()->m_ViaSizeList;
m_ViasDiameterList.erase( m_ViasDiameterList.begin() ); // remove the netclass value
InitDimensionsLists();
}
/***************************************************/
void DIALOG_DESIGN_RULES::InitDimensionsLists()
/***************************************************/
/* Populates the lists of sizes (Tracks width list and Vias diameters & drill list)
*/
{
wxString msg;
int Internal_Unit = m_Parent->m_InternalUnits;
for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_TracksWidthList[ii], Internal_Unit, false );
m_gridTrackWidthList->SetCellValue( ii, 0, msg );
}
for( unsigned ii = 0; ii < m_ViasDiameterList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDiameterList[ii], Internal_Unit, false );
m_gridViaSizeList->SetCellValue( ii, 0, msg );
}
// recompute the column widths here, after setting texts
m_gridViaSizeList->SetColumnWidth( 0, wxLIST_AUTOSIZE );
m_gridTrackWidthList->SetColumnWidth( 0, wxLIST_AUTOSIZE );
}
// Sort comparison function (helper for makePointers() )
static bool sortByClassThenName( NETCUP* a, NETCUP* b )
......@@ -433,7 +469,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
}
/*************************************************/
bool DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
/*************************************************/
{
g_DesignSettings.m_CurrentViaType = VIA_THROUGH;
......@@ -457,8 +493,50 @@ bool DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
// Update tracks minimum values for DRC
g_DesignSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
}
return true;
/*******************************************************************/
void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( )
/*******************************************************************/
{
wxString msg;
// Reinitialize m_TrackWidthList
m_TracksWidthList.clear();
for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
{
msg = m_gridTrackWidthList->GetCellValue( row, 0 );
if( msg.IsEmpty() )
continue;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
m_TracksWidthList.push_back( value);
}
// Sort new list by by increasing value
sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
// Reinitialize m_TrackWidthList
m_ViasDiameterList.clear();
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
{
msg = m_gridViaSizeList->GetCellValue( row, 0 );
if( msg.IsEmpty() )
continue;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
m_ViasDiameterList.push_back( value);
}
// Sort new list by by increasing value
sort( m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
std::vector <int>* list = &m_Parent->GetBoard()->m_TrackWidthList;
list->erase( list->begin() + 1, list->end() ); // Remove old "custom" sizes
list->insert( list->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
// Reinitialize m_ViaSizeList
list = &m_Parent->GetBoard()->m_ViaSizeList;
list->erase( list->begin() + 1, list->end() );
list->insert( list->end(), m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
m_Parent->m_TrackAndViasSizesList_Changed = true;
}
......@@ -482,6 +560,7 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
CopyRulesListToBoard();
CopyGlobalRulesToBoard();
CopyDimensionsListsToBoard( );
EndModal( wxID_OK );
......@@ -743,7 +822,9 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
wxString msg;
int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits );
int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits );
int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits );
int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits );
int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits );
......@@ -767,7 +848,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_grid->GetCellValue( row, GRID_VIASIZE ),
m_Parent->m_InternalUnits );
if( viadia < g_DesignSettings.m_ViasMinSize )
if( viadia < minViaDia )
{
result = false;
msg.Printf( _( "%s: <b>Via Diameter</b> &lt; <b>Minimun Via Diameter</b><br>" ),
......@@ -802,7 +883,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_grid->GetCellValue( row, GRID_uVIASIZE ),
m_Parent->m_InternalUnits );
if( muviadia < g_DesignSettings.m_MicroViasMinSize )
if( muviadia < minUViaDia )
{
result = false;
msg.Printf( _( "%s: <b>MicroVia Diameter</b> &lt; <b>MicroVia Min Diameter</b><br>" ),
......@@ -833,5 +914,60 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
}
}
// Test list of values for specific vias and tracks
for( int row = 1; row < m_gridTrackWidthList->GetNumberRows(); ++row )
{
wxString tvalue = m_gridTrackWidthList->GetCellValue(row, 0);
if( tvalue.IsEmpty() )
continue;
int tracksize = ReturnValueFromString( g_UnitMetric,
tvalue,
m_Parent->m_InternalUnits );
if( tracksize < minTrackWidth )
{
result = false;
msg.Printf( _( "<b>Extra Track %d Size</b> %s &lt; <b>Min Track Size</b><br>" ),
row+1, GetChars( tvalue ) );
m_MessagesList->AppendToPage( msg );
}
if( tracksize > 10000 )
{
result = false;
msg.Printf( _( "<b>Extra Track %d Size</b> %s &gt; <b>1 inch!</b><br>" ),
row+1, GetChars( tvalue ) );
m_MessagesList->AppendToPage( msg );
}
}
for( int row = 1; row < m_gridViaSizeList->GetNumberRows(); ++row )
{
wxString tvalue = m_gridViaSizeList->GetCellValue(row, 0);
if( tvalue.IsEmpty() )
continue;
int viadia = ReturnValueFromString( g_UnitMetric,
tvalue,
m_Parent->m_InternalUnits );
if( viadia < minViaDia )
{
result = false;
msg.Printf( _( "<b>Extra Via %d Size</b> %s &lt; <b>Min Via Size</b><br>" ),
row+1, GetChars( tvalue ) );
m_MessagesList->AppendToPage( msg );
}
if( viadia > 10000 )
{
result = false;
msg.Printf( _( "<b>Extra Via %d Size</b>%s &gt; <b>1 inch!</b><br>" ),
row+1, GetChars( tvalue ) );
m_MessagesList->AppendToPage( msg );
}
}
return result;
}
......@@ -42,6 +42,10 @@ private:
*/
NETCUPS m_AllNets;
// List of values to "customize" some tracks and vias
std::vector <int> m_ViasDiameterList;
std::vector <int> m_TracksWidthList;
private:
void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); }
void OnNetClassesNameRightClick( wxGridEvent& event ){ event.Skip(); }
......@@ -60,9 +64,11 @@ private:
void InitDialogRules();
void InitGlobalRules();
void InitRulesList();
void InitDimensionsLists();
void InitializeRulesSelectionBoxes();
void CopyRulesListToBoard();
bool CopyGlobalRulesToBoard();
void CopyGlobalRulesToBoard();
void CopyDimensionsListsToBoard( );
void SetRoutableLayerStatus();
void FillListBoxWithNetNames( wxListCtrl* aListCtrl, const wxString& aNetClass );
void PrintCurrentSettings( );
......
......@@ -251,10 +251,107 @@ DIALOG_DESIGN_RULES_BASE::DIALOG_DESIGN_RULES_BASE( wxWindow* parent, wxWindowID
bpanelGlobRulesSizer->Add( bDesignRulesUpperSizer, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bpanelGlobRulesSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_staticTextInfo = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("List of specific vias diameters and specific tracks widths\nThese values can be used to replace default Netclasses values, on demand,\nfor some vias or track segments"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
bpanelGlobRulesSizer->Add( m_staticTextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
wxBoxSizer* bDesignRulesLowerSizer;
bDesignRulesLowerSizer = new wxBoxSizer( wxHORIZONTAL );
bpanelGlobRulesSizer->Add( bDesignRulesLowerSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sViaSizeBox;
sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Vias Custom Sizes List:") ), wxVERTICAL );
m_staticText7 = new wxStaticText( m_panelGolbalDesignRules, wxID_ANY, _("A 0 value or blank means default Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
sViaSizeBox->Add( m_staticText7, 0, wxALL, 5 );
m_gridViaSizeList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridViaSizeList->CreateGrid( 7, 2 );
m_gridViaSizeList->EnableEditing( true );
m_gridViaSizeList->EnableGridLines( true );
m_gridViaSizeList->EnableDragGridSize( false );
m_gridViaSizeList->SetMargins( 0, 0 );
// Columns
m_gridViaSizeList->EnableDragColMove( false );
m_gridViaSizeList->EnableDragColSize( true );
m_gridViaSizeList->SetColLabelSize( 30 );
m_gridViaSizeList->SetColLabelValue( 0, _("Diameter") );
m_gridViaSizeList->SetColLabelValue( 1, _("Drill") );
m_gridViaSizeList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridViaSizeList->EnableDragRowSize( true );
m_gridViaSizeList->SetRowLabelSize( 80 );
m_gridViaSizeList->SetRowLabelValue( 0, _("Via 1") );
m_gridViaSizeList->SetRowLabelValue( 1, _("Via 2") );
m_gridViaSizeList->SetRowLabelValue( 2, _("Via 3") );
m_gridViaSizeList->SetRowLabelValue( 3, _("Via 4") );
m_gridViaSizeList->SetRowLabelValue( 4, _("Via 5") );
m_gridViaSizeList->SetRowLabelValue( 5, _("Via 6") );
m_gridViaSizeList->SetRowLabelValue( 6, _("Via 7") );
m_gridViaSizeList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridViaSizeList->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sViaSizeBox->Add( m_gridViaSizeList, 0, wxALL, 5 );
bDesignRulesLowerSizer->Add( sViaSizeBox, 0, wxALL, 5 );
wxStaticBoxSizer* sbTracksListSizer;
sbTracksListSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGolbalDesignRules, wxID_ANY, _("Tracks Custom Widths List:") ), wxHORIZONTAL );
m_gridTrackWidthList = new wxGrid( m_panelGolbalDesignRules, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridTrackWidthList->CreateGrid( 7, 1 );
m_gridTrackWidthList->EnableEditing( true );
m_gridTrackWidthList->EnableGridLines( true );
m_gridTrackWidthList->EnableDragGridSize( false );
m_gridTrackWidthList->SetMargins( 0, 0 );
// Columns
m_gridTrackWidthList->EnableDragColMove( false );
m_gridTrackWidthList->EnableDragColSize( true );
m_gridTrackWidthList->SetColLabelSize( 30 );
m_gridTrackWidthList->SetColLabelValue( 0, _("Width") );
m_gridTrackWidthList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridTrackWidthList->SetRowSize( 0, 17 );
m_gridTrackWidthList->SetRowSize( 1, 17 );
m_gridTrackWidthList->SetRowSize( 2, 17 );
m_gridTrackWidthList->SetRowSize( 3, 17 );
m_gridTrackWidthList->SetRowSize( 4, 17 );
m_gridTrackWidthList->SetRowSize( 5, 17 );
m_gridTrackWidthList->SetRowSize( 6, 17 );
m_gridTrackWidthList->EnableDragRowSize( true );
m_gridTrackWidthList->SetRowLabelSize( 80 );
m_gridTrackWidthList->SetRowLabelValue( 0, _("Track 1") );
m_gridTrackWidthList->SetRowLabelValue( 1, _("Track 2") );
m_gridTrackWidthList->SetRowLabelValue( 2, _("Track 3") );
m_gridTrackWidthList->SetRowLabelValue( 3, _("Track 4") );
m_gridTrackWidthList->SetRowLabelValue( 4, _("Track 5") );
m_gridTrackWidthList->SetRowLabelValue( 5, _("Track 6") );
m_gridTrackWidthList->SetRowLabelValue( 6, _("Track 7") );
m_gridTrackWidthList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridTrackWidthList->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
sbTracksListSizer->Add( m_gridTrackWidthList, 0, wxALL, 5 );
bDesignRulesLowerSizer->Add( sbTracksListSizer, 0, wxALL, 5 );
bpanelGlobRulesSizer->Add( bDesignRulesLowerSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelGolbalDesignRules->SetSizer( bpanelGlobRulesSizer );
m_panelGolbalDesignRules->Layout();
......
This diff is collapsed.
......@@ -28,6 +28,7 @@
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/notebook.h>
#include <wx/html/htmlwin.h>
#include <wx/dialog.h>
......@@ -79,6 +80,11 @@ class DIALOG_DESIGN_RULES_BASE : public wxDialog
wxTextCtrl* m_SetMicroViasMinDrillCtrl;
wxStaticText* m_TrackMinWidthTitle;
wxTextCtrl* m_SetTrackMinWidthCtrl;
wxStaticLine* m_staticline1;
wxStaticText* m_staticTextInfo;
wxStaticText* m_staticText7;
wxGrid* m_gridViaSizeList;
wxGrid* m_gridTrackWidthList;
wxHtmlWindow* m_MessagesList;
wxStdDialogButtonSizer* m_sdbButtonsSizer;
wxButton* m_sdbButtonsSizerOK;
......
......@@ -27,6 +27,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = false;
if( DrawStruct && DrawStruct->m_Flags ) // "POPUP" in progress
{
DrawPanel->m_IgnoreMouseEvents = true;
......@@ -113,6 +114,25 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
}
if( DrawStruct ) // display netclass info for zones, tracks and pads
{
switch( DrawStruct->Type() )
{
case TYPE_ZONE_CONTAINER:
case TYPE_TRACK:
case TYPE_VIA:
case TYPE_PAD:
GetBoard()->SetCurrentNetClass(
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
break;
default:
break;
}
}
switch( m_ID_current_state )
{
case ID_MAIN_MENUBAR:
......
......@@ -400,12 +400,17 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
/******************************************************************************/
/* Create command lines for a popup menu, for track editing
* also update Netclass selection
*/
{
wxPoint cursorPosition = GetScreen()->m_Curseur;
wxString msg;
int flags = Track->m_Flags;
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
int flags = Track->m_Flags;
if( flags == 0 )
{
if( Track->Type() == TYPE_VIA )
......@@ -416,13 +421,15 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, via_mnu,
ID_POPUP_PCB_VIA_EDITING, _( "Edit Via Drill" ), edit_xpm );
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
_( "Set Via Hole to Default" ), apply_xpm );
msg = _( "Set via hole to a specific value. This specific value is currently" );
_( "Set Via Hole to Netclass Default" ), apply_xpm );
msg = _( "Set Via Hole to the Specific Value" );
msg << wxT( " " ) << ReturnStringFromValue( g_UnitMetric,
g_DesignSettings.m_ViaDrillCustomValue,
m_InternalUnits );
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
_( "Set Via Hole to Specific Value" ), msg,
msg,
_("Set via hole to a specific value, rather than its default Netclass value."),
options_new_pad_xpm );
msg = _( "Set a specific via hole value. This value is currently" );
msg << wxT( " " ) << ReturnStringFromValue( g_UnitMetric,
......@@ -435,7 +442,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS,
_( "Export this Via Hole to Others id Vias" ), global_options_pad_xpm );
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT,
_( "Set ALL Via Holes to Default" ), apply_xpm );
_( "Set All Via Holes to Netclass Default" ), apply_xpm );
if( Track->IsDrillDefault() ) // Can't export the drill value, because this value is 0 (default)
{
via_mnu->Enable( ID_POPUP_PCB_VIA_HOLE_EXPORT, FALSE );
......@@ -499,12 +506,16 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_EDIT_TRACK_MNU, _(
"Change Tracks and Vias Sizes" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,
Track->Type()==TYPE_VIA ? _( "Change Via Size" ) : _(
"Change Segment Width" ), width_segment_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,
if( Track->Type() == TYPE_VIA )
{
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,_( "Change Via Size" ), width_segment_xpm );
}
else
{
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG, _( "Change Segment Width" ), width_segment_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,
_( "Change Track Width" ), width_track_xpm );
}
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET,
_( "Set Net to NetClass values" ), width_net_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
......@@ -725,7 +736,9 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
/************************************************************************/
void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
/************************************************************************/
/* Create pop menu for pads */
/* Create pop menu for pads
* also update Netclass selection
*/
{
wxMenu* sub_menu_Pad;
int flags = Pad->m_Flags;
......@@ -733,6 +746,10 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
if( flags ) // Currently in edit, no others commands possible
return;
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
wxString msg = Pad->MenuText( GetBoard() );
sub_menu_Pad = new wxMenu;
......
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