diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp index 315e406b00..9ddc46013b 100644 --- a/3d-viewer/3d_canvas.cpp +++ b/3d-viewer/3d_canvas.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -53,6 +53,9 @@ #include +static const double DELTA_MOVE_STEP = 0.7; + + /* * EDA_3D_CANVAS implementation */ @@ -86,7 +89,7 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) : m_init = false; m_reportWarnings = true; m_shadow_init = false; - // set an invalide value to not yet initialized indexes managing + // set an invalid value to not yet initialized indexes managing // textures created to enhance 3D rendering m_text_pcb = m_text_silk = INVALID_INDEX; m_text_fake_shadow_front = INVALID_INDEX; @@ -144,8 +147,7 @@ void EDA_3D_CANVAS::ClearLists( int aGlList ) m_glLists[ii] = 0; } - // When m_text_fake_shadow_??? is set to INVALID_INDEX, textures are no yet - // created. + // When m_text_fake_shadow_??? is set to INVALID_INDEX, textures are not yet created. if( m_text_fake_shadow_front != INVALID_INDEX ) glDeleteTextures( 1, &m_text_fake_shadow_front ); @@ -169,7 +171,7 @@ void EDA_3D_CANVAS::OnChar( wxKeyEvent& event ) void EDA_3D_CANVAS::SetView3D( int keycode ) { int ii; - double delta_move = 0.7 * GetPrm3DVisu().m_Zoom; + double delta_move = DELTA_MOVE_STEP * GetPrm3DVisu().m_Zoom; switch( keycode ) { @@ -284,19 +286,27 @@ void EDA_3D_CANVAS::SetView3D( int keycode ) void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event ) { - if( event.ShiftDown() ) + double delta = DELTA_MOVE_STEP * GetPrm3DVisu().m_Zoom; + if ( GetPrm3DVisu().GetFlag( FL_MOUSEWHEEL_PANNING ) ) + delta *= 0.05 * event.GetWheelRotation(); + else + if ( event.GetWheelRotation() < 0 ) + delta = -delta; + + if( GetPrm3DVisu().GetFlag( FL_MOUSEWHEEL_PANNING ) ) { - 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.ShiftDown() ) + { + 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.x += delta; } else { @@ -310,10 +320,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(); } @@ -327,7 +337,9 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event ) GetPrm3DVisu().m_Zoom /= magnification; if( GetPrm3DVisu().m_Zoom <= 0.01 ) + { GetPrm3DVisu().m_Zoom = 0.01; + } DisplayStatus(); Refresh( false ); @@ -376,8 +388,6 @@ void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event ) } -/* Construct and display a popup menu when the right button is clicked. - */ void EDA_3D_CANVAS::OnRightClick( wxMouseEvent& event ) { wxPoint pos; @@ -563,7 +573,7 @@ GLuint load_and_generate_texture( tsImage *image ) return texture; } -/* Initialize broad parameters for OpenGL */ + void EDA_3D_CANVAS::InitGL() { if( !m_init ) @@ -579,7 +589,7 @@ void EDA_3D_CANVAS::InitGL() m_ZTop = 10.0; glDisable( GL_CULL_FACE ); // show back faces - glEnable( GL_DEPTH_TEST ); // Enable z-buferring + glEnable( GL_DEPTH_TEST ); // Enable z-buffering glEnable( GL_ALPHA_TEST ); glEnable( GL_LINE_SMOOTH ); // glEnable(GL_POLYGON_SMOOTH); // creates issues with some graphic cards @@ -600,7 +610,6 @@ void EDA_3D_CANVAS::InitGL() } -/* Initialize OpenGL light sources. */ void EDA_3D_CANVAS::SetLights() { // activate light. the source is above the xy plane, at source_pos diff --git a/3d-viewer/3d_frame.cpp b/3d-viewer/3d_frame.cpp index 9410acc940..b1a6db1cee 100644 --- a/3d-viewer/3d_frame.cpp +++ b/3d-viewer/3d_frame.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -70,6 +70,8 @@ static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" ); static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" ); static const wxChar keyBoardBodyColor_Blue[]= wxT( "BoardBodyColor_Blue" ); +static const wxChar keyMousewheelPanning[] = wxT( "MousewheelPAN3D" ); + static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" ); static const wxChar keyRenderShadows[] = wxT( "Render_Shadows" ); static const wxChar keyRenderRemoveHoles[] = wxT( "Render_RemoveHoles" ); @@ -282,6 +284,9 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( keyBoardBodyColor_Blue, &GetPrm3DVisu().m_BoardBodyColor.m_Blue, 22.0 /255.0 ); bool tmp; + aCfg->Read( keyMousewheelPanning, &tmp, false ); + prms.SetFlag( FL_MOUSEWHEEL_PANNING, tmp ); + aCfg->Read( keyShowRealisticMode, &tmp, false ); prms.SetFlag( FL_USE_REALISTIC_MODE, tmp ); @@ -380,6 +385,8 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg ) aCfg->Write( keyBoardBodyColor_Green, GetPrm3DVisu().m_BoardBodyColor.m_Green ); aCfg->Write( keyBoardBodyColor_Blue, GetPrm3DVisu().m_BoardBodyColor.m_Blue ); + aCfg->Write( keyMousewheelPanning, prms.GetFlag( FL_MOUSEWHEEL_PANNING ) ); + aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) ); aCfg->Write( keyRenderShadows, prms.GetFlag( FL_RENDER_SHADOWS ) ); @@ -565,6 +572,10 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event ) Set3DBoardBodyColorFromUser(); break; + case ID_MENU3D_MOUSEWHEEL_PANNING: + GetPrm3DVisu().SetFlag( FL_MOUSEWHEEL_PANNING, isChecked ); + return; + case ID_MENU3D_REALISTIC_MODE: GetPrm3DVisu().SetFlag( FL_USE_REALISTIC_MODE, isChecked ); GetMenuBar()->FindItem( ID_MENU3D_COMMENTS_ONOFF )->Enable( !isChecked ); @@ -747,8 +758,6 @@ void EDA_3D_FRAME::OnActivate( wxActivateEvent& event ) } -/* called to set the background color of the 3D scene - */ bool EDA_3D_FRAME::Set3DColorFromUser( S3D_COLOR &aColor, const wxString& aTitle, wxColourData* aPredefinedColors ) { @@ -780,13 +789,12 @@ bool EDA_3D_FRAME::Set3DColorFromUser( S3D_COLOR &aColor, const wxString& aTitle return true; } -/* called to set the silkscreen color. Sets up a number of default colors - */ + bool EDA_3D_FRAME::Set3DSilkScreenColorFromUser() { wxColourData definedColors; - definedColors.SetCustomColour(0, wxColour( 241, 241, 241 ) ); // White + definedColors.SetCustomColour(0, wxColour( 241, 241, 241 ) ); // White definedColors.SetCustomColour(1, wxColour( 180, 180, 180 ) ); // Gray bool change = Set3DColorFromUser( GetPrm3DVisu().m_SilkScreenColor, @@ -800,8 +808,6 @@ bool EDA_3D_FRAME::Set3DSilkScreenColorFromUser() } -/* called to set the soldermask color. Sets up a number of default colors - */ bool EDA_3D_FRAME::Set3DSolderMaskColorFromUser() { wxColourData definedColors; @@ -824,8 +830,6 @@ bool EDA_3D_FRAME::Set3DSolderMaskColorFromUser() } -/* called to set the copper surface color. Sets up a number of default colors - */ bool EDA_3D_FRAME::Set3DCopperColorFromUser() { wxColourData definedColors; @@ -847,8 +851,6 @@ bool EDA_3D_FRAME::Set3DCopperColorFromUser() } -/* called to set the board body color. Sets up a number of default colors - */ bool EDA_3D_FRAME::Set3DBoardBodyColorFromUser() { wxColourData definedColors; @@ -873,8 +875,6 @@ bool EDA_3D_FRAME::Set3DBoardBodyColorFromUser() } -/* called to set the solder paste layer color. Sets up a number of default colors - */ bool EDA_3D_FRAME::Set3DSolderPasteColorFromUser() { wxColourData definedColors; @@ -907,6 +907,7 @@ INFO3D_VISU& EDA_3D_FRAME::GetPrm3DVisu() const return g_Parm_3D_Visu; } + bool EDA_3D_FRAME::IsEnabled( DISPLAY3D_FLG aItem ) const { // return true if aItem must be displayed diff --git a/3d-viewer/3d_toolbar.cpp b/3d-viewer/3d_toolbar.cpp index 9cc3380816..29184f8b1a 100644 --- a/3d-viewer/3d_toolbar.cpp +++ b/3d-viewer/3d_toolbar.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Wayne Stambaugh - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -153,6 +153,12 @@ void EDA_3D_FRAME::CreateMenuBar() menuBar->Append( prefsMenu, _( "&Preferences" ) ); + AddMenuItem( prefsMenu, ID_MENU3D_MOUSEWHEEL_PANNING, + _( "Use Touchpad to Pan" ), + KiBitmap( tools_xpm ), wxITEM_CHECK ); + + prefsMenu->AppendSeparator(); + AddMenuItem( prefsMenu, ID_MENU3D_REALISTIC_MODE, _( "Realistic Mode" ), KiBitmap( use_3D_copper_thickness_xpm ), wxITEM_CHECK ); @@ -292,6 +298,7 @@ void EDA_3D_FRAME::CreateMenuBar() SetMenuBarOptionsState(); } + void EDA_3D_FRAME::SetMenuBarOptionsState() { wxMenuBar* menuBar = GetMenuBar(); @@ -301,6 +308,9 @@ void EDA_3D_FRAME::SetMenuBarOptionsState() wxMenuItem* item; // Set the state of toggle menus according to the current display options + item = menuBar->FindItem( ID_MENU3D_MOUSEWHEEL_PANNING ); + item->Check( GetPrm3DVisu().GetFlag( FL_MOUSEWHEEL_PANNING ) ); + item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE ); item->Check( GetPrm3DVisu().IsRealisticMode() ); item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF ); @@ -366,6 +376,7 @@ void EDA_3D_FRAME::SetMenuBarOptionsState() item->Check( GetPrm3DVisu().GetFlag( FL_ECO )); } + void EDA_3D_FRAME::SetToolbars() { } diff --git a/3d-viewer/3d_viewer_id.h b/3d-viewer/3d_viewer_id.h index 9626df086d..f30d16e225 100644 --- a/3d-viewer/3d_viewer_id.h +++ b/3d-viewer/3d_viewer_id.h @@ -51,6 +51,7 @@ enum id_3dview_frm ID_MENU3D_COMMENTS_ONOFF, ID_MENU3D_ECO_ONOFF, ID_MENU3D_SHOW_BOARD_BODY, + ID_MENU3D_MOUSEWHEEL_PANNING, ID_MENU3D_REALISTIC_MODE, ID_MENU3D_FL_RENDER_SHADOWS, ID_MENU3D_FL_RENDER_SHOW_HOLES_IN_ZONES, diff --git a/3d-viewer/info3d_visu.h b/3d-viewer/info3d_visu.h index b1d8f4848c..7326a0408b 100644 --- a/3d-viewer/info3d_visu.h +++ b/3d-viewer/info3d_visu.h @@ -71,6 +71,7 @@ enum DISPLAY3D_FLG { FL_GRID, FL_USE_COPPER_THICKNESS, FL_SHOW_BOARD_BODY, + FL_MOUSEWHEEL_PANNING, FL_USE_REALISTIC_MODE, FL_RENDER_SHADOWS, FL_RENDER_SHOW_HOLES_IN_ZONES, diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 42936ef233..2a81a17185 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2008-2015 Wayne Stambaugh - * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1076,6 +1076,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable ) // Transfer EDA_DRAW_PANEL settings GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() ); + GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); GetToolManager()->RunAction( "pcbnew.Control.switchCursor" ); } else if( m_galCanvasActive ) diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp index 73e0e590c7..63b5dc40f0 100644 --- a/common/draw_panel.cpp +++ b/common/draw_panel.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2007-2011 Wayne Stambaugh - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -48,6 +48,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" ) @@ -96,11 +97,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, { wxASSERT( parent ); -#ifndef USE_OSX_MAGNIFY_EVENT ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); -#else - ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER ); -#endif DisableKeyboardScrolling(); m_scrollIncrementX = std::min( size.x / 8, 10 ); @@ -119,6 +116,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; @@ -136,6 +134,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 ); @@ -165,6 +164,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 ); @@ -437,7 +437,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; @@ -648,6 +648,15 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg ) } +void EDA_DRAW_PANEL::SetEnableMousewheelPan( bool aEnable ) +{ + m_enableMousewheelPan = aEnable; + + if( GetParent()->IsGalCanvasActive() ) + GetParent()->GetGalCanvas()->GetViewControls()->EnableMousewheelPan( aEnable ); +} + + void EDA_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable ) { m_enableZoomNoCenter = aEnable; @@ -965,17 +974,24 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) offCenterReq = offCenterReq || m_enableZoomNoCenter; int axis = event.GetWheelAxis(); + int wheelRotation = event.GetWheelRotation(); - // This is a zoom in or out command - if( event.GetWheelRotation() > 0 ) + if( m_enableMousewheelPan ) + { + wxPoint newStart = GetViewStart(); + if( axis == wxMOUSE_WHEEL_HORIZONTAL ) + newStart.x += wheelRotation; + else + newStart.y -= wheelRotation; + + wxPoint center = GetScreenCenterLogicalPosition(); + GetParent()->SetScrollCenterPosition( center ); + Scroll( newStart ); + } + else if( wheelRotation > 0 ) { if( event.ShiftDown() && !event.ControlDown() ) - { - if( axis == 0 ) - cmd.SetId( ID_PAN_UP ); - else - cmd.SetId( ID_PAN_RIGHT ); - } + cmd.SetId( ID_PAN_UP ); else if( event.ControlDown() && !event.ShiftDown() ) cmd.SetId( ID_PAN_LEFT ); else if( offCenterReq ) @@ -983,15 +999,10 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) else cmd.SetId( ID_POPUP_ZOOM_IN ); } - else if( event.GetWheelRotation() < 0 ) + else if( wheelRotation < 0 ) { if( event.ShiftDown() && !event.ControlDown() ) - { - if( axis == 0 ) - cmd.SetId( ID_PAN_DOWN ); - else - cmd.SetId( ID_PAN_LEFT ); - } + cmd.SetId( ID_PAN_DOWN ); else if( event.ControlDown() && !event.ShiftDown() ) cmd.SetId( ID_PAN_RIGHT ); else if( offCenterReq ) @@ -1000,7 +1011,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) cmd.SetId( ID_POPUP_ZOOM_OUT ); } - GetEventHandler()->ProcessEvent( cmd ); + if( cmd.GetId() ) + GetEventHandler()->ProcessEvent( cmd ); event.Skip(); } diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 3484a1530c..ac6c778f1f 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -3,6 +3,8 @@ * * Copyright (C) 2012 Torsten Hueter, torstenhtr gmx.de * Copyright (C) 2013-2015 CERN + * Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * @author Maciej Suminski * @@ -96,20 +98,31 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent ) { const double wheelPanSpeed = 0.001; - if( aEvent.ControlDown() || aEvent.ShiftDown() ) + if( aEvent.ControlDown() || aEvent.ShiftDown() || m_enableMousewheelPan ) { // Scrolling VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) * ( (double) aEvent.GetWheelRotation() * wheelPanSpeed ); - double scrollSpeed; + int axis = aEvent.GetWheelAxis(); + double scrollX = 0.0; + double scrollY = 0.0; - if( std::abs( scrollVec.x ) > std::abs( scrollVec.y ) ) - scrollSpeed = scrollVec.x; + if ( m_enableMousewheelPan ) + { + if ( axis == wxMOUSE_WHEEL_HORIZONTAL ) + scrollX = scrollVec.x; + else + scrollY = -scrollVec.y; + } else - scrollSpeed = scrollVec.y; + { + if ( aEvent.ControlDown() ) + scrollX = -scrollVec.x; + else + scrollY = -scrollVec.y; + } - VECTOR2D delta( aEvent.ControlDown() ? -scrollSpeed : 0.0, - aEvent.ShiftDown() ? -scrollSpeed : 0.0 ); + VECTOR2D delta( scrollX, scrollY ); m_view->SetCenter( m_view->GetCenter() + delta ); } @@ -121,7 +134,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent ) int rotation = aEvent.GetWheelRotation(); double zoomScale; -#ifdef __APPLE__ +#ifdef __WXMAC__ // The following is to support Apple pointer devices (MagicMouse & // Macbook touchpad), which send events more frequently, but with smaller // wheel rotation. diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h index df0c0bf9d2..12446b9f7a 100644 --- a/eeschema/dialogs/dialog_eeschema_options.h +++ b/eeschema/dialogs/dialog_eeschema_options.h @@ -400,6 +400,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 diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp index 56e1cf7a1a..1d336f643c 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.cpp +++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 13 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -205,6 +205,11 @@ 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, xwID_ANY, _("Use touchpa&d to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkEnableMousewheelPan->SetToolTip( _("Use touchpad to pan canvas") ); + + 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 ); @@ -239,21 +244,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, wxTE_PROCESS_ENTER ); + fieldNameTextCtrl = new wxTextCtrl( fieldSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); fieldSizer->Add( fieldNameTextCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - fieldDefaultValueLabel = new wxStaticText( m_panel2, wxID_ANY, _("D&efault Value"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldDefaultValueLabel = new wxStaticText( fieldSizer->GetStaticBox(), wxID_ANY, _("D&efault 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, wxTE_PROCESS_ENTER ); + fieldDefaultValueTextCtrl = new wxTextCtrl( fieldSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); 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 ); diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp index 9340f096ff..499e424e1c 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.fbp +++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp @@ -3399,6 +3399,94 @@ + + 3 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + xwID_ANY + Use touchpa&d to pan + + 0 + + + 0 + + 1 + m_checkEnableMousewheelPan + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Use touchpad to pan canvas + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 wxEXPAND|wxTOP|wxRIGHT|wxLEFT diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h index d09b2f92d3..dab077f2a5 100644 --- a/eeschema/dialogs/dialog_eeschema_options_base.h +++ b/eeschema/dialogs/dialog_eeschema_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 13 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -106,6 +106,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_checkEnableZoomCenter; wxCheckBox* m_checkEnableMiddleButtonPan; wxCheckBox* m_checkMiddleButtonPanLimited; + wxCheckBox* m_checkEnableMousewheelPan; wxCheckBox* m_checkAutoPan; wxCheckBox* m_checkHVOrientation; wxCheckBox* m_checkPageLimits; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 52137632ac..c2aeaeb426 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2014-2016 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -330,6 +330,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowHiddenPins( m_showAllPins ); dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() ); + dlg.SetEnableMousewheelPan( m_canvas->GetEnableMousewheelPan() ); dlg.SetEnableZoomNoCenter( m_canvas->GetEnableZoomNoCenter() ); dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); @@ -378,6 +379,7 @@ void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event ) SetGridVisibility( dlg.GetShowGrid() ); m_showAllPins = dlg.GetShowHiddenPins(); m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() ); + m_canvas->SetEnableMousewheelPan( dlg.GetEnableMousewheelPan() ); m_canvas->SetEnableZoomNoCenter( dlg.GetEnableZoomNoCenter() ); m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp index e778279baa..d64bac5dc6 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr - * Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -72,6 +72,7 @@ void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event ) m_canvas->Refresh(); } + DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) : DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY ) { @@ -125,6 +126,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 +171,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() ); diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame_base.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame_base.cpp index 32d235ffb4..c6bdd8f0ac 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame_base.cpp +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame_base.cpp @@ -12,114 +12,119 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bDialogSizer; bDialogSizer = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bUpperSizer; bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - + wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - + wxString m_PolarDisplayChoices[] = { _("Cartesian coordinates"), _("Polar coordinates") }; int m_PolarDisplayNChoices = sizeof( m_PolarDisplayChoices ) / sizeof( wxString ); m_PolarDisplay = new wxRadioBox( this, wxID_ANY, _("Coordinates"), wxDefaultPosition, wxDefaultSize, m_PolarDisplayNChoices, m_PolarDisplayChoices, 1, wxRA_SPECIFY_COLS ); m_PolarDisplay->SetSelection( 0 ); bLeftSizer->Add( m_PolarDisplay, 0, wxALL|wxEXPAND, 5 ); - + wxString m_BoxUnitsChoices[] = { _("Inches"), _("Millimeters") }; int m_BoxUnitsNChoices = sizeof( m_BoxUnitsChoices ) / sizeof( wxString ); m_BoxUnits = new wxRadioBox( this, wxID_ANY, _("Units"), wxDefaultPosition, wxDefaultSize, m_BoxUnitsNChoices, m_BoxUnitsChoices, 1, wxRA_SPECIFY_COLS ); m_BoxUnits->SetSelection( 0 ); bLeftSizer->Add( m_BoxUnits, 0, wxALL|wxEXPAND, 5 ); - + wxString m_CursorShapeChoices[] = { _("Small cross"), _("Full screen cursor") }; int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString ); m_CursorShape = new wxRadioBox( this, wxID_ANY, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS ); m_CursorShape->SetSelection( 1 ); bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 ); - + m_OptDisplayDCodes = new wxCheckBox( this, wxID_ANY, _("Show D codes"), wxDefaultPosition, wxDefaultSize, 0 ); - m_OptDisplayDCodes->SetValue(true); + m_OptDisplayDCodes->SetValue(true); bLeftSizer->Add( m_OptDisplayDCodes, 0, wxALL, 5 ); - - + + bUpperSizer->Add( bLeftSizer, 1, wxALL|wxEXPAND, 5 ); - + wxBoxSizer* bMiddleSizer; bMiddleSizer = new wxBoxSizer( wxVERTICAL ); - + wxString m_OptDisplayLinesChoices[] = { _("Sketch"), _("Filled") }; int m_OptDisplayLinesNChoices = sizeof( m_OptDisplayLinesChoices ) / sizeof( wxString ); m_OptDisplayLines = new wxRadioBox( this, wxID_ANY, _("Lines"), wxDefaultPosition, wxDefaultSize, m_OptDisplayLinesNChoices, m_OptDisplayLinesChoices, 1, wxRA_SPECIFY_COLS ); m_OptDisplayLines->SetSelection( 1 ); bMiddleSizer->Add( m_OptDisplayLines, 0, wxALL|wxEXPAND, 5 ); - + wxString m_OptDisplayFlashedItemsChoices[] = { _("Sketch"), _("Filled") }; int m_OptDisplayFlashedItemsNChoices = sizeof( m_OptDisplayFlashedItemsChoices ) / sizeof( wxString ); m_OptDisplayFlashedItems = new wxRadioBox( this, wxID_ANY, _("Pads"), wxDefaultPosition, wxDefaultSize, m_OptDisplayFlashedItemsNChoices, m_OptDisplayFlashedItemsChoices, 1, wxRA_SPECIFY_COLS ); m_OptDisplayFlashedItems->SetSelection( 1 ); bMiddleSizer->Add( m_OptDisplayFlashedItems, 0, wxALL|wxEXPAND, 5 ); - + wxString m_OptDisplayPolygonsChoices[] = { _("Sketch"), _("Filled") }; int m_OptDisplayPolygonsNChoices = sizeof( m_OptDisplayPolygonsChoices ) / sizeof( wxString ); m_OptDisplayPolygons = new wxRadioBox( this, wxID_ANY, _("Polygons"), wxDefaultPosition, wxDefaultSize, m_OptDisplayPolygonsNChoices, m_OptDisplayPolygonsChoices, 1, wxRA_SPECIFY_COLS ); m_OptDisplayPolygons->SetSelection( 1 ); bMiddleSizer->Add( m_OptDisplayPolygons, 0, wxALL|wxEXPAND, 5 ); - - + + bUpperSizer->Add( bMiddleSizer, 1, wxALL|wxEXPAND, 5 ); - + wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - + wxString m_ShowPageLimitsChoices[] = { _("Full size without limits"), _("Full size"), _("Size A4"), _("Size A3"), _("Size A2"), _("Size A"), _("Size B"), _("Size C") }; int m_ShowPageLimitsNChoices = sizeof( m_ShowPageLimitsChoices ) / sizeof( wxString ); m_ShowPageLimits = new wxRadioBox( this, wxID_ANY, _("Page"), wxDefaultPosition, wxDefaultSize, m_ShowPageLimitsNChoices, m_ShowPageLimitsChoices, 1, wxRA_SPECIFY_COLS ); m_ShowPageLimits->SetSelection( 0 ); bRightSizer->Add( m_ShowPageLimits, 0, wxALL|wxEXPAND, 5 ); - + wxStaticBoxSizer* bLeftBottomSizer; bLeftBottomSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); - + 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( 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( bLeftBottomSizer->GetStaticBox(), wxID_ANY, _("Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 ); - bLeftBottomSizer->Add( m_OptMiddleButtonPanLimited, 0, wxALL, 5 ); - - + bLeftBottomSizer->Add( m_OptMiddleButtonPanLimited, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_OptMousewheelPan = new wxCheckBox( bLeftBottomSizer->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OptMousewheelPan->SetToolTip( _("Use touchpad to pan canvas") ); + + bLeftBottomSizer->Add( m_OptMousewheelPan, 0, wxALL, 5 ); + + bRightSizer->Add( bLeftBottomSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - + + bUpperSizer->Add( bRightSizer, 2, wxALL|wxEXPAND, 5 ); - - + + bDialogSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); - + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bDialogSizer->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); - + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - + bDialogSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); - - + + this->SetSizer( bDialogSizer ); this->Layout(); bDialogSizer->Fit( this ); - + // Connect Events m_OptMiddleButtonPan->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this ); @@ -132,5 +137,5 @@ DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE() m_OptMiddleButtonPan->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this ); - + } diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame_base.fbp b/gerbview/dialogs/gerbview_dialog_display_options_frame_base.fbp index dfb28da2ee..4c57b25b13 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame_base.fbp +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame_base.fbp @@ -1041,7 +1041,7 @@ 5 - wxALL + wxLEFT|wxRIGHT|wxTOP 0 1 @@ -1127,6 +1127,94 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use touchpad to pan + + 0 + + + 0 + + 1 + m_OptMousewheelPan + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Use touchpad to pan canvas + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame_base.h b/gerbview/dialogs/gerbview_dialog_display_options_frame_base.h index 3348b055b8..d49eea101d 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame_base.h +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame_base.h @@ -36,7 +36,7 @@ class DIALOG_SHIM; class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM { private: - + protected: wxRadioBox* m_PolarDisplay; wxRadioBox* m_BoxUnits; @@ -49,22 +49,23 @@ 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; wxButton* m_sdbSizer1Cancel; - + // Virtual event handlers, overide them in your derived class virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKBUttonClick( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Gerbview Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Gerbview Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_DISPLAY_OPTIONS_BASE(); - + }; #endif //__GERBVIEW_DIALOG_DISPLAY_OPTIONS_FRAME_BASE_H__ diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 8c386f0b1b..14ad10420c 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -3,7 +3,7 @@ * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -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 @@ -142,6 +143,10 @@ public: void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; } + bool GetEnableMousewheelPan() const { return m_enableMousewheelPan; } + + void SetEnableMousewheelPan( bool aEnable ); + bool GetEnableMiddleButtonPan() const { return m_enableMiddleButtonPan; } void SetEnableMiddleButtonPan( bool aEnable ) { m_enableMiddleButtonPan = aEnable; } diff --git a/include/view/view_controls.h b/include/view/view_controls.h index ddff54e477..d91a0f2fcb 100644 --- a/include/view/view_controls.h +++ b/include/view/view_controls.h @@ -3,6 +3,8 @@ * * Copyright (C) 2012 Torsten Hueter, torstenhtr gmx.de * Copyright (C) 2013 CERN + * Copyright (C) 2013-2016 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -49,7 +51,7 @@ public: VIEW_CONTROLS( VIEW* aView ) : m_view( aView ), m_forceCursorPosition( false ), m_cursorCaptured( false ), m_snappingEnabled( false ), m_grabMouse( false ), m_autoPanEnabled( false ), m_autoPanMargin( 0.1 ), - m_autoPanSpeed( 0.15 ), m_warpCursor( false ) + m_autoPanSpeed( 0.15 ), m_warpCursor( false ), m_enableMousewheelPan( false ) { } @@ -193,6 +195,25 @@ public: return m_warpCursor; } + /** + * Function EnableMousewheelPan() + * Enables or disables mousewheel panning. + * @param aEnabled is true if mouse-wheel panning is enabled. + */ + virtual void EnableMousewheelPan( bool aEnable ) + { + m_enableMousewheelPan = aEnable; + } + + /** + * Function IsMousewheelPanEnabled() + * Returns the current setting for mousewheel panning + */ + virtual bool IsMousewheelPanEnabled() const + { + return m_enableMousewheelPan; + } + /** * Function CenterOnCursor() * Sets the viewport center to the current cursor position and warps the cursor to the @@ -239,6 +260,9 @@ protected: /// If the cursor is allowed to be warped bool m_warpCursor; + + /// Mousewheel (2-finger touchpad) panning + bool m_enableMousewheelPan; }; } // namespace KIGFX diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index ee82299753..8dfd846446 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -85,6 +85,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_ZoomCenterOpt->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() ); @@ -137,10 +138,11 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); GetParent()->GetCanvas()->SetEnableZoomNoCenter( ! m_ZoomCenterOpt->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() ); + g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection(); g_MagneticTrackOption = m_MagneticTrackOptCtrl->GetSelection(); diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp index bfa504fc58..3412d6e8ee 100644 --- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp +++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.cpp @@ -12,212 +12,216 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bSizerUpper; bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); - + wxBoxSizer* bLeftSizer; bLeftSizer = new wxBoxSizer( wxVERTICAL ); - + wxString m_PolarDisplayChoices[] = { _("Cartesian coordinates"), _("Polar coordinates") }; int m_PolarDisplayNChoices = sizeof( m_PolarDisplayChoices ) / sizeof( wxString ); m_PolarDisplay = new wxRadioBox( this, wxID_POLAR_CTRL, _("Coordinates"), wxDefaultPosition, wxDefaultSize, m_PolarDisplayNChoices, m_PolarDisplayChoices, 1, wxRA_SPECIFY_COLS ); m_PolarDisplay->SetSelection( 1 ); m_PolarDisplay->SetToolTip( _("Activates the display of relative coordinates from relative origin (set by the space key)\nto the cursor, in polar coordinates (angle and distance)") ); - + bLeftSizer->Add( m_PolarDisplay, 0, wxALL|wxEXPAND, 5 ); - + wxString m_UnitsSelectionChoices[] = { _("Inches"), _("Millimeters") }; int m_UnitsSelectionNChoices = sizeof( m_UnitsSelectionChoices ) / sizeof( wxString ); m_UnitsSelection = new wxRadioBox( this, wxID_UNITS, _("Units"), wxDefaultPosition, wxDefaultSize, m_UnitsSelectionNChoices, m_UnitsSelectionChoices, 1, wxRA_SPECIFY_COLS ); m_UnitsSelection->SetSelection( 1 ); m_UnitsSelection->SetToolTip( _("Selection of units used to display dimensions and positions of items") ); - + bLeftSizer->Add( m_UnitsSelection, 0, wxALL|wxEXPAND, 5 ); - + wxString m_CursorShapeChoices[] = { _("Small cross"), _("Full screen cursor") }; int m_CursorShapeNChoices = sizeof( m_CursorShapeChoices ) / sizeof( wxString ); m_CursorShape = new wxRadioBox( this, wxID_CURSOR_SHAPE, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShapeNChoices, m_CursorShapeChoices, 1, wxRA_SPECIFY_COLS ); m_CursorShape->SetSelection( 0 ); m_CursorShape->SetToolTip( _("Main cursor shape selection (small cross or large cursor)") ); - + bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 ); - - + + bSizerUpper->Add( bLeftSizer, 2, wxALL|wxEXPAND, 5 ); - + wxBoxSizer* bMiddleLeftSizer; bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL ); - + wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextmaxlinks = new wxStaticText( this, wxID_ANY, _("&Maximum links:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextmaxlinks->Wrap( -1 ); fgSizer1->Add( m_staticTextmaxlinks, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_MaxShowLinks = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); m_MaxShowLinks->SetToolTip( _("Adjust the number of ratsnets shown from cursor to closest pads") ); - + fgSizer1->Add( m_MaxShowLinks, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxTOP, 5 ); - + m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save (minutes):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextautosave->Wrap( -1 ); fgSizer1->Add( m_staticTextautosave, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxT("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 0 ); m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.") ); - + fgSizer1->Add( m_SaveTime, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_stMaxUndoItems = new wxStaticText( this, wxID_ANY, _("Ma&ximum undo items:"), wxDefaultPosition, wxDefaultSize, 0 ); m_stMaxUndoItems->Wrap( -1 ); fgSizer1->Add( m_stMaxUndoItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_spinMaxUndoItems = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65536, 1 ); fgSizer1->Add( m_spinMaxUndoItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_staticTextRotationAngle = new wxStaticText( this, wxID_ANY, _("&Rotation angle:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextRotationAngle->Wrap( -1 ); fgSizer1->Add( m_staticTextRotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - + m_RotationAngle = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_RotationAngle->SetToolTip( _("Context menu and hot key footprint rotation increment.") ); - + fgSizer1->Add( m_RotationAngle, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - - + + bMiddleLeftSizer->Add( fgSizer1, 0, wxEXPAND, 5 ); - + wxStaticBoxSizer* bMiddleRightBoxSizer; bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL ); - + m_DrcOn = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_DRC_ONOFF, _("&Enforce design rules when routing"), wxDefaultPosition, wxDefaultSize, 0 ); - m_DrcOn->SetValue(true); + m_DrcOn->SetValue(true); m_DrcOn->SetToolTip( _("Enable/disable the DRC control.\nWhen the DRC control is disabled, all connections are allowed.") ); - + bMiddleRightBoxSizer->Add( m_DrcOn, 0, wxALL|wxEXPAND, 5 ); - + m_ShowGlobalRatsnest = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_GENERAL_RATSNEST, _("&Show ratsnest"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ShowGlobalRatsnest->SetValue(true); + m_ShowGlobalRatsnest->SetValue(true); m_ShowGlobalRatsnest->SetToolTip( _("Show (or not) the full rastnest.") ); - + bMiddleRightBoxSizer->Add( m_ShowGlobalRatsnest, 0, wxALL, 5 ); - + m_ShowModuleRatsnest = new wxCheckBox( bMiddleRightBoxSizer->GetStaticBox(), wxID_RATSNEST_MODULE, _("S&how 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( 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( 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( bMiddleRightBoxSizer->GetStaticBox(), wxID_SEGMENTS45, _("L&imit 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( 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 ); - - + + bMiddleLeftSizer->Add( bMiddleRightBoxSizer, 4, wxALL|wxEXPAND, 5 ); - - + + bSizerUpper->Add( bMiddleLeftSizer, 0, wxALL|wxEXPAND, 5 ); - + wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); - + wxString m_MagneticPadOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; int m_MagneticPadOptCtrlNChoices = sizeof( m_MagneticPadOptCtrlChoices ) / sizeof( wxString ); m_MagneticPadOptCtrl = new wxRadioBox( this, wxID_ANY, _("Magnetic Pads"), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlNChoices, m_MagneticPadOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_MagneticPadOptCtrl->SetSelection( 0 ); m_MagneticPadOptCtrl->SetToolTip( _("control the capture of the pcb cursor when the mouse cursor enters a pad area") ); - + bRightSizer->Add( m_MagneticPadOptCtrl, 0, wxALL|wxEXPAND, 5 ); - + wxString m_MagneticTrackOptCtrlChoices[] = { _("Never"), _("When creating tracks"), _("Always") }; int m_MagneticTrackOptCtrlNChoices = sizeof( m_MagneticTrackOptCtrlChoices ) / sizeof( wxString ); m_MagneticTrackOptCtrl = new wxRadioBox( this, wxID_MAGNETIC_TRACKS, _("Magnetic Tracks"), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlNChoices, m_MagneticTrackOptCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_MagneticTrackOptCtrl->SetSelection( 0 ); m_MagneticTrackOptCtrl->SetToolTip( _("Control the capture of the pcb cursor when the mouse cursor enters a track") ); - + bRightSizer->Add( m_MagneticTrackOptCtrl, 0, wxALL|wxEXPAND, 5 ); - + wxStaticBoxSizer* sbSizer2PAN; sbSizer2PAN = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); - + m_ZoomCenterOpt = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_ANY, _("Ce&nter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ZoomCenterOpt->SetValue(true); m_ZoomCenterOpt->SetToolTip( _("Keep the cursor at its current location when zooming") ); - + sbSizer2PAN->Add( m_ZoomCenterOpt, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - + 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( sbSizer2PAN->GetStaticBox(), wxID_MIDDLEBUTTONPAN, _("Limi&t 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_MousewheelPANOpt = new wxCheckBox( sbSizer2PAN->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MousewheelPANOpt->SetToolTip( _("Use touchpad 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 ); - - + + bRightSizer->Add( sbSizer2PAN, 1, wxEXPAND, 5 ); - + wxStaticBoxSizer* sbSizer2Adv; sbSizer2Adv = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Advanced/Developer") ), wxVERTICAL ); - + m_DumpZonesWhenFilling = new wxCheckBox( sbSizer2Adv->GetStaticBox(), wxID_ANY, _("Dump zone geometry to files when filling"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer2Adv->Add( m_DumpZonesWhenFilling, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - + + bRightSizer->Add( sbSizer2Adv, 0, wxALL|wxEXPAND, 5 ); - - + + bSizerUpper->Add( bRightSizer, 0, wxALL|wxEXPAND, 5 ); - - + + bMainSizer->Add( bSizerUpper, 0, wxEXPAND, 5 ); - + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); - + m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - + bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 ); - - + + this->SetSizer( bMainSizer ); this->Layout(); bMainSizer->Fit( this ); - + // Connect Events m_MiddleButtonPANOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnMiddleBtnPanEnbl ), NULL, this ); m_DumpZonesWhenFilling->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnMiddleBtnPanEnbl ), NULL, this ); @@ -232,5 +236,5 @@ DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::~DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( m_DumpZonesWhenFilling->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnMiddleBtnPanEnbl ), NULL, this ); m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnCancelClick ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnOkClick ), NULL, this ); - + } diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp index af52929dd2..43741477e7 100644 --- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp +++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.fbp @@ -111,11 +111,11 @@ bLeftSizer wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -201,11 +201,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -291,11 +291,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -408,11 +408,11 @@ none 0 0 - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -491,11 +491,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL|wxTOP 0 - + 1 1 1 @@ -579,11 +579,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -662,11 +662,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -750,11 +750,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -833,11 +833,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -921,11 +921,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -1004,11 +1004,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + 1 1 1 @@ -1738,11 +1738,11 @@ bRightSizer wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -1828,11 +1828,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -1930,11 +1930,11 @@ wxVERTICAL none - + 5 wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -1948,7 +1948,7 @@ 1 0 - 1 + 0 1 1 @@ -2018,11 +2018,11 @@ - + 5 wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -2106,11 +2106,11 @@ - + 5 wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -2194,11 +2194,99 @@ - + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Use touchpad to pan + + 0 + + + 0 + + 1 + m_MousewheelPANOpt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Use touchpad to pan canvas + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL 0 - + 1 1 1 @@ -2288,7 +2376,7 @@ 5 wxALL|wxEXPAND 0 - + wxID_ANY Advanced/Developer diff --git a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h index 98119f4cdc..6bb5bb08c0 100644 --- a/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h +++ b/pcbnew/dialogs/dialog_general_options_BoardEditor_base.h @@ -38,7 +38,7 @@ class DIALOG_SHIM; class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM { private: - + protected: enum { @@ -55,7 +55,7 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM wxID_MIDDLEBUTTONPAN, wxID_AUTOPAN }; - + wxRadioBox* m_PolarDisplay; wxRadioBox* m_UnitsSelection; wxRadioBox* m_CursorShape; @@ -79,24 +79,25 @@ class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public DIALOG_SHIM wxCheckBox* m_ZoomCenterOpt; wxCheckBox* m_MiddleButtonPANOpt; wxCheckBox* m_OptMiddleButtonPanLimited; + wxCheckBox* m_MousewheelPANOpt; wxCheckBox* m_AutoPANOpt; wxCheckBox* m_DumpZonesWhenFilling; wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; - + // Virtual event handlers, overide them in your derived class virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("General Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("General Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE(); - + }; #endif //__DIALOG_GENERAL_OPTIONS_BOARDEDITOR_BASE_H__