7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 11:50:10 +00:00

More encapsulation work.

* Complete encapsulation of the MODULE class.
* Complete encapsulation of the EDA_TEXT class.
* Encapsulate most of the ZONE_CONTAINER class.
* Add pcbcommon library as a dependency for reSWIGging the scripting
  support.  This should cover most dependency cases.
This commit is contained in:
Wayne Stambaugh 2013-03-18 15:36:07 -04:00
parent da9e6b1679
commit 7d0ec1a138
95 changed files with 846 additions and 896 deletions
3d-viewer
common
eeschema
include
pcbnew

View File

@ -245,14 +245,14 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
SetGLColor( color );
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
if( aZone->m_FillMode == 0 )
if( aZone->GetFillMode() == 0 )
{
// solid polygons only are used to fill areas
if( aZone->GetFilledPolysList().size() > 3 )
{
Draw3D_SolidHorizontalPolyPolygons( aZone->GetFilledPolysList(),
g_Parm_3D_Visu.GetLayerZcoordBIU( layer ),
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
g_Parm_3D_Visu.GetLayerZcoordBIU( layer ),
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
}
}
else
@ -261,7 +261,7 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
for( unsigned iseg = 0; iseg < aZone->m_FillSegmList.size(); iseg++ )
Draw3D_SolidSegment( aZone->m_FillSegmList[iseg].m_Start,
aZone->m_FillSegmList[iseg].m_End,
aZone->m_ZoneMinThickness, thickness, zpos,
aZone->GetMinThickness(), thickness, zpos,
g_Parm_3D_Visu.m_BiuTo3Dunits );
}
@ -271,7 +271,7 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
if( polysList.size() == 0 )
return;
if( aZone->m_ZoneMinThickness <= 1 )
if( aZone->GetMinThickness() <= 1 )
return;
int imax = polysList.size() - 1;
@ -288,7 +288,7 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
wxPoint start( begincorner->x, begincorner->y );
wxPoint end( endcorner->x, endcorner->y );
Draw3D_SolidSegment( start, end,
aZone->m_ZoneMinThickness, thickness, zpos,
aZone->GetMinThickness(), thickness, zpos,
g_Parm_3D_Visu.m_BiuTo3Dunits );
}
@ -301,7 +301,7 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone )
wxPoint start( endcorner->x, endcorner->y );
wxPoint end( firstcorner->x, firstcorner->y );
Draw3D_SolidSegment( start, end,
aZone->m_ZoneMinThickness, thickness, zpos,
aZone->GetMinThickness(), thickness, zpos,
g_Parm_3D_Visu.m_BiuTo3Dunits );
}
@ -625,15 +625,15 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
s_Text3DZPos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
s_Text3DWidth = text->GetThickness();
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
wxSize size = text->m_Size;
wxSize size = text->GetSize();
s_thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
if( text->m_Mirror )
if( text->IsMirrored() )
NEGATE( size.x );
if( text->m_MultilineAllowed )
if( text->IsMultilineAllowed() )
{
wxPoint pos = text->m_Pos;
wxPoint pos = text->GetTextPosition();
wxArrayString* list = wxStringSplit( text->GetText(), '\n' );
wxPoint offset;
@ -646,8 +646,8 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, (EDA_COLOR_T) color,
txt, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify,
text->GetThickness(), text->m_Italic,
text->GetHorizJustify(), text->GetVertJustify(),
text->GetThickness(), text->IsItalic(),
true, Draw3dTextSegm );
pos += offset;
}
@ -656,10 +656,10 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
}
else
{
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_COLOR_T) color,
DrawGraphicText( NULL, NULL, text->GetTextPosition(), (EDA_COLOR_T) color,
text->GetText(), text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify,
text->GetThickness(), text->m_Italic,
text->GetHorizJustify(), text->GetVertJustify(),
text->GetThickness(), text->IsItalic(),
true,
Draw3dTextSegm );
}

View File

@ -47,7 +47,7 @@
EDA_TEXT::EDA_TEXT( const wxString& text )
{
m_Size.x = m_Size.y = MILS_TO_IU( DEFAULT_SIZE_TEXT ); // Width and height of font.
m_Size.x = m_Size.y = Mils2iu( DEFAULT_SIZE_TEXT ); // Width and height of font.
m_Orient = 0; // Rotation angle in 0.1 degrees.
m_Attributs = 0;
m_Mirror = false; // display mirror if true
@ -325,8 +325,8 @@ wxString EDA_TEXT::GetTextStyleName()
bool EDA_TEXT::IsDefaultFormatting() const
{
return ( ( m_Size.x == DEFAULT_SIZE_TEXT )
&& ( m_Size.y == DEFAULT_SIZE_TEXT )
return ( ( m_Size.x == Mils2iu( DEFAULT_SIZE_TEXT ) )
&& ( m_Size.y == Mils2iu( DEFAULT_SIZE_TEXT ) )
&& ( m_Attributs == 0 )
&& ( m_Mirror == false )
&& ( m_HJustify == GR_TEXT_HJUSTIFY_CENTER )
@ -345,14 +345,15 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
{
aFormatter->Print( aNestLevel+1, "(effects" );
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) || m_Bold
|| m_Italic )
if( ( m_Size.x != Mils2iu( DEFAULT_SIZE_TEXT ) )
|| ( m_Size.y != Mils2iu( DEFAULT_SIZE_TEXT ) ) || m_Bold || m_Italic )
{
aFormatter->Print( 0, " (font" );
// Add font support here at some point in the future.
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) )
if( ( m_Size.x != Mils2iu( DEFAULT_SIZE_TEXT ) )
|| ( m_Size.y != Mils2iu( DEFAULT_SIZE_TEXT ) ) )
aFormatter->Print( 0, " (size %s %s)", FMT_IU( m_Size.GetHeight() ).c_str(),
FMT_IU( m_Size.GetWidth() ).c_str() );

View File

@ -118,14 +118,14 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
// So we *do not* stop the search here
SCH_COMPONENT* component = referencesList[ii].GetComponent();
SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
fpfield->m_Text = footprint;
fpfield->SetText( footprint );
if( aForceFieldsVisibleAttribute )
{
if( aFieldsVisibleAttributeState )
component->GetField( FOOTPRINT )->m_Attributs &= ~TEXT_NO_VISIBLE;
component->GetField( FOOTPRINT )->SetVisible( false );
else
component->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
component->GetField( FOOTPRINT )->SetVisible( true );
}
}
}

View File

@ -248,7 +248,7 @@ order = Alphab. ) count = %d\n\n"
msg.Printf( wxT( "> %-28.28s %s %s\n" ),
GetChars( label->GetText() ),
GetChars( labeltype ),
GetChars( returnURLItemLocation( sheetpath, label->m_Pos ) ) );
GetChars( returnURLItemLocation( sheetpath, label->GetPosition() ) ) );
fputs( TO_UTF8( msg ), m_outFile );
break;
@ -262,7 +262,7 @@ order = Alphab. ) count = %d\n\n"
GetChars( labeltype ),
GetChars( returnURLItemLocation( m_labelList[ii].GetSheetPath().
PathHumanReadable(),
pinsheet->m_Pos ) ) );
pinsheet->GetPosition() ) ) );
fputs( TO_UTF8( msg ), m_outFile );
break;
@ -294,7 +294,7 @@ const wxString BOM_LISTER::returnFieldsString( SCH_COMPONENT* aComponent )
continue;
if( aComponent->GetFieldCount() > ii )
text = aComponent->GetField( ii )->m_Text;
text = aComponent->GetField( ii )->GetText();
else
text = wxEmptyString;
@ -388,11 +388,11 @@ bool BOM_LISTER::PrintComponentsListByReferenceHumanReadable( FILE* aFile )
}
fprintf( m_outFile, "| %-10s %-12s", CmpName.c_str(),
TO_UTF8( comp->GetField( VALUE )->m_Text ) );
TO_UTF8( comp->GetField( VALUE )->GetText() ) );
if( addDatasheet )
fprintf( m_outFile, "%-20s",
TO_UTF8( comp->GetField( DATASHEET )->m_Text ) );
TO_UTF8( comp->GetField( DATASHEET )->GetText() ) );
if( m_includeSubComponents )
{
@ -531,19 +531,19 @@ bool BOM_LISTER::PrintComponentsListByReferenceCsvForm( FILE* aFile )
{
// Store value and datasheet (will be printed later)
strCur.Empty();
strCur << (wxChar)m_separatorSymbol << comp->GetField( VALUE )->m_Text;
strCur << (wxChar)m_separatorSymbol << comp->GetField( VALUE )->GetText();
if( addDatasheet )
strCur << (wxChar)m_separatorSymbol << comp->GetField( DATASHEET )->m_Text;
strCur << (wxChar)m_separatorSymbol << comp->GetField( DATASHEET )->GetText();
}
else
{
// Print the current component reference, value and datasheet
msg = cmpName;
msg << (wxChar)m_separatorSymbol << comp->GetField( VALUE )->m_Text;
msg << (wxChar)m_separatorSymbol << comp->GetField( VALUE )->GetText();
if( addDatasheet )
msg << (wxChar)m_separatorSymbol << comp->GetField( DATASHEET )->m_Text;
msg << (wxChar)m_separatorSymbol << comp->GetField( DATASHEET )->GetText();
fprintf( m_outFile, "%s", TO_UTF8( msg ) );
}
@ -698,7 +698,7 @@ int BOM_LISTER::PrintComponentsListByValue( FILE* aFile )
cmpName += TO_UTF8( LIB_COMPONENT::ReturnSubReference( m_cmplist[ii].GetUnit() ) );
fprintf( m_outFile, "| %-12s %-10s",
TO_UTF8( drawLibItem->GetField( VALUE )->m_Text ),
TO_UTF8( drawLibItem->GetField( VALUE )->GetText() ),
cmpName.c_str() );
// print the sheet path and location

View File

@ -176,7 +176,7 @@ LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) :
// Add the MANDATORY_FIELDS in RAM only. These are assumed to be present
// when the field editors are invoked.
LIB_FIELD* value = new LIB_FIELD( this, VALUE );
value->m_Text = aName;
value->SetText( aName );
drawings.push_back( value );
drawings.push_back( new LIB_FIELD( this, REFERENCE ) );
@ -266,7 +266,7 @@ wxString LIB_COMPONENT::ReturnSubReference( int aUnit )
void LIB_COMPONENT::SetName( const wxString& aName )
{
m_name = aName;
GetValueField().m_Text = aName;
GetValueField().SetText( aName );
m_aliases[0]->SetName( aName );
}
@ -535,25 +535,25 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
LIB_FIELD& value = GetValueField();
// First line: it s a comment (component name for readers)
aFormatter.Print( 0, "#\n# %s\n#\n", TO_UTF8( value.m_Text ) );
aFormatter.Print( 0, "#\n# %s\n#\n", TO_UTF8( value.GetText() ) );
// Save data
aFormatter.Print( 0, "DEF" );
if( value.IsVisible() )
{
aFormatter.Print( 0, " %s", TO_UTF8( value.m_Text ) );
aFormatter.Print( 0, " %s", TO_UTF8( value.GetText() ) );
}
else
{
aFormatter.Print( 0, " ~%s", TO_UTF8( value.m_Text ) );
aFormatter.Print( 0, " ~%s", TO_UTF8( value.GetText() ) );
}
LIB_FIELD& reference = GetReferenceField();
if( !reference.m_Text.IsEmpty() )
if( !reference.GetText().IsEmpty() )
{
aFormatter.Print( 0, " %s", TO_UTF8( reference.m_Text ) );
aFormatter.Print( 0, " %s", TO_UTF8( reference.GetText() ) );
}
else
{
@ -593,7 +593,7 @@ bool LIB_COMPONENT::Save( OUTPUTFORMATTER& aFormatter )
// There is no need to save empty fields, i.e. no reason to preserve field
// names now that fields names come in dynamically through the template
// fieldnames.
if( !fields[i].m_Text.IsEmpty() )
if( !fields[i].GetText().IsEmpty() )
{
fields[i].SetId( fieldId++ );
@ -724,13 +724,15 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
if( componentName[0] != '~' )
{
m_name = value.m_Text = FROM_UTF8( componentName );
m_name = value.m_Text = m_name.MakeUpper();
m_name = FROM_UTF8( componentName );
m_name = m_name.MakeUpper();
value.SetText( m_name );
}
else
{
m_name = value.m_Text = FROM_UTF8( &componentName[1] );
value.m_Attributs |= TEXT_NO_VISIBLE;
m_name = FROM_UTF8( &componentName[1] );
value.SetText( m_name );
value.SetVisible( false );
}
// Add the root alias to the alias list.
@ -740,12 +742,12 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
if( strcmp( prefix, "~" ) == 0 )
{
reference.m_Text.Empty();
reference.m_Attributs |= TEXT_NO_VISIBLE;
reference.Empty();
reference.SetVisible( false );
}
else
{
reference.m_Text = FROM_UTF8( prefix );
reference.SetText( FROM_UTF8( prefix ) );
}
// Copy optional infos
@ -927,7 +929,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
*fixedField = *field;
if( field->GetId() == VALUE )
m_name = field->m_Text;
m_name = field->GetText();
SAFE_DELETE( field );
}

View File

@ -329,15 +329,12 @@ bool SCH_REFERENCE_LIST::sortByReferenceOnly( const SCH_REFERENCE& item1,
const SCH_REFERENCE& item2 )
{
int ii;
const wxString* Text1, * Text2;
ii = RefDesStringCompare( item1.GetRef(), item2.GetRef() );
if( ii == 0 )
{
Text1 = &( item1.m_RootCmp->GetField( VALUE )->m_Text );
Text2 = &( item2.m_RootCmp->GetField( VALUE )->m_Text );
ii = Text1->CmpNoCase( *Text2 );
ii = item1.m_RootCmp->GetField( VALUE )->GetText().CmpNoCase( item2.m_RootCmp->GetField( VALUE )->GetText() );
}
if( ii == 0 )
@ -803,21 +800,21 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
GetChars( componentFlatList[ii].GetRef() ),
componentFlatList[ii].m_NumRef,
componentFlatList[ii].m_Unit,
GetChars( *componentFlatList[ii].m_Value ),
GetChars( componentFlatList[ii].m_Value-GetText() ),
GetChars( componentFlatList[next].GetRef() ),
componentFlatList[next].m_NumRef,
componentFlatList[next].m_Unit,
componentFlatList[next].m_Value->GetData() );
componentFlatList[next].m_Value->GetText().GetData() );
#else
msg.Printf( _( "Different values for %s%d%c (%s) and %s%d%c (%s)" ),
GetChars( componentFlatList[ii].GetRef() ),
componentFlatList[ii].m_NumRef,
componentFlatList[ii].m_Unit + 'A' - 1,
GetChars( *componentFlatList[ii].m_Value ),
GetChars( componentFlatList[ii].m_Value->GetText() ),
GetChars( componentFlatList[next].GetRef() ),
componentFlatList[next].m_NumRef,
componentFlatList[next].m_Unit + 'A' - 1,
GetChars( *componentFlatList[next].m_Value ) );
GetChars( componentFlatList[next].m_Value->GetText() ) );
#endif
if( aMessageList )
@ -884,7 +881,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_COMPONENT* aLibComp
if( aComponent->GetField( VALUE )->GetText().IsEmpty() )
aComponent->GetField( VALUE )->SetText( wxT( "~" ) );
m_Value = &aComponent->GetField( VALUE )->m_Text;
m_Value = aComponent->GetField( VALUE );
}

View File

@ -110,7 +110,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
if( LibItem )
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet ),
LibItem->GetField( VALUE )->m_Text, DARKCYAN ) );
LibItem->GetField( VALUE )->GetText(), DARKCYAN ) );
SetMsgPanel( items );

View File

@ -132,14 +132,14 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
if( LibItem == NULL )
break;
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
SendCommand( MSG_TO_PCB, Line );
}
break;
case SCH_COMPONENT_T:
LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
SendCommand( MSG_TO_PCB, Line );
break;
@ -154,11 +154,11 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT*
wxString pinnum;
Pin->ReturnPinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
}
else
{
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->m_Text ) );
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
}
SendCommand( MSG_TO_PCB, Line );

View File

@ -216,7 +216,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
if( !copyPanelToSelectedField() )
return;
if( ! SCH_COMPONENT::IsReferenceStringValid( m_FieldsBuf[REFERENCE].m_Text ) )
if( ! SCH_COMPONENT::IsReferenceStringValid( m_FieldsBuf[REFERENCE].GetText() ) )
{
DisplayError( NULL, _( "Illegal reference. A reference must start with a letter" ) );
return;
@ -233,7 +233,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
// change all field positions from relative to absolute
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{
m_FieldsBuf[i].m_Pos += m_Cmp->m_Pos;
m_FieldsBuf[i].SetPosition( m_FieldsBuf[i].GetPosition() + m_Cmp->m_Pos );
}
// Delete any fields with no name before we copy all of m_FieldsBuf back into the component.
@ -274,7 +274,7 @@ Do you wish to remove this and all remaining undefined fields?" ),
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
if( entry && entry->IsPower() )
m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName;
m_FieldsBuf[VALUE].SetText( m_Cmp->m_ChipName );
// copy all the fields back, and change the length of m_Fields.
m_Cmp->SetFields( m_FieldsBuf );
@ -282,7 +282,7 @@ Do you wish to remove this and all remaining undefined fields?" ),
// Reference has a specific initialization, depending on the current active sheet
// because for a given component, in a complex hierarchy, there are more than one
// reference.
m_Cmp->SetRef( &m_Parent->GetCurrentSheet(), m_FieldsBuf[REFERENCE].m_Text );
m_Cmp->SetRef( &m_Parent->GetCurrentSheet(), m_FieldsBuf[REFERENCE].GetText() );
m_Parent->OnModify();
m_Parent->GetScreen()->TestDanglingEnds();
@ -303,7 +303,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent&
SCH_FIELD blank( wxPoint(), fieldNdx, m_Cmp );
blank.m_Orient = m_FieldsBuf[REFERENCE].m_Orient;
blank.SetOrientation( m_FieldsBuf[REFERENCE].GetOrientation() );
m_FieldsBuf.push_back( blank );
m_FieldsBuf[fieldNdx].SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ) );
@ -364,7 +364,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::moveUpButtonHandler( wxCommandEvent& ev
SCH_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
D( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
TO_UTF8( tmp.m_Text ), TO_UTF8( tmp.GetName( false ) ) ); )
TO_UTF8( tmp.GetText() ), TO_UTF8( tmp.GetName( false ) ) ); )
m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx];
setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] );
@ -458,7 +458,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
m_FieldsBuf.push_back( aComponent->m_Fields[i] );
// make the editable field position relative to the component
m_FieldsBuf[i].m_Pos -= m_Cmp->m_Pos;
m_FieldsBuf[i].SetPosition( m_FieldsBuf[i].GetPosition() - m_Cmp->m_Pos );
}
// Add template fieldnames:
@ -480,18 +480,18 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
if( !schField )
{
if( !it->m_Visible )
fld.m_Attributs |= TEXT_NO_VISIBLE;
fld.SetVisible( false );
else
fld.m_Attributs &= ~TEXT_NO_VISIBLE;
fld.SetVisible( true );
fld.m_Text = it->m_Value; // empty? ok too.
fld.SetText( it->m_Value ); // empty? ok too.
}
else
{
fld = *schField;
// make the editable field position relative to the component
fld.m_Pos -= m_Cmp->m_Pos;
fld.SetPosition( fld.GetPosition() - m_Cmp->m_Pos );
}
m_FieldsBuf.push_back( fld );
@ -510,7 +510,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
m_FieldsBuf.push_back( *cmp );
// make the editable field position relative to the component
m_FieldsBuf[newNdx].m_Pos -= m_Cmp->m_Pos;
m_FieldsBuf[newNdx].SetPosition( m_FieldsBuf[newNdx].GetPosition() - m_Cmp->m_Pos );
}
}
@ -523,7 +523,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
}
#endif
m_FieldsBuf[REFERENCE].m_Text = m_Cmp->GetRef( &m_Parent->GetCurrentSheet() );
m_FieldsBuf[REFERENCE].SetText( m_Cmp->GetRef( &m_Parent->GetCurrentSheet() ) );
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{
@ -590,31 +590,31 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
SCH_FIELD& field = m_FieldsBuf[fieldNdx];
showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) );
showCheckBox->SetValue( field.IsVisible() );
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
rotateCheckBox->SetValue( field.GetOrientation() == TEXT_ORIENT_VERT );
int style = 0;
if( field.m_Italic )
if( field.IsItalic() )
style = 1;
if( field.m_Bold )
if( field.IsBold() )
style |= 2;
m_StyleRadioBox->SetSelection( style );
// Select the right text justification
if( field.m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
m_FieldHJustifyCtrl->SetSelection(0);
else if( field.m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
else if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
m_FieldHJustifyCtrl->SetSelection(2);
else
m_FieldHJustifyCtrl->SetSelection(1);
if( field.m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
m_FieldVJustifyCtrl->SetSelection(0);
else if( field.m_VJustify == GR_TEXT_VJUSTIFY_TOP )
else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
else
m_FieldVJustifyCtrl->SetSelection(1);
@ -633,7 +633,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
// may only delete user defined fields
deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
fieldValueTextCtrl->SetValue( field.m_Text );
fieldValueTextCtrl->SetValue( field.GetText() );
// For power symbols, the value is NOR editable, because value and pin
// name must be same and can be edited only in library editor
@ -642,23 +642,23 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else
fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) );
wxPoint coord = field.m_Pos;
wxPoint coord = field.GetPosition();
wxPoint zero = -m_Cmp->m_Pos; // relative zero
// If the field value is empty and the position is at relative zero, we
// set the initial position as a small offset from the ref field, and
// orient it the same as the ref field. That is likely to put it at least
// close to the desired position.
if( coord == zero && field.m_Text.IsEmpty() )
if( coord == zero && field.GetText().IsEmpty() )
{
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].m_Orient == TEXT_ORIENT_VERT );
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetOrientation() == TEXT_ORIENT_VERT );
coord.x = m_FieldsBuf[REFERENCE].m_Pos.x
coord.x = m_FieldsBuf[REFERENCE].GetPosition().x
+ ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
coord.y = m_FieldsBuf[REFERENCE].m_Pos.y
coord.y = m_FieldsBuf[REFERENCE].GetPosition().y
+ ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100;
// coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT.
@ -683,17 +683,14 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
SCH_FIELD& field = m_FieldsBuf[fieldNdx];
if( showCheckBox->GetValue() )
field.m_Attributs &= ~TEXT_NO_VISIBLE;
else
field.m_Attributs |= TEXT_NO_VISIBLE;
field.SetVisible( showCheckBox->GetValue() );
if( rotateCheckBox->GetValue() )
field.m_Orient = TEXT_ORIENT_VERT;
field.SetOrientation( TEXT_ORIENT_VERT );
else
field.m_Orient = TEXT_ORIENT_HORIZ;
field.SetOrientation( TEXT_ORIENT_HORIZ );
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
rotateCheckBox->SetValue( field.GetOrientation() == TEXT_ORIENT_VERT );
// Copy the text justification
EDA_TEXT_HJUSTIFY_T hjustify[3] = {
@ -706,8 +703,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
GR_TEXT_VJUSTIFY_TOP
};
field.m_HJustify = hjustify[m_FieldHJustifyCtrl->GetSelection()];
field.m_VJustify = vjustify[m_FieldVJustifyCtrl->GetSelection()];
field.SetHorizJustify( hjustify[m_FieldHJustifyCtrl->GetSelection()] );
field.SetVertJustify( vjustify[m_FieldVJustifyCtrl->GetSelection()] );
field.SetName( fieldNameTextCtrl->GetValue() );
@ -717,27 +714,21 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
* When void, usually netlists are broken
*/
if( !fieldValueTextCtrl->GetValue().IsEmpty() || fieldNdx > VALUE )
field.m_Text = fieldValueTextCtrl->GetValue();
field.SetText( fieldValueTextCtrl->GetValue() );
setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
field.m_Size.y = field.m_Size.x;
int tmp = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
field.SetSize( wxSize( tmp, tmp ) );
int style = m_StyleRadioBox->GetSelection();
if( (style & 1 ) != 0 )
field.m_Italic = true;
else
field.m_Italic = false;
field.SetItalic( (style & 1 ) != 0 );
field.SetBold( (style & 2 ) != 0 );
if( (style & 2 ) != 0 )
field.m_Bold = true;
else
field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
wxPoint pos;
pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
field.SetPosition( pos );
return true;
}
@ -853,11 +844,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
// Perhaps the FOOTPRINT field should also be considered,
// but for most of components it is not set in library
LIB_FIELD& refField = entry->GetReferenceField();
m_Cmp->GetField( REFERENCE )->m_Pos = refField.m_Pos + m_Cmp->m_Pos;
m_Cmp->GetField( REFERENCE )->SetPosition( refField.GetPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( REFERENCE )->ImportValues( refField );
LIB_FIELD& valField = entry->GetValueField();
m_Cmp->GetField( VALUE )->m_Pos = valField.m_Pos + m_Cmp->m_Pos;
m_Cmp->GetField( VALUE )->SetPosition( valField.GetPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( VALUE )->ImportValues( valField );
m_Cmp->SetOrientation( CMP_NORMAL );

View File

@ -99,7 +99,7 @@ void DIALOG_LABEL_EDITOR::InitDialog()
wxString msg;
bool multiLine = false;
if( m_CurrentText->m_MultilineAllowed )
if( m_CurrentText->IsMultilineAllowed() )
{
m_textLabel = m_textLabelMultiLine;
m_textLabelSingleLine->Show(false);
@ -111,7 +111,7 @@ void DIALOG_LABEL_EDITOR::InitDialog()
m_textLabelMultiLine->Show(false);
}
m_textLabel->SetValue( m_CurrentText->m_Text );
m_textLabel->SetValue( m_CurrentText->GetText() );
m_textLabel->SetFocus();
switch( m_CurrentText->Type() )
@ -146,19 +146,19 @@ void DIALOG_LABEL_EDITOR::InitDialog()
if ( !multiLine )
{
max_len =m_CurrentText->m_Text.Length();
max_len =m_CurrentText->GetText().Length();
}
else
{
// calculate the length of the biggest line
// we cannot use the length of the entire text that has no meaning
int curr_len = MINTEXTWIDTH;
int imax = m_CurrentText->m_Text.Len();
int imax = m_CurrentText->GetText().Length();
for( int count = 0; count < imax; count++ )
{
if( m_CurrentText->m_Text[count] == '\n' ||
m_CurrentText->m_Text[count] == '\r' ) // new line
if( m_CurrentText->GetText()[count] == '\n' ||
m_CurrentText->GetText()[count] == '\r' ) // new line
{
curr_len = 0;
}
@ -185,10 +185,10 @@ void DIALOG_LABEL_EDITOR::InitDialog()
int style = 0;
if( m_CurrentText->m_Italic )
if( m_CurrentText->IsItalic() )
style = 1;
if( m_CurrentText->m_Bold )
if( m_CurrentText->IsBold() )
style += 2;
m_TextStyle->SetSelection( style );
@ -197,7 +197,7 @@ void DIALOG_LABEL_EDITOR::InitDialog()
msg = _( "H" ) + units + _( " x W" ) + units;
m_staticSizeUnits->SetLabel( msg );
msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->m_Size.x );
msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->GetSize().x );
m_TextSize->SetValue( msg );
if( m_CurrentText->Type() != SCH_GLOBAL_LABEL_T
@ -257,7 +257,7 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
text = m_textLabel->GetValue();
if( !text.IsEmpty() )
m_CurrentText->m_Text = text;
m_CurrentText->SetText( text );
else if( !m_CurrentText->IsNew() )
{
DisplayError( this, _( "Empty Text!" ) );
@ -267,34 +267,31 @@ void DIALOG_LABEL_EDITOR::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UserUnit, text );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
m_CurrentText->SetSize( wxSize( value, value ) );
if( m_TextShape )
m_CurrentText->SetShape( m_TextShape->GetSelection() );
int style = m_TextStyle->GetSelection();
if( ( style & 1 ) )
m_CurrentText->m_Italic = 1;
else
m_CurrentText->m_Italic = 0;
m_CurrentText->SetItalic( ( style & 1 ) );
if( ( style & 2 ) )
{
m_CurrentText->m_Bold = true;
m_CurrentText->m_Thickness = GetPenSizeForBold( m_CurrentText->m_Size.x );
m_CurrentText->SetBold( true );
m_CurrentText->SetThickness( GetPenSizeForBold( m_CurrentText->GetSize().x ) );
}
else
{
m_CurrentText->m_Bold = false;
m_CurrentText->m_Thickness = 0;
m_CurrentText->SetBold( false );
m_CurrentText->SetThickness( 0 );
}
m_Parent->OnModify();
/* Make the text size as new default size if it is a new text */
if( m_CurrentText->IsNew() )
m_Parent->SetDefaultLabelSize( m_CurrentText->m_Size.x );
m_Parent->SetDefaultLabelSize( m_CurrentText->GetSize().x );
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->GetCanvas()->MoveCursorToCrossHair();

View File

@ -222,7 +222,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
return;
// test if reference prefix is acceptable
if( ! SCH_COMPONENT::IsReferenceStringValid( m_FieldsBuf[REFERENCE].m_Text ) )
if( ! SCH_COMPONENT::IsReferenceStringValid( m_FieldsBuf[REFERENCE].GetText() ) )
{
DisplayError( NULL, _( "Illegal reference prefix. A reference must start by a letter" ) );
return;
@ -235,7 +235,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
*/
/* If a new name entered in the VALUE field, that it not an existing alias name
* or root alias of the component */
wxString newvalue = m_FieldsBuf[VALUE].m_Text;
wxString newvalue = m_FieldsBuf[VALUE].GetText();
if( m_LibEntry->HasAlias( newvalue ) && !m_LibEntry->GetAlias( newvalue )->IsRoot() )
{
@ -255,7 +255,7 @@ An alias %s already exists!\nCannot update this component" ),
// back into the component
for( unsigned i = MANDATORY_FIELDS; i < m_FieldsBuf.size(); )
{
if( m_FieldsBuf[i].GetName().IsEmpty() || m_FieldsBuf[i].m_Text.IsEmpty() )
if( m_FieldsBuf[i].GetName().IsEmpty() || m_FieldsBuf[i].GetText().IsEmpty() )
{
m_FieldsBuf.erase( m_FieldsBuf.begin() + i );
continue;
@ -269,7 +269,7 @@ An alias %s already exists!\nCannot update this component" ),
{
printf( "save[%d].name:'%s' value:'%s'\n", i,
TO_UTF8( m_FieldsBuf[i].GetName() ),
TO_UTF8( m_FieldsBuf[i].m_Text ) );
TO_UTF8( m_FieldsBuf[i].GetText() ) );
}
#endif
@ -277,7 +277,7 @@ An alias %s already exists!\nCannot update this component" ),
m_LibEntry->SetFields( m_FieldsBuf );
// We need to keep the name and the value the same at the moment!
SetName( m_LibEntry->GetValueField().m_Text );
SetName( m_LibEntry->GetValueField().GetText() );
m_Parent->OnModify();
@ -329,7 +329,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
m_skipCopyFromPanel = true;
if( m_FieldsBuf[fieldNdx].m_Text.IsEmpty() )
if( m_FieldsBuf[fieldNdx].GetText().IsEmpty() )
{
m_FieldsBuf.erase( m_FieldsBuf.begin() + fieldNdx );
fieldListCtrl->DeleteItem( fieldNdx );
@ -339,7 +339,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
}
else
{
m_FieldsBuf[fieldNdx].m_Text.Empty();
m_FieldsBuf[fieldNdx].Empty();
copySelectedFieldToPanel();
}
@ -512,12 +512,12 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
D( printf( "add template:%s\n", TO_UTF8( it->m_Name ) ); )
fld.SetName( it->m_Name );
fld.m_Text = it->m_Value; // empty? ok too.
fld.SetText( it->m_Value ); // empty? ok too.
if( !it->m_Visible )
fld.m_Attributs |= TEXT_NO_VISIBLE;
fld.SetVisible( false );
else
fld.m_Attributs &= ~TEXT_NO_VISIBLE;
fld.SetVisible( true );;
}
else
{
@ -580,7 +580,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FI
}
fieldListCtrl->SetItem( aFieldNdx, COLUMN_FIELD_NAME, aField.GetName() );
fieldListCtrl->SetItem( aFieldNdx, COLUMN_TEXT, aField.m_Text );
fieldListCtrl->SetItem( aFieldNdx, COLUMN_TEXT, aField.GetText() );
// recompute the column widths here, after setting texts
fieldListCtrl->SetColumnWidth( COLUMN_FIELD_NAME, wxLIST_AUTOSIZE );
@ -599,30 +599,31 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
LIB_FIELD& field = m_FieldsBuf[fieldNdx];
showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) );
showCheckBox->SetValue( field.IsVisible() );
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
rotateCheckBox->SetValue( field.GetOrientation() == TEXT_ORIENT_VERT );
int style = 0;
if( field.m_Italic )
if( field.IsItalic() )
style = 1;
if( field.m_Bold )
if( field.IsBold() )
style |= 2;
m_StyleRadioBox->SetSelection( style );
// Select the right text justification
if( field.m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
m_FieldHJustifyCtrl->SetSelection(0);
else if( field.m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
else if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
m_FieldHJustifyCtrl->SetSelection(2);
else
m_FieldHJustifyCtrl->SetSelection(1);
if( field.m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
m_FieldVJustifyCtrl->SetSelection(0);
else if( field.m_VJustify == GR_TEXT_VJUSTIFY_TOP )
else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
m_FieldVJustifyCtrl->SetSelection(2);
else
m_FieldVJustifyCtrl->SetSelection(1);
@ -656,23 +657,23 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
// if fieldNdx == REFERENCE, VALUE, then disable delete button
deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS );
fieldValueTextCtrl->SetValue( field.m_Text );
fieldValueTextCtrl->SetValue( field.GetText() );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) );
wxPoint coord = field.m_Pos;
wxPoint coord = field.GetPosition();
wxPoint zero;
// If the field value is empty and the position is at relative zero, we set the
// initial position as a small offset from the ref field, and orient
// it the same as the ref field. That is likely to put it at least
// close to the desired position.
if( coord == zero && field.m_Text.IsEmpty() )
if( coord == zero && field.GetText().IsEmpty() )
{
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].m_Orient == TEXT_ORIENT_VERT );
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetOrientation() == TEXT_ORIENT_VERT );
coord.x = m_FieldsBuf[REFERENCE].m_Pos.x + (fieldNdx - MANDATORY_FIELDS + 1) * 100;
coord.y = m_FieldsBuf[REFERENCE].m_Pos.y + (fieldNdx - MANDATORY_FIELDS + 1) * 100;
coord.x = m_FieldsBuf[REFERENCE].GetPosition().x + (fieldNdx - MANDATORY_FIELDS + 1) * 100;
coord.y = m_FieldsBuf[REFERENCE].GetPosition().y + (fieldNdx - MANDATORY_FIELDS + 1) * 100;
// coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT.
// That is ok, we basically don't want all the new empty fields on
@ -702,14 +703,14 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
LIB_FIELD& field = m_FieldsBuf[fieldNdx];
if( showCheckBox->GetValue() )
field.m_Attributs &= ~TEXT_NO_VISIBLE;
field.SetVisible( true );
else
field.m_Attributs |= TEXT_NO_VISIBLE;
field.SetVisible( false );
if( rotateCheckBox->GetValue() )
field.m_Orient = TEXT_ORIENT_VERT;
field.SetOrientation( TEXT_ORIENT_VERT );
else
field.m_Orient = TEXT_ORIENT_HORIZ;
field.SetOrientation( TEXT_ORIENT_HORIZ );
// Copy the text justification
static const EDA_TEXT_HJUSTIFY_T hjustify[3] = {
@ -722,14 +723,14 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
GR_TEXT_VJUSTIFY_TOP
};
field.m_HJustify = hjustify[m_FieldHJustifyCtrl->GetSelection()];
field.m_VJustify = vjustify[m_FieldVJustifyCtrl->GetSelection()];
field.SetHorizJustify( hjustify[m_FieldHJustifyCtrl->GetSelection()] );
field.SetVertJustify( vjustify[m_FieldVJustifyCtrl->GetSelection()] );
// Blank/empty field texts for REFERENCE and VALUE are not allowed.
// (Value is the name of the component in lib!)
// Change them only if user provided a non blank value
if( !fieldValueTextCtrl->GetValue().IsEmpty() || fieldNdx > VALUE )
field.m_Text = fieldValueTextCtrl->GetValue();
field.SetText( fieldValueTextCtrl->GetValue() );
// FieldNameTextCtrl has a tricked value in it for VALUE index, do not copy it back.
// It has the "Chip Name" appended.
@ -744,27 +745,23 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
int tmp = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
field.m_Size.y = field.m_Size.x;
field.SetSize( wxSize( tmp, tmp ) );
int style = m_StyleRadioBox->GetSelection();
if( (style & 1 ) != 0 )
field.m_Italic = true;
else
field.m_Italic = false;
if( (style & 2 ) != 0 )
field.m_Bold = true;
else
field.m_Bold = false;
field.SetItalic( (style & 1 ) != 0 );
field.SetBold( (style & 2 ) != 0 );
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
wxPoint pos( ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() ),
ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() ) );
// Note: the Y axis for components in lib is from bottom to top
// and the screen axis is top to bottom: we must change the y coord sign for editing
NEGATE( field.m_Pos.y );
NEGATE( pos.y );
field.SetPosition( pos );
return true;
}

View File

@ -101,21 +101,21 @@ void DIALOG_EDIT_ONE_FIELD::initDlg_base()
void DIALOG_LIB_EDIT_ONE_FIELD::initDlg()
{
m_textsize = m_field->m_Size.x;
m_TextValue->SetValue( m_field->m_Text );
m_textsize = m_field->GetSize().x;
m_TextValue->SetValue( m_field->GetText() );
m_textorient = m_field->GetOrientation();
m_text_invisible = m_field->IsVisible() ? false : true;
m_textshape = 0;
if( m_field->m_Italic )
if( m_field->IsItalic() )
m_textshape = 1;
if( m_field->m_Bold )
if( m_field->IsBold() )
m_textshape |= 2;
m_textHjustify = m_field->m_HJustify;
m_textVjustify = m_field->m_VJustify;
m_textHjustify = m_field->GetHorizJustify();
m_textVjustify = m_field->GetVertJustify();
initDlg_base();
}
@ -171,44 +171,31 @@ void DIALOG_LIB_EDIT_ONE_FIELD::TransfertDataToField()
m_field->SetText( GetTextField() );
m_field->m_Size.x = m_field->m_Size.y = m_textsize;
m_field->m_Orient = m_textorient;
if( m_Invisible->GetValue() )
m_field->m_Attributs |= TEXT_NO_VISIBLE;
else
m_field->m_Attributs &= ~TEXT_NO_VISIBLE;
if( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 )
m_field->m_Italic = true;
else
m_field->m_Italic = false;
if( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 )
m_field->m_Bold = true;
else
m_field->m_Bold = false;
m_field->m_HJustify = m_textHjustify;
m_field->m_VJustify = m_textVjustify;
m_field->SetSize( wxSize( m_textsize, m_textsize ) );
m_field->SetOrientation( m_textorient );
m_field->SetVisible( !m_Invisible->GetValue() );
m_field->SetItalic( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 );
m_field->SetBold( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 );
m_field->SetHorizJustify( m_textHjustify );
m_field->SetVertJustify( m_textVjustify );
}
void DIALOG_SCH_EDIT_ONE_FIELD::initDlg()
{
m_textsize = m_field->m_Size.x;
m_TextValue->SetValue( m_field->m_Text );
m_textsize = m_field->GetSize().x;
m_TextValue->SetValue( m_field->GetText() );
m_textorient = m_field->GetOrientation();
m_text_invisible = m_field->IsVisible() ? false : true;
m_textshape = 0;
if( m_field->m_Italic )
if( m_field->IsItalic() )
m_textshape = 1;
if( m_field->m_Bold )
if( m_field->IsBold() )
m_textshape |= 2;
m_textHjustify = m_field->m_HJustify;
m_textVjustify = m_field->m_VJustify;
m_textHjustify = m_field->GetHorizJustify();
m_textVjustify = m_field->GetVertJustify();
initDlg_base();
}
@ -228,24 +215,12 @@ void DIALOG_SCH_EDIT_ONE_FIELD::TransfertDataToField()
m_field->SetText( GetTextField() );
m_field->m_Size.x = m_field->m_Size.y = m_textsize;
m_field->m_Orient = m_textorient;
m_field->SetSize( wxSize( m_textsize, m_textsize ) );
m_field->SetOrientation( m_textorient );
m_field->SetVisible( !m_Invisible->GetValue() );
if( m_Invisible->GetValue() )
m_field->m_Attributs |= TEXT_NO_VISIBLE;
else
m_field->m_Attributs &= ~TEXT_NO_VISIBLE;
if( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 )
m_field->m_Italic = true;
else
m_field->m_Italic = false;
if( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 )
m_field->m_Bold = true;
else
m_field->m_Bold = false;
m_field->m_HJustify = m_textHjustify;
m_field->m_VJustify = m_textVjustify;
m_field->SetItalic( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 );
m_field->SetBold( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 );
m_field->SetHorizJustify( m_textHjustify );
m_field->SetVertJustify( m_textVjustify );
}

View File

@ -64,26 +64,26 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
if ( m_graphicText )
{
msg = ReturnStringFromValue( g_UserUnit, m_graphicText->m_Size.x );
msg = ReturnStringFromValue( g_UserUnit, m_graphicText->GetSize().x );
m_TextSize->SetValue( msg );
m_TextValue->SetValue( m_graphicText->m_Text );
m_TextValue->SetValue( m_graphicText->GetText() );
if ( m_graphicText->GetUnit() == 0 )
m_CommonUnit->SetValue( true );
if ( m_graphicText->GetConvert() == 0 )
m_CommonConvert->SetValue( true );
if ( m_graphicText->m_Orient == TEXT_ORIENT_VERT )
if ( m_graphicText->GetOrientation() == TEXT_ORIENT_VERT )
m_Orient->SetValue( true );
int shape = 0;
if ( m_graphicText->m_Italic )
if ( m_graphicText->IsItalic() )
shape = 1;
if ( m_graphicText->m_Bold )
if ( m_graphicText->IsBold() )
shape |= 2;
m_TextShapeOpt->SetSelection( shape );
switch ( m_graphicText->m_HJustify )
switch ( m_graphicText->GetHorizJustify() )
{
case GR_TEXT_HJUSTIFY_LEFT:
m_TextHJustificationOpt->SetSelection( 0 );
@ -99,7 +99,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
}
switch ( m_graphicText->m_VJustify )
switch ( m_graphicText->GetVertJustify() )
{
case GR_TEXT_VJUSTIFY_BOTTOM:
m_TextVJustificationOpt->SetSelection( 0 );
@ -159,8 +159,8 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
else
m_graphicText->SetText( wxT( "[null]" ) );
m_graphicText->m_Size.x = m_graphicText->m_Size.y = m_parent->m_textSize;
m_graphicText->m_Orient = m_parent->m_textOrientation;
m_graphicText->SetSize( wxSize( m_parent->m_textSize, m_parent->m_textSize ) );
m_graphicText->SetOrientation( m_parent->m_textOrientation );
if( m_parent->m_drawSpecificUnit )
m_graphicText->SetUnit( m_parent->GetUnit() );
@ -172,43 +172,36 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
else
m_graphicText->SetConvert( 0 );
if( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 )
m_graphicText->m_Italic = true;
else
m_graphicText->m_Italic = false;
if( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 )
m_graphicText->m_Bold = true;
else
m_graphicText->m_Bold = false;
m_graphicText->SetItalic( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 );
m_graphicText->SetBold( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 );
switch( m_TextHJustificationOpt->GetSelection() )
{
case 0:
m_graphicText->m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
break;
case 1:
m_graphicText->m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
break;
case 2:
m_graphicText->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
m_graphicText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
break;
}
switch( m_TextVJustificationOpt->GetSelection() )
{
case 0:
m_graphicText->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
break;
case 1:
m_graphicText->m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
break;
case 2:
m_graphicText->m_VJustify = GR_TEXT_VJUSTIFY_TOP;
m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
break;
}
}

View File

@ -93,7 +93,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
}
// Draw the bitmap at it's new position.
image->SetPosition( screen->GetCrossHairPosition() );
image->Move( screen->GetCrossHairPosition() );
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}

View File

@ -75,7 +75,7 @@ create a new power component with the new value." ), GetChars( entry->GetName()
// Don't use GetText() here. If the field is the reference designator and it's parent
// component has multiple parts, we don't want the part suffix added to the field.
wxString newtext = aField->m_Text;
wxString newtext = aField->GetText();
m_canvas->SetIgnoreMouseEvents( true );
wxString title;
@ -155,10 +155,10 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField, wxDC* aDC )
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
if( aField->m_Orient == TEXT_ORIENT_HORIZ )
aField->m_Orient = TEXT_ORIENT_VERT;
if( aField->GetOrientation() == TEXT_ORIENT_HORIZ )
aField->SetOrientation( TEXT_ORIENT_VERT );
else
aField->m_Orient = TEXT_ORIENT_HORIZ;
aField->SetOrientation( TEXT_ORIENT_HORIZ );
aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );

View File

@ -99,23 +99,23 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
return NULL;
}
textItem->m_Bold = lastTextBold;
textItem->m_Italic = lastTextItalic;
textItem->SetBold( lastTextBold );
textItem->SetItalic( lastTextItalic );
textItem->SetOrientation( lastTextOrientation );
textItem->m_Size.x = textItem->m_Size.y = GetDefaultLabelSize();
textItem->SetSize( wxSize( GetDefaultLabelSize(), GetDefaultLabelSize() ) );
textItem->SetFlags( IS_NEW | IS_MOVED );
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
EditSchematicText( textItem );
if( textItem->m_Text.IsEmpty() )
if( textItem->GetText().IsEmpty() )
{
SAFE_DELETE( textItem );
return NULL;
}
lastTextBold = textItem->m_Bold;
lastTextItalic = textItem->m_Italic;
lastTextBold = textItem->IsBold();
lastTextItalic = textItem->IsItalic();
lastTextOrientation = textItem->GetOrientation();
if( (aType == SCH_GLOBAL_LABEL_T) || (aType == SCH_HIERARCHICAL_LABEL_T) )
@ -180,19 +180,19 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
switch( type )
{
case SCH_LABEL_T:
newtext = new SCH_LABEL( text->m_Pos, text->m_Text );
newtext = new SCH_LABEL( text->GetPosition(), text->GetText() );
break;
case SCH_GLOBAL_LABEL_T:
newtext = new SCH_GLOBALLABEL( text->m_Pos, text->m_Text );
newtext = new SCH_GLOBALLABEL( text->GetPosition(), text->GetText() );
break;
case SCH_HIERARCHICAL_LABEL_T:
newtext = new SCH_HIERLABEL( text->m_Pos, text->m_Text );
newtext = new SCH_HIERLABEL( text->GetPosition(), text->GetText() );
break;
case SCH_TEXT_T:
newtext = new SCH_TEXT( text->m_Pos, text->m_Text );
newtext = new SCH_TEXT( text->GetPosition(), text->GetText() );
break;
default:
@ -208,10 +208,10 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
newtext->SetFlags( text->GetFlags() );
newtext->SetShape( text->GetShape() );
newtext->SetOrientation( text->GetOrientation() );
newtext->m_Size = text->m_Size;
newtext->m_Thickness = text->m_Thickness;
newtext->m_Italic = text->m_Italic;
newtext->m_Bold = text->m_Bold;
newtext->SetSize( text->GetSize() );
newtext->SetThickness( text->GetThickness() );
newtext->SetItalic( text->IsItalic() );
newtext->SetBold( text->IsBold() );
/* Save the new text in undo list if the old text was not itself a "new created text"
* In this case, the old text is already in undo list as a deleted item.

View File

@ -174,7 +174,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
case FIND_VALUE: // find value
pos = pSch->GetPosition();
if( aSearchText.CmpNoCase( pSch->GetField( VALUE )->m_Text ) != 0 )
if( aSearchText.CmpNoCase( pSch->GetField( VALUE )->GetText() ) != 0 )
break;
notFound = false;

View File

@ -257,7 +257,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
component->SetLibName( Name );
// Set the component value that can differ from component name in lib, for aliases
component->GetField( VALUE )->m_Text = Name;
component->GetField( VALUE )->SetText( Name );
MSG_PANEL_ITEMS items;
component->SetCurrentSheetPath( &GetCurrentSheet() );

View File

@ -257,12 +257,12 @@ void LIB_EDIT_FRAME::RedrawComponent( wxDC* aDC, wxPoint aOffset )
// although it is stored without ? and part id.
// So temporary change the reference by a schematic like reference
LIB_FIELD* Field = m_component->GetField( REFERENCE );
wxString fieldText = Field->m_Text;
wxString fieldText = Field->GetText();
wxString fieldfullText = Field->GetFullText( m_unit );
Field->m_Text = fieldfullText;
Field->SetText( fieldfullText );
m_component->Draw( m_canvas, aDC, aOffset, m_unit,
m_convert, GR_DEFAULT_DRAWMODE );
Field->m_Text = fieldText;
Field->SetText( fieldText );
}
}
@ -623,7 +623,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
}
LIB_COMPONENT* component = new LIB_COMPONENT( name );
component->GetReferenceField().m_Text = dlg.GetReference();
component->GetReferenceField().SetText( dlg.GetReference() );
component->SetPartCount( dlg.GetPartCount() );
// Initialize component->m_TextInside member:

View File

@ -71,7 +71,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
* the old one. Rename the component and remove any conflicting aliases to prevent name
* errors when updating the library.
*/
if( (aField->GetId() == VALUE) && ( text != aField->m_Text ) )
if( (aField->GetId() == VALUE) && ( text != aField->GetText() ) )
{
wxString msg;

View File

@ -777,10 +777,10 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericLibParts()
for( unsigned i=0; i<fieldList.size(); ++i )
{
if( !fieldList[i].m_Text.IsEmpty() )
if( !fieldList[i].GetText().IsEmpty() )
{
XNODE* xfield;
xfields->AddChild( xfield = node( sField, fieldList[i].m_Text ) );
xfields->AddChild( xfield = node( sField, fieldList[i].GetText() ) );
xfield->AddAttribute( sName, fieldList[i].GetName(false) );
}
}
@ -1000,13 +1000,13 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericComponents()
xcomps->AddChild( xcomp = node( sComponent ) );
xcomp->AddAttribute( sRef, comp->GetRef( path ) );
xcomp->AddChild( node( sValue, comp->GetField( VALUE )->m_Text ) );
xcomp->AddChild( node( sValue, comp->GetField( VALUE )->GetText() ) );
if( !comp->GetField( FOOTPRINT )->IsVoid() )
xcomp->AddChild( node( sFootprint, comp->GetField( FOOTPRINT )->m_Text ) );
xcomp->AddChild( node( sFootprint, comp->GetField( FOOTPRINT )->GetText() ) );
if( !comp->GetField( DATASHEET )->IsVoid() )
xcomp->AddChild( node( sDatasheet, comp->GetField( DATASHEET )->m_Text ) );
xcomp->AddChild( node( sDatasheet, comp->GetField( DATASHEET )->GetText() ) );
// Export all user defined fields within the component,
// which start at field index MANDATORY_FIELDS. Only output the <fields>
@ -1024,7 +1024,7 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericComponents()
if( !f->IsVoid() )
{
XNODE* xfield;
xfields->AddChild( xfield = node( sField, f->m_Text ) );
xfields->AddChild( xfield = node( sField, f->GetText() ) );
xfield->AddAttribute( sName, f->GetName() );
}
}
@ -1229,7 +1229,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPspice( FILE* f, bool use_netnames, bool a
SCH_TEXT* drawText = (SCH_TEXT*) item;
text = drawText->m_Text;
text = drawText->GetText();
if( text.IsEmpty() )
continue;
@ -1247,14 +1247,15 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPspice( FILE* f, bool use_netnames, bool a
{
// Put the Y position as an ascii string, for sort by vertical
// position, using usual sort string by alphabetic value
int ypos = drawText->m_Pos.y;
int ypos = drawText->GetPosition().y;
for( int ii = 0; ii < BUFYPOS_LEN; ii++ )
{
bufnum[BUFYPOS_LEN - 1 - ii] = (ypos & 63) + ' ';
ypos >>= 6;
}
text = drawText->m_Text.AfterFirst( ' ' );
text = drawText->GetText().AfterFirst( ' ' );
// First BUFYPOS_LEN char are the Y position.
msg.Printf( wxT( "%s %s" ), bufnum, text.GetData() );
@ -1305,7 +1306,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPspice( FILE* f, bool use_netnames, bool a
SCH_FIELD* netlistEnabledField = comp->FindField( wxT( "Spice_Netlist_Enabled" ) );
if( netlistEnabledField )
{
wxString netlistEnabled = netlistEnabledField->m_Text;
wxString netlistEnabled = netlistEnabledField->GetText();
if( netlistEnabled.IsEmpty() )
break;
@ -1319,7 +1320,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPspice( FILE* f, bool use_netnames, bool a
if( spiceSeqField )
{
// Get String containing the Sequence of Nodes:
wxString nodeSeqIndexLineStr = spiceSeqField->m_Text;
wxString nodeSeqIndexLineStr = spiceSeqField->GetText();
// Verify Field Exists and is not empty:
if( nodeSeqIndexLineStr.IsEmpty() )
@ -1416,7 +1417,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPspice( FILE* f, bool use_netnames, bool a
}
// Get Component Value Name:
wxString CompValue = comp->GetField( VALUE )->m_Text;
wxString CompValue = comp->GetField( VALUE )->GetText();
// Check if Override Model Name is Provided:
SCH_FIELD* spiceModelField = comp->FindField( wxT( "spice_model" ) );
@ -1424,7 +1425,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPspice( FILE* f, bool use_netnames, bool a
if( spiceModelField )
{
// Get Model Name String:
wxString ModelNameStr = spiceModelField->m_Text;
wxString ModelNameStr = spiceModelField->GetText();
// Verify Field Exists and is not empty:
if( !ModelNameStr.IsEmpty() )
@ -1527,7 +1528,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
if( !comp->GetField( FOOTPRINT )->IsVoid() )
{
footprint = comp->GetField( FOOTPRINT )->m_Text;
footprint = comp->GetField( FOOTPRINT )->GetText();
footprint.Replace( wxT( " " ), wxT( "_" ) );
}
else
@ -1541,7 +1542,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListPCBNEW( FILE* f, bool with_pcbnew )
ret |= fprintf( f, " %s", TO_UTF8( field ) );
field = comp->GetField( VALUE )->m_Text;
field = comp->GetField( VALUE )->GetText();
field.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " %s", TO_UTF8( field ) );
@ -1901,7 +1902,7 @@ bool NETLIST_EXPORT_TOOL::WriteNetListCADSTAR( FILE* f )
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
msg = Component->GetField( VALUE )->m_Text;
msg = Component->GetField( VALUE )->GetText();
msg.Replace( wxT( " " ), wxT( "_" ) );
ret |= fprintf( f, " \"%s\"", TO_UTF8( msg ) );
ret |= fprintf( f, "\n" );

View File

@ -74,7 +74,7 @@ private:
bool m_IsNew; ///< True if not yet annotated.
int m_SheetNum; ///< The sheet number for the reference.
time_t m_TimeStamp; ///< The time stamp for the reference.
wxString* m_Value; ///< The component value of the refernce. It is the
EDA_TEXT* m_Value; ///< The component value of the refernce. It is the
///< same for all instances.
int m_NumRef; ///< The numeric part of the reference designator.
int m_Flag;
@ -148,7 +148,7 @@ public:
int CompareValue( const SCH_REFERENCE& item ) const
{
return m_Value->CmpNoCase( *item.m_Value );
return m_Value->GetText().CmpNoCase( item.m_Value->GetText() );
}
int CompareRef( const SCH_REFERENCE& item ) const

View File

@ -351,7 +351,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
if( !Component->GetFlags() )
{
msg = _( "Move Component" );
msg << wxT( " " ) << Component->GetField( REFERENCE )->m_Text;
msg << wxT( " " ) << Component->GetField( REFERENCE )->GetText();
msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG );
@ -600,7 +600,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
/* add menu change type text (to label, glabel, text),
* but only if this is a single line text
*/
if( Text->m_Text.Find( wxT( "\n" ) ) == wxNOT_FOUND )
if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
{
AddMenuItem( menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL,
_( "Change to Label" ), KiBitmap( label2text_xpm ) );

View File

@ -243,7 +243,7 @@ another pin. Continue?" ) );
m_canvas->SetMouseCapture( NULL, NULL );
OnModify();
CurrentPin->SetPosition( newpos );
CurrentPin->Move( newpos );
if( CurrentPin->IsNew() )
{
@ -264,7 +264,7 @@ another pin. Continue?" ) );
if( Pin->GetFlags() == 0 )
continue;
Pin->SetPosition( CurrentPin->GetPosition() );
Pin->Move( CurrentPin->GetPosition() );
Pin->ClearFlags();
}
@ -344,13 +344,13 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
// Erase pin in old position
if( aErase )
{
CurrentPin->SetPosition( PinPreviousPos );
CurrentPin->Move( PinPreviousPos );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
&showPinText, DefaultTransform );
}
// Redraw pin in new position
CurrentPin->SetPosition( aPanel->GetScreen()->GetCrossHairPosition( true ) );
CurrentPin->Move( aPanel->GetScreen()->GetCrossHairPosition( true ) );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
&showPinText, DefaultTransform );
@ -359,7 +359,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
/* Keep the original position for existing pin (for Undo command)
* and the current position for a new pin */
if( !CurrentPin->IsNew() )
CurrentPin->SetPosition( pinpos );
CurrentPin->Move( pinpos );
}
@ -388,7 +388,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
if( SynchronizePins() )
pin->SetFlags( IS_LINKED );
pin->SetPosition( GetScreen()->GetCrossHairPosition( true ) );
pin->Move( GetScreen()->GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength );
pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType );
@ -541,7 +541,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
Pin = (LIB_PIN*) SourcePin->Clone();
Pin->ClearFlags();
Pin->SetFlags( IS_NEW );
Pin->SetPosition( Pin->GetPosition() + wxPoint( g_RepeatStep.x, -g_RepeatStep.y ) );
Pin->Move( Pin->GetPosition() + wxPoint( g_RepeatStep.x, -g_RepeatStep.y ) );
wxString nextName = Pin->GetName();
IncrementLabelMember( nextName );
Pin->SetName( nextName );

View File

@ -107,8 +107,8 @@ void CreateDummyCmp()
LIB_TEXT* Text = new LIB_TEXT( DummyCmp );
Text->m_Size.x = Text->m_Size.y = 150;
Text->m_Text = wxT( "??" );
Text->SetSize( wxSize( 150, 150 ) );
Text->SetText( wxString( wxT( "??" ) ) );
DummyCmp->AddDrawItem( Square );
DummyCmp->AddDrawItem( Text );
@ -157,14 +157,14 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet
schField = AddField( fld );
}
schField->m_Pos = m_Pos + it->m_Pos;
schField->SetPosition( m_Pos + it->GetPosition() );
schField->ImportValues( *it );
schField->m_Text = it->m_Text;
schField->SetText( it->GetText() );
}
wxString msg = libComponent.GetReferenceField().m_Text;
wxString msg = libComponent.GetReferenceField().GetText();
if( msg.IsEmpty() )
msg = wxT( "U" );
@ -178,7 +178,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet
/* Use the schematic component name instead of the library value field
* name.
*/
GetField( VALUE )->m_Text = m_ChipName;
GetField( VALUE )->SetText( m_ChipName );
}
@ -420,10 +420,10 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
// this will happen if we load a version 1 schematic file.
// it will also mean that multiple instances of the same sheet by default
// all have the same component references, but perhaps this is best.
if( !GetField( REFERENCE )->m_Text.IsEmpty() )
if( !GetField( REFERENCE )->GetText().IsEmpty() )
{
SetRef( sheet, GetField( REFERENCE )->m_Text );
return GetField( REFERENCE )->m_Text;
SetRef( sheet, GetField( REFERENCE )->GetText() );
return GetField( REFERENCE )->GetText();
}
return m_prefix;
@ -489,17 +489,15 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
SCH_FIELD* rf = GetField( REFERENCE );
if( rf->m_Text.IsEmpty()
|| ( abs( rf->m_Pos.x - m_Pos.x ) +
abs( rf->m_Pos.y - m_Pos.y ) > 10000 ) )
if( rf->GetText().IsEmpty()
|| ( abs( rf->GetPosition().x - m_Pos.x ) +
abs( rf->GetPosition().y - m_Pos.y ) > 10000 ) )
{
// move it to a reasonable position
rf->m_Pos = m_Pos;
rf->m_Pos.x += 50; // a slight offset
rf->m_Pos.y += 50;
rf->SetPosition( m_Pos + wxPoint( 50, 50 ) );
}
rf->m_Text = ref; // for drawing.
rf->SetText( ref ); // for drawing.
// Reinit the m_prefix member if needed
wxString prefix = ref;
@ -750,7 +748,7 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
// When a clear annotation is made, the calling function must call a
// UpdateAllScreenReferences for the active sheet.
// But this call cannot made here.
m_Fields[REFERENCE].m_Text = defRef; //for drawing.
m_Fields[REFERENCE].SetText( defRef ); //for drawing.
SetModified();
}
@ -943,7 +941,7 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) const
// skip the reference, it's been output already.
for( int i = 1; i < GetFieldCount(); ++i )
{
wxString value = GetField( i )->m_Text;
wxString value = GetField( i )->GetText();
if( !value.IsEmpty() )
{
@ -978,10 +976,10 @@ bool SCH_COMPONENT::Save( FILE* f ) const
}
else
{
if( GetField( REFERENCE )->m_Text.IsEmpty() )
if( GetField( REFERENCE )->GetText().IsEmpty() )
name1 = toUTFTildaText( m_prefix );
else
name1 = toUTFTildaText( GetField( REFERENCE )->m_Text );
name1 = toUTFTildaText( GetField( REFERENCE )->GetText() );
}
if( !m_ChipName.IsEmpty() )
@ -1121,14 +1119,14 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_ChipName = FROM_UTF8( name1 );
if( !newfmt )
GetField( VALUE )->m_Text = FROM_UTF8( name1 );
GetField( VALUE )->SetText( FROM_UTF8( name1 ) );
}
else
{
m_ChipName.Empty();
GetField( VALUE )->m_Text.Empty();
GetField( VALUE )->m_Orient = TEXT_ORIENT_HORIZ;
GetField( VALUE )->m_Attributs = TEXT_NO_VISIBLE;
GetField( VALUE )->Empty();
GetField( VALUE )->SetOrientation( TEXT_ORIENT_HORIZ );
GetField( VALUE )->SetVisible( false );
}
if( strcmp( name2, NULL_STRING ) != 0 )
@ -1172,11 +1170,11 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
}
if( !newfmt )
GetField( REFERENCE )->m_Text = FROM_UTF8( name2 );
GetField( REFERENCE )->SetText( FROM_UTF8( name2 ) );
}
else
{
GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE;
GetField( REFERENCE )->SetVisible( false );
}
/* Parse component description
@ -1205,10 +1203,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
// Set fields position to a default position (that is the
// component position. For existing fields, the real position
// will be set later
for( int i = 0; i<GetFieldCount(); ++i )
for( int i = 0; i<GetFieldCount(); i++ )
{
if( GetField( i )->m_Text.IsEmpty() )
GetField( i )->m_Pos = m_Pos;
if( GetField( i )->GetText().IsEmpty() )
GetField( i )->SetPosition( m_Pos );
}
}
else if( line[0] == 'A' && line[1] == 'R' )
@ -1244,7 +1242,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
multi = 1;
AddHierarchicalReference( path, ref, multi );
GetField( REFERENCE )->m_Text = ref;
GetField( REFERENCE )->SetText( ref );
}
else if( line[0] == 'F' )
{
@ -1306,14 +1304,11 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
GetField( fieldNdx )->SetName( fieldName );
}
GetField( fieldNdx )->m_Text = fieldText;
GetField( fieldNdx )->SetText( fieldText );
memset( char3, 0, sizeof(char3) );
int x, y, w, attr;
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", char1,
&GetField( fieldNdx )->m_Pos.x,
&GetField( fieldNdx )->m_Pos.y,
&GetField( fieldNdx )->m_Size.x,
&GetField( fieldNdx )->m_Attributs,
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", char1, &x, &y, &w, &attr,
char2, char3 ) ) < 4 )
{
aErrorMsg.Printf( wxT( "Component Field error line %d, aborted" ),
@ -1321,14 +1316,17 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
continue;
}
if( (GetField( fieldNdx )->m_Size.x == 0 ) || (ii == 4) )
GetField( fieldNdx )->m_Size.x = DEFAULT_SIZE_TEXT;
GetField( fieldNdx )->SetTextPosition( wxPoint( x, y ) );
GetField( fieldNdx )->SetAttributes( attr );
GetField( fieldNdx )->m_Orient = TEXT_ORIENT_HORIZ;
GetField( fieldNdx )->m_Size.y = GetField( fieldNdx )->m_Size.x;
if( (w == 0 ) || (ii == 4) )
w = DEFAULT_SIZE_TEXT;
GetField( fieldNdx )->SetSize( wxSize( w, w ) );
GetField( fieldNdx )->SetOrientation( TEXT_ORIENT_HORIZ );
if( char1[0] == 'V' )
GetField( fieldNdx )->m_Orient = TEXT_ORIENT_VERT;
GetField( fieldNdx )->SetOrientation( TEXT_ORIENT_VERT );
if( ii >= 7 )
{
@ -1342,23 +1340,15 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
else if( char3[0] == 'T' )
vjustify = GR_TEXT_VJUSTIFY_TOP;
if( char3[1] == 'I' )
GetField( fieldNdx )->m_Italic = true;
else
GetField( fieldNdx )->m_Italic = false;
if( char3[2] == 'B' )
GetField( fieldNdx )->m_Bold = true;
else
GetField( fieldNdx )->m_Bold = false;
GetField( fieldNdx )->m_HJustify = hjustify;
GetField( fieldNdx )->m_VJustify = vjustify;
GetField( fieldNdx )->SetItalic( char3[1] == 'I' );
GetField( fieldNdx )->SetBold( char3[2] == 'B' );
GetField( fieldNdx )->SetHorizJustify( hjustify );
GetField( fieldNdx )->SetVertJustify( vjustify );
}
if( fieldNdx == REFERENCE )
if( GetField( fieldNdx )->m_Text[0] == '#' )
GetField( fieldNdx )->m_Attributs |= TEXT_NO_VISIBLE;
if( GetField( fieldNdx )->GetText()[0] == '#' )
GetField( fieldNdx )->SetVisible( false );
}
else
{
@ -1485,7 +1475,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
else
msg = _( "Name" );
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->m_Text, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->GetText(), DARKCYAN ) );
// Display component reference in library and library
aList.push_back( MSG_PANEL_ITEM( _( "Component" ), m_ChipName, BROWN ) );
@ -1497,7 +1487,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
// Display the current associated footprin, if exists.
if( ! GetField( FOOTPRINT )->IsVoid() )
msg = GetField( FOOTPRINT )->m_Text;
msg = GetField( FOOTPRINT )->GetText();
else
msg = _("<Unknown>");
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKRED ) );
@ -1520,9 +1510,10 @@ void SCH_COMPONENT::MirrorY( int aYaxis_position )
for( int ii = 0; ii < GetFieldCount(); ii++ )
{
/* move the fields to the new position because the component itself
* has moved */
GetField( ii )->m_Pos.x -= dx;
// Move the fields to the new position because the component itself has moved.
wxPoint pos = GetField( ii )->GetPosition();
pos.x -= dx;
GetField( ii )->SetPosition( pos );
}
}
@ -1539,9 +1530,10 @@ void SCH_COMPONENT::MirrorX( int aXaxis_position )
for( int ii = 0; ii < GetFieldCount(); ii++ )
{
/* move the fields to the new position because the component itself
* has moved */
GetField( ii )->m_Pos.y -= dy;
// Move the fields to the new position because the component itself has moved.
wxPoint pos = GetField( ii )->GetPosition();
pos.y -= dy;
GetField( ii )->SetPosition( pos );
}
}
@ -1557,10 +1549,11 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition )
for( int ii = 0; ii < GetFieldCount(); ii++ )
{
/* move the fields to the new position because the component itself
* has moved */
GetField( ii )->m_Pos.x -= prev.x - m_Pos.x;
GetField( ii )->m_Pos.y -= prev.y - m_Pos.y;
// Move the fields to the new position because the component itself has moved.
wxPoint pos = GetField( ii )->GetPosition();
pos.x -= prev.x - m_Pos.x;
pos.y -= prev.y - m_Pos.y;
GetField( ii )->SetPosition( pos );
}
}

Some files were not shown because too many files have changed in this diff Show More