UNIT_BINDERize eeschema's plot and text edit dialogs.
(cherry picked from commit 298ea70)
This commit is contained in:
parent
e4d9366fe4
commit
06bf958bf1
|
@ -41,6 +41,21 @@ namespace numEval
|
||||||
|
|
||||||
} /* namespace numEval */
|
} /* namespace numEval */
|
||||||
|
|
||||||
|
|
||||||
|
#define VAR 1
|
||||||
|
#define ASSIGN 2
|
||||||
|
#define SEMCOL 3
|
||||||
|
#define PLUS 4
|
||||||
|
#define MINUS 5
|
||||||
|
#define UNIT 6
|
||||||
|
#define DIVIDE 7
|
||||||
|
#define MULT 8
|
||||||
|
#define ENDS 9
|
||||||
|
#define VALUE 10
|
||||||
|
#define PARENL 11
|
||||||
|
#define PARENR 12
|
||||||
|
|
||||||
|
|
||||||
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils )
|
NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils )
|
||||||
{
|
{
|
||||||
struct lconv* lc = localeconv();
|
struct lconv* lc = localeconv();
|
||||||
|
|
|
@ -30,11 +30,9 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <base_units.h>
|
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
|
|
||||||
#include <general.h>
|
|
||||||
#include <sch_base_frame.h>
|
#include <sch_base_frame.h>
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
|
@ -78,7 +76,8 @@ EDA_TEXT_VJUSTIFY_T IntToEdaTextVertJustify( int aVertJustify )
|
||||||
|
|
||||||
DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||||
const EDA_TEXT* aTextItem ) :
|
const EDA_TEXT* aTextItem ) :
|
||||||
DIALOG_LIB_EDIT_TEXT_BASE( aParent )
|
DIALOG_LIB_EDIT_TEXT_BASE( aParent ),
|
||||||
|
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true, 0 )
|
||||||
{
|
{
|
||||||
SetTitle( aTitle );
|
SetTitle( aTitle );
|
||||||
|
|
||||||
|
@ -101,8 +100,8 @@ void DIALOG_EDIT_ONE_FIELD::init()
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
m_TextValue->SetFocus();
|
SetInitialFocus( m_TextValue );
|
||||||
SCH_BASE_FRAME* parent = static_cast<SCH_BASE_FRAME*>( GetParent() );
|
SCH_BASE_FRAME* parent = GetParent();
|
||||||
m_TextValue->SetValidator( SCH_FIELD_VALIDATOR(
|
m_TextValue->SetValidator( SCH_FIELD_VALIDATOR(
|
||||||
parent->IsType( FRAME_SCH_LIB_EDITOR ),
|
parent->IsType( FRAME_SCH_LIB_EDITOR ),
|
||||||
m_fieldId, &m_text ) );
|
m_fieldId, &m_text ) );
|
||||||
|
@ -112,20 +111,7 @@ void DIALOG_EDIT_ONE_FIELD::init()
|
||||||
m_CommonUnit->Show( false );
|
m_CommonUnit->Show( false );
|
||||||
|
|
||||||
// Show the footprint selection dialog if this is the footprint field.
|
// Show the footprint selection dialog if this is the footprint field.
|
||||||
if( m_fieldId == FOOTPRINT )
|
m_TextValueSelectButton->Show( m_fieldId == FOOTPRINT );
|
||||||
{
|
|
||||||
m_TextValueSelectButton->Show();
|
|
||||||
m_TextValueSelectButton->Enable();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_TextValueSelectButton->Hide();
|
|
||||||
m_TextValueSelectButton->Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
|
|
||||||
m_TextSizeText->SetLabel( msg );
|
|
||||||
|
|
||||||
|
|
||||||
// Value fields of power components cannot be modified. This will grey out
|
// Value fields of power components cannot be modified. This will grey out
|
||||||
// the text box and display an explanation.
|
// the text box and display an explanation.
|
||||||
|
@ -171,15 +157,13 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
if( m_text.find_first_of( '?' ) != m_text.npos )
|
if( m_text.find_first_of( '?' ) != m_text.npos )
|
||||||
{
|
{
|
||||||
m_TextValue->SetSelection( m_text.find_first_of( '?' ),
|
m_TextValue->SetSelection( m_text.find_first_of( '?' ), m_text.find_last_of( '?' ) + 1 );
|
||||||
m_text.find_last_of( '?' ) + 1 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString num = m_text;
|
wxString num = m_text;
|
||||||
|
|
||||||
while( !num.IsEmpty() && ( !isdigit( num.Last() ) ||
|
while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) )
|
||||||
!isdigit( num.GetChar( 0 ) ) ) )
|
|
||||||
{
|
{
|
||||||
if( !isdigit( num.Last() ) )
|
if( !isdigit( num.Last() ) )
|
||||||
num.RemoveLast();
|
num.RemoveLast();
|
||||||
|
@ -187,8 +171,7 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
num = num.Right( num.Length() - 1);
|
num = num.Right( num.Length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TextValue->SetSelection( m_text.Find( num ),
|
m_TextValue->SetSelection( m_text.Find( num ), m_text.Find( num ) + num.Length() );
|
||||||
m_text.Find( num ) + num.Length() );
|
|
||||||
|
|
||||||
if( num.IsEmpty() )
|
if( num.IsEmpty() )
|
||||||
m_TextValue->SetSelection( -1, -1 );
|
m_TextValue->SetSelection( -1, -1 );
|
||||||
|
@ -200,10 +183,10 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Orient->SetValue( m_orientation );
|
m_Orient->SetValue( m_orientation );
|
||||||
m_TextSize->SetValue( StringFromValue( g_UserUnit, m_size ) );
|
m_textSize.SetValue( m_size );
|
||||||
m_TextHJustificationOpt->SetSelection( m_horizontalJustification );
|
m_TextHJustificationOpt->SetSelection( m_horizontalJustification );
|
||||||
m_TextVJustificationOpt->SetSelection( m_verticalJustification );
|
m_TextVJustificationOpt->SetSelection( m_verticalJustification );
|
||||||
m_Invisible->SetValue( !m_isVisible );
|
m_visible->SetValue( m_isVisible );
|
||||||
m_TextShapeOpt->SetSelection( m_style );
|
m_TextShapeOpt->SetSelection( m_style );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -226,10 +209,10 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_orientation = m_Orient->GetValue();
|
m_orientation = m_Orient->GetValue();
|
||||||
m_size = ValueFromString( g_UserUnit, m_TextSize->GetValue() );
|
m_size = m_textSize.GetValue();
|
||||||
m_horizontalJustification = m_TextHJustificationOpt->GetSelection();
|
m_horizontalJustification = m_TextHJustificationOpt->GetSelection();
|
||||||
m_verticalJustification = m_TextVJustificationOpt->GetSelection();
|
m_verticalJustification = m_TextVJustificationOpt->GetSelection();
|
||||||
m_isVisible = !m_Invisible->GetValue();
|
m_isVisible = m_visible->GetValue();
|
||||||
m_style = m_TextShapeOpt->GetSelection();
|
m_style = m_TextShapeOpt->GetSelection();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -270,7 +253,7 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
|
||||||
|
|
||||||
const SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
|
const SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
|
||||||
|
|
||||||
wxASSERT_MSG( component != NULL && component->Type() == SCH_COMPONENT_T,
|
wxASSERT_MSG( component && component->Type() == SCH_COMPONENT_T,
|
||||||
wxT( "Invalid schematic field parent item." ) );
|
wxT( "Invalid schematic field parent item." ) );
|
||||||
|
|
||||||
// The library symbol may have been removed so using SCH_COMPONENT::GetPartRef() here
|
// The library symbol may have been removed so using SCH_COMPONENT::GetPartRef() here
|
||||||
|
@ -287,32 +270,28 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
|
||||||
|
|
||||||
void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath )
|
void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath )
|
||||||
{
|
{
|
||||||
wxASSERT( aField != NULL || aField->Type() != SCH_FIELD_T );
|
|
||||||
|
|
||||||
if( aField->GetId() == REFERENCE )
|
if( aField->GetId() == REFERENCE )
|
||||||
{
|
{
|
||||||
wxASSERT( aSheetPath != NULL );
|
wxASSERT( aSheetPath );
|
||||||
|
|
||||||
SCH_COMPONENT* component = dynamic_cast< SCH_COMPONENT* >( aField->GetParent() );
|
SCH_COMPONENT* component = dynamic_cast< SCH_COMPONENT* >( aField->GetParent() );
|
||||||
|
|
||||||
wxASSERT( component != NULL );
|
wxASSERT( component );
|
||||||
|
|
||||||
if( component != NULL )
|
if( component )
|
||||||
component->SetRef( aSheetPath, m_text );
|
component->SetRef( aSheetPath, m_text );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
modified = ( modified ||
|
if( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_orientation )
|
||||||
( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_orientation ) );
|
modified = true;
|
||||||
|
|
||||||
modified = ( modified ||
|
if( ( aField->GetHorizJustify() != IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) ) )
|
||||||
( ( aField->GetHorizJustify() !=
|
modified = true;
|
||||||
IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) ) ) );
|
|
||||||
|
|
||||||
modified = ( modified ||
|
if( ( aField->GetVertJustify() != IntToEdaTextVertJustify( m_verticalJustification - 1 ) ) )
|
||||||
( ( aField->GetVertJustify() !=
|
modified = true;
|
||||||
IntToEdaTextVertJustify( m_verticalJustification - 1 ) ) ) );
|
|
||||||
|
|
||||||
aField->SetText( m_text );
|
aField->SetText( m_text );
|
||||||
updateText( aField );
|
updateText( aField );
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dialog_lib_edit_text_base.h>
|
#include <dialog_lib_edit_text_base.h>
|
||||||
|
#include <widgets/unit_binder.h>
|
||||||
|
|
||||||
class SCH_BASE_FRAME;
|
class SCH_BASE_FRAME;
|
||||||
class LIB_FIELD;
|
class LIB_FIELD;
|
||||||
|
@ -50,11 +51,10 @@ public:
|
||||||
DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||||
const EDA_TEXT* aTextItem );
|
const EDA_TEXT* aTextItem );
|
||||||
|
|
||||||
~DIALOG_EDIT_ONE_FIELD() {}
|
~DIALOG_EDIT_ONE_FIELD() override {}
|
||||||
|
|
||||||
virtual bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
|
bool TransferDataFromWindow() override;
|
||||||
virtual bool TransferDataFromWindow() override;
|
|
||||||
|
|
||||||
SCH_BASE_FRAME* GetParent() { return dynamic_cast< SCH_BASE_FRAME* >( wxDialog::GetParent() ); }
|
SCH_BASE_FRAME* GetParent() { return dynamic_cast< SCH_BASE_FRAME* >( wxDialog::GetParent() ); }
|
||||||
|
|
||||||
|
@ -77,41 +77,16 @@ protected:
|
||||||
*/
|
*/
|
||||||
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) override;
|
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) override;
|
||||||
|
|
||||||
/// @todo Update DIALOG_SHIM to handle this transparently so no matter what mode the
|
UNIT_BINDER m_textSize;
|
||||||
/// dialogs is shown, everything is handled without this ugliness.
|
int m_fieldId;
|
||||||
void OnOkClick( wxCommandEvent& aEvent ) override
|
bool m_isPower;
|
||||||
{
|
wxString m_text;
|
||||||
if( IsQuasiModal() )
|
int m_style;
|
||||||
EndQuasiModal( wxID_OK );
|
int m_size;
|
||||||
else
|
bool m_orientation;
|
||||||
EndDialog( wxID_OK );
|
int m_verticalJustification;
|
||||||
}
|
int m_horizontalJustification;
|
||||||
|
bool m_isVisible;
|
||||||
void OnCancelClick( wxCommandEvent& event ) override
|
|
||||||
{
|
|
||||||
if( IsQuasiModal() )
|
|
||||||
EndQuasiModal( wxID_CANCEL );
|
|
||||||
else
|
|
||||||
EndDialog( wxID_CANCEL );
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCloseDialog( wxCloseEvent& aEvent ) override
|
|
||||||
{
|
|
||||||
if( IsQuasiModal() )
|
|
||||||
EndQuasiModal( wxID_CANCEL );
|
|
||||||
else
|
|
||||||
EndDialog( wxID_CANCEL );
|
|
||||||
}
|
|
||||||
|
|
||||||
int m_fieldId;
|
|
||||||
bool m_isPower;
|
|
||||||
wxString m_text;
|
|
||||||
int m_style;
|
|
||||||
int m_size;
|
|
||||||
bool m_orientation;
|
|
||||||
int m_verticalJustification;
|
|
||||||
int m_horizontalJustification;
|
|
||||||
bool m_isVisible;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
/**
|
|
||||||
* @file dialog_lib_edit_text.cpp
|
|
||||||
* @brief dialog to editing graphic texts (not fields) in body components.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
|
@ -28,12 +23,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
|
||||||
#include <common.h>
|
|
||||||
#include <class_drawpanel.h>
|
|
||||||
#include <base_units.h>
|
|
||||||
|
|
||||||
#include <general.h>
|
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
#include <lib_text.h>
|
#include <lib_text.h>
|
||||||
|
@ -42,128 +31,84 @@
|
||||||
|
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) :
|
DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) :
|
||||||
DIALOG_LIB_EDIT_TEXT_BASE( aParent )
|
DIALOG_LIB_EDIT_TEXT_BASE( aParent ),
|
||||||
|
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true, 0 )
|
||||||
{
|
{
|
||||||
m_parent = aParent;
|
m_parent = aParent;
|
||||||
m_graphicText = aText;
|
m_graphicText = aText;
|
||||||
initDlg();
|
|
||||||
|
// Disable options for fieldedit, not existing in graphic text
|
||||||
|
m_visible->Show( false );
|
||||||
|
m_TextValueSelectButton->Hide();
|
||||||
|
m_PowerComponentValues->Show( false );
|
||||||
|
|
||||||
|
SetInitialFocus( m_TextValue );
|
||||||
|
|
||||||
|
m_sdbSizerButtonsOK->SetDefault();
|
||||||
|
|
||||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||||
FinishDialogSettings();
|
FinishDialogSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_LIB_EDIT_TEXT::initDlg( )
|
bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
m_TextValue->SetFocus();
|
|
||||||
|
|
||||||
// Disable options for fieldedition, not existing in graphic text
|
|
||||||
m_Invisible->Show(false);
|
|
||||||
|
|
||||||
if( m_graphicText )
|
if( m_graphicText )
|
||||||
{
|
{
|
||||||
msg = StringFromValue( g_UserUnit, m_graphicText->GetTextWidth() );
|
m_textSize.SetValue( m_graphicText->GetTextWidth() );
|
||||||
m_TextSize->SetValue( msg );
|
|
||||||
m_TextValue->SetValue( m_graphicText->GetText() );
|
m_TextValue->SetValue( m_graphicText->GetText() );
|
||||||
|
|
||||||
if( m_graphicText->GetUnit() == 0 )
|
m_CommonUnit->SetValue( m_graphicText->GetUnit() == 0 );
|
||||||
m_CommonUnit->SetValue( true );
|
m_CommonConvert->SetValue( m_graphicText->GetConvert() == 0 );
|
||||||
if( m_graphicText->GetConvert() == 0 )
|
m_Orient->SetValue( m_graphicText->GetTextAngle() == TEXT_ANGLE_VERT );
|
||||||
m_CommonConvert->SetValue( true );
|
|
||||||
if( m_graphicText->GetTextAngle() == TEXT_ANGLE_VERT )
|
|
||||||
m_Orient->SetValue( true );
|
|
||||||
|
|
||||||
int shape = 0;
|
int shape = 0;
|
||||||
if( m_graphicText->IsItalic() )
|
if( m_graphicText->IsItalic() )
|
||||||
shape = 1;
|
shape = 1;
|
||||||
if( m_graphicText->IsBold() )
|
if( m_graphicText->IsBold() )
|
||||||
shape |= 2;
|
shape |= 2;
|
||||||
|
|
||||||
m_TextShapeOpt->SetSelection( shape );
|
m_TextShapeOpt->SetSelection( shape );
|
||||||
|
|
||||||
switch ( m_graphicText->GetHorizJustify() )
|
switch ( m_graphicText->GetHorizJustify() )
|
||||||
{
|
{
|
||||||
case GR_TEXT_HJUSTIFY_LEFT:
|
case GR_TEXT_HJUSTIFY_LEFT: m_TextHJustificationOpt->SetSelection( 0 ); break;
|
||||||
m_TextHJustificationOpt->SetSelection( 0 );
|
case GR_TEXT_HJUSTIFY_CENTER: m_TextHJustificationOpt->SetSelection( 1 ); break;
|
||||||
break;
|
case GR_TEXT_HJUSTIFY_RIGHT: m_TextHJustificationOpt->SetSelection( 2 ); break;
|
||||||
|
|
||||||
case GR_TEXT_HJUSTIFY_CENTER:
|
|
||||||
m_TextHJustificationOpt->SetSelection( 1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
|
||||||
m_TextHJustificationOpt->SetSelection( 2 );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( m_graphicText->GetVertJustify() )
|
switch ( m_graphicText->GetVertJustify() )
|
||||||
{
|
{
|
||||||
case GR_TEXT_VJUSTIFY_TOP:
|
case GR_TEXT_VJUSTIFY_TOP: m_TextVJustificationOpt->SetSelection( 0 ); break;
|
||||||
m_TextVJustificationOpt->SetSelection( 0 );
|
case GR_TEXT_VJUSTIFY_CENTER: m_TextVJustificationOpt->SetSelection( 1 ); break;
|
||||||
break;
|
case GR_TEXT_VJUSTIFY_BOTTOM: m_TextVJustificationOpt->SetSelection( 2 ); break;
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_CENTER:
|
|
||||||
m_TextVJustificationOpt->SetSelection( 1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
||||||
m_TextVJustificationOpt->SetSelection( 2 );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = StringFromValue( g_UserUnit, m_parent->m_textSize );
|
m_textSize.SetValue( m_parent->m_textSize );
|
||||||
m_TextSize->SetValue( msg );
|
|
||||||
|
|
||||||
if( ! m_parent->m_drawSpecificUnit )
|
m_CommonUnit->SetValue( !m_parent->m_drawSpecificUnit );
|
||||||
m_CommonUnit->SetValue( true );
|
m_CommonConvert->SetValue( !m_parent->m_drawSpecificConvert );
|
||||||
if( ! m_parent->m_drawSpecificConvert )
|
m_Orient->SetValue( m_parent->m_current_text_angle == TEXT_ANGLE_VERT );
|
||||||
m_CommonConvert->SetValue( true );
|
|
||||||
if( m_parent->m_current_text_angle == TEXT_ANGLE_VERT )
|
|
||||||
m_Orient->SetValue( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
|
return true;
|
||||||
m_TextSizeText->SetLabel( msg );
|
|
||||||
|
|
||||||
m_sdbSizerButtonsOK->SetDefault();
|
|
||||||
|
|
||||||
// Hide the select button as the child dialog classes use this
|
|
||||||
m_TextValueSelectButton->Hide();
|
|
||||||
|
|
||||||
// Hide the "Power component value text cannot be modified!" warning
|
|
||||||
m_PowerComponentValues->Show( false );
|
|
||||||
Fit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_LIB_EDIT_TEXT::OnCancelClick( wxCommandEvent& event )
|
bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
EndModal(wxID_CANCEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Updates the different parameters for the component being edited */
|
|
||||||
void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
wxString Line;
|
|
||||||
|
|
||||||
Line = m_TextValue->GetValue();
|
|
||||||
m_parent->m_current_text_angle = m_Orient->GetValue() ? TEXT_ANGLE_VERT : TEXT_ANGLE_HORIZ;
|
m_parent->m_current_text_angle = m_Orient->GetValue() ? TEXT_ANGLE_VERT : TEXT_ANGLE_HORIZ;
|
||||||
wxString msg = m_TextSize->GetValue();
|
m_parent->m_textSize = m_textSize.GetValue();
|
||||||
m_parent->m_textSize = ValueFromString( g_UserUnit, msg );
|
m_parent->m_drawSpecificConvert = !m_CommonConvert->GetValue();
|
||||||
m_parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true;
|
m_parent->m_drawSpecificUnit = !m_CommonUnit->GetValue();
|
||||||
m_parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true;
|
|
||||||
|
|
||||||
if( m_graphicText )
|
if( m_graphicText )
|
||||||
{
|
{
|
||||||
if( ! Line.IsEmpty() )
|
if( m_TextValue->GetValue().IsEmpty() )
|
||||||
m_graphicText->SetText( Line );
|
|
||||||
else
|
|
||||||
m_graphicText->SetText( wxT( "[null]" ) );
|
m_graphicText->SetText( wxT( "[null]" ) );
|
||||||
|
else
|
||||||
|
m_graphicText->SetText( m_TextValue->GetValue() );
|
||||||
|
|
||||||
m_graphicText->SetTextSize( wxSize( m_parent->m_textSize, m_parent->m_textSize ) );
|
m_graphicText->SetTextSize( wxSize( m_parent->m_textSize, m_parent->m_textSize ) );
|
||||||
m_graphicText->SetTextAngle( m_parent->m_current_text_angle );
|
m_graphicText->SetTextAngle( m_parent->m_current_text_angle );
|
||||||
|
@ -183,37 +128,21 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
|
||||||
|
|
||||||
switch( m_TextHJustificationOpt->GetSelection() )
|
switch( m_TextHJustificationOpt->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); break;
|
||||||
m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
case 1: m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER ); break;
|
||||||
break;
|
case 2: m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); 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_TextVJustificationOpt->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); break;
|
||||||
m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
case 1: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER ); break;
|
||||||
break;
|
case 2: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); break;
|
||||||
|
|
||||||
case 1:
|
|
||||||
m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_parent->GetDrawItem() )
|
if( m_parent->GetDrawItem() )
|
||||||
m_parent->SetMsgPanel( m_parent->GetDrawItem() );
|
m_parent->SetMsgPanel( m_parent->GetDrawItem() );
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,8 @@
|
||||||
#ifndef _DIALOG_LIB_EDIT_TEXT_H_
|
#ifndef _DIALOG_LIB_EDIT_TEXT_H_
|
||||||
#define _DIALOG_LIB_EDIT_TEXT_H_
|
#define _DIALOG_LIB_EDIT_TEXT_H_
|
||||||
|
|
||||||
|
|
||||||
#include <dialog_lib_edit_text_base.h>
|
#include <dialog_lib_edit_text_base.h>
|
||||||
|
#include <widgets/unit_binder.h>
|
||||||
|
|
||||||
class LIB_EDIT_FRAME;
|
class LIB_EDIT_FRAME;
|
||||||
class LIB_TEXT;
|
class LIB_TEXT;
|
||||||
|
@ -38,16 +37,16 @@ class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
LIB_EDIT_FRAME* m_parent;
|
LIB_EDIT_FRAME* m_parent;
|
||||||
LIB_TEXT* m_graphicText;
|
LIB_TEXT* m_graphicText;
|
||||||
|
UNIT_BINDER m_textSize;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText );
|
DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText );
|
||||||
~DIALOG_LIB_EDIT_TEXT() {};
|
~DIALOG_LIB_EDIT_TEXT() override {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initDlg( );
|
bool TransferDataToWindow() override;
|
||||||
void OnOkClick( wxCommandEvent& aEvent ) override;
|
bool TransferDataFromWindow() override;
|
||||||
void OnCancelClick( wxCommandEvent& aEvent ) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -23,98 +23,108 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
|
||||||
bUpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
bUpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
wxBoxSizer* bTextValueBoxSizer;
|
wxBoxSizer* bTextValueBoxSizer;
|
||||||
bTextValueBoxSizer = new wxBoxSizer( wxVERTICAL );
|
bTextValueBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticText1->Wrap( -1 );
|
m_staticText1->Wrap( -1 );
|
||||||
bTextValueBoxSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
bTextValueBoxSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bTextValueOptsSizer;
|
|
||||||
bTextValueOptsSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_TextValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_TextValue->SetMinSize( wxSize( 200,-1 ) );
|
m_TextValue->SetMinSize( wxSize( 200,-1 ) );
|
||||||
|
|
||||||
bTextValueOptsSizer->Add( m_TextValue, 1, wxALL|wxEXPAND, 5 );
|
bTextValueBoxSizer->Add( m_TextValue, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||||
|
|
||||||
m_TextValueSelectButton = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_TextValueSelectButton = new wxButton( this, wxID_ANY, _("Select"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
bTextValueOptsSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
bTextValueBoxSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
bTextValueBoxSizer->Add( bTextValueOptsSizer, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND, 5 );
|
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bTextSizeSizer;
|
|
||||||
bTextSizeSizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
m_TextSizeText = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
bPropertiesSizer->Add( bUpperBoxSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
m_TextSizeText->Wrap( -1 );
|
|
||||||
bTextSizeSizer->Add( m_TextSizeText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_TextSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
wxBoxSizer* bSizer9;
|
||||||
bTextSizeSizer->Add( m_TextSize, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 );
|
bSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_PowerComponentValues = new wxStaticText( this, wxID_ANY, _("Note: power symbol value text cannot be modified."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
bUpperBoxSizer->Add( bTextSizeSizer, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bPropertiesSizer->Add( bUpperBoxSizer, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_PowerComponentValues = new wxStaticText( this, wxID_ANY, _("Power symbol value text cannot be modified!"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_PowerComponentValues->Wrap( -1 );
|
m_PowerComponentValues->Wrap( -1 );
|
||||||
m_PowerComponentValues->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
m_PowerComponentValues->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
|
||||||
|
|
||||||
bPropertiesSizer->Add( m_PowerComponentValues, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
bSizer9->Add( m_PowerComponentValues, 0, wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bPropertiesSizer->Add( bSizer9, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bBottomtBoxSizer;
|
wxBoxSizer* bBottomtBoxSizer;
|
||||||
bBottomtBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
bBottomtBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
wxStaticBoxSizer* sOptionsSizer;
|
wxBoxSizer* bSizer8;
|
||||||
sOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
|
bSizer8 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_Orient = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Vertical"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sOptionsSizer->Add( m_Orient, 0, wxALL, 5 );
|
|
||||||
|
|
||||||
m_staticline1 = new wxStaticLine( sOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
|
||||||
sOptionsSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
|
|
||||||
|
|
||||||
m_CommonUnit = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sOptionsSizer->Add( m_CommonUnit, 0, wxALL, 5 );
|
|
||||||
|
|
||||||
m_CommonConvert = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sOptionsSizer->Add( m_CommonConvert, 0, wxALIGN_RIGHT|wxBOTTOM|wxEXPAND|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_Invisible = new wxCheckBox( sOptionsSizer->GetStaticBox(), wxID_ANY, _("Invisible"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sOptionsSizer->Add( m_Invisible, 0, wxALIGN_LEFT|wxBOTTOM|wxLEFT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bBottomtBoxSizer->Add( sOptionsSizer, 0, wxALL|wxEXPAND, 5 );
|
bSizer8->Add( 0, 0, 1, wxEXPAND|wxTOP, 2 );
|
||||||
|
|
||||||
|
wxBoxSizer* bTextSizeSizer;
|
||||||
|
bTextSizeSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textSizeLabel->Wrap( -1 );
|
||||||
|
bTextSizeSizer->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bTextSizeSizer->Add( m_textSizeCtrl, 1, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
|
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textSizeUnits->Wrap( -1 );
|
||||||
|
bTextSizeSizer->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizer8->Add( bTextSizeSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizer8->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( bSizer8, 4, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bBottomtBoxSizer->Add( 0, 0, 0, wxEXPAND|wxLEFT, 5 );
|
||||||
|
|
||||||
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold and italic") };
|
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold and italic") };
|
||||||
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
|
int m_TextShapeOptNChoices = sizeof( m_TextShapeOptChoices ) / sizeof( wxString );
|
||||||
m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS );
|
m_TextShapeOpt = new wxRadioBox( this, wxID_ANY, _("Text Style"), wxDefaultPosition, wxDefaultSize, m_TextShapeOptNChoices, m_TextShapeOptChoices, 1, wxRA_SPECIFY_COLS );
|
||||||
m_TextShapeOpt->SetSelection( 3 );
|
m_TextShapeOpt->SetSelection( 3 );
|
||||||
bBottomtBoxSizer->Add( m_TextShapeOpt, 1, wxALL|wxEXPAND, 5 );
|
bBottomtBoxSizer->Add( m_TextShapeOpt, 3, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
wxString m_TextHJustificationOptChoices[] = { _("Align left"), _("Align center"), _("Align right") };
|
wxString m_TextHJustificationOptChoices[] = { _("Align left"), _("Align center"), _("Align right") };
|
||||||
int m_TextHJustificationOptNChoices = sizeof( m_TextHJustificationOptChoices ) / sizeof( wxString );
|
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 = new wxRadioBox( this, wxID_ANY, _("Horizontal Align"), wxDefaultPosition, wxDefaultSize, m_TextHJustificationOptNChoices, m_TextHJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
|
||||||
m_TextHJustificationOpt->SetSelection( 0 );
|
m_TextHJustificationOpt->SetSelection( 0 );
|
||||||
bBottomtBoxSizer->Add( m_TextHJustificationOpt, 1, wxALL|wxEXPAND, 5 );
|
bBottomtBoxSizer->Add( m_TextHJustificationOpt, 3, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
wxString m_TextVJustificationOptChoices[] = { _("Align top"), _("Align center"), _("Align bottom") };
|
wxString m_TextVJustificationOptChoices[] = { _("Align top"), _("Align center"), _("Align bottom") };
|
||||||
int m_TextVJustificationOptNChoices = sizeof( m_TextVJustificationOptChoices ) / sizeof( wxString );
|
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 = new wxRadioBox( this, wxID_ANY, _("Vertical Align"), wxDefaultPosition, wxDefaultSize, m_TextVJustificationOptNChoices, m_TextVJustificationOptChoices, 1, wxRA_SPECIFY_COLS );
|
||||||
m_TextVJustificationOpt->SetSelection( 0 );
|
m_TextVJustificationOpt->SetSelection( 0 );
|
||||||
bBottomtBoxSizer->Add( m_TextVJustificationOpt, 1, wxALL|wxEXPAND, 5 );
|
bBottomtBoxSizer->Add( m_TextVJustificationOpt, 3, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
bPropertiesSizer->Add( bBottomtBoxSizer, 1, wxEXPAND, 5 );
|
bPropertiesSizer->Add( bBottomtBoxSizer, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND, 6 );
|
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 6 );
|
||||||
|
|
||||||
|
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
|
bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_sdbSizerButtons = new wxStdDialogButtonSizer();
|
m_sdbSizerButtons = new wxStdDialogButtonSizer();
|
||||||
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
|
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
|
||||||
|
@ -133,8 +143,6 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
||||||
m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||||
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this );
|
|
||||||
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE()
|
DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE()
|
||||||
|
@ -142,7 +150,5 @@ DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE()
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
||||||
m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||||
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this );
|
|
||||||
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), 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/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -22,9 +22,8 @@
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/statline.h>
|
|
||||||
#include <wx/statbox.h>
|
|
||||||
#include <wx/radiobox.h>
|
#include <wx/radiobox.h>
|
||||||
|
#include <wx/statline.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -40,17 +39,18 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
|
||||||
wxStaticText* m_staticText1;
|
wxStaticText* m_staticText1;
|
||||||
wxTextCtrl* m_TextValue;
|
wxTextCtrl* m_TextValue;
|
||||||
wxButton* m_TextValueSelectButton;
|
wxButton* m_TextValueSelectButton;
|
||||||
wxStaticText* m_TextSizeText;
|
|
||||||
wxTextCtrl* m_TextSize;
|
|
||||||
wxStaticText* m_PowerComponentValues;
|
wxStaticText* m_PowerComponentValues;
|
||||||
|
wxStaticText* m_textSizeLabel;
|
||||||
|
wxTextCtrl* m_textSizeCtrl;
|
||||||
|
wxStaticText* m_textSizeUnits;
|
||||||
|
wxCheckBox* m_visible;
|
||||||
wxCheckBox* m_Orient;
|
wxCheckBox* m_Orient;
|
||||||
wxStaticLine* m_staticline1;
|
|
||||||
wxCheckBox* m_CommonUnit;
|
wxCheckBox* m_CommonUnit;
|
||||||
wxCheckBox* m_CommonConvert;
|
wxCheckBox* m_CommonConvert;
|
||||||
wxCheckBox* m_Invisible;
|
|
||||||
wxRadioBox* m_TextShapeOpt;
|
wxRadioBox* m_TextShapeOpt;
|
||||||
wxRadioBox* m_TextHJustificationOpt;
|
wxRadioBox* m_TextHJustificationOpt;
|
||||||
wxRadioBox* m_TextVJustificationOpt;
|
wxRadioBox* m_TextVJustificationOpt;
|
||||||
|
wxStaticLine* m_staticline2;
|
||||||
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
||||||
wxButton* m_sdbSizerButtonsOK;
|
wxButton* m_sdbSizerButtonsOK;
|
||||||
wxButton* m_sdbSizerButtonsCancel;
|
wxButton* m_sdbSizerButtonsCancel;
|
||||||
|
@ -58,8 +58,6 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
||||||
virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -125,10 +125,11 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
||||||
|
|
||||||
// Set the default line width (pen width which should be used for
|
// Set the default line width (pen width which should be used for
|
||||||
// items that do not have a pen size defined (like frame ref)
|
// items that do not have a pen size defined (like frame ref)
|
||||||
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, GetDefaultLineThickness() );
|
int defaultLineSize = GetDefaultLineThickness();
|
||||||
|
m_DefaultLineSizeCtrl->SetValue( StringFromValue( m_units, defaultLineSize, true, true ) );
|
||||||
|
|
||||||
// Initialize HPGL specific widgets
|
// Initialize HPGL specific widgets
|
||||||
PutValueInLocalUnits( *m_penHPGLWidthCtrl, m_HPGLPenSize );
|
m_penHPGLWidthCtrl->SetValue( StringFromValue( m_units, m_HPGLPenSize, true, true ) );
|
||||||
|
|
||||||
// Plot directory
|
// Plot directory
|
||||||
wxString path = m_parent->GetPlotDirectoryName();
|
wxString path = m_parent->GetPlotDirectoryName();
|
||||||
|
@ -237,11 +238,13 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
m_paperSizeOption->Set( paperSizes );
|
m_paperSizeOption->Set( paperSizes );
|
||||||
m_paperSizeOption->SetSelection( selection );
|
m_paperSizeOption->SetSelection( selection );
|
||||||
|
|
||||||
m_DefaultLineSizeCtrl->Enable( fmt == PLOT_FORMAT_POST
|
bool enable = fmt == PLOT_FORMAT_POST || fmt == PLOT_FORMAT_PDF || fmt == PLOT_FORMAT_SVG;
|
||||||
|| fmt == PLOT_FORMAT_PDF
|
m_defaultLineWidthTitle->Enable( enable );
|
||||||
|| fmt == PLOT_FORMAT_SVG );
|
m_DefaultLineSizeCtrl->Enable( enable );
|
||||||
|
|
||||||
|
m_plotOriginTitle->Enable( fmt == PLOT_FORMAT_HPGL );
|
||||||
m_plotOriginOpt->Enable( fmt == PLOT_FORMAT_HPGL );
|
m_plotOriginOpt->Enable( fmt == PLOT_FORMAT_HPGL );
|
||||||
|
m_penHPGLWidthTitle->Enable( fmt == PLOT_FORMAT_HPGL );
|
||||||
m_penHPGLWidthCtrl->Enable( fmt == PLOT_FORMAT_HPGL );
|
m_penHPGLWidthCtrl->Enable( fmt == PLOT_FORMAT_HPGL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +260,8 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
|
||||||
// HPGL Pen Size is stored in mm in config
|
// HPGL Pen Size is stored in mm in config
|
||||||
m_config->Write( PLOT_HPGL_PEN_SIZE_KEY, m_HPGLPenSize/IU_PER_MM );
|
m_config->Write( PLOT_HPGL_PEN_SIZE_KEY, m_HPGLPenSize/IU_PER_MM );
|
||||||
|
|
||||||
SetDefaultLineThickness( ValueFromTextCtrl( *m_DefaultLineSizeCtrl ) );
|
int thickness = ValueFromString( GetUserUnits(), m_DefaultLineSizeCtrl->GetValue(), true );
|
||||||
|
SetDefaultLineThickness( thickness );
|
||||||
|
|
||||||
// Plot directory
|
// Plot directory
|
||||||
wxString path = m_outputDirectoryName->GetValue();
|
wxString path = m_outputDirectoryName->GetValue();
|
||||||
|
|
|
@ -105,10 +105,9 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
|
||||||
gbSizer2->SetFlexibleDirection( wxBOTH );
|
gbSizer2->SetFlexibleDirection( wxBOTH );
|
||||||
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||||
|
|
||||||
wxStaticText* sPositionLabel;
|
m_plotOriginTitle = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
sPositionLabel = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Position:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_plotOriginTitle->Wrap( -1 );
|
||||||
sPositionLabel->Wrap( -1 );
|
gbSizer2->Add( m_plotOriginTitle, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||||
gbSizer2->Add( sPositionLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
|
||||||
|
|
||||||
wxString m_plotOriginOptChoices[] = { _("Bottom left"), _("Center on page") };
|
wxString m_plotOriginOptChoices[] = { _("Bottom left"), _("Center on page") };
|
||||||
int m_plotOriginOptNChoices = sizeof( m_plotOriginOptChoices ) / sizeof( wxString );
|
int m_plotOriginOptNChoices = sizeof( m_plotOriginOptChoices ) / sizeof( wxString );
|
||||||
|
@ -116,9 +115,9 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind
|
||||||
m_plotOriginOpt->SetSelection( 0 );
|
m_plotOriginOpt->SetSelection( 0 );
|
||||||
gbSizer2->Add( m_plotOriginOpt, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
gbSizer2->Add( m_plotOriginOpt, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_penHPLGWidthTitle = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Pen width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_penHPGLWidthTitle = new wxStaticText( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, _("Pen width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_penHPLGWidthTitle->Wrap( -1 );
|
m_penHPGLWidthTitle->Wrap( -1 );
|
||||||
gbSizer2->Add( m_penHPLGWidthTitle, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
gbSizer2->Add( m_penHPGLWidthTitle, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||||
|
|
||||||
m_penHPGLWidthCtrl = new wxTextCtrl( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_penHPGLWidthCtrl = new wxTextCtrl( m_HPGLOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
gbSizer2->Add( m_penHPGLWidthCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
gbSizer2->Add( m_penHPGLWidthCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
|
@ -1198,11 +1198,11 @@
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">sPositionLabel</property>
|
<property name="name">m_plotOriginTitle</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">protected</property>
|
||||||
<property name="pin_button">1</property>
|
<property name="pin_button">1</property>
|
||||||
<property name="pos"></property>
|
<property name="pos"></property>
|
||||||
<property name="resize">Resizable</property>
|
<property name="resize">Resizable</property>
|
||||||
|
@ -1375,7 +1375,7 @@
|
||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_penHPLGWidthTitle</property>
|
<property name="name">m_penHPGLWidthTitle</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
|
|
|
@ -57,8 +57,9 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
|
||||||
wxStaticText* m_defaultLineWidthTitle;
|
wxStaticText* m_defaultLineWidthTitle;
|
||||||
wxTextCtrl* m_DefaultLineSizeCtrl;
|
wxTextCtrl* m_DefaultLineSizeCtrl;
|
||||||
wxStaticBoxSizer* m_HPGLOptionsSizer;
|
wxStaticBoxSizer* m_HPGLOptionsSizer;
|
||||||
|
wxStaticText* m_plotOriginTitle;
|
||||||
wxChoice* m_plotOriginOpt;
|
wxChoice* m_plotOriginOpt;
|
||||||
wxStaticText* m_penHPLGWidthTitle;
|
wxStaticText* m_penHPGLWidthTitle;
|
||||||
wxTextCtrl* m_penHPGLWidthCtrl;
|
wxTextCtrl* m_penHPGLWidthCtrl;
|
||||||
WX_HTML_REPORT_PANEL* m_MessagesBox;
|
WX_HTML_REPORT_PANEL* m_MessagesBox;
|
||||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||||
|
|
|
@ -1125,9 +1125,11 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
|
||||||
DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
|
DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
|
||||||
DefaultTransform );
|
DefaultTransform );
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
|
DIALOG_LIB_EDIT_TEXT dlg( this, (LIB_TEXT*) DrawItem );
|
||||||
frame->ShowModal();
|
|
||||||
frame->Destroy();
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
|
return;
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
// Display new text
|
// Display new text
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#define VAR 1
|
|
||||||
#define ASSIGN 2
|
|
||||||
#define SEMCOL 3
|
|
||||||
#define PLUS 4
|
|
||||||
#define MINUS 5
|
|
||||||
#define UNIT 6
|
|
||||||
#define DIVIDE 7
|
|
||||||
#define MULT 8
|
|
||||||
#define ENDS 9
|
|
||||||
#define VALUE 10
|
|
||||||
#define PARENL 11
|
|
||||||
#define PARENR 12
|
|
|
@ -68,7 +68,6 @@ Supported units are millimeters (mm), Mil (mil) and inch (")
|
||||||
#ifndef NUMERIC_EVALUATOR_H_
|
#ifndef NUMERIC_EVALUATOR_H_
|
||||||
#define NUMERIC_EVALUATOR_H_
|
#define NUMERIC_EVALUATOR_H_
|
||||||
|
|
||||||
#include "grammar.h"
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
Loading…
Reference in New Issue