Pcbnew: make OK button default item in dimension properties dialog.

This commit is contained in:
Wayne Stambaugh 2015-08-01 17:30:38 -04:00
parent 6a6a55f9bf
commit e9ed3e3e55
4 changed files with 43 additions and 36 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -18,7 +18,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_staticTextDim = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDim = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDim->Wrap( -1 );
bSizerMain->Add( m_staticTextDim, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
@ -34,7 +34,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL );
m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("Size X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("Text Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 );
bSizerLeft->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
@ -42,7 +42,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_TxtSizeXCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_TxtSizeXCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("Size Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY = new wxStaticText( this, wxID_ANY, _("Text Height"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 );
bSizerLeft->Add( m_staticTextSizeY, 0, wxRIGHT|wxLEFT, 5 );
@ -50,7 +50,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_TxtSizeYCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_TxtSizeYCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextWidth = new wxStaticText( this, wxID_ANY, _("Text Thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextWidth->Wrap( -1 );
bSizerLeft->Add( m_staticTextWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
@ -58,7 +58,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_TxtWidthCtrl->SetMaxLength( 0 );
bSizerLeft->Add( m_TxtWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextPosX = new wxStaticText( this, wxID_ANY, _("Text position X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPosX = new wxStaticText( this, wxID_ANY, _("Text Position X"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPosX->Wrap( -1 );
bSizerLeft->Add( m_staticTextPosX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
@ -66,7 +66,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_textCtrlPosX->SetMaxLength( 0 );
bSizerLeft->Add( m_textCtrlPosX, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextPosY = new wxStaticText( this, wxID_ANY, _("Text position Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPosY = new wxStaticText( this, wxID_ANY, _("Text Position Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPosY->Wrap( -1 );
bSizerLeft->Add( m_staticTextPosY, 0, wxRIGHT|wxLEFT, 5 );
@ -86,7 +86,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_rbMirror->SetSelection( 0 );
bSizerRight->Add( m_rbMirror, 0, wxALL|wxEXPAND, 5 );
m_staticTextLayer = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayer->Wrap( -1 );
bSizerRight->Add( m_staticTextLayer, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
@ -100,7 +100,7 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_sdbSizerBts = new wxStdDialogButtonSizer();
m_sdbSizerBtsOK = new wxButton( this, wxID_OK );
@ -109,11 +109,12 @@ DIALOG_DIMENSION_EDITOR_BASE::DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wx
m_sdbSizerBts->AddButton( m_sdbSizerBtsCancel );
m_sdbSizerBts->Realize();
bSizerMain->Add( m_sdbSizerBts, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMain->Add( m_sdbSizerBts, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -42,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_DIMENSION_EDITOR_BASE</property>
<property name="pos"></property>
<property name="size">417,328</property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Dimension Properties</property>
@ -123,7 +125,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text:</property>
<property name="label">Text</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -315,7 +317,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Size X</property>
<property name="label">Text Width</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -489,7 +491,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Size Y</property>
<property name="label">Text Height</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -663,7 +665,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Width</property>
<property name="label">Text Thickness</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -837,7 +839,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text position X</property>
<property name="label">Text Position X</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1011,7 +1013,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text position Y</property>
<property name="label">Text Position Y</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1286,7 +1288,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Layer:</property>
<property name="label">Layer</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1434,7 +1436,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
@ -1515,7 +1517,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -67,7 +67,7 @@ class DIALOG_DIMENSION_EDITOR_BASE : public DIALOG_SHIM
public:
DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 417,328 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DIMENSION_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DIMENSION_EDITOR_BASE();
};

View File

@ -135,7 +135,7 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
// Configure the layers list selector
if( !m_Parent->GetBoard()->IsLayerEnabled( aDimension->GetLayer() ) )
// Should not happens, because one acnnot select a board item on a
// Should not happens, because one cannot select a board item on a
// not activated layer, but ...
m_SelLayerBox->ShowNonActivatedLayers( true );
@ -151,6 +151,7 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
m_SelLayerBox->SetLayerSelection( Dwgs_User );
}
SetDefaultItem( m_sdbSizerBtsOK );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
Centre();
@ -169,7 +170,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
if( !m_Parent->GetBoard()->IsLayerEnabled( newlayer ) )
{
wxMessageBox( _( "the layer currently selected is not enabled for this board\n"
wxMessageBox( _( "The layer currently selected is not enabled for this board\n"
"You cannot use it" ) );
return;
}
@ -213,16 +214,16 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
if( width > maxthickness )
{
DisplayError( NULL,
_( "The text thickness is too large for the text size. It will be clamped") );
_( "The text thickness is too large for the text size. "
"It will be clamped" ) );
width = maxthickness;
}
CurrentDimension->SetWidth( width );
CurrentDimension->Text().SetThickness( width );
CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
CurrentDimension->SetLayer( newlayer );
#ifndef USE_WX_OVERLAY
if( m_DC ) // Display new text
{
@ -231,6 +232,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
#else
m_Parent->Refresh();
#endif
m_Parent->OnModify();
EndModal( 1 );
}
@ -285,7 +287,6 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->Text().SetThickness( width );
aDimension->SetWidth( width );
aDimension->AdjustDimensionDetails();
aDimension->Draw( m_canvas, aDC, GR_XOR );
m_canvas->SetMouseCapture( BuildDimension, AbortBuildDimension );
@ -377,9 +378,11 @@ void PCB_EDIT_FRAME::DeleteDimension( DIMENSION* aDimension, wxDC* aDC )
OnModify();
}
/* Initialize parameters to move a pcb text
*/
static wxPoint initialTextPosition;
void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
{
if( aItem == NULL )
@ -418,6 +421,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
dimension->Draw( aPanel, aDC, GR_XOR );
}
/*
* Abort current text edit progress.
*
@ -439,6 +443,7 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
dimension->Draw( aPanel, aDC, GR_OR );
}
/*
* Place the current dimension text being moving
*/
@ -457,6 +462,5 @@ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC )
aItem->Text().SetTextPosition( initialTextPosition );
SaveCopyInUndoList( aItem, UR_CHANGED );
aItem->Text().SetTextPosition( tmp );
aItem->ClearFlags();
}