mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Move Use45Limit processing to VIEWER_TOOLS.
(We need it for the ruler in footprint preview widgets.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/20668
This commit is contained in:
parent
6bc9653029
commit
194ee9ef25
@ -54,6 +54,9 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.autozoom",
|
||||
&m_FootprintViewerAutoZoomOnSelect, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.use_45_limit",
|
||||
&m_ViewersDisplay.m_Use45Limit, true ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "footprint_viewer.show_pad_fill",
|
||||
&m_ViewersDisplay.m_DisplayPadFill, true ) );
|
||||
|
||||
|
@ -777,6 +777,8 @@ void FOOTPRINT_CHOOSER_FRAME::setupUIConditions()
|
||||
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
|
||||
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( cond.Get45degMode() ) );
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::showPadNumbers, CHECK( cond.PadNumbersDisplay() ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::padDisplayMode, CHECK( !cond.PadFillDisplay() ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::textOutlines, CHECK( !cond.TextFillDisplay() ) );
|
||||
|
@ -110,6 +110,7 @@ class PCB_VIEWERS_SETTINGS_BASE : public APP_SETTINGS_BASE
|
||||
public:
|
||||
struct VIEWERS_DISPLAY_OPTIONS
|
||||
{
|
||||
bool m_Use45Limit;
|
||||
bool m_DisplayGraphicsFill;
|
||||
bool m_DisplayTextFill;
|
||||
bool m_DisplayPadNumbers;
|
||||
|
@ -2113,25 +2113,6 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
|
||||
int DRAWING_TOOL::ToggleHV45Mode( const TOOL_EVENT& toolEvent )
|
||||
{
|
||||
#define TOGGLE( a ) a = !a
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
|
||||
if( frame()->IsType( FRAME_PCB_EDITOR ) )
|
||||
TOGGLE( mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" )->m_Use45DegreeLimit );
|
||||
else
|
||||
TOGGLE( mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" )->m_Use45Limit );
|
||||
|
||||
UpdateStatusBar();
|
||||
|
||||
return 0;
|
||||
|
||||
#undef TOGGLE
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a #PCB_SHAPE from the current state of a #TWO_POINT_GEOMETRY_MANAGER.
|
||||
*/
|
||||
@ -4169,8 +4150,6 @@ void DRAWING_TOOL::setTransitions()
|
||||
Go( &DRAWING_TOOL::PlaceImportedGraphics, PCB_ACTIONS::placeImportedGraphics.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::SetAnchor, PCB_ACTIONS::setAnchor.MakeEvent() );
|
||||
|
||||
Go( &DRAWING_TOOL::ToggleHV45Mode, PCB_ACTIONS::toggleHV45Mode.MakeEvent() );
|
||||
|
||||
Go( &DRAWING_TOOL::PlaceTuningPattern, PCB_ACTIONS::tuneSingleTrack.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::PlaceTuningPattern, PCB_ACTIONS::tuneDiffPair.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::PlaceTuningPattern, PCB_ACTIONS::tuneSkew.MakeEvent() );
|
||||
|
@ -203,8 +203,10 @@ bool PCB_EDITOR_CONDITIONS::get45degModeFunc( const SELECTION& aSelection, PCB_B
|
||||
|
||||
if( aFrame->IsType( FRAME_PCB_EDITOR ) )
|
||||
return mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" )->m_Use45DegreeLimit;
|
||||
else
|
||||
else if( aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
return mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" )->m_Use45Limit;
|
||||
else
|
||||
return aFrame->GetViewerSettingsBase()->m_ViewersDisplay.m_Use45Limit;
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,6 +105,23 @@ template<class T> void Flip( T& aValue )
|
||||
}
|
||||
|
||||
|
||||
int PCB_VIEWER_TOOLS::ToggleHV45Mode( const TOOL_EVENT& toolEvent )
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
|
||||
if( frame()->IsType( FRAME_PCB_EDITOR ) )
|
||||
Flip( mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" )->m_Use45DegreeLimit );
|
||||
else if( frame()->IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
Flip( mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" )->m_Use45Limit );
|
||||
else
|
||||
Flip( frame()->GetViewerSettingsBase()->m_ViewersDisplay.m_Use45Limit );
|
||||
|
||||
frame()->UpdateStatusBar();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_VIEWERS_SETTINGS_BASE* cfg = frame()->GetViewerSettingsBase();
|
||||
@ -331,8 +348,10 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( frame()->IsType( FRAME_PCB_EDITOR ) )
|
||||
force45Deg = mgr.GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" )->m_Use45DegreeLimit;
|
||||
else
|
||||
else if( frame()->IsType( FRAME_FOOTPRINT_EDITOR ) )
|
||||
force45Deg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" )->m_Use45Limit;
|
||||
else
|
||||
force45Deg = frame()->GetViewerSettingsBase()->m_ViewersDisplay.m_Use45Limit;
|
||||
|
||||
twoPtMgr.SetAngleSnap( force45Deg );
|
||||
twoPtMgr.SetEnd( cursorPos );
|
||||
@ -421,6 +440,8 @@ void PCB_VIEWER_TOOLS::setTransitions()
|
||||
// clang-format off
|
||||
Go( &PCB_VIEWER_TOOLS::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() );
|
||||
|
||||
Go( &PCB_VIEWER_TOOLS::ToggleHV45Mode, PCB_ACTIONS::toggleHV45Mode.MakeEvent() );
|
||||
|
||||
// Display modes
|
||||
Go( &PCB_VIEWER_TOOLS::ShowPadNumbers, PCB_ACTIONS::showPadNumbers.MakeEvent() );
|
||||
Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
|
||||
///< Launch a tool to measure between points.
|
||||
int MeasureTool( const TOOL_EVENT& aEvent );
|
||||
int ToggleHV45Mode( const TOOL_EVENT& aEvent );
|
||||
|
||||
// Display modes
|
||||
int ShowPadNumbers( const TOOL_EVENT& aEvent );
|
||||
|
Loading…
x
Reference in New Issue
Block a user