From 9fd53c4753564832cf095108bcef818e0901309f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 30 Dec 2017 21:14:41 +0000 Subject: [PATCH] Add standard pan and zoom options to cvpcb footprint viewer. Fixes: lp:1732881 * https://bugs.launchpad.net/kicad/+bug/1732881 --- cvpcb/dialogs/dialog_display_options.cpp | 11 +- cvpcb/dialogs/dialog_display_options_base.cpp | 18 +- cvpcb/dialogs/dialog_display_options_base.fbp | 182 +++++++++++++++++- cvpcb/dialogs/dialog_display_options_base.h | 6 +- 4 files changed, 206 insertions(+), 11 deletions(-) diff --git a/cvpcb/dialogs/dialog_display_options.cpp b/cvpcb/dialogs/dialog_display_options.cpp index db07595077..df3bdd8fe7 100644 --- a/cvpcb/dialogs/dialog_display_options.cpp +++ b/cvpcb/dialogs/dialog_display_options.cpp @@ -78,7 +78,10 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() m_TextDisplayOption->SetValue( not displ_opts->m_DisplayModTextFill ); m_ShowPadSketch->SetValue( not displ_opts->m_DisplayPadFill ); m_ShowPadNum->SetValue( displ_opts->m_DisplayPadNum ); - m_IsZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); + + m_enableZoomNoCenter->SetValue( m_Parent->GetCanvas()->GetEnableZoomNoCenter() ); + m_enableMousewheelPan->SetValue( m_Parent->GetCanvas()->GetEnableMousewheelPan() ); + m_enableAutoPan->SetValue( m_Parent->GetCanvas()->GetEnableAutoPan() ); } @@ -95,7 +98,11 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) displ_opts->m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); displ_opts->m_DisplayPadNum = m_ShowPadNum->GetValue(); displ_opts->m_DisplayPadFill = not m_ShowPadSketch->GetValue(); - m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_IsZoomNoCenter->GetValue() ); + + m_Parent->GetCanvas()->SetEnableZoomNoCenter( m_enableZoomNoCenter->GetValue() ); + m_Parent->GetCanvas()->SetEnableMousewheelPan( m_enableMousewheelPan->GetValue() ); + m_Parent->GetCanvas()->SetEnableAutoPan( m_enableAutoPan->GetValue() ); + m_Parent->GetCanvas()->Refresh(); } diff --git a/cvpcb/dialogs/dialog_display_options_base.cpp b/cvpcb/dialogs/dialog_display_options_base.cpp index cf3b47c159..8694c2b892 100644 --- a/cvpcb/dialogs/dialog_display_options_base.cpp +++ b/cvpcb/dialogs/dialog_display_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -40,10 +40,20 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxStaticBoxSizer* sbSizerViewOpt; sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL ); - m_IsZoomNoCenter = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Do not center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); - m_IsZoomNoCenter->SetToolTip( _("Keep the cursor at its current location when zooming") ); + m_enableZoomNoCenter = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Center and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 ); + m_enableZoomNoCenter->SetToolTip( _("Center the cursor on screen when zooming.") ); - sbSizerViewOpt->Add( m_IsZoomNoCenter, 0, wxEXPAND|wxALL, 5 ); + sbSizerViewOpt->Add( m_enableZoomNoCenter, 0, wxEXPAND|wxALL, 5 ); + + m_enableMousewheelPan = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 ); + m_enableMousewheelPan->SetToolTip( _("Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll).") ); + + sbSizerViewOpt->Add( m_enableMousewheelPan, 0, wxALL, 5 ); + + m_enableAutoPan = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 ); + m_enableAutoPan->SetToolTip( _("When drawing a track or moving an item, pan when approaching the edge of the display.") ); + + sbSizerViewOpt->Add( m_enableAutoPan, 0, wxALL, 5 ); bUpperSizer->Add( sbSizerViewOpt, 0, wxALL|wxEXPAND, 5 ); diff --git a/cvpcb/dialogs/dialog_display_options_base.fbp b/cvpcb/dialogs/dialog_display_options_base.fbp index bebc97784a..743090f3fd 100644 --- a/cvpcb/dialogs/dialog_display_options_base.fbp +++ b/cvpcb/dialogs/dialog_display_options_base.fbp @@ -515,7 +515,7 @@ 0 0 wxID_ANY - Do not center and warp cursor on zoom + Center and warp cursor on zoom 0 @@ -523,7 +523,7 @@ 0 1 - m_IsZoomNoCenter + m_enableZoomNoCenter 1 @@ -536,7 +536,183 @@ 0 - Keep the cursor at its current location when zooming + Center the cursor on screen when zooming. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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_enableMousewheelPan + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll). + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pan while moving object + + 0 + + + 0 + + 1 + m_enableAutoPan + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + When drawing a track or moving an item, pan when approaching the edge of the display. wxFILTER_NONE wxDefaultValidator diff --git a/cvpcb/dialogs/dialog_display_options_base.h b/cvpcb/dialogs/dialog_display_options_base.h index 10b404ef11..b6cdb7cae5 100644 --- a/cvpcb/dialogs/dialog_display_options_base.h +++ b/cvpcb/dialogs/dialog_display_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -40,7 +40,9 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM wxCheckBox* m_TextDisplayOption; wxCheckBox* m_ShowPadSketch; wxCheckBox* m_ShowPadNum; - wxCheckBox* m_IsZoomNoCenter; + wxCheckBox* m_enableZoomNoCenter; + wxCheckBox* m_enableMousewheelPan; + wxCheckBox* m_enableAutoPan; wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK;