Add position to Eeschema's edit text dialogs.

Fixes: lp:1627467
* https://bugs.launchpad.net/kicad/+bug/1627467

(cherry picked from commit 07c7828)
This commit is contained in:
Jeff Young 2018-07-06 18:03:57 +01:00
parent 45e6dfc7af
commit 68e7a49b53
8 changed files with 1780 additions and 811 deletions

View File

@ -77,6 +77,8 @@ EDA_TEXT_VJUSTIFY_T IntToEdaTextVertJustify( int aVertJustify )
DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
const EDA_TEXT* aTextItem ) :
DIALOG_LIB_EDIT_TEXT_BASE( aParent ),
m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true, 0 )
{
SetTitle( aTitle );
@ -86,10 +88,11 @@ DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxS
m_isPower = false;
m_text = aTextItem->GetText();
m_style = aTextItem->IsItalic() ? 1 : 0;
m_style += aTextItem->IsBold() ? 2 : 0;
m_isItalic = aTextItem->IsItalic();
m_isBold = aTextItem->IsBold();
m_position = aTextItem->GetTextPos();
m_size = aTextItem->GetTextWidth();
m_orientation = ( aTextItem->GetTextAngle() == TEXT_ANGLE_VERT );
m_isVertical = ( aTextItem->GetTextAngle() == TEXT_ANGLE_VERT );
m_verticalJustification = aTextItem->GetVertJustify() + 1;
m_horizontalJustification = aTextItem->GetHorizJustify() + 1;
m_isVisible = aTextItem->IsVisible();
@ -102,9 +105,8 @@ void DIALOG_EDIT_ONE_FIELD::init()
SetInitialFocus( m_TextValue );
SCH_BASE_FRAME* parent = GetParent();
m_TextValue->SetValidator( SCH_FIELD_VALIDATOR(
parent->IsType( FRAME_SCH_LIB_EDITOR ),
m_fieldId, &m_text ) );
bool libedit = parent->IsType( FRAME_SCH_LIB_EDITOR );
m_TextValue->SetValidator( SCH_FIELD_VALIDATOR( libedit, m_fieldId, &m_text ) );
// Disable options for graphic text editing which are not needed for fields.
m_CommonConvert->Show( false );
@ -182,12 +184,15 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
m_TextValue->SetSelection( -1, -1 );
}
m_Orient->SetValue( m_orientation );
m_posX.SetValue( m_position.x );
m_posY.SetValue( m_position.y );
m_textSize.SetValue( m_size );
m_TextHJustificationOpt->SetSelection( m_horizontalJustification );
m_TextVJustificationOpt->SetSelection( m_verticalJustification );
m_orientChoice->SetSelection( m_isVertical ? 1 : 0 );
m_hAlignChoice->SetSelection( m_horizontalJustification );
m_vAlignChoice->SetSelection( m_verticalJustification );
m_visible->SetValue( m_isVisible );
m_TextShapeOpt->SetSelection( m_style );
m_italic->SetValue( m_isItalic );
m_bold->SetValue( m_isBold );
return true;
}
@ -208,12 +213,14 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
}
}
m_orientation = m_Orient->GetValue();
m_isVertical = m_orientChoice->GetSelection() == 1;
m_position = wxPoint( m_posX.GetValue(), m_posY.GetValue() );
m_size = m_textSize.GetValue();
m_horizontalJustification = m_TextHJustificationOpt->GetSelection();
m_verticalJustification = m_TextVJustificationOpt->GetSelection();
m_horizontalJustification = m_hAlignChoice->GetSelection();
m_verticalJustification = m_vAlignChoice->GetSelection();
m_isVisible = m_visible->GetValue();
m_style = m_TextShapeOpt->GetSelection();
m_isItalic = m_italic->GetValue();
m_isBold = m_bold->GetValue();
return true;
}
@ -221,11 +228,12 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
void DIALOG_EDIT_ONE_FIELD::updateText( EDA_TEXT* aText )
{
aText->SetTextPos( m_position );
aText->SetTextSize( wxSize( m_size, m_size ) );
aText->SetVisible( m_isVisible );
aText->SetTextAngle( m_orientation ? TEXT_ANGLE_VERT : TEXT_ANGLE_HORIZ );
aText->SetItalic( (m_style & 1) != 0 );
aText->SetBold( (m_style & 2) != 0 );
aText->SetTextAngle( m_isVertical ? TEXT_ANGLE_VERT : TEXT_ANGLE_HORIZ );
aText->SetItalic( m_isItalic );
aText->SetBold( m_isBold );
aText->SetHorizJustify( IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) );
aText->SetVertJustify( IntToEdaTextVertJustify( m_verticalJustification - 1 ) );
}
@ -282,21 +290,24 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
component->SetRef( aSheetPath, m_text );
}
bool modified = false;
bool positioningModified = false;
if( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_orientation )
modified = true;
if( aField->GetTextPos() != m_position )
positioningModified = true;
if( ( aField->GetHorizJustify() != IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) ) )
modified = true;
if( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_isVertical )
positioningModified = true;
if( ( aField->GetVertJustify() != IntToEdaTextVertJustify( m_verticalJustification - 1 ) ) )
modified = true;
if( aField->GetHorizJustify() != IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) )
positioningModified = true;
if( aField->GetVertJustify() != IntToEdaTextVertJustify( m_verticalJustification - 1 ) )
positioningModified = true;
aField->SetText( m_text );
updateText( aField );
if( modified )
if( positioningModified )
{
auto component = static_cast< SCH_COMPONENT* >( aField->GetParent() );
component->ClearFieldsAutoplaced();

View File

@ -77,13 +77,18 @@ protected:
*/
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) override;
UNIT_BINDER m_posX;
UNIT_BINDER m_posY;
UNIT_BINDER m_textSize;
int m_fieldId;
bool m_isPower;
wxString m_text;
int m_style;
bool m_isItalic;
bool m_isBold;
wxPoint m_position;
int m_size;
bool m_orientation;
bool m_isVertical;
int m_verticalJustification;
int m_horizontalJustification;
bool m_isVisible;

View File

@ -32,6 +32,8 @@
DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) :
DIALOG_LIB_EDIT_TEXT_BASE( aParent ),
m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true, 0 )
{
m_parent = aParent;
@ -55,32 +57,29 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
{
if( m_graphicText )
{
m_posX.SetValue( m_graphicText->GetPosition().x );
m_posY.SetValue( m_graphicText->GetPosition().y );
m_textSize.SetValue( m_graphicText->GetTextWidth() );
m_TextValue->SetValue( m_graphicText->GetText() );
m_italic->SetValue( m_graphicText->IsItalic() );
m_bold->SetValue( m_graphicText->IsBold() );
m_CommonUnit->SetValue( m_graphicText->GetUnit() == 0 );
m_CommonConvert->SetValue( m_graphicText->GetConvert() == 0 );
m_Orient->SetValue( m_graphicText->GetTextAngle() == TEXT_ANGLE_VERT );
int shape = 0;
if( m_graphicText->IsItalic() )
shape = 1;
if( m_graphicText->IsBold() )
shape |= 2;
m_TextShapeOpt->SetSelection( shape );
m_orientChoice->SetSelection( m_graphicText->GetTextAngle() == TEXT_ANGLE_HORIZ ? 0 : 1 );
switch ( m_graphicText->GetHorizJustify() )
{
case GR_TEXT_HJUSTIFY_LEFT: m_TextHJustificationOpt->SetSelection( 0 ); break;
case GR_TEXT_HJUSTIFY_CENTER: m_TextHJustificationOpt->SetSelection( 1 ); break;
case GR_TEXT_HJUSTIFY_RIGHT: m_TextHJustificationOpt->SetSelection( 2 ); break;
case GR_TEXT_HJUSTIFY_LEFT: m_hAlignChoice->SetSelection( 0 ); break;
case GR_TEXT_HJUSTIFY_CENTER: m_hAlignChoice->SetSelection( 1 ); break;
case GR_TEXT_HJUSTIFY_RIGHT: m_hAlignChoice->SetSelection( 2 ); break;
}
switch ( m_graphicText->GetVertJustify() )
{
case GR_TEXT_VJUSTIFY_TOP: m_TextVJustificationOpt->SetSelection( 0 ); break;
case GR_TEXT_VJUSTIFY_CENTER: m_TextVJustificationOpt->SetSelection( 1 ); break;
case GR_TEXT_VJUSTIFY_BOTTOM: m_TextVJustificationOpt->SetSelection( 2 ); break;
case GR_TEXT_VJUSTIFY_TOP: m_vAlignChoice->SetSelection( 0 ); break;
case GR_TEXT_VJUSTIFY_CENTER: m_vAlignChoice->SetSelection( 1 ); break;
case GR_TEXT_VJUSTIFY_BOTTOM: m_vAlignChoice->SetSelection( 2 ); break;
}
}
else
@ -89,7 +88,7 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
m_CommonUnit->SetValue( !m_parent->m_drawSpecificUnit );
m_CommonConvert->SetValue( !m_parent->m_drawSpecificConvert );
m_Orient->SetValue( m_parent->m_current_text_angle == TEXT_ANGLE_VERT );
m_orientChoice->SetSelection( m_graphicText->GetTextAngle() == TEXT_ANGLE_HORIZ ? 0 : 1 );
}
return true;
@ -98,7 +97,8 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
{
m_parent->m_current_text_angle = m_Orient->GetValue() ? TEXT_ANGLE_VERT : TEXT_ANGLE_HORIZ;
m_parent->m_current_text_angle = m_orientChoice->GetSelection() ? TEXT_ANGLE_VERT
: TEXT_ANGLE_HORIZ;
m_parent->m_textSize = m_textSize.GetValue();
m_parent->m_drawSpecificConvert = !m_CommonConvert->GetValue();
m_parent->m_drawSpecificUnit = !m_CommonUnit->GetValue();
@ -110,6 +110,7 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
else
m_graphicText->SetText( m_TextValue->GetValue() );
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
m_graphicText->SetTextSize( wxSize( m_parent->m_textSize, m_parent->m_textSize ) );
m_graphicText->SetTextAngle( m_parent->m_current_text_angle );
@ -123,17 +124,17 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
else
m_graphicText->SetConvert( 0 );
m_graphicText->SetItalic( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 );
m_graphicText->SetBold( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 );
m_graphicText->SetItalic( m_italic->GetValue() );
m_graphicText->SetBold( m_bold->GetValue() );
switch( m_TextHJustificationOpt->GetSelection() )
switch( m_hAlignChoice->GetSelection() )
{
case 0: m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); break;
case 1: m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER ); break;
case 2: m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); break;
}
switch( m_TextVJustificationOpt->GetSelection() )
switch( m_vAlignChoice->GetSelection() )
{
case 0: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); break;
case 1: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER ); break;

View File

@ -38,6 +38,9 @@ class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE
private:
LIB_EDIT_FRAME* m_parent;
LIB_TEXT* m_graphicText;
UNIT_BINDER m_posX;
UNIT_BINDER m_posY;
UNIT_BINDER m_textSize;
public:

View File

@ -27,18 +27,24 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bTextValueBoxSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bTextValueBoxSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextValue->SetMinSize( wxSize( 200,-1 ) );
bTextValueBoxSizer->Add( m_TextValue, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bTextValueBoxSizer->Add( m_TextValue, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_PowerComponentValues = new wxStaticText( this, wxID_ANY, _("(Power symbol value text cannot be modified.)"), wxDefaultPosition, wxDefaultSize, 0 );
m_PowerComponentValues->Wrap( -1 );
m_PowerComponentValues->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bTextValueBoxSizer->Add( m_PowerComponentValues, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_TextValueSelectButton = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 );
bTextValueBoxSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND, 5 );
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bPropertiesSizer->Add( bUpperBoxSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@ -46,85 +52,127 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
m_PowerComponentValues = new wxStaticText( this, wxID_ANY, _("Note: power symbol value text cannot be modified."), wxDefaultPosition, wxDefaultSize, 0 );
m_PowerComponentValues->Wrap( -1 );
m_PowerComponentValues->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizer9->Add( m_PowerComponentValues, 0, wxRIGHT|wxLEFT, 5 );
m_visible = new wxCheckBox( this, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_visible, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPropertiesSizer->Add( bSizer9, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPropertiesSizer->Add( bSizer9, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bBottomtBoxSizer;
bBottomtBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 8, 3, 3 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );
m_xPosLabel = new wxStaticText( this, wxID_ANY, _("Position X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_xPosLabel->Wrap( -1 );
fgSizer3->Add( m_xPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_xPosCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_xPosCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_xPosUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_xPosUnits->Wrap( -1 );
fgSizer3->Add( m_xPosUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
bSizer8->Add( 0, 0, 1, wxEXPAND|wxTOP, 2 );
fgSizer3->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bTextSizeSizer;
bTextSizeSizer = new wxBoxSizer( wxHORIZONTAL );
m_italic = new wxCheckBox( this, wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_italic, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_orientLabel = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_orientLabel->Wrap( -1 );
fgSizer3->Add( m_orientLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
wxString m_orientChoiceChoices[] = { _("Horizontal"), _("Vertical") };
int m_orientChoiceNChoices = sizeof( m_orientChoiceChoices ) / sizeof( wxString );
m_orientChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_orientChoiceNChoices, m_orientChoiceChoices, 0 );
m_orientChoice->SetSelection( 0 );
fgSizer3->Add( m_orientChoice, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_yPosLabel = new wxStaticText( this, wxID_ANY, _("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_yPosLabel->Wrap( -1 );
fgSizer3->Add( m_yPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_yPosCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_yPosCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_yPosUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_yPosUnits->Wrap( -1 );
fgSizer3->Add( m_yPosUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer3->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_bold = new wxCheckBox( this, wxID_ANY, _("Bold"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_bold, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
fgSizer3->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_hAlignLabel = new wxStaticText( this, wxID_ANY, _("H Align:"), wxDefaultPosition, wxDefaultSize, 0 );
m_hAlignLabel->Wrap( -1 );
fgSizer3->Add( m_hAlignLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
wxString m_hAlignChoiceChoices[] = { _("Left"), _("Center"), _("Right") };
int m_hAlignChoiceNChoices = sizeof( m_hAlignChoiceChoices ) / sizeof( wxString );
m_hAlignChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_hAlignChoiceNChoices, m_hAlignChoiceChoices, 0 );
m_hAlignChoice->SetSelection( 0 );
fgSizer3->Add( m_hAlignChoice, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
bTextSizeSizer->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
fgSizer3->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bTextSizeSizer->Add( m_textSizeCtrl, 1, wxEXPAND|wxALL, 5 );
fgSizer3->Add( m_textSizeCtrl, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits->Wrap( -1 );
bTextSizeSizer->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
fgSizer3->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
bSizer8->Add( bTextSizeSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizer3->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_visible = new wxCheckBox( this, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_visible, 0, wxALIGN_LEFT|wxBOTTOM|wxLEFT, 5 );
m_Orient = new wxCheckBox( this, wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_Orient, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer3->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
m_vAlignLabel = new wxStaticText( this, wxID_ANY, _("V Align:"), wxDefaultPosition, wxDefaultSize, 0 );
m_vAlignLabel->Wrap( -1 );
fgSizer3->Add( m_vAlignLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
wxString m_vAlignChoiceChoices[] = { _("Top"), _("Center"), _("Bottom") };
int m_vAlignChoiceNChoices = sizeof( m_vAlignChoiceChoices ) / sizeof( wxString );
m_vAlignChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_vAlignChoiceNChoices, m_vAlignChoiceChoices, 0 );
m_vAlignChoice->SetSelection( 0 );
fgSizer3->Add( m_vAlignChoice, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bPropertiesSizer->Add( fgSizer3, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bBottomtBoxSizer;
bBottomtBoxSizer = new wxBoxSizer( wxVERTICAL );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_CommonUnit, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bBottomtBoxSizer->Add( m_CommonUnit, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_CommonConvert, 0, wxALIGN_RIGHT|wxBOTTOM|wxEXPAND|wxLEFT, 5 );
bBottomtBoxSizer->Add( m_CommonConvert, 0, wxALIGN_RIGHT|wxEXPAND|wxRIGHT|wxLEFT, 5 );
bBottomtBoxSizer->Add( bSizer8, 4, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPropertiesSizer->Add( bBottomtBoxSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
bBottomtBoxSizer->Add( 0, 0, 0, wxEXPAND|wxLEFT, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold and italic") };
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Text Style"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextShapeOpt->SetSelection( 3 );
bBottomtBoxSizer->Add( m_TextShapeOpt, 3, wxALL|wxEXPAND, 5 );
wxString m_TextHJustificationOptChoices[] = { _("Align left"), _("Align center"), _("Align right") };
int m_TextHJustificationOptNChoices = sizeof( m_TextHJustificationOptChoices ) / sizeof( wxString );
m_TextHJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Horizontal Align"), wxDefaultPosition, wxDefaultSize, m_TextHJustificationOptNChoices, m_TextHJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextHJustificationOpt->SetSelection( 0 );
bBottomtBoxSizer->Add( m_TextHJustificationOpt, 3, wxALL|wxEXPAND, 5 );
wxString m_TextVJustificationOptChoices[] = { _("Align top"), _("Align center"), _("Align bottom") };
int m_TextVJustificationOptNChoices = sizeof( m_TextVJustificationOptChoices ) / sizeof( wxString );
m_TextVJustificationOpt = new wxRadioBox( this, wxID_ANY, _("Vertical Align"), wxDefaultPosition, wxDefaultSize, m_TextVJustificationOptNChoices, m_TextVJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
m_TextVJustificationOpt->SetSelection( 0 );
bBottomtBoxSizer->Add( m_TextVJustificationOpt, 3, wxALL|wxEXPAND, 5 );
bPropertiesSizer->Add( bBottomtBoxSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 6 );
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
@ -133,7 +181,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
bMainSizer->Add( m_sdbSizerButtons, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
bMainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/radiobox.h>
#include <wx/choice.h>
#include <wx/statline.h>
#include <wx/dialog.h>
@ -38,18 +38,28 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_TextValue;
wxButton* m_TextValueSelectButton;
wxStaticText* m_PowerComponentValues;
wxButton* m_TextValueSelectButton;
wxCheckBox* m_visible;
wxStaticText* m_xPosLabel;
wxTextCtrl* m_xPosCtrl;
wxStaticText* m_xPosUnits;
wxCheckBox* m_italic;
wxStaticText* m_orientLabel;
wxChoice* m_orientChoice;
wxStaticText* m_yPosLabel;
wxTextCtrl* m_yPosCtrl;
wxStaticText* m_yPosUnits;
wxCheckBox* m_bold;
wxStaticText* m_hAlignLabel;
wxChoice* m_hAlignChoice;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
wxStaticText* m_textSizeUnits;
wxCheckBox* m_visible;
wxCheckBox* m_Orient;
wxStaticText* m_vAlignLabel;
wxChoice* m_vAlignChoice;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxRadioBox* m_TextShapeOpt;
wxRadioBox* m_TextHJustificationOpt;
wxRadioBox* m_TextVJustificationOpt;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
@ -62,7 +72,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
public:
DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_EDIT_TEXT_BASE();
};

View File

@ -53,9 +53,9 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
// Editing the component value field is equivalent to creating a new component based
// on the current component. Set the dialog message to inform the user.
if( aField->GetId() == VALUE )
caption = _( "Component Name" );
caption = _( "Edit Component Name" );
else
caption.Printf( _( "Edit Field %s" ), GetChars( aField->GetName() ) );
caption.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) );
DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );