Move exact dialog: make all messages translatable. Fix minor issues (some can be Windows specific). Remove useless declarations. Fix coding style issues

Fix minor warnings from cppcheck.
This commit is contained in:
jean-pierre charras 2015-02-22 15:43:44 +01:00
parent c1978b3242
commit 0975e3e5bd
12 changed files with 173 additions and 72 deletions

View File

@ -206,7 +206,11 @@ wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit )
break; break;
case DEGREES: case DEGREES:
wxASSERT( false ); label = _( "deg" );
break;
default:
label = wxT( "??" );
break; break;
} }

View File

@ -182,7 +182,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DIALOG_MOVE_EXACT dialog( this, translation, rotation ); DIALOG_MOVE_EXACT dialog( this, translation, rotation );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_MOVE_EXACT::MOVE_OK ) if( ret == wxID_OK )
{ {
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
const wxPoint blockCentre = GetScreen()->m_BlockLocate.Centre(); const wxPoint blockCentre = GetScreen()->m_BlockLocate.Centre();

View File

@ -24,6 +24,7 @@
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <base_units.h> #include <base_units.h>
#include <macros.h>
#include <module_editor_frame.h> #include <module_editor_frame.h>
@ -42,8 +43,6 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent,
// set the unit labels // set the unit labels
m_xUnit->SetLabelText( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_xUnit->SetLabelText( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_yUnit->SetLabelText( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_yUnit->SetLabelText( GetAbbreviatedUnitsLabel( g_UserUnit ) );
// rotation is always degrees
m_rotUnit->SetLabelText( _( "deg" ) );
// tabbing goes through the entries in sequence // tabbing goes through the entries in sequence
m_yEntry->MoveAfterInTabOrder( m_xEntry ); m_yEntry->MoveAfterInTabOrder( m_xEntry );
@ -54,8 +53,11 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent,
m_xEntry->SetValue( wxString::FromDouble( m_options.entry1 ) ); m_xEntry->SetValue( wxString::FromDouble( m_options.entry1 ) );
m_yEntry->SetValue( wxString::FromDouble( m_options.entry2 ) ); m_yEntry->SetValue( wxString::FromDouble( m_options.entry2 ) );
m_rotEntry->SetValue( wxString::FromDouble( m_options.entryRotation ) ); m_rotEntry->SetValue( wxString::FromDouble( m_options.entryRotation ) );
updateDlgTexts( m_polarCoords->IsChecked() );
Fit(); m_stdButtonsOK->SetDefault();
GetSizer()->SetSizeHints(this);
} }
@ -64,12 +66,6 @@ DIALOG_MOVE_EXACT::~DIALOG_MOVE_EXACT()
} }
/*!
* Convert a given Cartesian point into a polar representation.
*
* Linear units are not considered, the answer is in the same units as given
* Angle is returned in degrees
*/
void DIALOG_MOVE_EXACT::ToPolarDeg( double x, double y, double& r, double& q ) void DIALOG_MOVE_EXACT::ToPolarDeg( double x, double y, double& r, double& q )
{ {
// convert to polar coordinates // convert to polar coordinates
@ -79,12 +75,6 @@ void DIALOG_MOVE_EXACT::ToPolarDeg( double x, double y, double& r, double& q )
} }
/*!
* Get the (Cartesian) translation described by the text entries
* @param val output translation vector
* @param polar interpret as polar coords
* @return false if error (though the text conversion functions don't report errors)
*/
bool DIALOG_MOVE_EXACT::GetTranslationInIU ( wxPoint& val, bool polar ) bool DIALOG_MOVE_EXACT::GetTranslationInIU ( wxPoint& val, bool polar )
{ {
if( polar ) if( polar )
@ -110,6 +100,7 @@ bool DIALOG_MOVE_EXACT::GetTranslationInIU ( wxPoint& val, bool polar )
void DIALOG_MOVE_EXACT::OnPolarChanged( wxCommandEvent& event ) void DIALOG_MOVE_EXACT::OnPolarChanged( wxCommandEvent& event )
{ {
bool newPolar = m_polarCoords->IsChecked(); bool newPolar = m_polarCoords->IsChecked();
updateDlgTexts( newPolar );
wxPoint val; wxPoint val;
// get the value as previously stored // get the value as previously stored
@ -122,25 +113,34 @@ void DIALOG_MOVE_EXACT::OnPolarChanged( wxCommandEvent& event )
ToPolarDeg( val.x, val.y, r, q); ToPolarDeg( val.x, val.y, r, q);
PutValueInLocalUnits( *m_xEntry, round( r / 10.0) * 10 ); PutValueInLocalUnits( *m_xEntry, round( r / 10.0) * 10 );
m_xLabel->SetLabelText( wxT( "r:" ) );
m_yEntry->SetValue( wxString::FromDouble( q ) ); m_yEntry->SetValue( wxString::FromDouble( q ) );
m_yLabel->SetLabelText( wxT( "\u03b8:" ) ); // theta }
else
{
// vector is already in Cartesian, so just render out
// note - round off the last decimal place (10nm) to prevent
// (some) rounding causing errors when round-tripping
// you can never eliminate entirely, however
PutValueInLocalUnits( *m_xEntry, KiROUND( val.x / 10.0) * 10 );
PutValueInLocalUnits( *m_yEntry, KiROUND( val.y / 10.0) * 10 );
}
Layout();
}
void DIALOG_MOVE_EXACT::updateDlgTexts( bool aPolar )
{
if( aPolar )
{
m_xLabel->SetLabelText( _( "Distance:" ) ); // Polar radius
m_yLabel->SetLabelText( _( "Angle:" ) ); // Polar theta or angle
m_yUnit->SetLabelText( GetAbbreviatedUnitsLabel( DEGREES ) ); m_yUnit->SetLabelText( GetAbbreviatedUnitsLabel( DEGREES ) );
} }
else else
{ {
// vector is already in Cartesian, so just render out m_xLabel->SetLabelText( _( "Move vector X:" ) );
m_yLabel->SetLabelText( _( "Move vector Y:" ) );
// note - round off the last decimal place (10nm) to prevent
// (some) rounding causing errors when round-tripping
// you can never eliminate entirely, however
PutValueInLocalUnits( *m_xEntry, round( val.x / 10.0) * 10 );
m_xLabel->SetLabelText( wxT( "x:" ) );
PutValueInLocalUnits( *m_yEntry, round( val.y / 10.0) * 10 );
m_yLabel->SetLabelText( wxT( "y:" ) );
m_yUnit->SetLabelText( GetAbbreviatedUnitsLabel( g_UserUnit ) ); m_yUnit->SetLabelText( GetAbbreviatedUnitsLabel( g_UserUnit ) );
} }
@ -172,7 +172,7 @@ void DIALOG_MOVE_EXACT::OnClear( wxCommandEvent& event )
void DIALOG_MOVE_EXACT::OnCancelClick( wxCommandEvent& event ) void DIALOG_MOVE_EXACT::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( MOVE_ABORT ); EndModal( wxID_ABORT );
} }
@ -191,14 +191,11 @@ void DIALOG_MOVE_EXACT::OnOkClick( wxCommandEvent& event )
m_yEntry->GetValue().ToDouble( &m_options.entry2 ); m_yEntry->GetValue().ToDouble( &m_options.entry2 );
m_rotEntry->GetValue().ToDouble( &m_options.entryRotation ); m_rotEntry->GetValue().ToDouble( &m_options.entryRotation );
EndModal( MOVE_OK ); EndModal( wxID_OK);
} }
} }
/*!
* Reset a text field to be 0 if it was exited while blank
*/
void DIALOG_MOVE_EXACT::OnTextFocusLost( wxFocusEvent& event ) void DIALOG_MOVE_EXACT::OnTextFocusLost( wxFocusEvent& event )
{ {
wxTextCtrl* obj = static_cast<wxTextCtrl*>( event.GetEventObject() ); wxTextCtrl* obj = static_cast<wxTextCtrl*>( event.GetEventObject() );

View File

@ -44,7 +44,7 @@
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_MOVE_EXACT_BASE</property> <property name="name">DIALOG_MOVE_EXACT_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">-1,-1</property> <property name="size">331,200</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Move item</property> <property name="title">Move item</property>
@ -126,7 +126,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Polar coordinates</property> <property name="label">Use polar coordinates</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -282,7 +282,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0"> <object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -456,7 +456,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1"> <object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -632,7 +632,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0"> <object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -806,7 +806,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1"> <object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -929,7 +929,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Rotate:</property> <property name="label">Item rotation:</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
@ -982,7 +982,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0"> <object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -1156,7 +1156,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1"> <object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -1249,6 +1249,87 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>

View File

@ -37,13 +37,6 @@ private:
double& m_rotation; double& m_rotation;
public: public:
enum MOVE_EDIT_T
{
MOVE_ABORT, ///< if not changed or error
MOVE_OK, ///< if successfully changed
};
// Constructor and destructor // Constructor and destructor
DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, wxPoint& translation, DIALOG_MOVE_EXACT( PCB_BASE_FRAME* aParent, wxPoint& translation,
double& rotation ); double& rotation );
@ -51,16 +44,36 @@ public:
private: private:
/*!
* Reset a text field to be 0 if it was exited while blank
*/
void OnTextFocusLost( wxFocusEvent& event ); void OnTextFocusLost( wxFocusEvent& event );
void OnPolarChanged( wxCommandEvent& event ); void OnPolarChanged( wxCommandEvent& event );
void OnClear( wxCommandEvent& event ); void OnClear( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
/**
* Convert a given Cartesian point into a polar representation.
*
* Linear units are not considered, the answer is in the same units as given
* Angle is returned in degrees
*/
void ToPolarDeg( double x, double y, double& r, double& q ); void ToPolarDeg( double x, double y, double& r, double& q );
/**
* Get the (Cartesian) translation described by the text entries
* @param val output translation vector
* @param polar interpret as polar coords
* @return false if error (though the text conversion functions don't report errors)
*/
bool GetTranslationInIU ( wxPoint& val, bool polar ); bool GetTranslationInIU ( wxPoint& val, bool polar );
// Update texts (comments) after changing the coordinates type (polar/cartesian)
void updateDlgTexts( bool aPolar );
/** /**
* Persistent dialog options * Persistent dialog options
*/ */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -16,7 +16,7 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id,
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL ); bMainSizer = new wxBoxSizer( wxVERTICAL );
m_polarCoords = new wxCheckBox( this, wxID_ANY, _("Polar coordinates"), wxDefaultPosition, wxDefaultSize, 0 ); m_polarCoords = new wxCheckBox( this, wxID_ANY, _("Use polar coordinates"), wxDefaultPosition, wxDefaultSize, 0 );
bMainSizer->Add( m_polarCoords, 0, wxALL|wxEXPAND, 5 ); bMainSizer->Add( m_polarCoords, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer2; wxFlexGridSizer* fgSizer2;
@ -30,46 +30,49 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id,
fgSizer2->Add( m_xLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); fgSizer2->Add( m_xLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_xEntry = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_xEntry = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_xEntry, 0, wxALL|wxEXPAND, 5 ); fgSizer2->Add( m_xEntry, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_xUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_xUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_xUnit->Wrap( -1 ); m_xUnit->Wrap( -1 );
fgSizer2->Add( m_xUnit, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 ); fgSizer2->Add( m_xUnit, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
m_clearX = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_clearX = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
fgSizer2->Add( m_clearX, 0, wxALL, 5 ); fgSizer2->Add( m_clearX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_yLabel = new wxStaticText( this, wxID_ANY, _("y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_yLabel = new wxStaticText( this, wxID_ANY, _("y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_yLabel->Wrap( -1 ); m_yLabel->Wrap( -1 );
fgSizer2->Add( m_yLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); fgSizer2->Add( m_yLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_yEntry = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_yEntry = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_yEntry, 0, wxALL|wxEXPAND, 5 ); fgSizer2->Add( m_yEntry, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_yUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_yUnit = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_yUnit->Wrap( -1 ); m_yUnit->Wrap( -1 );
fgSizer2->Add( m_yUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); fgSizer2->Add( m_yUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_clearY = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_clearY = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
fgSizer2->Add( m_clearY, 0, wxALL, 5 ); fgSizer2->Add( m_clearY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_rotLabel = new wxStaticText( this, wxID_ANY, _("Rotate:"), wxDefaultPosition, wxDefaultSize, 0 ); m_rotLabel = new wxStaticText( this, wxID_ANY, _("Item rotation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_rotLabel->Wrap( -1 ); m_rotLabel->Wrap( -1 );
fgSizer2->Add( m_rotLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); fgSizer2->Add( m_rotLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_rotEntry = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 ); m_rotEntry = new wxTextCtrl( this, wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_rotEntry, 0, wxALL|wxEXPAND, 5 ); fgSizer2->Add( m_rotEntry, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_rotUnit = new wxStaticText( this, wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 ); m_rotUnit = new wxStaticText( this, wxID_ANY, _("deg"), wxDefaultPosition, wxDefaultSize, 0 );
m_rotUnit->Wrap( -1 ); m_rotUnit->Wrap( -1 );
fgSizer2->Add( m_rotUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); fgSizer2->Add( m_rotUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_clearRot = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_clearRot = new wxBitmapButton( this, wxID_CLEAR, wxArtProvider::GetBitmap( wxART_DELETE, wxART_BUTTON ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
fgSizer2->Add( m_clearRot, 0, wxALL, 5 ); fgSizer2->Add( m_clearRot, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( fgSizer2, 1, wxEXPAND, 5 ); bMainSizer->Add( fgSizer2, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_stdButtons = new wxStdDialogButtonSizer(); m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK ); m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK ); m_stdButtons->AddButton( m_stdButtonsOK );
@ -82,7 +85,6 @@ DIALOG_MOVE_EXACT_BASE::DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id,
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_MOVE_EXACT_BASE::OnClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_MOVE_EXACT_BASE::OnClose ) );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -28,6 +28,7 @@ class DIALOG_SHIM;
#include <wx/bmpbuttn.h> #include <wx/bmpbuttn.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -54,6 +55,7 @@ class DIALOG_MOVE_EXACT_BASE : public DIALOG_SHIM
wxTextCtrl* m_rotEntry; wxTextCtrl* m_rotEntry;
wxStaticText* m_rotUnit; wxStaticText* m_rotUnit;
wxBitmapButton* m_clearRot; wxBitmapButton* m_clearRot;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_stdButtons; wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK; wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel; wxButton* m_stdButtonsCancel;
@ -69,7 +71,7 @@ class DIALOG_MOVE_EXACT_BASE : public DIALOG_SHIM
public: public:
DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Move item"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_MOVE_EXACT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Move item"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 331,200 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MOVE_EXACT_BASE(); ~DIALOG_MOVE_EXACT_BASE();
}; };

View File

@ -372,7 +372,7 @@ EVIA::EVIA( CPTREE& aVia )
string ext = attribs.get<string>( "extent" ); string ext = attribs.get<string>( "extent" );
sscanf( ext.c_str(), "%u-%u", &layer_front_most, &layer_back_most ); sscanf( ext.c_str(), "%d-%d", &layer_front_most, &layer_back_most );
drill = attribs.get<double>( "drill" ); drill = attribs.get<double>( "drill" );
diam = attribs.get_optional<double>( "diameter" ); diam = attribs.get_optional<double>( "diameter" );
@ -951,6 +951,7 @@ ELAYER::ELAYER( CPTREE& aLayer )
number = attribs.get<int>( "number" ); number = attribs.get<int>( "number" );
name = attribs.get<string>( "name" ); name = attribs.get<string>( "name" );
color = attribs.get<int>( "color" ); color = attribs.get<int>( "color" );
fill = 1; // Temporary value.
visible = parseOptionalBool( attribs, "visible" ); visible = parseOptionalBool( attribs, "visible" );
active = parseOptionalBool( attribs, "active" ); active = parseOptionalBool( attribs, "active" );
} }
@ -992,6 +993,7 @@ struct ERULES
ERULES() : ERULES() :
psElongationLong ( 100 ), psElongationLong ( 100 ),
psElongationOffset ( 0 ),
rvPadTop ( 0.25 ), rvPadTop ( 0.25 ),
// rvPadBottom ( 0.25 ), // rvPadBottom ( 0.25 ),
rlMinPadTop ( Mils2iu( 10 ) ), rlMinPadTop ( Mils2iu( 10 ) ),

View File

@ -1512,7 +1512,7 @@ void PCB_EDIT_FRAME::moveExact()
DIALOG_MOVE_EXACT dialog( this, translation, rotation ); DIALOG_MOVE_EXACT dialog( this, translation, rotation );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_MOVE_EXACT::MOVE_OK ) if( ret == wxID_OK )
{ {
BOARD_ITEM* item = GetScreen()->GetCurItem(); BOARD_ITEM* item = GetScreen()->GetCurItem();

View File

@ -595,7 +595,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
D_PAD* pad = padstacks[i]; D_PAD* pad = padstacks[i];
// Straight padstack // Straight padstack
fprintf( aFile, "PADSTACK PAD%d %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR ); fprintf( aFile, "PADSTACK PAD%u %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR );
LSET pad_set = pad->GetLayerSet() & master_layermask; LSET pad_set = pad->GetLayerSet() & master_layermask;
@ -604,18 +604,18 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
{ {
LAYER_ID layer = *seq; LAYER_ID layer = *seq;
fprintf( aFile, "PAD P%d %s 0 0\n", i, GenCADLayerName( cu_count, layer ).c_str() ); fprintf( aFile, "PAD P%u %s 0 0\n", i, GenCADLayerName( cu_count, layer ).c_str() );
} }
// Flipped padstack // Flipped padstack
fprintf( aFile, "PADSTACK PAD%dF %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR ); fprintf( aFile, "PADSTACK PAD%uF %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR );
// the normal LAYER_ID sequence is inverted from gc_seq[] // the normal LAYER_ID sequence is inverted from gc_seq[]
for( LSEQ seq = pad_set.Seq(); seq; ++seq ) for( LSEQ seq = pad_set.Seq(); seq; ++seq )
{ {
LAYER_ID layer = *seq; LAYER_ID layer = *seq;
fprintf( aFile, "PAD P%d %s 0 0\n", i, GenCADLayerNameFlipped( cu_count, layer ).c_str() ); fprintf( aFile, "PAD P%u %s 0 0\n", i, GenCADLayerNameFlipped( cu_count, layer ).c_str() );
} }
} }

View File

@ -848,7 +848,7 @@ void FOOTPRINT_EDIT_FRAME::moveExact()
DIALOG_MOVE_EXACT dialog( this, translation, rotation ); DIALOG_MOVE_EXACT dialog( this, translation, rotation );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_MOVE_EXACT::MOVE_OK ) if( ret == wxID_OK )
{ {
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
@ -926,7 +926,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
DIALOG_MOVE_EXACT dialog( this, translation, rotation ); DIALOG_MOVE_EXACT dialog( this, translation, rotation );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_MOVE_EXACT::MOVE_OK ) if( ret == wxID_OK )
{ {
MoveMarkedItemsExactly( module, wxPoint(0, 0), MoveMarkedItemsExactly( module, wxPoint(0, 0),
translation, rotation, true ); translation, rotation, true );

View File

@ -610,7 +610,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
DIALOG_MOVE_EXACT dialog( editFrame, translation, rotation ); DIALOG_MOVE_EXACT dialog( editFrame, translation, rotation );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
if( ret == DIALOG_MOVE_EXACT::MOVE_OK ) if( ret == wxID_OK )
{ {
if( !isUndoInhibited() ) if( !isUndoInhibited() )
{ {