diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 6ac4f19566..6b49bfa391 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include #include @@ -1282,7 +1284,23 @@ int SCH_EDITOR_CONTROL::AssignNetclass( const TOOL_EVENT& aEvent ) getView()->UpdateAllItemsConditionally( KIGFX::REPAINT, []( KIGFX::VIEW_ITEM* aItem ) -> bool { - return dynamic_cast( aItem ); + // Netclass coloured items + // + if( dynamic_cast( aItem ) ) + return true; + else if( dynamic_cast( aItem ) ) + return true; + else if( dynamic_cast( aItem ) ) + return true; + + // Items that might reference an item's netclass name + // + EDA_TEXT* text = dynamic_cast( aItem ); + + if( text && text->HasTextVars() ) + return true; + + return false; } ); } } diff --git a/pcbnew/dialogs/dialog_net_inspector.cpp b/pcbnew/dialogs/dialog_net_inspector.cpp index c4a445141c..4cad374326 100644 --- a/pcbnew/dialogs/dialog_net_inspector.cpp +++ b/pcbnew/dialogs/dialog_net_inspector.cpp @@ -2148,8 +2148,15 @@ void DIALOG_NET_INSPECTOR::onDeleteNet( wxCommandEvent& aEvent ) m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, [removedCode]( KIGFX::VIEW_ITEM* aItem ) -> bool { - if( auto bci = dynamic_cast( aItem ) ) - return bci->GetNetCode() == removedCode; + auto boardItem = dynamic_cast( aItem ); + + if( boardItem && boardItem->GetNetCode() == removedCode ) + return true; + + EDA_TEXT* text = dynamic_cast( aItem ); + + if( text && text->HasTextVars() ) + return true; return false; } ); diff --git a/pcbnew/netlist_reader/netlist.cpp b/pcbnew/netlist_reader/netlist.cpp index 1662e69319..6b1fac3481 100644 --- a/pcbnew/netlist_reader/netlist.cpp +++ b/pcbnew/netlist_reader/netlist.cpp @@ -87,10 +87,31 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR SetMsgPanel( board ); - // Update rendered tracks and vias net labels - // TODO is there a way to extract information about which nets were modified? - for( auto track : board->Tracks() ) - GetCanvas()->GetView()->Update( track ); + // Update rendered track/via/pad net labels, and any text items that might reference a + // netName or netClass + int netNamesCfg = GetPcbNewSettings()->m_Display.m_NetNames; + + GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, + [&]( KIGFX::VIEW_ITEM* aItem ) -> bool + { + if( dynamic_cast( aItem ) ) + { + if( netNamesCfg == 2 || netNamesCfg == 3 ) + return true; + } + else if( dynamic_cast( aItem ) ) + { + if( netNamesCfg == 1 || netNamesCfg == 3 ) + return true; + } + + EDA_TEXT* text = dynamic_cast( aItem ); + + if( text && text->HasTextVars() ) + return true; + + return false; + } ); // Spread new footprints. std::vector newFootprints = aUpdater.GetAddedFootprints(); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 5c893740b3..a420f67775 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -1144,26 +1144,28 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage ) PCBNEW_SETTINGS* settings = GetPcbNewSettings(); static LSET maskAndPasteLayers = LSET( 4, F_Mask, F_Paste, B_Mask, B_Paste ); - bool maskOrPasteVisible = ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any(); - GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, [&]( KIGFX::VIEW_ITEM* aItem ) -> bool { if( dynamic_cast( aItem ) ) { - return settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS; + if( settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS ) + return true; } else if( dynamic_cast( aItem ) ) { - return settings->m_Display.m_PadClearance || maskOrPasteVisible; - } - else if( dynamic_cast( aItem ) ) - { - EDA_TEXT* text = dynamic_cast( aItem ); + if( settings->m_Display.m_PadClearance ) + return true; - return text->HasTextVars(); + if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() ) + return true; } + EDA_TEXT* text = dynamic_cast( aItem ); + + if( text && text->HasTextVars() ) + return true; + return false; } ); diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index f5097d498f..d8e80fa779 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -294,7 +294,7 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent ) m_frame->SaveCopyInUndoList( undoCmd, UNDO_REDO::PAGESETTINGS ); DIALOG_PAGES_SETTINGS dlg( m_frame, pcbIUScale.IU_PER_MILS, wxSize( MAX_PAGE_SIZE_PCBNEW_MILS, - MAX_PAGE_SIZE_PCBNEW_MILS ) ); + MAX_PAGE_SIZE_PCBNEW_MILS ) ); dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); if( dlg.ShowModal() == wxID_OK ) @@ -302,20 +302,12 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent ) m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, [&]( KIGFX::VIEW_ITEM* aItem ) -> bool { - BOARD_ITEM* item = dynamic_cast( aItem ); + EDA_TEXT* text = dynamic_cast( aItem ); - if( !item ) - return false; + if( text && text->HasTextVars() ) + return true; - switch( item->Type() ) - { - case PCB_TEXT_T: - case PCB_FP_TEXT_T: - return true; // text variables - - default: - return false; - } + return false; } ); m_frame->OnModify();