Update text variables when they change.
Fixes https://gitlab.com/kicad/code/kicad/issues/10734
This commit is contained in:
parent
d6a86fa9e0
commit
69b69aa431
|
@ -133,9 +133,18 @@ int SCH_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
|
||||||
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
|
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
|
||||||
|
|
||||||
if( dlg.ShowModal() )
|
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();
|
m_frame->OnModify();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_frame->RollbackSchematicFromUndo();
|
m_frame->RollbackSchematicFromUndo();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -974,6 +974,8 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
|
||||||
// Make sure everything's up-to-date
|
// Make sure everything's up-to-date
|
||||||
GetBoard()->BuildListOfNets();
|
GetBoard()->BuildListOfNets();
|
||||||
|
|
||||||
|
const PCB_DISPLAY_OPTIONS prevOpts = GetDisplayOptions();
|
||||||
|
|
||||||
DIALOG_BOARD_SETUP dlg( this );
|
DIALOG_BOARD_SETUP dlg( this );
|
||||||
|
|
||||||
if( !aInitialPage.IsEmpty() )
|
if( !aInitialPage.IsEmpty() )
|
||||||
|
@ -988,24 +990,37 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
|
||||||
|
|
||||||
Kiway().CommonSettingsChanged( false, true );
|
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 )
|
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
||||||
{
|
[&]( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||||
// Update clearance outlines
|
{
|
||||||
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
|
||||||
[&]( KIGFX::VIEW_ITEM* aItem ) -> bool
|
|
||||||
|
if( !item )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( aItem );
|
case PCB_TRACE_T:
|
||||||
PAD* pad = dynamic_cast<PAD*>( aItem );
|
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
|
case PCB_PAD_T:
|
||||||
// to check them independently
|
return padClearanceModeChanged;
|
||||||
|
|
||||||
return ( track && opts.m_ShowTrackClearanceMode )
|
case PCB_TEXT_T:
|
||||||
|| ( pad && opts.m_DisplayPadClearance );
|
case PCB_FP_TEXT_T:
|
||||||
} );
|
return true; // text variables
|
||||||
}
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
|
|
||||||
|
|
|
@ -339,9 +339,32 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
|
||||||
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
|
dlg.SetWksFileName( BASE_SCREEN::m_DrawingSheetFileName );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
|
{
|
||||||
|
m_frame->GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
||||||
|
[&]( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||||
|
{
|
||||||
|
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( 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();
|
m_frame->OnModify();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_frame->RollbackFromUndo();
|
m_frame->RollbackFromUndo();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue