Fix assert launching PCBNew.

This commit is contained in:
Jeff Young 2019-06-01 00:06:25 +01:00
parent f1076c0f48
commit ed9153a786
13 changed files with 4 additions and 141 deletions

View File

@ -98,7 +98,6 @@ static const EDA_COLOR_T default_items_color[] = {
COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType ) COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType )
{ {
m_frameType = aFrameType; m_frameType = aFrameType;
m_legacyMode = false;
for( unsigned src = 0, dst = 0; dst < arrayDim( m_LayersColors ); ++dst ) for( unsigned src = 0, dst = 0; dst < arrayDim( m_LayersColors ); ++dst )
{ {
@ -126,10 +125,8 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType )
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{ {
if( (unsigned) aLayer < arrayDim( m_LayersColors ) ) if( (unsigned) aLayer < arrayDim( m_LayersColors ) )
{ return m_LayersColors[aLayer];
return m_legacyMode ? m_LayersColors[aLayer].AsLegacyColor()
: m_LayersColors[aLayer];
}
return COLOR4D::UNSPECIFIED; return COLOR4D::UNSPECIFIED;
} }
@ -137,19 +134,14 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor ) void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{ {
if( (unsigned) aLayer < arrayDim( m_LayersColors ) ) if( (unsigned) aLayer < arrayDim( m_LayersColors ) )
{
m_LayersColors[aLayer] = aColor; m_LayersColors[aLayer] = aColor;
}
} }
COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{ {
if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) ) if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) )
{ return m_LayersColors[aItemIdx];
return m_legacyMode ? m_LayersColors[aItemIdx].AsLegacyColor()
: m_LayersColors[aItemIdx];
}
return COLOR4D::UNSPECIFIED; return COLOR4D::UNSPECIFIED;
} }
@ -158,9 +150,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor ) void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
{ {
if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) ) if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) )
{
m_LayersColors[aItemIdx] = aColor; m_LayersColors[aItemIdx] = aColor;
}
} }

View File

@ -781,7 +781,7 @@ double EDA_DRAW_FRAME::bestZoom( double sizeX, double sizeY, double scaleFactor,
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
{ {
wxFAIL_MSG( "Obsolete! Should go through COMMON_TOOLS." ); m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
} }

View File

@ -92,27 +92,10 @@ public:
*/ */
void SetAllColorsAs( COLOR4D aColor ); void SetAllColorsAs( COLOR4D aColor );
/**
* Enables or disables legacy color mode. When enabled, all colors will be
* quantized to the legacy color palette when returned from GetItemColor and
* GetLayerColor (but the underlying color will not be changed, and can
* still be set to arbitrary colors).
*/
void SetLegacyMode( bool aMode )
{
m_legacyMode = aMode;
}
private: private:
FRAME_T m_frameType; FRAME_T m_frameType;
/**
* @see SetLegacyMode()
*/
bool m_legacyMode;
void setupConfigParams(); void setupConfigParams();
}; };
#endif // COLORS_DESIGN_SETTING_H #endif // COLORS_DESIGN_SETTING_H

View File

@ -49,7 +49,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
rotationAngle = AngleToStringDegrees( (double)m_Frame->GetRotationAngle() ); rotationAngle = AngleToStringDegrees( (double)m_Frame->GetRotationAngle() );
m_RotationAngle->SetValue( rotationAngle ); m_RotationAngle->SetValue( rotationAngle );
m_DrcOn->SetValue( m_Frame->Settings().m_legacyDrcOn );
m_TrackAutodel->SetValue( m_Frame->Settings().m_legacyAutoDeleteOldTrack ); m_TrackAutodel->SetValue( m_Frame->Settings().m_legacyAutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( m_Frame->Settings().m_legacyUse45DegreeTracks ); m_Track_45_Only_Ctrl->SetValue( m_Frame->Settings().m_legacyUse45DegreeTracks );
m_Segments_45_Only_Ctrl->SetValue( m_Frame->Settings().m_use45DegreeGraphicSegments ); m_Segments_45_Only_Ctrl->SetValue( m_Frame->Settings().m_use45DegreeGraphicSegments );
@ -74,7 +73,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) ); m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );
/* Updating the combobox to display the active layer. */ /* Updating the combobox to display the active layer. */
m_Frame->Settings().m_legacyDrcOn = m_DrcOn->GetValue();
m_Frame->Settings().m_legacyAutoDeleteOldTrack = m_TrackAutodel->GetValue(); m_Frame->Settings().m_legacyAutoDeleteOldTrack = m_TrackAutodel->GetValue();
m_Frame->Settings().m_use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue(); m_Frame->Settings().m_use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue();

View File

@ -108,9 +108,6 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
int diagdrc = OK_DRC; int diagdrc = OK_DRC;
return_code = TRACK_ACTION_SUCCESS; return_code = TRACK_ACTION_SUCCESS;
if( Settings().m_legacyDrcOn )
diagdrc = m_drc->DrcOnCreatingTrack( aTrackItem, GetBoard()->m_Track );
if( diagdrc != OK_DRC ) if( diagdrc != OK_DRC )
return_code = TRACK_ACTION_DRC_ERROR; return_code = TRACK_ACTION_DRC_ERROR;
} }

View File

@ -113,12 +113,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
// Vertical tool bar button click event handler.
EVT_TOOL( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
EVT_TOOL( ID_ZOOM_SELECTION, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL,
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
EVT_TOOL( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, FOOTPRINT_EDIT_FRAME::OnToggleSearchTree ) EVT_TOOL( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, FOOTPRINT_EDIT_FRAME::OnToggleSearchTree )
// Preferences and option menus // Preferences and option menus

View File

@ -153,8 +153,6 @@ public:
*/ */
void Show3D_Frame( wxCommandEvent& event ) override; void Show3D_Frame( wxCommandEvent& event ) override;
void OnVerticalToolbar( wxCommandEvent& aEvent );
/** /**
* Handle most of tools og the vertical right toolbar ("Tools" toolbar) * Handle most of tools og the vertical right toolbar ("Tools" toolbar)
*/ */

View File

@ -486,80 +486,6 @@ void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
} }
void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
int lastToolID = GetToolId();
// Stop the current command and deselect the current tool.
SetNoToolSelected();
switch( id )
{
case ID_NO_TOOL_SELECTED:
break;
case ID_ZOOM_SELECTION:
// This tool is located on the main toolbar: switch it on or off on click on it
if( lastToolID != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetNoToolSelected();
break;
case ID_MODEDIT_LINE_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
break;
case ID_MODEDIT_ARC_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
break;
case ID_MODEDIT_CIRCLE_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
break;
case ID_MODEDIT_TEXT_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
break;
case ID_MODEDIT_ANCHOR_TOOL:
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
break;
case ID_MODEDIT_PLACE_GRID_COORD:
SetToolID( id, wxCURSOR_PENCIL, _( "Set grid origin" ) );
break;
case ID_MODEDIT_PAD_TOOL:
if( GetBoard()->m_Modules )
{
SetToolID( id, wxCURSOR_PENCIL, _( "Add pad" ) );
}
else
{
SetToolID( id, wxCURSOR_ARROW, _( "Pad properties" ) );
InstallPadOptionsFrame( NULL );
SetNoToolSelected();
}
break;
case ID_MODEDIT_DELETE_TOOL:
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
break;
case ID_MODEDIT_MEASUREMENT_TOOL:
DisplayError( this, wxT( "Measurement Tool not available in Legacy Toolset" ) );
SetNoToolSelected();
break;
default:
wxFAIL_MSG( wxT( "Unknown command id." ) );
SetNoToolSelected();
}
}
void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
{ {
switch( aItem->Type() ) switch( aItem->Type() )

View File

@ -208,7 +208,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
#endif #endif
// Option toolbar // Option toolbar
EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
PCB_EDIT_FRAME::OnSelectOptionToolbar ) PCB_EDIT_FRAME::OnSelectOptionToolbar )
@ -233,7 +232,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// User interface update event handlers. // User interface update event handlers.
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox ) EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox )
EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar ) EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar ) EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )

View File

@ -313,7 +313,6 @@ public:
void OnUpdateSave( wxUpdateUIEvent& aEvent ); void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent ); void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
bool LayerManagerShown(); bool LayerManagerShown();
bool MicrowaveToolbarShown(); bool MicrowaveToolbarShown();
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ); void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );

View File

@ -50,9 +50,6 @@ public:
return m_colorsSettings; return m_colorsSettings;
} }
bool m_legacyDrcOn = true; // Not stored, always true when starting pcbnew,
// false only on request during routing, and
// always for temporary use
bool m_legacyAutoDeleteOldTrack = true; bool m_legacyAutoDeleteOldTrack = true;
bool m_legacyUse45DegreeTracks = true; // True to allow horiz, vert. and 45deg only tracks bool m_legacyUse45DegreeTracks = true; // True to allow horiz, vert. and 45deg only tracks
static bool m_use45DegreeGraphicSegments; // True to allow horizontal, vertical and static bool m_use45DegreeGraphicSegments; // True to allow horizontal, vertical and

View File

@ -165,7 +165,6 @@ enum pcbnew_ids
ID_BOARD_SETUP_DIALOG, ID_BOARD_SETUP_DIALOG,
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
ID_TB_OPTIONS_DRC_OFF,
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_START_CMD,

View File

@ -344,8 +344,6 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiScaledBitmap( drc_off_xpm, this ),
_( "Enable design rule checking" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
@ -679,10 +677,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_DRC_OFF:
Settings().m_legacyDrcOn = !state;
break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
m_show_microwave_tools = state; m_show_microwave_tools = state;
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
@ -752,16 +746,6 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
#endif #endif
void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
{
bool state = !Settings().m_legacyDrcOn;
aEvent.Check( state );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
Settings().m_legacyDrcOn ?
_( "Disable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) :
_( "Enable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) );
}
bool PCB_EDIT_FRAME::LayerManagerShown() bool PCB_EDIT_FRAME::LayerManagerShown()
{ {
return m_auimgr.GetPane( "LayersManager" ).IsShown(); return m_auimgr.GetPane( "LayersManager" ).IsShown();