Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
3fed7b9d
Commit
3fed7b9d
authored
Dec 07, 2010
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Component library object encapsulation work.
parent
a6a34f35
Changes
21
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
501 additions
and
427 deletions
+501
-427
CHANGELOG.txt
CHANGELOG.txt
+10
-0
base_struct.cpp
common/base_struct.cpp
+10
-6
block.cpp
eeschema/block.cpp
+1
-1
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+1
-1
class_libentry.cpp
eeschema/class_libentry.cpp
+10
-10
cross-probing.cpp
eeschema/cross-probing.cpp
+2
-1
dangling_ends.cpp
eeschema/dangling_ends.cpp
+3
-1
dialog_edit_libentry_fields_in_lib.cpp
eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp
+22
-20
edit_component_in_schematic.cpp
eeschema/edit_component_in_schematic.cpp
+1
-0
find.cpp
eeschema/find.cpp
+3
-1
lib_draw_item.h
eeschema/lib_draw_item.h
+2
-0
lib_field.cpp
eeschema/lib_field.cpp
+50
-32
lib_field.h
eeschema/lib_field.h
+27
-13
lib_pin.cpp
eeschema/lib_pin.cpp
+215
-204
lib_pin.h
eeschema/lib_pin.h
+36
-33
libfield.cpp
eeschema/libfield.cpp
+3
-3
netform.cpp
eeschema/netform.cpp
+5
-5
netlist.cpp
eeschema/netlist.cpp
+6
-7
pinedit.cpp
eeschema/pinedit.cpp
+81
-81
sch_component.cpp
eeschema/sch_component.cpp
+11
-8
base_struct.h
include/base_struct.h
+2
-0
No files found.
CHANGELOG.txt
View file @
3fed7b9d
...
...
@@ -4,6 +4,16 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-dec-07 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Finish encapsulating LIB_FIELD object.
* Encapsulated all members currently in use in LIB_PIN object.
++Common
* Add SetModified() helper to EDA_BaseStruct object that checks for a parent
object and sets it's modified status as well.
2010-dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
...
...
common/base_struct.cpp
View file @
3fed7b9d
...
...
@@ -20,9 +20,7 @@ enum textbox {
};
/******************************************************************************/
EDA_BaseStruct
::
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
KICAD_T
idType
)
/******************************************************************************/
{
InitVars
();
m_StructType
=
idType
;
...
...
@@ -30,9 +28,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
}
/********************************************/
EDA_BaseStruct
::
EDA_BaseStruct
(
KICAD_T
idType
)
/********************************************/
{
InitVars
();
m_StructType
=
idType
;
...
...
@@ -51,9 +47,7 @@ EDA_BaseStruct::EDA_BaseStruct( const EDA_BaseStruct& base )
}
/********************************************/
void
EDA_BaseStruct
::
InitVars
()
/********************************************/
{
m_StructType
=
TYPE_NOT_INIT
;
Pnext
=
NULL
;
// Linked list: Link (next struct)
...
...
@@ -69,6 +63,16 @@ void EDA_BaseStruct::InitVars()
}
void
EDA_BaseStruct
::
SetModified
()
{
m_Flags
|=
IS_CHANGED
;
// If this a child object, then the parent modification state also needs to be set.
if
(
m_Parent
)
m_Parent
->
SetModified
();
}
// see base_struct.h
SEARCH_RESULT
EDA_BaseStruct
::
IterateForward
(
EDA_BaseStruct
*
listStart
,
INSPECTOR
*
inspector
,
...
...
eeschema/block.cpp
View file @
3fed7b9d
...
...
@@ -898,7 +898,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
/* Calculate the pin position (according to the component orientation)
*/
aPosition
=
DefaultTransform
.
TransformCoordinate
(
Pin
->
m_Pos
)
+
CmpPosition
;
aPosition
=
DefaultTransform
.
TransformCoordinate
(
Pin
->
GetPosition
()
)
+
CmpPosition
;
return
Pin
;
}
...
...
eeschema/bus-wire-junction.cpp
View file @
3fed7b9d
...
...
@@ -756,7 +756,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
{
// Calculate the exact position of the connection point of the pin,
// depending on orientation of the component.
itempos
=
LibItem
->
GetScreenCoord
(
pin
->
m_Pos
);
itempos
=
LibItem
->
GetScreenCoord
(
pin
->
GetPosition
()
);
itempos
.
x
+=
LibItem
->
m_Pos
.
x
;
itempos
.
y
+=
LibItem
->
m_Pos
.
y
;
if
(
(
itempos
.
x
==
pos
.
x
)
&&
(
itempos
.
y
==
pos
.
y
)
)
...
...
eeschema/class_libentry.cpp
View file @
3fed7b9d
...
...
@@ -417,11 +417,11 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem, WinEDA_DrawPanel* aPan
{
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
aItem
;
if
(
field
->
m_FieldId
<
MANDATORY_FIELDS
)
if
(
field
->
GetId
()
<
MANDATORY_FIELDS
)
{
wxLogWarning
(
_
(
"An attempt was made to remove the %s field \
from component %s in library %s."
),
GetChars
(
field
->
m_Name
),
GetChars
(
GetName
()
),
GetChars
(
field
->
GetName
()
),
GetChars
(
GetName
()
),
GetChars
(
GetLibraryName
()
)
);
return
;
}
...
...
@@ -609,7 +609,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
// fieldnames.
if
(
!
fields
[
i
].
m_Text
.
IsEmpty
()
)
{
fields
[
i
].
m_FieldId
=
fieldId
++
;
fields
[
i
].
SetId
(
fieldId
++
)
;
if
(
!
fields
[
i
].
Save
(
aFile
)
)
return
false
;
}
...
...
@@ -916,9 +916,9 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
return
false
;
}
if
(
field
->
m_FieldId
<
MANDATORY_FIELDS
)
if
(
field
->
GetId
()
<
MANDATORY_FIELDS
)
{
LIB_FIELD
*
fixedField
=
GetField
(
field
->
m_FieldId
);
LIB_FIELD
*
fixedField
=
GetField
(
field
->
GetId
()
);
// this will fire only if somebody broke a constructor or editor.
// MANDATORY_FIELDS are always present in ram resident components, no
...
...
@@ -927,7 +927,7 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
*
fixedField
=
*
field
;
if
(
field
->
m_FieldId
==
VALUE
)
if
(
field
->
GetId
()
==
VALUE
)
m_name
=
field
->
m_Text
;
SAFE_DELETE
(
field
);
...
...
@@ -1055,7 +1055,7 @@ void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList )
continue
;
field
=
(
LIB_FIELD
*
)
&
item
;
if
(
(
unsigned
)
field
->
m_FieldId
<
MANDATORY_FIELDS
)
if
(
(
unsigned
)
field
->
GetId
()
<
MANDATORY_FIELDS
)
continue
;
// was added above
aList
.
push_back
(
*
field
);
...
...
@@ -1072,7 +1072,7 @@ LIB_FIELD* LIB_COMPONENT::GetField( int aId )
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
&
item
;
if
(
field
->
m_FieldId
==
aId
)
if
(
field
->
GetId
()
==
aId
)
return
field
;
}
...
...
@@ -1089,7 +1089,7 @@ LIB_FIELD* LIB_COMPONENT::FindField( const wxString& aFieldName )
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
&
item
;
if
(
field
->
m_Name
==
aFieldName
)
if
(
field
->
GetName
()
==
aFieldName
)
return
field
;
}
...
...
@@ -1262,7 +1262,7 @@ void LIB_COMPONENT::DeleteSelectedItems()
{
#if 0 // Set to 1 to allows fields deletion on block delete or other global command
LIB_FIELD& field = ( LIB_FIELD& ) *item;
if( (field.
m_FieldId
== REFERENCE) || (field.m_FieldId == VALUE) ||
if( (field.
GetId()
== REFERENCE) || (field.m_FieldId == VALUE) ||
(field.m_Attributs & TEXT_NO_VISIBLE) )
#endif
item
->
m_Selected
=
0
;
...
...
eeschema/cross-probing.cpp
View file @
3fed7b9d
...
...
@@ -130,7 +130,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
break
;
Pin
=
(
LIB_PIN
*
)
objectToSync
;
if
(
Pin
->
m_PinNum
)
if
(
Pin
->
GetNumber
()
)
{
wxString
pinnum
;
Pin
->
ReturnPinStringNum
(
pinnum
);
...
...
eeschema/dangling_ends.cpp
View file @
3fed7b9d
...
...
@@ -64,10 +64,11 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint&
wxPoint
pinpos
;
Pin
=
LocateAnyPin
(
DrawList
,
pos
,
&
DrawLibItem
);
if
(
!
Pin
)
return
NULL
;
pinpos
=
Pin
->
m_Pos
;
pinpos
=
Pin
->
GetPosition
()
;
if
(
DrawLibItem
==
NULL
)
NEGATE
(
pinpos
.
y
);
// In libraries Y axis is bottom to top
...
...
@@ -78,5 +79,6 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint&
if
(
pos
==
pinpos
)
return
Pin
;
return
NULL
;
}
eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp
View file @
3fed7b9d
...
...
@@ -249,7 +249,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
].
m_Name
.
IsEmpty
()
||
m_FieldsBuf
[
i
].
m_Text
.
IsEmpty
()
)
if
(
m_FieldsBuf
[
i
].
GetName
()
.
IsEmpty
()
||
m_FieldsBuf
[
i
].
m_Text
.
IsEmpty
()
)
{
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
i
);
continue
;
...
...
@@ -262,7 +262,7 @@ An alias %s already exists!\nCannot update this component" ),
for
(
unsigned
i
=
0
;
i
<
m_FieldsBuf
.
size
();
++
i
)
{
printf
(
"save[%d].name:'%s' value:'%s'
\n
"
,
i
,
CONV_TO_UTF8
(
m_FieldsBuf
[
i
].
m_Name
),
CONV_TO_UTF8
(
m_FieldsBuf
[
i
].
GetName
()
),
CONV_TO_UTF8
(
m_FieldsBuf
[
i
].
m_Text
)
);
}
#endif
...
...
@@ -296,7 +296,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
LIB_FIELD
blank
(
fieldNdx
);
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
[
fieldNdx
].
m_Name
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
fieldNdx
);
m_FieldsBuf
[
fieldNdx
].
SetName
(
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
fieldNdx
)
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
...
...
@@ -423,7 +423,7 @@ static LIB_FIELD* findfield( const LIB_FIELD_LIST& aList, const wxString& aField
for
(
unsigned
i
=
0
;
i
<
aList
.
size
();
++
i
)
{
if
(
aFieldName
==
aList
[
i
].
m_Name
)
if
(
aFieldName
==
aList
[
i
].
GetName
()
)
{
field
=
&
aList
[
i
];
// best to avoid casting here.
break
;
...
...
@@ -437,7 +437,7 @@ LIB_FIELD* DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::findField( const wxString& aField
{
for
(
unsigned
i
=
0
;
i
<
m_FieldsBuf
.
size
();
++
i
)
{
if
(
aFieldName
==
m_FieldsBuf
[
i
].
m_Name
)
if
(
aFieldName
==
m_FieldsBuf
[
i
].
GetName
()
)
return
&
m_FieldsBuf
[
i
];
}
return
NULL
;
...
...
@@ -455,7 +455,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
#if defined(DEBUG)
for
(
unsigned
i
=
0
;
i
<
cmpFields
.
size
();
++
i
)
{
printf
(
"cmpFields[%d].name:%s
\n
"
,
i
,
CONV_TO_UTF8
(
cmpFields
[
i
].
m_Name
)
);
printf
(
"cmpFields[%d].name:%s
\n
"
,
i
,
CONV_TO_UTF8
(
cmpFields
[
i
].
GetName
()
)
);
}
#endif
...
...
@@ -483,7 +483,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// fixed fields:
for
(
int
i
=
0
;
i
<
MANDATORY_FIELDS
;
++
i
)
{
D
(
printf
(
"add fixed:%s
\n
"
,
CONV_TO_UTF8
(
cmpFields
[
i
].
m_Name
)
);
)
D
(
printf
(
"add fixed:%s
\n
"
,
CONV_TO_UTF8
(
cmpFields
[
i
].
GetName
()
)
);
)
m_FieldsBuf
.
push_back
(
cmpFields
[
i
]
);
}
...
...
@@ -510,7 +510,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
{
D
(
printf
(
"add template:%s
\n
"
,
CONV_TO_UTF8
(
it
->
m_Name
)
);
)
fld
.
m_Name
=
it
->
m_Name
;
fld
.
SetName
(
it
->
m_Name
)
;
fld
.
m_Text
=
it
->
m_Value
;
// empty? ok too.
if
(
!
it
->
m_Visible
)
...
...
@@ -520,7 +520,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
}
else
{
D
(
printf
(
"match template:%s
\n
"
,
CONV_TO_UTF8
(
libField
->
m_Name
)
);
)
D
(
printf
(
"match template:%s
\n
"
,
CONV_TO_UTF8
(
libField
->
GetName
()
)
);
)
fld
=
*
libField
;
// copy values from component, m_Name too
}
...
...
@@ -532,11 +532,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
for
(
unsigned
i
=
MANDATORY_FIELDS
;
i
<
cmpFields
.
size
();
++
i
)
{
LIB_FIELD
*
cmp
=
&
cmpFields
[
i
];
LIB_FIELD
*
buf
=
findField
(
cmp
->
m_Name
);
LIB_FIELD
*
buf
=
findField
(
cmp
->
GetName
()
);
if
(
!
buf
)
{
D
(
printf
(
"add cmp:%s
\n
"
,
CONV_TO_UTF8
(
cmp
->
m_Name
)
);
)
D
(
printf
(
"add cmp:%s
\n
"
,
CONV_TO_UTF8
(
cmp
->
GetName
()
)
);
)
m_FieldsBuf
.
push_back
(
*
cmp
);
}
}
...
...
@@ -578,7 +578,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FI
fieldListCtrl
->
SetItem
(
ndx
,
COLUMN_TEXT
,
wxEmptyString
);
}
fieldListCtrl
->
SetItem
(
aFieldNdx
,
COLUMN_FIELD_NAME
,
aField
.
m_Name
);
fieldListCtrl
->
SetItem
(
aFieldNdx
,
COLUMN_FIELD_NAME
,
aField
.
GetName
()
);
fieldListCtrl
->
SetItem
(
aFieldNdx
,
COLUMN_TEXT
,
aField
.
m_Text
);
// recompute the column widths here, after setting texts
...
...
@@ -629,17 +629,19 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
// Field names have become more important than field ids, so we cannot
// mangle the names in the buffer but we can do so in the panel.
if
(
field
.
m_FieldId
==
VALUE
)
{
// This field is the lib name and the default value when loading this component in schematic
// The value is now not editable here (in this dialog) because changing it is equivalent to create
// a new component or alias. This is handles in libedir, not in this dialog.
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
+
wxT
(
" / "
)
+
_
(
"Chip Name"
)
);
if
(
field
.
GetId
()
==
VALUE
)
{
// This field is the lib name and the default value when loading this component in
// schematic. The value is now not editable here (in this dialog) because changing
// it is equivalent to create a new component or alias. This is handles in libedir,
// not in this dialog.
fieldNameTextCtrl
->
SetValue
(
field
.
GetName
()
+
wxT
(
" / "
)
+
_
(
"Chip Name"
)
);
fieldValueTextCtrl
->
Enable
(
false
);
}
else
{
fieldValueTextCtrl
->
Enable
(
true
);
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
);
fieldNameTextCtrl
->
SetValue
(
field
.
GetName
()
);
}
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable field name editing
...
...
@@ -731,8 +733,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
// FieldNameTextCtrl has a tricked value in it for VALUE index, do not copy it back.
// It has the "Chip Name" appended.
if
(
field
.
m_FieldId
>=
MANDATORY_FIELDS
)
field
.
m_Name
=
fieldNameTextCtrl
->
GetValue
(
);
if
(
field
.
GetId
()
>=
MANDATORY_FIELDS
)
field
.
SetName
(
fieldNameTextCtrl
->
GetValue
()
);
setRowItem
(
fieldNdx
,
field
);
// update fieldListCtrl
...
...
eeschema/edit_component_in_schematic.cpp
View file @
3fed7b9d
...
...
@@ -100,6 +100,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_FIELD* Field, wxDC* DC )
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
Field
->
GetParent
();
fieldNdx
=
Field
->
m_FieldId
;
if
(
fieldNdx
==
VALUE
)
{
Entry
=
CMP_LIBRARY
::
FindLibraryComponent
(
Cmp
->
m_ChipName
);
...
...
eeschema/find.cpp
View file @
3fed7b9d
...
...
@@ -147,10 +147,12 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component
pos
=
pSch
->
m_Pos
;
/* temporary: will be changed if
* the pin is found */
pin
=
pSch
->
GetPin
(
text_to_find
);
if
(
pin
==
NULL
)
break
;
NotFound
=
FALSE
;
pos
+=
pin
->
m_Pos
;
pos
+=
pin
->
GetPosition
()
;
break
;
case
2
:
// find reference
...
...
eeschema/lib_draw_item.h
View file @
3fed7b9d
...
...
@@ -301,6 +301,8 @@ public:
*/
wxPoint
GetPosition
()
const
{
return
DoGetPosition
();
}
void
SetPosition
(
const
wxPoint
&
aPosition
)
{
DoMove
(
aPosition
);
}
/**
* Mirror the draw object along the horizontal (X) axis about a point.
*
...
...
eeschema/lib_field.cpp
View file @
3fed7b9d
...
...
@@ -47,8 +47,7 @@ LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) :
}
LIB_FIELD
::
LIB_FIELD
(
int
idfield
)
:
LIB_DRAW_ITEM
(
COMPONENT_FIELD_DRAW_TYPE
,
NULL
)
LIB_FIELD
::
LIB_FIELD
(
int
idfield
)
:
LIB_DRAW_ITEM
(
COMPONENT_FIELD_DRAW_TYPE
,
NULL
)
{
Init
(
idfield
);
}
...
...
@@ -56,14 +55,14 @@ LIB_FIELD::LIB_FIELD( int idfield ) :
LIB_FIELD
::
LIB_FIELD
(
const
LIB_FIELD
&
field
)
:
LIB_DRAW_ITEM
(
field
)
{
m_
FieldId
=
field
.
m_FieldI
d
;
m_
id
=
field
.
m_i
d
;
m_Pos
=
field
.
m_Pos
;
m_Size
=
field
.
m_Size
;
m_Thickness
=
field
.
m_Thickness
;
m_Orient
=
field
.
m_Orient
;
m_Attributs
=
field
.
m_Attributs
;
m_Text
=
field
.
m_Text
;
m_
Name
=
field
.
m_N
ame
;
m_
name
=
field
.
m_n
ame
;
m_HJustify
=
field
.
m_HJustify
;
m_VJustify
=
field
.
m_VJustify
;
m_Italic
=
field
.
m_Italic
;
...
...
@@ -78,7 +77,7 @@ LIB_FIELD::~LIB_FIELD()
void
LIB_FIELD
::
Init
(
int
id
)
{
m_
FieldI
d
=
id
;
m_
i
d
=
id
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
m_typeName
=
_
(
"Field"
);
m_Orient
=
TEXT_ORIENT_HORIZ
;
...
...
@@ -88,7 +87,7 @@ void LIB_FIELD::Init( int id )
// fields in RAM must always have names, because we are trying to get
// less dependent on field ids and more dependent on names.
// Plus assumptions are made in the field editors.
m_
N
ame
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
id
);
m_
n
ame
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
id
);
}
...
...
@@ -98,12 +97,14 @@ bool LIB_FIELD::Save( FILE* ExportFile )
wxString
text
=
m_Text
;
hjustify
=
'C'
;
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
hjustify
=
'L'
;
else
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
hjustify
=
'R'
;
vjustify
=
'C'
;
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
vjustify
=
'B'
;
else
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
...
...
@@ -113,7 +114,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
text
=
wxT
(
"~"
);
if
(
fprintf
(
ExportFile
,
"F%d
\"
%s
\"
%d %d %d %c %c %c %c%c%c"
,
m_
FieldI
d
,
CONV_TO_UTF8
(
text
),
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
,
m_
i
d
,
CONV_TO_UTF8
(
text
),
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
,
m_Orient
==
0
?
'H'
:
'V'
,
(
m_Attributs
&
TEXT_NO_VISIBLE
)
?
'I'
:
'V'
,
hjustify
,
vjustify
,
...
...
@@ -126,11 +127,11 @@ bool LIB_FIELD::Save( FILE* ExportFile )
* Just because default name depends on the language and can change from
* a country to an other
*/
wxString
defName
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
m_
FieldI
d
);
wxString
defName
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
m_
i
d
);
if
(
m_
FieldId
>=
FIELD1
&&
!
m_N
ame
.
IsEmpty
()
&&
m_
N
ame
!=
defName
&&
fprintf
(
ExportFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_
N
ame
)
)
<
0
)
if
(
m_
id
>=
FIELD1
&&
!
m_n
ame
.
IsEmpty
()
&&
m_
n
ame
!=
defName
&&
fprintf
(
ExportFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_
n
ame
)
)
<
0
)
return
false
;
if
(
fprintf
(
ExportFile
,
"
\n
"
)
<
0
)
...
...
@@ -150,7 +151,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
char
fieldUserName
[
1024
];
char
*
text
;
if
(
sscanf
(
line
+
1
,
"%d"
,
&
m_
FieldId
)
!=
1
||
m_FieldI
d
<
0
)
if
(
sscanf
(
line
+
1
,
"%d"
,
&
m_
id
)
!=
1
||
m_i
d
<
0
)
{
errorMsg
=
wxT
(
"invalid field header"
);
return
false
;
...
...
@@ -191,7 +192,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
if
(
cnt
<
5
)
{
errorMsg
.
Printf
(
wxT
(
"field %d does not have the correct number of parameters"
),
m_
FieldI
d
);
m_
i
d
);
return
false
;
}
...
...
@@ -260,17 +261,17 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
}
// fields in RAM must always have names.
if
(
m_
FieldI
d
<
MANDATORY_FIELDS
)
if
(
m_
i
d
<
MANDATORY_FIELDS
)
{
// Fields in RAM must always have names, because we are trying to get
// less dependent on field ids and more dependent on names.
// Plus assumptions are made in the field editors.
m_
Name
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
m_FieldI
d
);
m_
name
=
TEMPLATE_FIELDNAME
::
GetDefaultFieldName
(
m_i
d
);
}
else
{
ReadDelimitedText
(
fieldUserName
,
line
,
sizeof
(
fieldUserName
)
);
m_
N
ame
=
CONV_FROM_UTF8
(
fieldUserName
);
m_
n
ame
=
CONV_FROM_UTF8
(
fieldUserName
);
}
return
true
;
...
...
@@ -369,13 +370,15 @@ bool LIB_FIELD::HitTest( const wxPoint& refPos )
bool
LIB_FIELD
::
HitTest
(
wxPoint
aPosRef
,
int
aThreshold
,
const
TRANSFORM
&
aTransform
)
{
int
extraCharCount
=
0
;
// Reference designator text has one or 2 additional character (displays
// U? or U?A)
if
(
m_
FieldI
d
==
REFERENCE
)
if
(
m_
i
d
==
REFERENCE
)
{
extraCharCount
++
;
m_Text
.
Append
(
'?'
);
LIB_COMPONENT
*
parent
=
(
LIB_COMPONENT
*
)
m_Parent
;
if
(
parent
&&
(
parent
->
GetPartCount
()
>
1
)
)
{
m_Text
.
Append
(
'A'
);
...
...
@@ -386,6 +389,7 @@ bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTran
wxPoint
physicalpos
=
aTransform
.
TransformCoordinate
(
m_Pos
);
wxPoint
tmp
=
m_Pos
;
m_Pos
=
physicalpos
;
/* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped.
* this simple algo works only for schematic matrix (rot 90 or/and mirror)
...
...
@@ -405,9 +409,10 @@ bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTran
return
hit
;
}
LIB_DRAW_ITEM
*
LIB_FIELD
::
DoGenCopy
()
{
LIB_FIELD
*
newfield
=
new
LIB_FIELD
(
m_
FieldI
d
);
LIB_FIELD
*
newfield
=
new
LIB_FIELD
(
m_
i
d
);
Copy
(
newfield
);
...
...
@@ -429,7 +434,7 @@ void LIB_FIELD::Copy( LIB_FIELD* Target ) const
Target
->
m_Orient
=
m_Orient
;
Target
->
m_Attributs
=
m_Attributs
;
Target
->
m_Text
=
m_Text
;
Target
->
m_
Name
=
m_N
ame
;
Target
->
m_
name
=
m_n
ame
;
Target
->
m_HJustify
=
m_HJustify
;
Target
->
m_VJustify
=
m_VJustify
;
Target
->
m_Italic
=
m_Italic
;
...
...
@@ -443,8 +448,8 @@ int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const
const
LIB_FIELD
*
tmp
=
(
LIB_FIELD
*
)
&
other
;
if
(
m_
FieldId
!=
tmp
->
m_FieldI
d
)
return
m_
FieldId
-
tmp
->
m_FieldI
d
;
if
(
m_
id
!=
tmp
->
m_i
d
)
return
m_
id
-
tmp
->
m_i
d
;
int
result
=
m_Text
.
CmpNoCase
(
tmp
->
m_Text
);
...
...
@@ -511,7 +516,7 @@ void LIB_FIELD::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
*/
wxString
LIB_FIELD
::
GetFullText
(
int
unit
)
{
if
(
m_
FieldI
d
!=
REFERENCE
)
if
(
m_
i
d
!=
REFERENCE
)
return
m_Text
;
wxString
text
=
m_Text
;
...
...
@@ -547,7 +552,7 @@ int LIB_FIELD::GetDefaultColor()
{
int
color
;
switch
(
m_
FieldI
d
)
switch
(
m_
i
d
)
{
case
REFERENCE
:
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
...
...
@@ -579,11 +584,11 @@ void LIB_FIELD::Rotate()
}
wxString
LIB_FIELD
::
GetName
()
wxString
LIB_FIELD
::
GetName
()
const
{
wxString
name
;
switch
(
m_
FieldI
d
)
switch
(
m_
i
d
)
{
case
REFERENCE
:
name
=
_
(
"Reference"
);
...
...
@@ -602,16 +607,30 @@ wxString LIB_FIELD::GetName()
break
;
default
:
if
(
m_
N
ame
.
IsEmpty
()
)
name
.
Printf
(
_
(
"Field%d"
),
m_
FieldI
d
);
if
(
m_
n
ame
.
IsEmpty
()
)
name
.
Printf
(
_
(
"Field%d"
),
m_
i
d
);
else
name
=
m_
N
ame
;
name
=
m_
n
ame
;
}
return
name
;
}
void
LIB_FIELD
::
SetName
(
const
wxString
&
aName
)
{
// Mandatory field names are fixed.
if
(
m_id
>
MANDATORY_FIELDS
)
return
;
if
(
m_name
!=
aName
)
{
m_name
=
aName
;
SetModified
();
}
}
void
LIB_FIELD
::
SetText
(
const
wxString
&
aText
)
{
if
(
aText
==
m_Text
)
...
...
@@ -619,7 +638,7 @@ void LIB_FIELD::SetText( const wxString& aText )
wxString
oldName
=
m_Text
;
if
(
m_
FieldI
d
==
VALUE
&&
m_Parent
!=
NULL
)
if
(
m_
i
d
==
VALUE
&&
m_Parent
!=
NULL
)
{
LIB_COMPONENT
*
parent
=
GetParent
();
...
...
@@ -729,4 +748,3 @@ void LIB_FIELD::DisplayInfo( WinEDA_DrawFrame* aFrame )
// Display field text:
aFrame
->
AppendMsgPanel
(
_
(
"Value"
),
m_Text
,
BROWN
);
}
eeschema/lib_field.h
View file @
3fed7b9d
...
...
@@ -5,7 +5,6 @@
#ifndef CLASS_LIBENTRY_FIELDS_H
#define CLASS_LIBENTRY_FIELDS_H
//#include "general.h"
#include "lib_draw_item.h"
...
...
@@ -18,6 +17,9 @@
*/
class
LIB_FIELD
:
public
LIB_DRAW_ITEM
,
public
EDA_TextStruct
{
int
m_id
;
///< @see enum NumFieldType
wxString
m_name
;
///< Name (not the field text value itself, that is .m_Text)
wxString
m_savedText
;
///< Temporary storage for the string when edition.
bool
m_rotate
;
///< Flag to indicate a rotation occurred while editing.
bool
m_updateText
;
///< Flag to indicate text change occurred while editing.
...
...
@@ -35,11 +37,6 @@ class LIB_FIELD : public LIB_DRAW_ITEM, public EDA_TextStruct
*/
void
calcEdit
(
const
wxPoint
&
aPosition
);
public
:
int
m_FieldId
;
///< @see enum NumFieldType
wxString
m_Name
;
///< Name (not the field text value itself, that is .m_Text)
public
:
LIB_FIELD
(
int
idfield
=
2
);
...
...
@@ -62,11 +59,28 @@ public:
*
* The first four field IDs are reserved and therefore always return their respective
* names. The user definable fields will return FieldN where N is the ID of the field
* when the m_
N
ame member is empty.
* when the m_
n
ame member is empty.
*
* @return Name of the field.
*/
wxString
GetName
();
wxString
GetName
()
const
;
/**
* Function SetName
*
* Sets a user definable field name to \a aName.
*
* Reserved fields such as value and reference are not renamed. If the field name is
* changed, the field modified flag is set. If the field is the child of a component,
* the parent component's modified flag is also set.
*
* @param aName - User defined field name.
*/
void
SetName
(
const
wxString
&
aName
);
int
GetId
()
{
return
m_id
;
}
void
SetId
(
int
aId
)
{
m_id
=
aId
;
}
/**
* Function GetPenSize virtual pure
...
...
@@ -133,9 +147,9 @@ public:
void
operator
=
(
const
LIB_FIELD
&
field
)
{
m_
FieldId
=
field
.
m_FieldI
d
;
m_
id
=
field
.
m_i
d
;
m_Text
=
field
.
m_Text
;
m_
Name
=
field
.
m_N
ame
;
m_
name
=
field
.
m_n
ame
;
m_Pos
=
field
.
m_Pos
;
m_Size
=
field
.
m_Size
;
m_Thickness
=
field
.
m_Thickness
;
...
...
eeschema/lib_pin.cpp
View file @
3fed7b9d
This diff is collapsed.
Click to expand it.
eeschema/lib_pin.h
View file @
3fed7b9d
...
...
@@ -80,6 +80,18 @@ enum DrawPinOrient {
class
LIB_PIN
:
public
LIB_DRAW_ITEM
{
wxPoint
m_position
;
///< Position of the pin.
int
m_length
;
///< Length of the pin.
int
m_orientation
;
///< Pin orientation (Up, Down, Left, Right)
int
m_shape
;
///< Bitwise ORed of pin shapes (see enum DrawPinShape)
int
m_width
;
///< Line width of the pin.
int
m_type
;
///< Electrical type of the pin. See enum ElectricPinType.
int
m_attributes
;
///< Set bit 0 to indicate pin is invisible.
wxString
m_name
;
long
m_number
;
///< Pin number defined as 4 ASCII characters like "12", "anod",
///< "G6", or "12". It is stored as "12\0\0" and does not
///< depend on endian type.
/**
* Draw the pin.
*/
...
...
@@ -87,15 +99,6 @@ class LIB_PIN : public LIB_DRAW_ITEM
int
aColor
,
int
aDrawMode
,
void
*
aData
,
const
TRANSFORM
&
aTransform
);
public
:
int
m_PinLen
;
/* Pin length */
int
m_Orient
;
/* Pin orientation (Up, Down, Left, Right) */
int
m_PinShape
;
/* Bitwise ORed: Pin shape (see enum DrawPinShape) */
int
m_PinType
;
/* Electrical pin properties */
int
m_Attributs
;
/* bit 0 != 0: pin invisible */
long
m_PinNum
;
/* Pin number: 4 ASCII code like "12" or "anod"
* or "G6" "12" is stored as "12\0\0" ans does not
* depend on endian type*/
wxString
m_PinName
;
int
m_PinNumSize
;
int
m_PinNameSize
;
/* Pin num and Pin name sizes */
...
...
@@ -107,10 +110,6 @@ public:
char
m_PinNumPositionOpt
;
char
m_PinNamePositionOpt
;
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start
* point (segments) */
int
m_Width
;
/* Line width */
public
:
LIB_PIN
(
LIB_COMPONENT
*
aParent
);
LIB_PIN
(
const
LIB_PIN
&
aPin
);
...
...
@@ -165,17 +164,13 @@ public:
* Pin numbers are coded as a long or 4 ASCII characters. Used to print
* or draw the pin number.
*
* @param aStringBuffer - the wxString to store the pin num as an unicode
* string
* @param aStringBuffer - the wxString to store the pin num as an unicode string
*/
void
ReturnPinStringNum
(
wxString
&
aStringBuffer
)
const
;
long
GetNumber
()
const
{
return
m_number
;
}
wxString
GetNumber
()
{
return
ReturnPinStringNum
(
m_PinNum
);
}
wxString
GetNumberString
()
const
{
return
ReturnPinStringNum
(
m_number
);
}
/**
* Function ReturnPinStringNum (static function)
...
...
@@ -188,6 +183,8 @@ public:
void
SetPinNumFromString
(
wxString
&
aBuffer
);
wxString
GetName
()
const
{
return
m_name
;
}
/**
* Set the pin name.
*
...
...
@@ -227,25 +224,29 @@ public:
*/
void
SetNumberTextSize
(
int
aSize
);
int
GetOrientation
()
const
{
return
m_orientation
;
}
/**
* Set orientation on the pin.
*
* This will also update the orientation of the pins marked by
* EnableEditMode().
* This will also update the orientation of the pins marked by EnableEditMode().
*
* @param aOrientation - The orientation of the pin.
*/
void
SetOrientation
(
int
aOrientation
);
int
GetShape
()
const
{
return
m_shape
;
}
/**
* Set the
draw style of the pin
.
* Set the
shape of the pin to \a aShape
.
*
* This will also update the draw style of the pins marked by
* EnableEditMode().
* This will also update the draw style of the pins marked by EnableEditMode().
*
* @param aS
tyle - The draw style of the pin
.
* @param aS
hape - The draw shape of the pin. See enum DrawPinShape
.
*/
void
SetDrawStyle
(
int
aStyle
);
void
SetShape
(
int
aShape
);
int
GetType
()
const
{
return
m_type
;
}
/**
* Set the electrical type of the pin.
...
...
@@ -255,7 +256,7 @@ public:
*
* @param aType - The electrical type of the pin.
*/
void
Set
Electrical
Type
(
int
aType
);
void
SetType
(
int
aType
);
/**
* Set the pin length.
...
...
@@ -266,6 +267,8 @@ public:
*/
void
SetLength
(
int
aLength
);
int
GetLength
()
{
return
m_length
;
}
/**
* Set the pin part number.
*
...
...
@@ -320,7 +323,7 @@ public:
*
* @return True if draw object is visible otherwise false.
*/
bool
IsVisible
()
{
return
(
m_
Attribut
s
&
PINNOTDRAW
)
==
0
;
}
bool
IsVisible
()
{
return
(
m_
attribute
s
&
PINNOTDRAW
)
==
0
;
}
/**
* @return the size of the "pen" that be used to draw or plot this item.
...
...
@@ -436,12 +439,12 @@ protected:
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
const
{
return
m_
Pos
;
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_
position
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
const
{
return
m_
W
idth
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
virtual
int
DoGetWidth
()
const
{
return
m_
w
idth
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
;
};
...
...
eeschema/libfield.cpp
View file @
3fed7b9d
...
...
@@ -30,7 +30,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
// Editing the component value field is equivalent to creating a new component based
// on the current component. Set the dialog message to inform the user.
if
(
aField
->
m_FieldId
==
VALUE
)
if
(
aField
->
GetId
()
==
VALUE
)
{
caption
=
_
(
"Component Name"
);
title
=
_
(
"Enter a name to create a new component based on this one."
);
...
...
@@ -51,7 +51,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
text
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
if
(
(
aField
->
m_FieldId
==
REFERENCE
||
aField
->
m_FieldId
==
VALUE
)
&&
text
.
IsEmpty
(
)
)
if
(
(
aField
->
GetId
()
==
REFERENCE
||
aField
->
GetId
()
==
VALUE
)
&&
text
.
IsEmpty
(
)
)
{
title
.
Printf
(
_
(
"A %s field cannot be empty."
),
GetChars
(
aField
->
GetName
().
Lower
()
)
);
DisplayError
(
this
,
title
);
...
...
@@ -64,7 +64,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
* the old one. Rename the component and remove any conflicting aliases to prevent name
* errors when updating the library.
*/
if
(
aField
->
m_FieldId
==
VALUE
)
if
(
aField
->
GetId
()
==
VALUE
)
{
wxString
msg
;
...
...
eeschema/netform.cpp
View file @
3fed7b9d
...
...
@@ -445,7 +445,7 @@ static bool sortPinsByNum( NETLIST_OBJECT* aPin1, NETLIST_OBJECT* aPin2 )
static
bool
sortPinsByNumber
(
LIB_PIN
*
aPin1
,
LIB_PIN
*
aPin2
)
{
// return "lhs < rhs"
return
RefDesStringCompare
(
aPin1
->
GetNumber
(),
aPin2
->
GetNumber
()
)
<
0
;
return
RefDesStringCompare
(
aPin1
->
GetNumber
String
(),
aPin2
->
GetNumberString
()
)
<
0
;
}
...
...
@@ -758,7 +758,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
{
XNODE
*
xfield
;
xfields
->
AddChild
(
xfield
=
node
(
sField
,
fieldList
[
i
].
m_Text
)
);
xfield
->
AddAttribute
(
sName
,
fieldList
[
i
].
m_Name
);
xfield
->
AddAttribute
(
sName
,
fieldList
[
i
].
GetName
()
);
}
}
...
...
@@ -778,7 +778,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
XNODE
*
pin
;
pins
->
AddChild
(
pin
=
node
(
sPin
)
);
pin
->
AddAttribute
(
sNum
,
pinList
[
i
]
->
GetNumber
()
);
pin
->
AddAttribute
(
sNum
,
pinList
[
i
]
->
GetNumber
String
()
);
// caution: construction work site here, drive slowly
}
...
...
@@ -1489,7 +1489,7 @@ bool EXPORT_HELP::addPinToComponentPinList( SCH_COMPONENT* aComponent,
if
(
pin
->
m_Link
!=
aComponent
)
continue
;
if
(
pin
->
m_PinNum
!=
aPin
->
m_PinNum
)
if
(
pin
->
m_PinNum
!=
aPin
->
GetNumber
()
)
continue
;
// most expensive test at the end.
...
...
eeschema/netlist.cpp
View file @
3fed7b9d
...
...
@@ -641,7 +641,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
if
(
pin
->
GetConvert
()
&&
(
pin
->
GetConvert
()
!=
DrawLibItem
->
m_Convert
)
)
continue
;
wxPoint
pos2
=
DrawLibItem
->
m_Transform
.
TransformCoordinate
(
pin
->
m_Pos
)
+
wxPoint
pos2
=
DrawLibItem
->
m_Transform
.
TransformCoordinate
(
pin
->
GetPosition
()
)
+
DrawLibItem
->
m_Pos
;
new_item
=
new
NETLIST_OBJECT
();
...
...
@@ -650,15 +650,14 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item
->
m_SheetList
=
*
sheetlist
;
new_item
->
m_Type
=
NET_PIN
;
new_item
->
m_Link
=
DrawLibItem
;
new_item
->
m_ElectricalType
=
pin
->
m_PinType
;
new_item
->
m_PinNum
=
pin
->
m_PinNum
;
new_item
->
m_Label
=
pin
->
m_PinName
;
new_item
->
m_ElectricalType
=
pin
->
GetType
()
;
new_item
->
m_PinNum
=
pin
->
GetNumber
()
;
new_item
->
m_Label
=
pin
->
GetName
()
;
new_item
->
m_Start
=
new_item
->
m_End
=
pos2
;
aNetItemBuffer
.
push_back
(
new_item
);
if
(
(
(
int
)
pin
->
m_PinType
==
(
int
)
PIN_POWER_IN
)
&&
(
pin
->
m_Attributs
&
PINNOTDRAW
)
)
if
(
(
(
int
)
pin
->
GetType
()
==
(
int
)
PIN_POWER_IN
)
&&
!
pin
->
IsVisible
()
)
{
/* There is an associated PIN_LABEL. */
new_item
=
new
NETLIST_OBJECT
();
...
...
@@ -666,7 +665,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item
->
m_Comp
=
NULL
;
new_item
->
m_SheetList
=
*
sheetlist
;
new_item
->
m_Type
=
NET_PINLABEL
;
new_item
->
m_Label
=
pin
->
m_PinName
;
new_item
->
m_Label
=
pin
->
GetName
()
;
new_item
->
m_Start
=
pos2
;
new_item
->
m_End
=
new_item
->
m_Start
;
...
...
eeschema/pinedit.cpp
View file @
3fed7b9d
This diff is collapsed.
Click to expand it.
eeschema/sch_component.cpp
View file @
3fed7b9d
...
...
@@ -94,15 +94,15 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
{
// Can no longer insert an empty name, since names are now keys. The
// field index is not used beyond the first MANDATORY_FIELDS
if
(
it
->
m_Name
.
IsEmpty
()
)
if
(
it
->
GetName
()
.
IsEmpty
()
)
continue
;
// See if field by same name already exists.
SCH_FIELD
*
schField
=
FindField
(
it
->
m_Name
);
SCH_FIELD
*
schField
=
FindField
(
it
->
GetName
()
);
if
(
!
schField
)
{
SCH_FIELD
fld
(
wxPoint
(
0
,
0
),
GetFieldCount
(),
this
,
it
->
m_Name
);
SCH_FIELD
fld
(
wxPoint
(
0
,
0
),
GetFieldCount
(),
this
,
it
->
GetName
()
);
schField
=
AddField
(
fld
);
}
...
...
@@ -1586,21 +1586,24 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxP
{
LIB_PIN_LIST
pinList
;
Entry
->
GetPins
(
pinList
,
m_Multi
,
m_Convert
);
// Search for a match in pinList
for
(
unsigned
ii
=
0
;
ii
<
pinList
.
size
();
ii
++
)
{
LIB_PIN
*
pin
=
pinList
[
ii
];
wxString
pinNum
;
pin
->
ReturnPinStringNum
(
pinNum
);
if
(
SCH_ITEM
::
Matches
(
pin
->
m_PinName
,
aSearchData
)
||
SCH_ITEM
::
Matches
(
pinNum
,
aSearchData
)
)
if
(
SCH_ITEM
::
Matches
(
pin
->
GetName
(),
aSearchData
)
||
SCH_ITEM
::
Matches
(
pinNum
,
aSearchData
)
)
{
if
(
aFindLocation
)
{
wxPoint
pinpos
=
pin
->
m_Pos
;
wxPoint
pinpos
=
pin
->
GetPosition
()
;
pinpos
=
m_Transform
.
TransformCoordinate
(
pinpos
);
*
aFindLocation
=
pinpos
+
m_Pos
;
}
return
true
;
}
...
...
@@ -1640,7 +1643,7 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( LIB_PIN* Pin )
wxCHECK_MSG
(
Pin
!=
NULL
&&
Pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
,
wxPoint
(
0
,
0
),
wxT
(
"Cannot get physical position of pin."
)
);
return
m_Transform
.
TransformCoordinate
(
Pin
->
m_Pos
)
+
m_Pos
;
return
m_Transform
.
TransformCoordinate
(
Pin
->
GetPosition
()
)
+
m_Pos
;
}
...
...
@@ -1680,6 +1683,6 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
continue
;
// Calculate the pin position relative to the component position and orientation.
aPoints
.
push_back
(
m_Transform
.
TransformCoordinate
(
pin
->
m_Pos
)
+
m_Pos
);
aPoints
.
push_back
(
m_Transform
.
TransformCoordinate
(
pin
->
GetPosition
()
)
+
m_Pos
);
}
}
include/base_struct.h
View file @
3fed7b9d
...
...
@@ -359,6 +359,8 @@ public:
inline
bool
IsDragging
()
const
{
return
m_Flags
&
IS_DRAGGED
;
}
inline
bool
IsSelected
()
const
{
return
m_Flags
&
SELECTED
;
}
void
SetModified
();
int
GetState
(
int
type
)
const
{
return
m_Status
&
type
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment