Fix formatting from simulator X/Y zoom changes

This commit is contained in:
ecorm 2024-01-29 23:59:12 -04:00 committed by Jeff Young
parent 16de0a666c
commit 4dcd1fb8e2
6 changed files with 84 additions and 98 deletions

View File

@ -1366,15 +1366,14 @@ EVT_MENU( mpID_ZOOM_UNDO, mpWindow::onZoomUndo )
EVT_MENU( mpID_ZOOM_REDO, mpWindow::onZoomRedo ) EVT_MENU( mpID_ZOOM_REDO, mpWindow::onZoomRedo )
END_EVENT_TABLE() END_EVENT_TABLE()
mpWindow::mpWindow() : mpWindow::mpWindow() : mpWindow( DelegatingContructorTag() )
mpWindow( DelegatingContructorTag() )
{ {
initializeGraphicsContext(); initializeGraphicsContext();
} }
mpWindow::mpWindow( wxWindow* parent, wxWindowID id ) : mpWindow::mpWindow( wxWindow* parent, wxWindowID id ) :
mpWindow( DelegatingContructorTag(), mpWindow( DelegatingContructorTag(), parent, id, wxDefaultPosition, wxDefaultSize, 0,
parent, id, wxDefaultPosition, wxDefaultSize, 0, wxT( "mathplot" ) ) wxT( "mathplot" ) )
{ {
m_popmenu.Append( mpID_ZOOM_UNDO, _( "Undo Last Zoom" ), _( "Return zoom to level prior to last zoom action" ) ); m_popmenu.Append( mpID_ZOOM_UNDO, _( "Undo Last Zoom" ), _( "Return zoom to level prior to last zoom action" ) );
m_popmenu.Append( mpID_ZOOM_REDO, _( "Redo Last Zoom" ), _( "Return zoom to level prior to last zoom undo" ) ); m_popmenu.Append( mpID_ZOOM_REDO, _( "Redo Last Zoom" ), _( "Return zoom to level prior to last zoom undo" ) );
@ -1618,9 +1617,8 @@ void mpWindow::Fit()
// JL // JL
void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax, void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax, const wxCoord* printSizeX,
const wxCoord* printSizeX, const wxCoord* printSizeY, const wxCoord* printSizeY, wxOrientation directions )
wxOrientation directions )
{ {
const bool isPrinting = printSizeX != nullptr && printSizeY != nullptr; const bool isPrinting = printSizeX != nullptr && printSizeY != nullptr;
@ -1798,8 +1796,7 @@ void mpWindow::ZoomOut( const wxPoint& centerPoint )
} }
void mpWindow::ZoomOut( const wxPoint& centerPoint, double zoomFactor, void mpWindow::ZoomOut( const wxPoint& centerPoint, double zoomFactor, wxOrientation directions )
wxOrientation directions )
{ {
if( zoomFactor == 0 ) if( zoomFactor == 0 )
zoomFactor = 1.0; zoomFactor = 1.0;
@ -2082,8 +2079,7 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
paintDC.Blit( 0, 0, m_scrX, m_scrY, targetDC, 0, 0 ); paintDC.Blit( 0, 0, m_scrX, m_scrY, targetDC, 0, 0 );
} }
void mpWindow::DoZoom( const wxPoint& centerPoint, double zoomFactor, void mpWindow::DoZoom( const wxPoint& centerPoint, double zoomFactor, wxOrientation directions )
wxOrientation directions )
{ {
if( m_yLocked ) if( m_yLocked )
{ {
@ -2225,8 +2221,7 @@ void mpWindow::PerformMouseWheelAction( wxMouseEvent& event, MouseWheelAction ac
switch( action ) switch( action )
{ {
case MouseWheelAction::NONE: case MouseWheelAction::NONE: break;
break;
case MouseWheelAction::PAN_LEFT_RIGHT: case MouseWheelAction::PAN_LEFT_RIGHT:
SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX, SetXView( m_posX + changeUnitsX, m_desiredXmax + changeUnitsX,
@ -2270,8 +2265,7 @@ void mpWindow::PerformMouseWheelAction( wxMouseEvent& event, MouseWheelAction ac
ZoomOut( clickPt, zoomIncrementalFactor, wxVERTICAL ); ZoomOut( clickPt, zoomIncrementalFactor, wxVERTICAL );
break; break;
default: default: break;
break;
} }
} }

View File

@ -551,37 +551,31 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>( m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>(
"simulator.mouse_wheel_actions.vertical_unmodified", "simulator.mouse_wheel_actions.vertical_unmodified",
&m_Simulator.preferences.mouse_wheel_actions.vertical_unmodified, &m_Simulator.preferences.mouse_wheel_actions.vertical_unmodified,
SIM_MOUSE_WHEEL_ACTION::ZOOM, SIM_MOUSE_WHEEL_ACTION::ZOOM, SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) ); SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>( m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>(
"simulator.mouse_wheel_actions.vertical_with_ctrl", "simulator.mouse_wheel_actions.vertical_with_ctrl",
&m_Simulator.preferences.mouse_wheel_actions.vertical_with_ctrl, &m_Simulator.preferences.mouse_wheel_actions.vertical_with_ctrl,
SIM_MOUSE_WHEEL_ACTION::PAN_LEFT_RIGHT, SIM_MOUSE_WHEEL_ACTION::PAN_LEFT_RIGHT, SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) ); SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>( m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>(
"simulator.mouse_wheel_actions.vertical_with_shift", "simulator.mouse_wheel_actions.vertical_with_shift",
&m_Simulator.preferences.mouse_wheel_actions.vertical_with_shift, &m_Simulator.preferences.mouse_wheel_actions.vertical_with_shift,
SIM_MOUSE_WHEEL_ACTION::PAN_UP_DOWN, SIM_MOUSE_WHEEL_ACTION::PAN_UP_DOWN, SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) ); SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>( m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>(
"simulator.mouse_wheel_actions.vertical_with_alt", "simulator.mouse_wheel_actions.vertical_with_alt",
&m_Simulator.preferences.mouse_wheel_actions.vertical_with_alt, &m_Simulator.preferences.mouse_wheel_actions.vertical_with_alt,
SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) ); SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>( m_params.emplace_back( new PARAM_ENUM<SIM_MOUSE_WHEEL_ACTION>(
"simulator.mouse_wheel_actions.horizontal", "simulator.mouse_wheel_actions.horizontal",
&m_Simulator.preferences.mouse_wheel_actions.horizontal, &m_Simulator.preferences.mouse_wheel_actions.horizontal, SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::NONE, SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY ) );
SIM_MOUSE_WHEEL_ACTION::NONE,
SIM_MOUSE_WHEEL_ACTION::ZOOM_VERTICALLY) );
m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h", m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
&m_SymChooserPanel.sash_pos_h, -1 ) ); &m_SymChooserPanel.sash_pos_h, -1 ) );

View File

@ -197,8 +197,7 @@ public:
void ApplyPreferences( const SIM_PREFERENCES& aPrefs ) override void ApplyPreferences( const SIM_PREFERENCES& aPrefs ) override
{ {
m_plotWin->SetMouseWheelActions( m_plotWin->SetMouseWheelActions( convertMouseWheelActions( aPrefs.mouse_wheel_actions ) );
convertMouseWheelActions( aPrefs.mouse_wheel_actions ) );
} }
wxString GetLabelX() const wxString GetLabelX() const
@ -368,8 +367,8 @@ private:
static mpWindow::MouseWheelActionSet static mpWindow::MouseWheelActionSet
convertMouseWheelActions( const SIM_MOUSE_WHEEL_ACTION_SET& s ) convertMouseWheelActions( const SIM_MOUSE_WHEEL_ACTION_SET& s )
{ {
static_assert( static_cast<unsigned>(mpWindow::MouseWheelAction::COUNT) == static_assert( static_cast<unsigned>( mpWindow::MouseWheelAction::COUNT )
static_cast<unsigned>(SIM_MOUSE_WHEEL_ACTION::COUNT), == static_cast<unsigned>( SIM_MOUSE_WHEEL_ACTION::COUNT ),
"mpWindow::MouseWheelAction enum must match SIM_MOUSE_WHEEL_ACTION" ); "mpWindow::MouseWheelAction enum must match SIM_MOUSE_WHEEL_ACTION" );
using A = mpWindow::MouseWheelAction; using A = mpWindow::MouseWheelAction;

View File

@ -1124,8 +1124,7 @@ public:
* position on the screen after the zoom (by default, the center of the mpWindow). * position on the screen after the zoom (by default, the center of the mpWindow).
*/ */
void ZoomIn( const wxPoint& centerPoint = wxDefaultPosition ); void ZoomIn( const wxPoint& centerPoint = wxDefaultPosition );
void ZoomIn( const wxPoint& centerPoint, double zoomFactor, void ZoomIn( const wxPoint& centerPoint, double zoomFactor, wxOrientation directions = wxBOTH );
wxOrientation directions = wxBOTH );
/** Zoom out current view and refresh display /** Zoom out current view and refresh display
* @param centerPoint The point (pixel coordinates) that will stay in the same * @param centerPoint The point (pixel coordinates) that will stay in the same