Commit f0dc5434 authored by jean-pierre charras's avatar jean-pierre charras

All: new middle mouse pan feature, from lajos kamocsay (and jp charras for some enhancements).

If enable in preference menu, allow the pan with drag mouse with middle button down.
both unlimited and limited pan is allowed.
parent 0df37933
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
#define CLIP_BOX_PADDING 2 #define CLIP_BOX_PADDING 2
// keys to store options in config:
#define ENBL_MIDDLE_BUTT_PAN_KEY wxT( "MiddleButtonPAN" )
#define MIDDLE_BUTT_PAN_LIMITED_KEY wxT( "MiddleBtnPANLimited" )
#define ENBL_AUTO_PAN_KEY wxT( "AutoPAN" )
/* Definitions for enabling and disabling debugging features in drawpanel.cpp. /* Definitions for enabling and disabling debugging features in drawpanel.cpp.
* Please don't forget to turn these off before making any commits to Launchpad. * Please don't forget to turn these off before making any commits to Launchpad.
*/ */
...@@ -96,6 +101,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -96,6 +101,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_ClipBox.SetY( 0 ); m_ClipBox.SetY( 0 );
m_canStartBlock = -1; // Command block can start if >= 0 m_canStartBlock = -1; // Command block can start if >= 0
m_abortRequest = false; m_abortRequest = false;
m_enableMiddleButtonPan = false;
m_panScrollbarLimits = false;
m_enableAutoPan = true; m_enableAutoPan = true;
m_ignoreMouseEvents = false; m_ignoreMouseEvents = false;
...@@ -103,7 +110,11 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -103,7 +110,11 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_endMouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL;
if( wxGetApp().GetSettings() ) if( wxGetApp().GetSettings() )
wxGetApp().GetSettings()->Read( wxT( "AutoPAN" ), &m_enableAutoPan, true ); {
wxGetApp().GetSettings()->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, false );
wxGetApp().GetSettings()->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false );
wxGetApp().GetSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true );
}
m_requestAutoPan = false; m_requestAutoPan = false;
m_enableBlockCommands = false; m_enableBlockCommands = false;
...@@ -123,10 +134,11 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -123,10 +134,11 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
EDA_DRAW_PANEL::~EDA_DRAW_PANEL() EDA_DRAW_PANEL::~EDA_DRAW_PANEL()
{ {
wxGetApp().GetSettings()->Write( wxT( "AutoPAN" ), m_enableAutoPan ); wxGetApp().GetSettings()->Write( ENBL_MIDDLE_BUTT_PAN_KEY, m_enableMiddleButtonPan );
wxGetApp().GetSettings()->Write( MIDDLE_BUTT_PAN_LIMITED_KEY, m_panScrollbarLimits );
wxGetApp().GetSettings()->Write( ENBL_AUTO_PAN_KEY, m_enableAutoPan );
} }
EDA_DRAW_FRAME* EDA_DRAW_PANEL::GetParent() EDA_DRAW_FRAME* EDA_DRAW_PANEL::GetParent()
{ {
return ( EDA_DRAW_FRAME* ) wxWindow::GetParent(); return ( EDA_DRAW_FRAME* ) wxWindow::GetParent();
...@@ -317,18 +329,24 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event ) ...@@ -317,18 +329,24 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
int dir; int dir;
int x, y; int x, y;
int ppux, ppuy; int ppux, ppuy;
int csizeX, csizeY;
int unitsX, unitsY; int unitsX, unitsY;
int maxX, maxY; int maxX, maxY;
GetViewStart( &x, &y ); GetViewStart( &x, &y );
GetScrollPixelsPerUnit( &ppux, &ppuy ); GetScrollPixelsPerUnit( &ppux, &ppuy );
GetClientSize( &csizeX, &csizeY );
GetVirtualSize( &unitsX, &unitsY ); GetVirtualSize( &unitsX, &unitsY );
maxX = unitsX;
maxY = unitsY; csizeX /= ppux;
csizeY /= ppuy;
unitsX /= ppux; unitsX /= ppux;
unitsY /= ppuy; unitsY /= ppuy;
maxX = unitsX - csizeX;
maxY = unitsY - csizeY;
dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL dir = event.GetOrientation(); // wxHORIZONTAL or wxVERTICAL
if( id == wxEVT_SCROLLWIN_LINEUP ) if( id == wxEVT_SCROLLWIN_LINEUP )
...@@ -381,7 +399,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event ) ...@@ -381,7 +399,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ), wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ),
ppux, ppuy, unitsX, unitsY, x, y ); ppux, ppuy, unitsX, unitsY, x, y );
Scroll( x/ppux, y/ppuy ); Scroll( x, y );
event.Skip(); event.Skip();
} }
...@@ -958,8 +976,104 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -958,8 +976,104 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
ignoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
} }
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) if( event.ButtonDown( wxMOUSE_BTN_MIDDLE ) && m_enableMiddleButtonPan )
&& (screen->m_BlockLocate.GetState() == STATE_NO_BLOCK) ) {
if( m_panScrollbarLimits )
{
int ppux, ppuy;
GetScrollPixelsPerUnit( &ppux, &ppuy );
GetViewStart( &m_PanStartCenter.x, &m_PanStartCenter.y );
m_PanStartCenter.x *= ppux;
m_PanStartCenter.y *= ppuy;
}
else
m_PanStartCenter = GetParent()->GetScreen()->GetScrollCenterPosition();
m_PanStartEventPosition = event.GetPosition();
INSTALL_UNBUFFERED_DC( dc, this );
CrossHairOff( &dc );
}
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) && m_enableMiddleButtonPan )
{
INSTALL_UNBUFFERED_DC( dc, this );
CrossHairOn( &dc );
}
if( event.MiddleIsDown() && m_enableMiddleButtonPan )
{
wxPoint currentPosition = event.GetPosition();
if( m_panScrollbarLimits )
{
int x, y;
int ppux, ppuy;
int maxX, maxY;
int vsizeX, vsizeY;
int csizeX, csizeY;
GetScrollPixelsPerUnit( &ppux, &ppuy );
GetVirtualSize( &vsizeX, &vsizeY );
GetClientSize( &csizeX, &csizeY );
maxX = vsizeX - csizeX;
maxY = vsizeY - csizeY;
x = m_PanStartCenter.x + m_PanStartEventPosition.x - currentPosition.x;
y = m_PanStartCenter.y + m_PanStartEventPosition.y - currentPosition.y;
bool shouldMoveCursor = false;
if( x < 0 )
{
currentPosition.x += x;
x = 0;
shouldMoveCursor = true;
}
if( y < 0 )
{
currentPosition.y += y;
y = 0;
shouldMoveCursor = true;
}
if( x > maxX )
{
currentPosition.x += ( x - maxX );
x = maxX;
shouldMoveCursor = true;
}
if( y > maxY )
{
currentPosition.y += ( y - maxY );
y = maxY;
shouldMoveCursor = true;
}
if ( shouldMoveCursor )
WarpPointer( currentPosition.x, currentPosition.y );
Scroll( x/ppux, y/ppuy );
Refresh();
Update();
}
else
{
double scale = GetParent()->GetScreen()->GetScalingFactor();
int x = m_PanStartCenter.x +
wxRound( (double) ( m_PanStartEventPosition.x - currentPosition.x ) / scale );
int y = m_PanStartCenter.y +
wxRound( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );
GetParent()->RedrawScreen( wxPoint( x, y ), false );
}
}
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) && !m_enableMiddleButtonPan &&
(screen->m_BlockLocate.GetState() == STATE_NO_BLOCK) )
{ {
// The middle button has been released, with no block command: // The middle button has been released, with no block command:
// We use it for a zoom center at cursor position command // We use it for a zoom center at cursor position command
...@@ -1010,7 +1124,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1010,7 +1124,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
screen->m_BlockLocate.SetOrigin( m_CursorStartPos ); screen->m_BlockLocate.SetOrigin( m_CursorStartPos );
} }
if( event.LeftDown() || event.MiddleDown() ) if( event.LeftDown() || ( !m_enableMiddleButtonPan && event.MiddleDown() ) )
{ {
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
{ {
...@@ -1020,7 +1134,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1020,7 +1134,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
} }
} }
else if( ( m_canStartBlock >= 0 ) else if( ( m_canStartBlock >= 0 )
&& ( event.LeftIsDown() || event.MiddleIsDown() ) && ( event.LeftIsDown() || ( !m_enableMiddleButtonPan && event.MiddleIsDown() ) )
&& !IsMouseCaptured() ) && !IsMouseCaptured() )
{ {
// Mouse is dragging: if no block in progress, start a block command. // Mouse is dragging: if no block in progress, start a block command.
...@@ -1029,7 +1143,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1029,7 +1143,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// Start a block command // Start a block command
int cmd_type = kbstat; int cmd_type = kbstat;
if( event.MiddleIsDown() ) if( !m_enableMiddleButtonPan && event.MiddleIsDown() )
cmd_type |= MOUSE_MIDDLE; cmd_type |= MOUSE_MIDDLE;
/* A block command is started if the drag is enough. A small /* A block command is started if the drag is enough. A small
...@@ -1055,7 +1169,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1055,7 +1169,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
} }
} }
if( event.ButtonUp( wxMOUSE_BTN_LEFT ) || event.ButtonUp( wxMOUSE_BTN_MIDDLE ) ) if( event.ButtonUp( wxMOUSE_BTN_LEFT ) ||
( !m_enableMiddleButtonPan && event.ButtonUp( wxMOUSE_BTN_MIDDLE ) ) )
{ {
/* Release the mouse button: end of block. /* Release the mouse button: end of block.
* The command can finish (DELETE) or have a next command (MOVE, * The command can finish (DELETE) or have a next command (MOVE,
......
...@@ -54,6 +54,9 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog() ...@@ -54,6 +54,9 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::initDialog()
m_TextDisplayOption->SetSelection( m_Parent->m_DisplayModText ); m_TextDisplayOption->SetSelection( m_Parent->m_DisplayModText );
m_IsShowPadFill->SetValue( m_Parent->m_DisplayPadFill ); m_IsShowPadFill->SetValue( m_Parent->m_DisplayPadFill );
m_IsShowPadNum->SetValue( m_Parent->m_DisplayPadNum ); m_IsShowPadNum->SetValue( m_Parent->m_DisplayPadNum );
m_IsMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() );
m_IsMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() );
m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() );
} }
...@@ -68,6 +71,8 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void ) ...@@ -68,6 +71,8 @@ void DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::UpdateObjectSettings( void )
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection(); m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue(); m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue(); m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_IsMiddleButtonPan->GetValue() );
m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_IsMiddleButtonPanLimited->GetValue() );
m_Parent->GetCanvas()->Refresh(); m_Parent->GetCanvas()->Refresh();
} }
......
//////////////////////////////////////////// /**
// Name: dialog_display_options.h * @file dialog_display_options.h
// Licence: GPL */
////////////////////////////////////////////
#ifndef _DIALOG_DISPLAY_OPTIONS_H_ #ifndef _DIALOG_DISPLAY_OPTIONS_H_
#define _DIALOG_DISPLAY_OPTIONS_H_ #define _DIALOG_DISPLAY_OPTIONS_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_display_options_base.h> #include <dialog_display_options_base.h>
//////////////////////////////////////////// /* Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS
/// Class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS * derived from DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE,
// derived from DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE, * created by wxformBuilder
// created by wxformBuilder */
////////////////////////////////////////////
class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS : class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS :
public DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE public DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE
...@@ -28,9 +49,13 @@ public: ...@@ -28,9 +49,13 @@ public:
private: private:
void initDialog( ); void initDialog( );
void UpdateObjectSettings( void ); void UpdateObjectSettings( void );
virtual void OnApplyClick( wxCommandEvent& event ); void OnApplyClick( wxCommandEvent& event );
virtual void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
virtual void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnMiddleBtnPanEnbl( wxCommandEvent& event )
{
m_IsMiddleButtonPanLimited->Enable( m_IsMiddleButtonPan->GetValue() );
}
}; };
#endif // _DIALOG_DISPLAY_OPTIONS_H_ #endif // _DIALOG_DISPLAY_OPTIONS_H_
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -19,30 +19,54 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( ...@@ -19,30 +19,54 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
wxBoxSizer* bUpperSizer; wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
wxString m_EdgesDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; wxString m_EdgesDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") };
int m_EdgesDisplayOptionNChoices = sizeof( m_EdgesDisplayOptionChoices ) / sizeof( wxString ); int m_EdgesDisplayOptionNChoices = sizeof( m_EdgesDisplayOptionChoices ) / sizeof( wxString );
m_EdgesDisplayOption = new wxRadioBox( this, ID_EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionNChoices, m_EdgesDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); m_EdgesDisplayOption = new wxRadioBox( this, ID_EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionNChoices, m_EdgesDisplayOptionChoices, 1, wxRA_SPECIFY_COLS );
m_EdgesDisplayOption->SetSelection( 0 ); m_EdgesDisplayOption->SetSelection( 0 );
bUpperSizer->Add( m_EdgesDisplayOption, 1, wxALL|wxEXPAND, 5 ); bSizerLeft->Add( m_EdgesDisplayOption, 1, wxALL|wxEXPAND, 5 );
wxString m_TextDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") }; wxString m_TextDisplayOptionChoices[] = { _("Line"), _("Filled"), _("Sketch") };
int m_TextDisplayOptionNChoices = sizeof( m_TextDisplayOptionChoices ) / sizeof( wxString ); int m_TextDisplayOptionNChoices = sizeof( m_TextDisplayOptionChoices ) / sizeof( wxString );
m_TextDisplayOption = new wxRadioBox( this, ID_TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionNChoices, m_TextDisplayOptionChoices, 1, wxRA_SPECIFY_COLS ); m_TextDisplayOption = new wxRadioBox( this, ID_TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionNChoices, m_TextDisplayOptionChoices, 1, wxRA_SPECIFY_COLS );
m_TextDisplayOption->SetSelection( 0 ); m_TextDisplayOption->SetSelection( 0 );
bUpperSizer->Add( m_TextDisplayOption, 1, wxALL|wxEXPAND, 5 ); bSizerLeft->Add( m_TextDisplayOption, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pads:") ), wxVERTICAL );
m_IsShowPadFill = new wxCheckBox( this, ID_PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, 0 ); bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerPads;
sbSizerPads = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pads:") ), wxVERTICAL );
sbSizer1->Add( m_IsShowPadFill, 0, wxALL|wxEXPAND, 5 ); m_IsShowPadFill = new wxCheckBox( this, ID_PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPads->Add( m_IsShowPadFill, 0, wxALL|wxEXPAND, 5 );
m_IsShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 ); m_IsShowPadNum = new wxCheckBox( this, wxID_ANY, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerPads->Add( m_IsShowPadNum, 0, wxALL|wxEXPAND, 5 );
bSizerRight->Add( sbSizerPads, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerViewOpt;
sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("View:") ), wxVERTICAL );
sbSizer1->Add( m_IsShowPadNum, 0, wxALL|wxEXPAND, 5 ); m_IsMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerViewOpt->Add( m_IsMiddleButtonPan, 0, wxALL|wxEXPAND, 5 );
m_IsMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Limited"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerViewOpt->Add( m_IsMiddleButtonPanLimited, 0, wxALL, 5 );
bSizerRight->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( bSizerRight, 1, wxEXPAND, 5 );
bUpperSizer->Add( sbSizer1, 1, wxEXPAND|wxALL, 5 );
bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 );
...@@ -57,12 +81,15 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( ...@@ -57,12 +81,15 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); bSizerMain->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
// Connect Events // Connect Events
m_IsMiddleButtonPan->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this );
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this );
...@@ -71,7 +98,9 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( ...@@ -71,7 +98,9 @@ DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE() DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE()
{ {
// Disconnect Events // Disconnect Events
m_IsMiddleButtonPan->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnMiddleBtnPanEnbl ), NULL, this );
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE::OnOkClick ), NULL, this );
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_display_options_base__ #ifndef __DIALOG_DISPLAY_OPTIONS_BASE_H__
#define __dialog_display_options_base__ #define __DIALOG_DISPLAY_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
...@@ -41,6 +42,8 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public wxDialog ...@@ -41,6 +42,8 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public wxDialog
wxRadioBox* m_TextDisplayOption; wxRadioBox* m_TextDisplayOption;
wxCheckBox* m_IsShowPadFill; wxCheckBox* m_IsShowPadFill;
wxCheckBox* m_IsShowPadNum; wxCheckBox* m_IsShowPadNum;
wxCheckBox* m_IsMiddleButtonPan;
wxCheckBox* m_IsMiddleButtonPanLimited;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
...@@ -48,15 +51,17 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public wxDialog ...@@ -48,15 +51,17 @@ class DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnApplyClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 331,164 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 362,251 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE(); ~DIALOG_FOOTPRINTS_DISPLAY_OPTIONS_BASE();
}; };
#endif //__dialog_display_options_base__ #endif //__DIALOG_DISPLAY_OPTIONS_BASE_H__
...@@ -96,6 +96,26 @@ public: ...@@ -96,6 +96,26 @@ public:
return m_checkShowHiddenPins->GetValue(); return m_checkShowHiddenPins->GetValue();
} }
void SetEnableMiddleButtonPan( bool enable )
{
m_checkEnableMiddleButtonPan->SetValue( enable );
m_checkMiddleButtonPanLimited->Enable( enable );
}
bool GetEnableMiddleButtonPan( void )
{
return m_checkEnableMiddleButtonPan->GetValue();
}
void SetMiddleButtonPanLimited( bool enable )
{
m_checkMiddleButtonPanLimited->SetValue( enable );
}
bool GetMiddleButtonPanLimited( void )
{
return m_checkEnableMiddleButtonPan->GetValue();
}
void SetEnableAutoPan( bool enable ) void SetEnableAutoPan( bool enable )
{ {
m_checkAutoPan->SetValue( enable ); m_checkAutoPan->SetValue( enable );
...@@ -126,6 +146,12 @@ public: ...@@ -126,6 +146,12 @@ public:
/** Get the field \a aNdx name from the fields textctrl */ /** Get the field \a aNdx name from the fields textctrl */
wxString GetFieldName( int aNdx ); wxString GetFieldName( int aNdx );
private:
void OnMiddleBtnPanEnbl( wxCommandEvent& event )
{
m_checkMiddleButtonPanLimited->Enable( GetEnableMiddleButtonPan() );
}
}; };
#endif // __dialog_eeschema_options__ #endif // __dialog_eeschema_options__
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, wxDialog ) BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, wxDialog )
EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits ) EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits )
EVT_CHECKBOX( xwID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnMiddleBtnPanEnbl )
END_EVENT_TABLE() END_EVENT_TABLE()
DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
...@@ -131,6 +132,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -131,6 +132,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText23->Wrap( -1 ); m_staticText23->Wrap( -1 );
fgSizer1->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer1->Add( m_staticText23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 ); bSizer3->Add( fgSizer1, 0, wxALIGN_CENTER|wxEXPAND, 0 );
wxBoxSizer* bSizer2; wxBoxSizer* bSizer2;
...@@ -142,6 +144,12 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -142,6 +144,12 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_checkShowHiddenPins = new wxCheckBox( m_panel1, wxID_ANY, _("Show hi&dden pins"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowHiddenPins = new wxCheckBox( m_panel1, wxID_ANY, _("Show hi&dden pins"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 ); bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 );
m_checkEnableMiddleButtonPan = new wxCheckBox( m_panel1, xwID_ANY, _("Enable middle mouse button panning"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkEnableMiddleButtonPan, 0, wxALL, 3 );
m_checkMiddleButtonPanLimited = new wxCheckBox( m_panel1, wxID_ANY, _("Middle mouse button panning limited by current toolbar panning"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkMiddleButtonPanLimited, 0, wxALL, 3 );
m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkAutoPan, 0, wxALL|wxEXPAND, 3 ); bSizer2->Add( m_checkAutoPan, 0, wxALL|wxEXPAND, 3 );
...@@ -151,13 +159,16 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -151,13 +159,16 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_checkPageLimits = new wxCheckBox( m_panel1, wxID_ANY, _("Show p&age limits"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkPageLimits = new wxCheckBox( m_panel1, wxID_ANY, _("Show p&age limits"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_checkPageLimits, 0, wxALL|wxEXPAND, 3 ); bSizer2->Add( m_checkPageLimits, 0, wxALL|wxEXPAND, 3 );
bSizer3->Add( bSizer2, 0, wxEXPAND, 0 ); bSizer3->Add( bSizer2, 0, wxEXPAND, 0 );
bSizer3->Add( 0, 0, 1, wxALL|wxEXPAND, 10 ); bSizer3->Add( 0, 0, 1, wxALL|wxEXPAND, 10 );
p1mainSizer->Add( bSizer3, 1, wxALL|wxEXPAND, 12 ); p1mainSizer->Add( bSizer3, 1, wxALL|wxEXPAND, 12 );
m_panel1->SetSizer( p1mainSizer ); m_panel1->SetSizer( p1mainSizer );
m_panel1->Layout(); m_panel1->Layout();
p1mainSizer->Fit( m_panel1 ); p1mainSizer->Fit( m_panel1 );
...@@ -175,6 +186,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -175,6 +186,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_staticText211->Wrap( 400 ); m_staticText211->Wrap( 400 );
bSizer8->Add( m_staticText211, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); bSizer8->Add( m_staticText211, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
bSizer6->Add( bSizer8, 0, wxEXPAND, 5 ); bSizer6->Add( bSizer8, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer7; wxBoxSizer* bSizer7;
...@@ -242,10 +254,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -242,10 +254,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_fieldName8 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_fieldName8 = new wxTextCtrl( m_panel2, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_fieldName8, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 ); fgSizer2->Add( m_fieldName8, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3 );
bSizer7->Add( fgSizer2, 1, wxALIGN_CENTER|wxEXPAND, 5 ); bSizer7->Add( fgSizer2, 1, wxALIGN_CENTER|wxEXPAND, 5 );
bSizer6->Add( bSizer7, 1, wxALL|wxEXPAND, 12 ); bSizer6->Add( bSizer7, 1, wxALL|wxEXPAND, 12 );
m_panel2->SetSizer( bSizer6 ); m_panel2->SetSizer( bSizer6 );
m_panel2->Layout(); m_panel2->Layout();
bSizer6->Fit( m_panel2 ); bSizer6->Fit( m_panel2 );
...@@ -259,10 +274,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -259,10 +274,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
bOptionsSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); bOptionsSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
mainSizer->Add( bOptionsSizer, 1, 0, 12 ); mainSizer->Add( bOptionsSizer, 1, 0, 12 );
this->SetSizer( mainSizer ); this->SetSizer( mainSizer );
this->Layout(); this->Layout();
mainSizer->Fit( this ); mainSizer->Fit( this );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_eeschema_options_base__ #ifndef __DIALOG_EESCHEMA_OPTIONS_BASE_H__
#define __dialog_eeschema_options_base__ #define __DIALOG_EESCHEMA_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -41,19 +42,20 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog ...@@ -41,19 +42,20 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
// Private event handlers // Private event handlers
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); }
void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); }
protected: protected:
enum enum
{ {
ID_M_SPINAUTOSAVEINTERVAL = 1000, ID_M_SPINAUTOSAVEINTERVAL = 1000,
xwID_ANY
}; };
wxNotebook* m_notebook1; wxNotebook* m_notebook1;
wxPanel* m_panel1; wxPanel* m_panel1;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxChoice* m_choiceUnits; wxChoice* m_choiceUnits;
wxStaticText* m_staticText3; wxStaticText* m_staticText3;
wxChoice* m_choiceGridSize; wxChoice* m_choiceGridSize;
wxStaticText* m_staticGridUnits; wxStaticText* m_staticGridUnits;
...@@ -71,16 +73,16 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog ...@@ -71,16 +73,16 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
wxStaticText* m_staticRepeatYUnits; wxStaticText* m_staticRepeatYUnits;
wxStaticText* m_staticText16; wxStaticText* m_staticText16;
wxSpinCtrl* m_spinRepeatLabel; wxSpinCtrl* m_spinRepeatLabel;
wxStaticText* m_staticText221; wxStaticText* m_staticText221;
wxSpinCtrl* m_spinAutoSaveInterval; wxSpinCtrl* m_spinAutoSaveInterval;
wxStaticText* m_staticText23; wxStaticText* m_staticText23;
wxCheckBox* m_checkShowGrid; wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowHiddenPins; wxCheckBox* m_checkShowHiddenPins;
wxCheckBox* m_checkEnableMiddleButtonPan;
wxCheckBox* m_checkMiddleButtonPanLimited;
wxCheckBox* m_checkAutoPan; wxCheckBox* m_checkAutoPan;
wxCheckBox* m_checkHVOrientation; wxCheckBox* m_checkHVOrientation;
wxCheckBox* m_checkPageLimits; wxCheckBox* m_checkPageLimits;
wxPanel* m_panel2; wxPanel* m_panel2;
wxStaticText* m_staticText211; wxStaticText* m_staticText211;
wxStaticText* m_staticText15; wxStaticText* m_staticText15;
...@@ -105,6 +107,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog ...@@ -105,6 +107,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
public: public:
...@@ -114,4 +117,4 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog ...@@ -114,4 +117,4 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public wxDialog
}; };
#endif //__dialog_eeschema_options_base__ #endif //__DIALOG_EESCHEMA_OPTIONS_BASE_H__
...@@ -215,6 +215,8 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -215,6 +215,8 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 ); dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 );
dlg.SetShowGrid( IsGridVisible() ); dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_showAllPins ); dlg.SetShowHiddenPins( m_showAllPins );
dlg.SetEnableMiddleButtonPan( m_canvas->GetEnableMiddleButtonPan() );
dlg.SetMiddleButtonPanLimited( m_canvas->GetMiddleButtonPanLimited() );
dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() ); dlg.SetEnableAutoPan( m_canvas->GetEnableAutoPan() );
dlg.SetEnableHVBusOrientation( g_HVLines ); dlg.SetEnableHVBusOrientation( g_HVLines );
dlg.SetShowPageLimits( g_ShowPageLimits ); dlg.SetShowPageLimits( g_ShowPageLimits );
...@@ -246,6 +248,8 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -246,6 +248,8 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 ); SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
SetGridVisibility( dlg.GetShowGrid() ); SetGridVisibility( dlg.GetShowGrid() );
m_showAllPins = dlg.GetShowHiddenPins(); m_showAllPins = dlg.GetShowHiddenPins();
m_canvas->SetEnableMiddleButtonPan( dlg.GetEnableMiddleButtonPan() );
m_canvas->SetMiddleButtonPanLimited( dlg.GetMiddleButtonPanLimited() );
m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() ); m_canvas->SetEnableAutoPan( dlg.GetEnableAutoPan() );
g_HVLines = dlg.GetEnableHVBusOrientation(); g_HVLines = dlg.GetEnableHVBusOrientation();
g_ShowPageLimits = dlg.GetShowPageLimits(); g_ShowPageLimits = dlg.GetShowPageLimits();
......
...@@ -31,6 +31,10 @@ private: ...@@ -31,6 +31,10 @@ private:
void OnOKBUttonClick( wxCommandEvent& event ); void OnOKBUttonClick( wxCommandEvent& event );
void OnCancelButtonClick( wxCommandEvent& event ); void OnCancelButtonClick( wxCommandEvent& event );
void initOptDialog( ); void initOptDialog( );
void OnMiddleBtnPanEnbl( wxCommandEvent& event )
{
m_OptMiddleButtonPanLimited->Enable( m_OptMiddleButtonPan->GetValue() );
}
}; };
...@@ -93,6 +97,10 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( ) ...@@ -93,6 +97,10 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
} }
m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) ); m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
m_OptMiddleButtonPan->SetValue( m_Parent->GetCanvas()->GetEnableMiddleButtonPan() );
m_OptMiddleButtonPanLimited->SetValue( m_Parent->GetCanvas()->GetMiddleButtonPanLimited() );
m_OptMiddleButtonPanLimited->Enable( m_OptMiddleButtonPan->GetValue() );
} }
...@@ -138,6 +146,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) ...@@ -138,6 +146,11 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
m_Parent->SetPageSettings( pageInfo ); m_Parent->SetPageSettings( pageInfo );
m_Parent->GetCanvas()->SetEnableMiddleButtonPan( m_OptMiddleButtonPan->GetValue() );
m_Parent->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() );
m_Parent->GetCanvas()->Refresh();
EndModal( 1 ); EndModal( 1 );
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -40,6 +40,11 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -40,6 +40,11 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
m_CursorShape->SetSelection( 1 ); m_CursorShape->SetSelection( 1 );
bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 ); 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);
bLeftSizer->Add( m_OptDisplayDCodes, 0, wxALL, 5 );
bUpperSizer->Add( bLeftSizer, 0, wxEXPAND, 5 ); bUpperSizer->Add( bLeftSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bMiddleSizer; wxBoxSizer* bMiddleSizer;
...@@ -63,6 +68,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -63,6 +68,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
m_OptDisplayPolygons->SetSelection( 1 ); m_OptDisplayPolygons->SetSelection( 1 );
bMiddleSizer->Add( m_OptDisplayPolygons, 0, wxALL|wxEXPAND, 5 ); bMiddleSizer->Add( m_OptDisplayPolygons, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( bMiddleSizer, 0, wxEXPAND, 5 ); bUpperSizer->Add( bMiddleSizer, 0, wxEXPAND, 5 );
...@@ -77,15 +83,22 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -77,15 +83,22 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
m_ShowPageLimits->SetSelection( 0 ); m_ShowPageLimits->SetSelection( 0 );
bRightSizer->Add( m_ShowPageLimits, 0, wxALL|wxEXPAND, 5 ); bRightSizer->Add( m_ShowPageLimits, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* bLeftBottomSizer;
bLeftBottomSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL );
bRightSizer->Add( 20, 20, 0, 0, 5 ); m_OptMiddleButtonPan = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptMiddleButtonPan, 0, wxALL, 5 );
m_OptMiddleButtonPanLimited = new wxCheckBox( this, wxID_ANY, _("Middle Button PAN Limited"), wxDefaultPosition, wxDefaultSize, 0 );
bLeftBottomSizer->Add( m_OptMiddleButtonPanLimited, 0, wxALL, 5 );
bRightSizer->Add( bLeftBottomSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_OptDisplayDCodes = new wxCheckBox( this, wxID_ANY, _("Show D codes"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptDisplayDCodes->SetValue(true);
bRightSizer->Add( m_OptDisplayDCodes, 0, wxALL, 5 );
bUpperSizer->Add( bRightSizer, 1, wxEXPAND, 5 ); bUpperSizer->Add( bRightSizer, 1, wxEXPAND, 5 );
bDialogSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); bDialogSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
...@@ -97,12 +110,15 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -97,12 +110,15 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize(); m_sdbSizer1->Realize();
bDialogSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); bDialogSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bDialogSizer ); this->SetSizer( bDialogSizer );
this->Layout(); this->Layout();
// Connect Events // 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 ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this );
} }
...@@ -110,6 +126,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -110,6 +126,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE() DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE()
{ {
// Disconnect Events // Disconnect Events
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_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 ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __gerbview_dialog_display_options_frame_base__ #ifndef __GERBVIEW_DIALOG_DISPLAY_OPTIONS_FRAME_BASE_H__
#define __gerbview_dialog_display_options_frame_base__ #define __GERBVIEW_DIALOG_DISPLAY_OPTIONS_FRAME_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -36,28 +38,29 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public wxDialog ...@@ -36,28 +38,29 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public wxDialog
wxRadioBox* m_PolarDisplay; wxRadioBox* m_PolarDisplay;
wxRadioBox* m_BoxUnits; wxRadioBox* m_BoxUnits;
wxRadioBox* m_CursorShape; wxRadioBox* m_CursorShape;
wxCheckBox* m_OptDisplayDCodes;
wxRadioBox* m_OptDisplayLines; wxRadioBox* m_OptDisplayLines;
wxRadioBox* m_OptDisplayFlashedItems; wxRadioBox* m_OptDisplayFlashedItems;
wxRadioBox* m_OptDisplayPolygons; wxRadioBox* m_OptDisplayPolygons;
wxRadioBox* m_ShowPageLimits; wxRadioBox* m_ShowPageLimits;
wxCheckBox* m_OptMiddleButtonPan;
wxCheckBox* m_OptDisplayDCodes; wxCheckBox* m_OptMiddleButtonPanLimited;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // 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 OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKBUttonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKBUttonClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Gerbview Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 446,299 ), 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( 446,330 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DISPLAY_OPTIONS_BASE(); ~DIALOG_DISPLAY_OPTIONS_BASE();
}; };
#endif //__gerbview_dialog_display_options_frame_base__ #endif //__GERBVIEW_DIALOG_DISPLAY_OPTIONS_FRAME_BASE_H__
...@@ -61,6 +61,8 @@ private: ...@@ -61,6 +61,8 @@ private:
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit. int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit. int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
wxPoint m_CursorStartPos; ///< Used for testing the cursor movement. wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
/// The drawing area used to redraw the screen which is usually the visible area /// The drawing area used to redraw the screen which is usually the visible area
/// of the drawing in internal units. /// of the drawing in internal units.
...@@ -68,6 +70,11 @@ private: ...@@ -68,6 +70,11 @@ private:
bool m_abortRequest; ///< Flag used to abort long commands. bool m_abortRequest; ///< Flag used to abort long commands.
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
///< false to used unlimited pan
bool m_enableAutoPan; ///< True to enable automatic panning. bool m_enableAutoPan; ///< True to enable automatic panning.
/// true to request an auto pan. Valid only when m_enableAutoPan = true. /// true to request an auto pan. Valid only when m_enableAutoPan = true.
...@@ -110,6 +117,14 @@ public: ...@@ -110,6 +117,14 @@ public:
void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; } void SetAbortRequest( bool aAbortRequest ) { m_abortRequest = aAbortRequest; }
bool GetEnableMiddleButtonPan() const { return m_enableMiddleButtonPan; }
void SetEnableMiddleButtonPan( bool aEnable ) { m_enableMiddleButtonPan = aEnable; }
bool GetMiddleButtonPanLimited() const { return m_panScrollbarLimits; }
void SetMiddleButtonPanLimited( bool aEnable ) { m_panScrollbarLimits = aEnable; }
bool GetEnableAutoPan() const { return m_enableAutoPan; } bool GetEnableAutoPan() const { return m_enableAutoPan; }
void SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; } void SetEnableAutoPan( bool aEnable ) { m_enableAutoPan = aEnable; }
......
...@@ -44,20 +44,20 @@ ...@@ -44,20 +44,20 @@
#include <dialog_general_options.h> #include <dialog_general_options.h>
Dialog_GeneralOptions::Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ) : DIALOG_GENERALOPTIONS::DIALOG_GENERALOPTIONS( PCB_EDIT_FRAME* parent ) :
DialogGeneralOptionsBoardEditor_base( parent ) DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( parent )
{ {
init(); init();
m_buttonOK->SetDefault();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Center(); Center();
} }
void Dialog_GeneralOptions::init() void DIALOG_GENERALOPTIONS::init()
{ {
SetFocus(); SetFocus();
m_sdbSizerOK->SetDefault();
m_Board = GetParent()->GetBoard(); m_Board = GetParent()->GetBoard();
...@@ -88,6 +88,9 @@ void Dialog_GeneralOptions::init() ...@@ -88,6 +88,9 @@ void Dialog_GeneralOptions::init()
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_MiddleButtonPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMiddleButtonPan() );
m_OptMiddleButtonPanLimited->SetValue( GetParent()->GetCanvas()->GetMiddleButtonPanLimited() );
m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() );
m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() ); m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild );
...@@ -97,13 +100,13 @@ void Dialog_GeneralOptions::init() ...@@ -97,13 +100,13 @@ void Dialog_GeneralOptions::init()
} }
void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event ) void DIALOG_GENERALOPTIONS::OnCancelClick( wxCommandEvent& event )
{ {
event.Skip(); event.Skip();
} }
void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event )
{ {
EDA_UNITS_T ii; EDA_UNITS_T ii;
...@@ -133,6 +136,10 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -133,6 +136,10 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue();
GetParent()->GetCanvas()->SetEnableMiddleButtonPan( m_MiddleButtonPANOpt->GetValue() );
GetParent()->GetCanvas()->SetMiddleButtonPanLimited( m_OptMiddleButtonPanLimited->GetValue() );
GetParent()->GetCanvas()->SetEnableAutoPan( m_AutoPANOpt->GetValue() ); GetParent()->GetCanvas()->SetEnableAutoPan( m_AutoPANOpt->GetValue() );
g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue();
g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection(); g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <dialog_general_options_BoardEditor_base.h> #include <dialog_general_options_BoardEditor_base.h>
class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base class DIALOG_GENERALOPTIONS : public DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE
{ {
private: private:
BOARD* m_Board; BOARD* m_Board;
...@@ -11,12 +11,18 @@ private: ...@@ -11,12 +11,18 @@ private:
void init(); void init();
public: public:
Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ); DIALOG_GENERALOPTIONS( PCB_EDIT_FRAME* parent );
~Dialog_GeneralOptions() {}; ~DIALOG_GENERALOPTIONS() {};
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
PCB_EDIT_FRAME* GetParent() { return (PCB_EDIT_FRAME*) wxDialog::GetParent(); } PCB_EDIT_FRAME* GetParent() { return (PCB_EDIT_FRAME*) wxDialog::GetParent(); }
private:
void OnMiddleBtnPanEnbl( wxCommandEvent& event )
{
m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() );
}
}; };
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,12 +9,15 @@ ...@@ -9,12 +9,15 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL ); bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer; wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL ); bLeftSizer = new wxBoxSizer( wxVERTICAL );
...@@ -43,7 +46,8 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi ...@@ -43,7 +46,8 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi
bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 ); bLeftSizer->Add( m_CursorShape, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
bSizerUpper->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bMiddleLeftSizer; wxBoxSizer* bMiddleLeftSizer;
bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL ); bMiddleLeftSizer = new wxBoxSizer( wxVERTICAL );
...@@ -78,7 +82,8 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi ...@@ -78,7 +82,8 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi
bMiddleLeftSizer->Add( m_RotationAngle, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); bMiddleLeftSizer->Add( m_RotationAngle, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bMainSizer->Add( bMiddleLeftSizer, 1, wxEXPAND, 5 );
bSizerUpper->Add( bMiddleLeftSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* bMiddleRightBoxSizer; wxStaticBoxSizer* bMiddleRightBoxSizer;
bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); bMiddleRightBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
...@@ -114,17 +119,13 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi ...@@ -114,17 +119,13 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi
bMiddleRightBoxSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 ); bMiddleRightBoxSizer->Add( m_Segments_45_Only_Ctrl, 0, wxALL, 5 );
m_AutoPANOpt = new wxCheckBox( this, wxID_AUTOPAN, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, 0 );
m_AutoPANOpt->SetToolTip( _("Allows auto pan when creating a track, or moving an item.") );
bMiddleRightBoxSizer->Add( m_AutoPANOpt, 0, wxALL, 5 );
m_Track_DoubleSegm_Ctrl = new wxCheckBox( this, wxID_ANY, _("Double Segm Track"), wxDefaultPosition, wxDefaultSize, 0 ); m_Track_DoubleSegm_Ctrl = new wxCheckBox( this, wxID_ANY, _("Double Segm Track"), 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 ") ); 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 ); bMiddleRightBoxSizer->Add( m_Track_DoubleSegm_Ctrl, 0, wxALL, 5 );
bMainSizer->Add( bMiddleRightBoxSizer, 1, 0, 5 );
bSizerUpper->Add( bMiddleRightBoxSizer, 1, 0, 5 );
wxBoxSizer* bRightSizer; wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL ); bRightSizer = new wxBoxSizer( wxVERTICAL );
...@@ -145,27 +146,60 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi ...@@ -145,27 +146,60 @@ DialogGeneralOptionsBoardEditor_base::DialogGeneralOptionsBoardEditor_base( wxWi
bRightSizer->Add( m_MagneticTrackOptCtrl, 0, wxALL|wxEXPAND, 5 ); bRightSizer->Add( m_MagneticTrackOptCtrl, 0, wxALL|wxEXPAND, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); wxStaticBoxSizer* sbSizer2PAN;
m_buttonOK->SetDefault(); sbSizer2PAN = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pan:") ), wxVERTICAL );
bRightSizer->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_MiddleButtonPANOpt = new wxCheckBox( this, wxID_MIDDLEBUTTONPAN, _("Middle Button PAN Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
m_MiddleButtonPANOpt->SetToolTip( _("Allows auto pan when creating a track, or moving an item.") );
sbSizer2PAN->Add( m_MiddleButtonPANOpt, 0, wxALL, 5 );
m_OptMiddleButtonPanLimited = new wxCheckBox( this, wxID_MIDDLEBUTTONPAN, _("Middle Button PAN Limited"), wxDefaultPosition, wxDefaultSize, 0 );
m_OptMiddleButtonPanLimited->SetToolTip( _("Allows auto pan when creating a track, or moving an item.") );
sbSizer2PAN->Add( m_OptMiddleButtonPanLimited, 0, wxALL, 5 );
m_AutoPANOpt = new wxCheckBox( this, wxID_AUTOPAN, _("Auto PAN"), 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|wxBOTTOM|wxLEFT, 5 );
bSizerUpper->Add( bRightSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 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();
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); bMainSizer->Add( m_sdbSizer, 0, wxEXPAND, 5 );
bRightSizer->Add( m_buttonCANCEL, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
bMainSizer->Add( bRightSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
// Connect Events // Connect Events
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnOkClick ), NULL, this ); m_MiddleButtonPANOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnMiddleBtnPanEnbl ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnCancelClick ), NULL, this ); m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnOkClick ), NULL, this );
} }
DialogGeneralOptionsBoardEditor_base::~DialogGeneralOptionsBoardEditor_base() DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::~DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE()
{ {
// Disconnect Events // Disconnect Events
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnOkClick ), NULL, this ); m_MiddleButtonPANOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE::OnMiddleBtnPanEnbl ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogGeneralOptionsBoardEditor_base::OnCancelClick ), 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 );
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -23,15 +23,16 @@ ...@@ -23,15 +23,16 @@
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DialogGeneralOptionsBoardEditor_base /// Class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DialogGeneralOptionsBoardEditor_base : public wxDialog class DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE : public wxDialog
{ {
private: private:
...@@ -47,8 +48,9 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog ...@@ -47,8 +48,9 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog
wxID_TRACK_AUTODEL, wxID_TRACK_AUTODEL,
wxID_TRACKS45, wxID_TRACKS45,
wxID_SEGMENTS45, wxID_SEGMENTS45,
wxID_AUTOPAN,
wxID_MAGNETIC_TRACKS, wxID_MAGNETIC_TRACKS,
wxID_MIDDLEBUTTONPAN,
wxID_AUTOPAN
}; };
wxRadioBox* m_PolarDisplay; wxRadioBox* m_PolarDisplay;
...@@ -66,22 +68,27 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog ...@@ -66,22 +68,27 @@ class DialogGeneralOptionsBoardEditor_base : public wxDialog
wxCheckBox* m_TrackAutodel; wxCheckBox* m_TrackAutodel;
wxCheckBox* m_Track_45_Only_Ctrl; wxCheckBox* m_Track_45_Only_Ctrl;
wxCheckBox* m_Segments_45_Only_Ctrl; wxCheckBox* m_Segments_45_Only_Ctrl;
wxCheckBox* m_AutoPANOpt;
wxCheckBox* m_Track_DoubleSegm_Ctrl; wxCheckBox* m_Track_DoubleSegm_Ctrl;
wxRadioBox* m_MagneticPadOptCtrl; wxRadioBox* m_MagneticPadOptCtrl;
wxRadioBox* m_MagneticTrackOptCtrl; wxRadioBox* m_MagneticTrackOptCtrl;
wxButton* m_buttonOK; wxCheckBox* m_MiddleButtonPANOpt;
wxButton* m_buttonCANCEL; wxCheckBox* m_OptMiddleButtonPanLimited;
wxCheckBox* m_AutoPANOpt;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DialogGeneralOptionsBoardEditor_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("General settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 585,280 ), 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( 611,346 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogGeneralOptionsBoardEditor_base(); ~DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE();
}; };
......
...@@ -89,7 +89,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -89,7 +89,7 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
case wxID_PREFERENCES: case wxID_PREFERENCES:
{ {
Dialog_GeneralOptions dlg( this ); DIALOG_GENERALOPTIONS dlg( this );
dlg.ShowModal(); dlg.ShowModal();
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment