diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 5837830a3f..2d2e1f4356 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -133,9 +133,18 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent ) dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); if( dlg.ShowModal() ) + { + // Update text variables + m_frame->GetCanvas()->GetView()->MarkDirty(); + m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT ); + m_frame->GetCanvas()->Refresh(); + m_frame->OnModify(); + } else + { m_frame->RollbackSchematicFromUndo(); + } return 0; } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index bdf9b4e6c3..5615c4b58e 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -974,6 +974,8 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage ) // Make sure everything's up-to-date GetBoard()->BuildListOfNets(); + const PCB_DISPLAY_OPTIONS prevOpts = GetDisplayOptions(); + DIALOG_BOARD_SETUP dlg( this ); if( !aInitialPage.IsEmpty() ) @@ -988,24 +990,37 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage ) Kiway().CommonSettingsChanged( false, true ); - const PCB_DISPLAY_OPTIONS& opts = GetDisplayOptions(); + bool trackClearanceModeChanged = GetDisplayOptions().m_ShowTrackClearanceMode + != prevOpts.m_ShowTrackClearanceMode; + bool padClearanceModeChanged = GetDisplayOptions().m_DisplayPadClearance + != prevOpts.m_DisplayPadClearance; - if( opts.m_ShowTrackClearanceMode || opts.m_DisplayPadClearance ) - { - // Update clearance outlines - GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, - [&]( KIGFX::VIEW_ITEM* aItem ) -> bool + GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, + [&]( KIGFX::VIEW_ITEM* aItem ) -> bool + { + BOARD_ITEM* item = dynamic_cast( aItem ); + + if( !item ) + return false; + + switch( item->Type() ) { - PCB_TRACK* track = dynamic_cast( aItem ); - PAD* pad = dynamic_cast( aItem ); + case PCB_TRACE_T: + case PCB_ARC_T: + case PCB_VIA_T: + return trackClearanceModeChanged; - // PCB_TRACK is the base class of PCB_VIA and PCB_ARC so we don't need - // to check them independently + case PCB_PAD_T: + return padClearanceModeChanged; - return ( track && opts.m_ShowTrackClearanceMode ) - || ( pad && opts.m_DisplayPadClearance ); - } ); - } + case PCB_TEXT_T: + case PCB_FP_TEXT_T: + return true; // text variables + + default: + return false; + } + } ); GetCanvas()->Refresh(); diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index db09919d4c..4266f76777 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -339,9 +339,32 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent ) dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName ); if( dlg.ShowModal() == wxID_OK ) + { + m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, + [&]( KIGFX::VIEW_ITEM* aItem ) -> bool + { + BOARD_ITEM* item = dynamic_cast( aItem ); + + if( !item ) + return false; + + switch( item->Type() ) + { + case PCB_TEXT_T: + case PCB_FP_TEXT_T: + return true; // text variables + + default: + return false; + } + } ); + m_frame->OnModify(); + } else + { m_frame->RollbackFromUndo(); + } return 0; }