UNIT_BINDERize Pin Properties dialog.
(cherry picked from commit c609087)
This commit is contained in:
parent
52271d3195
commit
e4d9366fe4
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2016 - 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
|
||||
|
@ -25,7 +25,6 @@
|
|||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <gr_basic.h>
|
||||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <lib_edit_frame.h>
|
||||
|
@ -33,23 +32,40 @@
|
|||
#include <lib_pin.h>
|
||||
|
||||
#include <dialog_lib_edit_pin.h>
|
||||
#include <confirm.h>
|
||||
|
||||
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( EDA_DRAW_FRAME* parent, LIB_PIN* aPin ) :
|
||||
DIALOG_LIB_EDIT_PIN_BASE( parent )
|
||||
|
||||
DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin ) :
|
||||
DIALOG_LIB_EDIT_PIN_BASE( parent ),
|
||||
m_frame( parent ),
|
||||
m_pin( aPin ),
|
||||
m_posX( parent, m_posXLabel, m_posXCtrl, m_posXUnits, true ),
|
||||
m_posY( parent, m_posYLabel, m_posYCtrl, m_posYUnits, true ),
|
||||
m_pinLength( parent, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits, true, 0 ),
|
||||
m_nameSize( parent, m_nameSizeLabel, m_nameSizeCtrl, m_nameSizeUnits, true, 0 ),
|
||||
m_numberSize( parent, m_numberSizeLabel, m_numberSizeCtrl, m_numberSizeUnits, true, 0 )
|
||||
{
|
||||
// Creates a dummy pin to show on a panel, inside this dialog:
|
||||
m_dummyPin = new LIB_PIN( *aPin );
|
||||
m_dummyPin = new LIB_PIN( *m_pin );
|
||||
|
||||
// m_dummyPin changes do not propagate to other pins of the current lib component,
|
||||
// so set parent to null and clear flags
|
||||
m_dummyPin->SetParent( NULL );
|
||||
m_dummyPin->SetParent( nullptr );
|
||||
m_dummyPin->ClearFlags();
|
||||
|
||||
m_panelShowPin->SetBackgroundColour( parent->GetDrawBgColor().ToColour() );
|
||||
|
||||
// Set tab order
|
||||
m_textPadName->MoveAfterInTabOrder(m_textPinName);
|
||||
const wxArrayString& orientationNames = LIB_PIN::GetOrientationNames();
|
||||
const BITMAP_DEF* orientationBitmaps = LIB_PIN::GetOrientationSymbols();
|
||||
|
||||
for ( unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
|
||||
m_choiceOrientation->Insert( orientationNames[ii], KiBitmap( orientationBitmaps[ii] ), ii );
|
||||
|
||||
m_sdbSizerButtonsOK->SetDefault();
|
||||
SetInitialFocus( m_textPinName );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
|
||||
// On some windows manager (Unity, XFCE), this dialog is
|
||||
// not always raised, depending on this dialog is run.
|
||||
|
@ -63,17 +79,69 @@ DIALOG_LIB_EDIT_PIN::~DIALOG_LIB_EDIT_PIN()
|
|||
delete m_dummyPin;
|
||||
}
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN::OnInitDialog( wxInitDialogEvent& event )
|
||||
{
|
||||
m_textPinName->SetFocus();
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
bool DIALOG_LIB_EDIT_PIN::TransferDataToWindow()
|
||||
{
|
||||
if( !DIALOG_SHIM::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
m_choiceOrientation->SetSelection( LIB_PIN::GetOrientationIndex( m_pin->GetOrientation() ) );
|
||||
m_choiceStyle->SetSelection( m_pin->GetShape() );
|
||||
m_choiceElectricalType->SetSelection( m_pin->GetType() );
|
||||
m_textPinName->SetValue( m_pin->GetName() );
|
||||
m_nameSize.SetValue( m_pin->GetNameTextSize() );
|
||||
m_posX.SetValue( m_pin->GetPosition().x );
|
||||
m_posY.SetValue( -m_pin->GetPosition().y );
|
||||
m_textPinNumber->SetValue( m_pin->GetNumber() );
|
||||
m_numberSize.SetValue( m_pin->GetNumberTextSize() );
|
||||
m_pinLength.SetValue( m_pin->GetLength() );
|
||||
m_checkApplyToAllParts->SetValue( m_pin->GetUnit() == 0 );
|
||||
m_checkApplyToAllConversions->SetValue( m_pin->GetConvert() == 0 );
|
||||
m_checkShow->SetValue( m_pin->IsVisible() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_EDIT_PIN::TransferDataFromWindow()
|
||||
{
|
||||
if( !DIALOG_SHIM::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
const int acceptable_mingrid = 50;
|
||||
|
||||
if( ( m_posX.GetValue() % acceptable_mingrid ) || ( m_posY.GetValue() % acceptable_mingrid ) )
|
||||
{
|
||||
auto msg = wxString::Format( _( "This pin is not on a %d mils grid which will make it\n"
|
||||
"difficult to connect to in the schematic.\n"
|
||||
"Do you want to continue?" ),
|
||||
acceptable_mingrid );
|
||||
if( !IsOK( this, msg ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !m_pin->InEditMode() )
|
||||
m_frame->SaveCopyInUndoList( m_pin->GetParent() );
|
||||
|
||||
m_pin->SetName( m_textPinName->GetValue() );
|
||||
m_pin->SetNumber( m_textPinNumber->GetValue() );
|
||||
m_pin->SetNameTextSize( m_nameSize.GetValue() );
|
||||
m_pin->SetNumberTextSize( m_numberSize.GetValue() );
|
||||
m_pin->SetOrientation( LIB_PIN::GetOrientationCode( m_choiceOrientation->GetSelection() ) );
|
||||
m_pin->SetLength( m_pinLength.GetValue() );
|
||||
m_pin->SetPinPosition( wxPoint( m_posX.GetValue(), -m_posY.GetValue() ) );
|
||||
m_pin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
|
||||
m_pin->SetShape( m_choiceStyle->GetPinShapeSelection() );
|
||||
m_pin->SetConversion( m_checkApplyToAllConversions->GetValue() ? 0 : m_frame->GetConvert() );
|
||||
m_pin->SetPartNumber( m_checkApplyToAllParts->GetValue() ? 0 : m_frame->GetUnit() );
|
||||
m_pin->SetVisible( m_checkShow->GetValue() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw (on m_panelShowPin) the pin currently edited
|
||||
* accroding to current settings in dialog
|
||||
* Draw (on m_panelShowPin) the pin currently edited accroding to current settings in dialog
|
||||
*/
|
||||
void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
||||
{
|
||||
|
@ -96,80 +164,34 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
|||
// Give a 10% margin
|
||||
scale *= 0.9;
|
||||
dc.SetUserScale( scale, scale );
|
||||
|
||||
wxPoint offset = -bBox.Centre();
|
||||
|
||||
GRResetPenAndBrush( &dc );
|
||||
|
||||
// This is a flag for m_dummyPin->Draw
|
||||
uintptr_t flags = uintptr_t( PIN_DRAW_TEXTS | PIN_DRAW_DANGLING );
|
||||
|
||||
m_dummyPin->Draw( NULL, &dc, offset, COLOR4D::UNSPECIFIED, GR_COPY,
|
||||
(void*)flags, DefaultTransform );
|
||||
m_dummyPin->Draw( nullptr, &dc, -bBox.Centre(), COLOR4D::UNSPECIFIED, GR_COPY, (void*)flags,
|
||||
DefaultTransform );
|
||||
|
||||
m_dummyPin->SetParent(NULL);
|
||||
m_dummyPin->SetParent( nullptr );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN::OnCloseDialog( wxCloseEvent& event )
|
||||
{
|
||||
EndModal( wxID_CANCEL );
|
||||
}
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN::OnCancelButtonClick( wxCommandEvent& event )
|
||||
{
|
||||
EndModal( wxID_CANCEL );
|
||||
}
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event )
|
||||
{
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
// Called when a pin properties changes
|
||||
void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
|
||||
{
|
||||
if( ! IsShown() ) // do nothing at init time
|
||||
if( !IsShown() ) // do nothing at init time
|
||||
return;
|
||||
|
||||
int pinNameSize = ValueFromString( m_units, GetPinNameTextSize() );
|
||||
int pinNumSize = ValueFromString( m_units, GetPadNameTextSize());
|
||||
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
|
||||
int pinLength = ValueFromString( m_units, GetLength() );
|
||||
GRAPHIC_PINSHAPE pinShape = GetStyle();
|
||||
ELECTRICAL_PINTYPE pinType = GetElectricalType();
|
||||
|
||||
m_dummyPin->SetName( GetPinName() );
|
||||
m_dummyPin->SetNameTextSize( pinNameSize );
|
||||
m_dummyPin->SetNumber( GetPadName() );
|
||||
m_dummyPin->SetNumberTextSize( pinNumSize );
|
||||
m_dummyPin->SetOrientation( pinOrient );
|
||||
m_dummyPin->SetLength( pinLength );
|
||||
m_dummyPin->SetShape( pinShape );
|
||||
m_dummyPin->SetVisible( GetVisible() );
|
||||
m_dummyPin->SetType( pinType );
|
||||
m_dummyPin->SetName( m_textPinName->GetValue() );
|
||||
m_dummyPin->SetNumber( m_textPinNumber->GetValue() );
|
||||
m_dummyPin->SetNameTextSize( m_nameSize.GetValue() );
|
||||
m_dummyPin->SetNumberTextSize( m_numberSize.GetValue() );
|
||||
m_dummyPin->SetOrientation( LIB_PIN::GetOrientationCode( m_choiceOrientation->GetSelection() ) );
|
||||
m_dummyPin->SetLength( m_pinLength.GetValue() );
|
||||
m_dummyPin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
|
||||
m_dummyPin->SetShape( m_choiceStyle->GetPinShapeSelection() );
|
||||
m_dummyPin->SetVisible( m_checkShow->GetValue() );
|
||||
|
||||
m_panelShowPin->Refresh();
|
||||
}
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN::SetDlgUnitsLabel( const wxString& units )
|
||||
{
|
||||
m_staticNameTextSizeUnits->SetLabel( units );
|
||||
m_staticNumberTextSizeUnits->SetLabel( units );
|
||||
m_staticLengthUnits->SetLabel( units );
|
||||
m_staticPosXUnits->SetLabel( units );
|
||||
m_staticPosYUnits->SetLabel( units );
|
||||
}
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN::SetOrientationList( const wxArrayString& list,
|
||||
const BITMAP_DEF* aBitmaps )
|
||||
{
|
||||
for ( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
||||
{
|
||||
if( aBitmaps == NULL )
|
||||
m_choiceOrientation->Append( list[ii] );
|
||||
else
|
||||
m_choiceOrientation->Insert( list[ii], KiBitmap( aBitmaps[ii] ), ii );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,130 +25,38 @@
|
|||
#ifndef __dialog_lib_edit_pin__
|
||||
#define __dialog_lib_edit_pin__
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Subclass of DIALOG_LIB_EDIT_PIN_BASE, which is generated by wxFormBuilder.
|
||||
*/
|
||||
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <pin_shape_combobox.h>
|
||||
#include <pin_type_combobox.h>
|
||||
|
||||
#include <dialog_lib_edit_pin_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_edit_frame.h>
|
||||
|
||||
/** Implementing DIALOG_LIB_EDIT_PIN_BASE */
|
||||
class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
|
||||
{
|
||||
LIB_PIN * m_dummyPin; // a working copy used to show changes
|
||||
LIB_EDIT_FRAME* m_frame;
|
||||
LIB_PIN* m_pin;
|
||||
LIB_PIN* m_dummyPin; // a working copy used to show changes
|
||||
|
||||
UNIT_BINDER m_posX;
|
||||
UNIT_BINDER m_posY;
|
||||
UNIT_BINDER m_pinLength;
|
||||
UNIT_BINDER m_nameSize;
|
||||
UNIT_BINDER m_numberSize;
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
DIALOG_LIB_EDIT_PIN( EDA_DRAW_FRAME* parent, LIB_PIN* aPin );
|
||||
~DIALOG_LIB_EDIT_PIN();
|
||||
DIALOG_LIB_EDIT_PIN( LIB_EDIT_FRAME* parent, LIB_PIN* aPin );
|
||||
~DIALOG_LIB_EDIT_PIN() override;
|
||||
|
||||
void OnInitDialog( wxInitDialogEvent& event) override;
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
void OnCloseDialog( wxCloseEvent& event ) override;
|
||||
void OnCancelButtonClick( wxCommandEvent& event ) override;
|
||||
void OnOKButtonClick( wxCommandEvent& event ) override;
|
||||
void OnPaintShowPanel( wxPaintEvent& event ) override;
|
||||
void OnPropertiesChange( wxCommandEvent& event ) override;
|
||||
|
||||
void SetOrientationList( const wxArrayString& list, const BITMAP_DEF* aBitmaps );
|
||||
void SetOrientation( int orientation )
|
||||
{
|
||||
m_choiceOrientation->SetSelection( orientation );
|
||||
}
|
||||
int GetOrientation( void ) { return m_choiceOrientation->GetSelection(); }
|
||||
|
||||
void SetElectricalType( ELECTRICAL_PINTYPE type )
|
||||
{
|
||||
m_choiceElectricalType->SetSelection( type );
|
||||
}
|
||||
|
||||
ELECTRICAL_PINTYPE GetElectricalType( void )
|
||||
{
|
||||
return m_choiceElectricalType->GetPinTypeSelection();
|
||||
}
|
||||
|
||||
void SetStyle( GRAPHIC_PINSHAPE style ) { m_choiceStyle->SetSelection( style ); }
|
||||
GRAPHIC_PINSHAPE GetStyle( void ) { return m_choiceStyle->GetPinShapeSelection(); }
|
||||
|
||||
void SetPinName( const wxString& name ) { m_textPinName->SetValue( name ); }
|
||||
wxString GetPinName( void ) { return m_textPinName->GetValue(); }
|
||||
|
||||
void SetPinNameTextSize( const wxString& size )
|
||||
{
|
||||
m_textPinNameTextSize->SetValue( size );
|
||||
}
|
||||
wxString GetPinNameTextSize( void )
|
||||
{
|
||||
return m_textPinNameTextSize->GetValue();
|
||||
}
|
||||
|
||||
void SetPinPositionX( const wxString& aSize )
|
||||
{
|
||||
m_textPinPosX->SetValue( aSize );
|
||||
}
|
||||
|
||||
void SetPinPositionY( const wxString& aSize )
|
||||
{
|
||||
m_textPinPosY->SetValue( aSize );
|
||||
}
|
||||
|
||||
wxString GetPinPositionX()
|
||||
{
|
||||
return m_textPinPosX->GetValue();
|
||||
}
|
||||
|
||||
wxString GetPinPositionY()
|
||||
{
|
||||
return m_textPinPosY->GetValue();
|
||||
}
|
||||
|
||||
void SetPadName( const wxString& number )
|
||||
{
|
||||
m_textPadName->SetValue( number );
|
||||
}
|
||||
wxString GetPadName( void ) { return m_textPadName->GetValue(); }
|
||||
|
||||
void SetPadNameTextSize( const wxString& size )
|
||||
{
|
||||
m_textPadNameTextSize->SetValue( size );
|
||||
}
|
||||
wxString GetPadNameTextSize( void )
|
||||
{
|
||||
return m_textPadNameTextSize->GetValue();
|
||||
}
|
||||
|
||||
void SetLength( const wxString& length )
|
||||
{
|
||||
m_textLength->SetValue( length );
|
||||
}
|
||||
wxString GetLength( void ) { return m_textLength->GetValue(); }
|
||||
|
||||
void SetAddToAllParts( bool apply )
|
||||
{
|
||||
m_checkApplyToAllParts->SetValue( apply );
|
||||
}
|
||||
bool GetAddToAllParts( void )
|
||||
{
|
||||
return m_checkApplyToAllParts->GetValue();
|
||||
}
|
||||
|
||||
void SetAddToAllBodyStyles( bool apply )
|
||||
{
|
||||
m_checkApplyToAllConversions->SetValue( apply );
|
||||
}
|
||||
bool GetAddToAllBodyStyles( void )
|
||||
{
|
||||
return m_checkApplyToAllConversions->GetValue();
|
||||
}
|
||||
|
||||
void SetDlgUnitsLabel( const wxString& units );
|
||||
|
||||
void SetVisible( bool visible ) { m_checkShow->SetValue( visible ); }
|
||||
bool GetVisible( void ) { return m_checkShow->GetValue(); }
|
||||
};
|
||||
|
||||
#endif // __dialog_lib_edit_pin__
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 19 2018)
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -26,151 +26,136 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
|||
wxBoxSizer* bLeftSizer;
|
||||
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerPins;
|
||||
fgSizerPins = new wxFlexGridSizer( 5, 2, 0, 0 );
|
||||
fgSizerPins->AddGrowableCol( 1 );
|
||||
fgSizerPins->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerPins->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
|
||||
wxGridBagSizer* gbSizer1;
|
||||
gbSizer1 = new wxGridBagSizer( 1, 0 );
|
||||
gbSizer1->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_staticTextPinName = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPinName->Wrap( -1 );
|
||||
fgSizerPins->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
m_pinNameLabel = new wxStaticText( this, wxID_ANY, _("Pin &name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinNameLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinNameLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerPins->Add( m_textPinName, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||
gbSizer1->Add( m_textPinName, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPadName->Wrap( -1 );
|
||||
m_staticTextPadName->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
|
||||
m_pinNumberLabel = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinNumberLabel->Wrap( -1 );
|
||||
m_pinNumberLabel->SetToolTip( _("Pin number: 1 to 4 ASCII letters and/or digits") );
|
||||
|
||||
fgSizerPins->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
gbSizer1->Add( m_pinNumberLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerPins->Add( m_textPadName, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||
|
||||
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOrient->Wrap( -1 );
|
||||
fgSizerPins->Add( m_staticTextOrient, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
fgSizerPins->Add( m_choiceOrientation, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
m_textPinNumber = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textPinNumber, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextEType->Wrap( -1 );
|
||||
m_staticTextEType->SetToolTip( _("Used by the ERC.") );
|
||||
|
||||
fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
gbSizer1->Add( m_staticTextEType, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_choiceElectricalType = new PinTypeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
gbSizer1->Add( m_choiceElectricalType, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextGstyle->Wrap( -1 );
|
||||
fgSizerPins->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
gbSizer1->Add( m_staticTextGstyle, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_choiceStyle = new PinShapeComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
gbSizer1->Add( m_choiceStyle, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_posXLabel = new wxStaticText( this, wxID_ANY, _("X position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posXLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_posXLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_posXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posXCtrl->SetMinSize( wxSize( 110,-1 ) );
|
||||
|
||||
gbSizer1->Add( m_posXCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_posXUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posXUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_posXUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_posYLabel = new wxStaticText( this, wxID_ANY, _("Y position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posYLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_posYLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_posYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_posYCtrl, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_posYUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_posYUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_posYUnits, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextOrient->Wrap( -1 );
|
||||
gbSizer1->Add( m_staticTextOrient, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
gbSizer1->Add( m_choiceOrientation, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_pinLengthLabel = new wxStaticText( this, ID_M_STATICTEXTPINLEN, _("Pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinLengthLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinLengthLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_pinLengthCtrl = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_pinLengthCtrl, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_pinLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_pinLengthUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_pinLengthUnits, wxGBPosition( 7, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_nameSizeLabel = new wxStaticText( this, ID_M_STATICTEXTNAMESIZE, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_nameSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_nameSizeLabel, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
|
||||
|
||||
m_nameSizeCtrl = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_nameSizeCtrl, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
m_nameSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_nameSizeUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_nameSizeUnits, wxGBPosition( 8, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_numberSizeLabel = new wxStaticText( this, ID_M_STATICTEXTPADNAMESIZE, _("Number te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_numberSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_numberSizeLabel, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_numberSizeCtrl = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_numberSizeCtrl, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_numberSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_numberSizeUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_numberSizeUnits, wxGBPosition( 9, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bLeftSizer->Add( fgSizerPins, 0, wxALL|wxEXPAND, 5 );
|
||||
gbSizer1->AddGrowableCol( 1 );
|
||||
|
||||
wxBoxSizer* boarderSizer;
|
||||
boarderSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerPinSharing;
|
||||
sbSizerPinSharing = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Sharing:") ), wxVERTICAL );
|
||||
|
||||
m_checkApplyToAllParts = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizerPinSharing->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
m_checkApplyToAllConversions = new wxCheckBox( sbSizerPinSharing->GetStaticBox(), wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizerPinSharing->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
bLeftSizer->Add( gbSizer1, 1, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
boarderSizer->Add( sbSizerPinSharing, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerSchematicProperties;
|
||||
sbSizerSchematicProperties = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Schematic Properties:") ), wxVERTICAL );
|
||||
|
||||
m_checkShow = new wxCheckBox( sbSizerSchematicProperties->GetStaticBox(), wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkShow->SetValue(true);
|
||||
sbSizerSchematicProperties->Add( m_checkShow, 0, wxALL, 3 );
|
||||
|
||||
|
||||
boarderSizer->Add( sbSizerSchematicProperties, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
bLeftSizer->Add( boarderSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 12 );
|
||||
|
||||
|
||||
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
|
||||
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bRightSizer;
|
||||
bRightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerTextsSizes;
|
||||
fgSizerTextsSizes = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizerTextsSizes->AddGrowableCol( 1 );
|
||||
fgSizerTextsSizes->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerTextsSizes->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL );
|
||||
wxBoxSizer* checkboxesSizer;
|
||||
checkboxesSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextNameSize = new wxStaticText( this, ID_M_STATICTEXTNAMESIZE, _("N&ame text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextNameSize->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticTextNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
checkboxesSizer->Add( m_checkApplyToAllParts, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
m_textPinNameTextSize = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerTextsSizes->Add( m_textPinNameTextSize, 1, wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||
|
||||
m_staticNameTextSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticNameTextSizeUnits->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticNameTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
m_staticTextPadNameSize = new wxStaticText( this, ID_M_STATICTEXTPADNAMESIZE, _("Number te&xt size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPadNameSize->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticTextPadNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
m_textPadNameTextSize = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerTextsSizes->Add( m_textPadNameTextSize, 0, wxEXPAND|wxTOP, 3 );
|
||||
|
||||
m_staticNumberTextSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticNumberTextSizeUnits->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticNumberTextSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
m_staticTextPinLen = new wxStaticText( this, ID_M_STATICTEXTPINLEN, _("&Length:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPinLen->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticTextPinLen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerTextsSizes->Add( m_textLength, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticLengthUnits->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticLengthUnits, 0, wxALL, 5 );
|
||||
|
||||
m_staticTextPinPosX = new wxStaticText( this, wxID_ANY, _("Pin Pos X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextPinPosX->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticTextPinPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textPinPosX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerTextsSizes->Add( m_textPinPosX, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_staticPosXUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticPosXUnits->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticPosXUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_staticPinPosY = new wxStaticText( this, wxID_ANY, _("Pin Pos Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticPinPosY->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticPinPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textPinPosY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerTextsSizes->Add( m_textPinPosY, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_staticPosYUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticPosYUnits->Wrap( -1 );
|
||||
fgSizerTextsSizes->Add( m_staticPosYUnits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
checkboxesSizer->Add( m_checkApplyToAllConversions, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||
|
||||
|
||||
bRightSizer->Add( fgSizerTextsSizes, 0, wxALL|wxEXPAND, 5 );
|
||||
checkboxesSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_checkShow = new wxCheckBox( this, wxID_ANY, _("&Visible"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_checkShow->SetValue(true);
|
||||
checkboxesSizer->Add( m_checkShow, 0, wxALL, 3 );
|
||||
|
||||
|
||||
bRightSizer->Add( checkboxesSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_panelShowPin = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
||||
m_panelShowPin->SetMinSize( wxSize( 150,150 ) );
|
||||
|
@ -178,7 +163,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
|||
bRightSizer->Add( m_panelShowPin, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bUpperSizer->Add( bRightSizer, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
bUpperSizer->Add( bRightSizer, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
mainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
|
||||
|
@ -203,42 +188,34 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
|||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCloseDialog ) );
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnInitDialog ) );
|
||||
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPadName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPinNumber->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceElectricalType->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_pinLengthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_nameSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_numberSizeCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPinNameTextSize->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPadNameTextSize->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textLength->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
|
||||
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCancelButtonClick ), NULL, this );
|
||||
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnOKButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_LIB_EDIT_PIN_BASE::~DIALOG_LIB_EDIT_PIN_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCloseDialog ) );
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnInitDialog ) );
|
||||
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPadName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPinNumber->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceElectricalType->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_pinLengthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_nameSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_numberSizeCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPinNameTextSize->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textPadNameTextSize->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_textLength->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnPaintShowPanel ), NULL, this );
|
||||
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnCancelButtonClick ), NULL, this );
|
||||
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_PIN_BASE::OnOKButtonClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 19 2018)
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -24,9 +24,9 @@ class wxBitmapComboBox;
|
|||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/button.h>
|
||||
|
@ -47,45 +47,45 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
|
|||
ID_M_TEXTPINNAME = 1000,
|
||||
ID_M_STATICTEXTPADNAME,
|
||||
ID_M_TEXTPADNAME,
|
||||
ID_M_STATICTEXTPINLEN,
|
||||
ID_M_TEXTLENGTH,
|
||||
ID_M_STATICLENGTHUNITS,
|
||||
ID_M_STATICTEXTNAMESIZE,
|
||||
ID_M_TEXTPINNAMETEXTSIZE,
|
||||
ID_M_STATICNAMETEXTSIZEUNITS,
|
||||
ID_M_STATICTEXTPADNAMESIZE,
|
||||
ID_M_TEXTPADNAMETEXTSIZE,
|
||||
ID_M_STATICNUMBERTEXTSIZEUNITS,
|
||||
ID_M_STATICTEXTPINLEN,
|
||||
ID_M_TEXTLENGTH,
|
||||
ID_M_STATICLENGTHUNITS
|
||||
ID_M_STATICNUMBERTEXTSIZEUNITS
|
||||
};
|
||||
|
||||
wxStaticText* m_staticTextPinName;
|
||||
wxStaticText* m_pinNameLabel;
|
||||
wxTextCtrl* m_textPinName;
|
||||
wxStaticText* m_staticTextPadName;
|
||||
wxTextCtrl* m_textPadName;
|
||||
wxStaticText* m_staticTextOrient;
|
||||
wxBitmapComboBox* m_choiceOrientation;
|
||||
wxStaticText* m_pinNumberLabel;
|
||||
wxTextCtrl* m_textPinNumber;
|
||||
wxStaticText* m_staticTextEType;
|
||||
PinTypeComboBox* m_choiceElectricalType;
|
||||
wxStaticText* m_staticTextGstyle;
|
||||
PinShapeComboBox* m_choiceStyle;
|
||||
wxStaticText* m_posXLabel;
|
||||
wxTextCtrl* m_posXCtrl;
|
||||
wxStaticText* m_posXUnits;
|
||||
wxStaticText* m_posYLabel;
|
||||
wxTextCtrl* m_posYCtrl;
|
||||
wxStaticText* m_posYUnits;
|
||||
wxStaticText* m_staticTextOrient;
|
||||
wxBitmapComboBox* m_choiceOrientation;
|
||||
wxStaticText* m_pinLengthLabel;
|
||||
wxTextCtrl* m_pinLengthCtrl;
|
||||
wxStaticText* m_pinLengthUnits;
|
||||
wxStaticText* m_nameSizeLabel;
|
||||
wxTextCtrl* m_nameSizeCtrl;
|
||||
wxStaticText* m_nameSizeUnits;
|
||||
wxStaticText* m_numberSizeLabel;
|
||||
wxTextCtrl* m_numberSizeCtrl;
|
||||
wxStaticText* m_numberSizeUnits;
|
||||
wxCheckBox* m_checkApplyToAllParts;
|
||||
wxCheckBox* m_checkApplyToAllConversions;
|
||||
wxCheckBox* m_checkShow;
|
||||
wxStaticText* m_staticTextNameSize;
|
||||
wxTextCtrl* m_textPinNameTextSize;
|
||||
wxStaticText* m_staticNameTextSizeUnits;
|
||||
wxStaticText* m_staticTextPadNameSize;
|
||||
wxTextCtrl* m_textPadNameTextSize;
|
||||
wxStaticText* m_staticNumberTextSizeUnits;
|
||||
wxStaticText* m_staticTextPinLen;
|
||||
wxTextCtrl* m_textLength;
|
||||
wxStaticText* m_staticLengthUnits;
|
||||
wxStaticText* m_staticTextPinPosX;
|
||||
wxTextCtrl* m_textPinPosX;
|
||||
wxStaticText* m_staticPosXUnits;
|
||||
wxStaticText* m_staticPinPosY;
|
||||
wxTextCtrl* m_textPinPosY;
|
||||
wxStaticText* m_staticPosYUnits;
|
||||
wxPanel* m_panelShowPin;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
||||
|
@ -93,12 +93,8 @@ class DIALOG_LIB_EDIT_PIN_BASE : public DIALOG_SHIM
|
|||
wxButton* m_sdbSizerButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -99,37 +99,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
|
|||
STATUS_FLAGS item_flags = GetDrawItem()->GetFlags(); // save flags to restore them after editing
|
||||
LIB_PIN* pin = (LIB_PIN*) GetDrawItem();
|
||||
|
||||
pin->EnableEditMode( true, !SynchronizePins() );
|
||||
|
||||
DIALOG_LIB_EDIT_PIN dlg( this, pin );
|
||||
|
||||
wxString units = GetUnitsLabel( g_UserUnit );
|
||||
dlg.SetDlgUnitsLabel( units );
|
||||
|
||||
dlg.SetOrientationList( LIB_PIN::GetOrientationNames(), LIB_PIN::GetOrientationSymbols() );
|
||||
dlg.SetOrientation( LIB_PIN::GetOrientationIndex( pin->GetOrientation() ) );
|
||||
dlg.SetStyle( pin->GetShape() );
|
||||
dlg.SetElectricalType( pin->GetType() );
|
||||
dlg.SetPinName( pin->GetName() );
|
||||
dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
|
||||
dlg.SetPinPositionX( StringFromValue( g_UserUnit, pin->GetPosition().x ) );
|
||||
dlg.SetPinPositionY( StringFromValue( g_UserUnit, -pin->GetPosition().y ) );
|
||||
dlg.SetPadName( pin->GetNumber() );
|
||||
dlg.SetPadNameTextSize( StringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
|
||||
|
||||
dlg.SetLength( StringFromValue( g_UserUnit, pin->GetLength() ) );
|
||||
dlg.SetAddToAllParts( pin->GetUnit() == 0 );
|
||||
dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 );
|
||||
dlg.SetVisible( pin->IsVisible() );
|
||||
|
||||
/* 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() );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
{
|
||||
if( pin->IsNew() )
|
||||
|
@ -140,54 +113,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
// Test the pin position validity: to avoid issues in schematic,
|
||||
// it must be on a 50 mils grid
|
||||
wxPoint pinpos;
|
||||
pinpos.x = ValueFromString( g_UserUnit, dlg.GetPinPositionX() );
|
||||
pinpos.y = -ValueFromString( g_UserUnit, dlg.GetPinPositionY() );
|
||||
const int acceptable_mingrid = 50;
|
||||
|
||||
if( (pinpos.x % acceptable_mingrid) || (pinpos.y % acceptable_mingrid) )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "This pin is not on a %d mils grid\n"
|
||||
"It will be not easy to connect in schematic\n"
|
||||
"Do you want to continue?"), acceptable_mingrid );
|
||||
|
||||
if( !IsOK( this, msg ) )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Save the pin properties to use for the next new pin.
|
||||
LastPinNameSize = ValueFromString( g_UserUnit, dlg.GetPinNameTextSize() );
|
||||
LastPinNumSize = ValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
|
||||
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
|
||||
LastPinLength = ValueFromString( g_UserUnit, dlg.GetLength() );
|
||||
LastPinShape = dlg.GetStyle();
|
||||
LastPinType = dlg.GetElectricalType();
|
||||
LastPinCommonConvert = dlg.GetAddToAllBodyStyles();
|
||||
LastPinCommonUnit = dlg.GetAddToAllParts();
|
||||
LastPinVisible = dlg.GetVisible();
|
||||
|
||||
if( !pin->InEditMode() )
|
||||
SaveCopyInUndoList( pin->GetParent() );
|
||||
|
||||
pin->EnableEditMode( true, SynchronizePins()? false : true );
|
||||
pin->SetName( dlg.GetPinName() );
|
||||
pin->SetNameTextSize( GetLastPinNameSize() );
|
||||
pin->SetNumber( dlg.GetPadName() );
|
||||
pin->SetNumberTextSize( GetLastPinNumSize() );
|
||||
pin->SetOrientation( LastPinOrient );
|
||||
pin->SetLength( GetLastPinLength() );
|
||||
pin->SetPinPosition( pinpos );
|
||||
|
||||
pin->SetType( LastPinType );
|
||||
pin->SetShape( LastPinShape );
|
||||
pin->SetConversion( ( LastPinCommonConvert ) ? 0 : m_convert );
|
||||
pin->SetPartNumber( ( LastPinCommonUnit ) ? 0 : m_unit );
|
||||
pin->SetVisible( LastPinVisible );
|
||||
|
||||
if( pin->IsModified() || pin->IsNew() )
|
||||
{
|
||||
OnModify( );
|
||||
|
@ -203,6 +128,17 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
|
|||
// Restore pin flags, that can be changed by the dialog editor
|
||||
pin->ClearFlags();
|
||||
pin->SetFlags( item_flags );
|
||||
|
||||
// Save the pin properties to use for the next new pin.
|
||||
LastPinNameSize = pin->GetNameTextSize();
|
||||
LastPinNumSize = pin->GetNumberTextSize();
|
||||
LastPinOrient = pin->GetOrientation();
|
||||
LastPinLength = pin->GetLength();
|
||||
LastPinShape = pin->GetShape();
|
||||
LastPinType = pin->GetType();
|
||||
LastPinCommonConvert = pin->GetConvert() == 0;
|
||||
LastPinCommonUnit = pin->GetUnit() == 0;
|
||||
LastPinVisible = pin->IsVisible();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue