ADDED: Control to only show ratsnest for visible layers
This commit is contained in:
parent
5ec18aaf2a
commit
147540b3bb
|
@ -150,6 +150,10 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
|
|||
&m_NetColorMode, NET_COLOR_MODE::RATSNEST, NET_COLOR_MODE::OFF,
|
||||
NET_COLOR_MODE::ALL ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_ENUM<RATSNEST_MODE>( "board.ratsnest_display_mode",
|
||||
&m_RatsnestMode, RATSNEST_MODE::ALL, RATSNEST_MODE::ALL,
|
||||
RATSNEST_MODE::VISIBLE ) );
|
||||
|
||||
// TODO: move the rest of PCB_DISPLAY_OPTIONS that are project-specific in here
|
||||
#if 0
|
||||
m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "board.zone_display_mode",
|
||||
|
|
|
@ -89,6 +89,9 @@ public:
|
|||
/// How to use color overrides on specific nets and netclasses
|
||||
NET_COLOR_MODE m_NetColorMode;
|
||||
|
||||
/// Ratsnest draw mode (all layers vs only visible layers)
|
||||
RATSNEST_MODE m_RatsnestMode;
|
||||
|
||||
int m_MaxLinksShowed; // in track creation: number of hairwires shown
|
||||
bool m_ShowModuleRatsnest; // When moving a footprint: allows displaying a ratsnest
|
||||
bool m_ShowGlobalRatsnest; // If true, show all
|
||||
|
|
|
@ -101,6 +101,13 @@ enum class NET_COLOR_MODE
|
|||
ALL ///< Net/netclass colors are shown on all net copper
|
||||
};
|
||||
|
||||
///> Determines how ratsnest lines are drawn
|
||||
enum class RATSNEST_MODE
|
||||
{
|
||||
ALL, ///< Ratsnest lines are drawn to items on all layers (default)
|
||||
VISIBLE ///< Ratsnest lines are drawn to items on visible layers only
|
||||
};
|
||||
|
||||
/**
|
||||
* A saved set of layers that are visible
|
||||
*/
|
||||
|
|
|
@ -118,6 +118,9 @@ public:
|
|||
/// The current net color mode
|
||||
NET_COLOR_MODE m_NetColorMode;
|
||||
|
||||
/// The current ratsnest draw mode
|
||||
RATSNEST_MODE m_RatsnestMode;
|
||||
|
||||
/// How zones are drawn (TODO: not yet used)
|
||||
ZONE_DISPLAY_MODE m_ZoneDisplayMode;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS()
|
|||
* 3 show netnames on tracks and pads */
|
||||
m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
|
||||
m_NetColorMode = NET_COLOR_MODE::RATSNEST;
|
||||
m_RatsnestMode = RATSNEST_MODE::ALL;
|
||||
m_MaxLinksShowed = 3; // in track creation: number of hairwires shown
|
||||
m_ShowModuleRatsnest = true; // When moving a footprint: allows displaying a ratsnest
|
||||
m_DisplayRatsnestLinesCurved = false;
|
||||
|
|
|
@ -64,6 +64,7 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
|
|||
m_sketchText = false;
|
||||
m_netColorMode = NET_COLOR_MODE::RATSNEST;
|
||||
m_contrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
|
||||
m_ratsnestDisplayMode = RATSNEST_MODE::ALL;
|
||||
|
||||
m_trackOpacity = 1.0;
|
||||
m_viaOpacity = 1.0;
|
||||
|
@ -208,6 +209,8 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS& aOption
|
|||
|
||||
m_netColorMode = aOptions.m_NetColorMode;
|
||||
|
||||
m_ratsnestDisplayMode = aOptions.m_RatsnestMode;
|
||||
|
||||
m_trackOpacity = aOptions.m_TrackOpacity;
|
||||
m_viaOpacity = aOptions.m_ViaOpacity;
|
||||
m_padOpacity = aOptions.m_PadOpacity;
|
||||
|
|
|
@ -174,6 +174,9 @@ public:
|
|||
NET_COLOR_MODE GetNetColorMode() const { return m_netColorMode; }
|
||||
void SetNetColorMode( NET_COLOR_MODE aMode ) { m_netColorMode = aMode; }
|
||||
|
||||
RATSNEST_MODE GetRatsnestDisplayMode() const { return m_ratsnestDisplayMode; }
|
||||
void SetRatsnestDisplayMode( RATSNEST_MODE aMode ) { m_ratsnestDisplayMode = aMode; }
|
||||
|
||||
std::map<wxString, KIGFX::COLOR4D>& GetNetclassColorMap() { return m_netclassColors; }
|
||||
|
||||
std::map<int, KIGFX::COLOR4D>& GetNetColorMap() { return m_netColors; }
|
||||
|
@ -238,6 +241,8 @@ protected:
|
|||
///> How to display inactive layers (HIGH_CONTRAST_MODE:NORMAL, DIMMED or HIDDEN )
|
||||
HIGH_CONTRAST_MODE m_contrastModeDisplay;
|
||||
|
||||
RATSNEST_MODE m_ratsnestDisplayMode;
|
||||
|
||||
// These opacity overrides multiply with any opacity in the base layer color
|
||||
double m_trackOpacity; ///< Opacity override for all tracks
|
||||
double m_viaOpacity; ///< Opacity override for all types of via
|
||||
|
|
|
@ -133,6 +133,7 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
|
|||
PCB_DISPLAY_OPTIONS opts = GetDisplayOptions();
|
||||
opts.m_ContrastModeDisplay = localSettings.m_ContrastModeDisplay;
|
||||
opts.m_NetColorMode = localSettings.m_NetColorMode;
|
||||
opts.m_RatsnestMode = localSettings.m_RatsnestMode;
|
||||
opts.m_TrackOpacity = localSettings.m_TrackOpacity;
|
||||
opts.m_ViaOpacity = localSettings.m_ViaOpacity;
|
||||
opts.m_PadOpacity = localSettings.m_PadOpacity;
|
||||
|
@ -179,6 +180,7 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
|
|||
|
||||
localSettings.m_ContrastModeDisplay = displayOpts.m_ContrastModeDisplay;
|
||||
localSettings.m_NetColorMode = displayOpts.m_NetColorMode;
|
||||
localSettings.m_RatsnestMode = displayOpts.m_RatsnestMode;
|
||||
localSettings.m_TrackOpacity = displayOpts.m_TrackOpacity;
|
||||
localSettings.m_ViaOpacity = displayOpts.m_ViaOpacity;
|
||||
localSettings.m_PadOpacity = displayOpts.m_PadOpacity;
|
||||
|
|
|
@ -87,6 +87,14 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
|||
std::map<wxString, KIGFX::COLOR4D>& netclassColors = rs->GetNetclassColorMap();
|
||||
const std::map<int, wxString>& netclassMap = m_data->GetNetclassMap();
|
||||
|
||||
const bool onlyVisibleLayers = rs->GetRatsnestDisplayMode() == RATSNEST_MODE::VISIBLE;
|
||||
|
||||
LSET visibleLayers;
|
||||
|
||||
for( PCB_LAYER_ID layer : LSET::AllCuMask().Seq() )
|
||||
if( aView->IsLayerVisible( layer ) )
|
||||
visibleLayers.set( layer );
|
||||
|
||||
const bool curved_ratsnest = rs->GetCurvedRatsnestLinesEnabled();
|
||||
|
||||
// Draw the "dynamic" ratsnest (i.e. for objects that may be currently being moved)
|
||||
|
@ -186,6 +194,16 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
|||
show = sourceNode->Parent()->GetLocalRatsnestVisible() ||
|
||||
targetNode->Parent()->GetLocalRatsnestVisible();
|
||||
|
||||
if( onlyVisibleLayers && show )
|
||||
{
|
||||
LSET sourceLayers = sourceNode->Parent()->GetLayerSet();
|
||||
LSET targetLayers = targetNode->Parent()->GetLayerSet();
|
||||
|
||||
if( !( sourceLayers & visibleLayers ).any() ||
|
||||
!( targetLayers & visibleLayers ).any() )
|
||||
show = false;
|
||||
}
|
||||
|
||||
if ( enable && show )
|
||||
{
|
||||
if ( source == target )
|
||||
|
|
|
@ -609,16 +609,17 @@ void APPEARANCE_CONTROLS::createControls()
|
|||
m_paneNetDisplayOptions->Collapse();
|
||||
m_paneNetDisplayOptions->SetBackgroundColour( m_notebook->GetThemeBackgroundColour() );
|
||||
|
||||
wxWindow* netDisplayPane = m_paneNetDisplayOptions->GetPane();
|
||||
wxBoxSizer* netDisplayOptionsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxWindow* netDisplayPane = m_paneNetDisplayOptions->GetPane();
|
||||
//// Net color mode
|
||||
|
||||
m_staticTextNetDisplayTitle = new wxStaticText( netDisplayPane, wxID_ANY, _( "Net colors:" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextNetDisplayTitle->Wrap( -1 );
|
||||
m_staticTextNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) );
|
||||
m_txtNetDisplayTitle = new wxStaticText( netDisplayPane, wxID_ANY, _( "Net colors:" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_txtNetDisplayTitle->Wrap( -1 );
|
||||
m_txtNetDisplayTitle->SetToolTip( _( "Choose when to show net and netclass colors" ) );
|
||||
|
||||
netDisplayOptionsSizer->Add( m_staticTextNetDisplayTitle, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
|
||||
netDisplayOptionsSizer->Add( m_txtNetDisplayTitle, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
|
||||
|
||||
wxBoxSizer* netColorSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
@ -641,7 +642,35 @@ void APPEARANCE_CONTROLS::createControls()
|
|||
|
||||
netColorSizer->Add( m_rbNetColorOff, 0, 0, 5 );
|
||||
|
||||
netDisplayOptionsSizer->Add( netColorSizer, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
netDisplayOptionsSizer->Add( netColorSizer, 0, wxEXPAND | wxBOTTOM, 5 );
|
||||
|
||||
//// Ratsnest display
|
||||
|
||||
m_txtRatsnestVisibility = new wxStaticText( netDisplayPane, wxID_ANY, _( "Ratsnest display:" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_txtRatsnestVisibility->Wrap( -1 );
|
||||
m_txtRatsnestVisibility->SetToolTip( _( "Choose what ratsnest lines to display" ) );
|
||||
|
||||
netDisplayOptionsSizer->Add( m_txtRatsnestVisibility, 0, wxEXPAND | wxBOTTOM | wxLEFT, 2 );
|
||||
|
||||
wxBoxSizer* ratsnestDisplayModeSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_rbRatsnestAllLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "All layers" ),
|
||||
wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
m_rbRatsnestAllLayers->SetToolTip( _( "Ratsnest lines are shown to items on all layers" ) );
|
||||
m_rbRatsnestAllLayers->SetValue( true );
|
||||
|
||||
ratsnestDisplayModeSizer->Add( m_rbRatsnestAllLayers, 0, wxRIGHT, 10 );
|
||||
|
||||
m_rbRatsnestVisibleLayers = new wxRadioButton( netDisplayPane, wxID_ANY, _( "Visible layers" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_rbRatsnestVisibleLayers->SetToolTip( _( "Ratsnest lines are shown to items on visible layers" ) );
|
||||
|
||||
ratsnestDisplayModeSizer->Add( m_rbRatsnestVisibleLayers, 0, wxRIGHT, 4 );
|
||||
|
||||
netDisplayOptionsSizer->Add( ratsnestDisplayModeSizer, 0, wxEXPAND | wxBOTTOM, 5 );
|
||||
|
||||
////
|
||||
|
||||
netDisplayPane->SetSizer( netDisplayOptionsSizer );
|
||||
netDisplayPane->Layout();
|
||||
|
@ -662,6 +691,11 @@ void APPEARANCE_CONTROLS::createControls()
|
|||
m_rbNetColorOff->Bind( wxEVT_RADIOBUTTON, &APPEARANCE_CONTROLS::onNetColorModeChanged, this );
|
||||
m_rbNetColorRatsnest->Bind( wxEVT_RADIOBUTTON,
|
||||
&APPEARANCE_CONTROLS::onNetColorModeChanged, this );
|
||||
|
||||
m_rbRatsnestAllLayers->Bind( wxEVT_RADIOBUTTON,
|
||||
&APPEARANCE_CONTROLS::onRatsnestModeChanged, this );
|
||||
m_rbRatsnestVisibleLayers->Bind( wxEVT_RADIOBUTTON,
|
||||
&APPEARANCE_CONTROLS::onRatsnestModeChanged, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1048,6 +1082,11 @@ void APPEARANCE_CONTROLS::UpdateDisplayOptions()
|
|||
case NET_COLOR_MODE::OFF: m_rbNetColorOff->SetValue( true ); break;
|
||||
}
|
||||
|
||||
if( options.m_RatsnestMode == RATSNEST_MODE::ALL )
|
||||
m_rbRatsnestAllLayers->SetValue( true );
|
||||
else
|
||||
m_rbRatsnestVisibleLayers->SetValue( true );
|
||||
|
||||
wxASSERT( m_objectSettingsMap.count( LAYER_RATSNEST ) );
|
||||
APPEARANCE_SETTING* ratsnest = m_objectSettingsMap.at( LAYER_RATSNEST );
|
||||
ratsnest->ctl_visibility->SetValue( options.m_ShowGlobalRatsnest );
|
||||
|
@ -2360,6 +2399,21 @@ void APPEARANCE_CONTROLS::onNetColorModeChanged( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS::onRatsnestModeChanged( wxCommandEvent& aEvent )
|
||||
{
|
||||
PCB_DISPLAY_OPTIONS options = m_frame->GetDisplayOptions();
|
||||
|
||||
if( m_rbRatsnestAllLayers->GetValue() )
|
||||
options.m_RatsnestMode = RATSNEST_MODE::ALL;
|
||||
else
|
||||
options.m_RatsnestMode = RATSNEST_MODE::VISIBLE;
|
||||
|
||||
m_frame->SetDisplayOptions( options );
|
||||
m_frame->GetCanvas()->RedrawRatsnest();
|
||||
passOnFocus();
|
||||
}
|
||||
|
||||
|
||||
void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
|
||||
{
|
||||
KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
|
||||
|
|
|
@ -349,10 +349,13 @@ private:
|
|||
// Net display options controls
|
||||
|
||||
WX_COLLAPSIBLE_PANE* m_paneNetDisplayOptions;
|
||||
wxStaticText* m_staticTextNetDisplayTitle;
|
||||
wxStaticText* m_txtNetDisplayTitle;
|
||||
wxRadioButton* m_rbNetColorAll;
|
||||
wxRadioButton* m_rbNetColorRatsnest;
|
||||
wxRadioButton* m_rbNetColorOff;
|
||||
wxStaticText* m_txtRatsnestVisibility;
|
||||
wxRadioButton* m_rbRatsnestAllLayers;
|
||||
wxRadioButton* m_rbRatsnestVisibleLayers;
|
||||
|
||||
enum POPUP_ID
|
||||
{
|
||||
|
@ -424,6 +427,8 @@ private:
|
|||
|
||||
void onNetColorModeChanged( wxCommandEvent& aEvent );
|
||||
|
||||
void onRatsnestModeChanged( wxCommandEvent& aEvent );
|
||||
|
||||
void onNetclassContextMenu( wxCommandEvent& aEvent );
|
||||
|
||||
void handleBoardItemsChanged();
|
||||
|
|
Loading…
Reference in New Issue