From d99febba6c509f2bbbd89f401b6bb7f4589c3c77 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 26 May 2020 23:21:38 +0100 Subject: [PATCH] Treat sketch mode module items and board items the same. --- cvpcb/cvpcb_settings.cpp | 9 +++-- cvpcb/display_footprints_frame.cpp | 8 ++--- include/pcb_display_options.h | 5 ++- include/pcbstruct.h | 1 - pcbnew/footprint_editor_settings.cpp | 6 ++-- pcbnew/menubar_footprint_editor.cpp | 8 ++--- pcbnew/menubar_pcb_editor.cpp | 15 +++----- pcbnew/pcb_display_options.cpp | 5 ++- pcbnew/pcb_painter.cpp | 47 +++++++++++++++---------- pcbnew/pcb_painter.h | 13 +++---- pcbnew/pcbnew_settings.cpp | 6 ++-- pcbnew/toolbars_footprint_editor.cpp | 8 ++--- pcbnew/toolbars_footprint_viewer.cpp | 8 ++--- pcbnew/tools/pcb_actions.cpp | 13 +++---- pcbnew/tools/pcb_actions.h | 8 ++--- pcbnew/tools/pcb_viewer_tools.cpp | 51 ++++++++++++++++++---------- pcbnew/tools/pcb_viewer_tools.h | 4 +-- pcbnew/tools/pcbnew_control.cpp | 20 ----------- pcbnew/tools/pcbnew_control.h | 1 - 19 files changed, 112 insertions(+), 124 deletions(-) diff --git a/cvpcb/cvpcb_settings.cpp b/cvpcb/cvpcb_settings.cpp index ddc6c863fc..502852c6b0 100644 --- a/cvpcb/cvpcb_settings.cpp +++ b/cvpcb/cvpcb_settings.cpp @@ -45,18 +45,17 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() addParamsForWindow( &m_FootprintViewer, "footprint_viewer" ); - m_params.emplace_back( - new PARAM( "footprint_viewer.pad_fill", - &m_FootprintViewerDisplayOptions.m_DisplayPadFill, true ) ); + m_params.emplace_back( new PARAM( "footprint_viewer.pad_fill", + &m_FootprintViewerDisplayOptions.m_DisplayPadFill, true ) ); m_params.emplace_back( new PARAM( "footprint_viewer.pad_numbers", &m_FootprintViewerDisplayOptions.m_DisplayPadNum, true ) ); m_params.emplace_back( new PARAM( "footprint_viewer.footprint_text_fill", - &m_FootprintViewerDisplayOptions.m_DisplayModTextFill, true ) ); + &m_FootprintViewerDisplayOptions.m_DisplayTextFill, true ) ); m_params.emplace_back( new PARAM( "footprint_viewer.graphic_items_fill", - &m_FootprintViewerDisplayOptions.m_DisplayDrawItemsFill, true ) ); + &m_FootprintViewerDisplayOptions.m_DisplayGraphicsFill, true ) ); m_params.emplace_back( new PARAM( "footprint_viewer.auto_zoom", &m_FootprintViewerAutoZoom, false ) ); diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index a31ab29085..3214a8c9c9 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -223,8 +223,8 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddSeparator(); m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::moduleTextOutlines, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::graphicsOutlines, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Realize(); } @@ -500,8 +500,8 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars() m_optionsToolBar->Toggle( PCB_ACTIONS::showPadNumbers, opts.m_DisplayPadNum ); m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::moduleTextOutlines, !opts.m_DisplayModTextFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts.m_DisplayModEdgeFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::textOutlines, !opts.m_DisplayTextFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::graphicsOutlines, !opts.m_DisplayGraphicsFill ); m_optionsToolBar->Refresh(); } diff --git a/include/pcb_display_options.h b/include/pcb_display_options.h index 7a5c36ef61..c5f1eb58de 100644 --- a/include/pcb_display_options.h +++ b/include/pcb_display_options.h @@ -65,8 +65,8 @@ public: 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_DisplayGraphicsFill; // How to display module drawings ( sketch/ filled ) + bool m_DisplayTextFill; // 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. @@ -79,7 +79,6 @@ public: * 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_ShowModuleRatsnest; // When moving a footprint: allows displaying a ratsnest diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 1ffe06a353..e346693656 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -80,7 +80,6 @@ public: * 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 diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index 1d2e79536b..fd978f69ee 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -69,11 +69,11 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : m_params.emplace_back( new PARAM( "editing.use_45_degree_graphic_segments", &m_Use45DegreeGraphicSegments, false ) ); - m_params.emplace_back( new PARAM( "pcb_display.footprint_text", - &m_Display.m_DisplayModTextFill, true ) ); + m_params.emplace_back( new PARAM( "pcb_display.text_fill", + &m_Display.m_DisplayTextFill, true ) ); m_params.emplace_back( new PARAM( "pcb_display.graphic_items_fill", - &m_Display.m_DisplayDrawItemsFill, true ) ); + &m_Display.m_DisplayGraphicsFill, true ) ); m_params.emplace_back( new PARAM( "pcb_display.pad_fill", &m_Display.m_DisplayPadFill, true ) ); diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index e93a68d964..0e17a558f1 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -160,8 +160,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() auto sketchPadsCondition = [ this ] ( const SELECTION& aSel ) { return !GetDisplayOptions().m_DisplayPadFill; }; - auto sketchEdgesCondition = [ this ] ( const SELECTION& aSel ) { - return !GetDisplayOptions().m_DisplayModEdgeFill; + auto sketchGraphicsCondition = [ this ] ( const SELECTION& aSel ) { + return !GetDisplayOptions().m_DisplayGraphicsFill; }; auto contrastModeCondition = [ this ] ( const SELECTION& aSel ) { return !GetDisplayOptions().m_ContrastModeDisplay; @@ -201,8 +201,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) ); drawingModeSubMenu->SetIcon( add_zone_xpm ); - drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition ); - drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::moduleEdgeOutlines, sketchEdgesCondition ); + drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition ); + drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::graphicsOutlines, sketchGraphicsCondition ); viewMenu->AddMenu( drawingModeSubMenu ); // Contrast Mode Submenu diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 37a5b237e3..8dbf050bb7 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -325,15 +325,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() }; auto sketchGraphicsCondition = [ &disp_opt ]( const SELECTION &aSel ) { - return !disp_opt.m_DisplayDrawItemsFill; + return !disp_opt.m_DisplayGraphicsFill; }; - auto sketchModuleEdgeOutlinesCondition = [ &disp_opt ]( const SELECTION &aSel ) + auto sketchTextOutlinesCondition = [ &disp_opt ]( const SELECTION &aSel ) { - return !disp_opt.m_DisplayModEdgeFill; - }; - auto sketchModuleTextOutlinesCondition = [ &disp_opt ]( const SELECTION &aSel ) - { - return !disp_opt.m_DisplayModTextFill; + return !disp_opt.m_DisplayTextFill; }; viewMenu->AddCheckItem( PCB_ACTIONS::showLayersManager, layersPaletteShownCondition ); @@ -383,9 +379,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::trackDisplayMode, sketchTracksCondition ); drawingModeSubMenu->AddSeparator(); - drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::graphicDisplayMode, sketchGraphicsCondition ); - drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::moduleEdgeOutlines, sketchModuleEdgeOutlinesCondition ); - drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::moduleTextOutlines, sketchModuleTextOutlinesCondition ); + drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::graphicsOutlines, sketchGraphicsCondition ); + drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::textOutlines, sketchTextOutlinesCondition ); viewMenu->AddMenu( drawingModeSubMenu ); diff --git a/pcbnew/pcb_display_options.cpp b/pcbnew/pcb_display_options.cpp index 5a8a82d0fe..7b88e6f914 100644 --- a/pcbnew/pcb_display_options.cpp +++ b/pcbnew/pcb_display_options.cpp @@ -38,8 +38,8 @@ PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS() m_DisplayPadNum = true; m_DisplayPadIsol = true; - m_DisplayModEdgeFill = FILLED; - m_DisplayModTextFill = FILLED; + m_DisplayGraphicsFill = FILLED; + m_DisplayTextFill = FILLED; m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS; @@ -50,7 +50,6 @@ PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS() * 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_ShowModuleRatsnest = true; // When moving a footprint: allows displaying a ratsnest diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index e977f9aabc..1133c486d6 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -58,9 +58,8 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS() m_zoneOutlines = true; m_displayZone = DZ_SHOW_FILLED; m_clearance = CL_NONE; - m_sketchBoardGfx = false; - m_sketchFpGfx = false; - m_sketchFpTxtfx = false; + m_sketchGraphics = false; + m_sketchText = false; m_selectionCandidateColor = COLOR4D( 0.0, 1.0, 0.0, 0.75 ); // By default everything should be displayed as filled @@ -130,9 +129,8 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS& aOption { m_hiContrastEnabled = aOptions.m_ContrastModeDisplay; m_padNumbers = aOptions.m_DisplayPadNum; - m_sketchBoardGfx = !aOptions.m_DisplayDrawItemsFill; - m_sketchFpGfx = !aOptions.m_DisplayModEdgeFill; - m_sketchFpTxtfx = !aOptions.m_DisplayModTextFill; + m_sketchGraphics = !aOptions.m_DisplayGraphicsFill; + m_sketchText = !aOptions.m_DisplayTextFill; m_curvedRatsnestlines = aOptions.m_DisplayRatsnestLinesCurved; m_globalRatsnestlines = aOptions.m_ShowGlobalRatsnest; @@ -899,9 +897,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer ) void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment, int aLayer ) { const COLOR4D& color = m_pcbSettings.GetColor( aSegment, aSegment->GetLayer() ); - bool sketch = ( aSegment->Type() == PCB_LINE_T && m_pcbSettings.m_sketchBoardGfx ) - || ( aSegment->Type() == PCB_MODULE_EDGE_T && m_pcbSettings.m_sketchFpGfx ); - + bool sketch = m_pcbSettings.m_sketchGraphics; int thickness = getLineThickness( aSegment->GetWidth() ); VECTOR2D start( aSegment->GetStart() ); VECTOR2D end( aSegment->GetEnd() ); @@ -1011,7 +1007,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer ) const COLOR4D& color = m_pcbSettings.GetColor( aText, aText->GetLayer() ); VECTOR2D position( aText->GetTextPos().x, aText->GetTextPos().y ); - if( m_pcbSettings.m_sketchMode[aLayer] ) + if( m_pcbSettings.m_sketchText || m_pcbSettings.m_sketchMode[aLayer] ) { // Outline mode m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); @@ -1033,17 +1029,14 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer ) void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer ) { wxString shownText( aText->GetShownText() ); + if( shownText.Length() == 0 ) return; - bool sketch = m_pcbSettings.m_sketchFpTxtfx; - const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer ); VECTOR2D position( aText->GetTextPos().x, aText->GetTextPos().y ); - // Currently, draw text routines do not know the true outline mode. - // so draw the text in "line" mode (no thickness) - if( sketch ) + if( m_pcbSettings.m_sketchText ) { // Outline mode m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); @@ -1169,7 +1162,17 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer ) m_gal->SetStrokeColor( strokeColor ); m_gal->SetIsFill( false ); m_gal->SetIsStroke( true ); - m_gal->SetLineWidth( getLineThickness( aDimension->GetWidth() ) ); + + if( m_pcbSettings.m_sketchGraphics ) + { + // Outline mode + m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); + } + else + { + // Filled mode + m_gal->SetLineWidth( getLineThickness( aDimension->GetWidth() ) ); + } // Draw an arrow m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_crossBarF ) ); @@ -1186,7 +1189,17 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer ) TEXTE_PCB& text = aDimension->Text(); VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y ); - m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth() ) ); + if( m_pcbSettings.m_sketchText ) + { + // Outline mode + m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth ); + } + else + { + // Filled mode + m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth() ) ); + } + m_gal->SetTextAttributes( &text ); m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians() ); } diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 2835e784fc..b876a45473 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -130,7 +130,7 @@ public: */ inline void SetSketchModeGraphicItems( bool aEnabled ) { - m_sketchBoardGfx = aEnabled; + m_sketchGraphics = aEnabled; } /** @@ -170,14 +170,11 @@ protected: ///> Flag determining if items on a given layer should be drawn as an outline or a filled item bool m_sketchMode[GAL_LAYER_ID_END]; - ///> Flag determining if board graphic items should be outlined or stroked - bool m_sketchBoardGfx; + ///> Flag determining if graphic items should be outlined or stroked + bool m_sketchGraphics; - ///> Flag determining if footprint graphic items should be outlined or stroked - bool m_sketchFpGfx; - - ///> Flag determining if footprint text items should be outlined or stroked - bool m_sketchFpTxtfx; + ///> Flag determining if text items should be outlined or stroked + bool m_sketchText; ///> Flag determining if pad numbers should be visible bool m_padNumbers; diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 71ed475eba..964bfea75d 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -104,16 +104,16 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_params.emplace_back( new PARAM( "grid.user.size_y", &m_UserGrid.size_y, 0.01 ) ); m_params.emplace_back( new PARAM( - "pcb_display.graphic_items_fill", &m_Display.m_DisplayDrawItemsFill, true ) ); + "pcb_display.graphic_items_fill", &m_Display.m_DisplayGraphicsFill, true ) ); m_params.emplace_back( new PARAM( "pcb_display.max_links_shown", &m_Display.m_MaxLinksShowed, 3, 0, 15 ) ); m_params.emplace_back( new PARAM( - "pcb_display.footprint_edge_fill", &m_Display.m_DisplayModEdgeFill, true ) ); + "pcb_display.graphics_fill", &m_Display.m_DisplayGraphicsFill, true ) ); m_params.emplace_back( new PARAM( - "pcb_display.footprint_text_fill", &m_Display.m_DisplayModTextFill, true ) ); + "pcb_display.text_fill", &m_Display.m_DisplayTextFill, true ) ); m_params.emplace_back( new PARAM( "pcb_display.net_names_mode", &m_Display.m_DisplayNetNamesMode, 3, 0, 3 ) ); diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index 418d80353d..2241b30ceb 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -182,8 +182,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddSeparator(); m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::moduleTextOutlines, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::graphicsOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->AddSeparator(); @@ -241,8 +241,8 @@ void FOOTPRINT_EDIT_FRAME::SyncToolbars() m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() ); m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::moduleTextOutlines, !opts.m_DisplayModTextFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts.m_DisplayModEdgeFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::textOutlines, !opts.m_DisplayTextFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::graphicsOutlines, !opts.m_DisplayGraphicsFill ); m_optionsToolBar->Toggle( ACTIONS::highContrastMode, opts.m_ContrastModeDisplay ); m_optionsToolBar->Toggle( PCB_ACTIONS::toggleFootprintTree, IsSearchTreeShown() ); m_optionsToolBar->Refresh(); diff --git a/pcbnew/toolbars_footprint_viewer.cpp b/pcbnew/toolbars_footprint_viewer.cpp index d935fbf66e..acbba69063 100644 --- a/pcbnew/toolbars_footprint_viewer.cpp +++ b/pcbnew/toolbars_footprint_viewer.cpp @@ -120,8 +120,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddSeparator(); m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::moduleTextOutlines, ACTION_TOOLBAR::TOGGLE ); - m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::textOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::graphicsOutlines, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Realize(); } @@ -148,8 +148,8 @@ void FOOTPRINT_VIEWER_FRAME::SyncToolbars() m_optionsToolBar->Toggle( PCB_ACTIONS::showPadNumbers, opts.m_DisplayPadNum ); m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::moduleTextOutlines, !opts.m_DisplayModTextFill ); - m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts.m_DisplayModEdgeFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::textOutlines, !opts.m_DisplayTextFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::graphicsOutlines, !opts.m_DisplayGraphicsFill ); m_optionsToolBar->Refresh(); } diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index bd623d9259..426e68b28d 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -683,19 +683,14 @@ TOOL_ACTION PCB_ACTIONS::viaDisplayMode( "pcbnew.Control.viaDisplayMode", _( "Sketch Vias" ), _( "Show vias in outline mode" ), via_sketch_xpm ); -TOOL_ACTION PCB_ACTIONS::graphicDisplayMode( "pcbnew.Control.graphicDisplayMode", +TOOL_ACTION PCB_ACTIONS::graphicsOutlines( "pcbnew.Control.graphicOutlines", AS_GLOBAL, 0, "", - _( "Sketch Board Graphic Items" ), _( "Show board graphic items in outline mode" ), - show_graphics_mode_xpm ); - -TOOL_ACTION PCB_ACTIONS::moduleEdgeOutlines( "pcbnew.Control.graphicOutlines", - AS_GLOBAL, 0, "", - _( "Sketch Footprint Graphic Items" ), _( "Show footprint graphic items in outline mode" ), + _( "Sketch Graphic Items" ), _( "Show graphic items in outline mode" ), show_mod_edge_xpm ); -TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.Control.fpTextOutlines", +TOOL_ACTION PCB_ACTIONS::textOutlines( "pcbnew.Control.textOutlines", AS_GLOBAL, 0, "", - _( "Line Mode Footprint Text Items" ), _( "Show footprint texts in line mode" ), + _( "Sketch Text Items" ), _( "Show footprint texts in line mode" ), text_sketch_xpm ); TOOL_ACTION PCB_ACTIONS::showPadNumbers( "pcbnew.Control.showPadNumbers", diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 7fa5c97a0a..226ee7ca8c 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -222,7 +222,6 @@ public: static TOOL_ACTION trackDisplayMode; static TOOL_ACTION padDisplayMode; static TOOL_ACTION viaDisplayMode; - static TOOL_ACTION graphicDisplayMode; static TOOL_ACTION zoneDisplayEnable; static TOOL_ACTION zoneDisplayDisable; static TOOL_ACTION zoneDisplayOutlines; @@ -363,11 +362,10 @@ public: static TOOL_ACTION createArray; /// Display module edges as outlines - static TOOL_ACTION moduleEdgeOutlines; + static TOOL_ACTION graphicsOutlines; - /// Display module texts as lines // JEY TODO: if we're going to keep this, it needs - // to be all text, not just module text.... - static TOOL_ACTION moduleTextOutlines; + /// Display texts as lines + static TOOL_ACTION textOutlines; // Pad tools diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index 6076e68879..ef7a9d7200 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -135,49 +135,65 @@ int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent ) } -int PCB_VIEWER_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent ) +int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent ) { - auto opts = displayOptions(); + PCB_DISPLAY_OPTIONS opts = displayOptions(); - Flip( opts.m_DisplayModEdgeFill ); + Flip( opts.m_DisplayGraphicsFill ); frame()->SetDisplayOptions( opts ); view()->UpdateDisplayOptions( opts ); - for( auto module : board()->Modules() ) + for( MODULE* module : board()->Modules() ) { - for( auto item : module->GraphicalItems() ) + for( BOARD_ITEM* item : module->GraphicalItems() ) { if( item->Type() == PCB_MODULE_EDGE_T ) view()->Update( item, KIGFX::GEOMETRY ); } } + for( BOARD_ITEM* item : board()->Drawings() ) + { + KICAD_T t = item->Type(); + + if( t == PCB_LINE_T || t == PCB_DIMENSION_T || t == PCB_TARGET_T ) + view()->Update( item, KIGFX::GEOMETRY ); + } + canvas()->Refresh(); return 0; } -int PCB_VIEWER_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent ) +int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent ) { - auto opts = displayOptions(); + PCB_DISPLAY_OPTIONS opts = displayOptions(); - Flip( opts.m_DisplayModTextFill ); + Flip( opts.m_DisplayTextFill ); frame()->SetDisplayOptions( opts ); view()->UpdateDisplayOptions( opts ); - for( auto module : board()->Modules() ) + for( MODULE* module : board()->Modules() ) { view()->Update( &module->Reference(), KIGFX::GEOMETRY ); view()->Update( &module->Value(), KIGFX::GEOMETRY ); - for( auto item : module->GraphicalItems() ) + for( BOARD_ITEM* item : module->GraphicalItems() ) { if( item->Type() == PCB_MODULE_TEXT_T ) view()->Update( item, KIGFX::GEOMETRY ); } } + for( BOARD_ITEM* item : board()->Drawings() ) + { + KICAD_T t = item->Type(); + + if( t == PCB_TEXT_T || t == PCB_DIMENSION_T ) + view()->Update( item, KIGFX::GEOMETRY ); + } + canvas()->Refresh(); return 0; @@ -318,15 +334,14 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent ) void PCB_VIEWER_TOOLS::setTransitions() { - Go( &PCB_VIEWER_TOOLS::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() ); // Display modes - Go( &PCB_VIEWER_TOOLS::ShowPadNumbers, PCB_ACTIONS::showPadNumbers.MakeEvent() ); - Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); - Go( &PCB_VIEWER_TOOLS::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() ); - Go( &PCB_VIEWER_TOOLS::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() ); - Go( &PCB_VIEWER_TOOLS::ZoomAutomatically, - PCB_ACTIONS::zoomFootprintAutomatically.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::ShowPadNumbers, PCB_ACTIONS::showPadNumbers.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::GraphicOutlines, PCB_ACTIONS::graphicsOutlines.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::TextOutlines, PCB_ACTIONS::textOutlines.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::ZoomAutomatically, PCB_ACTIONS::zoomFootprintAutomatically.MakeEvent() ); - Go( &PCB_VIEWER_TOOLS::MeasureTool, ACTIONS::measureTool.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::MeasureTool, ACTIONS::measureTool.MakeEvent() ); } diff --git a/pcbnew/tools/pcb_viewer_tools.h b/pcbnew/tools/pcb_viewer_tools.h index 6d4adca3b6..1a6bc6693a 100644 --- a/pcbnew/tools/pcb_viewer_tools.h +++ b/pcbnew/tools/pcb_viewer_tools.h @@ -57,8 +57,8 @@ public: // Display modes int ShowPadNumbers( const TOOL_EVENT& aEvent ); int PadDisplayMode( const TOOL_EVENT& aEvent ); - int ModuleEdgeOutlines( const TOOL_EVENT& aEvent ); - int ModuleTextOutlines( const TOOL_EVENT& aEvent ); + int GraphicOutlines( const TOOL_EVENT& aEvent ); + int TextOutlines( const TOOL_EVENT& aEvent ); int ZoomAutomatically( const TOOL_EVENT& aEvent ); /// Show the 3D viewer diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index ffcad4b553..7ffb43fb44 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -189,25 +189,6 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent ) } -int PCBNEW_CONTROL::GraphicDisplayMode( const TOOL_EVENT& aEvent ) -{ - auto opts = displayOptions(); - - Flip( opts.m_DisplayDrawItemsFill ); - m_frame->SetDisplayOptions( opts ); - view()->UpdateDisplayOptions( opts ); - - for( auto item : board()->Drawings() ) - { - view()->Update( item, KIGFX::GEOMETRY ); - } - - canvas()->Refresh(); - - return 0; -} - - int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent ) { auto opts = displayOptions(); @@ -1066,7 +1047,6 @@ void PCBNEW_CONTROL::setTransitions() Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() ); Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() ); - Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() ); diff --git a/pcbnew/tools/pcbnew_control.h b/pcbnew/tools/pcbnew_control.h index 984512b3b6..c998bcba0e 100644 --- a/pcbnew/tools/pcbnew_control.h +++ b/pcbnew/tools/pcbnew_control.h @@ -59,7 +59,6 @@ public: int ZoneDisplayMode( const TOOL_EVENT& aEvent ); int TrackDisplayMode( const TOOL_EVENT& aEvent ); int ViaDisplayMode( const TOOL_EVENT& aEvent ); - int GraphicDisplayMode( const TOOL_EVENT& aEvent ); int HighContrastMode( const TOOL_EVENT& aEvent ); // Layer control