7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

refactoring: renamed pcbstruct.h to pcb_display_options.h, DISPLAY_OPTIONS->PCB_DISPLAY_OPTIONS

This commit is contained in:
Tomasz Włostowski 2017-10-30 18:21:07 +01:00
parent 90ab5860dc
commit 81d1e17f02
54 changed files with 473 additions and 357 deletions

View File

@ -38,11 +38,10 @@
#include <wx/sizer.h>
#include <wx/frame.h>
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
{

View File

@ -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

View File

@ -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 )
{

View File

@ -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();

View File

@ -25,7 +25,6 @@
#ifndef BOARD_DESIGN_SETTINGS_H_
#define BOARD_DESIGN_SETTINGS_H_
#include <pcbstruct.h> // NB_COLORS
#include <class_pad.h>
#include <class_track.h>
#include <class_netclass.h>

View File

@ -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 );

View File

@ -33,7 +33,6 @@
#define INCLUDE__COMMON_H_
#include <vector>
#include <boost/cstdint.hpp>
#include <wx/wx.h>
#include <wx/confbase.h>

View File

@ -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_

View File

@ -40,8 +40,8 @@
#include <eda_text.h> // EDA_DRAW_MODE_T
#include <richio.h>
#include <class_pcb_screen.h>
#include <pcbstruct.h>
#include <pcb_display_options.h>
#include <pcb_general_settings.h>
/* 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;

View File

@ -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();

View File

@ -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<KIGFX::PCB_PAINTER*>( 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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -217,7 +217,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
auto frame = static_cast<PCB_EDIT_FRAME*> ( 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;

View File

@ -123,7 +123,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
auto frame = static_cast<PCB_BASE_FRAME*> ( 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 )
{

View File

@ -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;

View File

@ -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 )

View File

@ -37,7 +37,7 @@
#include <confirm.h>
#include <wxPcbStruct.h>
#include <pcbstruct.h>
#include <pcb_display_options.h>
#include <layer_widget.h>
#include <macros.h>
#include <menus_helpers.h>
@ -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();

View File

@ -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;

View File

@ -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 )

View File

@ -29,6 +29,7 @@
* @brief Functions relatives to tracks, vias and segments used to fill zones.
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
@ -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;

View File

@ -34,7 +34,9 @@
#include <pcbnew.h>
#include <class_board_item.h>
#include <class_board_connected_item.h>
#include <PolyLine.h>
#include <pcb_display_options.h>
//#include <PolyLine.h>
#include <trigo.h>
@ -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

View File

@ -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<PCB_BASE_FRAME*> ( 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 <wxPoint> 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<PCB_BASE_FRAME*> ( 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<PCB_BASE_FRAME*> ( 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 ) );
}
}

View File

@ -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
}

Some files were not shown because too many files have changed in this diff Show More