Commit 4b9db692 authored by Garth Corral's avatar Garth Corral

- Changed mousewheel handling to pan more smoothly rather than in larger

  steps to better support devices with precise scrolling deltas (trackpads).
  Scrolling is done in the handler rather than creating and firing cmd events.
  This is intended to support two-finger scrolling on the Magic Trackpad.
- Added a preference, 'Use mousewheel to pan', to allow panning by default
  on mousewheel events.  This reverses the existing behavior where unmodified 
  mousewheel zooms and Shift/Cmd modified pans.  

  The old behavior was:
  - Unmodified scrollwheel performed zoom in/out
  - Shift modified scrollwheel performed pan up/down
  - Cmd modified scrollwheel performed pan left/right
  - Shift+Cmd modified scrollwheel performed zoom in/out
    with no cursor warp

  With the new preference checked, this changes to:

  - Unmodified scrollwheel performs pan up/down
  - Shift modified scrollwheel performs pan left/right
  - Cmd modified scrollwheel performs zoom in/out
  - Shift+Cmd modified scrollwheel performs zoom in/out
    with no cursor warp

  With the preference unchecked, this is now:
  - Unmodified scrollwheel performed zoom in/out
  - Shift modified scrollwheel performed pan left/right
  - Cmd modified scrollwheel performed pan up/down
  - Shift+Cmd modified scrollwheel performed zoom in/out
    with no cursor warp

  It should be noted that for the last case, the behavior has changed.
  This is not arbitrary.  This now matches expected behavior for an OS X
  application.  This also matches what wxWidgets expects on this platform
  as wxWidgets changes the axis of mousewheel events to horizontal when
  the event is shift-modified.

  The preference is added everwhere that mouse preferences previously
  existed, i.e., eeschema, pcbnew and gerbview.  The 3D Viewer does
  not yet honor this preference, but behaves as if it was checked.
  The pl_editor does not currently have any preferences to honor.

  As with the magnify event support, this covers canvases for all
  current tools, EDA_DRAW_PANEL, EDA_3D_CANVAS and EDA_DRAW_PANEL_GAL.

  This does NOT modify the behavior of mousewheel zooming, though it
  probably should.  This remains unsuitable for use with a trackpad,
  use pinch-to-zoom instead.
parent ae322dba
......@@ -250,19 +250,18 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
{
if( event.ShiftDown() )
double delta = 0.05 * GetPrm3DVisu().m_Zoom * event.GetWheelRotation();
if( event.ShiftDown() || true )
{
if( event.GetWheelRotation() < 0 )
SetView3D( WXK_UP ); // move up
if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL )
m_draw3dOffset.x -= delta;
else
SetView3D( WXK_DOWN ); // move down
m_draw3dOffset.y -= delta;
}
else if( event.ControlDown() )
{
if( event.GetWheelRotation() > 0 )
SetView3D( WXK_RIGHT ); // move right
else
SetView3D( WXK_LEFT ); // move left
m_draw3dOffset.y -= delta;
}
else
{
......@@ -276,10 +275,10 @@ void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
else
GetPrm3DVisu().m_Zoom *= 1.4;
DisplayStatus();
Refresh( false );
}
DisplayStatus();
Refresh( false );
GetPrm3DVisu().m_Beginx = event.GetX();
GetPrm3DVisu().m_Beginy = event.GetY();
}
......
......@@ -47,6 +47,7 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
// keys to store options in config:
#define ENBL_ZOOM_NO_CENTER_KEY wxT( "ZoomNoCenter" )
#define ENBL_MOUSEWHEEL_PAN_KEY wxT( "MousewheelPAN" )
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
......@@ -121,6 +122,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_ClipBox.SetY( 0 );
m_canStartBlock = -1; // Command block can start if >= 0
m_abortRequest = false;
m_enableMousewheelPan = false;
m_enableMiddleButtonPan = true;
m_enableZoomNoCenter = false;
m_panScrollbarLimits = false;
......@@ -135,6 +137,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
if( cfg )
{
cfg->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
cfg->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, true );
cfg->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false );
cfg->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
......@@ -164,6 +167,7 @@ EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
if( cfg )
{
cfg->Write( ENBL_MOUSEWHEEL_PAN_KEY, m_enableMousewheelPan );
cfg->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
cfg->Write( ENBL_ZOOM_NO_CENTER_KEY, m_enableZoomNoCenter );
cfg->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
......@@ -424,7 +428,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
// so we skip these events.
// Note they are here just in case, because they are not actually used
// in Kicad
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || !defined (__WINDOWS__)
#if wxCHECK_VERSION( 3, 1, 0 ) || !wxCHECK_VERSION( 2, 9, 5 ) || ( !defined (__WINDOWS__) && !defined (__WXMAC__) )
int maxX = unitsX - csizeX;
int maxY = unitsY - csizeY;
......@@ -934,47 +938,40 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
bool offCenterReq = event.ControlDown() && event.ShiftDown();
offCenterReq = offCenterReq || m_enableZoomNoCenter;
#if wxMAJOR_VERSION >= 2 && wxMINOR_VERSION >= 9
#if wxCHECK_VERSION(2, 9, 0)
int axis = event.GetWheelAxis();
#else
const int axis = 0;
#endif
// This is a zoom in or out command
if( event.GetWheelRotation() > 0 )
wxPoint delta;
wxPoint start = GetViewStart();
if( ( m_enableMousewheelPan || event.ShiftDown() ) && !event.ControlDown() )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_UP );
else
cmd.SetId( ID_PAN_RIGHT );
}
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_IN );
if( axis == wxMOUSE_WHEEL_HORIZONTAL )
delta.x = -event.GetWheelRotation();
else
cmd.SetId( ID_POPUP_ZOOM_IN );
delta.y = event.GetWheelRotation();
}
else if( event.GetWheelRotation() < 0 )
else if( event.ControlDown() && !event.ShiftDown() && !m_enableMousewheelPan )
delta.y = event.GetWheelRotation();
else if( offCenterReq )
cmd.SetId( event.GetWheelRotation() > 0 ? ID_OFFCENTER_ZOOM_IN : ID_OFFCENTER_ZOOM_OUT );
else
cmd.SetId( event.GetWheelRotation() > 0 ? ID_POPUP_ZOOM_IN : ID_POPUP_ZOOM_OUT );
if( cmd.GetId() )
{
if( event.ShiftDown() && !event.ControlDown() )
{
if( axis == 0 )
cmd.SetId( ID_PAN_DOWN );
else
cmd.SetId( ID_PAN_LEFT );
}
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_RIGHT );
else if( offCenterReq )
cmd.SetId( ID_OFFCENTER_ZOOM_OUT );
else
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
}
else
{
wxPoint newStart = start - delta;
wxPoint center = GetScreenCenterLogicalPosition();
GetParent()->SetScrollCenterPosition(center);
Scroll(newStart);
}
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
......
......@@ -29,6 +29,7 @@
#include <wx/colour.h>
#include <wx/filename.h>
#include <kiface_i.h>
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <view/wx_view_controls.h>
......@@ -47,6 +48,9 @@
#include <profile.h>
#endif /* __WXDEBUG__ */
// keys to retrieve options in config:
#define ENBL_MOUSEWHEEL_PAN_KEY wxT( "MousewheelPAN" )
EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId,
const wxPoint& aPosition, const wxSize& aSize,
GalType aGalType ) :
......@@ -91,11 +95,20 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
NULL, m_eventDispatcher );
}
m_enableMousewheelPan = false;
// Set up timer that prevents too frequent redraw commands
m_refreshTimer.SetOwner( this );
m_pendingRefresh = false;
m_drawing = false;
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
wxConfigBase* cfg = Kiface().KifaceSettings();
if( cfg )
{
cfg->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false );
}
}
......
......@@ -25,6 +25,7 @@
#include <wx/wx.h>
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <view/wx_view_controls.h>
#include <gal/graphics_abstraction_layer.h>
......@@ -134,24 +135,24 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
{
const double wheelPanSpeed = 0.001;
VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
if( aEvent.ControlDown() || aEvent.ShiftDown() )
if( !aEvent.ControlDown() && ( aEvent.ShiftDown() || ((EDA_DRAW_PANEL_GAL *)m_parentPanel)->GetEnableMousewheelPan() ) )
{
// Scrolling
VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
double scrollSpeed;
if( abs( scrollVec.x ) > abs( scrollVec.y ) )
scrollSpeed = scrollVec.x;
else
scrollSpeed = scrollVec.y;
VECTOR2D delta( aEvent.ControlDown() ? -scrollSpeed : 0.0,
aEvent.ShiftDown() ? -scrollSpeed : 0.0 );
int axis = aEvent.GetWheelAxis();
VECTOR2D delta( axis == wxMOUSE_WHEEL_HORIZONTAL ? scrollVec.x : 0.0,
axis == wxMOUSE_WHEEL_VERTICAL ? -scrollVec.y : 0.0 );
setCenter( m_view->GetCenter() + delta );
}
else if( aEvent.ControlDown() && !aEvent.ShiftDown() && !((EDA_DRAW_PANEL_GAL *)m_parentPanel)->GetEnableMousewheelPan() )
{
VECTOR2D delta( 0.0, -scrollVec.y );
setCenter( m_view->GetCenter() + delta );
}
else
{
// Zooming
......
......@@ -372,6 +372,20 @@ public:
return m_checkMiddleButtonPanLimited->GetValue();
}
/**
* Function SetEnableMousewheelPan
* Sets the MousewheelPan setting in the dialog
*
* @param enable The boolean value to set the AutoPan value in the dialog
*/
void SetEnableMousewheelPan( bool enable ) { m_checkEnableMousewheelPan->SetValue( enable ); }
/**
* Function GetEnableMousewheelPan
* Return the MousewheelPan setting from the dialog
*/
bool GetEnableMousewheelPan( void ) { return m_checkEnableMousewheelPan->GetValue(); }
/**
* Function SetEnableAutoPan
* Sets the AutoPan setting in the dialog
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Oct 17 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -191,6 +191,9 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bSizer2->Add( m_checkMiddleButtonPanLimited, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
m_checkEnableMousewheelPan = new wxCheckBox( m_panel1, wxID_ANY, _("Use mousewheel to pan"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkEnableMousewheelPan, 0, wxLEFT|wxRIGHT|wxTOP, 3 );
m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Pan while moving ob&ject"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkAutoPan, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 );
......@@ -225,21 +228,21 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
wxStaticBoxSizer* fieldSizer;
fieldSizer = new wxStaticBoxSizer( new wxStaticBox( m_panel2, wxID_ANY, _("Field Settings") ), wxVERTICAL );
fieldNameLabel = new wxStaticText( m_panel2, wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel = new wxStaticText( fieldSizer->GetStaticBox(), wxID_ANY, _("Name"), wxDefaultPosition, wxDefaultSize, 0 );
fieldNameLabel->Wrap( -1 );
fieldSizer->Add( fieldNameLabel, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
fieldNameTextCtrl = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldNameTextCtrl = new wxTextCtrl( fieldSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldSizer->Add( fieldNameTextCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
fieldDefaultValueLabel = new wxStaticText( m_panel2, wxID_ANY, _("Default Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldDefaultValueLabel = new wxStaticText( fieldSizer->GetStaticBox(), wxID_ANY, _("Default Value"), wxDefaultPosition, wxDefaultSize, 0 );
fieldDefaultValueLabel->Wrap( -1 );
fieldSizer->Add( fieldDefaultValueLabel, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
fieldDefaultValueTextCtrl = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldDefaultValueTextCtrl = new wxTextCtrl( fieldSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fieldSizer->Add( fieldDefaultValueTextCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
fieldVisibleCheckbox = new wxCheckBox( m_panel2, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
fieldVisibleCheckbox = new wxCheckBox( fieldSizer->GetStaticBox(), wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
fieldSizer->Add( fieldVisibleCheckbox, 0, wxALL, 5 );
......@@ -255,7 +258,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel2->SetSizer( bSizer6 );
m_panel2->Layout();
bSizer6->Fit( m_panel2 );
m_notebook1->AddPage( m_panel2, _("Template Field Names"), true );
m_notebook1->AddPage( m_panel2, _("Template Field Names"), false );
bOptionsSizer->Add( m_notebook1, 1, wxALL|wxEXPAND, 5 );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// C++ code generated with wxFormBuilder (version Oct 17 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -100,6 +100,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkEnableZoomNoCenter;
wxCheckBox* m_checkEnableMiddleButtonPan;
wxCheckBox* m_checkMiddleButtonPanLimited;
wxCheckBox* m_checkEnableMousewheelPan;
wxCheckBox* m_checkAutoPan;
wxCheckBox* m_checkHVOrientation;
wxCheckBox* m_checkPageLimits;
......
......@@ -328,6 +328,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_showAllPins );
dlg.SetEnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() );
dlg.SetEnableZoomNoCenter( m_canvas->GetEnableZoomNoCenter() );
dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() );
......@@ -379,6 +380,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
SetGridVisibility( dlg.GetShowGrid() );
m_showAllPins = dlg.GetShowHiddenPins();
m_canvas->SetEnableMousewheelPan( dlg.GetEnableMousewheelPan() );
m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() );
m_canvas->SetEnableZoomNoCenter( dlg.GetEnableZoomNoCenter() );
m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() );
......
......@@ -125,6 +125,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
m_OptZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() );
m_OptMousewheelPan->SetValue( m_Parent->GetCanvas()->GetEnableMousewheelPan() );
m_OptMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() );
m_OptMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() );
m_OptMiddleButtonPanLimited->Enable( m_OptMiddleButtonPan->GetValue() );
......@@ -169,6 +170,7 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
m_Parent->SetPageSettings( pageInfo );
m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_OptZoomNoCenter->GetValue() );
m_Parent->GetCanvas()->SetEnableMousewheelPan( m_OptMousewheelPan->GetValue() );
m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_OptMiddleButtonPan->GetValue() );
m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Oct 17 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -83,16 +83,21 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
wxStaticBoxSizer* bLeftBottomSizer;
bLeftBottomSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL );
m_OptZoomNoCenter = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptZoomNoCenter = new wxCheckBox( bLeftBottomSizer->GetStaticBox(), wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") );
bLeftBottomSizer->Add( m_OptZoomNoCenter, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_OptMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptMiddleButtonPan = new wxCheckBox( bLeftBottomSizer->GetStaticBox(), wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptMiddleButtonPan, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_OptMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptMiddleButtonPanLimited, 0, wxALL, 5 );
m_OptMiddleButtonPanLimited = new wxCheckBox( bLeftBottomSizer->GetStaticBox(), wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptMiddleButtonPanLimited, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_OptMousewheelPan = new wxCheckBox( bLeftBottomSizer->GetStaticBox(), wxID_ANY, _("Use mousewheel to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptMousewheelPan->SetToolTip( _("Use mousewheel to pan canvas") );
bLeftBottomSizer->Add( m_OptMousewheelPan, 0, wxALL, 5 );
bRightSizer->Add( bLeftBottomSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......@@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
......@@ -1039,7 +1041,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
......@@ -1125,6 +1127,94 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Use mousewheel to pan</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OptMousewheelPan</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Use mousewheel to pan canvas</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Oct 17 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -49,6 +49,7 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_OptZoomNoCenter;
wxCheckBox* m_OptMiddleButtonPan;
wxCheckBox* m_OptMiddleButtonPanLimited;
wxCheckBox* m_OptMousewheelPan;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
......
......@@ -107,6 +107,24 @@ public:
return (KIGFX::VIEW_CONTROLS*)( m_viewControls );
}
/**
* Function GetEnableMousewheelPan
* Return default mousewheel behavior.
*/
bool GetEnableMousewheelPan() const
{
return m_enableMousewheelPan;
}
/**
* Function SetEnableMousewheelPan
* Set default mousewheel behavior.
*/
void SetEnableMousewheelPan( bool aEnable )
{
m_enableMousewheelPan = aEnable;
}
/// @copydoc wxWindow::Refresh()
void Refresh( bool aEraseBackground = true, const wxRect* aRect = NULL );
......@@ -191,6 +209,9 @@ protected:
/// Processes and forwards events to tools
TOOL_DISPATCHER* m_eventDispatcher;
/// True to enable mousewheel panning by default.
bool m_enableMousewheelPan;
};
#endif
......@@ -73,6 +73,7 @@ private:
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_enableMousewheelPan; ///< True to enable mousewheel panning by default.
bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning.
bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
///< true to limit panning to scrollbar current limits
......@@ -135,6 +136,10 @@ public:
void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; }
bool GetEnableMousewheelPan() const { return m_enableMousewheelPan; }
void SetEnableMousewheelPan( bool aEnable ) { m_enableMousewheelPan = aEnable; }
bool GetEnableMiddleButtonPan() const { return m_enableMiddleButtonPan; }
void SetEnableMiddleButtonPan( bool aEnable ) { m_enableMiddleButtonPan = aEnable; }
......
......@@ -86,6 +86,7 @@ void DIALOG_GENERALOPTIONS::init()
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( g_Segments_45_Only );
m_ZoomNoCenterOpt->SetValue( GetParent()->GetCanvas()->GetEnableZoomNoCenter() );
m_MousewheelPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMousewheelPan() );
m_MiddleButtonPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMiddleButtonPan() );
m_OptMiddleButtonPanLimited->SetValue( GetParent()->GetCanvas()->GetMiddleButtonPanLimited() );
m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() );
......@@ -134,10 +135,13 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue();
GetParent()->GetCanvas()->SetEnableZoomNoCenter( m_ZoomNoCenterOpt->GetValue() );
GetParent()->GetCanvas()->SetEnableMousewheelPan( m_MousewheelPANOpt->GetValue() );
GetParent()->GetCanvas()->SetEnableMiddleButtonPan( m_MiddleButtonPANOpt->GetValue() );
GetParent()->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() );
GetParent()->GetCanvas()->SetEnableAutoPan( m_AutoPANOpt->GetValue() );
GetParent()->GetGalCanvas()->SetEnableMousewheelPan( m_MousewheelPANOpt->GetValue() );
g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue();
g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection();
g_MagneticTrackOption = m_MagneticTrackOptCtrl->GetSelection();
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Oct 17 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -90,39 +90,39 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE(
wxStaticBoxSizer* bMiddleRightBoxSizer;
bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
m_DrcOn = new wxCheckBox( this, wxID_DRC_ONOFF, _("Enforce design rules when routing"), wxDefaultPosition, wxDefaultSize, 0 );
m_DrcOn = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_DRC_ONOFF, _("Enforce design rules when routing"), wxDefaultPosition, wxDefaultSize, 0 );
m_DrcOn->SetValue(true);
m_DrcOn->SetToolTip( _("Enable/disable the DRC control.\nWhen DRC is disable, all connections are allowed.") );
bMiddleRightBoxSizer->Add( m_DrcOn, 0, wxALL|wxEXPAND, 5 );
m_ShowGlobalRatsnest = new wxCheckBox( this, wxID_GENERAL_RATSNEST, _("Show ratsnest"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowGlobalRatsnest = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_GENERAL_RATSNEST, _("Show ratsnest"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowGlobalRatsnest->SetValue(true);
m_ShowGlobalRatsnest->SetToolTip( _("Show (or not) the full rastnest.") );
bMiddleRightBoxSizer->Add( m_ShowGlobalRatsnest, 0, wxALL, 5 );
m_ShowModuleRatsnest = new wxCheckBox( this, wxID_RATSNEST_MODULE, _("Show footprint ratsnest"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowModuleRatsnest = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_RATSNEST_MODULE, _("Show footprint ratsnest"), wxDefaultPosition, wxDefaultSize, 0 );
m_ShowModuleRatsnest->SetToolTip( _("Shows (or not) the local ratsnest relative to a footprint, when moving it.\nThis ratsnest is useful to place a footprint.") );
bMiddleRightBoxSizer->Add( m_ShowModuleRatsnest, 0, wxALL, 5 );
m_TrackAutodel = new wxCheckBox( this, wxID_TRACK_AUTODEL, _("Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackAutodel = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_TRACK_AUTODEL, _("Delete unconnected tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_TrackAutodel->SetToolTip( _("Enable/disable the automatic track deletion when recreating a track.") );
bMiddleRightBoxSizer->Add( m_TrackAutodel, 0, wxALL, 5 );
m_Track_45_Only_Ctrl = new wxCheckBox( this, wxID_TRACKS45, _("Limit tracks to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_Track_45_Only_Ctrl = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_TRACKS45, _("Limit tracks to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_Track_45_Only_Ctrl->SetToolTip( _("If enabled, force tracks directions to H, V or 45 degrees, when creating a track.") );
bMiddleRightBoxSizer->Add( m_Track_45_Only_Ctrl, 0, wxALL, 5 );
m_Segments_45_Only_Ctrl = new wxCheckBox( this, wxID_SEGMENTS45, _("Limit graphic lines to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_Segments_45_Only_Ctrl = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_SEGMENTS45, _("Limit graphic lines to 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_Segments_45_Only_Ctrl->SetToolTip( _("If enabled, force segments directions to H, V or 45 degrees, when creating a segment on technical layers.") );
bMiddleRightBoxSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 );
m_Track_DoubleSegm_Ctrl = new wxCheckBox( this, wxID_ANY, _("Use double segmented tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_Track_DoubleSegm_Ctrl = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_ANY, _("Use double segmented tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_Track_DoubleSegm_Ctrl->SetToolTip( _("If enabled, uses two track segments, with 45 degrees angle between them when creating a new track ") );
bMiddleRightBoxSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxALL, 5 );
......@@ -155,22 +155,27 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE(
wxStaticBoxSizer* sbSizer2PAN;
sbSizer2PAN = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL );
m_ZoomNoCenterOpt = new wxCheckBox( this, wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZoomNoCenterOpt = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZoomNoCenterOpt->SetToolTip( _("Keep the cursor at its current location when zooming") );
sbSizer2PAN->Add( m_ZoomNoCenterOpt, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_MiddleButtonPANOpt = new wxCheckBox( this, wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_MiddleButtonPANOpt = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_ANY, _("Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_MiddleButtonPANOpt->SetToolTip( _("Use middle mouse button dragging to pan") );
sbSizer2PAN->Add( m_MiddleButtonPANOpt, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_OptMiddleButtonPanLimited = new wxCheckBox( this, wxID_MIDDLEBUTTONPAN, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptMiddleButtonPanLimited = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_MIDDLEBUTTONPAN, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptMiddleButtonPanLimited->SetToolTip( _("Middle mouse button panning limited by current scrollbar size") );
sbSizer2PAN->Add( m_OptMiddleButtonPanLimited, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_AutoPANOpt = new wxCheckBox( this, wxID_AUTOPAN, _("Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 );
m_MousewheelPANOpt = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_ANY, _("Use mousewheel to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_MousewheelPANOpt->SetToolTip( _("Use mousewheel to pan canvas") );
sbSizer2PAN->Add( m_MousewheelPANOpt, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_AutoPANOpt = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_AUTOPAN, _("Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 );
m_AutoPANOpt->SetToolTip( _("Allows auto pan when creating a track, or moving an item.") );
sbSizer2PAN->Add( m_AutoPANOpt, 0, wxALL, 5 );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......@@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
......@@ -573,6 +575,7 @@
<event name="OnSize"></event>
<event name="OnSpinCtrl"></event>
<event name="OnSpinCtrlText"></event>
<event name="OnTextEnter"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
......@@ -743,6 +746,7 @@
<event name="OnSize"></event>
<event name="OnSpinCtrl"></event>
<event name="OnSpinCtrlText"></event>
<event name="OnTextEnter"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
......@@ -2019,6 +2023,94 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Use mousewheel to pan</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_MousewheelPANOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Use mousewheel to pan canvas</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Oct 17 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -77,6 +77,7 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM
wxCheckBox* m_ZoomNoCenterOpt;
wxCheckBox* m_MiddleButtonPANOpt;
wxCheckBox* m_OptMiddleButtonPanLimited;
wxCheckBox* m_MousewheelPANOpt;
wxCheckBox* m_AutoPANOpt;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
......
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