From 81d1e17f023587d6d40765b5acfe85249391279c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Mon, 30 Oct 2017 18:21:07 +0100 Subject: [PATCH] refactoring: renamed pcbstruct.h to pcb_display_options.h, DISPLAY_OPTIONS->PCB_DISPLAY_OPTIONS --- .../3d_cache/dialogs/dlg_select_3dmodel.h | 3 +- common/CMakeLists.txt | 3 +- cvpcb/class_DisplayFootprintsFrame.cpp | 10 +- cvpcb/dialogs/dialog_display_options.cpp | 4 +- include/class_board_design_settings.h | 1 - include/class_colors_design_settings.h | 6 +- include/common.h | 1 - include/pcb_display_options.h | 93 +++++ include/wxBasePcbFrame.h | 4 +- pcbnew/autorouter/auto_place_footprints.cpp | 2 +- pcbnew/basepcbframe.cpp | 17 +- pcbnew/block.cpp | 2 +- pcbnew/class_board.cpp | 2 - pcbnew/class_dimension.cpp | 2 +- pcbnew/class_drawsegment.cpp | 4 +- pcbnew/class_edge_mod.cpp | 2 +- pcbnew/class_mire.cpp | 2 +- pcbnew/class_pad_draw_functions.cpp | 2 +- pcbnew/class_pcb_layer_widget.cpp | 4 +- pcbnew/class_pcb_text.cpp | 11 +- pcbnew/class_text_mod.cpp | 2 +- pcbnew/class_track.cpp | 15 +- pcbnew/class_track.h | 6 +- pcbnew/class_zone.cpp | 366 +++++++++--------- pcbnew/classpcb.cpp | 34 -- pcbnew/controle.cpp | 2 +- pcbnew/dialogs/dialog_display_options.cpp | 18 +- pcbnew/dialogs/dialog_general_options.cpp | 4 +- pcbnew/edit.cpp | 6 +- pcbnew/editedge.cpp | 4 +- pcbnew/editrack.cpp | 12 +- pcbnew/footprint_wizard_frame.cpp | 2 +- pcbnew/hotkeys_board_editor.cpp | 2 +- pcbnew/modeditoptions.cpp | 5 +- pcbnew/moduleframe.cpp | 2 +- pcbnew/modules.cpp | 4 +- pcbnew/move_or_drag_track.cpp | 2 +- pcbnew/pcb_display_options.cpp | 59 +++ pcbnew/pcb_draw_panel_gal.cpp | 4 +- pcbnew/pcb_painter.cpp | 14 +- pcbnew/pcb_painter.h | 6 +- pcbnew/pcbnew_config.cpp | 4 +- pcbnew/pcbplot.cpp | 1 - pcbnew/print_board_functions.cpp | 13 +- pcbnew/ratsnest.cpp | 4 +- pcbnew/router/pns_kicad_iface.cpp | 8 +- pcbnew/router/pns_kicad_iface.h | 4 +- pcbnew/router/pns_tool_base.cpp | 2 +- pcbnew/specctra_export.cpp | 1 - pcbnew/tool_pcb.cpp | 2 +- pcbnew/toolbars_update_user_interface.cpp | 8 +- pcbnew/tools/pcb_editor_control.cpp | 27 +- pcbnew/tools/pcbnew_control.cpp | 10 +- pcbnew/tracepcb.cpp | 2 +- 54 files changed, 473 insertions(+), 357 deletions(-) create mode 100644 include/pcb_display_options.h create mode 100644 pcbnew/pcb_display_options.cpp diff --git a/3d-viewer/3d_cache/dialogs/dlg_select_3dmodel.h b/3d-viewer/3d_cache/dialogs/dlg_select_3dmodel.h index 652f9880b7..73db022400 100644 --- a/3d-viewer/3d_cache/dialogs/dlg_select_3dmodel.h +++ b/3d-viewer/3d_cache/dialogs/dlg_select_3dmodel.h @@ -38,11 +38,10 @@ #include #include -struct MODULE_3D_SETTINGS; +class MODULE_3D_SETTINGS; class S3D_CACHE; class S3D_FILENAME_RESOLVER; class C3D_MODEL_VIEWER; -//class wxGenericDirCtrl; class DLG_SELECT_3DMODEL : public wxDialog { diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a81666cb74..37777b143c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -407,6 +407,7 @@ set( PCB_COMMON_SRCS ../pcbnew/kicad_clipboard.cpp ../pcbnew/gpcb_plugin.cpp ../pcbnew/pcb_netlist.cpp + ../pcbnew/pcb_display_options.cpp widgets/widget_net_selector.cpp pcb_plot_params_keywords.cpp pcb_keywords.cpp @@ -532,7 +533,7 @@ target_link_libraries( dsntest common ${wxWidgets_LIBRARIES} rt ) add_dependencies( dsntest lib-dependencies ) -target_link_libraries( pcbcommon 3d-viewer ) +target_link_libraries( pcbcommon ) # _kiway.so diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 243a020e23..fa61b768c6 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -96,11 +96,11 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRA GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ); // Initialize some display options - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); displ_opts->m_DisplayPadIsol = false; // Pad clearance has no meaning here // Track and via clearance has no meaning here. - displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; + displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE; SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); ReCreateHToolbar(); @@ -249,7 +249,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); wxString msgTextsFill[2] = { _( "Show texts in filled mode" ), _( "Show texts in sketch mode" ) }; @@ -264,7 +264,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ) void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ), _( "Show outlines in sketch mode" ) }; @@ -295,7 +295,7 @@ bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* Po void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { int id = event.GetId(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); switch( id ) { diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp index f7b579d84e..db07595077 100644 --- a/cvpcb/dialogs/dialog_display_options.cpp +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -72,7 +72,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() /* mandatory to use escape key as cancel under wxGTK. */ SetFocus(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); m_EdgesDisplayOption->SetValue( not displ_opts->m_DisplayModEdgeFill ); m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill ); @@ -89,7 +89,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Parent->GetDisplayOptions(); displ_opts->m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue(); displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 785c04ac05..f71c4faade 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -25,7 +25,6 @@ #ifndef BOARD_DESIGN_SETTINGS_H_ #define BOARD_DESIGN_SETTINGS_H_ -#include // NB_COLORS #include #include #include diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index 4d4dbdb71c..e8e6fa22bb 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -61,15 +61,13 @@ public: virtual void Save( wxConfigBase *aConfig ) override; /** * Function GetLayerColor - * @return the color for aLayer which is one of the layer indices given - * in pcbstruct.h or in schematic + * @return the color for aLayer which */ COLOR4D GetLayerColor( LAYER_NUM aLayer ) const; /** * Function SetLayerColor - * sets the color for aLayer which is one of the layer indices given - * in pcbstruct.h or in schematic + * sets the color for aLayer */ void SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor ); diff --git a/include/common.h b/include/common.h index d0337d5621..1aa79715d7 100644 --- a/include/common.h +++ b/include/common.h @@ -33,7 +33,6 @@ #define INCLUDE__COMMON_H_ #include -#include #include #include diff --git a/include/pcb_display_options.h b/include/pcb_display_options.h new file mode 100644 index 0000000000..d39b10ce1c --- /dev/null +++ b/include/pcb_display_options.h @@ -0,0 +1,93 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file pcb_display_options.h + * @brief Definition of PCB_DISPLAY_OPTIONS class + */ + +#ifndef PCB_DISPLAY_OPTIONS_H_ +#define PCB_DISPLAY_OPTIONS_H_ + +/** + * Class PCB_DISPLAY_OPTIONS + * handles display options like enable/disable some optional drawings. + */ +class PCB_DISPLAY_OPTIONS +{ +public: + + /** + * Enum TRACE_CLEARANCE_DISPLAY_MODE_T + * is the set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option. + * This parameter controls how to show tracks and vias clearance area. + */ + enum TRACE_CLEARANCE_DISPLAY_MODE_T { + DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas + SHOW_CLEARANCE_NEW_TRACKS, /* Show clearance areas only for new track + * during track creation. */ + SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, /* Show clearance areas only for new track + * during track creation, and shows a via + * clearance area at end of current new + * segment (guide to place a new via + */ + SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, + /* Show clearance for new, moving and + * dragging tracks and vias + */ + SHOW_CLEARANCE_ALWAYS /* Show Always clearance areas + * for track and vias + */ + }; + + bool m_DisplayPadFill; + bool m_DisplayViaFill; + bool m_DisplayPadNum; // show pads numbers + bool m_DisplayPadIsol; + bool m_DisplayModEdgeFill; // How to display module drawings ( sketch/ filled ) + bool m_DisplayModTextFill; // How to display module texts ( sketch/ filled ) + bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled. + + /// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T. + TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode; + + bool m_DisplayPolarCood; + int m_DisplayZonesMode; + int m_DisplayNetNamesMode; /* 0 do not show netnames, + * 1 show netnames on pads + * 2 show netnames on tracks + * 3 show netnames on tracks and pads + */ + + bool m_DisplayDrawItemsFill; // How to display graphic items on board ( sketch/ filled ) + bool m_ContrastModeDisplay; + int m_MaxLinksShowed; // in track creation: number of hairwires shown + bool m_Show_Module_Ratsnest; // When moving a footprint: allows displaying a ratsnest + +public: + + PCB_DISPLAY_OPTIONS(); +}; + +#endif // PCBSTRUCT_H_ diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index a3695ae961..6b0f23ee25 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -40,8 +40,8 @@ #include // EDA_DRAW_MODE_T #include #include -#include +#include #include /* Forward declarations of classes. */ @@ -68,7 +68,7 @@ class PCB_GENERAL_SETTINGS ; class PCB_BASE_FRAME : public EDA_DRAW_FRAME { public: - DISPLAY_OPTIONS m_DisplayOptions; + PCB_DISPLAY_OPTIONS m_DisplayOptions; EDA_UNITS_T m_UserGridUnit; wxRealPoint m_UserGridSize; diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp index e3987d85db..4b6b7ece75 100644 --- a/pcbnew/autorouter/auto_place_footprints.cpp +++ b/pcbnew/autorouter/auto_place_footprints.cpp @@ -618,7 +618,7 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD wxPoint LastPosOK; double min_cost, curr_cost, Score; bool TstOtherSide; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aFrame->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)aFrame->GetDisplayOptions(); BOARD* brd = aFrame->GetBoard(); aModule->CalculateBoundingBox(); diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 2cff66e00c..579a956704 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -382,7 +382,7 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event ) void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) { PCB_LAYER_ID preslayer = GetActiveLayer(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); // Check if the specified layer matches the present layer if( layer == preslayer ) @@ -431,7 +431,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); SetStatusText( wxEmptyString ); displ_opts->m_DisplayPolarCood = !displ_opts->m_DisplayPolarCood; @@ -442,7 +442,7 @@ void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent ) void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill; EDA_DRAW_PANEL_GAL* gal = GetGalCanvas(); @@ -470,7 +470,7 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent ) void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); aEvent.Check( displ_opts->m_DisplayPolarCood ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD, @@ -482,7 +482,8 @@ void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent ) void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); + aEvent.Check( !displ_opts->m_DisplayPadFill ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH, displ_opts->m_DisplayPadFill ? @@ -621,7 +622,7 @@ void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg ) if( aId < 0 ) return; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); // handle color changes for transitions in and out of ID_TRACK_BUTT if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT ) @@ -654,7 +655,7 @@ void PCB_BASE_FRAME::UpdateStatusBar() double dYpos; wxString line; wxString locformatter; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); EDA_DRAW_FRAME::UpdateStatusBar(); @@ -983,7 +984,7 @@ void PCB_BASE_FRAME::UseGalCanvas( bool aEnable ) // Transfer latest current display options from legacy to GAL canvas: auto painter = static_cast( galCanvas->GetView()->GetPainter() ); auto settings = painter->GetSettings(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); settings->LoadDisplayOptions( displ_opts ); galCanvas->GetView()->RecacheAllItems(); diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 86a130c947..3dbdacfa89 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -489,7 +489,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a BASE_SCREEN* screen = aPanel->GetScreen(); // do not show local module rastnest in block move, it is not usable. - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aPanel->GetDisplayOptions() ); bool showRats = displ_opts->m_Show_Module_Ratsnest; displ_opts->m_Show_Module_Ratsnest = false; diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1b3d1551ef..8f2ccb8317 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1088,7 +1088,6 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const } -// virtual, see pcbstruct.h void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString txt; @@ -1123,7 +1122,6 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) } -// virtual, see pcbstruct.h SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) { KICAD_T stype; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 5e4abeb1e0..3724d90b4c 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -327,7 +327,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer ); GRSetDrawMode( DC, mode_color ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; int width = m_Width; diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index d3fbdbf86c..7629469812 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -217,7 +217,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, auto frame = static_cast ( panel->GetParent() ); auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) panel->GetDisplayOptions(); if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) { @@ -331,8 +331,6 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, } } - -// see pcbstruct.h void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index a080fa885b..3d948df58e 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -123,7 +123,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, auto frame = static_cast ( panel->GetParent() ); auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) { diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 6f8e70f40b..fc5c5ee6f8 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -93,7 +93,7 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, auto gcolor = frame->Settings().Colors().GetLayerColor( m_Layer ); GRSetDrawMode( DC, mode_color ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); bool filled = displ_opts ? displ_opts->m_DisplayDrawItemsFill : FILLED; width = m_Width; diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 620e0b45cc..1ad11b0f0c 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -127,7 +127,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, wxCHECK_RET( frame != NULL, wxT( "Panel has no parent frame window." ) ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( frame->GetDisplayOptions() ); PCB_SCREEN* screen = frame->GetScreen(); if( displ_opts && displ_opts->m_DisplayPadFill == SKETCH ) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 7a25f4e462..a5b44b1634 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include @@ -562,7 +562,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) return false; myframe->SetActiveLayer( layer ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)myframe->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)myframe->GetDisplayOptions(); if( m_alwaysShowActiveCopperLayer ) OnLayerSelected(); diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 33c517c10a..c0acff6338 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -69,12 +69,12 @@ void TEXTE_PCB::SetTextAngle( double aAngle ) void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE DrawMode, const wxPoint& offset ) { - wxASSERT( panel ); + wxASSERT( panel ); if( !panel ) return; - BOARD* brd = GetBoard(); + BOARD* brd = GetBoard(); if( brd->IsLayerVisible( m_Layer ) == false ) return; @@ -83,7 +83,12 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); EDA_DRAW_MODE_T fillmode = FILLED; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = nullptr; + + if( panel ) + { + displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); + } if( displ_opts && displ_opts->m_DisplayDrawItemsFill == SKETCH ) fillmode = SKETCH; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 933e65228e..e5a2b8b5a3 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -254,7 +254,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod color = frame->Settings().Colors().GetItemColor( LAYER_MOD_TEXT_INVISIBLE ); } - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( aPanel->GetDisplayOptions() ); // shade text if high contrast mode is active if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay ) diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 7f3f0a0358..4984c4ab95 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -29,6 +29,7 @@ * @brief Functions relatives to tracks, vias and segments used to fill zones. */ + #include #include #include @@ -51,14 +52,14 @@ * tests to see if the clearance border is drawn on the given track. * @return bool - true if should draw clearance, else false. */ -static bool ShowClearance( DISPLAY_OPTIONS* aDisplOpts, const TRACK* aTrack ) +static bool ShowClearance( PCB_DISPLAY_OPTIONS* aDisplOpts, const TRACK* aTrack ) { // maybe return true for tracks and vias, not for zone segments return IsCopperLayer( aTrack->GetLayer() ) && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T ) - && ( ( aDisplOpts->m_ShowTrackClearanceMode == SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS + && ( ( aDisplOpts->m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) ) - || ( aDisplOpts->m_ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS ) + || ( aDisplOpts->m_ShowTrackClearanceMode == PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS ) ); } @@ -554,7 +555,7 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel, * - only tracks with a length > 10 * thickness are eligible * and, of course, if we are not printing the board */ - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); if( displ_opts->m_DisplayNetNamesMode == 0 || displ_opts->m_DisplayNetNamesMode == 1 ) return; @@ -649,7 +650,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, return; #endif - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay ) { @@ -701,7 +702,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); if( displ_opts->m_DisplayZonesMode != 0 ) return; @@ -789,7 +790,7 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w int fillvia = 0; PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); PCB_SCREEN* screen = frame->GetScreen(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( frame->GetDisplayOptions() ); if( displ_opts->m_DisplayViaFill == FILLED ) fillvia = 1; diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 3535eb3618..542dba3fa0 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -34,7 +34,9 @@ #include #include #include -#include +#include + +//#include #include @@ -42,7 +44,7 @@ class TRACK; class VIA; class D_PAD; class MSG_PANEL_ITEM; - +class SHAPE_POLY_SET; // Via types // Note that this enum must be synchronized to GAL_LAYER_ID diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 6029d937e1..94c0541300 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -179,107 +179,107 @@ const wxPoint& ZONE_CONTAINER::GetPosition() const } -PCB_LAYER_ID ZONE_CONTAINER::GetLayer() const -{ - return BOARD_ITEM::GetLayer(); -} - - -bool ZONE_CONTAINER::IsOnCopperLayer() const -{ - if( GetIsKeepout() ) - { - return ( m_layerSet & LSET::AllCuMask() ).count() > 0; - } - else - { - return IsCopperLayer( GetLayer() ); - } -} - - -bool ZONE_CONTAINER::CommonLayerExists( const LSET aLayerSet ) const -{ - LSET common = GetLayerSet() & aLayerSet; - - return common.count() > 0; -} - - -void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer ) -{ - SetLayerSet( LSET( aLayer ) ); - - m_Layer = aLayer; -} - - -void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) -{ - if( GetIsKeepout() ) - { - // Keepouts can only exist on copper layers - aLayerSet &= LSET::AllCuMask(); - } - +PCB_LAYER_ID ZONE_CONTAINER::GetLayer() const +{ + return BOARD_ITEM::GetLayer(); +} + + +bool ZONE_CONTAINER::IsOnCopperLayer() const +{ + if( GetIsKeepout() ) + { + return ( m_layerSet & LSET::AllCuMask() ).count() > 0; + } + else + { + return IsCopperLayer( GetLayer() ); + } +} + + +bool ZONE_CONTAINER::CommonLayerExists( const LSET aLayerSet ) const +{ + LSET common = GetLayerSet() & aLayerSet; + + return common.count() > 0; +} + + +void ZONE_CONTAINER::SetLayer( PCB_LAYER_ID aLayer ) +{ + SetLayerSet( LSET( aLayer ) ); + + m_Layer = aLayer; +} + + +void ZONE_CONTAINER::SetLayerSet( LSET aLayerSet ) +{ + if( GetIsKeepout() ) + { + // Keepouts can only exist on copper layers + aLayerSet &= LSET::AllCuMask(); + } + if( aLayerSet.count() == 0 ) { return; } - m_layerSet = aLayerSet; - - // Set the single layer to the first selected layer - m_Layer = aLayerSet.Seq()[0]; -} - - -LSET ZONE_CONTAINER::GetLayerSet() const -{ - // TODO - Enable multi-layer zones for all zone types - // not just keepout zones - if( GetIsKeepout() ) - { - return m_layerSet; - } - else - { - return LSET( m_Layer ); - } -} - -void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const -{ - if( GetIsKeepout() ) - { - LSEQ layers = m_layerSet.Seq(); - - for( unsigned int idx = 0; idx < layers.size(); idx++ ) - { - aLayers[idx] = layers[idx]; - } - - aCount = layers.size(); - } - else - { - aLayers[0] = m_Layer; - aCount = 1; - } -} - - -bool ZONE_CONTAINER::IsOnLayer( PCB_LAYER_ID aLayer ) const -{ - if( GetIsKeepout() ) - { - return m_layerSet.test( aLayer ); - } - - return BOARD_ITEM::IsOnLayer( aLayer ); -} - - + m_layerSet = aLayerSet; + + // Set the single layer to the first selected layer + m_Layer = aLayerSet.Seq()[0]; +} + + +LSET ZONE_CONTAINER::GetLayerSet() const +{ + // TODO - Enable multi-layer zones for all zone types + // not just keepout zones + if( GetIsKeepout() ) + { + return m_layerSet; + } + else + { + return LSET( m_Layer ); + } +} + +void ZONE_CONTAINER::ViewGetLayers( int aLayers[], int& aCount ) const +{ + if( GetIsKeepout() ) + { + LSEQ layers = m_layerSet.Seq(); + + for( unsigned int idx = 0; idx < layers.size(); idx++ ) + { + aLayers[idx] = layers[idx]; + } + + aCount = layers.size(); + } + else + { + aLayers[0] = m_Layer; + aCount = 1; + } +} + + +bool ZONE_CONTAINER::IsOnLayer( PCB_LAYER_ID aLayer ) const +{ + if( GetIsKeepout() ) + { + return m_layerSet.test( aLayer ); + } + + return BOARD_ITEM::IsOnLayer( aLayer ); +} + + void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { @@ -292,89 +292,89 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod auto frame = static_cast ( panel->GetParent() ); - PCB_LAYER_ID draw_layer = UNDEFINED_LAYER; - - LSET layers = GetLayerSet() & brd->GetVisibleLayers(); - - // If there are no visible layers and the zone is not highlighted, return - if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) ) - { - return; - } - - /* Keepout zones can exist on multiple layers - * Thus, determining which color to use to render them is a bit tricky. - * In descending order of priority: - * - * 1. If in GR_HIGHLIGHT mode: - * a. If zone is on selected layer, use layer color! - * b. Else, use grey - * 1. Not in GR_HIGHLIGHT mode - * a. If zone is on selected layer, use layer color - * b. Else, use color of top-most (visible) layer - * - */ - if( GetIsKeepout() ) - { - // At least one layer must be provided! - assert( GetLayerSet().count() > 0 ); - - // Not on any visible layer? - if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) ) - { - return; - } - - // Is keepout zone present on the selected layer? - if( layers.test( curr_layer ) ) - { - draw_layer = curr_layer; - } - else - { - // Select the first (top) visible layer - if( layers.count() > 0 ) - { - draw_layer = layers.Seq()[0]; - } - else - { - draw_layer = GetLayerSet().Seq()[0]; - } - } - - } - /* Non-keepout zones are easier to deal with - */ - else - { - if( brd->IsLayerVisible( GetLayer() ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) - { - return; - } - - draw_layer = GetLayer(); - } - - assert( draw_layer != UNDEFINED_LAYER ); - - auto color = frame->Settings().Colors().GetLayerColor( draw_layer ); + PCB_LAYER_ID draw_layer = UNDEFINED_LAYER; + + LSET layers = GetLayerSet() & brd->GetVisibleLayers(); + + // If there are no visible layers and the zone is not highlighted, return + if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) ) + { + return; + } + + /* Keepout zones can exist on multiple layers + * Thus, determining which color to use to render them is a bit tricky. + * In descending order of priority: + * + * 1. If in GR_HIGHLIGHT mode: + * a. If zone is on selected layer, use layer color! + * b. Else, use grey + * 1. Not in GR_HIGHLIGHT mode + * a. If zone is on selected layer, use layer color + * b. Else, use color of top-most (visible) layer + * + */ + if( GetIsKeepout() ) + { + // At least one layer must be provided! + assert( GetLayerSet().count() > 0 ); + + // Not on any visible layer? + if( layers.count() == 0 && !( aDrawMode & GR_HIGHLIGHT ) ) + { + return; + } + + // Is keepout zone present on the selected layer? + if( layers.test( curr_layer ) ) + { + draw_layer = curr_layer; + } + else + { + // Select the first (top) visible layer + if( layers.count() > 0 ) + { + draw_layer = layers.Seq()[0]; + } + else + { + draw_layer = GetLayerSet().Seq()[0]; + } + } + + } + /* Non-keepout zones are easier to deal with + */ + else + { + if( brd->IsLayerVisible( GetLayer() ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) + { + return; + } + + draw_layer = GetLayer(); + } + + assert( draw_layer != UNDEFINED_LAYER ); + + auto color = frame->Settings().Colors().GetLayerColor( draw_layer ); GRSetDrawMode( DC, aDrawMode ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); if( displ_opts->m_ContrastModeDisplay ) { if( !IsOnLayer( curr_layer ) ) - { + { color = COLOR4D( DARKDARKGRAY ); - } + } } if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) ) - { + { color.SetToLegacyHighlightColor(); - } + } color.a = 0.588; @@ -413,9 +413,9 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset ) { - + static std::vector CornersBuffer; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); // outline_mode is false to show filled polys, // and true to show polygons outlines only (test and debug purposes) @@ -434,9 +434,9 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; auto frame = static_cast ( panel->GetParent() ); - auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); + auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); - if( brd->IsLayerVisible( GetLayer() ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) + if( brd->IsLayerVisible( GetLayer() ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; GRSetDrawMode( DC, aDrawMode ); @@ -561,9 +561,9 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; auto frame = static_cast ( panel->GetParent() ); - auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); + auto color = frame->Settings().Colors().GetLayerColor( GetLayer() ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); if( displ_opts->m_ContrastModeDisplay ) { @@ -961,15 +961,15 @@ void ZONE_CONTAINER::Flip( const wxPoint& aCentre ) { Mirror( aCentre ); int copperLayerCount = GetBoard()->GetCopperLayerCount(); - - if( GetIsKeepout() ) - { - SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) ); - } - else - { - SetLayer( FlipLayer( GetLayer(), copperLayerCount ) ); - } + + if( GetIsKeepout() ) + { + SetLayerSet( FlipLayerMask( GetLayerSet(), copperLayerCount ) ); + } + else + { + SetLayer( FlipLayer( GetLayer(), copperLayerCount ) ); + } } diff --git a/pcbnew/classpcb.cpp b/pcbnew/classpcb.cpp index c568e5d0d7..a1aed6f070 100644 --- a/pcbnew/classpcb.cpp +++ b/pcbnew/classpcb.cpp @@ -1,9 +1,3 @@ -/** - * @file classpcb.cpp - * @brief Member functions of classes used in Pcbnew (see pcbstruct.h) - * except for tracks (see class_track.cpp). - */ - /* * This program source code file is part of KiCad, a free EDA CAD application. * @@ -198,31 +192,3 @@ int PCB_SCREEN::MilsToIuScalar() { return (int)IU_PER_MILS; } - - -DISPLAY_OPTIONS::DISPLAY_OPTIONS() -{ - m_DisplayPadFill = FILLED; - m_DisplayViaFill = FILLED; - m_DisplayPadNum = true; - m_DisplayPadIsol = true; - - m_DisplayModEdgeFill = FILLED; - m_DisplayModTextFill = FILLED; - m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled - m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; - - m_DisplayPolarCood = false; /* false = display absolute coordinates, - * true = display polar cordinates */ - m_DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones, - * 1 = do not show filled areas outlines - * 2 = show outlines of filled areas */ - m_DisplayNetNamesMode = 3; /* 0 do not show netnames, - * 1 show netnames on pads - * 2 show netnames on tracks - * 3 show netnames on tracks and pads */ - m_DisplayDrawItemsFill = FILLED; - m_ContrastModeDisplay = false; - m_MaxLinksShowed = 3; // in track creation: number of hairwires shown - m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest -} diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index b27e76c53d..447a4f1d02 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -104,7 +104,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) BOARD_ITEM* item; GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( GetDisplayOptions() ); // Assign to scanList the proper item types desired based on tool type // or hotkey that is in play. diff --git a/pcbnew/dialogs/dialog_display_options.cpp b/pcbnew/dialogs/dialog_display_options.cpp index adc1552427..cca2a073f4 100644 --- a/pcbnew/dialogs/dialog_display_options.cpp +++ b/pcbnew/dialogs/dialog_display_options.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -46,13 +46,13 @@ #include -static const UTIL::CFG_MAP traceClearanceSelectMap = +static const UTIL::CFG_MAP traceClearanceSelectMap = { - { SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, 2 }, // Default - { DO_NOT_SHOW_CLEARANCE, 0 }, - { SHOW_CLEARANCE_NEW_TRACKS, 1 }, - { SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, 3 }, - { SHOW_CLEARANCE_ALWAYS, 4 }, + { PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, 2 }, // Default + { PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE, 0 }, + { PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS, 1 }, + { PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, 3 }, + { PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS, 4 }, }; @@ -83,7 +83,7 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) : bool DIALOG_DISPLAY_OPTIONS::TransferDataToWindow() { - const DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) m_parent->GetDisplayOptions(); + const PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_parent->GetDisplayOptions(); m_OptDisplayTracks->SetValue( displ_opts->m_DisplayPcbTrackFill == SKETCH ); @@ -114,7 +114,7 @@ bool DIALOG_DISPLAY_OPTIONS::TransferDataToWindow() */ bool DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow() { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) m_parent->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_parent->GetDisplayOptions(); m_parent->SetShowPageLimits( m_Show_Page_Limits->GetValue() ); diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index a6c8b1c6b3..151fadd701 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -59,7 +59,7 @@ void DIALOG_GENERALOPTIONS::init() m_sdbSizerOK->SetDefault(); m_Board = GetParent()->GetBoard(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetParent()->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetParent()->GetDisplayOptions(); /* Set display options */ m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 1 : 0 ); @@ -97,7 +97,7 @@ void DIALOG_GENERALOPTIONS::OnCancelClick( wxCommandEvent& event ) void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) { EDA_UNITS_T ii; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetParent()->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetParent()->GetDisplayOptions(); displ_opts->m_DisplayPolarCood = ( m_PolarDisplay->GetSelection() == 0 ) ? false : true; ii = g_UserUnit; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 6e9ab4a991..afd59eb490 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) INSTALL_UNBUFFERED_DC( dc, m_canvas ); MODULE* module; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); m_canvas->CrossHairOff( &dc ); @@ -1352,7 +1352,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) { PCB_LAYER_ID curLayer = GetActiveLayer(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); // Check if the specified layer matches the present layer if( layer == curLayer ) @@ -1427,7 +1427,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) int lastToolID = GetToolId(); INSTALL_UNBUFFERED_DC( dc, m_canvas ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); // Stop the current command and deselect the current tool. m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index a9020f27b8..18b3ad9db6 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -113,7 +113,7 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { EDA_ITEM* PtStruct; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); bool tmp = displ_opts->m_DisplayDrawItemsFill; if( Segment == NULL ) @@ -347,7 +347,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi if( Segment == NULL ) return; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)aPanel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) ( aPanel->GetDisplayOptions() ); bool tmp = displ_opts->m_DisplayDrawItemsFill; displ_opts->m_DisplayDrawItemsFill = SKETCH; diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 2c7f80359e..5f158b93b0 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -675,19 +675,19 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen(); PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) aPanel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) aPanel-> GetDisplayOptions(); bool tmp = displ_opts->m_DisplayPcbTrackFill; displ_opts->m_DisplayPcbTrackFill = true; - TRACE_CLEARANCE_DISPLAY_MODE_T showTrackClearanceMode = displ_opts->m_ShowTrackClearanceMode; + auto showTrackClearanceMode = displ_opts->m_ShowTrackClearanceMode; if ( g_FirstTrackSegment == NULL ) return; NETCLASSPTR netclass = g_FirstTrackSegment->GetNetClass(); - if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE ) - displ_opts->m_ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS; + if( showTrackClearanceMode != PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE ) + displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS; // Values to Via circle int boardViaRadius = frame->GetDesignSettings().GetCurrentViaSize()/2; @@ -702,7 +702,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo frame->TraceAirWiresToTargets( aDC ); - if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) + if( showTrackClearanceMode >= PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) { COLOR4D color = frame->Settings().Colors().GetLayerColor( g_CurrentTrackSegment->GetLayer() ); DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->GetEnd(), @@ -766,7 +766,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo DBG( g_CurrentTrackList.VerifyListIntegrity(); ); DrawTraces( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR ); - if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) + if( showTrackClearanceMode >= PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) { COLOR4D color = frame->Settings().Colors().GetLayerColor(g_CurrentTrackSegment->GetLayer()); diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 2478e94d61..89c328bf69 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -143,7 +143,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, // Set some display options here, because the FOOTPRINT_WIZARD_FRAME // does not have a config menu to do that: - DISPLAY_OPTIONS* disp_opts = (DISPLAY_OPTIONS*) GetDisplayOptions(); + auto disp_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); disp_opts->m_DisplayPadIsol = false; disp_opts->m_DisplayPadNum = true; GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false ); diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 516388d9d9..56bf38bb7c 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -70,7 +70,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit MODULE* module = NULL; int evt_type = 0; //Used to post a wxCommandEvent on demand PCB_SCREEN* screen = GetScreen(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); /* Convert lower to upper case * (the usual toupper function has problem with non ascii codes like function keys diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index 1deb71dfd9..aec6c26134 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -44,7 +44,7 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { int id = event.GetId(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); bool state = m_optionsToolBar->GetToolToggled( id ); switch( id ) @@ -83,7 +83,7 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); // Update everything @@ -148,4 +148,3 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings() return m_configParams; } - diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index fa46873eb5..8c891b107b 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -596,7 +596,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ) void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent ) { int id = aEvent.GetId(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); bool state = false; diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 2fd5046fb9..7dd7aca5c7 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -380,7 +380,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat s_PickedList.ClearItemsList(); } - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); if( displ_opts->m_Show_Module_Ratsnest && aDC ) TraceModuleRatsNest( aDC ); @@ -488,4 +488,4 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool if( module->GetFlags() == 0 ) // module not in edit: redraw full screen m_canvas->Refresh(); } -} \ No newline at end of file +} diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 5ffba986ae..32734cc78d 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -103,7 +103,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) aPanel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) aPanel->GetDisplayOptions(); wxPoint moveVector; int tmp = displ_opts->m_DisplayPcbTrackFill; GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT; diff --git a/pcbnew/pcb_display_options.cpp b/pcbnew/pcb_display_options.cpp new file mode 100644 index 0000000000..72a259e719 --- /dev/null +++ b/pcbnew/pcb_display_options.cpp @@ -0,0 +1,59 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2012 Wayne Stambaugh + * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include +#include + +PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS() +{ + m_DisplayPadFill = FILLED; + m_DisplayViaFill = FILLED; + m_DisplayPadNum = true; + m_DisplayPadIsol = true; + + m_DisplayModEdgeFill = FILLED; + m_DisplayModTextFill = FILLED; + m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled + m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; + + m_DisplayPolarCood = false; /* false = display absolute coordinates, + * true = display polar cordinates */ + m_DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones, + * 1 = do not show filled areas outlines + * 2 = show outlines of filled areas */ + m_DisplayNetNamesMode = 3; /* 0 do not show netnames, + * 1 show netnames on pads + * 2 show netnames on tracks + * 3 show netnames on tracks and pads */ + m_DisplayDrawItemsFill = FILLED; + m_ContrastModeDisplay = false; + m_MaxLinksShowed = 3; // in track creation: number of hairwires shown + m_Show_Module_Ratsnest = true; // When moving a footprint: allows displaying a ratsnest +} diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 8f671b9d46..57898d2a4f 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -117,7 +117,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy if( frame ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) frame->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) frame->GetDisplayOptions(); static_cast( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts ); } } @@ -345,7 +345,7 @@ void PCB_DRAW_PANEL_GAL::OnShow() if( frame ) { SetTopLayer( frame->GetActiveLayer() ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) frame->GetDisplayOptions(); static_cast( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( displ_opts ); } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index a0d490b633..f3ee59b94c 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -38,6 +38,8 @@ #include #include +#include + #include #include @@ -118,7 +120,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet } -void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS* aOptions ) +void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOptions ) { if( aOptions == NULL ) return; @@ -178,23 +180,23 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const DISPLAY_OPTIONS* aOptions ) // Clearance settings switch( aOptions->m_ShowTrackClearanceMode ) { - case DO_NOT_SHOW_CLEARANCE: + case PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE: m_clearance = CL_NONE; break; - case SHOW_CLEARANCE_NEW_TRACKS: + case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS: m_clearance = CL_NEW | CL_TRACKS; break; - case SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS: + case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS: m_clearance = CL_NEW | CL_TRACKS | CL_VIAS; break; - case SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS: + case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS: m_clearance = CL_NEW | CL_EDITED | CL_TRACKS | CL_VIAS; break; - case SHOW_CLEARANCE_ALWAYS: + case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS: m_clearance = CL_NEW | CL_EDITED | CL_EXISTING | CL_TRACKS | CL_VIAS; break; } diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index cb90426926..c9c2fc1c9c 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -34,7 +34,7 @@ class EDA_ITEM; class COLORS_DESIGN_SETTINGS; -class DISPLAY_OPTIONS; +class PCB_DISPLAY_OPTIONS; class BOARD_ITEM; class BOARD; @@ -99,7 +99,7 @@ public: * for vias/pads/tracks and so on). * @param aOptions are settings that you want to use for displaying items. */ - void LoadDisplayOptions( const DISPLAY_OPTIONS* aOptions ); + void LoadDisplayOptions( const PCB_DISPLAY_OPTIONS* aOptions ); /// @copydoc RENDER_SETTINGS::GetColor() virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const override; @@ -204,7 +204,7 @@ protected: void draw( const TEXTE_PCB* aText, int aLayer ); void draw( const TEXTE_MODULE* aText, int aLayer ); void draw( const MODULE* aModule, int aLayer ); - void draw( const ZONE_CONTAINER* aZone, int aLayer ); + void draw( const ZONE_CONTAINER* aZone, int aLayer ); void draw( const DIMENSION* aDimension, int aLayer ); void draw( const PCB_TARGET* aTarget ); void draw( const MARKER_PCB* aMarker ); diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 5f5be2f1d9..e820937a2f 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -326,7 +326,7 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); if( m_configParams.empty() ) { @@ -344,7 +344,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &displ_opts->m_DisplayPcbTrackFill, true ) ); m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "TrackDisplayClearance" ), (int*) &displ_opts->m_ShowTrackClearanceMode, - SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); + PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "PadFill" ), &displ_opts->m_DisplayPadFill, true ) ); m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "ViaFill" ), diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 2fea89e650..cede89ef10 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 8766864eec..b0cc2c6006 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -51,9 +51,8 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, { const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0; int defaultPenSize = Millimeter2iu( 0.2 ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - - DISPLAY_OPTIONS save_opt; + auto displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions(); + PCB_DISPLAY_OPTIONS save_opt; PRINT_PARAMETERS * printParameters = (PRINT_PARAMETERS*) aData; // can be null PRINT_PARAMETERS::DrillShapeOptT drillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; @@ -73,7 +72,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, displ_opts->m_DisplayModEdgeFill = FILLED; displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; - displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; + displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE; displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; @@ -110,13 +109,13 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, void* aData) { const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0; - DISPLAY_OPTIONS save_opt; + PCB_DISPLAY_OPTIONS save_opt; BOARD* Pcb = GetBoard(); int defaultPenSize = Millimeter2iu( 0.2 ); bool onePagePerLayer = false; PRINT_PARAMETERS* printParameters = (PRINT_PARAMETERS*) aData; // can be null - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions(); if( printParameters && printParameters->m_OptionPrintPage == 0 ) onePagePerLayer = true; @@ -186,7 +185,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, displ_opts->m_DisplayModEdgeFill = FILLED; displ_opts->m_DisplayModTextFill = FILLED; displ_opts->m_DisplayPcbTrackFill = true; - displ_opts->m_ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE; + displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE; displ_opts->m_DisplayDrawItemsFill = FILLED; displ_opts->m_DisplayZonesMode = 0; displ_opts->m_DisplayNetNamesMode = 0; diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index 7d1e1646cb..64e4e079f7 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -196,7 +196,7 @@ void PCB_BASE_FRAME::build_ratsnest_module( MODULE* aModule, wxPoint aMoveVector void PCB_BASE_FRAME::TraceAirWiresToTargets( wxDC* aDC ) { auto connectivity = GetBoard()->GetConnectivity(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions(); auto targets = connectivity->NearestUnconnectedTargets( s_ref, s_CursorPos, s_refNet ); @@ -221,7 +221,7 @@ void MODULE::DrawOutlinesWhenMoving( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* pt_pad; DrawEdgesOnly( panel, DC, aMoveVector, GR_XOR ); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*) ( panel->GetDisplayOptions() ); // Show pads in sketch mode to speedu up drawings pad_fill_tmp = displ_opts->m_DisplayPadFill; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index e0be212190..be0602d57f 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -898,9 +898,9 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClea if( m_dispOptions ) { auto clearanceDisp = m_dispOptions->m_ShowTrackClearanceMode; - pitem->ShowTrackClearance( clearanceDisp != DO_NOT_SHOW_CLEARANCE ); - pitem->ShowViaClearance( clearanceDisp != DO_NOT_SHOW_CLEARANCE - && clearanceDisp != SHOW_CLEARANCE_NEW_TRACKS ); + pitem->ShowTrackClearance( clearanceDisp != PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE ); + pitem->ShowViaClearance( clearanceDisp != PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE + && clearanceDisp != PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS ); } } @@ -1037,5 +1037,5 @@ void PNS_KICAD_IFACE::SetHostFrame( PCB_EDIT_FRAME* aFrame ) m_frame = aFrame; m_commit.reset( new BOARD_COMMIT( m_frame ) ); - m_dispOptions = (DISPLAY_OPTIONS*) m_frame->GetDisplayOptions(); + m_dispOptions = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions(); } diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 361f57937e..cb3f66b008 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -31,7 +31,7 @@ class PNS_PCBNEW_DEBUG_DECORATOR; class BOARD; class BOARD_COMMIT; -class DISPLAY_OPTIONS; +class PCB_DISPLAY_OPTIONS; namespace KIGFX { @@ -78,7 +78,7 @@ private: BOARD* m_board; PCB_EDIT_FRAME* m_frame; std::unique_ptr m_commit; - DISPLAY_OPTIONS* m_dispOptions; + PCB_DISPLAY_OPTIONS* m_dispOptions; }; #endif diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index 22cb6179c6..dc068eb3fc 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -157,7 +157,7 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer ) ITEM* rv = NULL; PCB_EDIT_FRAME* frame = getEditFrame(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)frame->GetDisplayOptions(); for( int i = 0; i < 4; i++ ) { diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index a0975e1ad0..668e014bc5 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -32,7 +32,6 @@ */ #include -#include // HISTORY_NUMBER #include // DisplayError() #include // EDA_FileSelector() #include // RotatePoint() diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index a7a25e85d7..376123b68a 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -733,7 +733,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { int id = event.GetId(); bool state = event.IsChecked(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); switch( id ) { diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index a962274bbd..302598ba50 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -120,7 +120,7 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ) { int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES; - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); if( aEvent.IsChecked() && ( displ_opts->m_DisplayZonesMode == selected ) ) return; @@ -161,7 +161,7 @@ void PCB_EDIT_FRAME::OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); aEvent.Check( !displ_opts->m_DisplayViaFill ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, displ_opts->m_DisplayViaFill ? @@ -172,7 +172,7 @@ void PCB_EDIT_FRAME::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); aEvent.Check( !displ_opts->m_DisplayPcbTrackFill ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, displ_opts->m_DisplayPcbTrackFill ? @@ -183,7 +183,7 @@ void PCB_EDIT_FRAME::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions(); aEvent.Check( displ_opts->m_ContrastModeDisplay ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, displ_opts->m_ContrastModeDisplay ? diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 264158ca56..b6617dd7c2 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -154,7 +154,6 @@ TOOL_ACTION PCB_ACTIONS::showLocalRatsnest( "pcbnew.Control.showLocalRatsnest", AS_GLOBAL, 0, "", "" ); - class ZONE_CONTEXT_MENU : public CONTEXT_MENU { public: @@ -922,20 +921,20 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent ) // If the new zone is on the same layer as the the initial zone, // do nothing - if( success ) + if( success ) { - if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) ) - { - DisplayError( - m_frame, _( "The duplicated keepout zone cannot be on the same layers as the original zone." ) ); - success = false; - } - else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) - { - DisplayError( - m_frame, _( "The duplicated zone cannot be on the same layer as the original zone." ) ); - success = false; - } + if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) ) + { + DisplayError( + m_frame, _( "The duplicated keepout zone cannot be on the same layers as the original zone." ) ); + success = false; + } + else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) + { + DisplayError( + m_frame, _( "The duplicated zone cannot be on the same layer as the original zone." ) ); + success = false; + } } // duplicate the zone diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 29078f1775..a0cd7b2a2a 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -263,7 +263,7 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent ) auto settings = painter->GetSettings(); // Apply new display options to the GAL canvas - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); displ_opts->m_DisplayPcbTrackFill = !displ_opts->m_DisplayPcbTrackFill; settings->LoadDisplayOptions( displ_opts ); @@ -284,7 +284,7 @@ int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent ) auto painter = static_cast( getView()->GetPainter() ); auto settings = painter->GetSettings(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); // Apply new display options to the GAL canvas displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill; @@ -306,7 +306,7 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent ) { auto painter = static_cast( getView()->GetPainter() ); auto settings = painter->GetSettings(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); // Apply new display options to the GAL canvas displ_opts->m_DisplayViaFill = !displ_opts->m_DisplayViaFill; @@ -328,7 +328,7 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent ) { auto painter = static_cast( getView()->GetPainter() ); auto settings = painter->GetSettings(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); // Apply new display options to the GAL canvas if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayEnable ) ) @@ -355,7 +355,7 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent ) { auto painter = static_cast( getView()->GetPainter() ); auto settings = painter->GetSettings(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); + PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions(); displ_opts->m_ContrastModeDisplay = !displ_opts->m_ContrastModeDisplay; settings->LoadDisplayOptions( displ_opts ); diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 0838e160ab..c9c64ff508 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -295,7 +295,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode ) static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule, int ox, int oy, LSET aLayerMask, GR_DRAWMODE draw_mode ) { - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); + auto displ_opts = (PCB_DISPLAY_OPTIONS*)( panel->GetDisplayOptions() ); int tmp = displ_opts->m_DisplayPadFill;