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
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
...
@@ -4,6 +4,16 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
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>
2010-dec-02 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
================================================================================
++EESchema
++EESchema
...
...
common/base_struct.cpp
View file @
3fed7b9d
...
@@ -20,9 +20,7 @@ enum textbox {
...
@@ -20,9 +20,7 @@ enum textbox {
};
};
/******************************************************************************/
EDA_BaseStruct
::
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
KICAD_T
idType
)
EDA_BaseStruct
::
EDA_BaseStruct
(
EDA_BaseStruct
*
parent
,
KICAD_T
idType
)
/******************************************************************************/
{
{
InitVars
();
InitVars
();
m_StructType
=
idType
;
m_StructType
=
idType
;
...
@@ -30,9 +28,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
...
@@ -30,9 +28,7 @@ EDA_BaseStruct::EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType )
}
}
/********************************************/
EDA_BaseStruct
::
EDA_BaseStruct
(
KICAD_T
idType
)
EDA_BaseStruct
::
EDA_BaseStruct
(
KICAD_T
idType
)
/********************************************/
{
{
InitVars
();
InitVars
();
m_StructType
=
idType
;
m_StructType
=
idType
;
...
@@ -51,9 +47,7 @@ EDA_BaseStruct::EDA_BaseStruct( const EDA_BaseStruct& base )
...
@@ -51,9 +47,7 @@ EDA_BaseStruct::EDA_BaseStruct( const EDA_BaseStruct& base )
}
}
/********************************************/
void
EDA_BaseStruct
::
InitVars
()
void
EDA_BaseStruct
::
InitVars
()
/********************************************/
{
{
m_StructType
=
TYPE_NOT_INIT
;
m_StructType
=
TYPE_NOT_INIT
;
Pnext
=
NULL
;
// Linked list: Link (next struct)
Pnext
=
NULL
;
// Linked list: Link (next struct)
...
@@ -69,6 +63,16 @@ void EDA_BaseStruct::InitVars()
...
@@ -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
// see base_struct.h
SEARCH_RESULT
EDA_BaseStruct
::
IterateForward
(
EDA_BaseStruct
*
listStart
,
SEARCH_RESULT
EDA_BaseStruct
::
IterateForward
(
EDA_BaseStruct
*
listStart
,
INSPECTOR
*
inspector
,
INSPECTOR
*
inspector
,
...
...
eeschema/block.cpp
View file @
3fed7b9d
...
@@ -898,7 +898,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
...
@@ -898,7 +898,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
/* Calculate the pin position (according to the component orientation)
/* Calculate the pin position (according to the component orientation)
*/
*/
aPosition
=
DefaultTransform
.
TransformCoordinate
(
Pin
->
m_Pos
)
+
CmpPosition
;
aPosition
=
DefaultTransform
.
TransformCoordinate
(
Pin
->
GetPosition
()
)
+
CmpPosition
;
return
Pin
;
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 )
...
@@ -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,
// Calculate the exact position of the connection point of the pin,
// depending on orientation of the component.
// depending on orientation of the component.
itempos
=
LibItem
->
GetScreenCoord
(
pin
->
m_Pos
);
itempos
=
LibItem
->
GetScreenCoord
(
pin
->
GetPosition
()
);
itempos
.
x
+=
LibItem
->
m_Pos
.
x
;
itempos
.
x
+=
LibItem
->
m_Pos
.
x
;
itempos
.
y
+=
LibItem
->
m_Pos
.
y
;
itempos
.
y
+=
LibItem
->
m_Pos
.
y
;
if
(
(
itempos
.
x
==
pos
.
x
)
&&
(
itempos
.
y
==
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
...
@@ -417,11 +417,11 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* aItem, WinEDA_DrawPanel* aPan
{
{
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
aItem
;
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 \
wxLogWarning
(
_
(
"An attempt was made to remove the %s field \
from component %s in library %s."
),
from component %s in library %s."
),
GetChars
(
field
->
m_Name
),
GetChars
(
GetName
()
),
GetChars
(
field
->
GetName
()
),
GetChars
(
GetName
()
),
GetChars
(
GetLibraryName
()
)
);
GetChars
(
GetLibraryName
()
)
);
return
;
return
;
}
}
...
@@ -609,7 +609,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
...
@@ -609,7 +609,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
// fieldnames.
// fieldnames.
if
(
!
fields
[
i
].
m_Text
.
IsEmpty
()
)
if
(
!
fields
[
i
].
m_Text
.
IsEmpty
()
)
{
{
fields
[
i
].
m_FieldId
=
fieldId
++
;
fields
[
i
].
SetId
(
fieldId
++
)
;
if
(
!
fields
[
i
].
Save
(
aFile
)
)
if
(
!
fields
[
i
].
Save
(
aFile
)
)
return
false
;
return
false
;
}
}
...
@@ -916,9 +916,9 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
...
@@ -916,9 +916,9 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
return
false
;
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.
// this will fire only if somebody broke a constructor or editor.
// MANDATORY_FIELDS are always present in ram resident components, no
// MANDATORY_FIELDS are always present in ram resident components, no
...
@@ -927,7 +927,7 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
...
@@ -927,7 +927,7 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
*
fixedField
=
*
field
;
*
fixedField
=
*
field
;
if
(
field
->
m_FieldId
==
VALUE
)
if
(
field
->
GetId
()
==
VALUE
)
m_name
=
field
->
m_Text
;
m_name
=
field
->
m_Text
;
SAFE_DELETE
(
field
);
SAFE_DELETE
(
field
);
...
@@ -1055,7 +1055,7 @@ void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList )
...
@@ -1055,7 +1055,7 @@ void LIB_COMPONENT::GetFields( LIB_FIELD_LIST& aList )
continue
;
continue
;
field
=
(
LIB_FIELD
*
)
&
item
;
field
=
(
LIB_FIELD
*
)
&
item
;
if
(
(
unsigned
)
field
->
m_FieldId
<
MANDATORY_FIELDS
)
if
(
(
unsigned
)
field
->
GetId
()
<
MANDATORY_FIELDS
)
continue
;
// was added above
continue
;
// was added above
aList
.
push_back
(
*
field
);
aList
.
push_back
(
*
field
);
...
@@ -1072,7 +1072,7 @@ LIB_FIELD* LIB_COMPONENT::GetField( int aId )
...
@@ -1072,7 +1072,7 @@ LIB_FIELD* LIB_COMPONENT::GetField( int aId )
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
&
item
;
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
&
item
;
if
(
field
->
m_FieldId
==
aId
)
if
(
field
->
GetId
()
==
aId
)
return
field
;
return
field
;
}
}
...
@@ -1089,7 +1089,7 @@ LIB_FIELD* LIB_COMPONENT::FindField( const wxString& aFieldName )
...
@@ -1089,7 +1089,7 @@ LIB_FIELD* LIB_COMPONENT::FindField( const wxString& aFieldName )
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
&
item
;
LIB_FIELD
*
field
=
(
LIB_FIELD
*
)
&
item
;
if
(
field
->
m_Name
==
aFieldName
)
if
(
field
->
GetName
()
==
aFieldName
)
return
field
;
return
field
;
}
}
...
@@ -1262,7 +1262,7 @@ void LIB_COMPONENT::DeleteSelectedItems()
...
@@ -1262,7 +1262,7 @@ void LIB_COMPONENT::DeleteSelectedItems()
{
{
#if 0 // Set to 1 to allows fields deletion on block delete or other global command
#if 0 // Set to 1 to allows fields deletion on block delete or other global command
LIB_FIELD& field = ( LIB_FIELD& ) *item;
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) )
(field.m_Attributs & TEXT_NO_VISIBLE) )
#endif
#endif
item
->
m_Selected
=
0
;
item
->
m_Selected
=
0
;
...
...
eeschema/cross-probing.cpp
View file @
3fed7b9d
...
@@ -130,7 +130,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
...
@@ -130,7 +130,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
break
;
break
;
Pin
=
(
LIB_PIN
*
)
objectToSync
;
Pin
=
(
LIB_PIN
*
)
objectToSync
;
if
(
Pin
->
m_PinNum
)
if
(
Pin
->
GetNumber
()
)
{
{
wxString
pinnum
;
wxString
pinnum
;
Pin
->
ReturnPinStringNum
(
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&
...
@@ -64,10 +64,11 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint&
wxPoint
pinpos
;
wxPoint
pinpos
;
Pin
=
LocateAnyPin
(
DrawList
,
pos
,
&
DrawLibItem
);
Pin
=
LocateAnyPin
(
DrawList
,
pos
,
&
DrawLibItem
);
if
(
!
Pin
)
if
(
!
Pin
)
return
NULL
;
return
NULL
;
pinpos
=
Pin
->
m_Pos
;
pinpos
=
Pin
->
GetPosition
()
;
if
(
DrawLibItem
==
NULL
)
if
(
DrawLibItem
==
NULL
)
NEGATE
(
pinpos
.
y
);
// In libraries Y axis is bottom to top
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&
...
@@ -78,5 +79,6 @@ LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint&
if
(
pos
==
pinpos
)
if
(
pos
==
pinpos
)
return
Pin
;
return
Pin
;
return
NULL
;
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" ),
...
@@ -249,7 +249,7 @@ An alias %s already exists!\nCannot update this component" ),
// back into the component
// back into the component
for
(
unsigned
i
=
MANDATORY_FIELDS
;
i
<
m_FieldsBuf
.
size
();
)
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
);
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
i
);
continue
;
continue
;
...
@@ -262,7 +262,7 @@ An alias %s already exists!\nCannot update this component" ),
...
@@ -262,7 +262,7 @@ An alias %s already exists!\nCannot update this component" ),
for
(
unsigned
i
=
0
;
i
<
m_FieldsBuf
.
size
();
++
i
)
for
(
unsigned
i
=
0
;
i
<
m_FieldsBuf
.
size
();
++
i
)
{
{
printf
(
"save[%d].name:'%s' value:'%s'
\n
"
,
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
)
);
CONV_TO_UTF8
(
m_FieldsBuf
[
i
].
m_Text
)
);
}
}
#endif
#endif
...
@@ -296,7 +296,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
...
@@ -296,7 +296,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
LIB_FIELD
blank
(
fieldNdx
);
LIB_FIELD
blank
(
fieldNdx
);
m_FieldsBuf
.
push_back
(
blank
);
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
]
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
...
@@ -423,7 +423,7 @@ static LIB_FIELD* findfield( const LIB_FIELD_LIST& aList, const wxString& aField
...
@@ -423,7 +423,7 @@ static LIB_FIELD* findfield( const LIB_FIELD_LIST& aList, const wxString& aField
for
(
unsigned
i
=
0
;
i
<
aList
.
size
();
++
i
)
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.
field
=
&
aList
[
i
];
// best to avoid casting here.
break
;
break
;
...
@@ -437,7 +437,7 @@ LIB_FIELD* DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::findField( const wxString& aField
...
@@ -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
)
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
&
m_FieldsBuf
[
i
];
}
}
return
NULL
;
return
NULL
;
...
@@ -455,7 +455,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
...
@@ -455,7 +455,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
#if defined(DEBUG)
#if defined(DEBUG)
for
(
unsigned
i
=
0
;
i
<
cmpFields
.
size
();
++
i
)
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
#endif
...
@@ -483,7 +483,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
...
@@ -483,7 +483,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
// fixed fields:
// fixed fields:
for
(
int
i
=
0
;
i
<
MANDATORY_FIELDS
;
++
i
)
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
]
);
m_FieldsBuf
.
push_back
(
cmpFields
[
i
]
);
}
}
...
@@ -510,7 +510,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
...
@@ -510,7 +510,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
{
{
D
(
printf
(
"add template:%s
\n
"
,
CONV_TO_UTF8
(
it
->
m_Name
)
);
)
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.
fld
.
m_Text
=
it
->
m_Value
;
// empty? ok too.
if
(
!
it
->
m_Visible
)
if
(
!
it
->
m_Visible
)
...
@@ -520,7 +520,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
...
@@ -520,7 +520,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
}
}
else
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
fld
=
*
libField
;
// copy values from component, m_Name too
}
}
...
@@ -532,11 +532,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
...
@@ -532,11 +532,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers()
for
(
unsigned
i
=
MANDATORY_FIELDS
;
i
<
cmpFields
.
size
();
++
i
)
for
(
unsigned
i
=
MANDATORY_FIELDS
;
i
<
cmpFields
.
size
();
++
i
)
{
{
LIB_FIELD
*
cmp
=
&
cmpFields
[
i
];
LIB_FIELD
*
cmp
=
&
cmpFields
[
i
];
LIB_FIELD
*
buf
=
findField
(
cmp
->
m_Name
);
LIB_FIELD
*
buf
=
findField
(
cmp
->
GetName
()
);
if
(
!
buf
)
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
);
m_FieldsBuf
.
push_back
(
*
cmp
);
}
}
}
}
...
@@ -578,7 +578,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FI
...
@@ -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
(
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
);
fieldListCtrl
->
SetItem
(
aFieldNdx
,
COLUMN_TEXT
,
aField
.
m_Text
);
// recompute the column widths here, after setting texts
// recompute the column widths here, after setting texts
...
@@ -629,17 +629,19 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
...
@@ -629,17 +629,19 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
// Field names have become more important than field ids, so we cannot
// 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.
// mangle the names in the buffer but we can do so in the panel.
if
(
field
.
m_FieldId
==
VALUE
)
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
// This field is the lib name and the default value when loading this component in
// a new component or alias. This is handles in libedir, not in this dialog.
// schematic. The value is now not editable here (in this dialog) because changing
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
+
wxT
(
" / "
)
+
_
(
"Chip Name"
)
);
// 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
);
fieldValueTextCtrl
->
Enable
(
false
);
}
}
else
else
{
{
fieldValueTextCtrl
->
Enable
(
true
);
fieldValueTextCtrl
->
Enable
(
true
);
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
);
fieldNameTextCtrl
->
SetValue
(
field
.
GetName
()
);
}
}
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable field name editing
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable field name editing
...
@@ -731,8 +733,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
...
@@ -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.
// FieldNameTextCtrl has a tricked value in it for VALUE index, do not copy it back.
// It has the "Chip Name" appended.
// It has the "Chip Name" appended.
if
(
field
.
m_FieldId
>=
MANDATORY_FIELDS
)
if
(
field
.
GetId
()
>=
MANDATORY_FIELDS
)
field
.
m_Name
=
fieldNameTextCtrl
->
GetValue
(
);
field
.
SetName
(
fieldNameTextCtrl
->
GetValue
()
);
setRowItem
(
fieldNdx
,
field
);
// update fieldListCtrl
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 )
...
@@ -100,6 +100,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_FIELD* Field, wxDC* DC )
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
Field
->
GetParent
();
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
Field
->
GetParent
();
fieldNdx
=
Field
->
m_FieldId
;
fieldNdx
=
Field
->
m_FieldId
;
if
(
fieldNdx
==
VALUE
)
if
(
fieldNdx
==
VALUE
)
{
{
Entry
=
CMP_LIBRARY
::
FindLibraryComponent
(
Cmp
->
m_ChipName
);
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
...
@@ -147,10 +147,12 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component
pos
=
pSch
->
m_Pos
;
/* temporary: will be changed if
pos
=
pSch
->
m_Pos
;
/* temporary: will be changed if
* the pin is found */
* the pin is found */
pin
=
pSch
->
GetPin
(
text_to_find
);
pin
=
pSch
->
GetPin
(
text_to_find
);
if
(
pin
==
NULL
)
if
(
pin
==
NULL
)
break
;
break
;
NotFound
=
FALSE
;
NotFound
=
FALSE
;
pos
+=
pin
->
m_Pos
;
pos
+=
pin
->
GetPosition
()
;
break
;
break
;
case
2
:
// find reference
case
2
:
// find reference
...
...
eeschema/lib_draw_item.h
View file @
3fed7b9d
...
@@ -301,6 +301,8 @@ public:
...
@@ -301,6 +301,8 @@ public:
*/
*/
wxPoint
GetPosition
()
const
{
return
DoGetPosition
();
}
wxPoint
GetPosition
()
const
{
return
DoGetPosition
();
}
void
SetPosition
(
const
wxPoint
&
aPosition
)
{
DoMove
(
aPosition
);
}
/**
/**
* Mirror the draw object along the horizontal (X) axis about a point.
* 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 ) :
...
@@ -47,8 +47,7 @@ LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) :
}
}
LIB_FIELD
::
LIB_FIELD
(
int
idfield
)
:
LIB_FIELD
::
LIB_FIELD
(
int
idfield
)
:
LIB_DRAW_ITEM
(
COMPONENT_FIELD_DRAW_TYPE
,
NULL
)
LIB_DRAW_ITEM
(
COMPONENT_FIELD_DRAW_TYPE
,
NULL
)
{
{
Init
(
idfield
);
Init
(
idfield
);
}
}
...
@@ -56,14 +55,14 @@ LIB_FIELD::LIB_FIELD( int idfield ) :
...
@@ -56,14 +55,14 @@ LIB_FIELD::LIB_FIELD( int idfield ) :
LIB_FIELD
::
LIB_FIELD
(
const
LIB_FIELD
&
field
)
:
LIB_DRAW_ITEM
(
field
)
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_Pos
=
field
.
m_Pos
;
m_Size
=
field
.
m_Size
;
m_Size
=
field
.
m_Size
;
m_Thickness
=
field
.
m_Thickness
;
m_Thickness
=
field
.
m_Thickness
;
m_Orient
=
field
.
m_Orient
;
m_Orient
=
field
.
m_Orient
;
m_Attributs
=
field
.
m_Attributs
;
m_Attributs
=
field
.
m_Attributs
;
m_Text
=
field
.
m_Text
;
m_Text
=
field
.
m_Text
;
m_
Name
=
field
.
m_N
ame
;
m_
name
=
field
.
m_n
ame
;
m_HJustify
=
field
.
m_HJustify
;
m_HJustify
=
field
.
m_HJustify
;
m_VJustify
=
field
.
m_VJustify
;
m_VJustify
=
field
.
m_VJustify
;
m_Italic
=
field
.
m_Italic
;
m_Italic
=
field
.
m_Italic
;
...
@@ -78,7 +77,7 @@ LIB_FIELD::~LIB_FIELD()
...
@@ -78,7 +77,7 @@ LIB_FIELD::~LIB_FIELD()
void
LIB_FIELD
::
Init
(
int
id
)
void
LIB_FIELD
::
Init
(
int
id
)
{
{
m_
FieldI
d
=
id
;
m_
i
d
=
id
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
m_typeName
=
_
(
"Field"
);
m_typeName
=
_
(
"Field"
);
m_Orient
=
TEXT_ORIENT_HORIZ
;
m_Orient
=
TEXT_ORIENT_HORIZ
;
...
@@ -88,7 +87,7 @@ void LIB_FIELD::Init( int id )
...
@@ -88,7 +87,7 @@ void LIB_FIELD::Init( int id )
// fields in RAM must always have names, because we are trying to get
// fields in RAM must always have names, because we are trying to get
// less dependent on field ids and more dependent on names.
// less dependent on field ids and more dependent on names.
// Plus assumptions are made in the field editors.
// 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 )
...
@@ -98,12 +97,14 @@ bool LIB_FIELD::Save( FILE* ExportFile )
wxString
text
=
m_Text
;
wxString
text
=
m_Text
;
hjustify
=
'C'
;
hjustify
=
'C'
;
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
hjustify
=
'L'
;
hjustify
=
'L'
;
else
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
else
if
(
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
hjustify
=
'R'
;
hjustify
=
'R'
;
vjustify
=
'C'
;
vjustify
=
'C'
;
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
vjustify
=
'B'
;
vjustify
=
'B'
;
else
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
else
if
(
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
...
@@ -113,7 +114,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
...
@@ -113,7 +114,7 @@ bool LIB_FIELD::Save( FILE* ExportFile )
text
=
wxT
(
"~"
);
text
=
wxT
(
"~"
);
if
(
fprintf
(
ExportFile
,
"F%d
\"
%s
\"
%d %d %d %c %c %c %c%c%c"
,
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_Orient
==
0
?
'H'
:
'V'
,
(
m_Attributs
&
TEXT_NO_VISIBLE
)
?
'I'
:
'V'
,
(
m_Attributs
&
TEXT_NO_VISIBLE
)
?
'I'
:
'V'
,
hjustify
,
vjustify
,
hjustify
,
vjustify
,
...
@@ -126,11 +127,11 @@ bool LIB_FIELD::Save( FILE* ExportFile )
...
@@ -126,11 +127,11 @@ bool LIB_FIELD::Save( FILE* ExportFile )
* Just because default name depends on the language and can change from
* Just because default name depends on the language and can change from
* a country to an other
* 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
()
if
(
m_
id
>=
FIELD1
&&
!
m_n
ame
.
IsEmpty
()
&&
m_
N
ame
!=
defName
&&
m_
n
ame
!=
defName
&&
fprintf
(
ExportFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_
N
ame
)
)
<
0
)
&&
fprintf
(
ExportFile
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
m_
n
ame
)
)
<
0
)
return
false
;
return
false
;
if
(
fprintf
(
ExportFile
,
"
\n
"
)
<
0
)
if
(
fprintf
(
ExportFile
,
"
\n
"
)
<
0
)
...
@@ -150,7 +151,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
...
@@ -150,7 +151,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
char
fieldUserName
[
1024
];
char
fieldUserName
[
1024
];
char
*
text
;
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"
);
errorMsg
=
wxT
(
"invalid field header"
);
return
false
;
return
false
;
...
@@ -191,7 +192,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
...
@@ -191,7 +192,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
if
(
cnt
<
5
)
if
(
cnt
<
5
)
{
{
errorMsg
.
Printf
(
wxT
(
"field %d does not have the correct number of parameters"
),
errorMsg
.
Printf
(
wxT
(
"field %d does not have the correct number of parameters"
),
m_
FieldI
d
);
m_
i
d
);
return
false
;
return
false
;
}
}
...
@@ -260,17 +261,17 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
...
@@ -260,17 +261,17 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
}
}
// fields in RAM must always have names.
// 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
// Fields in RAM must always have names, because we are trying to get
// less dependent on field ids and more dependent on names.
// less dependent on field ids and more dependent on names.
// Plus assumptions are made in the field editors.
// 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
else
{
{
ReadDelimitedText
(
fieldUserName
,
line
,
sizeof
(
fieldUserName
)
);
ReadDelimitedText
(
fieldUserName
,
line
,
sizeof
(
fieldUserName
)
);
m_
N
ame
=
CONV_FROM_UTF8
(
fieldUserName
);
m_
n
ame
=
CONV_FROM_UTF8
(
fieldUserName
);
}
}
return
true
;
return
true
;
...
@@ -369,13 +370,15 @@ bool LIB_FIELD::HitTest( const wxPoint& refPos )
...
@@ -369,13 +370,15 @@ bool LIB_FIELD::HitTest( const wxPoint& refPos )
bool
LIB_FIELD
::
HitTest
(
wxPoint
aPosRef
,
int
aThreshold
,
const
TRANSFORM
&
aTransform
)
bool
LIB_FIELD
::
HitTest
(
wxPoint
aPosRef
,
int
aThreshold
,
const
TRANSFORM
&
aTransform
)
{
{
int
extraCharCount
=
0
;
int
extraCharCount
=
0
;
// Reference designator text has one or 2 additional character (displays
// Reference designator text has one or 2 additional character (displays
// U? or U?A)
// U? or U?A)
if
(
m_
FieldI
d
==
REFERENCE
)
if
(
m_
i
d
==
REFERENCE
)
{
{
extraCharCount
++
;
extraCharCount
++
;
m_Text
.
Append
(
'?'
);
m_Text
.
Append
(
'?'
);
LIB_COMPONENT
*
parent
=
(
LIB_COMPONENT
*
)
m_Parent
;
LIB_COMPONENT
*
parent
=
(
LIB_COMPONENT
*
)
m_Parent
;
if
(
parent
&&
(
parent
->
GetPartCount
()
>
1
)
)
if
(
parent
&&
(
parent
->
GetPartCount
()
>
1
)
)
{
{
m_Text
.
Append
(
'A'
);
m_Text
.
Append
(
'A'
);
...
@@ -386,6 +389,7 @@ bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTran
...
@@ -386,6 +389,7 @@ bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTran
wxPoint
physicalpos
=
aTransform
.
TransformCoordinate
(
m_Pos
);
wxPoint
physicalpos
=
aTransform
.
TransformCoordinate
(
m_Pos
);
wxPoint
tmp
=
m_Pos
;
wxPoint
tmp
=
m_Pos
;
m_Pos
=
physicalpos
;
m_Pos
=
physicalpos
;
/* The text orientation may need to be flipped if the
/* The text orientation may need to be flipped if the
* transformation matrix causes xy axes to be flipped.
* transformation matrix causes xy axes to be flipped.
* this simple algo works only for schematic matrix (rot 90 or/and mirror)
* 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
...
@@ -405,9 +409,10 @@ bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTran
return
hit
;
return
hit
;
}
}
LIB_DRAW_ITEM
*
LIB_FIELD
::
DoGenCopy
()
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
);
Copy
(
newfield
);
...
@@ -429,7 +434,7 @@ void LIB_FIELD::Copy( LIB_FIELD* Target ) const
...
@@ -429,7 +434,7 @@ void LIB_FIELD::Copy( LIB_FIELD* Target ) const
Target
->
m_Orient
=
m_Orient
;
Target
->
m_Orient
=
m_Orient
;
Target
->
m_Attributs
=
m_Attributs
;
Target
->
m_Attributs
=
m_Attributs
;
Target
->
m_Text
=
m_Text
;
Target
->
m_Text
=
m_Text
;
Target
->
m_
Name
=
m_N
ame
;
Target
->
m_
name
=
m_n
ame
;
Target
->
m_HJustify
=
m_HJustify
;
Target
->
m_HJustify
=
m_HJustify
;
Target
->
m_VJustify
=
m_VJustify
;
Target
->
m_VJustify
=
m_VJustify
;
Target
->
m_Italic
=
m_Italic
;
Target
->
m_Italic
=
m_Italic
;
...
@@ -443,8 +448,8 @@ int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const
...
@@ -443,8 +448,8 @@ int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const
const
LIB_FIELD
*
tmp
=
(
LIB_FIELD
*
)
&
other
;
const
LIB_FIELD
*
tmp
=
(
LIB_FIELD
*
)
&
other
;
if
(
m_
FieldId
!=
tmp
->
m_FieldI
d
)
if
(
m_
id
!=
tmp
->
m_i
d
)
return
m_
FieldId
-
tmp
->
m_FieldI
d
;
return
m_
id
-
tmp
->
m_i
d
;
int
result
=
m_Text
.
CmpNoCase
(
tmp
->
m_Text
);
int
result
=
m_Text
.
CmpNoCase
(
tmp
->
m_Text
);
...
@@ -511,7 +516,7 @@ void LIB_FIELD::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
...
@@ -511,7 +516,7 @@ void LIB_FIELD::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
*/
*/
wxString
LIB_FIELD
::
GetFullText
(
int
unit
)
wxString
LIB_FIELD
::
GetFullText
(
int
unit
)
{
{
if
(
m_
FieldI
d
!=
REFERENCE
)
if
(
m_
i
d
!=
REFERENCE
)
return
m_Text
;
return
m_Text
;
wxString
text
=
m_Text
;
wxString
text
=
m_Text
;
...
@@ -547,7 +552,7 @@ int LIB_FIELD::GetDefaultColor()
...
@@ -547,7 +552,7 @@ int LIB_FIELD::GetDefaultColor()
{
{
int
color
;
int
color
;
switch
(
m_
FieldI
d
)
switch
(
m_
i
d
)
{
{
case
REFERENCE
:
case
REFERENCE
:
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
color
=
ReturnLayerColor
(
LAYER_REFERENCEPART
);
...
@@ -579,11 +584,11 @@ void LIB_FIELD::Rotate()
...
@@ -579,11 +584,11 @@ void LIB_FIELD::Rotate()
}
}
wxString
LIB_FIELD
::
GetName
()
wxString
LIB_FIELD
::
GetName
()
const
{
{
wxString
name
;
wxString
name
;
switch
(
m_
FieldI
d
)
switch
(
m_
i
d
)
{
{
case
REFERENCE
:
case
REFERENCE
:
name
=
_
(
"Reference"
);
name
=
_
(
"Reference"
);
...
@@ -602,16 +607,30 @@ wxString LIB_FIELD::GetName()
...
@@ -602,16 +607,30 @@ wxString LIB_FIELD::GetName()
break
;
break
;
default
:
default
:
if
(
m_
N
ame
.
IsEmpty
()
)
if
(
m_
n
ame
.
IsEmpty
()
)
name
.
Printf
(
_
(
"Field%d"
),
m_
FieldI
d
);
name
.
Printf
(
_
(
"Field%d"
),
m_
i
d
);
else
else
name
=
m_
N
ame
;
name
=
m_
n
ame
;
}
}
return
name
;
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
)
void
LIB_FIELD
::
SetText
(
const
wxString
&
aText
)
{
{
if
(
aText
==
m_Text
)
if
(
aText
==
m_Text
)
...
@@ -619,7 +638,7 @@ void LIB_FIELD::SetText( const wxString& aText )
...
@@ -619,7 +638,7 @@ void LIB_FIELD::SetText( const wxString& aText )
wxString
oldName
=
m_Text
;
wxString
oldName
=
m_Text
;
if
(
m_
FieldI
d
==
VALUE
&&
m_Parent
!=
NULL
)
if
(
m_
i
d
==
VALUE
&&
m_Parent
!=
NULL
)
{
{
LIB_COMPONENT
*
parent
=
GetParent
();
LIB_COMPONENT
*
parent
=
GetParent
();
...
@@ -729,4 +748,3 @@ void LIB_FIELD::DisplayInfo( WinEDA_DrawFrame* aFrame )
...
@@ -729,4 +748,3 @@ void LIB_FIELD::DisplayInfo( WinEDA_DrawFrame* aFrame )
// Display field text:
// Display field text:
aFrame
->
AppendMsgPanel
(
_
(
"Value"
),
m_Text
,
BROWN
);
aFrame
->
AppendMsgPanel
(
_
(
"Value"
),
m_Text
,
BROWN
);
}
}
eeschema/lib_field.h
View file @
3fed7b9d
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#ifndef CLASS_LIBENTRY_FIELDS_H
#ifndef CLASS_LIBENTRY_FIELDS_H
#define CLASS_LIBENTRY_FIELDS_H
#define CLASS_LIBENTRY_FIELDS_H
//#include "general.h"
#include "lib_draw_item.h"
#include "lib_draw_item.h"
...
@@ -18,6 +17,9 @@
...
@@ -18,6 +17,9 @@
*/
*/
class
LIB_FIELD
:
public
LIB_DRAW_ITEM
,
public
EDA_TextStruct
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.
wxString
m_savedText
;
///< Temporary storage for the string when edition.
bool
m_rotate
;
///< Flag to indicate a rotation occurred while editing.
bool
m_rotate
;
///< Flag to indicate a rotation occurred while editing.
bool
m_updateText
;
///< Flag to indicate text change 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
...
@@ -35,11 +37,6 @@ class LIB_FIELD : public LIB_DRAW_ITEM, public EDA_TextStruct
*/
*/
void
calcEdit
(
const
wxPoint
&
aPosition
);
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
:
public
:
LIB_FIELD
(
int
idfield
=
2
);
LIB_FIELD
(
int
idfield
=
2
);
...
@@ -62,11 +59,28 @@ public:
...
@@ -62,11 +59,28 @@ public:
*
*
* The first four field IDs are reserved and therefore always return their respective
* 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
* 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.
* @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
* Function GetPenSize virtual pure
...
@@ -133,9 +147,9 @@ public:
...
@@ -133,9 +147,9 @@ public:
void
operator
=
(
const
LIB_FIELD
&
field
)
void
operator
=
(
const
LIB_FIELD
&
field
)
{
{
m_
FieldId
=
field
.
m_FieldI
d
;
m_
id
=
field
.
m_i
d
;
m_Text
=
field
.
m_Text
;
m_Text
=
field
.
m_Text
;
m_
Name
=
field
.
m_N
ame
;
m_
name
=
field
.
m_n
ame
;
m_Pos
=
field
.
m_Pos
;
m_Pos
=
field
.
m_Pos
;
m_Size
=
field
.
m_Size
;
m_Size
=
field
.
m_Size
;
m_Thickness
=
field
.
m_Thickness
;
m_Thickness
=
field
.
m_Thickness
;
...
...
eeschema/lib_pin.cpp
View file @
3fed7b9d
...
@@ -134,8 +134,8 @@ static const char ** s_icons_Pins_Electrical_Type[] =
...
@@ -134,8 +134,8 @@ static const char ** s_icons_Pins_Electrical_Type[] =
pintype_noconnect_xpm
pintype_noconnect_xpm
};
};
#define PIN_ELECTRICAL_TYPE_CNT ( sizeof( pin_electrical_type_names ) / \
sizeof( wxString ) )
#define PIN_ELECTRICAL_TYPE_CNT ( sizeof( pin_electrical_type_names ) /
sizeof( wxString ) )
const
wxChar
*
MsgPinElectricType
[]
=
const
wxChar
*
MsgPinElectricType
[]
=
...
@@ -162,15 +162,15 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
...
@@ -162,15 +162,15 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
LIB_PIN
::
LIB_PIN
(
LIB_COMPONENT
*
aParent
)
:
LIB_PIN
::
LIB_PIN
(
LIB_COMPONENT
*
aParent
)
:
LIB_DRAW_ITEM
(
COMPONENT_PIN_DRAW_TYPE
,
aParent
)
LIB_DRAW_ITEM
(
COMPONENT_PIN_DRAW_TYPE
,
aParent
)
{
{
m_
PinLen
=
300
;
/* default Pin len */
m_
length
=
300
;
/* default Pin len */
m_
Orient
=
PIN_RIGHT
;
/* Pin op
rient: Up, Down, Left, Right */
m_
orientation
=
PIN_RIGHT
;
/* Pin o
rient: Up, Down, Left, Right */
m_
PinShape
=
NONE
;
/* Pin shape, bitwise. */
m_
shape
=
NONE
;
/* Pin shape, bitwise. */
m_
PinType
=
PIN_UNSPECIFIED
;
/* electrical type of pin */
m_
type
=
PIN_UNSPECIFIED
;
/* electrical type of pin */
m_
Attributs
=
0
;
/* bit 0 != 0: pin invisible */
m_
attributes
=
0
;
/* bit 0 != 0: pin invisible */
m_
PinNum
=
0
;
/* pin number ( i.e. 4 codes ASCII ) */
m_
number
=
0
;
/* pin number ( i.e. 4 codes ASCII ) */
m_PinNumSize
=
50
;
m_PinNumSize
=
50
;
m_PinNameSize
=
50
;
/* Default size for pin name and num */
m_PinNameSize
=
50
;
/* Default size for pin name and num */
m_
W
idth
=
0
;
m_
w
idth
=
0
;
m_typeName
=
_
(
"Pin"
);
m_typeName
=
_
(
"Pin"
);
m_PinNumShapeOpt
=
0
;
m_PinNumShapeOpt
=
0
;
m_PinNameShapeOpt
=
0
;
m_PinNameShapeOpt
=
0
;
...
@@ -181,33 +181,33 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) :
...
@@ -181,33 +181,33 @@ LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) :
LIB_PIN
::
LIB_PIN
(
const
LIB_PIN
&
pin
)
:
LIB_DRAW_ITEM
(
pin
)
LIB_PIN
::
LIB_PIN
(
const
LIB_PIN
&
pin
)
:
LIB_DRAW_ITEM
(
pin
)
{
{
m_
Pos
=
pin
.
m_Pos
;
m_
position
=
pin
.
m_position
;
m_
PinLen
=
pin
.
m_PinLen
;
m_
length
=
pin
.
m_length
;
m_
Orient
=
pin
.
m_Orient
;
m_
orientation
=
pin
.
m_orientation
;
m_
PinShape
=
pin
.
m_PinS
hape
;
m_
shape
=
pin
.
m_s
hape
;
m_
PinType
=
pin
.
m_PinT
ype
;
m_
type
=
pin
.
m_t
ype
;
m_
Attributs
=
pin
.
m_Attribut
s
;
m_
attributes
=
pin
.
m_attribute
s
;
m_
PinNum
=
pin
.
m_PinNum
;
m_
number
=
pin
.
m_number
;
m_PinNumSize
=
pin
.
m_PinNumSize
;
m_PinNumSize
=
pin
.
m_PinNumSize
;
m_PinNameSize
=
pin
.
m_PinNameSize
;
m_PinNameSize
=
pin
.
m_PinNameSize
;
m_PinNumShapeOpt
=
pin
.
m_PinNumShapeOpt
;
m_PinNumShapeOpt
=
pin
.
m_PinNumShapeOpt
;
m_PinNameShapeOpt
=
pin
.
m_PinNameShapeOpt
;
m_PinNameShapeOpt
=
pin
.
m_PinNameShapeOpt
;
m_PinNumPositionOpt
=
pin
.
m_PinNumPositionOpt
;
m_PinNumPositionOpt
=
pin
.
m_PinNumPositionOpt
;
m_PinNamePositionOpt
=
pin
.
m_PinNamePositionOpt
;
m_PinNamePositionOpt
=
pin
.
m_PinNamePositionOpt
;
m_
Width
=
pin
.
m_W
idth
;
m_
width
=
pin
.
m_w
idth
;
m_
PinName
=
pin
.
m_PinN
ame
;
m_
name
=
pin
.
m_n
ame
;
}
}
void
LIB_PIN
::
SetName
(
const
wxString
&
n
ame
)
void
LIB_PIN
::
SetName
(
const
wxString
&
aN
ame
)
{
{
wxString
tmp
=
(
name
.
IsEmpty
()
)
?
wxT
(
"~"
)
:
n
ame
;
wxString
tmp
=
(
aName
.
IsEmpty
()
)
?
wxT
(
"~"
)
:
aN
ame
;
tmp
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
tmp
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
if
(
m_
PinN
ame
!=
tmp
)
if
(
m_
n
ame
!=
tmp
)
{
{
m_
PinN
ame
=
tmp
;
m_
n
ame
=
tmp
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -218,12 +218,11 @@ void LIB_PIN::SetName( const wxString& name )
...
@@ -218,12 +218,11 @@ void LIB_PIN::SetName( const wxString& name )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_name
==
m_name
)
||
pinList
[
i
]
->
m_PinName
==
m_PinName
)
continue
;
continue
;
pinList
[
i
]
->
m_
PinName
=
m_PinN
ame
;
pinList
[
i
]
->
m_
name
=
m_n
ame
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
...
@@ -233,7 +232,7 @@ void LIB_PIN::SetNameTextSize( int size )
...
@@ -233,7 +232,7 @@ void LIB_PIN::SetNameTextSize( int size )
if
(
size
!=
m_PinNameSize
)
if
(
size
!=
m_PinNameSize
)
{
{
m_PinNameSize
=
size
;
m_PinNameSize
=
size
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -244,12 +243,11 @@ void LIB_PIN::SetNameTextSize( int size )
...
@@ -244,12 +243,11 @@ void LIB_PIN::SetNameTextSize( int size )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_PinNameSize
==
size
)
||
pinList
[
i
]
->
m_PinNameSize
==
size
)
continue
;
continue
;
pinList
[
i
]
->
m_PinNameSize
=
size
;
pinList
[
i
]
->
m_PinNameSize
=
size
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
...
@@ -258,10 +256,10 @@ void LIB_PIN::SetNumber( const wxString& number )
...
@@ -258,10 +256,10 @@ void LIB_PIN::SetNumber( const wxString& number )
{
{
wxString
tmp
=
(
number
.
IsEmpty
()
)
?
wxT
(
"~"
)
:
number
;
wxString
tmp
=
(
number
.
IsEmpty
()
)
?
wxT
(
"~"
)
:
number
;
tmp
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
tmp
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
long
oldNumber
=
m_
PinNum
;
long
oldNumber
=
m_
number
;
SetPinNumFromString
(
tmp
);
SetPinNumFromString
(
tmp
);
if
(
m_
PinNum
!=
oldNumber
)
if
(
m_
number
!=
oldNumber
)
{
{
m_Flags
|=
IS_CHANGED
;
m_Flags
|=
IS_CHANGED
;
}
}
...
@@ -277,7 +275,7 @@ void LIB_PIN::SetNumberTextSize( int size )
...
@@ -277,7 +275,7 @@ void LIB_PIN::SetNumberTextSize( int size )
if
(
size
!=
m_PinNumSize
)
if
(
size
!=
m_PinNumSize
)
{
{
m_PinNumSize
=
size
;
m_PinNumSize
=
size
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -288,22 +286,21 @@ void LIB_PIN::SetNumberTextSize( int size )
...
@@ -288,22 +286,21 @@ void LIB_PIN::SetNumberTextSize( int size )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_PinNumSize
==
size
)
||
pinList
[
i
]
->
m_PinNumSize
==
size
)
continue
;
continue
;
pinList
[
i
]
->
m_PinNumSize
=
size
;
pinList
[
i
]
->
m_PinNumSize
=
size
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
void
LIB_PIN
::
SetOrientation
(
int
orientation
)
void
LIB_PIN
::
SetOrientation
(
int
orientation
)
{
{
if
(
m_
Orient
!=
orientation
)
if
(
m_
orientation
!=
orientation
)
{
{
m_
Orient
=
orientation
;
m_
orientation
=
orientation
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -314,22 +311,21 @@ void LIB_PIN::SetOrientation( int orientation )
...
@@ -314,22 +311,21 @@ void LIB_PIN::SetOrientation( int orientation )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_orientation
==
orientation
)
||
pinList
[
i
]
->
m_Orient
==
orientation
)
continue
;
continue
;
pinList
[
i
]
->
m_
Orient
=
orientation
;
pinList
[
i
]
->
m_
orientation
=
orientation
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
void
LIB_PIN
::
Set
DrawStyle
(
int
styl
e
)
void
LIB_PIN
::
Set
Shape
(
int
aShap
e
)
{
{
if
(
m_
PinShape
!=
styl
e
)
if
(
m_
shape
!=
aShap
e
)
{
{
m_
PinShape
=
styl
e
;
m_
shape
=
aShap
e
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -340,22 +336,21 @@ void LIB_PIN::SetDrawStyle( int style )
...
@@ -340,22 +336,21 @@ void LIB_PIN::SetDrawStyle( int style )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_shape
==
aShape
)
||
pinList
[
i
]
->
m_PinShape
==
style
)
continue
;
continue
;
pinList
[
i
]
->
m_
PinShape
=
styl
e
;
pinList
[
i
]
->
m_
shape
=
aShap
e
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
void
LIB_PIN
::
Set
ElectricalType
(
int
t
ype
)
void
LIB_PIN
::
Set
Type
(
int
aT
ype
)
{
{
if
(
m_
PinType
!=
t
ype
)
if
(
m_
type
!=
aT
ype
)
{
{
m_
PinType
=
t
ype
;
m_
type
=
aT
ype
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -366,22 +361,21 @@ void LIB_PIN::SetElectricalType( int type )
...
@@ -366,22 +361,21 @@ void LIB_PIN::SetElectricalType( int type )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_type
==
aType
)
||
pinList
[
i
]
->
m_PinType
==
type
)
continue
;
continue
;
pinList
[
i
]
->
m_
PinType
=
t
ype
;
pinList
[
i
]
->
m_
type
=
aT
ype
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
void
LIB_PIN
::
SetLength
(
int
length
)
void
LIB_PIN
::
SetLength
(
int
length
)
{
{
if
(
m_
PinLen
!=
length
)
if
(
m_
length
!=
length
)
{
{
m_
PinLen
=
length
;
m_
length
=
length
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
...
@@ -394,11 +388,11 @@ void LIB_PIN::SetLength( int length )
...
@@ -394,11 +388,11 @@ void LIB_PIN::SetLength( int length )
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
m_Convert
!=
m_Convert
||
pinList
[
i
]
->
m_Convert
!=
m_Convert
||
pinList
[
i
]
->
m_
PinLen
==
length
)
||
pinList
[
i
]
->
m_
length
==
length
)
continue
;
continue
;
pinList
[
i
]
->
m_
PinLen
=
length
;
pinList
[
i
]
->
m_
length
=
length
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
...
@@ -409,7 +403,7 @@ void LIB_PIN::SetPartNumber( int part )
...
@@ -409,7 +403,7 @@ void LIB_PIN::SetPartNumber( int part )
return
;
return
;
m_Unit
=
part
;
m_Unit
=
part
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
if
(
m_Unit
==
0
)
if
(
m_Unit
==
0
)
{
{
...
@@ -423,8 +417,8 @@ void LIB_PIN::SetPartNumber( int part )
...
@@ -423,8 +417,8 @@ void LIB_PIN::SetPartNumber( int part )
if
(
pin
->
m_Flags
==
0
||
pin
==
this
if
(
pin
->
m_Flags
==
0
||
pin
==
this
||
(
m_Convert
&&
(
m_Convert
!=
pin
->
m_Convert
)
)
||
(
m_Convert
&&
(
m_Convert
!=
pin
->
m_Convert
)
)
||
(
m_
Pos
!=
pin
->
m_Pos
)
||
(
m_
position
!=
pin
->
m_position
)
||
(
pin
->
m_
Orient
!=
m_Orient
)
)
||
(
pin
->
m_
orientation
!=
m_orientation
)
)
continue
;
continue
;
GetParent
()
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
pin
);
GetParent
()
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
pin
);
...
@@ -454,8 +448,8 @@ void LIB_PIN::SetConversion( int style )
...
@@ -454,8 +448,8 @@ void LIB_PIN::SetConversion( int style )
if
(
(
pin
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pin
->
m_Flags
&
IS_LINKED
)
==
0
||
(
pin
==
this
)
||
(
pin
==
this
)
||
(
m_Unit
&&
(
m_Unit
!=
pin
->
m_Unit
)
)
||
(
m_Unit
&&
(
m_Unit
!=
pin
->
m_Unit
)
)
||
(
m_
Pos
!=
pin
->
m_Pos
)
||
(
m_
position
!=
pin
->
m_position
)
||
(
pin
->
m_
Orient
!=
m_Orient
)
)
||
(
pin
->
m_
orientation
!=
m_orientation
)
)
continue
;
continue
;
GetParent
()
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
pin
);
GetParent
()
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
pin
);
...
@@ -470,11 +464,11 @@ void LIB_PIN::SetVisible( bool visible )
...
@@ -470,11 +464,11 @@ void LIB_PIN::SetVisible( bool visible )
return
;
return
;
if
(
visible
)
if
(
visible
)
m_
Attribut
s
&=
~
PINNOTDRAW
;
m_
attribute
s
&=
~
PINNOTDRAW
;
else
else
m_
Attribut
s
|=
PINNOTDRAW
;
m_
attribute
s
|=
PINNOTDRAW
;
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
if
(
GetParent
()
==
NULL
)
if
(
GetParent
()
==
NULL
)
return
;
return
;
...
@@ -484,16 +478,15 @@ void LIB_PIN::SetVisible( bool visible )
...
@@ -484,16 +478,15 @@ void LIB_PIN::SetVisible( bool visible )
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
pinList
.
size
();
i
++
)
{
{
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
if
(
(
pinList
[
i
]
->
m_Flags
&
IS_LINKED
)
==
0
||
pinList
[
i
]
->
IsVisible
()
==
visible
)
||
pinList
[
i
]
->
IsVisible
()
==
visible
)
continue
;
continue
;
if
(
visible
)
if
(
visible
)
pinList
[
i
]
->
m_
Attribut
s
&=
~
PINNOTDRAW
;
pinList
[
i
]
->
m_
attribute
s
&=
~
PINNOTDRAW
;
else
else
pinList
[
i
]
->
m_
Attribut
s
|=
PINNOTDRAW
;
pinList
[
i
]
->
m_
attribute
s
|=
PINNOTDRAW
;
pinList
[
i
]
->
m_Flags
|=
IS_CHANGED
;
SetModified
()
;
}
}
}
}
...
@@ -512,8 +505,8 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
...
@@ -512,8 +505,8 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
if
(
pinList
[
i
]
==
this
)
if
(
pinList
[
i
]
==
this
)
continue
;
continue
;
if
(
(
pinList
[
i
]
->
m_
Pos
==
m_Pos
)
if
(
(
pinList
[
i
]
->
m_
position
==
m_position
)
&&
(
pinList
[
i
]
->
m_
Orient
==
m_Orient
)
&&
(
pinList
[
i
]
->
m_
orientation
==
m_orientation
)
&&
(
!
(
m_Flags
&
IS_NEW
)
)
&&
(
!
(
m_Flags
&
IS_NEW
)
)
&&
editPinByPin
==
false
&&
editPinByPin
==
false
&&
enable
)
&&
enable
)
...
@@ -532,7 +525,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
...
@@ -532,7 +525,7 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
*/
*/
bool
LIB_PIN
::
HitTest
(
const
wxPoint
&
aRefPos
)
bool
LIB_PIN
::
HitTest
(
const
wxPoint
&
aRefPos
)
{
{
int
mindist
=
m_
Width
?
m_W
idth
/
2
:
g_DrawDefaultLineThickness
/
2
;
int
mindist
=
m_
width
?
m_w
idth
/
2
:
g_DrawDefaultLineThickness
/
2
;
// Have a minimal tolerance for hit test
// Have a minimal tolerance for hit test
if
(
mindist
<
3
)
if
(
mindist
<
3
)
...
@@ -551,7 +544,7 @@ bool LIB_PIN::HitTest( const wxPoint& aRefPos )
...
@@ -551,7 +544,7 @@ bool LIB_PIN::HitTest( const wxPoint& aRefPos )
*/
*/
bool
LIB_PIN
::
HitTest
(
wxPoint
aRefPos
,
int
aThreshold
,
const
TRANSFORM
&
aTransform
)
bool
LIB_PIN
::
HitTest
(
wxPoint
aRefPos
,
int
aThreshold
,
const
TRANSFORM
&
aTransform
)
{
{
wxPoint
pinPos
=
aTransform
.
TransformCoordinate
(
m_
Pos
);
wxPoint
pinPos
=
aTransform
.
TransformCoordinate
(
m_
position
);
wxPoint
pinEnd
=
aTransform
.
TransformCoordinate
(
ReturnPinEndPoint
()
);
wxPoint
pinEnd
=
aTransform
.
TransformCoordinate
(
ReturnPinEndPoint
()
);
return
TestSegmentHit
(
aRefPos
,
pinPos
,
pinEnd
,
aThreshold
);
return
TestSegmentHit
(
aRefPos
,
pinPos
,
pinEnd
,
aThreshold
);
...
@@ -563,7 +556,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
...
@@ -563,7 +556,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
wxString
StringPinNum
;
wxString
StringPinNum
;
int
Etype
;
int
Etype
;
switch
(
m_
PinT
ype
)
switch
(
m_
t
ype
)
{
{
default
:
default
:
case
PIN_INPUT
:
case
PIN_INPUT
:
...
@@ -616,9 +609,9 @@ bool LIB_PIN::Save( FILE* ExportFile )
...
@@ -616,9 +609,9 @@ bool LIB_PIN::Save( FILE* ExportFile )
if
(
StringPinNum
.
IsEmpty
()
)
if
(
StringPinNum
.
IsEmpty
()
)
StringPinNum
=
wxT
(
"~"
);
StringPinNum
=
wxT
(
"~"
);
if
(
!
m_
PinN
ame
.
IsEmpty
()
)
if
(
!
m_
n
ame
.
IsEmpty
()
)
{
{
if
(
fprintf
(
ExportFile
,
"X %s"
,
CONV_TO_UTF8
(
m_
PinN
ame
)
)
<
0
)
if
(
fprintf
(
ExportFile
,
"X %s"
,
CONV_TO_UTF8
(
m_
n
ame
)
)
<
0
)
return
false
;
return
false
;
}
}
else
else
...
@@ -628,35 +621,35 @@ bool LIB_PIN::Save( FILE* ExportFile )
...
@@ -628,35 +621,35 @@ bool LIB_PIN::Save( FILE* ExportFile )
}
}
if
(
fprintf
(
ExportFile
,
" %s %d %d %d %c %d %d %d %d %c"
,
if
(
fprintf
(
ExportFile
,
" %s %d %d %d %c %d %d %d %d %c"
,
CONV_TO_UTF8
(
StringPinNum
),
m_
Pos
.
x
,
m_Pos
.
y
,
CONV_TO_UTF8
(
StringPinNum
),
m_
position
.
x
,
m_position
.
y
,
(
int
)
m_
PinLen
,
(
int
)
m_Orient
,
m_PinNumSize
,
m_PinNameSize
,
(
int
)
m_
length
,
(
int
)
m_orientation
,
m_PinNumSize
,
m_PinNameSize
,
m_Unit
,
m_Convert
,
Etype
)
<
0
)
m_Unit
,
m_Convert
,
Etype
)
<
0
)
return
false
;
return
false
;
if
(
(
m_
PinShape
)
||
(
m_Attribut
s
&
PINNOTDRAW
)
)
if
(
(
m_
shape
)
||
(
m_attribute
s
&
PINNOTDRAW
)
)
{
{
if
(
fprintf
(
ExportFile
,
" "
)
<
0
)
if
(
fprintf
(
ExportFile
,
" "
)
<
0
)
return
false
;
return
false
;
}
}
if
(
m_
Attribut
s
&
PINNOTDRAW
if
(
m_
attribute
s
&
PINNOTDRAW
&&
fprintf
(
ExportFile
,
"N"
)
<
0
)
&&
fprintf
(
ExportFile
,
"N"
)
<
0
)
return
false
;
return
false
;
if
(
m_
PinS
hape
&
INVERT
if
(
m_
s
hape
&
INVERT
&&
fprintf
(
ExportFile
,
"I"
)
<
0
)
&&
fprintf
(
ExportFile
,
"I"
)
<
0
)
return
false
;
return
false
;
if
(
m_
PinS
hape
&
CLOCK
if
(
m_
s
hape
&
CLOCK
&&
fprintf
(
ExportFile
,
"C"
)
<
0
)
&&
fprintf
(
ExportFile
,
"C"
)
<
0
)
return
false
;
return
false
;
if
(
m_
PinS
hape
&
LOWLEVEL_IN
if
(
m_
s
hape
&
LOWLEVEL_IN
&&
fprintf
(
ExportFile
,
"L"
)
<
0
)
&&
fprintf
(
ExportFile
,
"L"
)
<
0
)
return
false
;
return
false
;
if
(
m_
PinS
hape
&
LOWLEVEL_OUT
if
(
m_
s
hape
&
LOWLEVEL_OUT
&&
fprintf
(
ExportFile
,
"V"
)
<
0
)
&&
fprintf
(
ExportFile
,
"V"
)
<
0
)
return
false
;
return
false
;
if
(
m_
PinS
hape
&
CLOCK_FALL
if
(
m_
s
hape
&
CLOCK_FALL
&&
fprintf
(
ExportFile
,
"F"
)
<
0
)
&&
fprintf
(
ExportFile
,
"F"
)
<
0
)
return
false
;
return
false
;
if
(
m_
PinS
hape
&
NONLOGIC
if
(
m_
s
hape
&
NONLOGIC
&&
fprintf
(
ExportFile
,
"X"
)
<
0
)
&&
fprintf
(
ExportFile
,
"X"
)
<
0
)
return
false
;
return
false
;
...
@@ -681,7 +674,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
...
@@ -681,7 +674,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
*
pinAttrs
=
0
;
*
pinAttrs
=
0
;
i
=
sscanf
(
line
+
2
,
"%s %s %d %d %d %s %d %d %d %d %s %s"
,
pinName
,
i
=
sscanf
(
line
+
2
,
"%s %s %d %d %d %s %d %d %d %d %s %s"
,
pinName
,
pinNum
,
&
m_
Pos
.
x
,
&
m_Pos
.
y
,
&
m_PinLen
,
pinOrient
,
&
m_PinNumSize
,
pinNum
,
&
m_
position
.
x
,
&
m_position
.
y
,
&
m_length
,
pinOrient
,
&
m_PinNumSize
,
&
m_PinNameSize
,
&
m_Unit
,
&
m_Convert
,
pinType
,
pinAttrs
);
&
m_PinNameSize
,
&
m_Unit
,
&
m_Convert
,
pinType
,
pinAttrs
);
if
(
i
<
11
)
if
(
i
<
11
)
...
@@ -690,54 +683,54 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
...
@@ -690,54 +683,54 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
return
false
;
return
false
;
}
}
m_
Orient
=
pinOrient
[
0
]
&
255
;
m_
orientation
=
pinOrient
[
0
]
&
255
;
strncpy
(
(
char
*
)
&
m_
PinNum
,
pinNum
,
4
);
strncpy
(
(
char
*
)
&
m_
number
,
pinNum
,
4
);
m_
PinN
ame
=
CONV_FROM_UTF8
(
pinName
);
m_
n
ame
=
CONV_FROM_UTF8
(
pinName
);
switch
(
*
pinType
&
255
)
switch
(
*
pinType
&
255
)
{
{
case
'I'
:
case
'I'
:
m_
PinT
ype
=
PIN_INPUT
;
m_
t
ype
=
PIN_INPUT
;
break
;
break
;
case
'O'
:
case
'O'
:
m_
PinT
ype
=
PIN_OUTPUT
;
m_
t
ype
=
PIN_OUTPUT
;
break
;
break
;
case
'B'
:
case
'B'
:
m_
PinT
ype
=
PIN_BIDI
;
m_
t
ype
=
PIN_BIDI
;
break
;
break
;
case
'T'
:
case
'T'
:
m_
PinT
ype
=
PIN_TRISTATE
;
m_
t
ype
=
PIN_TRISTATE
;
break
;
break
;
case
'P'
:
case
'P'
:
m_
PinT
ype
=
PIN_PASSIVE
;
m_
t
ype
=
PIN_PASSIVE
;
break
;
break
;
case
'U'
:
case
'U'
:
m_
PinT
ype
=
PIN_UNSPECIFIED
;
m_
t
ype
=
PIN_UNSPECIFIED
;
break
;
break
;
case
'W'
:
case
'W'
:
m_
PinT
ype
=
PIN_POWER_IN
;
m_
t
ype
=
PIN_POWER_IN
;
break
;
break
;
case
'w'
:
case
'w'
:
m_
PinT
ype
=
PIN_POWER_OUT
;
m_
t
ype
=
PIN_POWER_OUT
;
break
;
break
;
case
'C'
:
case
'C'
:
m_
PinT
ype
=
PIN_OPENCOLLECTOR
;
m_
t
ype
=
PIN_OPENCOLLECTOR
;
break
;
break
;
case
'E'
:
case
'E'
:
m_
PinT
ype
=
PIN_OPENEMITTER
;
m_
t
ype
=
PIN_OPENEMITTER
;
break
;
break
;
case
'N'
:
case
'N'
:
m_
PinT
ype
=
PIN_NC
;
m_
t
ype
=
PIN_NC
;
break
;
break
;
default
:
default
:
...
@@ -755,31 +748,31 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
...
@@ -755,31 +748,31 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
break
;
break
;
case
'N'
:
case
'N'
:
m_
Attribut
s
|=
PINNOTDRAW
;
m_
attribute
s
|=
PINNOTDRAW
;
break
;
break
;
case
'I'
:
case
'I'
:
m_
PinS
hape
|=
INVERT
;
m_
s
hape
|=
INVERT
;
break
;
break
;
case
'C'
:
case
'C'
:
m_
PinS
hape
|=
CLOCK
;
m_
s
hape
|=
CLOCK
;
break
;
break
;
case
'L'
:
case
'L'
:
m_
PinS
hape
|=
LOWLEVEL_IN
;
m_
s
hape
|=
LOWLEVEL_IN
;
break
;
break
;
case
'V'
:
case
'V'
:
m_
PinS
hape
|=
LOWLEVEL_OUT
;
m_
s
hape
|=
LOWLEVEL_OUT
;
break
;
break
;
case
'F'
:
case
'F'
:
m_
PinS
hape
|=
CLOCK_FALL
;
m_
s
hape
|=
CLOCK_FALL
;
break
;
break
;
case
'X'
:
case
'X'
:
m_
PinS
hape
|=
NONLOGIC
;
m_
s
hape
|=
NONLOGIC
;
break
;
break
;
default
:
default
:
...
@@ -799,7 +792,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
...
@@ -799,7 +792,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
*/
*/
int
LIB_PIN
::
GetPenSize
()
int
LIB_PIN
::
GetPenSize
()
{
{
return
(
m_
Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_W
idth
;
return
(
m_
width
==
0
)
?
g_DrawDefaultLineThickness
:
m_w
idth
;
}
}
...
@@ -815,7 +808,7 @@ void LIB_PIN::drawGraphic( WinEDA_DrawPanel* aPanel,
...
@@ -815,7 +808,7 @@ void LIB_PIN::drawGraphic( WinEDA_DrawPanel* aPanel,
// in g_InvisibleItemColor because we must see them.
// in g_InvisibleItemColor because we must see them.
WinEDA_SchematicFrame
*
frame
=
(
WinEDA_SchematicFrame
*
)
wxGetApp
().
GetTopWindow
();
WinEDA_SchematicFrame
*
frame
=
(
WinEDA_SchematicFrame
*
)
wxGetApp
().
GetTopWindow
();
if
(
(
m_Attributs
&
PINNOTDRAW
)
)
if
(
m_attributes
&
PINNOTDRAW
)
{
{
if
(
frame
->
m_LibeditFrame
&&
frame
->
m_LibeditFrame
->
IsActive
()
)
if
(
frame
->
m_LibeditFrame
&&
frame
->
m_LibeditFrame
->
IsActive
()
)
aColor
=
g_InvisibleItemColor
;
aColor
=
g_InvisibleItemColor
;
...
@@ -833,7 +826,7 @@ void LIB_PIN::drawGraphic( WinEDA_DrawPanel* aPanel,
...
@@ -833,7 +826,7 @@ void LIB_PIN::drawGraphic( WinEDA_DrawPanel* aPanel,
int
orient
=
ReturnPinDrawOrient
(
aTransform
);
int
orient
=
ReturnPinDrawOrient
(
aTransform
);
/* Calculate the pin position */
/* Calculate the pin position */
wxPoint
pos1
=
aTransform
.
TransformCoordinate
(
m_
Pos
)
+
aOffset
;
wxPoint
pos1
=
aTransform
.
TransformCoordinate
(
m_
position
)
+
aOffset
;
/* Drawing from the pin and the special symbol combination */
/* Drawing from the pin and the special symbol combination */
DrawPinSymbol
(
aPanel
,
aDC
,
pos1
,
orient
,
aDrawMode
,
aColor
);
DrawPinSymbol
(
aPanel
,
aDC
,
pos1
,
orient
,
aDrawMode
,
aColor
);
...
@@ -871,7 +864,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -871,7 +864,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
int
MapX1
,
MapY1
,
x1
,
y1
;
int
MapX1
,
MapY1
,
x1
,
y1
;
int
color
;
int
color
;
int
width
=
GetPenSize
(
);
int
width
=
GetPenSize
(
);
int
posX
=
aPinPos
.
x
,
posY
=
aPinPos
.
y
,
len
=
m_
PinLen
;
int
posX
=
aPinPos
.
x
,
posY
=
aPinPos
.
y
,
len
=
m_
length
;
BASE_SCREEN
*
screen
=
aPanel
->
GetScreen
();
BASE_SCREEN
*
screen
=
aPanel
->
GetScreen
();
color
=
ReturnLayerColor
(
LAYER_PIN
);
color
=
ReturnLayerColor
(
LAYER_PIN
);
...
@@ -913,7 +906,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -913,7 +906,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
break
;
break
;
}
}
if
(
m_
PinS
hape
&
INVERT
)
if
(
m_
s
hape
&
INVERT
)
{
{
GRCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
MapX1
*
INVERT_PIN_RADIUS
+
x1
,
GRCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
MapX1
*
INVERT_PIN_RADIUS
+
x1
,
MapY1
*
INVERT_PIN_RADIUS
+
y1
,
MapY1
*
INVERT_PIN_RADIUS
+
y1
,
...
@@ -923,7 +916,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -923,7 +916,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
MapY1
*
INVERT_PIN_RADIUS
*
2
+
y1
);
MapY1
*
INVERT_PIN_RADIUS
*
2
+
y1
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
width
,
color
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
width
,
color
);
}
}
else
if
(
m_
PinS
hape
&
CLOCK_FALL
)
/* an alternative for Inverted Clock */
else
if
(
m_
s
hape
&
CLOCK_FALL
)
/* an alternative for Inverted Clock */
{
{
GRMoveTo
(
x1
+
MapY1
*
CLOCK_PIN_DIM
,
GRMoveTo
(
x1
+
MapY1
*
CLOCK_PIN_DIM
,
y1
-
MapX1
*
CLOCK_PIN_DIM
);
y1
-
MapX1
*
CLOCK_PIN_DIM
);
...
@@ -949,7 +942,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -949,7 +942,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
width
,
color
);
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
width
,
color
);
}
}
if
(
m_
PinS
hape
&
CLOCK
)
if
(
m_
s
hape
&
CLOCK
)
{
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
{
...
@@ -985,7 +978,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -985,7 +978,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
}
}
}
}
if
(
m_
PinS
hape
&
LOWLEVEL_IN
)
/* IEEE symbol "Active Low Input" */
if
(
m_
s
hape
&
LOWLEVEL_IN
)
/* IEEE symbol "Active Low Input" */
{
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
{
...
@@ -1008,7 +1001,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -1008,7 +1001,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
}
}
if
(
m_
PinS
hape
&
LOWLEVEL_OUT
)
/* IEEE symbol "Active Low Output" */
if
(
m_
s
hape
&
LOWLEVEL_OUT
)
/* IEEE symbol "Active Low Output" */
{
{
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
if
(
MapY1
==
0
)
/* MapX1 = +- 1 */
{
{
...
@@ -1031,7 +1024,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -1031,7 +1024,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
color
);
color
);
}
}
}
}
else
if
(
m_
PinS
hape
&
NONLOGIC
)
/* NonLogic pin symbol */
else
if
(
m_
s
hape
&
NONLOGIC
)
/* NonLogic pin symbol */
{
{
GRMoveTo
(
x1
-
(
MapX1
+
MapY1
)
*
NONLOGIC_PIN_DIM
,
GRMoveTo
(
x1
-
(
MapX1
+
MapY1
)
*
NONLOGIC_PIN_DIM
,
y1
-
(
MapY1
-
MapX1
)
*
NONLOGIC_PIN_DIM
);
y1
-
(
MapY1
-
MapX1
)
*
NONLOGIC_PIN_DIM
);
...
@@ -1054,7 +1047,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -1054,7 +1047,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
/* Draw the pin end target (active end of the pin)
/* Draw the pin end target (active end of the pin)
*/
*/
#define NCSYMB_PIN_DIM TARGET_PIN_DIAM
#define NCSYMB_PIN_DIM TARGET_PIN_DIAM
if
(
m_
PinT
ype
==
PIN_NC
)
// Draw a N.C. symbol
if
(
m_
t
ype
==
PIN_NC
)
// Draw a N.C. symbol
{
{
GRLine
(
&
aPanel
->
m_ClipBox
,
aDC
,
GRLine
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
-
NCSYMB_PIN_DIM
,
posY
-
NCSYMB_PIN_DIM
,
posX
-
NCSYMB_PIN_DIM
,
posY
-
NCSYMB_PIN_DIM
,
...
@@ -1068,10 +1061,9 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
...
@@ -1068,10 +1061,9 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
/* Draw but do not print the pin end target 1 pixel width
/* Draw but do not print the pin end target 1 pixel width
*/
*/
else
if
(
!
screen
->
m_IsPrinting
)
else
if
(
!
screen
->
m_IsPrinting
)
GRCircle
(
&
aPanel
->
m_ClipBox
,
{
aDC
,
posX
,
posY
,
GRCircle
(
&
aPanel
->
m_ClipBox
,
aDC
,
posX
,
posY
,
TARGET_PIN_DIAM
,
0
,
color
);
TARGET_PIN_DIAM
,
}
0
,
color
);
}
}
...
@@ -1118,24 +1110,29 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1118,24 +1110,29 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
/* Create the pin num string */
/* Create the pin num string */
ReturnPinStringNum
(
StringPinNum
);
ReturnPinStringNum
(
StringPinNum
);
x1
=
pin_pos
.
x
;
y1
=
pin_pos
.
y
;
x1
=
pin_pos
.
x
;
y1
=
pin_pos
.
y
;
switch
(
orient
)
switch
(
orient
)
{
{
case
PIN_UP
:
case
PIN_UP
:
y1
-=
m_PinLen
;
break
;
y1
-=
m_length
;
break
;
case
PIN_DOWN
:
case
PIN_DOWN
:
y1
+=
m_PinLen
;
break
;
y1
+=
m_length
;
break
;
case
PIN_LEFT
:
case
PIN_LEFT
:
x1
-=
m_PinLen
;
break
;
x1
-=
m_length
;
break
;
case
PIN_RIGHT
:
case
PIN_RIGHT
:
x1
+=
m_PinLen
;
break
;
x1
+=
m_length
;
break
;
}
}
if
(
m_
PinN
ame
.
IsEmpty
()
)
if
(
m_
n
ame
.
IsEmpty
()
)
DrawPinName
=
FALSE
;
DrawPinName
=
FALSE
;
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
if
(
TextInside
)
/* Draw the text inside, but the pin numbers outside. */
...
@@ -1149,7 +1146,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1149,7 +1146,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
{
{
x
=
x1
+
TextInside
;
x
=
x1
+
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_HORIZ
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
PinNameSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_LEFT
,
...
@@ -1160,7 +1157,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1160,7 +1157,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
{
{
x
=
x1
-
TextInside
;
x
=
x1
-
TextInside
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_HORIZ
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_HJUSTIFY_RIGHT
,
...
@@ -1190,7 +1187,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1190,7 +1187,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
if
(
DrawPinName
)
if
(
DrawPinName
)
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_VERT
,
PinNameSize
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
nameLineWidth
,
GR_TEXT_VJUSTIFY_CENTER
,
nameLineWidth
,
...
@@ -1211,7 +1208,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1211,7 +1208,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
if
(
DrawPinName
)
if
(
DrawPinName
)
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_VERT
,
PinNameSize
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
nameLineWidth
,
GR_TEXT_VJUSTIFY_CENTER
,
nameLineWidth
,
...
@@ -1237,7 +1234,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1237,7 +1234,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
{
{
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
-
TXTMARGE
),
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x
,
y1
-
TXTMARGE
),
NameColor
,
m_
PinN
ame
,
NameColor
,
m_
n
ame
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
nameLineWidth
,
GR_TEXT_VJUSTIFY_BOTTOM
,
nameLineWidth
,
...
@@ -1260,7 +1257,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
...
@@ -1260,7 +1257,7 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
{
{
y
=
(
y1
+
pin_pos
.
y
)
/
2
;
y
=
(
y1
+
pin_pos
.
y
)
/
2
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
-
TXTMARGE
,
y
),
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
-
TXTMARGE
,
y
),
NameColor
,
m_
PinN
ame
,
NameColor
,
m_
n
ame
,
TEXT_ORIENT_VERT
,
PinNameSize
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
nameLineWidth
,
GR_TEXT_VJUSTIFY_BOTTOM
,
nameLineWidth
,
...
@@ -1317,23 +1314,23 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1317,23 +1314,23 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
switch
(
orient
)
switch
(
orient
)
{
{
case
PIN_UP
:
case
PIN_UP
:
y1
-=
m_
PinLen
;
y1
-=
m_
length
;
break
;
break
;
case
PIN_DOWN
:
case
PIN_DOWN
:
y1
+=
m_
PinLen
;
y1
+=
m_
length
;
break
;
break
;
case
PIN_LEFT
:
case
PIN_LEFT
:
x1
-=
m_
PinLen
;
x1
-=
m_
length
;
break
;
break
;
case
PIN_RIGHT
:
case
PIN_RIGHT
:
x1
+=
m_
PinLen
;
x1
+=
m_
length
;
break
;
break
;
}
}
if
(
m_
PinN
ame
.
IsEmpty
()
)
if
(
m_
n
ame
.
IsEmpty
()
)
DrawPinName
=
FALSE
;
DrawPinName
=
FALSE
;
/* Draw the text inside, but the pin numbers outside. */
/* Draw the text inside, but the pin numbers outside. */
...
@@ -1347,7 +1344,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1347,7 +1344,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
{
{
x
=
x1
+
TextInside
;
x
=
x1
+
TextInside
;
plotter
->
text
(
wxPoint
(
x
,
y1
),
NameColor
,
plotter
->
text
(
wxPoint
(
x
,
y1
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_HORIZ
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
PinNameSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_LEFT
,
...
@@ -1360,7 +1357,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1360,7 +1357,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
if
(
DrawPinName
)
if
(
DrawPinName
)
plotter
->
text
(
wxPoint
(
x
,
y1
),
plotter
->
text
(
wxPoint
(
x
,
y1
),
NameColor
,
m_
PinN
ame
,
TEXT_ORIENT_HORIZ
,
NameColor
,
m_
n
ame
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1386,7 +1383,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1386,7 +1383,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
if
(
DrawPinName
)
if
(
DrawPinName
)
plotter
->
text
(
wxPoint
(
x1
,
y
),
NameColor
,
plotter
->
text
(
wxPoint
(
x1
,
y
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_VERT
,
PinNameSize
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1407,7 +1404,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1407,7 +1404,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
if
(
DrawPinName
)
if
(
DrawPinName
)
plotter
->
text
(
wxPoint
(
x1
,
y
),
NameColor
,
plotter
->
text
(
wxPoint
(
x1
,
y
),
NameColor
,
m_
PinN
ame
,
m_
n
ame
,
TEXT_ORIENT_VERT
,
PinNameSize
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_CENTER
,
...
@@ -1433,7 +1430,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1433,7 +1430,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
{
{
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
x
=
(
x1
+
pin_pos
.
x
)
/
2
;
plotter
->
text
(
wxPoint
(
x
,
y1
-
TXTMARGE
),
plotter
->
text
(
wxPoint
(
x
,
y1
-
TXTMARGE
),
NameColor
,
m_
PinN
ame
,
NameColor
,
m_
n
ame
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
TEXT_ORIENT_HORIZ
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_BOTTOM
,
...
@@ -1456,7 +1453,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1456,7 +1453,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
{
{
y
=
(
y1
+
pin_pos
.
y
)
/
2
;
y
=
(
y1
+
pin_pos
.
y
)
/
2
;
plotter
->
text
(
wxPoint
(
x1
-
TXTMARGE
,
y
),
plotter
->
text
(
wxPoint
(
x1
-
TXTMARGE
,
y
),
NameColor
,
m_
PinN
ame
,
NameColor
,
m_
n
ame
,
TEXT_ORIENT_VERT
,
PinNameSize
,
TEXT_ORIENT_VERT
,
PinNameSize
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_BOTTOM
,
...
@@ -1480,24 +1477,24 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
...
@@ -1480,24 +1477,24 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
/* return the pin end position, for a component in normal orient */
/* return the pin end position, for a component in normal orient */
wxPoint
LIB_PIN
::
ReturnPinEndPoint
()
const
wxPoint
LIB_PIN
::
ReturnPinEndPoint
()
const
{
{
wxPoint
pos
=
m_
Pos
;
wxPoint
pos
=
m_
position
;
switch
(
m_
Orient
)
switch
(
m_
orientation
)
{
{
case
PIN_UP
:
case
PIN_UP
:
pos
.
y
+=
m_
PinLen
;
pos
.
y
+=
m_
length
;
break
;
break
;
case
PIN_DOWN
:
case
PIN_DOWN
:
pos
.
y
-=
m_
PinLen
;
pos
.
y
-=
m_
length
;
break
;
break
;
case
PIN_LEFT
:
case
PIN_LEFT
:
pos
.
x
-=
m_
PinLen
;
pos
.
x
-=
m_
length
;
break
;
break
;
case
PIN_RIGHT
:
case
PIN_RIGHT
:
pos
.
x
+=
m_
PinLen
;
pos
.
x
+=
m_
length
;
break
;
break
;
}
}
...
@@ -1514,9 +1511,9 @@ wxPoint LIB_PIN::ReturnPinEndPoint() const
...
@@ -1514,9 +1511,9 @@ wxPoint LIB_PIN::ReturnPinEndPoint() const
int
LIB_PIN
::
ReturnPinDrawOrient
(
const
TRANSFORM
&
aTransform
)
int
LIB_PIN
::
ReturnPinDrawOrient
(
const
TRANSFORM
&
aTransform
)
{
{
int
orient
;
int
orient
;
wxPoint
end
;
// position of a end pin starting at 0,0 according to its orientation, lenght
= 1
wxPoint
end
;
// position of pin end starting at 0,0 according to its orientation, length
= 1
switch
(
m_
Orient
)
switch
(
m_
orientation
)
{
{
case
PIN_UP
:
case
PIN_UP
:
end
.
y
=
1
;
end
.
y
=
1
;
...
@@ -1565,7 +1562,7 @@ int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform )
...
@@ -1565,7 +1562,7 @@ int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform )
*/
*/
void
LIB_PIN
::
ReturnPinStringNum
(
wxString
&
aStringBuffer
)
const
void
LIB_PIN
::
ReturnPinStringNum
(
wxString
&
aStringBuffer
)
const
{
{
aStringBuffer
=
ReturnPinStringNum
(
m_
PinNum
);
aStringBuffer
=
ReturnPinStringNum
(
m_
number
);
}
}
...
@@ -1610,7 +1607,7 @@ void LIB_PIN::SetPinNumFromString( wxString& buffer )
...
@@ -1610,7 +1607,7 @@ void LIB_PIN::SetPinNumFromString( wxString& buffer )
ascii_buf
[
ii
]
&=
0xFF
;
ascii_buf
[
ii
]
&=
0xFF
;
}
}
strncpy
(
(
char
*
)
&
m_
PinNum
,
ascii_buf
,
4
);
strncpy
(
(
char
*
)
&
m_
number
,
ascii_buf
,
4
);
}
}
...
@@ -1618,13 +1615,13 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
...
@@ -1618,13 +1615,13 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
{
{
LIB_PIN
*
newpin
=
new
LIB_PIN
(
GetParent
()
);
LIB_PIN
*
newpin
=
new
LIB_PIN
(
GetParent
()
);
newpin
->
m_
Pos
=
m_Pos
;
newpin
->
m_
position
=
m_position
;
newpin
->
m_
PinLen
=
m_PinLen
;
newpin
->
m_
length
=
m_length
;
newpin
->
m_
Orient
=
m_Orient
;
newpin
->
m_
orientation
=
m_orientation
;
newpin
->
m_
PinShape
=
m_PinS
hape
;
newpin
->
m_
shape
=
m_s
hape
;
newpin
->
m_
PinType
=
m_PinT
ype
;
newpin
->
m_
type
=
m_t
ype
;
newpin
->
m_
Attributs
=
m_Attribut
s
;
newpin
->
m_
attributes
=
m_attribute
s
;
newpin
->
m_
PinNum
=
m_PinNum
;
newpin
->
m_
number
=
m_number
;
newpin
->
m_PinNumSize
=
m_PinNumSize
;
newpin
->
m_PinNumSize
=
m_PinNumSize
;
newpin
->
m_PinNameSize
=
m_PinNameSize
;
newpin
->
m_PinNameSize
=
m_PinNameSize
;
newpin
->
m_PinNumShapeOpt
=
m_PinNumShapeOpt
;
newpin
->
m_PinNumShapeOpt
=
m_PinNumShapeOpt
;
...
@@ -1634,8 +1631,8 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
...
@@ -1634,8 +1631,8 @@ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
newpin
->
m_Unit
=
m_Unit
;
newpin
->
m_Unit
=
m_Unit
;
newpin
->
m_Convert
=
m_Convert
;
newpin
->
m_Convert
=
m_Convert
;
newpin
->
m_Flags
=
m_Flags
;
newpin
->
m_Flags
=
m_Flags
;
newpin
->
m_
Width
=
m_W
idth
;
newpin
->
m_
width
=
m_w
idth
;
newpin
->
m_
PinName
=
m_PinN
ame
;
newpin
->
m_
name
=
m_n
ame
;
return
(
LIB_DRAW_ITEM
*
)
newpin
;
return
(
LIB_DRAW_ITEM
*
)
newpin
;
}
}
...
@@ -1647,19 +1644,19 @@ int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
...
@@ -1647,19 +1644,19 @@ int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
const
LIB_PIN
*
tmp
=
(
LIB_PIN
*
)
&
other
;
const
LIB_PIN
*
tmp
=
(
LIB_PIN
*
)
&
other
;
if
(
m_
PinNum
!=
tmp
->
m_PinNum
)
if
(
m_
number
!=
tmp
->
m_number
)
return
m_
PinNum
-
tmp
->
m_PinNum
;
return
m_
number
-
tmp
->
m_number
;
int
result
=
m_
PinName
.
CmpNoCase
(
tmp
->
m_PinN
ame
);
int
result
=
m_
name
.
CmpNoCase
(
tmp
->
m_n
ame
);
if
(
result
!=
0
)
if
(
result
!=
0
)
return
result
;
return
result
;
if
(
m_
Pos
.
x
!=
tmp
->
m_Pos
.
x
)
if
(
m_
position
.
x
!=
tmp
->
m_position
.
x
)
return
m_
Pos
.
x
-
tmp
->
m_Pos
.
x
;
return
m_
position
.
x
-
tmp
->
m_position
.
x
;
if
(
m_
Pos
.
y
!=
tmp
->
m_Pos
.
y
)
if
(
m_
position
.
y
!=
tmp
->
m_position
.
y
)
return
m_
Pos
.
y
-
tmp
->
m_Pos
.
y
;
return
m_
position
.
y
-
tmp
->
m_position
.
y
;
return
0
;
return
0
;
}
}
...
@@ -1667,7 +1664,7 @@ int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
...
@@ -1667,7 +1664,7 @@ int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
void
LIB_PIN
::
DoOffset
(
const
wxPoint
&
offset
)
void
LIB_PIN
::
DoOffset
(
const
wxPoint
&
offset
)
{
{
m_
Pos
+=
offset
;
m_
position
+=
offset
;
}
}
...
@@ -1675,47 +1672,61 @@ bool LIB_PIN::DoTestInside( EDA_Rect& rect ) const
...
@@ -1675,47 +1672,61 @@ bool LIB_PIN::DoTestInside( EDA_Rect& rect ) const
{
{
wxPoint
end
=
ReturnPinEndPoint
();
wxPoint
end
=
ReturnPinEndPoint
();
return
rect
.
Inside
(
m_
Pos
.
x
,
-
m_Pos
.
y
)
||
rect
.
Inside
(
end
.
x
,
-
end
.
y
);
return
rect
.
Inside
(
m_
position
.
x
,
-
m_position
.
y
)
||
rect
.
Inside
(
end
.
x
,
-
end
.
y
);
}
}
void
LIB_PIN
::
DoMove
(
const
wxPoint
&
newPosition
)
void
LIB_PIN
::
DoMove
(
const
wxPoint
&
newPosition
)
{
{
m_Pos
=
newPosition
;
if
(
m_position
!=
newPosition
)
{
m_position
=
newPosition
;
SetModified
();
}
}
}
void
LIB_PIN
::
DoMirrorHorizontal
(
const
wxPoint
&
center
)
void
LIB_PIN
::
DoMirrorHorizontal
(
const
wxPoint
&
center
)
{
{
m_
Pos
.
x
-=
center
.
x
;
m_
position
.
x
-=
center
.
x
;
m_
Pos
.
x
*=
-
1
;
m_
position
.
x
*=
-
1
;
m_
Pos
.
x
+=
center
.
x
;
m_
position
.
x
+=
center
.
x
;
if
(
m_
Orient
==
PIN_RIGHT
)
if
(
m_
orientation
==
PIN_RIGHT
)
m_
Orient
=
PIN_LEFT
;
m_
orientation
=
PIN_LEFT
;
else
if
(
m_
Orient
==
PIN_LEFT
)
else
if
(
m_
orientation
==
PIN_LEFT
)
m_
Orient
=
PIN_RIGHT
;
m_
orientation
=
PIN_RIGHT
;
}
}
void
LIB_PIN
::
DoPlot
(
PLOTTER
*
plotter
,
const
wxPoint
&
offset
,
bool
fill
,
void
LIB_PIN
::
DoPlot
(
PLOTTER
*
plotter
,
const
wxPoint
&
offset
,
bool
fill
,
const
TRANSFORM
&
aTransform
)
const
TRANSFORM
&
aTransform
)
{
{
if
(
m_
Attribut
s
&
PINNOTDRAW
)
if
(
m_
attribute
s
&
PINNOTDRAW
)
return
;
return
;
int
orient
=
ReturnPinDrawOrient
(
aTransform
);
int
orient
=
ReturnPinDrawOrient
(
aTransform
);
wxPoint
pos
=
aTransform
.
TransformCoordinate
(
m_
Pos
)
+
offset
;
wxPoint
pos
=
aTransform
.
TransformCoordinate
(
m_
position
)
+
offset
;
plotter
->
set_current_line_width
(
GetPenSize
()
);
plotter
->
set_current_line_width
(
GetPenSize
()
);
PlotPinSymbol
(
plotter
,
pos
,
m_
PinLen
,
orient
,
m_PinS
hape
);
PlotPinSymbol
(
plotter
,
pos
,
m_
length
,
orient
,
m_s
hape
);
PlotPinTexts
(
plotter
,
pos
,
orient
,
GetParent
()
->
GetPinNameOffset
(),
PlotPinTexts
(
plotter
,
pos
,
orient
,
GetParent
()
->
GetPinNameOffset
(),
GetParent
()
->
ShowPinNumbers
(),
GetParent
()
->
ShowPinNames
(),
GetParent
()
->
ShowPinNumbers
(),
GetParent
()
->
ShowPinNames
(),
GetPenSize
()
);
GetPenSize
()
);
}
}
void
LIB_PIN
::
DoSetWidth
(
int
aWidth
)
{
if
(
m_width
!=
aWidth
)
{
m_width
=
aWidth
;
SetModified
();
}
}
/**
/**
* Function DisplayInfo
* Function DisplayInfo
* Displays info (pin num and name, orientation ...
* Displays info (pin num and name, orientation ...
...
@@ -1727,9 +1738,9 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -1727,9 +1738,9 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
LIB_DRAW_ITEM
::
DisplayInfo
(
frame
);
LIB_DRAW_ITEM
::
DisplayInfo
(
frame
);
frame
->
AppendMsgPanel
(
_
(
"Name"
),
m_
PinN
ame
,
DARKCYAN
);
frame
->
AppendMsgPanel
(
_
(
"Name"
),
m_
n
ame
,
DARKCYAN
);
if
(
m_
PinNum
==
0
)
if
(
m_
number
==
0
)
Text
=
wxT
(
"?"
);
Text
=
wxT
(
"?"
);
else
else
ReturnPinStringNum
(
Text
);
ReturnPinStringNum
(
Text
);
...
@@ -1737,9 +1748,9 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -1737,9 +1748,9 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
frame
->
AppendMsgPanel
(
_
(
"Number"
),
Text
,
DARKCYAN
);
frame
->
AppendMsgPanel
(
_
(
"Number"
),
Text
,
DARKCYAN
);
frame
->
AppendMsgPanel
(
_
(
"Type"
),
frame
->
AppendMsgPanel
(
_
(
"Type"
),
wxGetTranslation
(
pin_electrical_type_names
[
m_
PinT
ype
]
),
wxGetTranslation
(
pin_electrical_type_names
[
m_
t
ype
]
),
RED
);
RED
);
Text
=
wxGetTranslation
(
pin_style_names
[
GetStyleCodeIndex
(
m_
PinS
hape
)
]);
Text
=
wxGetTranslation
(
pin_style_names
[
GetStyleCodeIndex
(
m_
s
hape
)
]);
frame
->
AppendMsgPanel
(
_
(
"Style"
),
Text
,
BLUE
);
frame
->
AppendMsgPanel
(
_
(
"Style"
),
Text
,
BLUE
);
if
(
IsVisible
()
)
if
(
IsVisible
()
)
Text
=
_
(
"Yes"
);
Text
=
_
(
"Yes"
);
...
@@ -1748,10 +1759,10 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -1748,10 +1759,10 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
frame
->
AppendMsgPanel
(
_
(
"Visible"
),
Text
,
DARKGREEN
);
frame
->
AppendMsgPanel
(
_
(
"Visible"
),
Text
,
DARKGREEN
);
/* Display pin length */
/* Display pin length */
Text
=
ReturnStringFromValue
(
g_UserUnit
,
m_
PinLen
,
EESCHEMA_INTERNAL_UNIT
,
true
);
Text
=
ReturnStringFromValue
(
g_UserUnit
,
m_
length
,
EESCHEMA_INTERNAL_UNIT
,
true
);
frame
->
AppendMsgPanel
(
_
(
"Length"
),
Text
,
MAGENTA
);
frame
->
AppendMsgPanel
(
_
(
"Length"
),
Text
,
MAGENTA
);
Text
=
wxGetTranslation
(
pin_orientation_names
[
GetOrientationCodeIndex
(
m_
Orient
)
]);
Text
=
wxGetTranslation
(
pin_orientation_names
[
GetOrientationCodeIndex
(
m_
orientation
)
]);
frame
->
AppendMsgPanel
(
_
(
"Orientation"
),
Text
,
DARKMAGENTA
);
frame
->
AppendMsgPanel
(
_
(
"Orientation"
),
Text
,
DARKMAGENTA
);
}
}
...
@@ -1762,7 +1773,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
...
@@ -1762,7 +1773,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
*/
*/
EDA_Rect
LIB_PIN
::
GetBoundingBox
()
EDA_Rect
LIB_PIN
::
GetBoundingBox
()
{
{
wxPoint
pt
=
m_
Pos
;
wxPoint
pt
=
m_
position
;
pt
.
y
*=
-
1
;
// Reverse the Y axis, according to the schematic orientation
pt
.
y
*=
-
1
;
// Reverse the Y axis, according to the schematic orientation
...
@@ -1888,7 +1899,7 @@ const char*** LIB_PIN::GetStyleSymbols()
...
@@ -1888,7 +1899,7 @@ const char*** LIB_PIN::GetStyleSymbols()
void
LIB_PIN
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
void
LIB_PIN
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
{
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
" num=
\"
"
<<
GetNumber
().
mb_str
()
<<
" num=
\"
"
<<
GetNumber
String
().
mb_str
()
<<
'"'
<<
"/>
\n
"
;
<<
'"'
<<
"/>
\n
"
;
...
...
eeschema/lib_pin.h
View file @
3fed7b9d
...
@@ -80,6 +80,18 @@ enum DrawPinOrient {
...
@@ -80,6 +80,18 @@ enum DrawPinOrient {
class
LIB_PIN
:
public
LIB_DRAW_ITEM
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.
* Draw the pin.
*/
*/
...
@@ -87,15 +99,6 @@ class LIB_PIN : public LIB_DRAW_ITEM
...
@@ -87,15 +99,6 @@ class LIB_PIN : public LIB_DRAW_ITEM
int
aColor
,
int
aDrawMode
,
void
*
aData
,
const
TRANSFORM
&
aTransform
);
int
aColor
,
int
aDrawMode
,
void
*
aData
,
const
TRANSFORM
&
aTransform
);
public
:
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_PinNumSize
;
int
m_PinNameSize
;
/* Pin num and Pin name sizes */
int
m_PinNameSize
;
/* Pin num and Pin name sizes */
...
@@ -107,10 +110,6 @@ public:
...
@@ -107,10 +110,6 @@ public:
char
m_PinNumPositionOpt
;
char
m_PinNumPositionOpt
;
char
m_PinNamePositionOpt
;
char
m_PinNamePositionOpt
;
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start
* point (segments) */
int
m_Width
;
/* Line width */
public
:
public
:
LIB_PIN
(
LIB_COMPONENT
*
aParent
);
LIB_PIN
(
LIB_COMPONENT
*
aParent
);
LIB_PIN
(
const
LIB_PIN
&
aPin
);
LIB_PIN
(
const
LIB_PIN
&
aPin
);
...
@@ -165,17 +164,13 @@ public:
...
@@ -165,17 +164,13 @@ public:
* Pin numbers are coded as a long or 4 ASCII characters. Used to print
* Pin numbers are coded as a long or 4 ASCII characters. Used to print
* or draw the pin number.
* or draw the pin number.
*
*
* @param aStringBuffer - the wxString to store the pin num as an unicode
* @param aStringBuffer - the wxString to store the pin num as an unicode string
* string
*/
*/
void
ReturnPinStringNum
(
wxString
&
aStringBuffer
)
const
;
void
ReturnPinStringNum
(
wxString
&
aStringBuffer
)
const
;
long
GetNumber
()
const
{
return
m_number
;
}
wxString
GetNumber
()
wxString
GetNumberString
()
const
{
return
ReturnPinStringNum
(
m_number
);
}
{
return
ReturnPinStringNum
(
m_PinNum
);
}
/**
/**
* Function ReturnPinStringNum (static function)
* Function ReturnPinStringNum (static function)
...
@@ -188,6 +183,8 @@ public:
...
@@ -188,6 +183,8 @@ public:
void
SetPinNumFromString
(
wxString
&
aBuffer
);
void
SetPinNumFromString
(
wxString
&
aBuffer
);
wxString
GetName
()
const
{
return
m_name
;
}
/**
/**
* Set the pin name.
* Set the pin name.
*
*
...
@@ -227,25 +224,29 @@ public:
...
@@ -227,25 +224,29 @@ public:
*/
*/
void
SetNumberTextSize
(
int
aSize
);
void
SetNumberTextSize
(
int
aSize
);
int
GetOrientation
()
const
{
return
m_orientation
;
}
/**
/**
* Set orientation on the pin.
* Set orientation on the pin.
*
*
* This will also update the orientation of the pins marked by
* This will also update the orientation of the pins marked by EnableEditMode().
* EnableEditMode().
*
*
* @param aOrientation - The orientation of the pin.
* @param aOrientation - The orientation of the pin.
*/
*/
void
SetOrientation
(
int
aOrientation
);
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
* This will also update the draw style of the pins marked by EnableEditMode().
* 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.
* Set the electrical type of the pin.
...
@@ -255,7 +256,7 @@ public:
...
@@ -255,7 +256,7 @@ public:
*
*
* @param aType - The electrical type of the pin.
* @param aType - The electrical type of the pin.
*/
*/
void
Set
Electrical
Type
(
int
aType
);
void
SetType
(
int
aType
);
/**
/**
* Set the pin length.
* Set the pin length.
...
@@ -266,6 +267,8 @@ public:
...
@@ -266,6 +267,8 @@ public:
*/
*/
void
SetLength
(
int
aLength
);
void
SetLength
(
int
aLength
);
int
GetLength
()
{
return
m_length
;
}
/**
/**
* Set the pin part number.
* Set the pin part number.
*
*
...
@@ -320,7 +323,7 @@ public:
...
@@ -320,7 +323,7 @@ public:
*
*
* @return True if draw object is visible otherwise false.
* @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.
* @return the size of the "pen" that be used to draw or plot this item.
...
@@ -436,12 +439,12 @@ protected:
...
@@ -436,12 +439,12 @@ protected:
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
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
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
const
{
return
m_
W
idth
;
}
virtual
int
DoGetWidth
()
const
{
return
m_
w
idth
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
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 )
...
@@ -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
// 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.
// on the current component. Set the dialog message to inform the user.
if
(
aField
->
m_FieldId
==
VALUE
)
if
(
aField
->
GetId
()
==
VALUE
)
{
{
caption
=
_
(
"Component Name"
);
caption
=
_
(
"Component Name"
);
title
=
_
(
"Enter a name to create a new component based on this one."
);
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 )
...
@@ -51,7 +51,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
text
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
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
()
)
);
title
.
Printf
(
_
(
"A %s field cannot be empty."
),
GetChars
(
aField
->
GetName
().
Lower
()
)
);
DisplayError
(
this
,
title
);
DisplayError
(
this
,
title
);
...
@@ -64,7 +64,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
...
@@ -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
* the old one. Rename the component and remove any conflicting aliases to prevent name
* errors when updating the library.
* errors when updating the library.
*/
*/
if
(
aField
->
m_FieldId
==
VALUE
)
if
(
aField
->
GetId
()
==
VALUE
)
{
{
wxString
msg
;
wxString
msg
;
...
...
eeschema/netform.cpp
View file @
3fed7b9d
...
@@ -445,7 +445,7 @@ static bool sortPinsByNum( NETLIST_OBJECT* aPin1, NETLIST_OBJECT* aPin2 )
...
@@ -445,7 +445,7 @@ static bool sortPinsByNum( NETLIST_OBJECT* aPin1, NETLIST_OBJECT* aPin2 )
static
bool
sortPinsByNumber
(
LIB_PIN
*
aPin1
,
LIB_PIN
*
aPin2
)
static
bool
sortPinsByNumber
(
LIB_PIN
*
aPin1
,
LIB_PIN
*
aPin2
)
{
{
// return "lhs < rhs"
// 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()
...
@@ -758,7 +758,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
{
{
XNODE
*
xfield
;
XNODE
*
xfield
;
xfields
->
AddChild
(
xfield
=
node
(
sField
,
fieldList
[
i
].
m_Text
)
);
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()
...
@@ -778,7 +778,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
XNODE
*
pin
;
XNODE
*
pin
;
pins
->
AddChild
(
pin
=
node
(
sPin
)
);
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
// caution: construction work site here, drive slowly
}
}
...
@@ -1489,7 +1489,7 @@ bool EXPORT_HELP::addPinToComponentPinList( SCH_COMPONENT* aComponent,
...
@@ -1489,7 +1489,7 @@ bool EXPORT_HELP::addPinToComponentPinList( SCH_COMPONENT* aComponent,
if
(
pin
->
m_Link
!=
aComponent
)
if
(
pin
->
m_Link
!=
aComponent
)
continue
;
continue
;
if
(
pin
->
m_PinNum
!=
aPin
->
m_PinNum
)
if
(
pin
->
m_PinNum
!=
aPin
->
GetNumber
()
)
continue
;
continue
;
// most expensive test at the end.
// most expensive test at the end.
...
...
eeschema/netlist.cpp
View file @
3fed7b9d
...
@@ -641,7 +641,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
...
@@ -641,7 +641,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
if
(
pin
->
GetConvert
()
&&
(
pin
->
GetConvert
()
!=
DrawLibItem
->
m_Convert
)
)
if
(
pin
->
GetConvert
()
&&
(
pin
->
GetConvert
()
!=
DrawLibItem
->
m_Convert
)
)
continue
;
continue
;
wxPoint
pos2
=
DrawLibItem
->
m_Transform
.
TransformCoordinate
(
pin
->
m_Pos
)
+
wxPoint
pos2
=
DrawLibItem
->
m_Transform
.
TransformCoordinate
(
pin
->
GetPosition
()
)
+
DrawLibItem
->
m_Pos
;
DrawLibItem
->
m_Pos
;
new_item
=
new
NETLIST_OBJECT
();
new_item
=
new
NETLIST_OBJECT
();
...
@@ -650,15 +650,14 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
...
@@ -650,15 +650,14 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item
->
m_SheetList
=
*
sheetlist
;
new_item
->
m_SheetList
=
*
sheetlist
;
new_item
->
m_Type
=
NET_PIN
;
new_item
->
m_Type
=
NET_PIN
;
new_item
->
m_Link
=
DrawLibItem
;
new_item
->
m_Link
=
DrawLibItem
;
new_item
->
m_ElectricalType
=
pin
->
m_PinType
;
new_item
->
m_ElectricalType
=
pin
->
GetType
()
;
new_item
->
m_PinNum
=
pin
->
m_PinNum
;
new_item
->
m_PinNum
=
pin
->
GetNumber
()
;
new_item
->
m_Label
=
pin
->
m_PinName
;
new_item
->
m_Label
=
pin
->
GetName
()
;
new_item
->
m_Start
=
new_item
->
m_End
=
pos2
;
new_item
->
m_Start
=
new_item
->
m_End
=
pos2
;
aNetItemBuffer
.
push_back
(
new_item
);
aNetItemBuffer
.
push_back
(
new_item
);
if
(
(
(
int
)
pin
->
m_PinType
==
(
int
)
PIN_POWER_IN
)
if
(
(
(
int
)
pin
->
GetType
()
==
(
int
)
PIN_POWER_IN
)
&&
!
pin
->
IsVisible
()
)
&&
(
pin
->
m_Attributs
&
PINNOTDRAW
)
)
{
{
/* There is an associated PIN_LABEL. */
/* There is an associated PIN_LABEL. */
new_item
=
new
NETLIST_OBJECT
();
new_item
=
new
NETLIST_OBJECT
();
...
@@ -666,7 +665,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
...
@@ -666,7 +665,7 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
new_item
->
m_Comp
=
NULL
;
new_item
->
m_Comp
=
NULL
;
new_item
->
m_SheetList
=
*
sheetlist
;
new_item
->
m_SheetList
=
*
sheetlist
;
new_item
->
m_Type
=
NET_PINLABEL
;
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_Start
=
pos2
;
new_item
->
m_End
=
new_item
->
m_Start
;
new_item
->
m_End
=
new_item
->
m_Start
;
...
...
eeschema/pinedit.cpp
View file @
3fed7b9d
...
@@ -51,12 +51,13 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event )
...
@@ -51,12 +51,13 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event )
LIB_PIN
*
pin
=
(
LIB_PIN
*
)
m_drawItem
;
LIB_PIN
*
pin
=
(
LIB_PIN
*
)
m_drawItem
;
// Save old pin orientation
// Save old pin orientation
LastPinOrient
=
pin
->
m_Orient
;
LastPinOrient
=
pin
->
GetOrientation
();
if
(
!
pin
->
InEditMode
()
)
if
(
!
pin
->
InEditMode
()
)
SaveCopyInUndoList
(
pin
->
GetParent
()
);
SaveCopyInUndoList
(
pin
->
GetParent
()
);
// Get the actual pin orientation index
// Get the actual pin orientation index
int
orientationIndex
=
pin
->
GetOrientationCodeIndex
(
pin
->
m_Orient
);
int
orientationIndex
=
pin
->
GetOrientationCodeIndex
(
pin
->
GetOrientation
()
);
// Compute the next orientation, swap lower two bits for the right order
// Compute the next orientation, swap lower two bits for the right order
orientationIndex
=
((
orientationIndex
&
2
)
>>
1
)
|
((
orientationIndex
&
1
)
<<
1
);
orientationIndex
=
((
orientationIndex
&
2
)
>>
1
)
|
((
orientationIndex
&
1
)
<<
1
);
...
@@ -64,7 +65,7 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event )
...
@@ -64,7 +65,7 @@ void LIB_EDIT_FRAME::OnRotatePin( wxCommandEvent& event )
orientationIndex
=
((
orientationIndex
&
2
)
>>
1
)
|
((
orientationIndex
&
1
)
<<
1
);
orientationIndex
=
((
orientationIndex
&
2
)
>>
1
)
|
((
orientationIndex
&
1
)
<<
1
);
// Set the new orientation
// Set the new orientation
pin
->
SetOrientation
(
pin
->
GetOrientationCode
(
orientationIndex
)
);
pin
->
SetOrientation
(
pin
->
GetOrientationCode
(
orientationIndex
)
);
OnModify
(
);
OnModify
(
);
pin
->
DisplayInfo
(
this
);
pin
->
DisplayInfo
(
this
);
...
@@ -86,23 +87,23 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
...
@@ -86,23 +87,23 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
wxString
units
=
GetUnitsLabel
(
g_UserUnit
);
wxString
units
=
GetUnitsLabel
(
g_UserUnit
);
dlg
.
SetOrientationList
(
LIB_PIN
::
GetOrientationNames
(),
LIB_PIN
::
GetOrientationSymbols
()
);
dlg
.
SetOrientationList
(
LIB_PIN
::
GetOrientationNames
(),
LIB_PIN
::
GetOrientationSymbols
()
);
dlg
.
SetOrientation
(
LIB_PIN
::
GetOrientationCodeIndex
(
pin
->
m_Orient
)
);
dlg
.
SetOrientation
(
LIB_PIN
::
GetOrientationCodeIndex
(
pin
->
GetOrientation
()
)
);
dlg
.
SetStyleList
(
LIB_PIN
::
GetStyleNames
(),
LIB_PIN
::
GetStyleSymbols
()
);
dlg
.
SetStyleList
(
LIB_PIN
::
GetStyleNames
(),
LIB_PIN
::
GetStyleSymbols
()
);
dlg
.
SetStyle
(
LIB_PIN
::
GetStyleCodeIndex
(
pin
->
m_PinShape
)
);
dlg
.
SetStyle
(
LIB_PIN
::
GetStyleCodeIndex
(
pin
->
GetShape
()
)
);
dlg
.
SetElectricalTypeList
(
LIB_PIN
::
GetElectricalTypeNames
(),
dlg
.
SetElectricalTypeList
(
LIB_PIN
::
GetElectricalTypeNames
(),
LIB_PIN
::
GetElectricalTypeSymbols
()
);
LIB_PIN
::
GetElectricalTypeSymbols
()
);
dlg
.
SetElectricalType
(
pin
->
m_PinType
);
dlg
.
SetElectricalType
(
pin
->
GetType
()
);
dlg
.
SetName
(
pin
->
m_PinName
);
dlg
.
SetName
(
pin
->
GetName
()
);
dlg
.
SetNameTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
dlg
.
SetNameTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
pin
->
m_PinNameSize
,
pin
->
m_PinNameSize
,
m_InternalUnits
)
);
m_InternalUnits
)
);
dlg
.
SetNameTextSizeUnits
(
units
);
dlg
.
SetNameTextSizeUnits
(
units
);
dlg
.
SetNumber
(
pin
->
GetNumber
()
);
dlg
.
SetNumber
(
pin
->
GetNumber
String
()
);
dlg
.
SetNumberTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
dlg
.
SetNumberTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
pin
->
m_PinNumSize
,
pin
->
m_PinNumSize
,
m_InternalUnits
)
);
m_InternalUnits
)
);
dlg
.
SetNumberTextSizeUnits
(
units
);
dlg
.
SetNumberTextSizeUnits
(
units
);
dlg
.
SetLength
(
ReturnStringFromValue
(
g_UserUnit
,
pin
->
m_PinLen
,
m_InternalUnits
)
);
dlg
.
SetLength
(
ReturnStringFromValue
(
g_UserUnit
,
pin
->
GetLength
()
,
m_InternalUnits
)
);
dlg
.
SetLengthUnits
(
units
);
dlg
.
SetLengthUnits
(
units
);
dlg
.
SetAddToAllParts
(
pin
->
GetUnit
()
==
0
);
dlg
.
SetAddToAllParts
(
pin
->
GetUnit
()
==
0
);
dlg
.
SetAddToAllBodyStyles
(
pin
->
GetConvert
()
==
0
);
dlg
.
SetAddToAllBodyStyles
(
pin
->
GetConvert
()
==
0
);
...
@@ -150,8 +151,8 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
...
@@ -150,8 +151,8 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
pin
->
SetNumberTextSize
(
LastPinNumSize
);
pin
->
SetNumberTextSize
(
LastPinNumSize
);
pin
->
SetOrientation
(
LastPinOrient
);
pin
->
SetOrientation
(
LastPinOrient
);
pin
->
SetLength
(
LastPinLength
);
pin
->
SetLength
(
LastPinLength
);
pin
->
Set
Electrical
Type
(
LastPinType
);
pin
->
SetType
(
LastPinType
);
pin
->
Set
DrawStyl
e
(
LastPinShape
);
pin
->
Set
Shap
e
(
LastPinShape
);
pin
->
SetConversion
(
(
LastPinCommonConvert
)
?
0
:
m_convert
);
pin
->
SetConversion
(
(
LastPinCommonConvert
)
?
0
:
m_convert
);
pin
->
SetPartNumber
(
(
LastPinCommonUnit
)
?
0
:
m_unit
);
pin
->
SetPartNumber
(
(
LastPinCommonUnit
)
?
0
:
m_unit
);
pin
->
SetVisible
(
LastPinVisible
);
pin
->
SetVisible
(
LastPinVisible
);
...
@@ -224,10 +225,9 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
...
@@ -224,10 +225,9 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
newpos
.
y
=
-
GetScreen
()
->
m_Curseur
.
y
;
newpos
.
y
=
-
GetScreen
()
->
m_Curseur
.
y
;
// Tst for an other pin in same new position:
// Tst for an other pin in same new position:
for
(
Pin
=
m_component
->
GetNextPin
();
Pin
!=
NULL
;
for
(
Pin
=
m_component
->
GetNextPin
();
Pin
!=
NULL
;
Pin
=
m_component
->
GetNextPin
(
Pin
)
)
Pin
=
m_component
->
GetNextPin
(
Pin
)
)
{
{
if
(
Pin
==
CurrentPin
||
newpos
!=
Pin
->
m_Pos
||
Pin
->
m_Flags
)
if
(
Pin
==
CurrentPin
||
newpos
!=
Pin
->
GetPosition
()
||
Pin
->
m_Flags
)
continue
;
continue
;
if
(
ask_for_pin
&&
!
g_EditPinByPinIsOn
)
if
(
ask_for_pin
&&
!
g_EditPinByPinIsOn
)
...
@@ -238,6 +238,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
...
@@ -238,6 +238,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
another pin. Continue?"
)
);
another pin. Continue?"
)
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
if
(
!
status
)
if
(
!
status
)
return
;
return
;
else
else
...
@@ -254,16 +255,18 @@ another pin. Continue?" ) );
...
@@ -254,16 +255,18 @@ another pin. Continue?" ) );
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
OnModify
(
);
OnModify
();
CurrentPin
->
m_Pos
=
newpos
;
CurrentPin
->
SetPosition
(
newpos
)
;
if
(
CurrentPin
->
IsNew
()
)
if
(
CurrentPin
->
IsNew
()
)
{
{
LastPinOrient
=
CurrentPin
->
m_Orient
;
LastPinOrient
=
CurrentPin
->
GetOrientation
();
LastPinType
=
CurrentPin
->
m_PinType
;
LastPinType
=
CurrentPin
->
GetType
();
LastPinShape
=
CurrentPin
->
m_PinShape
;
LastPinShape
=
CurrentPin
->
GetShape
();
if
(
!
g_EditPinByPinIsOn
)
if
(
!
g_EditPinByPinIsOn
)
CreateImagePins
(
CurrentPin
,
m_unit
,
m_convert
,
m_showDeMorgan
);
CreateImagePins
(
CurrentPin
,
m_unit
,
m_convert
,
m_showDeMorgan
);
m_lastDrawItem
=
CurrentPin
;
m_lastDrawItem
=
CurrentPin
;
m_component
->
AddDrawItem
(
m_drawItem
);
m_component
->
AddDrawItem
(
m_drawItem
);
}
}
...
@@ -273,7 +276,8 @@ another pin. Continue?" ) );
...
@@ -273,7 +276,8 @@ another pin. Continue?" ) );
{
{
if
(
Pin
->
m_Flags
==
0
)
if
(
Pin
->
m_Flags
==
0
)
continue
;
continue
;
Pin
->
m_Pos
=
CurrentPin
->
m_Pos
;
Pin
->
SetPosition
(
CurrentPin
->
GetPosition
()
);
Pin
->
m_Flags
=
0
;
Pin
->
m_Flags
=
0
;
}
}
...
@@ -308,14 +312,14 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
...
@@ -308,14 +312,14 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
Pin
->
m_Flags
=
0
;
Pin
->
m_Flags
=
0
;
if
(
Pin
==
CurrentPin
)
if
(
Pin
==
CurrentPin
)
continue
;
continue
;
if
(
(
Pin
->
m_Pos
==
CurrentPin
->
m_Pos
)
if
(
(
Pin
->
GetPosition
()
==
CurrentPin
->
GetPosition
()
)
&&
(
Pin
->
m_Orient
==
CurrentPin
->
m_Orient
)
&&
(
Pin
->
GetOrientation
()
==
CurrentPin
->
GetOrientation
()
)
&&
(
g_EditPinByPinIsOn
==
false
)
)
&&
(
g_EditPinByPinIsOn
==
false
)
)
Pin
->
m_Flags
|=
IS_LINKED
|
IS_MOVED
;
Pin
->
m_Flags
|=
IS_LINKED
|
IS_MOVED
;
}
}
CurrentPin
->
m_Flags
|=
IS_LINKED
|
IS_MOVED
;
CurrentPin
->
m_Flags
|=
IS_LINKED
|
IS_MOVED
;
PinPreviousPos
=
OldPos
=
CurrentPin
->
m_Pos
;
PinPreviousPos
=
OldPos
=
CurrentPin
->
GetPosition
()
;
startPos
.
x
=
OldPos
.
x
;
startPos
.
x
=
OldPos
.
x
;
startPos
.
y
=
-
OldPos
.
y
;
startPos
.
y
=
-
OldPos
.
y
;
...
@@ -345,28 +349,27 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -345,28 +349,27 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if
(
CurrentPin
==
NULL
||
CurrentPin
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
if
(
CurrentPin
==
NULL
||
CurrentPin
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
return
;
return
;
wxPoint
pinpos
=
CurrentPin
->
m_Pos
;
wxPoint
pinpos
=
CurrentPin
->
GetPosition
()
;
bool
showPinText
=
true
;
bool
showPinText
=
true
;
/* Erase pin in old position */
/* Erase pin in old position */
if
(
erase
)
if
(
erase
)
{
{
CurrentPin
->
m_Pos
=
PinPreviousPos
;
CurrentPin
->
SetPosition
(
PinPreviousPos
)
;
CurrentPin
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
g_XorMode
,
CurrentPin
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
g_XorMode
,
&
showPinText
,
DefaultTransform
);
&
showPinText
,
DefaultTransform
);
}
}
/* Redraw pin in new position */
/* Redraw pin in new position */
CurrentPin
->
m_Pos
.
x
=
panel
->
GetScreen
()
->
m_Curseur
.
x
;
CurrentPin
->
SetPosition
(
panel
->
GetScreen
()
->
GetCursorDrawPosition
()
);
CurrentPin
->
m_Pos
.
y
=
-
panel
->
GetScreen
()
->
m_Curseur
.
y
;
CurrentPin
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
g_XorMode
,
&
showPinText
,
DefaultTransform
);
CurrentPin
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
g_XorMode
,
&
showPinText
,
DefaultTransform
);
PinPreviousPos
=
CurrentPin
->
m_Pos
;
PinPreviousPos
=
CurrentPin
->
GetPosition
()
;
/* Keep the original position for existing pin (for Undo command)
/* Keep the original position for existing pin (for Undo command)
* and the current position for a new pin */
* and the current position for a new pin */
if
(
!
CurrentPin
->
IsNew
()
)
if
(
!
CurrentPin
->
IsNew
()
)
CurrentPin
->
m_Pos
=
pinpos
;
CurrentPin
->
SetPosition
(
pinpos
)
;
}
}
...
@@ -384,7 +387,7 @@ void LIB_EDIT_FRAME::DeletePin( wxDC* DC, LIB_COMPONENT* LibEntry, LIB_PIN* Pin
...
@@ -384,7 +387,7 @@ void LIB_EDIT_FRAME::DeletePin( wxDC* DC, LIB_COMPONENT* LibEntry, LIB_PIN* Pin
if
(
LibEntry
==
NULL
||
Pin
==
NULL
)
if
(
LibEntry
==
NULL
||
Pin
==
NULL
)
return
;
return
;
PinPos
=
Pin
->
m_Pos
;
PinPos
=
Pin
->
GetPosition
()
;
LibEntry
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
Pin
,
DrawPanel
,
DC
);
LibEntry
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
Pin
,
DrawPanel
,
DC
);
if
(
g_EditPinByPinIsOn
==
false
)
if
(
g_EditPinByPinIsOn
==
false
)
...
@@ -396,7 +399,7 @@ void LIB_EDIT_FRAME::DeletePin( wxDC* DC, LIB_COMPONENT* LibEntry, LIB_PIN* Pin
...
@@ -396,7 +399,7 @@ void LIB_EDIT_FRAME::DeletePin( wxDC* DC, LIB_COMPONENT* LibEntry, LIB_PIN* Pin
Pin
=
tmp
;
Pin
=
tmp
;
tmp
=
LibEntry
->
GetNextPin
(
Pin
);
tmp
=
LibEntry
->
GetNextPin
(
Pin
);
if
(
Pin
->
m_Pos
!=
PinPos
)
if
(
Pin
->
GetPosition
()
!=
PinPos
)
continue
;
continue
;
LibEntry
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
Pin
);
LibEntry
->
RemoveDrawItem
(
(
LIB_DRAW_ITEM
*
)
Pin
);
...
@@ -432,30 +435,18 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
...
@@ -432,30 +435,18 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
if
(
g_EditPinByPinIsOn
==
false
)
if
(
g_EditPinByPinIsOn
==
false
)
pin
->
m_Flags
|=
IS_LINKED
;
pin
->
m_Flags
|=
IS_LINKED
;
pin
->
m_Pos
=
GetScreen
()
->
GetCursorDrawPosition
(
);
pin
->
SetPosition
(
GetScreen
()
->
GetCursorDrawPosition
()
);
pin
->
m_PinLen
=
LastPinLength
;
pin
->
SetLength
(
LastPinLength
)
;
pin
->
m_Orient
=
LastPinOrient
;
pin
->
SetOrientation
(
LastPinOrient
)
;
pin
->
m_PinType
=
LastPinType
;
pin
->
SetType
(
LastPinType
)
;
pin
->
m_PinShape
=
LastPinShape
;
pin
->
SetShape
(
LastPinShape
)
;
pin
->
m_PinNameSize
=
LastPinNameSize
;
pin
->
m_PinNameSize
=
LastPinNameSize
;
pin
->
m_PinNumSize
=
LastPinNumSize
;
pin
->
m_PinNumSize
=
LastPinNumSize
;
pin
->
SetConvert
(
LastPinCommonConvert
?
0
:
m_convert
);
pin
->
SetUnit
(
LastPinCommonUnit
?
0
:
m_unit
);
pin
->
SetVisible
(
LastPinVisible
);
if
(
LastPinCommonConvert
)
PinPreviousPos
=
pin
->
GetPosition
();
pin
->
SetConvert
(
0
);
else
pin
->
SetConvert
(
m_convert
);
if
(
LastPinCommonUnit
)
pin
->
SetUnit
(
0
);
else
pin
->
SetUnit
(
m_unit
);
if
(
LastPinVisible
)
pin
->
m_Attributs
&=
~
PINNOTDRAW
;
else
pin
->
m_Attributs
|=
PINNOTDRAW
;
PinPreviousPos
=
pin
->
m_Pos
;
DrawPanel
->
m_IgnoreMouseEvents
=
true
;
DrawPanel
->
m_IgnoreMouseEvents
=
true
;
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
cmd
.
SetId
(
ID_LIBEDIT_EDIT_PIN
);
cmd
.
SetId
(
ID_LIBEDIT_EDIT_PIN
);
...
@@ -463,7 +454,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
...
@@ -463,7 +454,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
if
(
pin
->
m_Flags
&
IS_CANCELLED
)
if
(
pin
->
m_Flags
&
IS_CANCELLED
)
{
{
DeletePin
(
NULL
,
m_component
,
pin
);
DeletePin
(
NULL
,
m_component
,
pin
);
m_drawItem
=
NULL
;
m_drawItem
=
NULL
;
...
@@ -473,6 +464,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
...
@@ -473,6 +464,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
ClearTempCopyComponent
();
ClearTempCopyComponent
();
DrawPanel
->
ManageCurseur
=
DrawMovePin
;
DrawPanel
->
ManageCurseur
=
DrawMovePin
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortPinMove
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortPinMove
;
if
(
DC
)
if
(
DC
)
pin
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
wxCOPY
,
&
showPinText
,
pin
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
wxCOPY
,
&
showPinText
,
DefaultTransform
);
DefaultTransform
);
...
@@ -498,10 +490,12 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
...
@@ -498,10 +490,12 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
if
(
CreateConv
==
true
)
if
(
CreateConv
==
true
)
{
{
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
if
(
Pin
->
GetConvert
()
>
1
)
if
(
Pin
->
GetConvert
()
>
1
)
NewPin
->
SetConvert
(
1
);
NewPin
->
SetConvert
(
1
);
else
else
NewPin
->
SetConvert
(
2
);
NewPin
->
SetConvert
(
2
);
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
}
}
...
@@ -511,8 +505,10 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
...
@@ -511,8 +505,10 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
continue
;
/* Pin common to all units. */
continue
;
/* Pin common to all units. */
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
if
(
convert
!=
0
)
if
(
convert
!=
0
)
NewPin
->
SetConvert
(
1
);
NewPin
->
SetConvert
(
1
);
NewPin
->
SetUnit
(
ii
);
NewPin
->
SetUnit
(
ii
);
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
...
@@ -521,8 +517,10 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
...
@@ -521,8 +517,10 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
NewPin
->
SetConvert
(
2
);
NewPin
->
SetConvert
(
2
);
if
(
Pin
->
GetUnit
()
!=
0
)
if
(
Pin
->
GetUnit
()
!=
0
)
NewPin
->
SetUnit
(
ii
);
NewPin
->
SetUnit
(
ii
);
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
}
}
}
}
...
@@ -544,12 +542,14 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
...
@@ -544,12 +542,14 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
if
(
(
m_component
==
NULL
)
||
(
MasterPin
==
NULL
)
)
if
(
(
m_component
==
NULL
)
||
(
MasterPin
==
NULL
)
)
return
;
return
;
if
(
MasterPin
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
if
(
MasterPin
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
return
;
return
;
OnModify
(
);
OnModify
(
);
Pin
=
m_component
->
GetNextPin
();
Pin
=
m_component
->
GetNextPin
();
for
(
;
Pin
!=
NULL
;
Pin
=
m_component
->
GetNextPin
(
Pin
)
)
for
(
;
Pin
!=
NULL
;
Pin
=
m_component
->
GetNextPin
(
Pin
)
)
{
{
if
(
(
Pin
->
GetConvert
()
)
&&
(
Pin
->
GetConvert
()
!=
m_convert
)
)
if
(
(
Pin
->
GetConvert
()
)
&&
(
Pin
->
GetConvert
()
!=
m_convert
)
)
...
@@ -572,7 +572,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
...
@@ -572,7 +572,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
break
;
break
;
case
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM
:
case
ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM
:
Pin
->
m_PinLen
=
MasterPin
->
m_PinLen
;
Pin
->
SetLength
(
MasterPin
->
GetLength
()
)
;
break
;
break
;
}
}
...
@@ -588,15 +588,15 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
...
@@ -588,15 +588,15 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
LIB_PIN
*
Pin
;
LIB_PIN
*
Pin
;
wxString
msg
;
wxString
msg
;
if
(
m_component
==
NULL
||
SourcePin
==
NULL
if
(
m_component
==
NULL
||
SourcePin
==
NULL
||
SourcePin
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
||
SourcePin
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
return
;
return
;
Pin
=
(
LIB_PIN
*
)
SourcePin
->
GenCopy
();
Pin
=
(
LIB_PIN
*
)
SourcePin
->
GenCopy
();
Pin
->
m_Flags
=
IS_NEW
;
Pin
->
m_Flags
=
IS_NEW
;
Pin
->
m_Pos
.
x
+=
g_RepeatStep
.
x
;
Pin
->
SetPosition
(
Pin
->
GetPosition
()
+
wxPoint
(
g_RepeatStep
.
x
,
-
g_RepeatStep
.
y
)
);
Pin
->
m_Pos
.
y
+=
-
g_RepeatStep
.
y
;
wxString
nextName
=
Pin
->
GetName
();
IncrementLabelMember
(
Pin
->
m_PinName
);
IncrementLabelMember
(
nextName
);
Pin
->
SetName
(
nextName
);
Pin
->
ReturnPinStringNum
(
msg
);
Pin
->
ReturnPinStringNum
(
msg
);
IncrementLabelMember
(
msg
);
IncrementLabelMember
(
msg
);
...
@@ -609,8 +609,8 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
...
@@ -609,8 +609,8 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
wxPoint
savepos
=
GetScreen
()
->
m_Curseur
;
wxPoint
savepos
=
GetScreen
()
->
m_Curseur
;
DrawPanel
->
CursorOff
(
DC
);
DrawPanel
->
CursorOff
(
DC
);
GetScreen
()
->
m_Curseur
.
x
=
Pin
->
m_Pos
.
x
;
GetScreen
()
->
m_Curseur
.
x
=
Pin
->
GetPosition
()
.
x
;
GetScreen
()
->
m_Curseur
.
y
=
-
Pin
->
m_Pos
.
y
;
GetScreen
()
->
m_Curseur
.
y
=
-
Pin
->
GetPosition
()
.
y
;
// Add this new pin in list, and creates pins for others parts if needed
// Add this new pin in list, and creates pins for others parts if needed
m_drawItem
=
Pin
;
m_drawItem
=
Pin
;
...
@@ -629,16 +629,18 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
...
@@ -629,16 +629,18 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
/* helper function to sort pins by pin num */
/* helper function to sort pins by pin num */
bool
sort_by_pin_number
(
const
LIB_PIN
*
ref
,
const
LIB_PIN
*
tst
)
bool
sort_by_pin_number
(
const
LIB_PIN
*
ref
,
const
LIB_PIN
*
tst
)
{
{
int
test
=
ref
->
m_PinNum
-
tst
->
m_PinNum
;
int
test
=
ref
->
GetNumber
()
-
tst
->
GetNumber
()
;
if
(
test
==
0
)
if
(
test
==
0
)
{
{
test
=
ref
->
GetConvert
()
-
tst
->
GetConvert
();
test
=
ref
->
GetConvert
()
-
tst
->
GetConvert
();
}
}
if
(
test
==
0
)
if
(
test
==
0
)
{
{
test
=
ref
->
GetUnit
()
-
tst
->
GetUnit
();
test
=
ref
->
GetUnit
()
-
tst
->
GetUnit
();
}
}
return
test
<
0
;
return
test
<
0
;
}
}
...
@@ -686,7 +688,7 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
...
@@ -686,7 +688,7 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
LIB_PIN
*
curr_pin
=
PinList
[
ii
];
LIB_PIN
*
curr_pin
=
PinList
[
ii
];
Pin
=
PinList
[
ii
-
1
];
Pin
=
PinList
[
ii
-
1
];
if
(
Pin
->
m_PinNum
!=
curr_pin
->
m_PinNum
if
(
Pin
->
GetNumber
()
!=
curr_pin
->
GetNumber
()
||
Pin
->
GetConvert
()
!=
curr_pin
->
GetConvert
()
||
Pin
->
GetConvert
()
!=
curr_pin
->
GetConvert
()
||
Pin
->
GetUnit
()
!=
curr_pin
->
GetUnit
()
)
||
Pin
->
GetUnit
()
!=
curr_pin
->
GetUnit
()
)
continue
;
continue
;
...
@@ -697,13 +699,13 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
...
@@ -697,13 +699,13 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
msg
.
Printf
(
_
(
"<b>Duplicate pin %s</b>
\"
%s
\"
at location <b>(%.3f, \
msg
.
Printf
(
_
(
"<b>Duplicate pin %s</b>
\"
%s
\"
at location <b>(%.3f, \
%.3f)</b> conflicts with pin %s
\"
%s
\"
at location <b>(%.3f, %.3f)</b>"
),
%.3f)</b> conflicts with pin %s
\"
%s
\"
at location <b>(%.3f, %.3f)</b>"
),
GetChars
(
stringCurrPinNum
),
GetChars
(
stringCurrPinNum
),
GetChars
(
curr_pin
->
m_PinName
),
GetChars
(
curr_pin
->
GetName
()
),
(
float
)
curr_pin
->
m_Pos
.
x
/
1000.0
,
(
float
)
curr_pin
->
GetPosition
()
.
x
/
1000.0
,
(
float
)
-
curr_pin
->
m_Pos
.
y
/
1000.0
,
(
float
)
-
curr_pin
->
GetPosition
()
.
y
/
1000.0
,
GetChars
(
stringPinNum
),
GetChars
(
stringPinNum
),
GetChars
(
Pin
->
m_PinName
),
GetChars
(
Pin
->
GetName
()
),
(
float
)
Pin
->
m_Pos
.
x
/
1000.0
,
(
float
)
Pin
->
GetPosition
()
.
x
/
1000.0
,
(
float
)
-
Pin
->
m_Pos
.
y
/
1000.0
);
(
float
)
-
Pin
->
GetPosition
()
.
y
/
1000.0
);
if
(
m_component
->
GetPartCount
()
>
1
)
if
(
m_component
->
GetPartCount
()
>
1
)
{
{
...
@@ -725,24 +727,24 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
...
@@ -725,24 +727,24 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
// Test for off grid pins:
// Test for off grid pins:
offgrid_error
=
0
;
offgrid_error
=
0
;
for
(
unsigned
ii
=
0
;
ii
<
PinList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
PinList
.
size
();
ii
++
)
{
{
Pin
=
PinList
[
ii
];
Pin
=
PinList
[
ii
];
if
(
(
(
Pin
->
m_Pos
.
x
%
MIN_GRID_SIZE
)
==
0
)
&&
if
(
(
(
Pin
->
GetPosition
()
.
x
%
MIN_GRID_SIZE
)
==
0
)
&&
(
(
Pin
->
m_Pos
.
y
%
MIN_GRID_SIZE
)
==
0
)
)
(
(
Pin
->
GetPosition
()
.
y
%
MIN_GRID_SIZE
)
==
0
)
)
continue
;
continue
;
// A pin is foun here off grid
// A pin is foun here off grid
offgrid_error
++
;
offgrid_error
++
;
wxString
stringPinNum
;
wxString
stringPinNum
;
Pin
->
ReturnPinStringNum
(
stringPinNum
);
Pin
->
ReturnPinStringNum
(
stringPinNum
);
msg
.
Printf
(
_
(
"<b>Off grid pin %s</b>
\"
%s
\"
at location <b>(%.3f, \
msg
.
Printf
(
_
(
"<b>Off grid pin %s</b>
\"
%s
\"
at location <b>(%.3f, %.3f)</b>"
),
%.3f)</b>"
),
GetChars
(
stringPinNum
),
GetChars
(
stringPinNum
),
GetChars
(
Pin
->
m_PinName
),
GetChars
(
Pin
->
GetName
()
),
(
float
)
Pin
->
m_Pos
.
x
/
1000.0
,
(
float
)
Pin
->
GetPosition
()
.
x
/
1000.0
,
(
float
)
-
Pin
->
m_Pos
.
y
/
1000.0
);
(
float
)
-
Pin
->
GetPosition
()
.
y
/
1000.0
);
if
(
m_component
->
GetPartCount
()
>
1
)
if
(
m_component
->
GetPartCount
()
>
1
)
{
{
...
@@ -763,9 +765,7 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
...
@@ -763,9 +765,7 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
}
}
if
(
!
dup_error
&&
!
offgrid_error
)
if
(
!
dup_error
&&
!
offgrid_error
)
DisplayInfoMessage
(
this
,
DisplayInfoMessage
(
this
,
_
(
"No off grid or duplicate pins were found."
)
);
_
(
"No off grid or duplicate pins were found."
)
);
else
else
error_display
.
ShowModal
();
error_display
.
ShowModal
();
}
}
eeschema/sch_component.cpp
View file @
3fed7b9d
...
@@ -94,15 +94,15 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
...
@@ -94,15 +94,15 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
{
{
// Can no longer insert an empty name, since names are now keys. The
// Can no longer insert an empty name, since names are now keys. The
// field index is not used beyond the first MANDATORY_FIELDS
// field index is not used beyond the first MANDATORY_FIELDS
if
(
it
->
m_Name
.
IsEmpty
()
)
if
(
it
->
GetName
()
.
IsEmpty
()
)
continue
;
continue
;
// See if field by same name already exists.
// See if field by same name already exists.
SCH_FIELD
*
schField
=
FindField
(
it
->
m_Name
);
SCH_FIELD
*
schField
=
FindField
(
it
->
GetName
()
);
if
(
!
schField
)
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
);
schField
=
AddField
(
fld
);
}
}
...
@@ -1586,21 +1586,24 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxP
...
@@ -1586,21 +1586,24 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxP
{
{
LIB_PIN_LIST
pinList
;
LIB_PIN_LIST
pinList
;
Entry
->
GetPins
(
pinList
,
m_Multi
,
m_Convert
);
Entry
->
GetPins
(
pinList
,
m_Multi
,
m_Convert
);
// Search for a match in pinList
// Search for a match in pinList
for
(
unsigned
ii
=
0
;
ii
<
pinList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
pinList
.
size
();
ii
++
)
{
{
LIB_PIN
*
pin
=
pinList
[
ii
];
LIB_PIN
*
pin
=
pinList
[
ii
];
wxString
pinNum
;
wxString
pinNum
;
pin
->
ReturnPinStringNum
(
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
)
if
(
aFindLocation
)
{
{
wxPoint
pinpos
=
pin
->
m_Pos
;
wxPoint
pinpos
=
pin
->
GetPosition
()
;
pinpos
=
m_Transform
.
TransformCoordinate
(
pinpos
);
pinpos
=
m_Transform
.
TransformCoordinate
(
pinpos
);
*
aFindLocation
=
pinpos
+
m_Pos
;
*
aFindLocation
=
pinpos
+
m_Pos
;
}
}
return
true
;
return
true
;
}
}
...
@@ -1640,7 +1643,7 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( LIB_PIN* Pin )
...
@@ -1640,7 +1643,7 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( LIB_PIN* Pin )
wxCHECK_MSG
(
Pin
!=
NULL
&&
Pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
,
wxPoint
(
0
,
0
),
wxCHECK_MSG
(
Pin
!=
NULL
&&
Pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
,
wxPoint
(
0
,
0
),
wxT
(
"Cannot get physical position of pin."
)
);
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
...
@@ -1680,6 +1683,6 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
continue
;
continue
;
// Calculate the pin position relative to the component position and orientation.
// 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:
...
@@ -359,6 +359,8 @@ public:
inline
bool
IsDragging
()
const
{
return
m_Flags
&
IS_DRAGGED
;
}
inline
bool
IsDragging
()
const
{
return
m_Flags
&
IS_DRAGGED
;
}
inline
bool
IsSelected
()
const
{
return
m_Flags
&
SELECTED
;
}
inline
bool
IsSelected
()
const
{
return
m_Flags
&
SELECTED
;
}
void
SetModified
();
int
GetState
(
int
type
)
const
int
GetState
(
int
type
)
const
{
{
return
m_Status
&
type
;
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