Commit 0bdf5bac authored by Emmeran's avatar Emmeran

added option to allow zooming around the crosshair instead of the center; can...

added option to allow zooming around the crosshair instead of the center; can be enabled via options or by holding alt while using the mousewheel
parent 638decaf
...@@ -66,6 +66,7 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME ) ...@@ -66,6 +66,7 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, EDA_BASE_FRAME )
EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen ) EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate ) EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
EVT_MENU_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_DRAW_FRAME::OnZoom ) EVT_MENU_RANGE( ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_OFFCENTER_ZOOM_IN, ID_OFFCENTER_ZOOM_OUT, EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE,
EDA_DRAW_FRAME::OnZoom ) EDA_DRAW_FRAME::OnZoom )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
......
...@@ -44,6 +44,7 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels ...@@ -44,6 +44,7 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
#define CLIP_BOX_PADDING 2 #define CLIP_BOX_PADDING 2
// keys to store options in config: // keys to store options in config:
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" ) #define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" ) #define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" ) #define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
...@@ -102,6 +103,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -102,6 +103,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_canStartBlock = -1; // Command block can start if >= 0 m_canStartBlock = -1; // Command block can start if >= 0
m_abortRequest = false; m_abortRequest = false;
m_enableMiddleButtonPan = false; m_enableMiddleButtonPan = false;
m_enableZoomNoCenter = false;
m_panScrollbarLimits = false; m_panScrollbarLimits = false;
m_enableAutoPan = true; m_enableAutoPan = true;
m_ignoreMouseEvents = false; m_ignoreMouseEvents = false;
...@@ -113,6 +115,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -113,6 +115,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
if( wxGetApp().GetSettings() ) if( wxGetApp().GetSettings() )
{ {
wxGetApp().GetSettings()->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false ); wxGetApp().GetSettings()->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false );
wxGetApp().GetSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
wxGetApp().GetSettings()->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false ); wxGetApp().GetSettings()->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
wxGetApp().GetSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true ); wxGetApp().GetSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
} }
...@@ -137,6 +140,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -137,6 +140,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
EDA_DRAW_PANEL::~EDA_DRAW_PANEL() EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
{ {
wxGetApp().GetSettings()->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan ); wxGetApp().GetSettings()->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
wxGetApp().GetSettings()->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
wxGetApp().GetSettings()->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits ); wxGetApp().GetSettings()->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
wxGetApp().GetSettings()->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan ); wxGetApp().GetSettings()->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan );
} }
...@@ -154,6 +158,23 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen() ...@@ -154,6 +158,23 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
return parentFrame->GetScreen(); return parentFrame->GetScreen();
} }
wxPoint EDA_DRAW_PANEL::ToDeviceXY( const wxPoint& pos )
{
wxPoint ret;
INSTALL_UNBUFFERED_DC( dc, this );
ret.x = dc.LogicalToDeviceX( pos.x );
ret.y = dc.LogicalToDeviceY( pos.y );
return ret;
}
wxPoint EDA_DRAW_PANEL::ToLogicalXY( const wxPoint& pos )
{
wxPoint ret;
INSTALL_UNBUFFERED_DC( dc, this );
ret.x = dc.DeviceToLogicalX( pos.x );
ret.y = dc.DeviceToLogicalY( pos.y );
return ret;
}
void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor ) void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
{ {
...@@ -856,6 +877,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) ...@@ -856,6 +877,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
cmd.SetId( ID_PAN_UP ); cmd.SetId( ID_PAN_UP );
else if( event.ControlDown() && !event.ShiftDown() ) else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT ); cmd.SetId( ID_PAN_LEFT );
else if( event.AltDown() || m_enableZoomNoCenter)
cmd.SetId( ID_OFFCENTER_ZOOM_IN );
else else
cmd.SetId( ID_POPUP_ZOOM_IN ); cmd.SetId( ID_POPUP_ZOOM_IN );
} }
...@@ -865,6 +888,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) ...@@ -865,6 +888,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
cmd.SetId( ID_PAN_DOWN ); cmd.SetId( ID_PAN_DOWN );
else if( event.ControlDown() && !event.ShiftDown() ) else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT ); cmd.SetId( ID_PAN_RIGHT );
else if( event.AltDown() || m_enableZoomNoCenter)
cmd.SetId( ID_OFFCENTER_ZOOM_OUT );
else else
cmd.SetId( ID_POPUP_ZOOM_OUT ); cmd.SetId( ID_POPUP_ZOOM_OUT );
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <base_units.h> #include <base_units.h>
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ) void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
{ {
AdjustScrollBars( aCenterPoint ); AdjustScrollBars( aCenterPoint );
...@@ -53,6 +54,18 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe ...@@ -53,6 +54,18 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
m_canvas->Update(); m_canvas->Update();
} }
void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
{
wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2; // relative screen position to center before zoom
wxPoint newScreenPos = m_canvas->ToDeviceXY( GetScreen()->GetCrossHairPosition() ); // screen position of crosshair after zoom
wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos );
AdjustScrollBars( newCenter );
m_canvas->Refresh();
m_canvas->Update();
}
void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer ) void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
{ {
...@@ -111,6 +124,12 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) ...@@ -111,6 +124,12 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_OFFCENTER_ZOOM_IN:
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() );
if( screen->SetPreviousZoom() )
RedrawScreen2( center );
break;
case ID_POPUP_ZOOM_IN: case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true; zoom_at_cursor = true;
center = screen->GetCrossHairPosition(); center = screen->GetCrossHairPosition();
...@@ -121,6 +140,12 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event ) ...@@ -121,6 +140,12 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
RedrawScreen( center, zoom_at_cursor ); RedrawScreen( center, zoom_at_cursor );
break; break;
case ID_OFFCENTER_ZOOM_OUT:
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() );
if( screen->SetNextZoom() )
RedrawScreen2( center );
break;
case ID_POPUP_ZOOM_OUT: case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true; zoom_at_cursor = true;
center = screen->GetCrossHairPosition(); center = screen->GetCrossHairPosition();
......
...@@ -77,6 +77,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() ...@@ -77,6 +77,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
m_TextDisplayOption->SetSelection( m_Parent->m_DisplayModText ); m_TextDisplayOption->SetSelection( m_Parent->m_DisplayModText );
m_IsShowPadFill->SetValue( m_Parent->m_DisplayPadFill ); m_IsShowPadFill->SetValue( m_Parent->m_DisplayPadFill );
m_IsShowPadNum->SetValue( m_Parent->m_DisplayPadNum ); m_IsShowPadNum->SetValue( m_Parent->m_DisplayPadNum );
m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() ); m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() );
m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() ); m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() );
m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() ); m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() );
...@@ -94,6 +95,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) ...@@ -94,6 +95,7 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() );
m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() ); m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() );
m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() ); m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() );
m_Parent->GetCanvas()->Refresh(); m_Parent->GetCanvas()->Refresh();
......
...@@ -54,6 +54,9 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( ...@@ -54,6 +54,9 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
wxStaticBoxSizer* sbSizerViewOpt; wxStaticBoxSizer* sbSizerViewOpt;
sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL ); sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL );
m_IsZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Zoom off center"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxALL|wxEXPAND, 5 );
m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 ); m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxALL|wxEXPAND, 5 ); sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxALL|wxEXPAND, 5 );
......
...@@ -43,6 +43,7 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM ...@@ -43,6 +43,7 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxRadioBox* m_TextDisplayOption; wxRadioBox* m_TextDisplayOption;
wxCheckBox* m_IsShowPadFill; wxCheckBox* m_IsShowPadFill;
wxCheckBox* m_IsShowPadNum; wxCheckBox* m_IsShowPadNum;
wxCheckBox* m_IsZoomNoCenter;
wxCheckBox* m_IsMiddleButtonPan; wxCheckBox* m_IsMiddleButtonPan;
wxCheckBox* m_IsMiddleButtonPanLimited; wxCheckBox* m_IsMiddleButtonPanLimited;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
......
...@@ -81,6 +81,15 @@ public: ...@@ -81,6 +81,15 @@ public:
void SetShowHiddenPins( bool show ) { m_checkShowHiddenPins->SetValue( show ); } void SetShowHiddenPins( bool show ) { m_checkShowHiddenPins->SetValue( show ); }
bool GetShowHiddenPins( void ) { return m_checkShowHiddenPins->GetValue(); } bool GetShowHiddenPins( void ) { return m_checkShowHiddenPins->GetValue(); }
void SetEnableZoomNoCenter( bool enable )
{
m_checkEnableZoomNoCenter->SetValue( enable );
}
bool GetEnableZoomNoCenter( void )
{
return m_checkEnableZoomNoCenter->GetValue();
}
void SetEnableMiddleButtonPan( bool enable ) void SetEnableMiddleButtonPan( bool enable )
{ {
m_checkEnableMiddleButtonPan->SetValue( enable ); m_checkEnableMiddleButtonPan->SetValue( enable );
......
...@@ -155,6 +155,11 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -155,6 +155,11 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_checkShowHiddenPins = new wxCheckBox( m_panel1, wxID_ANY, _("Show hi&dden pins"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowHiddenPins = new wxCheckBox( m_panel1, wxID_ANY, _("Show hi&dden pins"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 ); bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 );
m_checkEnableZoomNoCenter = new wxCheckBox( m_panel1, xwID_ANY, _("Enable zooming off center"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkEnableZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") );
bSizer2->Add( m_checkEnableZoomNoCenter, 0, wxALL, 3 );
m_checkEnableMiddleButtonPan = new wxCheckBox( m_panel1, xwID_ANY, _("Enable middle mouse button panning"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkEnableMiddleButtonPan = new wxCheckBox( m_panel1, xwID_ANY, _("Enable middle mouse button panning"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkEnableMiddleButtonPan->SetToolTip( _("Use middle mouse button dragging to pan") ); m_checkEnableMiddleButtonPan->SetToolTip( _("Use middle mouse button dragging to pan") );
......
...@@ -81,6 +81,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog ...@@ -81,6 +81,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
wxStaticText* m_staticText23; wxStaticText* m_staticText23;
wxCheckBox* m_checkShowGrid; wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowHiddenPins; wxCheckBox* m_checkShowHiddenPins;
wxCheckBox* m_checkEnableZoomNoCenter;
wxCheckBox* m_checkEnableMiddleButtonPan; wxCheckBox* m_checkEnableMiddleButtonPan;
wxCheckBox* m_checkMiddleButtonPanLimited; wxCheckBox* m_checkMiddleButtonPanLimited;
wxCheckBox* m_checkAutoPan; wxCheckBox* m_checkAutoPan;
......
...@@ -275,6 +275,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -275,6 +275,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_showAllPins ); dlg.SetShowHiddenPins( m_showAllPins );
dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() ); dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() );
dlg.SetEnableZoomNoCenter( m_canvas->GetEnableZoomNoCenter() );
dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() ); dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() );
dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() );
dlg.SetEnableHVBusOrientation( GetForceHVLines() ); dlg.SetEnableHVBusOrientation( GetForceHVLines() );
...@@ -309,6 +310,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -309,6 +310,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
SetGridVisibility( dlg.GetShowGrid() ); SetGridVisibility( dlg.GetShowGrid() );
m_showAllPins = dlg.GetShowHiddenPins(); m_showAllPins = dlg.GetShowHiddenPins();
m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() ); m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() );
m_canvas->SetEnableZoomNoCenter( dlg.GetEnableZoomNoCenter() );
m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() ); m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() );
m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() );
SetForceHVLines( dlg.GetEnableHVBusOrientation() ); SetForceHVLines( dlg.GetEnableHVBusOrientation() );
......
...@@ -98,6 +98,8 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( ) ...@@ -98,6 +98,8 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) ); m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
m_OptZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
m_OptMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() ); m_OptMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() );
m_OptMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() ); m_OptMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() );
m_OptMiddleButtonPanLimited->Enable( m_OptMiddleButtonPan->GetValue() ); m_OptMiddleButtonPanLimited->Enable( m_OptMiddleButtonPan->GetValue() );
...@@ -141,6 +143,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) ...@@ -141,6 +143,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
m_Parent->SetPageSettings( pageInfo ); m_Parent->SetPageSettings( pageInfo );
m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_OptZoomNoCenter->GetValue() );
m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_OptMiddleButtonPan->GetValue() ); m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_OptMiddleButtonPan->GetValue() );
m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() ); m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() );
......
...@@ -86,6 +86,9 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -86,6 +86,9 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
wxStaticBoxSizer* bLeftBottomSizer; wxStaticBoxSizer* bLeftBottomSizer;
bLeftBottomSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL ); bLeftBottomSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL );
m_OptZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Zoom off center"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptZoomNoCenter, 0, wxALL, 5 );
m_OptMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 ); m_OptMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptMiddleButtonPan, 0, wxALL, 5 ); bLeftBottomSizer->Add( m_OptMiddleButtonPan, 0, wxALL, 5 );
......
...@@ -44,6 +44,7 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM ...@@ -44,6 +44,7 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxRadioBox* m_OptDisplayFlashedItems; wxRadioBox* m_OptDisplayFlashedItems;
wxRadioBox* m_OptDisplayPolygons; wxRadioBox* m_OptDisplayPolygons;
wxRadioBox* m_ShowPageLimits; wxRadioBox* m_ShowPageLimits;
wxCheckBox* m_OptZoomNoCenter;
wxCheckBox* m_OptMiddleButtonPan; wxCheckBox* m_OptMiddleButtonPan;
wxCheckBox* m_OptMiddleButtonPanLimited; wxCheckBox* m_OptMiddleButtonPanLimited;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
......
...@@ -71,6 +71,7 @@ private: ...@@ -71,6 +71,7 @@ private:
bool m_abortRequest; ///< Flag used to abort long commands. bool m_abortRequest; ///< Flag used to abort long commands.
bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center
bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning. bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning.
bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
///< true to limit panning to scrollbar current limits ///< true to limit panning to scrollbar current limits
...@@ -134,6 +135,10 @@ public: ...@@ -134,6 +135,10 @@ public:
void SetEnableMiddleButtonPan( bool aEnable ) { m_enableMiddleButtonPan = aEnable; } void SetEnableMiddleButtonPan( bool aEnable ) { m_enableMiddleButtonPan = aEnable; }
bool GetEnableZoomNoCenter() const { return m_enableZoomNoCenter; }
void SetEnableZoomNoCenter( bool aEnable ) { m_enableZoomNoCenter = aEnable; }
bool GetMiddleButtonPanLimited() const { return m_panScrollbarLimits; } bool GetMiddleButtonPanLimited() const { return m_panScrollbarLimits; }
void SetMiddleButtonPanLimited( bool aEnable ) { m_panScrollbarLimits = aEnable; } void SetMiddleButtonPanLimited( bool aEnable ) { m_panScrollbarLimits = aEnable; }
...@@ -319,6 +324,18 @@ public: ...@@ -319,6 +324,18 @@ public:
* warps the cursor to the current cross hair position. * warps the cursor to the current cross hair position.
*/ */
void MoveCursorToCrossHair(); void MoveCursorToCrossHair();
/**
* Function ToDeviceXY
* transforms logical to device coordinates
*/
wxPoint ToDeviceXY( const wxPoint& pos );
/**
* Function ToLogicalXY
* transforms device to logical coordinates
*/
wxPoint ToLogicalXY( const wxPoint& pos );
/** /**
* Function MoveCursor * Function MoveCursor
......
...@@ -241,6 +241,10 @@ enum main_id ...@@ -241,6 +241,10 @@ enum main_id
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
ID_TB_OPTIONS_SHOW_PADS_SKETCH, ID_TB_OPTIONS_SHOW_PADS_SKETCH,
// zoom commands for non center zooming
ID_OFFCENTER_ZOOM_IN,
ID_OFFCENTER_ZOOM_OUT,
ID_END_LIST ID_END_LIST
}; };
......
...@@ -674,6 +674,13 @@ public: ...@@ -674,6 +674,13 @@ public:
*/ */
void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer ); void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
/**
* Function RedrawScreen2
* puts the crosshair back to the screen position it had before zooming
* @param beforePos The screen position of the crosshair before zooming
*/
void RedrawScreen2( const wxPoint& posBefore );
/** /**
* Function Zoom_Automatique * Function Zoom_Automatique
* redraws the screen with best zoom level and the best centering * redraws the screen with best zoom level and the best centering
......
...@@ -88,6 +88,7 @@ void DIALOG_GENERALOPTIONS::init() ...@@ -88,6 +88,7 @@ void DIALOG_GENERALOPTIONS::init()
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_ZoomNoCenterOpt->SetValue( GetParent()->GetCanvas()->GetEnableZoomNoCenter() );
m_MiddleButtonPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMiddleButtonPan() ); m_MiddleButtonPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMiddleButtonPan() );
m_OptMiddleButtonPanLimited->SetValue( GetParent()->GetCanvas()->GetMiddleButtonPanLimited() ); m_OptMiddleButtonPanLimited->SetValue( GetParent()->GetCanvas()->GetMiddleButtonPanLimited() );
m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() ); m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() );
...@@ -137,6 +138,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) ...@@ -137,6 +138,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue();
GetParent()->GetCanvas()->SetEnableZoomNoCenter( m_ZoomNoCenterOpt->GetValue() );
GetParent()->GetCanvas()->SetEnableMiddleButtonPan( m_MiddleButtonPANOpt->GetValue() ); GetParent()->GetCanvas()->SetEnableMiddleButtonPan( m_MiddleButtonPANOpt->GetValue() );
GetParent()->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() ); GetParent()->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() );
......
...@@ -149,6 +149,11 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( ...@@ -149,6 +149,11 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE(
wxStaticBoxSizer* sbSizer2PAN; wxStaticBoxSizer* sbSizer2PAN;
sbSizer2PAN = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL ); sbSizer2PAN = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL );
m_ZoomNoCenterOpt = new wxCheckBox( this, wxID_ZOOMNOCENTER, _("Zoom off center"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZoomNoCenterOpt->SetToolTip( _("Keep the cursor at its current location when zooming") );
sbSizer2PAN->Add( m_ZoomNoCenterOpt, 0, wxALL, 5 );
m_MiddleButtonPANOpt = new wxCheckBox( this, wxID_MIDDLEBUTTONPAN, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 ); m_MiddleButtonPANOpt = new wxCheckBox( this, wxID_MIDDLEBUTTONPAN, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
m_MiddleButtonPANOpt->SetToolTip( _("Use middle mouse button dragging to pan") ); m_MiddleButtonPANOpt->SetToolTip( _("Use middle mouse button dragging to pan") );
......
...@@ -50,6 +50,7 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM ...@@ -50,6 +50,7 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
wxID_TRACKS45, wxID_TRACKS45,
wxID_SEGMENTS45, wxID_SEGMENTS45,
wxID_MAGNETIC_TRACKS, wxID_MAGNETIC_TRACKS,
wxID_ZOOMNOCENTER,
wxID_MIDDLEBUTTONPAN, wxID_MIDDLEBUTTONPAN,
wxID_AUTOPAN wxID_AUTOPAN
}; };
...@@ -72,6 +73,7 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM ...@@ -72,6 +73,7 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
wxCheckBox* m_Track_DoubleSegm_Ctrl; wxCheckBox* m_Track_DoubleSegm_Ctrl;
wxRadioBox* m_MagneticPadOptCtrl; wxRadioBox* m_MagneticPadOptCtrl;
wxRadioBox* m_MagneticTrackOptCtrl; wxRadioBox* m_MagneticTrackOptCtrl;
wxCheckBox* m_ZoomNoCenterOpt;
wxCheckBox* m_MiddleButtonPANOpt; wxCheckBox* m_MiddleButtonPANOpt;
wxCheckBox* m_OptMiddleButtonPanLimited; wxCheckBox* m_OptMiddleButtonPanLimited;
wxCheckBox* m_AutoPANOpt; wxCheckBox* m_AutoPANOpt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment