From ed9153a786ab3229f1538ea68f41e6ebc6060538 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 1 Jun 2019 00:06:25 +0100 Subject: [PATCH] Fix assert launching PCBNew. --- common/colors_design_settings.cpp | 16 +---- common/legacy_gal/eda_draw_frame.cpp | 2 +- include/colors_design_settings.h | 17 ------ pcbnew/dialogs/panel_pcbnew_settings.cpp | 2 - pcbnew/edit_track_width.cpp | 3 - pcbnew/footprint_edit_frame.cpp | 6 -- pcbnew/footprint_edit_frame.h | 2 - pcbnew/footprint_editor_utils.cpp | 74 ------------------------ pcbnew/pcb_edit_frame.cpp | 2 - pcbnew/pcb_edit_frame.h | 1 - pcbnew/pcb_general_settings.h | 3 - pcbnew/pcbnew_id.h | 1 - pcbnew/toolbars_pcb_editor.cpp | 16 ----- 13 files changed, 4 insertions(+), 141 deletions(-) diff --git a/common/colors_design_settings.cpp b/common/colors_design_settings.cpp index d275d905f5..67c764890a 100644 --- a/common/colors_design_settings.cpp +++ b/common/colors_design_settings.cpp @@ -98,7 +98,6 @@ static const EDA_COLOR_T default_items_color[] = { COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType ) { m_frameType = aFrameType; - m_legacyMode = false; 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 { if( (unsigned) aLayer < arrayDim( m_LayersColors ) ) - { - return m_legacyMode ? m_LayersColors[aLayer].AsLegacyColor() - : m_LayersColors[aLayer]; - } + return m_LayersColors[aLayer]; + 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 ) { if( (unsigned) aLayer < arrayDim( m_LayersColors ) ) - { m_LayersColors[aLayer] = aColor; - } } COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const { if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) ) - { - return m_legacyMode ? m_LayersColors[aItemIdx].AsLegacyColor() - : m_LayersColors[aItemIdx]; - } + return m_LayersColors[aItemIdx]; return COLOR4D::UNSPECIFIED; } @@ -158,9 +150,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor ) { if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) ) - { m_LayersColors[aItemIdx] = aColor; - } } diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp index 46463ff383..65aeee9262 100644 --- a/common/legacy_gal/eda_draw_frame.cpp +++ b/common/legacy_gal/eda_draw_frame.cpp @@ -781,7 +781,7 @@ double EDA_DRAW_FRAME::bestZoom( double sizeX, double sizeY, double scaleFactor, void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) { - wxFAIL_MSG( "Obsolete! Should go through COMMON_TOOLS." ); + m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); } diff --git a/include/colors_design_settings.h b/include/colors_design_settings.h index 8323cefac1..079eacea05 100644 --- a/include/colors_design_settings.h +++ b/include/colors_design_settings.h @@ -92,27 +92,10 @@ public: */ 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: FRAME_T m_frameType; - /** - * @see SetLegacyMode() - */ - bool m_legacyMode; - void setupConfigParams(); - }; #endif // COLORS_DESIGN_SETTING_H diff --git a/pcbnew/dialogs/panel_pcbnew_settings.cpp b/pcbnew/dialogs/panel_pcbnew_settings.cpp index f6efab70d3..64cc2fe9ac 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_settings.cpp @@ -49,7 +49,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow() rotationAngle = AngleToStringDegrees( (double)m_Frame->GetRotationAngle() ); m_RotationAngle->SetValue( rotationAngle ); - m_DrcOn->SetValue( m_Frame->Settings().m_legacyDrcOn ); m_TrackAutodel->SetValue( m_Frame->Settings().m_legacyAutoDeleteOldTrack ); m_Track_45_Only_Ctrl->SetValue( m_Frame->Settings().m_legacyUse45DegreeTracks ); 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() ) ) ); /* 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_use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue(); diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 1d80928ad1..d3a3e9795d 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -108,9 +108,6 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, int diagdrc = OK_DRC; return_code = TRACK_ACTION_SUCCESS; - if( Settings().m_legacyDrcOn ) - diagdrc = m_drc->DrcOnCreatingTrack( aTrackItem, GetBoard()->m_Track ); - if( diagdrc != OK_DRC ) return_code = TRACK_ACTION_DRC_ERROR; } diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 4bcc2d8ea2..e562c93dea 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -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_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 ) // Preferences and option menus diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 7e988f6ee9..b50fdeddff 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -153,8 +153,6 @@ public: */ void Show3D_Frame( wxCommandEvent& event ) override; - void OnVerticalToolbar( wxCommandEvent& aEvent ); - /** * Handle most of tools og the vertical right toolbar ("Tools" toolbar) */ diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 42e541291a..f0a77be1e3 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -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 ) { switch( aItem->Type() ) diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index b3b0ad55c3..f65fb491d6 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -208,7 +208,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) #endif // Option toolbar - EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, PCB_EDIT_FRAME::OnSelectOptionToolbar ) @@ -233,7 +232,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) // User interface update event handlers. 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_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable ) 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_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth ) diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index a60e0e2450..02b2faa9e5 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -313,7 +313,6 @@ public: void OnUpdateSave( wxUpdateUIEvent& aEvent ); void OnUpdateLayerPair( wxUpdateUIEvent& aEvent ); void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); - void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent ); bool LayerManagerShown(); bool MicrowaveToolbarShown(); void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ); diff --git a/pcbnew/pcb_general_settings.h b/pcbnew/pcb_general_settings.h index a5ad24fdf1..1fed3300b6 100644 --- a/pcbnew/pcb_general_settings.h +++ b/pcbnew/pcb_general_settings.h @@ -50,9 +50,6 @@ public: 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_legacyUse45DegreeTracks = true; // True to allow horiz, vert. and 45deg only tracks static bool m_use45DegreeGraphicSegments; // True to allow horizontal, vertical and diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 49e244458a..6f08d955de 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -165,7 +165,6 @@ enum pcbnew_ids ID_BOARD_SETUP_DIALOG, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, - ID_TB_OPTIONS_DRC_OFF, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, ID_PCB_MUWAVE_START_CMD, diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 7306dc2082..a379d740c1 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -344,8 +344,6 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() wxDefaultPosition, wxDefaultSize, 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( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE ); @@ -679,10 +677,6 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { - case ID_TB_OPTIONS_DRC_OFF: - Settings().m_legacyDrcOn = !state; - break; - case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: m_show_microwave_tools = state; m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools ); @@ -752,16 +746,6 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent ) #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() { return m_auimgr.GetPane( "LayersManager" ).IsShown();