Implement preference for immediate actions.

Also pushes prefer-selection-to-dragging to common.
This commit is contained in:
Jeff Young 2019-07-25 10:48:11 -06:00
parent e58d9606dd
commit 460b03372d
22 changed files with 1229 additions and 555 deletions

View File

@ -31,9 +31,6 @@
#include <pgm_base.h>
#include <id.h>
#include <wx/graphics.h>
static constexpr int dpi_scaling_precision = 1;
static constexpr double dpi_scaling_increment = 0.5;
@ -69,6 +66,14 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP
m_textEditorBtn->SetBitmap( KiBitmap( folder_xpm ) );
m_pdfViewerBtn->SetBitmap( KiBitmap( folder_xpm ) );
m_canvasScaleCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ), NULL, this );
}
PANEL_COMMON_SETTINGS::~PANEL_COMMON_SETTINGS()
{
m_canvasScaleCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_COMMON_SETTINGS::OnCanvasScaleChange ), NULL, this );
}
@ -127,6 +132,17 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow()
commonSettings->Read( ENBL_AUTO_PAN_KEY, &option );
m_AutoPANOpt->SetValue( option );
if( !commonSettings->Read( PREFER_SELECT_TO_DRAG_KEY, &option ) )
{
// Legacy versions stored the property only for PCBNew, so see if we have it there
std::unique_ptr<wxConfigBase> pcbSettings = GetNewConfig( wxT( "pcbnew" ) );
pcbSettings->Read( "DragSelects", &option, true );
}
m_PreferSelectToDrag->SetValue( option );
commonSettings->Read( IMMEDIATE_ACTIONS_KEY, &option );
m_NonImmediateActions->SetValue( !option );
m_textEditorPath->SetValue( Pgm().GetEditorName( false ) );
m_defaultPDFViewer->SetValue( Pgm().UseSystemPdfBrowser() );
m_otherPDFViewer->SetValue( !Pgm().UseSystemPdfBrowser() );
@ -160,6 +176,8 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow()
commonSettings->Write( ENBL_ZOOM_NO_CENTER_KEY, !m_ZoomCenterOpt->GetValue() );
commonSettings->Write( ENBL_MOUSEWHEEL_PAN_KEY, m_MousewheelPANOpt->GetValue() );
commonSettings->Write( ENBL_AUTO_PAN_KEY, m_AutoPANOpt->GetValue() );
commonSettings->Write( PREFER_SELECT_TO_DRAG_KEY, m_PreferSelectToDrag->GetValue() );
commonSettings->Write( IMMEDIATE_ACTIONS_KEY, !m_NonImmediateActions->GetValue() );
Pgm().SetEditorName( m_textEditorPath->GetValue() );

View File

@ -34,6 +34,7 @@ class PANEL_COMMON_SETTINGS : public PANEL_COMMON_SETTINGS_BASE
{
public:
PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aParent );
~PANEL_COMMON_SETTINGS() override;
protected:
bool TransferDataFromWindow() override;
@ -48,7 +49,7 @@ protected:
/**
* Event fired when the canvas scale field is modified
*/
void OnCanvasScaleChange( wxCommandEvent& aEvent ) override;
void OnCanvasScaleChange( wxCommandEvent& aEvent );
/**
* Event fired when the canvas auto-scale option is changed

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 10 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,195 +9,214 @@
///////////////////////////////////////////////////////////////////////////
PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
wxBoxSizer* bPanelSizer;
bPanelSizer = new wxBoxSizer( wxVERTICAL );
bPanelSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 4, 4 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer1->SetEmptyCellSize( wxSize( -1,2 ) );
m_staticTextautosave = new wxStaticText( this, wxID_ANY, _("&Auto save:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextautosave->Wrap( -1 );
gbSizer1->Add( m_staticTextautosave, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
m_SaveTime = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 );
m_SaveTime->SetToolTip( _("Delay after the first change to create a backup file of the board on disk.\nIf set to 0, auto backup is disabled") );
bSizer6->Add( m_SaveTime, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxStaticText* minutesLabel;
minutesLabel = new wxStaticText( this, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 );
minutesLabel->Wrap( -1 );
bSizer6->Add( minutesLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
gbSizer1->Add( bSizer6, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_staticTextFileHistorySize = new wxStaticText( this, wxID_ANY, _("File history size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextFileHistorySize->Wrap( -1 );
gbSizer1->Add( m_staticTextFileHistorySize, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_fileHistorySize = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
gbSizer1->Add( m_fileHistorySize, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxStaticText* antialiasingLabel;
antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Graphics (Accelerated):"), wxDefaultPosition, wxDefaultSize, 0 );
antialiasingLabel = new wxStaticText( this, wxID_ANY, _("Accelerated graphics:"), wxDefaultPosition, wxDefaultSize, 0 );
antialiasingLabel->Wrap( -1 );
gbSizer1->Add( antialiasingLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxString m_antialiasingChoices[] = { _("No Antialiasing"), _("Subpixel Antialiasing (High Quality)"), _("Subpixel Antialiasing (Ultra Quality)"), _("Supersampling (2x)"), _("Supersampling (4x)") };
int m_antialiasingNChoices = sizeof( m_antialiasingChoices ) / sizeof( wxString );
m_antialiasing = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingNChoices, m_antialiasingChoices, 0 );
m_antialiasing->SetSelection( 0 );
gbSizer1->Add( m_antialiasing, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
wxStaticText* antialiasingLabel1;
antialiasingLabel1 = new wxStaticText( this, wxID_ANY, _("Graphics (Fallback):"), wxDefaultPosition, wxDefaultSize, 0 );
antialiasingLabel1 = new wxStaticText( this, wxID_ANY, _("Fallback graphics:"), wxDefaultPosition, wxDefaultSize, 0 );
antialiasingLabel1->Wrap( -1 );
gbSizer1->Add( antialiasingLabel1, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxString m_antialiasingFallbackChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("Balanced Antialiasing"), _("High Quality Antialiasing") };
int m_antialiasingFallbackNChoices = sizeof( m_antialiasingFallbackChoices ) / sizeof( wxString );
m_antialiasingFallback = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingFallbackNChoices, m_antialiasingFallbackChoices, 0 );
m_antialiasingFallback->SetSelection( 0 );
gbSizer1->Add( m_antialiasingFallback, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
gbSizer1->AddGrowableCol( 1 );
bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxALL, 5 );
bLeftSizer->Add( gbSizer1, 0, wxEXPAND|wxALL, 10 );
wxStaticBoxSizer* sizerHelperApps;
sizerHelperApps = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Helper Applications") ), wxVERTICAL );
wxGridBagSizer* gridHelperApps;
gridHelperApps = new wxGridBagSizer( 3, 3 );
gridHelperApps->SetFlexibleDirection( wxBOTH );
gridHelperApps->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gridHelperApps->SetEmptyCellSize( wxSize( -1,5 ) );
wxStaticText* textEditorLabel;
textEditorLabel = new wxStaticText( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Text editor:"), wxDefaultPosition, wxDefaultSize, 0 );
textEditorLabel->Wrap( -1 );
gridHelperApps->Add( textEditorLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 4 );
m_textEditorPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textEditorPath->SetMinSize( wxSize( 360,-1 ) );
m_textEditorPath->SetMinSize( wxSize( 280,-1 ) );
gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_textEditorBtn->SetMinSize( wxSize( 29,29 ) );
gridHelperApps->Add( m_textEditorBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_defaultPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("System default PDF viewer"), wxDefaultPosition, wxDefaultSize, 0 );
gridHelperApps->Add( m_defaultPDFViewer, wxGBPosition( 2, 0 ), wxGBSpan( 1, 3 ), 0, 4 );
m_otherPDFViewer = new wxRadioButton( sizerHelperApps->GetStaticBox(), wxID_ANY, _("Other:"), wxDefaultPosition, wxDefaultSize, 0 );
gridHelperApps->Add( m_otherPDFViewer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 4 );
m_PDFViewerPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PDFViewerPath->SetMinSize( wxSize( 360,-1 ) );
m_PDFViewerPath->SetMinSize( wxSize( 280,-1 ) );
gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) );
gridHelperApps->Add( m_pdfViewerBtn, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gridHelperApps->AddGrowableCol( 1 );
sizerHelperApps->Add( gridHelperApps, 0, wxALL|wxEXPAND, 5 );
sizerHelperApps->Add( gridHelperApps, 0, wxEXPAND|wxBOTTOM|wxLEFT, 5 );
bLeftSizer->Add( sizerHelperApps, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerIconsOpts;
sbSizerIconsOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface") ), wxVERTICAL );
wxFlexGridSizer* fgSizer11;
fgSizer11 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer11->AddGrowableCol( 1 );
fgSizer11->SetFlexibleDirection( wxBOTH );
fgSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTexticonscale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexticonscale->Wrap( -1 );
fgSizer11->Add( m_staticTexticonscale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4 );
m_iconScaleSlider = new STEPPED_SLIDER( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_iconScaleSlider->SetMinSize( wxSize( 240,-1 ) );
m_iconScaleSlider->SetMinSize( wxSize( 140,-1 ) );
fgSizer11->Add( m_iconScaleSlider, 1, wxBOTTOM|wxEXPAND, 4 );
m_iconScaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_iconScaleAuto, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 25 );
m_staticTextCanvasScale = new wxStaticText( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Canvas scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCanvasScale->Wrap( -1 );
fgSizer11->Add( m_staticTextCanvasScale, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_canvasScaleCtrl = new wxSpinCtrlDouble( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0, 1 );
m_canvasScaleCtrl->SetDigits( 0 );
fgSizer11->Add( m_canvasScaleCtrl, 0, wxALL|wxEXPAND, 5 );
m_canvasScaleAuto = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Automatic"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer11->Add( m_canvasScaleAuto, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 25 );
fgSizer11->Add( 0, 0, 0, wxEXPAND, 5 );
sbSizerIconsOpts->Add( fgSizer11, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
sbSizerIconsOpts->Add( fgSizer11, 1, wxEXPAND|wxRIGHT, 5 );
m_checkBoxIconsInMenus = new wxCheckBox( sbSizerIconsOpts->GetStaticBox(), wxID_ANY, _("Show icons in menus"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerIconsOpts->Add( m_checkBoxIconsInMenus, 0, wxALL, 4 );
bLeftSizer->Add( sbSizerIconsOpts, 0, wxEXPAND|wxALL, 5 );
bLeftSizer->Add( sbSizerIconsOpts, 1, wxEXPAND|wxALL, 5 );
bPanelSizer->Add( bLeftSizer, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* rightSizer;
rightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer51;
sbSizer51 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan and Zoom") ), wxVERTICAL );
m_ZoomCenterOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Ce&nter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_ZoomCenterOpt->SetToolTip( _("Center the cursor on screen when zooming.") );
sbSizer51->Add( m_ZoomCenterOpt, 0, wxTOP|wxRIGHT|wxLEFT, 4 );
sbSizer51->Add( m_ZoomCenterOpt, 0, wxRIGHT|wxLEFT, 4 );
m_MousewheelPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_ANY, _("Use touchpad to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_MousewheelPANOpt->SetToolTip( _("Enable touchpad-friendly controls (pan with scroll action, zoom with Ctrl+scroll).") );
sbSizer51->Add( m_MousewheelPANOpt, 0, wxALL, 4 );
m_AutoPANOpt = new wxCheckBox( sbSizer51->GetStaticBox(), wxID_AUTOPAN, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 );
m_AutoPANOpt->SetToolTip( _("When drawing a track or moving an item, pan when approaching the edge of the display.") );
sbSizer51->Add( m_AutoPANOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
bLeftSizer->Add( sbSizer51, 0, wxEXPAND|wxALL, 5 );
bPanelSizer->Add( bLeftSizer, 0, 0, 5 );
rightSizer->Add( sbSizer51, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Editing") ), wxVERTICAL );
m_PreferSelectToDrag = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Prefer selection to dragging"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer4->Add( m_PreferSelectToDrag, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_NonImmediateActions = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("First hotkey selects tool"), wxDefaultPosition, wxDefaultSize, 0 );
m_NonImmediateActions->SetToolTip( _("If not checked, hotkeys will immediately perform an action even if the relevant tool was not previously selected.") );
sbSizer4->Add( m_NonImmediateActions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
rightSizer->Add( sbSizer4, 1, wxEXPAND|wxALL, 5 );
bPanelSizer->Add( rightSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bPanelSizer );
this->Layout();
bPanelSizer->Fit( this );
// Connect Events
m_textEditorBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnTextEditorClick ), NULL, this );
m_PDFViewerPath->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_COMMON_SETTINGS_BASE::onUpdateUIPdfPath ), NULL, this );
@ -213,7 +232,6 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
m_iconScaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnIconScaleAuto ), NULL, this );
m_canvasScaleCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleChange ), NULL, this );
m_canvasScaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleAuto ), NULL, this );
}
@ -234,7 +252,6 @@ PANEL_COMMON_SETTINGS_BASE::~PANEL_COMMON_SETTINGS_BASE()
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( PANEL_COMMON_SETTINGS_BASE::OnScaleSlider ), NULL, this );
m_iconScaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnIconScaleAuto ), NULL, this );
m_canvasScaleCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleChange ), NULL, this );
m_canvasScaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COMMON_SETTINGS_BASE::OnCanvasScaleAuto ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 10 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __PANEL_COMMON_SETTINGS_BASE_H__
#define __PANEL_COMMON_SETTINGS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -22,10 +23,10 @@
#include <wx/choice.h>
#include <wx/gbsizer.h>
#include <wx/textctrl.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/radiobut.h>
#include <wx/statbox.h>
@ -38,16 +39,16 @@
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_COMMON_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class PANEL_COMMON_SETTINGS_BASE : public wxPanel
class PANEL_COMMON_SETTINGS_BASE : public wxPanel
{
private:
protected:
enum
{
wxID_AUTOPAN = 1000
};
wxStaticText* m_staticTextautosave;
wxSpinCtrl* m_SaveTime;
wxStaticText* m_staticTextFileHistorySize;
@ -70,21 +71,23 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel
wxCheckBox* m_ZoomCenterOpt;
wxCheckBox* m_MousewheelPANOpt;
wxCheckBox* m_AutoPANOpt;
wxCheckBox* m_PreferSelectToDrag;
wxCheckBox* m_NonImmediateActions;
// Virtual event handlers, overide them in your derived class
virtual void OnTextEditorClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateUIPdfPath( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPDFViewerClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnIconScaleAuto( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCanvasScaleChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCanvasScaleAuto( wxCommandEvent& event ) { event.Skip(); }
public:
PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
~PANEL_COMMON_SETTINGS_BASE();
};
#endif //__PANEL_COMMON_SETTINGS_BASE_H__

View File

@ -161,6 +161,79 @@ EDA_BASE_FRAME::~EDA_BASE_FRAME()
}
void EDA_BASE_FRAME::PushTool( const std::string& actionName )
{
m_toolStack.push_back( actionName );
// Human cognitive stacking is very shallow; deeper tool stacks just get annoying
if( m_toolStack.size() > 3 )
m_toolStack.erase( m_toolStack.begin() );
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
if( action )
DisplayToolMsg( action->GetLabel() );
else
DisplayToolMsg( actionName );
}
void EDA_BASE_FRAME::PopTool( const std::string& actionName )
{
// Push/pop events can get out of order (such as when they're generated by the Simulator
// frame but not processed until the mouse is back in the Schematic frame), so make sure
// we're popping the right stack frame.
for( int i = m_toolStack.size() - 1; i >= 0; --i )
{
if( m_toolStack[ i ] == actionName )
{
m_toolStack.erase( m_toolStack.begin() + i );
// If there's something underneath us, and it's now the top of the stack, then
// re-activate it
if( ( --i ) >= 0 && i == m_toolStack.size() - 1 )
{
std::string back = m_toolStack[ i ];
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( back );
if( action )
{
// Pop the action as running it will push it back onto the stack
m_toolStack.pop_back();
TOOL_EVENT evt = action->MakeEvent();
evt.SetHasPosition( false );
GetToolManager()->PostEvent( evt );
}
}
else
DisplayToolMsg( ACTIONS::selectionTool.GetLabel() );
return;
}
}
}
std::string EDA_BASE_FRAME::CurrentToolName() const
{
if( m_toolStack.empty() )
return ACTIONS::selectionTool.GetName();
else
return m_toolStack.back();
}
bool EDA_BASE_FRAME::IsCurrentTool( const TOOL_ACTION& aAction ) const
{
if( m_toolStack.empty() )
return &aAction == &ACTIONS::selectionTool;
else
return m_toolStack.back() == aAction.GetName();
}
bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
{
#ifdef __WXMAC__
@ -327,6 +400,11 @@ void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged )
ReCreateMenuBar();
GetMenuBar()->Refresh();
}
wxConfigBase* settings = Pgm().CommonSettings();
settings->Read( PREFER_SELECT_TO_DRAG_KEY, &m_dragSelects );
settings->Read( IMMEDIATE_ACTIONS_KEY, &m_immediateActions );
}
@ -387,6 +465,16 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( baseCfgName + entryPerspective, &m_perspective );
aCfg->Read( baseCfgName + entryMruPath, &m_mruPath );
wxConfigBase* settings = Pgm().CommonSettings();
if( !settings->Read( PREFER_SELECT_TO_DRAG_KEY, &m_dragSelects ) )
{
// Legacy versions stored the property only for PCBNew, so see if we have it there
std::unique_ptr<wxConfigBase> pcbSettings = GetNewConfig( wxT( "pcbnew" ) );
pcbSettings->Read( "DragSelects", &m_dragSelects, true );
}
settings->Read( IMMEDIATE_ACTIONS_KEY, &m_immediateActions, false );
}

View File

@ -94,8 +94,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_toolDispatcher = NULL;
m_messagePanel = NULL;
m_currentScreen = NULL;
m_toolId = ID_NO_TOOL_SELECTED;
m_lastDrawToolId = ID_NO_TOOL_SELECTED;
m_showBorderAndTitleBlock = false; // true to display reference sheet.
m_LastGridSizeId = 0;
m_drawGrid = true; // hide/Show grid. default = show
@ -424,70 +422,6 @@ void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
}
void EDA_DRAW_FRAME::PushTool( const std::string& actionName )
{
m_toolStack.push_back( actionName );
// Human cognitive stacking is very shallow; deeper tool stacks just get annoying
if( m_toolStack.size() > 3 )
m_toolStack.erase( m_toolStack.begin() );
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
if( action )
DisplayToolMsg( action->GetLabel() );
else
DisplayToolMsg( actionName );
}
void EDA_DRAW_FRAME::PopTool( const std::string& actionName )
{
// Push/pop events can get out of order (such as when they're generated by the Simulator
// frame but not processed until the mouse is back in the Schematic frame), so make sure
// we're popping the right stack frame.
for( int i = m_toolStack.size() - 1; i >= 0; --i )
{
if( m_toolStack[ i ] == actionName )
{
m_toolStack.erase( m_toolStack.begin() + i );
// If there's something underneath us, and it's now the top of the stack, then
// re-activate it
if( ( --i ) >= 0 && i == m_toolStack.size() - 1 )
{
std::string back = m_toolStack[ i ];
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( back );
if( action )
{
// Pop the action as running it will push it back onto the stack
m_toolStack.pop_back();
TOOL_EVENT evt = action->MakeEvent();
evt.SetHasPosition( false );
GetToolManager()->PostEvent( evt );
}
}
else
DisplayToolMsg( ACTIONS::selectionTool.GetLabel() );
return;
}
}
}
bool EDA_DRAW_FRAME::IsCurrentTool( const TOOL_ACTION& aAction )
{
if( m_toolStack.empty() )
return &aAction == &ACTIONS::selectionTool;
else
return m_toolStack.back() == aAction.GetName();
}
void EDA_DRAW_FRAME::UpdateStatusBar()
{
SetStatusText( GetZoomLevelIndicator(), 1 );

View File

@ -32,6 +32,7 @@
#include <tool/action_menu.h>
#include <wx/log.h>
#include <menus_helpers.h>
#include <eda_base_frame.h>
#include <id.h>
@ -435,10 +436,21 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
// clients that don't supply a tool will have to check GetSelected() themselves
if( evt && m_tool )
{
TOOL_MANAGER* toolMgr = m_tool->GetManager();
if( g_last_menu_highlighted_id == aEvent.GetId() && !m_isContextMenu )
evt->SetHasPosition( false );
//aEvent.StopPropagation();
if( toolMgr->GetEditFrame() && !toolMgr->GetEditFrame()->GetDoImmediateActions() )
{
// An tool-selection-event has no position
if( evt->GetCommandStr().is_initialized()
&& evt->GetCommandStr().get() != toolMgr->GetEditFrame()->CurrentToolName() )
{
evt->SetHasPosition( false );
}
}
if( m_tool->GetManager() )
m_tool->GetManager()->ProcessEvent( *evt );
}

View File

@ -114,28 +114,37 @@ class EDA_BASE_FRAME : public wxFrame, public KIWAY_HOLDER
wxWindow* findQuasiModalDialog();
protected:
FRAME_T m_Ident; // Id Type (pcb, schematic, library..)
FRAME_T m_Ident; // Id Type (pcb, schematic, library..)
wxPoint m_FramePos;
wxSize m_FrameSize;
wxString m_AboutTitle; // Name of program displayed in About.
wxString m_AboutTitle; // Name of program displayed in About.
wxAuiManager m_auimgr;
wxString m_configName; // prefix used to identify some params (frame size...)
// and to name some config files (legacy hotkey files)
wxString m_configName; // Prefix used to identify some params (frame size...)
// and to name some config files (legacy hotkey files)
TOOL_MANAGER* m_toolManager;
ACTIONS* m_actions;
std::vector<std::string> m_toolStack; // Stack of user-level "tools". Not to be confused
// with TOOL_BASE-derived instances, many of which
// implement multiple user-level "tools". The user-
// level "tools" are TOOL_ACTIONSs internally.
bool m_immediateActions; // Preference for immediate actions. If false, the
// first invocation of a hotkey will just select the
// relevant tool.
bool m_dragSelects; // Prefer selection to dragging.
bool m_hasAutoSave;
bool m_autoSaveState;
int m_autoSaveInterval; // The auto save interval time in seconds.
int m_autoSaveInterval; // The auto save interval time in seconds.
wxTimer* m_autoSaveTimer;
wxString m_perspective; // wxAuiManager perspective.
wxString m_perspective; // wxAuiManager perspective.
wxString m_mruPath; // Most recently used path.
wxString m_mruPath; // Most recently used path.
EDA_UNITS_T m_userUnits;
@ -211,21 +220,47 @@ public:
*/
TOOL_MANAGER* GetToolManager() const { return m_toolManager; }
/**
* NB: the definition of "tool" is different at the user level. The implementation uses
* a single TOOL_BASE derived class to implement several user "tools", such as rectangle
* and circle, or wire and bus. So each user-level tool is actually a TOOL_ACTION.
*/
virtual void PushTool( const std::string& actionName );
virtual void PopTool( const std::string& actionName );
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
std::string CurrentToolName() const;
bool IsCurrentTool( const TOOL_ACTION& aAction ) const;
virtual void DisplayToolMsg( const wxString& msg ) {};
/**
* Indicates that hotkeys should perform an immediate action even if another tool is
* currently active. If false, the first hotkey should select the relevant tool.
*/
bool GetDoImmediateActions() const { return m_immediateActions; }
/**
* Indicates that a drag should draw a selection rectangle, even when started over an
* item.
*/
bool GetDragSelects() const { return m_dragSelects; }
/**
* Override the default process event handler to implement the auto save feature.
*
* @warning If you override this function in a derived class, make sure you call
* down to this or the auto save feature will be disabled.
* @warning If you override this function in a derived class, make sure you call down to
* this or the auto save feature will be disabled.
*/
bool ProcessEvent( wxEvent& aEvent ) override;
/**
* Capture the key event before it is sent to the GUI.
*
* the basic frame does not capture this event.
* editor frames should override this event function to capture and filter
* these keys when they are used as hotkeys, and skip it if the key is not
* used as hotkey (otherwise the key events will be not sent to menus)
* The basic frame does not capture this event. Editor frames should override this event
* function to capture and filter these keys when they are used as hotkeys, and skip it if
* the key is not used as hotkey (otherwise the key events will be not sent to menus).
*/
virtual void OnCharHook( wxKeyEvent& event );
@ -364,31 +399,28 @@ public:
/**
* Checks if \a aFileName can be written.
* <p>
* The function performs a number of tests on \a aFileName to verify that it
* can be saved. If \a aFileName defines a path with no file name, them the
* path is tested for user write permission. If \a aFileName defines a file
* name that does not exist in the path, the path is tested for user write
* permission. If \a aFileName defines a file that already exits, the file
* name is tested for user write permissions.
* The function performs a number of tests on \a aFileName to verify that it can be saved.
* If \a aFileName defines a path with no file name, them the path is tested for user write
* permission. If \a aFileName defines a file name that does not exist in the path, the
* path is tested for user write permission. If \a aFileName defines a file that already
* exits, the file name is tested for user write permissions.
* </p>
*
* @note The file name path must be set or an assertion will be raised on debug
* builds and return false on release builds.
* @note The file name path must be set or an assertion will be raised on debug builds and
* return false on release builds.
* @param aFileName The full path and/or file name of the file to test.
* @return False if \a aFileName cannot be written.
*/
bool IsWritable( const wxFileName& aFileName );
/**
* Check if an auto save file exists for \a aFileName and takes the appropriate
* action depending on the user input.
* Check if an auto save file exists for \a aFileName and takes the appropriate action
* depending on the user input.
* <p>
* If an auto save file exists for \a aFileName, the user is prompted if they wish
* to replace file \a aFileName with the auto saved file. If the user chooses to
* replace the file, the backup file of \a aFileName is removed, \a aFileName is
* renamed to the backup file name, and the auto save file is renamed to \a aFileName.
* If user chooses to keep the existing version of \a aFileName, the auto save file
* is removed.
* If an auto save file exists for \a aFileName, the user is prompted if they wish to
* replace file \a aFileName with the auto saved file. If the user chooses to replace the
* file, the backup file of \a aFileName is removed, \a aFileName is renamed to the backup
* file name, and the auto save file is renamed to \a aFileName. If user chooses to keep
* the existing version of \a aFileName, the auto save file is removed.
* </p>
* @param aFileName A wxFileName object containing the file name to check.
*/

View File

@ -35,7 +35,6 @@
#include "hotkeys_basic.h"
class wxSingleInstanceChecker;
class EDA_HOTKEY;
class ACTION_TOOLBAR;
class TOOL_MENU;
@ -82,47 +81,35 @@ namespace KIGFX
*/
class EDA_DRAW_FRAME : public KIWAY_PLAYER
{
///< Id of active button on the vertical toolbar.
int m_toolId;
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
EDA_DRAW_PANEL_GAL* m_canvas;
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
EDA_DRAW_PANEL_GAL* m_canvas;
///< GAL display options - this is the frame's interface to setting GAL display options
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
protected:
wxSocketServer* m_socketServer;
std::vector<wxSocketBase*> m_sockets; ///< interprocess communication
wxSocketServer* m_socketServer;
std::vector<wxSocketBase*> m_sockets; ///< interprocess communication
std::unique_ptr<wxSingleInstanceChecker> m_file_checker; ///< prevents opening same file multiple times.
int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
// 0 is for the grid corresponding to
// a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
bool m_drawGrid; // hide/Show grid
bool m_showPageLimits; ///< true to display the page limits
COLOR4D m_gridColor; ///< Grid color
COLOR4D m_drawBgColor; ///< the background color of the draw canvas
///< BLACK for Pcbnew, BLACK or WHITE for eeschema
double m_zoomLevelCoeff; ///< a suitable value to convert the internal zoom scaling factor
// to a zoom level value which rougly gives 1.0 when the board/schematic
// is at scale = 1
int m_UndoRedoCountMax; ///< default Undo/Redo command Max depth, to be handed
int m_LastGridSizeId; // The command id offset (>= 0) of the last selected
// grid 0 is for the grid corresponding to a
// wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
bool m_drawGrid; // Hide/Show grid
bool m_showPageLimits; // True to display the page limits
COLOR4D m_gridColor; // Grid color
COLOR4D m_drawBgColor; // The background color of the draw canvas; BLACK for
// Pcbnew, BLACK or WHITE for eeschema
double m_zoomLevelCoeff; // A suitable value to convert the internal zoom
// scaling factor to a zoom level value which rougly
// gives 1.0 when the board/schematic is at scale = 1
int m_UndoRedoCountMax; // Default Undo/Redo command Max depth, to be handed
// to screens
bool m_PolarCoords; //< for those frames that support polar coordinates
bool m_PolarCoords; // For those frames that support polar coordinates
TOOL_DISPATCHER* m_toolDispatcher;
/// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId; // JEY TODO: remove this; it doesn't work in modern toolset anyway
std::vector<std::string> m_toolStack; // stack of user-level "tools". Used to temporarily
// invoke an immediate-mode action. Note that these
// are "tools" in the UI sense, which are actually
// TOOL_ACTIONs internally
bool m_showBorderAndTitleBlock; /// Show the worksheet (border and title block).
long m_firstRunDialogSetting; /// Show first run dialog on startup
@ -303,62 +290,15 @@ public:
virtual void ReCreateOptToolbar() = 0;
virtual void ReCreateAuxiliaryToolbar() { }
/**
* The definition of "tool" is different at the user level. The implementation uses
* a single TOOL_BASE derived class to implement several user "tools", such as rectangle
* and circle, or wire and bus. So each user-level tool is actually a TOOL_ACTION.
/*
* These 4 functions provide a basic way to show/hide grid and /get/set grid color.
* These parameters are saved in KiCad config for each main frame.
*/
virtual void PushTool( const std::string& actionName );
virtual void PopTool( const std::string& actionName );
virtual bool IsGridVisible() const { return m_drawGrid; }
virtual void SetGridVisibility( bool aVisible ) { m_drawGrid = aVisible; }
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
bool IsCurrentTool( const TOOL_ACTION& aAction );
/**
* @return the current tool ID
* when there is no active tool, the ID_NO_TOOL_SELECTED is returned
* (the id of the default Tool (idle tool) of the right vertical toolbar)
*/
int GetToolId() const { return m_toolId; }
/* These 4 functions provide a basic way to show/hide grid
* and /get/set grid color.
* These parameters are saved in KiCad config for each main frame
*/
/**
* @return true if the grid must be shown
*/
virtual bool IsGridVisible() const
{
return m_drawGrid;
}
/**
* It may be overloaded by derived classes
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility( bool aVisible )
{
m_drawGrid = aVisible;
}
/**
* @return the color of the grid
*/
virtual COLOR4D GetGridColor()
{
return m_gridColor;
}
/**
* @param aColor = the new color of the grid
*/
virtual void SetGridColor( COLOR4D aColor )
{
m_gridColor = aColor;
}
virtual COLOR4D GetGridColor() { return m_gridColor; }
virtual void SetGridColor( COLOR4D aColor ) { m_gridColor = aColor; }
/**
* Command event handler for selecting grid sizes.
@ -392,26 +332,6 @@ public:
*/
virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent );
/**
* Change the zoom to the next one available redraws the screen
* and warp the mouse pointer on request.
*
* @param aCenterPoint is the reference point for zooming
* @param aWarpPointer = true to move the pointer to the aCenterPoint
*/
void SetNextZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
/**
* Change the zoom to the previous one available redraws the screen
* and warp the mouse pointer on request.
*
* @param aCenterPoint is the reference point for zooming
* @param aWarpPointer = true to move the pointer to the aCenterPoint
*/
void SetPreviousZoomAndRedraw( const wxPoint& aCenterPoint, bool aWarpPointer );
/**
* Rebuild the GAL and redraws the screen. Call when something went wrong.
*/
@ -462,7 +382,7 @@ public:
const wxString &aFilename, const wxString &aSheetLayer = wxEmptyString,
COLOR4D aColor = COLOR4D::UNSPECIFIED );
void DisplayToolMsg( const wxString& msg );
void DisplayToolMsg( const wxString& msg ) override;
/**
* Called when modifying the page settings.

View File

@ -55,6 +55,8 @@
#define GAL_DISPLAY_OPTIONS_KEY wxT( "GalDisplayOptions" )
#define GAL_ANTIALIASING_MODE_KEY wxT( "OpenGLAntialiasingMode" )
#define CAIRO_ANTIALIASING_MODE_KEY wxT( "CairoAntialiasingMode" )
#define IMMEDIATE_ACTIONS_KEY wxT( "ImmediateActions" )
#define PREFER_SELECT_TO_DRAG_KEY wxT( "PreferSelectionToDragging" )
///@}

View File

@ -47,7 +47,6 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataToWindow()
// Editing options
m_Segments_45_Only_Ctrl->SetValue( m_frame->Settings().m_Use45DegreeGraphicSegments );
m_MagneticPads->SetValue( m_frame->Settings().m_MagneticPads == CAPTURE_ALWAYS );
m_dragSelects->SetValue( m_frame->Settings().m_DragSelects );
return true;
}
@ -62,7 +61,6 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataFromWindow()
// Editing options
m_frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue();
m_frame->Settings().m_MagneticPads = m_MagneticPads->GetValue() ? CAPTURE_ALWAYS : NO_EFFECT;
m_frame->Settings().m_DragSelects = m_dragSelects->GetValue();
return true;
}

View File

@ -45,18 +45,10 @@ PANEL_MODEDIT_SETTINGS_BASE::PANEL_MODEDIT_SETTINGS_BASE( wxWindow* parent, wxWi
m_MagneticPads = new wxCheckBox( sbSizerEditOptions->GetStaticBox(), wxID_ANY, _("Magnetic pads"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerEditOptions->Add( m_MagneticPads, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerEditOptions->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_Segments_45_Only_Ctrl = new wxCheckBox( sbSizerEditOptions->GetStaticBox(), wxID_SEGMENTS45, _("L&imit graphic lines to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
m_Segments_45_Only_Ctrl->SetToolTip( _("Force line segment directions to H, V or 45 degrees when drawing on technical layers.") );
sbSizerEditOptions->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 );
m_dragSelects = new wxCheckBox( sbSizerEditOptions->GetStaticBox(), wxID_ANY, _("Prefer selection to dragging"), wxDefaultPosition, wxDefaultSize, 0 );
m_dragSelects->SetToolTip( _("When enabled and nothing is selected, drag gesture will draw a selection box, even if there are items under the cursor that could be immediately dragged.") );
sbSizerEditOptions->Add( m_dragSelects, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerEditOptions->Add( m_Segments_45_Only_Ctrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerColumns->Add( sbSizerEditOptions, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );

View File

@ -386,17 +386,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@ -482,94 +472,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<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">Prefer selection to dragging</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">g_DragSelects</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">When enabled and nothing is selected, drag gesture will draw a selection box, even if there are items under the cursor that could be immediately dragged.</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>

View File

@ -40,7 +40,6 @@ class PANEL_MODEDIT_SETTINGS_BASE : public wxPanel
wxRadioBox* m_UnitsSelection;
wxCheckBox* m_MagneticPads;
wxCheckBox* m_Segments_45_Only_Ctrl;
wxCheckBox* m_dragSelects;
public:

View File

@ -61,7 +61,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
m_magneticTrackChoice->SetSelection( general_opts.m_MagneticTracks );
m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticGraphics );
m_UseEditKeyForWidth->SetValue( general_opts.m_EditHotkeyChangesTrackWidth );
m_dragSelects->SetValue( general_opts.m_DragSelects );
m_FlipLeftRight->SetValue( general_opts.m_FlipLeftRight );
m_Show_Page_Limits->SetValue( m_Frame->ShowPageLimits() );
@ -84,7 +83,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
m_Frame->Settings().m_MagneticTracks = (MAGNETIC_OPTIONS) m_magneticTrackChoice->GetSelection();
m_Frame->Settings().m_MagneticGraphics = !m_magneticGraphicsChoice->GetSelection();
m_Frame->Settings().m_EditHotkeyChangesTrackWidth = m_UseEditKeyForWidth->GetValue();
m_Frame->Settings().m_DragSelects = m_dragSelects->GetValue();
m_Frame->Settings().m_FlipLeftRight = m_FlipLeftRight->GetValue();
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );

View File

@ -49,11 +49,6 @@ PANEL_PCBNEW_SETTINGS_BASE::PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWind
bOptionsSizer->Add( m_UseEditKeyForWidth, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_dragSelects = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Prefer selection to dragging"), wxDefaultPosition, wxDefaultSize, 0 );
m_dragSelects->SetToolTip( _("When enabled and nothing is selected, drag gesture will draw a selection box, even if there are items under the cursor that could be immediately dragged.") );
bOptionsSizer->Add( m_dragSelects, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_FlipLeftRight = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Flip board items L/R (default is T/B)"), wxDefaultPosition, wxDefaultSize, 0 );
bOptionsSizer->Add( m_FlipLeftRight, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );

View File

@ -470,94 +470,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</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">Prefer selection to dragging</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_dragSelects</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">When enabled and nothing is selected, drag gesture will draw a selection box, even if there are items under the cursor that could be immediately dragged.</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="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>

View File

@ -46,7 +46,6 @@ class PANEL_PCBNEW_SETTINGS_BASE : public wxPanel
wxRadioBox* m_UnitsSelection;
wxCheckBox* m_Segments_45_Only_Ctrl;
wxCheckBox* m_UseEditKeyForWidth;
wxCheckBox* m_dragSelects;
wxCheckBox* m_FlipLeftRight;
wxStaticText* m_staticTextRotationAngle;
wxTextCtrl* m_RotationAngle;

View File

@ -28,7 +28,6 @@
PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) :
m_Use45DegreeGraphicSegments( false ),
m_EditHotkeyChangesTrackWidth( false ),
m_DragSelects( true ),
m_FlipLeftRight( false ),
m_MagneticPads( CAPTURE_CURSOR_IN_TRACK_TOOL ),
m_MagneticTracks( CAPTURE_CURSOR_IN_TRACK_TOOL ),
@ -44,7 +43,6 @@ PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) :
Add( "MagneticTracks", reinterpret_cast<int*>( &m_MagneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL );
Add( "MagneticGraphics", &m_MagneticGraphics, true );
Add( "EditActionChangesTrackWidth", &m_EditHotkeyChangesTrackWidth, false );
Add( "DragSelects", &m_DragSelects, true );
Add( "FlipLeftRight", &m_FlipLeftRight, false );
break;

View File

@ -50,8 +50,6 @@ public:
bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
// vertical and 45º
bool m_EditHotkeyChangesTrackWidth;
bool m_DragSelects; // True: Drag gesture always draws a selection box,
// False: Drag will select an item and move it
bool m_FlipLeftRight; // True: Flip footprints across Y axis
// False: Flip footprints across X axis

View File

@ -189,7 +189,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( m_frame->ToolStackIsEmpty() )
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
bool dragAlwaysSelects = getEditFrame<PCB_BASE_FRAME>()->Settings().m_DragSelects;
bool dragAlwaysSelects = getEditFrame<PCB_BASE_FRAME>()->GetDragSelects();
m_additive = m_subtractive = m_exclusive_or = false;
if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )