Remove assert and update ruler units on the fly.
Fixes: lp:1781595 * https://bugs.launchpad.net/kicad/+bug/1781595
This commit is contained in:
parent
185b524a62
commit
16b5f40817
|
@ -71,10 +71,14 @@ public:
|
|||
return wxT( "RULER_ITEM" );
|
||||
}
|
||||
|
||||
private:
|
||||
void UpdateUserUnits( EDA_UNITS_T aUserUnits )
|
||||
{
|
||||
m_userUnits = aUserUnits;
|
||||
}
|
||||
|
||||
private:
|
||||
const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr;
|
||||
const EDA_UNITS_T m_userUnits;
|
||||
EDA_UNITS_T m_userUnits;
|
||||
};
|
||||
|
||||
} // PREVIEW
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <class_board.h>
|
||||
#include <view/view.h>
|
||||
|
||||
#include <tools/pcb_actions.h>
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||
{
|
||||
|
@ -81,3 +81,13 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::unitsChangeRefresh()
|
||||
{
|
||||
PCB_BASE_FRAME::unitsChangeRefresh(); // Update the status bar.
|
||||
|
||||
GetToolManager()->RunAction( PCB_ACTIONS::switchUnits, true ); // Notify tools.
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ protected:
|
|||
* duplicateItem(BOARD_ITEM*, bool) above
|
||||
*/
|
||||
virtual void duplicateItems( bool aIncrement ) = 0;
|
||||
|
||||
void unitsChangeRefresh() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
|
||||
const wxChar PCB_BASE_FRAME::CANVAS_TYPE_KEY[] = wxT( "canvas_type" );
|
||||
|
||||
|
|
|
@ -975,7 +975,7 @@ void PCB_EDIT_FRAME::OnUpdateLayerAlpha( wxUpdateUIEvent & )
|
|||
|
||||
void PCB_EDIT_FRAME::unitsChangeRefresh()
|
||||
{
|
||||
PCB_BASE_FRAME::unitsChangeRefresh(); // Update the grid size select box.
|
||||
PCB_BASE_EDIT_FRAME::unitsChangeRefresh(); // Update the grid size select box.
|
||||
|
||||
ReCreateAuxiliaryToolbar();
|
||||
}
|
||||
|
|
|
@ -1253,6 +1253,14 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
view.Update( &ruler, KIGFX::GEOMETRY );
|
||||
}
|
||||
|
||||
else if( evt->IsAction( &PCB_ACTIONS::switchUnits ) )
|
||||
{
|
||||
ruler.UpdateUserUnits( frame()->GetUserUnits() );
|
||||
|
||||
view.SetVisible( &ruler, true );
|
||||
view.Update( &ruler, KIGFX::GEOMETRY );
|
||||
}
|
||||
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
{
|
||||
GetManager()->PassEvent();
|
||||
|
|
Loading…
Reference in New Issue