Remove some references to g_UserUnit

(cherry picked from commit 614d832)
This commit is contained in:
Jeff Young 2018-02-02 15:56:09 +00:00
parent 74acb76e7f
commit a39fb03822
29 changed files with 433 additions and 518 deletions

View File

@ -42,12 +42,14 @@
#include <class_board.h>
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
PANEL_PREV_3D::PANEL_PREV_3D( wxWindow* aParent, EDA_UNITS_T aUnits, S3D_CACHE* aCacheManager,
MODULE* aModuleCopy,
COLORS_DESIGN_SETTINGS *aColors,
std::vector<MODULE_3D_SETTINGS> *aParentInfoList ) :
PANEL_PREV_3D_BASE( aParent, wxID_ANY )
{
m_userUnits = aUnits;
initPanel();
// Initialize the color settings to draw the board and the footprint
@ -133,7 +135,7 @@ void PANEL_PREV_3D::initPanel()
wxString units;
switch( g_UserUnit )
switch( m_userUnits )
{
case INCHES:
units = _( "inches" );
@ -243,7 +245,7 @@ void PANEL_PREV_3D::SetModelDataIdx( int idx, bool aReloadPreviewModule )
double scaler = 1;
switch( g_UserUnit )
switch( m_userUnits )
{
case MILLIMETRES:
scaler = 1.0f;
@ -486,7 +488,7 @@ void PANEL_PREV_3D::onIncrementOffset( wxSpinEvent& event )
double step = OFFSET_INCREMENT_MM;
if( g_UserUnit == INCHES )
if( m_userUnits == INCHES )
step = OFFSET_INCREMENT_MIL/1000.0;
incrementTextCtrl( textCtrl, step, -MAX_OFFSET, MAX_OFFSET );
@ -506,7 +508,7 @@ void PANEL_PREV_3D::onDecrementOffset( wxSpinEvent& event )
double step = OFFSET_INCREMENT_MM;
if( g_UserUnit == INCHES )
if( m_userUnits == INCHES )
step = OFFSET_INCREMENT_MIL/1000.0;
incrementTextCtrl( textCtrl, -step, -MAX_OFFSET, MAX_OFFSET );
@ -556,7 +558,7 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event )
if( event.ShiftDown( ) )
step = OFFSET_INCREMENT_MM_FINE;
if( g_UserUnit == INCHES )
if( m_userUnits == INCHES )
{
step = OFFSET_INCREMENT_MIL/1000.0;
if( event.ShiftDown( ) )
@ -599,7 +601,7 @@ void PANEL_PREV_3D::getOrientationVars( SGPOINT& aScale, SGPOINT& aRotation, SGP
double scaler = 1.0f;
switch( g_UserUnit )
switch( m_userUnits )
{
case MILLIMETRES:
scaler = 1.0f;

View File

@ -72,7 +72,7 @@ class COLORS_DESIGN_SETTINGS;
class PANEL_PREV_3D: public PANEL_PREV_3D_BASE
{
public:
PANEL_PREV_3D( wxWindow* aParent, S3D_CACHE* aCacheManager,
PANEL_PREV_3D( wxWindow* aParent, EDA_UNITS_T aUnits, S3D_CACHE* aCacheManager,
MODULE* aModuleCopy,
COLORS_DESIGN_SETTINGS *aColors,
std::vector<MODULE_3D_SETTINGS> *aParentInfoList = NULL );
@ -104,6 +104,8 @@ private:
/// Current MODULE_3D_SETTINGS that is being edited
MODULE_3D_SETTINGS m_modelInfo;
EDA_UNITS_T m_userUnits;
// Methods of the class
private:
void initPanel();

View File

@ -40,12 +40,12 @@ static const double majorTickLengthFactor = 2.5;
static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
const VECTOR2D& aRulerVec )
const VECTOR2D& aRulerVec, EDA_UNITS_T aUnits )
{
// draw the cursor labels
std::vector<wxString> cursorStrings;
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), g_UserUnit ) );
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) );
double degs = RAD2DECIDEG( -aRulerVec.Angle() );
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) );
@ -73,7 +73,7 @@ struct TICK_FORMAT
};
static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace )
static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS_T aUnits )
{
// simple 1/2/5 scales per decade
static std::vector<TICK_FORMAT> tickFormats =
@ -87,7 +87,7 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace )
aTickSpace = 1;
// convert to a round (mod-10) number of mils
if( g_UserUnit == INCHES )
if( aUnits == INCHES )
{
aTickSpace *= 2.54;
}
@ -119,12 +119,12 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace )
* @param aMinorTickLen length of minor ticks in IU
*/
void drawTicksAlongLine( KIGFX::VIEW *aView, const VECTOR2D& aOrigin,
const VECTOR2D& aLine, double aMinorTickLen )
const VECTOR2D& aLine, double aMinorTickLen, EDA_UNITS_T aUnits )
{
VECTOR2D tickLine = aLine.Rotate( -M_PI_2 );
auto gal = aView->GetGAL();
double tickSpace;
TICK_FORMAT tickF = getTickFormatForScale( gal->GetWorldScale(), tickSpace );
TICK_FORMAT tickF = getTickFormatForScale( gal->GetWorldScale(), tickSpace, aUnits );
auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( aView->GetPainter()->GetSettings() );
// number of ticks in whole ruler
@ -170,7 +170,7 @@ void drawTicksAlongLine( KIGFX::VIEW *aView, const VECTOR2D& aOrigin,
if( drawLabel )
{
wxString label = DimensionLabel( "", tickSpace * i, g_UserUnit );
wxString label = DimensionLabel( "", tickSpace * i, aUnits );
// FIXME: spaces choke OpenGL lp:1668455
label.erase( std::remove( label.begin(), label.end(), ' ' ), label.end() );
@ -205,9 +205,10 @@ void drawBacksideTicks( KIGFX::GAL& aGal, const VECTOR2D& aOrigin,
}
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr ):
RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS_T userUnits ):
EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
m_geomMgr( aGeomMgr )
m_geomMgr( aGeomMgr ),
m_userUnits( userUnits )
{}
@ -254,7 +255,7 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
// constant text size on screen
SetConstantGlyphHeight( gal, 14.0 );
drawCursorStrings( aView, end, rulerVec );
drawCursorStrings( aView, end, rulerVec, m_userUnits );
// tick label size
SetConstantGlyphHeight( gal, 12.0 );
@ -262,7 +263,7 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
// basic tick size
const double minorTickLen = 5.0 / gal.GetWorldScale();
drawTicksAlongLine( aView, origin, rulerVec, minorTickLen );
drawTicksAlongLine( aView, origin, rulerVec, minorTickLen, m_userUnits );
gal.SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ).WithAlpha( PreviewOverlayDeemphAlpha( true ) ) );
drawBacksideTicks( gal, origin, rulerVec, minorTickLen * majorTickLengthFactor, 2 );

View File

@ -35,13 +35,13 @@ using namespace std::placeholders;
GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
{
BASE_SCREEN* screen = aParent->GetScreen();
BASE_SCREEN* screen = m_parent->GetScreen();
SetTitle( _( "Grid" ) );
SetIcon( grid_select_xpm );
wxArrayString gridsList;
screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES );
for( unsigned int i = 0; i < gridsList.GetCount(); ++i )
{
@ -67,7 +67,7 @@ void GRID_MENU::update()
int currentId = screen->GetGridCmdId();
wxArrayString gridsList;
screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES );
for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
{

View File

@ -315,7 +315,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
_( "Grid" ), KiBitmap( grid_select_xpm ) );
wxArrayString gridsList;
int icurr = screen->BuildGridsChoiceList( gridsList, g_UserUnit != INCHES );
int icurr = screen->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES );
for( unsigned i = 0; i < gridsList.GetCount(); i++ )
{

View File

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sch_edit_frame.h>
#include <dialog_sch_edit_sheet_pin.h>
@ -35,14 +36,15 @@ static wxString sheetPinTypes[] =
};
#define SHEET_PIN_TYPE_CNT ( sizeof( sheetPinTypes ) / sizeof( wxString ) )
DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) :
DIALOG_SCH_EDIT_SHEET_PIN_BASE( parent )
DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin ) :
DIALOG_SCH_EDIT_SHEET_PIN_BASE( parent ),
m_frame( parent ),
m_sheetPin( aPin ),
m_textWidth( parent, m_widthLabel, m_widthCtrl, m_widthUnits, true ),
m_textHeight( parent, m_heightLabel, m_heightCtrl, m_heightUnits, true )
{
for( size_t i = 0; i < SHEET_PIN_TYPE_CNT; i++ )
m_choiceConnectionType->Append( sheetPinTypes[ i ] );
for( const wxString& sheetPinType : sheetPinTypes )
m_choiceConnectionType->Append( sheetPinType );
m_choiceConnectionType->SetSelection( 0 );
m_textName->SetFocus();
@ -55,6 +57,15 @@ DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) :
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier versions for
* the flex grid sizer in wxGTK that prevents the last column from being sized
* correctly. It doesn't cause any problems on win32 so it doesn't need to wrapped
* in ugly #ifdef __WXGTK__ #endif.
*/
Layout();
Fit();
SetMinSize( GetSize() );
// On some windows manager (Unity, XFCE), this dialog is
// not always raised, depending on this dialog is run.
// Force it to be raised
@ -62,6 +73,36 @@ DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) :
}
bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataToWindow()
{
m_textName->SetValue( m_sheetPin->GetText() );
m_textWidth.SetValue( m_sheetPin->GetTextWidth() );
m_textHeight.SetValue( m_sheetPin->GetTextHeight() );
m_choiceConnectionType->SetSelection( m_sheetPin->GetShape() );
return true;
}
bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow()
{
if( !m_sheetPin->IsNew() )
{
m_frame->SaveCopyInUndoList( (SCH_ITEM*) m_sheetPin->GetParent(), UR_CHANGED );
m_frame->GetScreen()->SetCurItem( nullptr );
}
m_sheetPin->SetText( m_textName->GetValue() );
m_sheetPin->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
auto shape = static_cast<PINSHEETLABEL_SHAPE>( m_choiceConnectionType->GetCurrentSelection() );
m_sheetPin->SetShape( shape );
m_frame->OnModify();
return true;
}
void DIALOG_SCH_EDIT_SHEET_PIN::onOKButton( wxCommandEvent& event )
{

View File

@ -34,31 +34,25 @@
#include <dialog_sch_edit_sheet_pin_base.h>
#include <sch_text.h> // enum PINSHEETLABEL_SHAPE definition
#include <widgets/unit_binder.h>
class SCH_SHEET_PIN;
class DIALOG_SCH_EDIT_SHEET_PIN : public DIALOG_SCH_EDIT_SHEET_PIN_BASE
{
SCH_EDIT_FRAME* m_frame;
SCH_SHEET_PIN* m_sheetPin;
UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight;
public:
DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent );
DIALOG_SCH_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin );
// Set the label text in m_textName.
// Because m_textName uses a wxTextValidator, the label text must be stored in the
// validator string
void SetLabelName( const wxString& aName ) { m_labelString = aName; }
wxString GetLabelName() const { return m_textName->GetValue(); }
void SetTextHeight( const wxString& aHeight ) { m_textHeight->SetValue( aHeight ); }
wxString GetTextHeight() const { return m_textHeight->GetValue(); }
void SetTextWidth( const wxString& aWidth ) { m_textWidth->SetValue( aWidth ); }
wxString GetTextWidth() const { return m_textWidth->GetValue(); }
void SetConnectionType( PINSHEETLABEL_SHAPE aType ) { m_choiceConnectionType->SetSelection( aType ); }
/// @todo move cast to widget
PINSHEETLABEL_SHAPE GetConnectionType() const { return static_cast<PINSHEETLABEL_SHAPE>( m_choiceConnectionType->GetCurrentSelection() ); }
void SetTextHeightUnits( const wxString& aUnit ) { m_staticHeightUnits->SetLabel( aUnit ); }
void SetTextWidthUnits( const wxString& aUnit ) { m_staticWidthUnits->SetLabel( aUnit ); }
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
void onOKButton( wxCommandEvent& event ) override;

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 2 2017)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_sch_edit_sheet_pin_base.h"
@ -27,46 +27,48 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 6 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textName->SetMinSize( wxSize( 160,-1 ) );
m_textName->SetValidator( wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, &m_labelString ) );
fgSizer1->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 6 );
fgSizer1->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 6 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_heightLabel = new wxStaticText( this, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_heightLabel->Wrap( -1 );
fgSizer1->Add( m_heightLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_textHeight = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textHeight, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_heightCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_heightCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_staticHeightUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticHeightUnits->Wrap( -1 );
fgSizer1->Add( m_staticHeightUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_heightUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_heightUnits->Wrap( -1 );
fgSizer1->Add( m_heightUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_widthLabel = new wxStaticText( this, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_widthLabel->Wrap( -1 );
fgSizer1->Add( m_widthLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_textWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textWidth, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_widthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_widthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticWidthUnits->Wrap( -1 );
fgSizer1->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
m_widthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_widthUnits->Wrap( -1 );
fgSizer1->Add( m_widthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Connection type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
wxArrayString m_choiceConnectionTypeChoices;
m_choiceConnectionType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceConnectionTypeChoices, 0 );
m_choiceConnectionType->SetSelection( 0 );
fgSizer1->Add( m_choiceConnectionType, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 );
fgSizer1->Add( m_choiceConnectionType, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 6 );
@ -75,10 +77,10 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
m_nameSizer->Add( fgSizer1, 1, wxEXPAND, 6 );
m_mainSizer->Add( m_nameSizer, 1, wxALL|wxEXPAND, 6 );
m_mainSizer->Add( m_nameSizer, 1, wxALL|wxEXPAND, 10 );
m_mainSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 3 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_mainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );

View File

@ -94,7 +94,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">10</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
@ -119,8 +119,8 @@
<property name="rows">4</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -202,8 +202,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -239,7 +239,7 @@
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">160,-1</property>
<property name="moveable">1</property>
<property name="name">m_textName</property>
<property name="pane_border">1</property>
@ -303,7 +303,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@ -342,7 +342,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText2</property>
<property name="name">m_heightLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -386,7 +386,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
@ -425,7 +425,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textHeight</property>
<property name="name">m_heightCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -477,8 +477,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -516,7 +516,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticHeightUnits</property>
<property name="name">m_heightUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -560,7 +560,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@ -599,7 +599,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText5</property>
<property name="name">m_widthLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -643,7 +643,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
@ -682,7 +682,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textWidth</property>
<property name="name">m_widthCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -734,8 +734,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -773,7 +773,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticWidthUnits</property>
<property name="name">m_widthUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -817,7 +817,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@ -900,8 +900,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">6</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@ -1002,13 +1002,84 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">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="width">0</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">; forward_declare</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="1">

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 2 2017)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SCH_EDIT_SHEET_PIN_BASE_H__
@ -11,8 +11,6 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -24,6 +22,7 @@ class DIALOG_SHIM;
#include <wx/valtext.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -40,14 +39,15 @@ class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public DIALOG_SHIM
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_textName;
wxStaticText* m_staticText2;
wxTextCtrl* m_textHeight;
wxStaticText* m_staticHeightUnits;
wxStaticText* m_staticText5;
wxTextCtrl* m_textWidth;
wxStaticText* m_staticWidthUnits;
wxStaticText* m_heightLabel;
wxTextCtrl* m_heightCtrl;
wxStaticText* m_heightUnits;
wxStaticText* m_widthLabel;
wxTextCtrl* m_widthCtrl;
wxStaticText* m_widthUnits;
wxStaticText* m_staticText3;
wxChoice* m_choiceConnectionType;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2014-2018 KiCad Developers, see CHANGELOG.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
@ -23,12 +23,17 @@
*/
#include <wx/string.h>
#include <sch_edit_frame.h>
#include <dialog_sch_sheet_props.h>
#include <validators.h>
#include <wildcards_and_files_ext.h>
#include <confirm.h>
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
DIALOG_SCH_SHEET_PROPS_BASE( parent )
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* parent, SCH_SHEET* aSheet ) :
DIALOG_SCH_SHEET_PROPS_BASE( parent ),
m_sheet( aSheet ),
m_filenameTextSize( parent, m_filenameSizeLabel, m_filenameSizeCtrl, m_filenameSizeUnits, true ),
m_sheetnameTextSize( parent, m_sheetnameSizeLabel, m_sheetnameSizeCtrl, m_sheetnameSizeUnits, true )
{
m_textFileName->SetValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR() );
m_textFileName->SetFocus();
@ -36,17 +41,66 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
* versions for the flex grid sizer in wxGTK that prevents the last
* column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif.
* Still present in wxWidgets 3.0.2
*/
Layout();
Fit();
SetMinSize( GetSize() );
GetSizer()->Fit( this );
}
void DIALOG_SCH_SHEET_PROPS::SetFileName( const wxString& aFileName )
bool DIALOG_SCH_SHEET_PROPS::TransferDataToWindow()
{
// Filenames are stored using unix notation
wxString fname = aFileName;
wxString fname = m_sheet->GetFileName();
#ifdef __WINDOWS__
fname.Replace( wxT("/"), wxT("\\") );
#endif
m_textFileName->SetValue( fname );
m_textSheetName->SetValue( m_sheet->GetName() );
m_filenameTextSize.SetValue( m_sheet->GetFileNameSize() );
m_sheetnameTextSize.SetValue( m_sheet->GetSheetNameSize() );
auto tstamp = wxString::Format( wxT( "%8.8lX" ), (unsigned long) m_sheet->GetTimeStamp() );
m_textCtrlTimeStamp->SetValue( tstamp );
return true;
}
bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
{
wxFileName fileName = GetFileName();
fileName.SetExt( SchematicFileExtension );
if( !fileName.IsOk() )
{
DisplayError( this, _( "File name is not valid!" ) );
return false;
}
// Duplicate sheet names are not valid.
SCH_SHEET_LIST hierarchy( g_RootSheet );
const SCH_SHEET* sheet = hierarchy.FindSheetByName( GetSheetName() );
if( sheet && (sheet != m_sheet) )
{
DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ),
GetSheetName() ) );
return false;
}
return true;
}

View File

@ -25,56 +25,33 @@
#ifndef __dialog_sch_sheet_props__
#define __dialog_sch_sheet_props__
/**
* @file
* Subclass of DIALOG_SCH_SHEET_PROPS_BASE, which is generated by wxFormBuilder.
*/
#include <dialog_sch_sheet_props_base.h>
#include <widgets/unit_binder.h>
class SCH_SHEET;
class SCH_EDIT_FRAME;
/** Implementing DIALOG_SCH_SHEET_PROPS_BASE */
class DIALOG_SCH_SHEET_PROPS : public DIALOG_SCH_SHEET_PROPS_BASE
{
SCH_SHEET* m_sheet;
UNIT_BINDER m_filenameTextSize;
UNIT_BINDER m_sheetnameTextSize;
public:
/** Constructor */
DIALOG_SCH_SHEET_PROPS( wxWindow* parent );
DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* parent, SCH_SHEET* aSheet );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void SetFileName( const wxString& aFileName );
const wxString GetFileName();
void SetSheetName( const wxString& aSheetName )
{
m_textSheetName->SetValue( aSheetName );
}
wxString GetSheetName() { return m_textSheetName->GetValue(); }
void SetFileNameTextSize( const wxString& aTextSize )
{
m_textFileNameSize->SetValue( aTextSize );
}
wxString GetFileNameTextSize() { return m_textFileNameSize->GetValue(); }
void SetSheetNameTextSize( const wxString& aTextSize )
{
m_textSheetNameSize->SetValue( aTextSize );
}
wxString GetSheetNameTextSize() { return m_textSheetNameSize->GetValue(); }
void SetFileNameTextSizeUnits(const wxString& aUnits)
{
m_staticFileNameSizeUnits->SetLabel( aUnits );
}
void SetSheetNameTextSizeUnits(const wxString& aUnits)
{
m_staticSheetNameSizeUnits->SetLabel( aUnits );
}
void SetSheetTimeStamp(const wxString& aTimeStamp)
{
m_textCtrlTimeStamp->SetValue( aTimeStamp );
}
int GetFileNameTextSize() { return m_filenameTextSize.GetValue(); }
int GetSheetNameTextSize() { return m_sheetnameTextSize.GetValue(); }
};
#endif // __dialog_sch_sheet_props__

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_sch_sheet_props_base.h"
@ -25,55 +25,55 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&File name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_filenameLabel = new wxStaticText( this, wxID_ANY, _("&File name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_filenameLabel->Wrap( -1 );
fgSizer1->Add( m_filenameLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_textFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textFileName->SetMinSize( wxSize( 200,-1 ) );
fgSizer1->Add( m_textFileName, 5, wxEXPAND|wxTOP|wxBOTTOM, 3 );
fgSizer1->Add( m_textFileName, 5, wxEXPAND|wxTOP, 5 );
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Si&ze:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_filenameSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_filenameSizeLabel->Wrap( -1 );
fgSizer1->Add( m_filenameSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_textFileNameSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textFileNameSize, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 3 );
m_filenameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_filenameSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_staticFileNameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticFileNameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticFileNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_filenameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_filenameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_filenameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("&Sheet name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_sheetnameLabel = new wxStaticText( this, wxID_ANY, _("&Sheet name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_sheetnameLabel->Wrap( -1 );
fgSizer1->Add( m_sheetnameLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_textSheetName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textSheetName, 5, wxEXPAND|wxTOP|wxBOTTOM, 3 );
fgSizer1->Add( m_textSheetName, 5, wxEXPAND|wxTOP, 5 );
fgSizer1->Add( 0, 0, 1, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_sheetnameSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_sheetnameSizeLabel->Wrap( -1 );
fgSizer1->Add( m_sheetnameSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_textSheetNameSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textSheetNameSize, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 3 );
m_sheetnameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_sheetnameSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
m_staticSheetNameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticSheetNameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticSheetNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_sheetnameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_sheetnameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_sheetnameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizer1->Add( m_staticline2, 0, wxEXPAND|wxALL, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizer1->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
@ -98,13 +98,10 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
bupperSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
mainSizer->Add( 0, 0, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
@ -118,6 +115,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}

View File

@ -44,7 +44,7 @@
<property name="minimum_size">500,150</property>
<property name="name">DIALOG_SCH_SHEET_PROPS_BASE</property>
<property name="pos"></property>
<property name="size">519,185</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">Schematic Sheet Properties</property>
@ -95,7 +95,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -119,8 +119,8 @@
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -158,7 +158,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="name">m_filenameLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -202,8 +202,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -293,9 +293,9 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxALL</property>
<property name="proportion">1</property>
<property name="border">10</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
@ -303,8 +303,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -334,7 +334,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Si&amp;ze:</property>
<property name="label">Text size:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -342,7 +342,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText2</property>
<property name="name">m_filenameSizeLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -386,8 +386,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -425,7 +425,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textFileNameSize</property>
<property name="name">m_filenameSizeCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -477,8 +477,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -516,7 +516,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticFileNameSizeUnits</property>
<property name="name">m_filenameSizeUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -560,8 +560,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -599,7 +599,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText4</property>
<property name="name">m_sheetnameLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -643,8 +643,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -734,9 +734,9 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="border">10</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
@ -744,8 +744,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -775,7 +775,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Size:</property>
<property name="label">Text size:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -783,7 +783,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText5</property>
<property name="name">m_sheetnameSizeLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -827,8 +827,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
@ -866,7 +866,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textSheetNameSize</property>
<property name="name">m_sheetnameSizeCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -918,8 +918,8 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -957,7 +957,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticSheetNameSizeUnits</property>
<property name="name">m_sheetnameSizeUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1002,164 +1002,22 @@
</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_staticline2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</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>
<property name="width">0</property>
</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_staticline3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</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>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -1382,17 +1240,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -1,8 +1,8 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 4 2017)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SCH_SHEET_PROPS_BASE_H__
@ -11,8 +11,6 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -21,8 +19,8 @@ class DIALOG_SHIM;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -36,18 +34,16 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
private:
protected:
wxStaticText* m_staticText1;
wxStaticText* m_filenameLabel;
wxTextCtrl* m_textFileName;
wxStaticText* m_staticText2;
wxTextCtrl* m_textFileNameSize;
wxStaticText* m_staticFileNameSizeUnits;
wxStaticText* m_staticText4;
wxStaticText* m_filenameSizeLabel;
wxTextCtrl* m_filenameSizeCtrl;
wxStaticText* m_filenameSizeUnits;
wxStaticText* m_sheetnameLabel;
wxTextCtrl* m_textSheetName;
wxStaticText* m_staticText5;
wxTextCtrl* m_textSheetNameSize;
wxStaticText* m_staticSheetNameSizeUnits;
wxStaticLine* m_staticline2;
wxStaticLine* m_staticline3;
wxStaticText* m_sheetnameSizeLabel;
wxTextCtrl* m_sheetnameSizeCtrl;
wxStaticText* m_sheetnameSizeUnits;
wxStaticText* m_staticTextTimeStamp;
wxTextCtrl* m_textCtrlTimeStamp;
wxStaticLine* m_staticline1;
@ -57,7 +53,7 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
public:
DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,185 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_SHEET_PROPS_BASE();
};

View File

@ -202,10 +202,10 @@ void SCH_BASE_FRAME::UpdateStatusBar()
EDA_DRAW_FRAME::UpdateStatusBar();
// Display absolute coordinates:
double dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
double dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
double dXpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().x );
double dYpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().y );
if ( g_UserUnit == MILLIMETRES )
if ( GetUserUnits() == MILLIMETRES )
{
dXpos = RoundTo0( dXpos, 100.0 );
dYpos = RoundTo0( dYpos, 100.0 );
@ -214,7 +214,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
wxString absformatter;
wxString locformatter;
switch( g_UserUnit )
switch( GetUserUnits() )
{
case INCHES:
absformatter = wxT( "X %.3f Y %.3f" );
@ -243,10 +243,10 @@ void SCH_BASE_FRAME::UpdateStatusBar()
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx );
dYpos = To_User_Unit( g_UserUnit, dy );
dXpos = To_User_Unit( GetUserUnits(), dx );
dYpos = To_User_Unit( GetUserUnits(), dy );
if( g_UserUnit == MILLIMETRES )
if( GetUserUnits() == MILLIMETRES )
{
dXpos = RoundTo0( dXpos, 100.0 );
dYpos = RoundTo0( dYpos, 100.0 );

View File

@ -29,7 +29,6 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <base_units.h>
#include <kiface_i.h>
#include <project.h>
#include <wildcards_and_files_ext.h>
@ -50,29 +49,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
// Get the new texts
DIALOG_SCH_SHEET_PROPS dlg( this );
wxString units = GetUnitsLabel( g_UserUnit );
dlg.SetFileName( aSheet->GetFileName() );
dlg.SetFileNameTextSize( StringFromValue( g_UserUnit, aSheet->GetFileNameSize() ) );
dlg.SetFileNameTextSizeUnits( units );
dlg.SetSheetName( aSheet->GetName() );
dlg.SetSheetNameTextSize( StringFromValue( g_UserUnit, aSheet->GetSheetNameSize() ) );
dlg.SetSheetNameTextSizeUnits( units );
dlg.SetSheetTimeStamp( wxString::Format( wxT( "%8.8lX" ),
(unsigned long) aSheet->GetTimeStamp() ) );
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
* versions for the flex grid sizer in wxGTK that prevents the last
* column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif.
* Still present in wxWidgets 3.0.2
*/
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
dlg.GetSizer()->Fit( &dlg );
DIALOG_SCH_SHEET_PROPS dlg( this, aSheet );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
@ -80,22 +57,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
wxFileName fileName = dlg.GetFileName();
fileName.SetExt( SchematicFileExtension );
if( !fileName.IsOk() )
{
DisplayError( this, _( "File name is not valid!" ) );
return false;
}
// Duplicate sheet names are not valid.
const SCH_SHEET* sheet = hierarchy.FindSheetByName( dlg.GetSheetName() );
if( sheet && (sheet != aSheet) )
{
DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ),
dlg.GetSheetName() ) );
return false;
}
wxString msg;
bool loadFromFile = false;
bool clearAnnotation = false;
@ -122,7 +83,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
if( !g_RootSheet->SearchHierarchy( newFilename, &useScreen ) )
{
loadFromFile = wxFileExists( newFilename );
wxLogDebug( "Sheet requested file \"%s\", %s", newFilename,
wxLogDebug( "Sheet requested file \"%s\", %s",
newFilename,
( loadFromFile ) ? "found" : "not found" );
}
@ -273,9 +235,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
if( !pi->GetError().IsEmpty() )
{
DisplayErrorMessage( this,
_( "The entire schematic could not be load. Errors "
"occurred attempting to load hierarchical sheet "
"schematics." ),
_( "The entire schematic could not be loaded.\n"
"Errors occurred loading hierarchical sheets." ),
pi->GetError() );
}
}
@ -291,9 +252,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
}
}
aSheet->SetFileNameSize( ValueFromString( g_UserUnit, dlg.GetFileNameTextSize() ) );
aSheet->SetFileNameSize( dlg.GetFileNameTextSize() );
aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( ValueFromString( g_UserUnit, dlg.GetSheetNameTextSize() ) );
aSheet->SetSheetNameSize( dlg.GetSheetNameTextSize() );
if( aSheet->GetName().IsEmpty() )
aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ),

View File

@ -34,9 +34,7 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <base_units.h>
#include <general.h>
#include <sch_sheet.h>
#include <dialog_helpers.h>
@ -63,43 +61,11 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw )
if( aSheetPin == NULL )
return wxID_CANCEL;
DIALOG_SCH_EDIT_SHEET_PIN dlg( this );
dlg.SetLabelName( aSheetPin->GetText() );
dlg.SetTextHeight( StringFromValue( g_UserUnit, aSheetPin->GetTextHeight() ) );
dlg.SetTextHeightUnits( GetUnitsLabel( g_UserUnit ) );
dlg.SetTextWidth( StringFromValue( g_UserUnit, aSheetPin->GetTextWidth() ) );
dlg.SetTextWidthUnits( GetUnitsLabel( g_UserUnit ) );
dlg.SetConnectionType( aSheetPin->GetShape() );
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier versions for
* the flex grid sizer in wxGTK that prevents the last column from being sized
* correctly. It doesn't cause any problems on win32 so it doesn't need to wrapped
* in ugly #ifdef __WXGTK__ #endif.
*/
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
DIALOG_SCH_EDIT_SHEET_PIN dlg( this, aSheetPin );
if( dlg.ShowModal() == wxID_CANCEL )
return wxID_CANCEL;
if( !aSheetPin->IsNew() )
{
SaveCopyInUndoList( (SCH_ITEM*) aSheetPin->GetParent(), UR_CHANGED );
GetScreen()->SetCurItem( NULL );
}
aSheetPin->SetText( dlg.GetLabelName() );
aSheetPin->SetTextSize( wxSize(
ValueFromString( g_UserUnit, dlg.GetTextWidth() ),
ValueFromString( g_UserUnit, dlg.GetTextHeight() ) ) );
aSheetPin->SetShape( dlg.GetConnectionType() );
OnModify();
if( aRedraw )
m_canvas->Refresh();

View File

@ -360,7 +360,7 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame )
msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED );
if( g_UserUnit == INCHES )
if( aMainFrame->GetUserUnits() == INCHES )
msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0,
Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 );
else

View File

@ -344,8 +344,8 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
// Build the aperture list of the current layer, and add it to the combo box:
wxArrayString dcode_list;
wxString msg;
const char* units = g_UserUnit == INCHES ? "mils" : "mm";
double scale = g_UserUnit == INCHES ? IU_PER_MILS : IU_PER_MM;
const char* units = GetUserUnits() == INCHES ? "mils" : "mm";
double scale = GetUserUnits() == INCHES ? IU_PER_MILS : IU_PER_MM;
for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ )
{

View File

@ -832,7 +832,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
_( "Measure distance" ) );
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr );
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
view.Add( &ruler );
view.SetVisible( &ruler, false );

View File

@ -44,7 +44,7 @@ class RULER_ITEM : public EDA_ITEM
{
public:
RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr );
RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, EDA_UNITS_T userUnits );
///> @copydoc EDA_ITEM::ViewBBox()
const BOX2I ViewBBox() const override;
@ -74,6 +74,7 @@ public:
private:
const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr;
const EDA_UNITS_T m_userUnits;
};
} // PREVIEW

View File

@ -88,7 +88,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* a
aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D,
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, aParent->GetUserUnits(),
aParent->Prj().Get3DCacheManager(),
m_currentModuleCopy,
&aParent->Settings().Colors(),

View File

@ -80,7 +80,7 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP
m_currentModuleCopy = new MODULE( *aModule );
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D,
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, aParent->GetUserUnits(),
aParent->Prj().Get3DCacheManager(),
m_currentModuleCopy,
&aParent->Settings().Colors(),

View File

@ -251,14 +251,14 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
{
wxString buffer;
buffer = StringFromValue( g_UserUnit, GetDesignSettings().m_ModuleSegmentWidth );
buffer = StringFromValue( GetUserUnits(), GetDesignSettings().m_ModuleSegmentWidth );
WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );
if( dlg.ShowModal() != wxID_OK )
return; // canceled by user
buffer = dlg.GetValue( );
GetDesignSettings().m_ModuleSegmentWidth = ValueFromString( g_UserUnit, buffer );
GetDesignSettings().m_ModuleSegmentWidth = ValueFromString( GetUserUnits(), buffer );
if( aEdge )
{

View File

@ -634,7 +634,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event )
fn.SetPath( dirDialog.GetPath() );
fn.SetExt( wxT( "rpt" ) );
bool unitMM = g_UserUnit != INCHES;
bool unitMM = GetUserUnits() != INCHES;
bool success = DoGenFootprintsReport( fn.GetFullPath(), unitMM );
wxString msg;

View File

@ -266,7 +266,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
break;
}
wxString value = StringFromValue( g_UserUnit, gap_size );
wxString value = StringFromValue( GetUserUnits(), gap_size );
WX_TEXT_ENTRY_DIALOG dlg( this, msg, _( "Create microwave module" ), value );
if( dlg.ShowModal() != wxID_OK )
@ -276,7 +276,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
}
value = dlg.GetValue();
gap_size = ValueFromString( g_UserUnit, value );
gap_size = ValueFromString( GetUserUnits(), value );
bool abort = false;
@ -472,7 +472,8 @@ MWAVE_POLYGONAL_SHAPE_DLG::MWAVE_POLYGONAL_SHAPE_DLG( PCB_EDIT_FRAME* parent,
wxRA_SPECIFY_COLS );
LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize, g_UserUnit, LeftBoxSizer );
m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize, parent->GetUserUnits(),
LeftBoxSizer );
GetSizer()->SetSizeHints( this );
}
@ -721,14 +722,14 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
gap_size = next_pad->GetPos0().x - pad->GetPos0().x - pad->GetSize().x;
// Entrer the desired length of the gap.
msg = StringFromValue( g_UserUnit, gap_size );
msg = StringFromValue( GetUserUnits(), gap_size );
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Gap:" ), _( "Create Microwave Gap" ), msg );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
msg = dlg.GetValue();
gap_size = ValueFromString( g_UserUnit, msg );
gap_size = ValueFromString( GetUserUnits(), msg );
// Updating sizes of pads forming the gap.
int tw = GetDesignSettings().GetCurrentTrackWidth();

View File

@ -639,7 +639,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
return;
wxString msg;
bool mmFirst = g_UserUnit != INCHES;
bool mmFirst = GetUserUnits() != INCHES;
m_SelTrackWidthBox->Clear();
@ -679,7 +679,7 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
wxString msg;
m_SelViaSizeBox->Clear();
bool mmFirst = g_UserUnit != INCHES;
bool mmFirst = GetUserUnits() != INCHES;
for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
{

View File

@ -1175,7 +1175,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr );
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, frame()->GetUserUnits() );
view.Add( &ruler );
view.SetVisible( &ruler, false );