refinements in dialogs and OSX Cancel button fix. Dialog_pad_properties, pad viewer in GAL mode: better size of the drawing area. The scrollbars are now usable.

This commit is contained in:
jean-pierre charras 2016-07-19 11:16:16 +02:00
commit fd42d76e2f
16 changed files with 89 additions and 43 deletions

View File

@ -42,6 +42,11 @@ DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) :
SetRepeatLabelInc( Parent()->GetRepeatDeltaLabel() ); SetRepeatLabelInc( Parent()->GetRepeatDeltaLabel() );
SetItemRepeatStep( Parent()->GetRepeatStep() ); SetItemRepeatStep( Parent()->GetRepeatStep() );
SetPinRepeatStep( Parent()->GetRepeatPinStep() ); SetPinRepeatStep( Parent()->GetRepeatPinStep() );
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
} }
void DIALOG_LIBEDIT_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id ) void DIALOG_LIBEDIT_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id )

View File

@ -56,9 +56,12 @@ DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
m_Parent = parent; m_Parent = parent;
init(); init();
m_sdbSizerOK->SetDefault(); m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
} }
void DIALOG_DISPLAY_OPTIONS::init() void DIALOG_DISPLAY_OPTIONS::init()

View File

@ -88,6 +88,8 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent
m_OrientValue = 0; m_OrientValue = 0;
Layout(); Layout();
FixOSXCancelButtonIssue();
} }

View File

@ -83,6 +83,8 @@ DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME*
m_sdbSizerStdButtonsOK->SetDefault(); m_sdbSizerStdButtonsOK->SetDefault();
Layout(); Layout();
FixOSXCancelButtonIssue();
} }

View File

@ -27,10 +27,11 @@
DIALOG_ENUM_PADS::DIALOG_ENUM_PADS( wxWindow* aParent ) : DIALOG_ENUM_PADS::DIALOG_ENUM_PADS( wxWindow* aParent ) :
DIALOG_ENUM_PADS_BASE( aParent ) DIALOG_ENUM_PADS_BASE( aParent )
{ {
// Calling SetSizeHints after all widgets are built is mandatory
// to set the correct size of the dialog FixOSXCancelButtonIssue();
GetSizer()->SetSizeHints( this );
Center(); // Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
} }

View File

@ -106,13 +106,12 @@ public:
m_IDF_Yref->Enable( true ); m_IDF_Yref->Enable( true );
} }
wxWindow* button = FindWindowByLabel( wxT( "OK" ) ); m_sdbSizerOK->SetDefault();
if( button ) FixOSXCancelButtonIssue();
SetDefaultItem( button );
GetSizer()->SetSizeHints( this ); // Now all widgets have the size fixed, call FinishDialogSettings
Centre(); FinishDialogSettings();
} }
~DIALOG_EXPORT_IDF3() ~DIALOG_EXPORT_IDF3()

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014) // C++ code generated with wxFormBuilder (version May 6 2016)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -60,7 +60,14 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
bSizer4->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer4->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_IDF_Xref = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_IDF_Xref = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__
if ( !m_IDF_Xref->HasFlag( wxTE_MULTILINE ) )
{
m_IDF_Xref->SetMaxLength( 8 ); m_IDF_Xref->SetMaxLength( 8 );
}
#else
m_IDF_Xref->SetMaxLength( 8 );
#endif
bSizer4->Add( m_IDF_Xref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer4->Add( m_IDF_Xref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@ -74,7 +81,14 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
bSizer5->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer5->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_IDF_Yref = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_IDF_Yref = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
#ifdef __WXGTK__
if ( !m_IDF_Yref->HasFlag( wxTE_MULTILINE ) )
{
m_IDF_Yref->SetMaxLength( 8 ); m_IDF_Yref->SetMaxLength( 8 );
}
#else
m_IDF_Yref->SetMaxLength( 8 );
#endif
bSizer5->Add( m_IDF_Yref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer5->Add( m_IDF_Yref, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@ -98,14 +112,14 @@ DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID i
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerIDFFile->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); bSizerIDFFile->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK ); m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer1->Realize(); m_sdbSizer->Realize();
bSizerIDFFile->Add( m_sdbSizer1, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizerIDFFile->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
this->SetSizer( bSizerIDFFile ); this->SetSizer( bSizerIDFFile );

View File

@ -1205,7 +1205,7 @@
<property name="Save">0</property> <property name="Save">0</property>
<property name="Yes">0</property> <property name="Yes">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property> <property name="name">m_sdbSizer</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<event name="OnApplyButtonClick"></event> <event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event> <event name="OnCancelButtonClick"></event>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014) // C++ code generated with wxFormBuilder (version May 6 2016)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -53,9 +53,9 @@ class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM
wxTextCtrl* m_IDF_Yref; wxTextCtrl* m_IDF_Yref;
wxRadioBox* m_rbUnitSelection; wxRadioBox* m_rbUnitSelection;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizerCancel;
public: public:

View File

@ -86,8 +86,11 @@ public:
tmpStr << m_YRef; tmpStr << m_YRef;
m_VRML_Yref->SetValue( tmpStr ); m_VRML_Yref->SetValue( tmpStr );
m_sdbSizer1OK->SetDefault(); m_sdbSizer1OK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre(); FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
Connect( ID_USE_ABS_PATH, wxEVT_UPDATE_UI, Connect( ID_USE_ABS_PATH, wxEVT_UPDATE_UI,
wxUpdateUIEventHandler( DIALOG_EXPORT_3DFILE::OnUpdateUseRelativePath ) ); wxUpdateUIEventHandler( DIALOG_EXPORT_3DFILE::OnUpdateUseRelativePath ) );

View File

@ -72,6 +72,16 @@ private:
bool TransferDataToWindow(); bool TransferDataToWindow();
bool TransferDataFromWindow(); bool TransferDataFromWindow();
void OnLayerChoice( wxCommandEvent& event ); void OnLayerChoice( wxCommandEvent& event );
void OnInitDlg( wxInitDialogEvent& event )
{
// Call the default wxDialog handler of a wxInitDialogEvent
TransferDataToWindow();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
bool Validate(); bool Validate();
}; };
@ -92,11 +102,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_EDIT_FRAME*
m_StandardButtonsSizerOK->SetDefault(); m_StandardButtonsSizerOK->SetDefault();
Layout();
FixOSXCancelButtonIssue(); FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
} }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 9 2016) // C++ code generated with wxFormBuilder (version May 6 2016)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -159,11 +159,13 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) );
} }
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE() DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) );
} }

View File

@ -67,7 +67,7 @@
<event name="OnHibernate"></event> <event name="OnHibernate"></event>
<event name="OnIconize"></event> <event name="OnIconize"></event>
<event name="OnIdle"></event> <event name="OnIdle"></event>
<event name="OnInitDialog"></event> <event name="OnInitDialog">OnInitDlg</event>
<event name="OnKeyDown"></event> <event name="OnKeyDown"></event>
<event name="OnKeyUp"></event> <event name="OnKeyUp"></event>
<event name="OnKillFocus"></event> <event name="OnKillFocus"></event>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 9 2016) // C++ code generated with wxFormBuilder (version May 6 2016)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -70,6 +70,7 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
public: public:

View File

@ -121,13 +121,12 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
else // We are editing a "master" pad, i.e. a template to create new pads else // We are editing a "master" pad, i.e. a template to create new pads
m_dummyPad->Copy( m_padMaster ); m_dummyPad->Copy( m_padMaster );
// Show the X and Y axis. It is usefull because pads can have an offset // Show the X and Y axis. It is usefull because pad shape can have an offset
// or a complex shape. Showing the pad reference position is important // or be a complex shape.
m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D(0.0, 0.0, 0.8, 1.0), m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D(0.0, 0.0, 0.8, 1.0),
KIGFX::ORIGIN_VIEWITEM::CROSS, KIGFX::ORIGIN_VIEWITEM::CROSS,
20000, Millimeter2iu( 0.2 ),
VECTOR2D( m_dummyPad->GetPosition().x, VECTOR2D( m_dummyPad->GetPosition() ) );
m_dummyPad->GetPosition().y ) );
m_axisOrigin->SetDrawAtZero( true ); m_axisOrigin->SetDrawAtZero( true );
if( m_parent->IsGalCanvasActive() ) if( m_parent->IsGalCanvasActive() )
@ -151,10 +150,13 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
TransferDataToWindow(); TransferDataToWindow();
m_sdbSizerOK->SetDefault(); m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
m_PadNumCtrl->SetFocus(); m_PadNumCtrl->SetFocus();
m_canUpdate = true; m_canUpdate = true;
FixOSXCancelButtonIssue();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
} }
@ -880,6 +882,12 @@ void DIALOG_PAD_PROPERTIES::redraw()
if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 ) if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
{ {
// gives a size to the full drawable area
BOX2I drawbox;
drawbox.Move( m_dummyPad->GetPosition() );
drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
m_panelShowPadGal->GetView()->SetBoundary( drawbox );
// Autozoom // Autozoom
m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) ); m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );

View File

@ -1,5 +1,5 @@
/** /**
* @file dialog_pad_properties.cpp * @file dialog_pad_properties.h
* @brief dialog pad properties editor. * @brief dialog pad properties editor.
*/ */