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
6566b0c5
Commit
6566b0c5
authored
Oct 25, 2010
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Schematic component library object improvements and other minor fixes.
parent
9afa8926
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
441 additions
and
551 deletions
+441
-551
CHANGELOG.txt
CHANGELOG.txt
+15
-0
block.cpp
eeschema/block.cpp
+2
-2
class_libentry.cpp
eeschema/class_libentry.cpp
+71
-99
class_libentry.h
eeschema/class_libentry.h
+46
-87
class_library.cpp
eeschema/class_library.cpp
+24
-33
class_library.h
eeschema/class_library.h
+9
-10
class_sch_component.cpp
eeschema/class_sch_component.cpp
+8
-10
dangling_ends.cpp
eeschema/dangling_ends.cpp
+3
-4
database.cpp
eeschema/database.cpp
+1
-1
dialog_edit_component_in_lib.cpp
eeschema/dialog_edit_component_in_lib.cpp
+1
-1
dialog_schematic_find.cpp
eeschema/dialog_schematic_find.cpp
+1
-1
edit_component_in_lib.cpp
eeschema/edit_component_in_lib.cpp
+20
-19
edit_graphic_bodyitem_text.cpp
eeschema/edit_graphic_bodyitem_text.cpp
+6
-6
lib_arc.cpp
eeschema/lib_arc.cpp
+5
-5
lib_arc.h
eeschema/lib_arc.h
+10
-12
lib_bezier.cpp
eeschema/lib_bezier.cpp
+1
-1
lib_bezier.h
eeschema/lib_bezier.h
+7
-8
lib_circle.cpp
eeschema/lib_circle.cpp
+2
-2
lib_circle.h
eeschema/lib_circle.h
+8
-10
lib_draw_item.cpp
eeschema/lib_draw_item.cpp
+1
-1
lib_draw_item.h
eeschema/lib_draw_item.h
+28
-42
lib_export.cpp
eeschema/lib_export.cpp
+5
-6
lib_field.cpp
eeschema/lib_field.cpp
+1
-1
lib_field.h
eeschema/lib_field.h
+3
-3
lib_pin.cpp
eeschema/lib_pin.cpp
+2
-2
lib_pin.h
eeschema/lib_pin.h
+4
-4
lib_polyline.cpp
eeschema/lib_polyline.cpp
+2
-3
lib_polyline.h
eeschema/lib_polyline.h
+9
-9
lib_rectangle.cpp
eeschema/lib_rectangle.cpp
+1
-1
lib_rectangle.h
eeschema/lib_rectangle.h
+14
-13
lib_text.cpp
eeschema/lib_text.cpp
+1
-1
lib_text.h
eeschema/lib_text.h
+3
-3
libedit.cpp
eeschema/libedit.cpp
+19
-28
libedit_onleftclick.cpp
eeschema/libedit_onleftclick.cpp
+3
-1
libeditframe.h
eeschema/libeditframe.h
+4
-5
netform.cpp
eeschema/netform.cpp
+6
-6
netlist.cpp
eeschema/netlist.cpp
+3
-4
onrightclick.cpp
eeschema/onrightclick.cpp
+2
-7
pinedit.cpp
eeschema/pinedit.cpp
+28
-28
schedit.cpp
eeschema/schedit.cpp
+2
-2
symbdraw.cpp
eeschema/symbdraw.cpp
+12
-12
symbedit.cpp
eeschema/symbedit.cpp
+6
-6
tool_viewlib.cpp
eeschema/tool_viewlib.cpp
+5
-6
viewlibs.cpp
eeschema/viewlibs.cpp
+12
-18
base_struct.h
include/base_struct.h
+25
-27
wxEeschemaStruct.h
include/wxEeschemaStruct.h
+0
-1
No files found.
CHANGELOG.txt
View file @
6566b0c5
...
...
@@ -4,6 +4,21 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-oct-25 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Remove common library component and alias base class CMP_LIB_ENTRY.
* Derive LIB_COMPONENT and LIB_ALIAS directly from EDA_BaseStruct.
* Encapsulate most library draw item object members.
* Make most library draw item get methods constant.
* Merge two edit component properties methods into a single method.
* Update double click left mouse button to use merged edit component
properties method.
* Set schematic find dialog find button as default button.
++include
* Add in-line flag state helpers to EDA_BaseStruct.
2010-oct-22 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
Component library editor bug fixes and other minor fixes.
...
...
eeschema/block.cpp
View file @
6566b0c5
...
...
@@ -932,9 +932,9 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
wxASSERT
(
Pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
);
/* Skip items not used for this part */
if
(
Multi
&&
Pin
->
m_Unit
&&
(
Pin
->
m_Unit
!=
Multi
)
)
if
(
Multi
&&
Pin
->
GetUnit
()
&&
(
Pin
->
GetUnit
()
!=
Multi
)
)
continue
;
if
(
convert
&&
Pin
->
m_Convert
&&
(
Pin
->
m_Convert
!=
convert
)
)
if
(
convert
&&
Pin
->
GetConvert
()
&&
(
Pin
->
GetConvert
()
!=
convert
)
)
continue
;
/* Calculate the pin position (according to the component orientation)
...
...
eeschema/class_libentry.cpp
View file @
6566b0c5
...
...
@@ -34,68 +34,62 @@
#define TRACE_DESTRUCTOR 0
/** class CMP_LIB_ENTRY
* Base class to describe library components and aliases.
* This class is not to be used directly.
* There are 2 derived classes
* class LIB_COMPONENT that describes a component in library
* class LIB_ALIAS that describes an alias of an existing component
* a LIB_COMPONENT object handle all info to draw a component
* (pins, graphic body items, fields, name, keywords and documentation)
* a LIB_ALIAS object use info of its LIB_COMPONENT parent
* and has just a name, keywords and documentation
/*******************************/
/* class LIB_ALIAS */
/*******************************/
/* Class to define an alias of a component
* An alias uses the component definition (graphic, pins...)
* but has its own name, keywords and documentation.
* Therefore, when the component is modified, alias of this component are
* modified.
* This is a simple method to create components with differs very few
* (like 74LS00, 74HC00 ... and many op amps )
*/
CMP_LIB_ENTRY
::
CMP_LIB_ENTRY
(
LibrEntryType
aType
,
const
wxString
&
aName
,
CMP_LIBRARY
*
aLibrary
)
:
EDA_BaseStruct
(
LIBCOMPONENT_STRUCT_TYPE
)
LIB_ALIAS
::
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
aRootComponent
)
:
EDA_BaseStruct
(
LIB_ALIAS_T
)
{
type
=
aType
;
root
=
aRootComponent
;
name
=
aName
;
library
=
aLibrary
;
}
CMP_LIB_ENTRY
::
CMP_LIB_ENTRY
(
CMP_LIB_ENTRY
&
aEntry
,
CMP_LIBRARY
*
aLibrary
)
:
EDA_BaseStruct
(
a
Entry
)
LIB_ALIAS
::
LIB_ALIAS
(
const
LIB_ALIAS
&
aAlias
,
LIB_COMPONENT
*
aRootComponent
)
:
EDA_BaseStruct
(
a
Alias
)
{
type
=
aEntry
.
type
;
name
=
aEntry
.
name
;
description
=
aEntry
.
description
;
keyWords
=
aEntry
.
keyWords
;
docFileName
=
aEntry
.
docFileName
;
library
=
aLibrary
;
name
=
aAlias
.
name
;
root
=
aRootComponent
;
description
=
aAlias
.
description
;
keyWords
=
aAlias
.
keyWords
;
docFileName
=
aAlias
.
docFileName
;
}
CMP_LIB_ENTRY
::~
CMP_LIB_ENTRY
()
LIB_ALIAS
::~
LIB_ALIAS
()
{
#if TRACE_DESTRUCTOR
wxLogDebug
(
wxT
(
"Destroying alias
\"
%s
\"
of component
\"
%s
\"
with alais list count %d."
),
GetChars
(
name
),
GetChars
(
root
->
GetName
()
),
root
->
m_aliases
.
size
()
);
#endif
}
wxString
CMP_LIB_ENTRY
::
GetLibraryName
()
wxString
LIB_ALIAS
::
GetLibraryName
()
{
if
(
library
!=
NULL
)
return
library
->
Get
Name
();
if
(
GetComponent
()
)
return
GetComponent
()
->
GetLibrary
Name
();
return
wxString
(
_
(
"none"
)
);
}
wxString
LIB_COMPONENT
::
GetLibraryName
()
{
if
(
library
!=
NULL
)
return
library
->
GetName
();
return
wxString
(
_
(
"none"
)
);
}
wxString
LIB_ALIAS
::
GetLibraryName
()
bool
LIB_ALIAS
::
IsRoot
()
const
{
if
(
GetComponent
()
)
return
GetComponent
()
->
GetLibraryName
();
return
wxString
(
_
(
"none"
)
);
return
name
.
CmpNoCase
(
root
->
GetName
()
)
==
0
;
}
/**
* Function SaveDoc
* writes the doc info out to a FILE in "*.dcm" format.
...
...
@@ -104,7 +98,7 @@ wxString LIB_ALIAS::GetLibraryName()
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
CMP_LIB_ENTRY
::
SaveDoc
(
FILE
*
aFile
)
bool
LIB_ALIAS
::
SaveDoc
(
FILE
*
aFile
)
{
if
(
description
.
IsEmpty
()
&&
keyWords
.
IsEmpty
()
&&
docFileName
.
IsEmpty
()
)
return
true
;
...
...
@@ -131,59 +125,24 @@ bool CMP_LIB_ENTRY::SaveDoc( FILE* aFile )
}
bool
CMP_LIB_ENTRY
::
operator
==
(
const
wxChar
*
aName
)
const
bool
LIB_ALIAS
::
operator
==
(
const
wxChar
*
aName
)
const
{
return
name
.
CmpNoCase
(
aName
)
==
0
;
}
bool
operator
<
(
const
CMP_LIB_ENTRY
&
aItem1
,
const
CMP_LIB_ENTRY
&
aItem2
)
bool
operator
<
(
const
LIB_ALIAS
&
aItem1
,
const
LIB_ALIAS
&
aItem2
)
{
return
aItem1
.
GetName
().
CmpNoCase
(
aItem2
.
GetName
()
)
<
0
;
}
int
LibraryEntryCompare
(
const
CMP_LIB_ENTRY
*
aItem1
,
const
CMP_LIB_ENTRY
*
aItem2
)
int
LibraryEntryCompare
(
const
LIB_ALIAS
*
aItem1
,
const
LIB_ALIAS
*
aItem2
)
{
return
aItem1
->
GetName
().
CmpNoCase
(
aItem2
->
GetName
()
);
}
/*******************************/
/* class LIB_ALIAS */
/*******************************/
/* Class to define an alias of a component
* An alias uses the component definition (graphic, pins...)
* but has its own name, keywords and documentation.
* Therefore, when the component is modified, alias of this component are
* modified.
* This is a simple method to create components with differs very few
* (like 74LS00, 74HC00 ... and many op amps )
*/
LIB_ALIAS
::
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
aRootComponent
)
:
CMP_LIB_ENTRY
(
ALIAS
,
aName
,
NULL
)
{
root
=
aRootComponent
;
}
LIB_ALIAS
::
LIB_ALIAS
(
LIB_ALIAS
&
aAlias
,
LIB_COMPONENT
*
aRootComponent
)
:
CMP_LIB_ENTRY
(
aAlias
)
{
root
=
aRootComponent
;
}
LIB_ALIAS
::~
LIB_ALIAS
()
{
#if TRACE_DESTRUCTOR
wxLogDebug
(
wxT
(
"Destroying alias
\"
%s
\"
of component
\"
%s
\"
with alais list count %d."
),
GetChars
(
name
),
GetChars
(
root
->
GetName
()
),
root
->
m_aliases
.
size
()
);
#endif
}
/***********************/
/* class LIB_COMPONENT */
/***********************/
...
...
@@ -196,10 +155,12 @@ LIB_ALIAS::~LIB_ALIAS()
* Library components are different from schematic components.
*/
LIB_COMPONENT
::
LIB_COMPONENT
(
const
wxString
&
aName
,
CMP_LIBRARY
*
aLibrary
)
:
CMP_LIB_ENTRY
(
ROOT
,
aName
,
aLibrary
)
EDA_BaseStruct
(
LIB_COMPONENT_T
)
{
m_name
=
aName
;
m_library
=
aLibrary
;
m_dateModified
=
0
;
unitCount
=
1
;
m_unitCount
=
1
;
m_pinNameOffset
=
40
;
m_options
=
ENTRY_NORMAL
;
m_unitsLocked
=
FALSE
;
...
...
@@ -223,12 +184,14 @@ LIB_COMPONENT::LIB_COMPONENT( const wxString& aName, CMP_LIBRARY* aLibrary ) :
LIB_COMPONENT
::
LIB_COMPONENT
(
LIB_COMPONENT
&
aComponent
,
CMP_LIBRARY
*
aLibrary
)
:
CMP_LIB_ENTRY
(
aComponent
,
aLibrary
)
EDA_BaseStruct
(
aComponent
)
{
LIB_DRAW_ITEM
*
newItem
;
m_library
=
aLibrary
;
m_name
=
aComponent
.
m_name
;
m_FootprintList
=
aComponent
.
m_FootprintList
;
unitCount
=
aComponent
.
unitCount
;
m_unitCount
=
aComponent
.
m_
unitCount
;
m_unitsLocked
=
aComponent
.
m_unitsLocked
;
m_pinNameOffset
=
aComponent
.
m_pinNameOffset
;
m_showPinNumbers
=
aComponent
.
m_showPinNumbers
;
...
...
@@ -277,6 +240,15 @@ LIB_COMPONENT::~LIB_COMPONENT()
}
wxString
LIB_COMPONENT
::
GetLibraryName
()
{
if
(
m_library
!=
NULL
)
return
m_library
->
GetName
();
return
wxString
(
_
(
"none"
)
);
}
/** function IsMulti
* @return the sub reference for component having multiple parts per package.
* The sub reference identify the part (or unit)
...
...
@@ -296,7 +268,7 @@ wxString LIB_COMPONENT::ReturnSubReference( int aUnit )
void
LIB_COMPONENT
::
SetName
(
const
wxString
&
aName
)
{
CMP_LIB_ENTRY
::
SetName
(
aName
)
;
m_name
=
aName
;
GetValueField
().
m_Text
=
aName
;
m_aliases
[
0
]
->
SetName
(
aName
);
}
...
...
@@ -600,7 +572,7 @@ bool LIB_COMPONENT::Save( FILE* aFile )
0
,
m_pinNameOffset
,
m_showPinNumbers
?
'Y'
:
'N'
,
m_showPinNames
?
'Y'
:
'N'
,
unitCount
,
m_unitsLocked
?
'L'
:
'F'
,
m_
unitCount
,
m_unitsLocked
?
'L'
:
'F'
,
m_options
==
ENTRY_POWER
?
'P'
:
'N'
)
<
0
)
return
false
;
...
...
@@ -735,8 +707,8 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
||
sscanf
(
p
,
"%c"
,
&
drawnum
)
!=
1
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* DrawNums: */
||
sscanf
(
p
,
"%c"
,
&
drawname
)
!=
1
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/* unitCount: */
||
sscanf
(
p
,
"%d"
,
&
unitCount
)
!=
1
)
||
(
p
=
strtok
(
NULL
,
"
\t\n
"
)
)
==
NULL
/*
m_
unitCount: */
||
sscanf
(
p
,
"%d"
,
&
m_
unitCount
)
!=
1
)
{
aErrorMsg
.
Printf
(
wxT
(
"Wrong DEF format in line %d, skipped."
),
*
aLineNum
);
while
(
GetLine
(
aFile
,
aLine
,
aLineNum
,
LINE_BUFFER_LEN_LARGE
)
)
...
...
@@ -749,9 +721,9 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
return
false
;
}
// Ensure unitCount is >= 1 (could be read as 0 in old libraries)
if
(
unitCount
<
1
)
unitCount
=
1
;
// Ensure
m_
unitCount is >= 1 (could be read as 0 in old libraries)
if
(
m_
unitCount
<
1
)
m_
unitCount
=
1
;
m_showPinNumbers
=
(
drawnum
==
'N'
)
?
false
:
true
;
m_showPinNames
=
(
drawname
==
'N'
)
?
false
:
true
;
...
...
@@ -762,16 +734,16 @@ bool LIB_COMPONENT::Load( FILE* aFile, char* aLine, int* aLineNum, wxString& aEr
strupper
(
componentName
);
if
(
componentName
[
0
]
!=
'~'
)
{
name
=
value
.
m_Text
=
CONV_FROM_UTF8
(
componentName
);
m_
name
=
value
.
m_Text
=
CONV_FROM_UTF8
(
componentName
);
}
else
{
name
=
value
.
m_Text
=
CONV_FROM_UTF8
(
&
componentName
[
1
]
);
m_
name
=
value
.
m_Text
=
CONV_FROM_UTF8
(
&
componentName
[
1
]
);
value
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
}
// Add the root alias to the alias list.
m_aliases
.
push_back
(
new
LIB_ALIAS
(
name
,
this
)
);
m_aliases
.
push_back
(
new
LIB_ALIAS
(
m_
name
,
this
)
);
LIB_FIELD
&
reference
=
GetReferenceField
();
...
...
@@ -952,7 +924,7 @@ bool LIB_COMPONENT::LoadField( char* aLine, wxString& aErrorMsg )
*
fixedField
=
*
field
;
if
(
field
->
m_FieldId
==
VALUE
)
name
=
field
->
m_Text
;
m_
name
=
field
->
m_Text
;
SAFE_DELETE
(
field
);
}
...
...
@@ -1000,7 +972,7 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int aUnit, int aConvert )
BOOST_FOREACH
(
LIB_DRAW_ITEM
&
item
,
drawings
)
{
if
(
(
item
.
m_Unit
>
0
)
&&
(
(
unitCount
>
1
)
&&
(
aUnit
>
0
)
if
(
(
item
.
m_Unit
>
0
)
&&
(
(
m_
unitCount
>
1
)
&&
(
aUnit
>
0
)
&&
(
aUnit
!=
item
.
m_Unit
)
)
)
continue
;
...
...
@@ -1422,10 +1394,10 @@ LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int aUnit, int aConvert, KICAD_T a
void
LIB_COMPONENT
::
SetPartCount
(
int
aCount
)
{
if
(
unitCount
==
aCount
)
if
(
m_
unitCount
==
aCount
)
return
;
if
(
aCount
<
unitCount
)
if
(
aCount
<
m_
unitCount
)
{
LIB_DRAW_ITEM_LIST
::
iterator
i
;
i
=
drawings
.
begin
();
...
...
@@ -1440,7 +1412,7 @@ void LIB_COMPONENT::SetPartCount( int aCount )
}
else
{
int
prevCount
=
unitCount
;
int
prevCount
=
m_
unitCount
;
// We cannot use an iterator here, because when adding items in vector
// the buffer can be reallocated, that change the previous value of
...
...
@@ -1462,7 +1434,7 @@ void LIB_COMPONENT::SetPartCount( int aCount )
drawings
.
sort
();
}
unitCount
=
aCount
;
m_
unitCount
=
aCount
;
}
...
...
@@ -1540,7 +1512,7 @@ bool LIB_COMPONENT::HasAlias( const wxString& aName ) const
void
LIB_COMPONENT
::
SetAliases
(
const
wxArrayString
&
aAliasList
)
{
wxCHECK_RET
(
library
==
NULL
,
wxCHECK_RET
(
m_
library
==
NULL
,
wxT
(
"Component aliases cannot be changed when they are owned by a library."
)
);
if
(
aAliasList
==
GetAliasNames
()
)
...
...
@@ -1572,7 +1544,7 @@ void LIB_COMPONENT::SetAliases( const wxArrayString& aAliasList )
void
LIB_COMPONENT
::
RemoveAlias
(
const
wxString
&
aName
)
{
wxCHECK_RET
(
library
==
NULL
,
wxCHECK_RET
(
m_
library
==
NULL
,
wxT
(
"Component aliases cannot be changed when they are owned by a library."
)
);
wxCHECK_RET
(
!
aName
.
IsEmpty
(),
wxT
(
"Cannot get alias with an empty name."
)
);
...
...
eeschema/class_libentry.h
View file @
6566b0c5
...
...
@@ -13,6 +13,7 @@
class
CMP_LIBRARY
;
class
LIB_ALIAS
;
class
LIB_COMPONENT
;
class
LIB_FIELD
;
...
...
@@ -32,15 +33,6 @@ typedef std::map< wxString, LIB_ALIAS*, AliasMapSort > LIB_ALIAS_MAP;
typedef
std
::
vector
<
LIB_ALIAS
*
>
LIB_ALIAS_LIST
;
/* Types for components in libraries
* components can be a true component or an alias of a true component.
*/
enum
LibrEntryType
{
ROOT
,
/* This is a true component standard LIB_COMPONENT */
ALIAS
/* This is an alias of a true component */
};
/* values for member .m_options */
enum
LibrEntryOptions
{
...
...
@@ -50,51 +42,60 @@ enum LibrEntryOptions
/**
* Class CMP_LIB_ENTRY
* is a base class to describe library components and aliases.
* Component library alias object definition.
*
* This class is not to be used directly.
* Component aliases are not really components. They are references
* to an actual component object.
*/
class
CMP_LIB_ENTRY
:
public
EDA_BaseStruct
class
LIB_ALIAS
:
public
EDA_BaseStruct
{
protected
:
wxString
name
;
/// Library object that entry is attached to.
CMP_LIBRARY
*
library
;
/**
* The actual component of the alias.
*
* @note - Do not delete the root component. The root component is actually shared by
* all of the aliases associated with it. The component pointer will be delete
* in the destructor of the last alias that shares this component is deleted.
* Deleting the root component will likely cause EESchema to crash.
*/
LIB_COMPONENT
*
root
;
/// Entry type, either ROOT or ALIAS.
LibrEntryType
type
;
friend
class
LIB_COMPONENT
;
protected
:
wxString
name
;
wxString
description
;
///< documentation for info
wxString
keyWords
;
///< keyword list (used for search for components by keyword)
wxString
docFileName
;
///< Associate doc file name
public
:
CMP_LIB_ENTRY
(
LibrEntryType
aType
,
const
wxString
&
aName
,
CMP_LIBRARY
*
aLibrary
=
NULL
);
CMP_LIB_ENTRY
(
CMP_LIB_ENTRY
&
aEntry
,
CMP_LIBRARY
*
aLibrary
=
NULL
);
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
aRootComponent
);
LIB_ALIAS
(
const
LIB_ALIAS
&
aAlias
,
LIB_COMPONENT
*
aRootComponent
=
NULL
);
virtual
~
CMP_LIB_ENTRY
();
virtual
~
LIB_ALIAS
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"CMP_LIB_ENTRY"
);
return
wxT
(
"LIB_ALIAS"
);
}
/**
* Get the alias root component.
*/
LIB_COMPONENT
*
GetComponent
()
const
{
return
root
;
}
virtual
wxString
GetLibraryName
();
CMP_LIBRARY
*
GetLibrary
()
{
return
library
;
}
bool
IsRoot
()
const
;
CMP_LIBRARY
*
GetLibrary
();
virtual
const
wxString
&
GetName
()
const
{
return
name
;
}
virtual
void
SetName
(
const
wxString
&
aName
)
{
name
=
aName
;
}
bool
isComponent
()
const
{
return
type
==
ROOT
;
}
bool
isAlias
()
const
{
return
type
==
ALIAS
;
}
int
GetType
()
const
{
return
type
;
}
void
SetDescription
(
const
wxString
&
aDescription
)
{
description
=
aDescription
;
...
...
@@ -133,12 +134,12 @@ public:
return
!
(
*
this
==
aName
);
}
bool
operator
==
(
const
wxString
&
aName
)
const
{
return
*
this
==
(
const
wxChar
*
)
aName
;
}
bool
operator
==
(
const
LIB_ALIAS
*
aAlias
)
const
{
return
this
==
aAlias
;
}
};
extern
bool
operator
<
(
const
CMP_LIB_ENTRY
&
aItem1
,
const
CMP_LIB_ENTRY
&
aItem2
);
extern
bool
operator
<
(
const
LIB_ALIAS
&
aItem1
,
const
LIB_ALIAS
&
aItem2
);
extern
int
LibraryEntryCompare
(
const
CMP_LIB_ENTRY
*
aItem1
,
const
CMP_LIB_ENTRY
*
aItem2
);
extern
int
LibraryEntryCompare
(
const
LIB_ALIAS
*
aItem1
,
const
LIB_ALIAS
*
aItem2
);
/**
...
...
@@ -147,8 +148,9 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* aItem1, const CMP_LIB_ENTRY
* A library component object is typically saved and loaded in a component library file (.lib).
* Library components are different from schematic components.
*/
class
LIB_COMPONENT
:
public
CMP_LIB_ENTRY
class
LIB_COMPONENT
:
public
EDA_BaseStruct
{
wxString
m_name
;
int
m_pinNameOffset
;
///< The offset in mils to draw the pin name. Set to 0
///< to draw the pin name above the pin.
bool
m_unitsLocked
;
///< True if component has multiple parts and changing
...
...
@@ -157,12 +159,13 @@ class LIB_COMPONENT : public CMP_LIB_ENTRY
bool
m_showPinNumbers
;
///< Determines if component pin numbers are visible.
long
m_dateModified
;
///< Date the component was last modified.
LibrEntryOptions
m_options
;
///< Special component features such as POWER or NORMAL.)
int
unitCount
;
///< Number of units (parts) per package.
int
m_unitCount
;
///< Number of units (parts) per package.
LIB_DRAW_ITEM_LIST
drawings
;
///< How to draw this part.
wxArrayString
m_FootprintList
;
/**< List of suitable footprint names for the
component (wild card names accepted). */
LIB_ALIAS_LIST
m_aliases
;
///< List of alias object pointers associated with the
///< component.
CMP_LIBRARY
*
m_library
;
///< Library the component belongs to if any.
void
deleteAllFields
();
...
...
@@ -183,7 +186,11 @@ public:
virtual
void
SetName
(
const
wxString
&
aName
);
virtual
wxString
GetLibraryName
();
wxString
GetName
()
{
return
m_name
;
}
wxString
GetLibraryName
();
CMP_LIBRARY
*
GetLibrary
()
{
return
m_library
;
}
wxArrayString
GetAliasNames
(
bool
aIncludeRoot
=
true
)
const
;
...
...
@@ -512,13 +519,13 @@ public:
*/
void
SetPartCount
(
int
count
);
int
GetPartCount
()
{
return
unitCount
;
}
int
GetPartCount
()
{
return
m_
unitCount
;
}
/** function IsMulti
* @return true if the component has multiple parts per package.
* When happens, the reference has a sub reference ti identify part
*/
bool
IsMulti
()
{
return
unitCount
>
1
;
}
bool
IsMulti
()
{
return
m_
unitCount
>
1
;
}
/** function IsMulti
* @return the sub reference for component having multiple parts per package.
...
...
@@ -574,52 +581,4 @@ public:
};
/**
* Component library alias object definition.
*
* Component aliases are not really components. They are references
* to an actual component object.
*/
class
LIB_ALIAS
:
public
CMP_LIB_ENTRY
{
friend
class
LIB_COMPONENT
;
protected
:
/**
* The actual component of the alias.
*
* @note - Do not delete the root component. The root component is actually shared by
* all of the aliases associated with it. The component pointer will be delete
* in the destructor of the last alias that shares this component is deleted.
* Deleting the root component will likely cause EESchema to crash.
*/
LIB_COMPONENT
*
root
;
public
:
LIB_ALIAS
(
const
wxString
&
aName
,
LIB_COMPONENT
*
aRootComponent
);
LIB_ALIAS
(
LIB_ALIAS
&
aAlias
,
LIB_COMPONENT
*
aRootComponent
=
NULL
);
virtual
~
LIB_ALIAS
();
virtual
wxString
GetClass
()
const
{
return
wxT
(
"LIB_ALIAS"
);
}
/**
* Get the alias root component.
*/
LIB_COMPONENT
*
GetComponent
()
const
{
return
root
;
}
virtual
wxString
GetLibraryName
();
bool
IsRoot
()
const
{
return
name
.
CmpNoCase
(
root
->
GetName
()
)
==
0
;
}
bool
operator
==
(
const
LIB_ALIAS
*
aAlias
)
const
{
return
this
==
aAlias
;
}
};
#endif // CLASS_LIBENTRY_H
eeschema/class_library.cpp
View file @
6566b0c5
...
...
@@ -174,13 +174,13 @@ bool CMP_LIBRARY::Conflicts( LIB_COMPONENT* aComponent )
}
CMP_LIB_ENTRY
*
CMP_LIBRARY
::
FindEntry
(
const
wxChar
*
aName
)
LIB_ALIAS
*
CMP_LIBRARY
::
FindEntry
(
const
wxChar
*
aName
)
{
LIB_ALIAS_MAP
::
iterator
it
=
aliases
.
find
(
wxString
(
aName
)
);
if
(
it
!=
aliases
.
end
()
)
return
(
CMP_LIB_ENTRY
*
)
(
*
it
).
second
;
return
(
*
it
).
second
;
return
NULL
;
}
...
...
@@ -190,10 +190,10 @@ CMP_LIB_ENTRY* CMP_LIBRARY::FindEntry( const wxChar* aName )
* Return the first entry in the library.
* @return The first entry or NULL if the library has no entries.
*/
CMP_LIB_ENTRY
*
CMP_LIBRARY
::
GetFirstEntry
()
LIB_ALIAS
*
CMP_LIBRARY
::
GetFirstEntry
()
{
if
(
aliases
.
size
()
)
return
(
LIB_ALIAS
*
)
(
*
aliases
.
begin
()).
second
;
return
(
*
aliases
.
begin
()).
second
;
else
return
NULL
;
}
...
...
@@ -201,16 +201,10 @@ CMP_LIB_ENTRY* CMP_LIBRARY::GetFirstEntry()
LIB_COMPONENT
*
CMP_LIBRARY
::
FindComponent
(
const
wxChar
*
aName
)
{
LIB_COMPONENT
*
component
=
NULL
;
CMP_LIB_ENTRY
*
entry
=
FindEntry
(
aName
);
LIB_ALIAS
*
entry
=
FindEntry
(
aName
);
if
(
entry
!=
NULL
)
{
wxCHECK_MSG
(
entry
->
isAlias
(),
NULL
,
wxT
(
"Component found in library entry list, bad programmer!"
)
);
LIB_ALIAS
*
alias
=
(
LIB_ALIAS
*
)
entry
;
component
=
alias
->
GetComponent
();
}
component
=
entry
->
GetComponent
();
return
component
;
}
...
...
@@ -276,7 +270,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
LIB_ALIAS
*
alias
=
FindAlias
(
aliasname
);
if
(
alias
!=
NULL
)
RemoveEntry
(
(
CMP_LIB_ENTRY
*
)
alias
);
RemoveEntry
(
alias
);
aliases
[
aliasname
]
=
newCmp
->
m_aliases
[
i
];
}
...
...
@@ -287,10 +281,9 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent )
}
CMP_LIB_ENTRY
*
CMP_LIBRARY
::
RemoveEntry
(
CMP_LIB_ENTRY
*
aEntry
)
LIB_ALIAS
*
CMP_LIBRARY
::
RemoveEntry
(
LIB_ALIAS
*
aEntry
)
{
wxCHECK_MSG
(
aEntry
!=
NULL
&&
aEntry
->
isAlias
(),
NULL
,
wxT
(
"Only LIB_ALIAS pointers can be removed from library."
)
);
wxCHECK_MSG
(
aEntry
!=
NULL
,
NULL
,
wxT
(
"NULL pointer cannot be removed from library."
)
);
LIB_ALIAS_MAP
::
iterator
it
=
aliases
.
find
(
aEntry
->
GetName
()
);
...
...
@@ -326,7 +319,7 @@ CMP_LIB_ENTRY* CMP_LIBRARY::RemoveEntry( CMP_LIB_ENTRY* aEntry )
aliases
.
erase
(
it
);
isModified
=
true
;
return
(
CMP_LIB_ENTRY
*
)
alias
;
return
alias
;
}
...
...
@@ -354,7 +347,7 @@ LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* aOldComponent,
while
(
i
!=
0
)
{
i
-=
1
;
RemoveEntry
(
(
CMP_LIB_ENTRY
*
)
aOldComponent
->
m_aliases
[
i
]
);
RemoveEntry
(
aOldComponent
->
m_aliases
[
i
]
);
}
LIB_COMPONENT
*
newCmp
=
new
LIB_COMPONENT
(
*
aNewComponent
,
this
);
...
...
@@ -371,7 +364,7 @@ LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* aOldComponent,
}
CMP_LIB_ENTRY
*
CMP_LIBRARY
::
GetNextEntry
(
const
wxChar
*
aName
)
LIB_ALIAS
*
CMP_LIBRARY
::
GetNextEntry
(
const
wxChar
*
aName
)
{
if
(
aliases
.
empty
()
)
return
NULL
;
...
...
@@ -383,11 +376,11 @@ CMP_LIB_ENTRY* CMP_LIBRARY::GetNextEntry( const wxChar* aName )
if
(
it
==
aliases
.
end
()
)
it
=
aliases
.
begin
();
return
(
CMP_LIB_ENTRY
*
)
(
*
it
).
second
;
return
(
*
it
).
second
;
}
CMP_LIB_ENTRY
*
CMP_LIBRARY
::
GetPreviousEntry
(
const
wxChar
*
aName
)
LIB_ALIAS
*
CMP_LIBRARY
::
GetPreviousEntry
(
const
wxChar
*
aName
)
{
if
(
aliases
.
empty
()
)
return
NULL
;
...
...
@@ -399,7 +392,7 @@ CMP_LIB_ENTRY* CMP_LIBRARY::GetPreviousEntry( const wxChar* aName )
it
--
;
return
(
CMP_LIB_ENTRY
*
)
(
*
it
).
second
;
return
(
*
it
).
second
;
}
...
...
@@ -551,7 +544,7 @@ the current schematic." ),
void
CMP_LIBRARY
::
LoadAliases
(
LIB_COMPONENT
*
component
)
{
wxCHECK_RET
(
component
!=
NULL
&&
component
->
isComponent
()
,
wxCHECK_RET
(
component
!=
NULL
,
wxT
(
"Cannot load aliases of NULL component object. Bad programmer!"
)
);
for
(
size_t
i
=
0
;
i
<
component
->
m_aliases
.
size
();
i
++
)
...
...
@@ -589,12 +582,12 @@ bool CMP_LIBRARY::LoadHeader( FILE* libfile, int* LineNum )
bool
CMP_LIBRARY
::
LoadDocs
(
wxString
&
aErrorMsg
)
{
int
lineNumber
=
0
;
char
line
[
LINE_BUFFER_LEN_LARGE
],
*
name
,
*
text
;
CMP_LIB_ENTRY
*
entry
;
FILE
*
file
;
wxString
msg
;
wxFileName
fn
=
fileName
;
int
lineNumber
=
0
;
char
line
[
LINE_BUFFER_LEN_LARGE
],
*
name
,
*
text
;
LIB_ALIAS
*
entry
;
FILE
*
file
;
wxString
msg
;
wxFileName
fn
=
fileName
;
fn
.
SetExt
(
DOC_EXT
);
...
...
@@ -647,8 +640,6 @@ bool CMP_LIBRARY::LoadDocs( wxString& aErrorMsg )
if
(
entry
)
{
wxASSERT
(
entry
->
isAlias
()
);
switch
(
line
[
0
]
)
{
case
'D'
:
...
...
@@ -979,9 +970,9 @@ LIB_COMPONENT* CMP_LIBRARY::FindLibraryComponent( const wxString& aName,
}
CMP_LIB_ENTRY
*
CMP_LIBRARY
::
FindLibraryEntry
(
const
wxString
&
aName
,
const
wxString
&
aLibraryName
)
LIB_ALIAS
*
CMP_LIBRARY
::
FindLibraryEntry
(
const
wxString
&
aName
,
const
wxString
&
aLibraryName
)
{
CMP_LIB_ENTRY
*
entry
=
NULL
;
LIB_ALIAS
*
entry
=
NULL
;
BOOST_FOREACH
(
CMP_LIBRARY
&
lib
,
libraryList
)
{
...
...
eeschema/class_library.h
View file @
6566b0c5
...
...
@@ -71,7 +71,6 @@ class CMP_LIBRARY
static
CMP_LIBRARY_LIST
libraryList
;
static
wxArrayString
libraryListSortOrder
;
friend
class
CMP_LIB_ENTRY
;
friend
class
LIB_COMPONENT
;
public
:
...
...
@@ -217,12 +216,12 @@ public:
* @param aName - Name of entry, case insensitive.
* @return Entry if found. NULL if not found.
*/
CMP_LIB_ENTRY
*
FindEntry
(
const
wxChar
*
aName
);
LIB_ALIAS
*
FindEntry
(
const
wxChar
*
aName
);
/**
* Find component by \a aName.
*
* This is a helper for FindEntry so casting a
CMP_LIB_ENTRY
pointer to
* This is a helper for FindEntry so casting a
LIB_ALIAS
pointer to
* a LIB_COMPONENT pointer is not required.
*
* @param aName - Name of component, case insensitive.
...
...
@@ -233,7 +232,7 @@ public:
/**
* Find alias by \a nName.
*
* This is a helper for FindEntry so casting a
CMP_LIB_ENTRY
pointer to
* This is a helper for FindEntry so casting a
LIB_ALIAS
pointer to
* a LIB_ALIAS pointer is not required.
*
* @param aName - Name of alias, case insensitive.
...
...
@@ -280,7 +279,7 @@ public:
* @param aEntry - Entry to remove from library.
* @return The next entry in the library or NULL if the library is empty.
*/
CMP_LIB_ENTRY
*
RemoveEntry
(
CMP_LIB_ENTRY
*
aEntry
);
LIB_ALIAS
*
RemoveEntry
(
LIB_ALIAS
*
aEntry
);
/**
* Replace an existing component entry in the library.
...
...
@@ -297,7 +296,7 @@ public:
*
* @return The first entry or NULL if the library has no entries.
*/
CMP_LIB_ENTRY
*
GetFirstEntry
();
LIB_ALIAS
*
GetFirstEntry
();
/**
* Find next library entry by \a aName.
...
...
@@ -308,7 +307,7 @@ public:
* @param aName - Name of current entry.
* @return Next entry if entry name is found. Otherwise NULL.
*/
CMP_LIB_ENTRY
*
GetNextEntry
(
const
wxChar
*
aName
);
LIB_ALIAS
*
GetNextEntry
(
const
wxChar
*
aName
);
/**
...
...
@@ -320,7 +319,7 @@ public:
* @param aName - Name of current entry.
* @return Previous entry if entry name is found, otherwise NULL.
*/
CMP_LIB_ENTRY
*
GetPreviousEntry
(
const
wxChar
*
aName
);
LIB_ALIAS
*
GetPreviousEntry
(
const
wxChar
*
aName
);
/**
* Return the file name without path or extension.
...
...
@@ -471,8 +470,8 @@ public:
* @param aLibraryName - Name of the library to search.
* @return The entry object if found, otherwise NULL.
*/
static
CMP_LIB_ENTRY
*
FindLibraryEntry
(
const
wxString
&
aEntryName
,
const
wxString
&
aLibraryName
=
wxEmptyString
);
static
LIB_ALIAS
*
FindLibraryEntry
(
const
wxString
&
aEntryName
,
const
wxString
&
aLibraryName
=
wxEmptyString
);
/**
* Function RemoveCacheLibrary
...
...
eeschema/class_sch_component.cpp
View file @
6566b0c5
...
...
@@ -43,8 +43,8 @@ void CreateDummyCmp()
LIB_RECTANGLE
*
Square
=
new
LIB_RECTANGLE
(
DummyCmp
);
Square
->
m_Pos
=
wxPoint
(
-
200
,
200
);
Square
->
m_End
=
wxPoint
(
200
,
-
200
);
Square
->
Move
(
wxPoint
(
-
200
,
200
)
);
Square
->
SetEndPosition
(
wxPoint
(
200
,
-
200
)
);
LIB_TEXT
*
Text
=
new
LIB_TEXT
(
DummyCmp
);
...
...
@@ -537,8 +537,6 @@ LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number )
if
(
Entry
==
NULL
)
return
NULL
;
wxASSERT
(
Entry
->
isComponent
()
);
return
Entry
->
GetPin
(
number
,
m_Multi
,
m_Convert
);
}
...
...
@@ -1127,10 +1125,10 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
{
// search for the component in lib
// Entry and root_component can differ if Entry is an alias
CMP_LIB_ENTRY
*
Entry
=
CMP_LIBRARY
::
FindLibraryEntry
(
m_ChipName
);
LIB_ALIAS
*
alias
=
CMP_LIBRARY
::
FindLibraryEntry
(
m_ChipName
);
LIB_COMPONENT
*
root_component
=
CMP_LIBRARY
::
FindLibraryComponent
(
m_ChipName
);
if
(
(
Entry
==
NULL
)
||
(
root_component
==
NULL
)
)
if
(
(
alias
==
NULL
)
||
(
root_component
==
NULL
)
)
return
;
wxString
msg
;
...
...
@@ -1149,13 +1147,13 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
// Display component reference in library and library
frame
->
AppendMsgPanel
(
_
(
"Component"
),
m_ChipName
,
BROWN
);
if
(
Entry
->
isAlias
()
)
if
(
alias
->
GetName
()
!=
root_component
->
GetName
()
)
frame
->
AppendMsgPanel
(
_
(
"Alias of"
),
root_component
->
GetName
(),
BROWN
);
frame
->
AppendMsgPanel
(
_
(
"Library"
),
Entry
->
GetLibraryName
(),
BROWN
);
frame
->
AppendMsgPanel
(
_
(
"Library"
),
alias
->
GetLibraryName
(),
BROWN
);
// Display description of the component, and keywords found in lib
frame
->
AppendMsgPanel
(
_
(
"Description"
),
Entry
->
GetDescription
(),
DARKCYAN
);
frame
->
AppendMsgPanel
(
_
(
"Key words"
),
Entry
->
GetKeyWords
(),
DARKCYAN
);
frame
->
AppendMsgPanel
(
_
(
"Description"
),
alias
->
GetDescription
(),
DARKCYAN
);
frame
->
AppendMsgPanel
(
_
(
"Key words"
),
alias
->
GetKeyWords
(),
DARKCYAN
);
}
...
...
eeschema/dangling_ends.cpp
View file @
6566b0c5
...
...
@@ -346,12 +346,11 @@ void RebuildEndPointsList( std::vector <DANGLING_END_ITEM>& aItemList, SCH_ITEM*
{
wxASSERT
(
Pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
);
if
(
Pin
->
m_Unit
&&
STRUCT
->
m_Multi
&&
(
STRUCT
->
m_Multi
!=
Pin
->
m_Unit
)
)
if
(
Pin
->
GetUnit
()
&&
STRUCT
->
m_Multi
&&
(
STRUCT
->
m_Multi
!=
Pin
->
GetUnit
()
)
)
continue
;
if
(
Pin
->
m_Convert
&&
STRUCT
->
m_Convert
&&
(
STRUCT
->
m_Convert
!=
Pin
->
m_Convert
)
)
if
(
Pin
->
GetConvert
()
&&
STRUCT
->
m_Convert
&&
(
STRUCT
->
m_Convert
!=
Pin
->
GetConvert
()
)
)
continue
;
DANGLING_END_ITEM
item
(
PIN_END
,
Pin
);
...
...
eeschema/database.cpp
View file @
6566b0c5
...
...
@@ -76,7 +76,7 @@ wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
void
DisplayCmpDoc
(
wxString
&
Name
)
{
CMP_LIB_ENTRY
*
CmpEntry
=
NULL
;
LIB_ALIAS
*
CmpEntry
=
NULL
;
CmpEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
Name
);
...
...
eeschema/dialog_edit_component_in_lib.cpp
View file @
6566b0c5
...
...
@@ -154,5 +154,5 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
m_SelNumberOfUnits
->
SetValue
(
component
->
GetPartCount
()
);
m_SetSkew
->
SetValue
(
component
->
GetPinNameOffset
()
);
m_OptionPower
->
SetValue
(
component
->
IsPower
()
);
m_OptionPartsLocked
->
SetValue
(
component
->
UnitsLocked
()
);
m_OptionPartsLocked
->
SetValue
(
component
->
UnitsLocked
()
&&
component
->
GetPartCount
()
>
1
);
}
eeschema/dialog_schematic_find.cpp
View file @
6566b0c5
...
...
@@ -35,8 +35,8 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData,
m_checkWrap
->
SetValue
(
flags
&
FR_SEARCH_WRAP
);
m_checkCurrentSheetOnly
->
SetValue
(
flags
&
FR_CURRENT_SHEET_ONLY
);
m_buttonFind
->
SetDefault
();
m_comboFind
->
SetFocus
();
SetPosition
(
aPosition
);
SetSize
(
aSize
);
}
...
...
eeschema/edit_component_in_lib.cpp
View file @
6566b0c5
...
...
@@ -33,35 +33,27 @@
void
WinEDA_LibeditFrame
::
OnEditComponentProperties
(
wxCommandEvent
&
event
)
{
bool
partLocked
=
GetComponent
()
->
UnitsLocked
();
EditComponentProperties
();
if
(
partLocked
!=
GetComponent
()
->
UnitsLocked
()
)
{
// g_EditPinByPinIsOn is set to the better value,
// if m_UnitSelectionLocked has changed
g_EditPinByPinIsOn
=
GetComponent
()
->
UnitsLocked
()
?
true
:
false
;
m_HToolBar
->
ToggleTool
(
ID_LIBEDIT_EDIT_PIN_BY_PIN
,
g_EditPinByPinIsOn
);
}
m_HToolBar
->
Refresh
();
DrawPanel
->
Refresh
();
}
void
WinEDA_LibeditFrame
::
EditComponentProperties
()
{
DIALOG_EDIT_COMPONENT_IN_LIBRARY
dlg
(
this
);
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
return
;
if
(
partLocked
!=
GetComponent
()
->
UnitsLocked
()
)
{
// g_EditPinByPinIsOn is set to the better value, if m_UnitSelectionLocked has changed
g_EditPinByPinIsOn
=
GetComponent
()
->
UnitsLocked
()
?
true
:
false
;
}
UpdateAliasSelectList
();
UpdatePartSelectList
();
DisplayLibInfos
();
DisplayCmpDoc
();
OnModify
(
);
OnModify
();
DrawPanel
->
Refresh
();
}
void
DIALOG_EDIT_COMPONENT_IN_LIBRARY
::
OnOkClick
(
wxCommandEvent
&
event
)
{
...
...
@@ -144,14 +136,23 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
void
DIALOG_EDIT_COMPONENT_IN_LIBRARY
::
CopyDocToAlias
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
{
if
(
m_Parent
==
NULL
)
return
;
LIB_ALIAS
*
alias
;
LIB_COMPONENT
*
component
=
m_Parent
->
GetComponent
();
if
(
component
==
NULL
)
return
;
m_DocCtrl
->
SetValue
(
component
->
GetDescription
()
);
m_DocfileCtrl
->
SetValue
(
component
->
GetDocFileName
()
);
m_KeywordsCtrl
->
SetValue
(
component
->
GetKeyWords
()
);
alias
=
component
->
GetAlias
(
m_Parent
->
GetAliasName
()
);
if
(
alias
==
NULL
)
return
;
m_DocCtrl
->
SetValue
(
alias
->
GetDescription
()
);
m_DocfileCtrl
->
SetValue
(
alias
->
GetDocFileName
()
);
m_KeywordsCtrl
->
SetValue
(
alias
->
GetKeyWords
()
);
}
...
...
eeschema/edit_graphic_bodyitem_text.cpp
View file @
6566b0c5
...
...
@@ -62,9 +62,9 @@ void Dialog_BodyGraphicText_Properties::InitDialog( )
m_TextSize
->
SetValue
(
msg
);
m_TextValue
->
SetValue
(
m_GraphicText
->
m_Text
);
if
(
m_GraphicText
->
m_Unit
==
0
)
if
(
m_GraphicText
->
GetUnit
()
==
0
)
m_CommonUnit
->
SetValue
(
TRUE
);
if
(
m_GraphicText
->
m_Convert
==
0
)
if
(
m_GraphicText
->
GetConvert
()
==
0
)
m_CommonConvert
->
SetValue
(
TRUE
);
if
(
m_GraphicText
->
m_Orient
==
TEXT_ORIENT_VERT
)
m_Orient
->
SetValue
(
TRUE
);
...
...
@@ -163,14 +163,14 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
m_GraphicText
->
m_Orient
=
m_Parent
->
m_textOrientation
;
if
(
m_Parent
->
m_drawSpecificUnit
)
m_GraphicText
->
m_Unit
=
m_Parent
->
GetUnit
(
);
m_GraphicText
->
SetUnit
(
m_Parent
->
GetUnit
()
);
else
m_GraphicText
->
m_Unit
=
0
;
m_GraphicText
->
SetUnit
(
0
)
;
if
(
m_Parent
->
m_drawSpecificConvert
)
m_GraphicText
->
m_Convert
=
m_Parent
->
GetConvert
(
);
m_GraphicText
->
SetConvert
(
m_Parent
->
GetConvert
()
);
else
m_GraphicText
->
m_Convert
=
0
;
m_GraphicText
->
SetConvert
(
0
)
;
if
(
(
m_TextShapeOpt
->
GetSelection
()
&
1
)
!=
0
)
m_GraphicText
->
m_Italic
=
true
;
...
...
eeschema/lib_arc.cpp
View file @
6566b0c5
...
...
@@ -182,7 +182,7 @@ bool LIB_ARC::HitTest( const wxPoint& aRefPoint )
bool
LIB_ARC
::
HitTest
(
wxPoint
aReferencePoint
,
int
aThreshold
,
const
TRANSFORM
&
aTransform
)
{
// TODO: use aTransMat to calcul
m
ates parameters
// TODO: use aTransMat to calculates parameters
wxPoint
relativePosition
=
aReferencePoint
;
NEGATE
(
relativePosition
.
y
);
// reverse Y axis
...
...
@@ -271,7 +271,7 @@ void LIB_ARC::DoOffset( const wxPoint& aOffset )
}
bool
LIB_ARC
::
DoTestInside
(
EDA_Rect
&
aRect
)
bool
LIB_ARC
::
DoTestInside
(
EDA_Rect
&
aRect
)
const
{
return
aRect
.
Inside
(
m_ArcStart
.
x
,
-
m_ArcStart
.
y
)
||
aRect
.
Inside
(
m_ArcEnd
.
x
,
-
m_ArcEnd
.
y
);
...
...
@@ -335,7 +335,7 @@ int LIB_ARC::GetPenSize()
void
LIB_ARC
::
drawEditGraphics
(
EDA_Rect
*
aClipBox
,
wxDC
*
aDC
,
int
aColor
)
{
// Th
i
e edit indicators only get drawn when a new arc is being drawn.
// The edit indicators only get drawn when a new arc is being drawn.
if
(
(
m_Flags
&
IS_NEW
)
==
0
)
return
;
...
...
@@ -356,7 +356,7 @@ void LIB_ARC::drawEditGraphics( EDA_Rect* aClipBox, wxDC* aDC, int aColor )
void
LIB_ARC
::
drawGraphic
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
const
TRANSFORM
&
aTransform
)
{
// D
O
n't draw the arc until the end point is selected. Only the edit indicators
// D
o
n't draw the arc until the end point is selected. Only the edit indicators
// get drawn at this time.
if
(
(
m_Flags
&
IS_NEW
)
&&
m_lastEditState
==
1
)
return
;
...
...
@@ -539,7 +539,7 @@ void LIB_ARC::BeginEdit( int aEditMode, const wxPoint aPosition )
}
else
{
// Save the current arc positions in case the resize i
a
aborted.
// Save the current arc positions in case the resize i
s
aborted.
saveAttributes
();
// The arc center point has to be rotated with while adjusting the
...
...
eeschema/lib_arc.h
View file @
6566b0c5
...
...
@@ -21,6 +21,13 @@ class LIB_ARC : public LIB_DRAW_ITEM
OUTLINE
,
};
int
m_Radius
;
int
m_t1
;
/* First radius angle of the arc in 0.1 degrees. */
int
m_t2
;
/* Second radius angle of the arc in 0.1 degrees. */
wxPoint
m_ArcStart
;
wxPoint
m_ArcEnd
;
/* Arc end position. */
wxPoint
m_Pos
;
/* Radius center point. */
int
m_Width
;
/* Line width */
wxPoint
m_savedStartPos
;
wxPoint
m_savedEndPos
;
int
m_savedAngle1
;
...
...
@@ -66,15 +73,6 @@ class LIB_ARC : public LIB_DRAW_ITEM
*/
void
calcRadiusAngles
();
public
:
int
m_Radius
;
int
m_t1
;
/* First radius angle of the arc in 0.1 degrees. */
int
m_t2
;
/* Second radius angle of the arc in 0.1 degrees. */
wxPoint
m_ArcStart
;
wxPoint
m_ArcEnd
;
/* Arc end position. */
wxPoint
m_Pos
;
/* Radius center point. */
int
m_Width
;
/* Line width */
public
:
LIB_ARC
(
LIB_COMPONENT
*
aParent
);
LIB_ARC
(
const
LIB_ARC
&
aArc
);
...
...
@@ -149,13 +147,13 @@ protected:
*/
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_Pos
;
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_Pos
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
...
...
eeschema/lib_bezier.cpp
View file @
6566b0c5
...
...
@@ -158,7 +158,7 @@ void LIB_BEZIER::DoOffset( const wxPoint& aOffset )
}
bool
LIB_BEZIER
::
DoTestInside
(
EDA_Rect
&
aRect
)
bool
LIB_BEZIER
::
DoTestInside
(
EDA_Rect
&
aRect
)
const
{
for
(
size_t
i
=
0
;
i
<
m_PolyPoints
.
size
();
i
++
)
{
...
...
eeschema/lib_bezier.h
View file @
6566b0c5
...
...
@@ -11,17 +11,16 @@
/**************************************************/
class
LIB_BEZIER
:
public
LIB_DRAW_ITEM
{
int
m_Width
;
// Line width
std
::
vector
<
wxPoint
>
m_BezierPoints
;
// list of parameter (3|4)
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// list of points (>= 2)
/**
* Draw the bezier curve.
*/
void
drawGraphic
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
const
TRANSFORM
&
aTransform
);
public
:
int
m_Width
;
/* Line width */
std
::
vector
<
wxPoint
>
m_BezierPoints
;
// list of parameter (3|4)
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// list of points (>= 2)
public
:
LIB_BEZIER
(
LIB_COMPONENT
*
aParent
);
LIB_BEZIER
(
const
LIB_BEZIER
&
aBezier
);
...
...
@@ -90,13 +89,13 @@ protected:
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_PolyPoints
[
0
];
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_PolyPoints
[
0
];
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
...
...
eeschema/lib_circle.cpp
View file @
6566b0c5
...
...
@@ -145,10 +145,10 @@ void LIB_CIRCLE::DoOffset( const wxPoint& aOffset )
}
bool
LIB_CIRCLE
::
DoTestInside
(
EDA_Rect
&
aRect
)
bool
LIB_CIRCLE
::
DoTestInside
(
EDA_Rect
&
aRect
)
const
{
/*
* FIXME: This fails to take into acount the radius around the center
* FIXME: This fails to take into ac
c
ount the radius around the center
* point.
*/
return
aRect
.
Inside
(
m_Pos
.
x
,
-
m_Pos
.
y
);
...
...
eeschema/lib_circle.h
View file @
6566b0c5
...
...
@@ -11,7 +11,11 @@
class
LIB_CIRCLE
:
public
LIB_DRAW_ITEM
{
int
m_savedRadius
;
///< Temporary storage of radius before editing begins.
int
m_Radius
;
wxPoint
m_Pos
;
// Position or centre (Arc and Circle) or start point (segments).
int
m_Width
;
// Line width.
int
m_savedRadius
;
// Temporary storage of radius before editing begins.
/**
* Draws the arc.
...
...
@@ -36,12 +40,6 @@ class LIB_CIRCLE : public LIB_DRAW_ITEM
*/
void
calcEdit
(
const
wxPoint
&
aPosition
);
public
:
int
m_Radius
;
wxPoint
m_Pos
;
/* Position or centre (Arc and Circle) or start point (segments) */
int
m_Width
;
/* Line width */
public
:
LIB_CIRCLE
(
LIB_COMPONENT
*
aParent
);
LIB_CIRCLE
(
const
LIB_CIRCLE
&
aCircle
);
...
...
@@ -115,13 +113,13 @@ protected:
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_Pos
;
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_Pos
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
...
...
eeschema/lib_draw_item.cpp
View file @
6566b0c5
...
...
@@ -127,7 +127,7 @@ void LIB_DRAW_ITEM::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aO
drawGraphic
(
aPanel
,
aDC
,
wxPoint
(
0
,
0
),
color
,
g_XorMode
,
aData
,
aTransform
);
}
// Calculte the new attributes at the current cursor position.
// Calcul
a
te the new attributes at the current cursor position.
calcEdit
(
aOffset
);
// Draw the items using the new attributes.
...
...
eeschema/lib_draw_item.h
View file @
6566b0c5
...
...
@@ -21,11 +21,6 @@ class LIB_PIN;
extern
const
int
fill_tab
[];
// Set KICAD_USE_LIB_OJBECT_EDIT to 1 to use build in ojbect editing mode.
#if !defined( KICAD_USE_LIB_OJBECT_EDIT )
#undef KICAD_USE_LIB_OJBECT_EDIT
#define KICAD_USE_LIB_OJBECT_EDIT 1
#endif
#define MINIMUM_SELECTION_DISTANCE 15 // Minimum selection distance in mils
...
...
@@ -40,7 +35,7 @@ typedef boost::ptr_vector< LIB_DRAW_ITEM > LIB_DRAW_ITEM_LIST;
/**
* Helper for defining a list of pin object pointers. The list does not
* use a Boost pointer class so the o
jb
ect pointers do not accidently get
* use a Boost pointer class so the o
bj
ect pointers do not accidently get
* deleted when the container is deleted.
*/
typedef
std
::
vector
<
LIB_PIN
*
>
LIB_PIN_LIST
;
...
...
@@ -84,7 +79,6 @@ class LIB_DRAW_ITEM : public EDA_BaseStruct
*/
virtual
void
calcEdit
(
const
wxPoint
&
aPosition
)
{}
/**
* Save the current item attributes while editing.
*
...
...
@@ -100,12 +94,10 @@ class LIB_DRAW_ITEM : public EDA_BaseStruct
bool
m_eraseLastDrawItem
;
///< Used when editing a new draw item to prevent drawing
///< artifacts.
protected
:
wxPoint
m_savedPos
;
///< Temporary position when editng an existing item.
wxPoint
m_initialPos
;
///< Temporary position when moving an existing item.
wxPoint
m_initialCursorPos
;
///< Iniital cursor position at the begining of a move.
public
:
friend
class
LIB_COMPONENT
;
protected
:
/**
* Unit identification for multiple parts per package. Set to 0 if the
* item is common to all units.
...
...
@@ -125,7 +117,11 @@ public:
*/
FILL_T
m_Fill
;
wxString
m_typeName
;
///< Name of object displayed in the message panel.
wxString
m_typeName
;
///< Name of object displayed in the message panel.
wxPoint
m_savedPos
;
///< Temporary position when editing an existing item.
wxPoint
m_initialPos
;
///< Temporary position when moving an existing item.
wxPoint
m_initialCursorPos
;
///< Initial cursor position at the beginning of a move.
public
:
...
...
@@ -139,13 +135,15 @@ public:
virtual
~
LIB_DRAW_ITEM
()
{
}
wxString
GetTypeName
()
{
return
m_typeName
;
}
/**
* Begin an editing a component library draw item in \a aEditMode at \a aPosition.
*
* This is used to start an editing action such as resize or move a draw object.
* It typically would be called on a left click when a draw tool is selected in
* the component library editor and one of the graphics tools is selected. It
* allows the draw item to maint
ia
n it's own internal state while it is being
* allows the draw item to maint
ai
n it's own internal state while it is being
* edited. Call AbortEdit() to quit the editing mode.
*
* @param aEditMode - The editing mode being performed. See base_struct.h for a list
...
...
@@ -223,7 +221,7 @@ public:
*
* Derived classes should override this function.
*
* @param aPosition - The coordinats to test.
* @param aPosition - The coordinat
e
s to test.
* @return - true if a hit, else false
*/
virtual
bool
HitTest
(
const
wxPoint
&
aPosition
)
...
...
@@ -283,7 +281,7 @@ public:
/**
* Set drawing object offset from the current position.
*
* @param aOffset - Coor
i
dinates to offset position.
* @param aOffset - Coordinates to offset position.
*/
void
SetOffset
(
const
wxPoint
&
aOffset
)
{
DoOffset
(
aOffset
);
}
...
...
@@ -296,7 +294,7 @@ public:
* @param aRect - Rectangle to check against.
* @return - True if object is inside rectangle.
*/
bool
Inside
(
EDA_Rect
&
aRect
)
{
return
DoTestInside
(
aRect
);
}
bool
Inside
(
EDA_Rect
&
aRect
)
const
{
return
DoTestInside
(
aRect
);
}
/**
* Move a draw object to a new \a aPosition.
...
...
@@ -310,7 +308,7 @@ public:
/**
* Return the current draw object start position.
*/
wxPoint
GetPosition
()
{
return
DoGetPosition
();
}
wxPoint
GetPosition
()
const
{
return
DoGetPosition
();
}
/**
* Mirror the draw object along the horizontal (X) axis about a point.
...
...
@@ -345,7 +343,7 @@ public:
*
* @return Width of draw object.
*/
int
GetWidth
()
{
return
DoGetWidth
();
}
int
GetWidth
()
const
{
return
DoGetWidth
();
}
void
SetWidth
(
int
aWidth
)
{
DoSetWidth
(
aWidth
);
}
/**
...
...
@@ -356,30 +354,14 @@ public:
*
* @return - True if draw object can be fill. Default is false.
*/
bool
IsFillable
()
{
return
m_isFillable
;
}
/**
* Return the modified status of the draw object.
*
* @return - True if the draw object has been modified.
*/
bool
IsModified
()
{
return
(
m_Flags
&
IS_CHANGED
)
!=
0
;
}
/**
* Return the new item status of the draw object.
*
* @return - True if the draw item has been added to the parent component.
*/
bool
IsNew
()
{
return
(
m_Flags
&
IS_NEW
)
!=
0
;
}
bool
IsMoving
()
{
return
(
m_Flags
&
IS_MOVED
);
}
bool
IsResizing
()
{
return
(
m_Flags
&
IS_RESIZED
);
}
bool
IsFillable
()
const
{
return
m_isFillable
;
}
/**
* Return the draw item editing mode status.
*
* @return - True if the item is being edited.
*/
bool
InEditMode
()
{
return
(
m_Flags
&
(
IS_NEW
|
IS_MOVED
|
IS_RESIZED
)
)
!=
0
;
}
bool
InEditMode
()
const
{
return
(
m_Flags
&
(
IS_NEW
|
IS_MOVED
|
IS_RESIZED
)
)
!=
0
;
}
void
SetEraseLastDrawItem
(
bool
aErase
=
true
)
{
m_eraseLastDrawItem
=
aErase
;
}
...
...
@@ -387,11 +369,15 @@ public:
void
SetUnit
(
int
aUnit
)
{
m_Unit
=
aUnit
;
}
int
GetUnit
()
{
return
m_Unit
;
}
int
GetUnit
()
const
{
return
m_Unit
;
}
void
SetConvert
(
int
aConvert
)
{
m_Convert
=
aConvert
;
}
int
GetConvert
()
{
return
m_Convert
;
}
int
GetConvert
()
const
{
return
m_Convert
;
}
void
SetFillMode
(
FILL_T
aFillMode
)
{
m_Fill
=
aFillMode
;
}
FILL_T
GetFillMode
()
const
{
return
m_Fill
;
}
protected
:
virtual
LIB_DRAW_ITEM
*
DoGenCopy
()
=
0
;
...
...
@@ -409,13 +395,13 @@ protected:
*/
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
=
0
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
)
=
0
;
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
=
0
;
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
=
0
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
)
=
0
;
virtual
wxPoint
DoGetPosition
()
=
0
;
virtual
wxPoint
DoGetPosition
()
const
=
0
;
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
)
=
0
;
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
)
=
0
;
virtual
int
DoGetWidth
()
=
0
;
virtual
int
DoGetWidth
()
const
=
0
;
virtual
void
DoSetWidth
(
int
aWidth
)
=
0
;
/** Flag to indicate if draw item is fillable. Default is false. */
...
...
eeschema/lib_export.cpp
View file @
6566b0c5
...
...
@@ -34,10 +34,10 @@ extern int ExportPartId;
*/
void
WinEDA_LibeditFrame
::
OnImportPart
(
wxCommandEvent
&
event
)
{
wxString
errMsg
;
wxFileName
fn
;
CMP_LIBRARY
*
LibTmp
;
CMP_LIB_ENTRY
*
LibEntry
;
wxString
errMsg
;
wxFileName
fn
;
CMP_LIBRARY
*
LibTmp
;
LIB_ALIAS
*
LibEntry
;
m_lastDrawItem
=
NULL
;
...
...
@@ -61,8 +61,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
{
wxString
msg
;
msg
.
Printf
(
_
(
"Component library file <%s> is empty."
),
GetChars
(
fn
.
GetFullPath
()
)
);
msg
.
Printf
(
_
(
"Component library file <%s> is empty."
),
GetChars
(
fn
.
GetFullPath
()
)
);
DisplayError
(
this
,
msg
);
return
;
}
...
...
eeschema/lib_field.cpp
View file @
6566b0c5
...
...
@@ -484,7 +484,7 @@ void LIB_FIELD::DoOffset( const wxPoint& offset )
}
bool
LIB_FIELD
::
DoTestInside
(
EDA_Rect
&
rect
)
bool
LIB_FIELD
::
DoTestInside
(
EDA_Rect
&
rect
)
const
{
/*
* FIXME: This fails to take into acount the size and/or orientation of
...
...
eeschema/lib_field.h
View file @
6566b0c5
...
...
@@ -214,13 +214,13 @@ protected:
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
other
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
offset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
rect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
rect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
newPosition
);
virtual
wxPoint
DoGetPosition
(
void
)
{
return
m_Pos
;
}
virtual
wxPoint
DoGetPosition
(
void
)
const
{
return
m_Pos
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
center
);
virtual
void
DoPlot
(
PLOTTER
*
plotter
,
const
wxPoint
&
offset
,
bool
fill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
(
void
)
{
return
m_Width
;
}
virtual
int
DoGetWidth
(
void
)
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
width
)
{
m_Width
=
width
;
}
};
...
...
eeschema/lib_pin.cpp
View file @
6566b0c5
...
...
@@ -1465,7 +1465,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
/* return the pin end position, for a component in normal orient */
wxPoint
LIB_PIN
::
ReturnPinEndPoint
()
wxPoint
LIB_PIN
::
ReturnPinEndPoint
()
const
{
wxPoint
pos
=
m_Pos
;
...
...
@@ -1642,7 +1642,7 @@ void LIB_PIN::DoOffset( const wxPoint& offset )
}
bool
LIB_PIN
::
DoTestInside
(
EDA_Rect
&
rect
)
bool
LIB_PIN
::
DoTestInside
(
EDA_Rect
&
rect
)
const
{
wxPoint
end
=
ReturnPinEndPoint
();
...
...
eeschema/lib_pin.h
View file @
6566b0c5
...
...
@@ -155,7 +155,7 @@ public:
virtual
void
DisplayInfo
(
WinEDA_DrawFrame
*
frame
);
virtual
EDA_Rect
GetBoundingBox
();
wxPoint
ReturnPinEndPoint
();
wxPoint
ReturnPinEndPoint
()
const
;
int
ReturnPinDrawOrient
(
const
TRANSFORM
&
aTransform
);
...
...
@@ -433,13 +433,13 @@ protected:
*/
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_Pos
;
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_Pos
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
...
...
eeschema/lib_polyline.cpp
View file @
6566b0c5
...
...
@@ -8,7 +8,6 @@
#include "class_drawpanel.h"
#include "plot_common.h"
#include "trigo.h"
#include "bezier_curves.h"
#include "general.h"
#include "protos.h"
...
...
@@ -155,7 +154,7 @@ void LIB_POLYLINE::DoOffset( const wxPoint& aOffset )
}
bool
LIB_POLYLINE
::
DoTestInside
(
EDA_Rect
&
aRect
)
bool
LIB_POLYLINE
::
DoTestInside
(
EDA_Rect
&
aRect
)
const
{
for
(
size_t
i
=
0
;
i
<
m_PolyPoints
.
size
();
i
++
)
{
...
...
@@ -252,7 +251,7 @@ void LIB_POLYLINE::drawGraphic( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoi
else
color
=
aColor
;
// Set the size of the buffer o
d
coordinates
// Set the size of the buffer o
f
coordinates
if
(
Buf_Poly_Drawings
==
NULL
)
{
Buf_Poly_Size
=
m_PolyPoints
.
size
();
...
...
eeschema/lib_polyline.h
View file @
6566b0c5
...
...
@@ -11,6 +11,10 @@
class
LIB_POLYLINE
:
public
LIB_DRAW_ITEM
{
int
m_Width
;
// Line width
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// list of points (>= 2)
int
m_ModifyIndex
;
// Index of the polyline point to modify
std
::
vector
<
wxPoint
>
m_savedPolyPoints
;
/**
...
...
@@ -30,17 +34,13 @@ class LIB_POLYLINE : public LIB_DRAW_ITEM
void
restoreAttributes
();
/**
* Calculate the polyline attributes r
a
lative to \a aPosition while editing.
* Calculate the polyline attributes r
e
lative to \a aPosition while editing.
*
* @param aPosition - Edit position in drawing units.
*/
void
calcEdit
(
const
wxPoint
&
aPosition
);
public
:
int
m_Width
;
/* Line width */
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// list of points (>= 2)
int
m_ModifyIndex
;
// Index of the polyline point to modify
public
:
LIB_POLYLINE
(
LIB_COMPONENT
*
aParent
);
LIB_POLYLINE
(
const
LIB_POLYLINE
&
aPolyline
);
...
...
@@ -120,7 +120,7 @@ protected:
virtual
LIB_DRAW_ITEM
*
DoGenCopy
();
/**
* Provide the p
lo
yline segment draw object specific comparison.
* Provide the p
ol
yline segment draw object specific comparison.
*
* The sort order for each polyline segment point is as follows:
* - Line segment point horizontal (X) position.
...
...
@@ -129,13 +129,13 @@ protected:
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_PolyPoints
[
0
];
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_PolyPoints
[
0
];
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
...
...
eeschema/lib_rectangle.cpp
View file @
6566b0c5
...
...
@@ -116,7 +116,7 @@ void LIB_RECTANGLE::DoOffset( const wxPoint& aOffset )
}
bool
LIB_RECTANGLE
::
DoTestInside
(
EDA_Rect
&
aRect
)
bool
LIB_RECTANGLE
::
DoTestInside
(
EDA_Rect
&
aRect
)
const
{
return
aRect
.
Inside
(
m_Pos
.
x
,
-
m_Pos
.
y
)
||
aRect
.
Inside
(
m_End
.
x
,
-
m_End
.
y
);
}
...
...
eeschema/lib_rectangle.h
View file @
6566b0c5
...
...
@@ -11,7 +11,14 @@
class
LIB_RECTANGLE
:
public
LIB_DRAW_ITEM
{
wxPoint
m_savedEndPos
;
///< Tempory storage of the current end position before editing.
wxPoint
m_End
;
// Rectangle end point.
wxPoint
m_Pos
;
// Rectangle start point.
int
m_Width
;
// Line width
bool
m_isWidthLocked
;
// Flag: Keep width locked
bool
m_isHeightLocked
;
// Flag: Keep height locked
bool
m_isStartPointSelected
;
// Flag: is the upper left edge selected?
wxPoint
m_savedEndPos
;
// Temporary storage of current end position before editing.
/**
* Draw the rectangle.
...
...
@@ -30,20 +37,13 @@ class LIB_RECTANGLE : public LIB_DRAW_ITEM
void
restoreAttributes
();
/**
* Calculate the rectangle attr
ubites ra
lative to \a aPosition while editing.
* Calculate the rectangle attr
ibutes re
lative to \a aPosition while editing.
*
* @param aPosition - Edit position in drawing units.
*/
void
calcEdit
(
const
wxPoint
&
aPosition
);
public
:
wxPoint
m_End
;
/* Rectangle end point. */
wxPoint
m_Pos
;
/* Rectangle start point. */
int
m_Width
;
/* Line width */
bool
m_isWidthLocked
;
/* Flag: Keep width locked */
bool
m_isHeightLocked
;
/* Flag: Keep height locked */
bool
m_isStartPointSelected
;
/* Flag: is the upper left edge selected ? */
public
:
LIB_RECTANGLE
(
LIB_COMPONENT
*
aParent
);
LIB_RECTANGLE
(
const
LIB_RECTANGLE
&
aRect
);
...
...
@@ -53,6 +53,7 @@ public:
return
wxT
(
"LIB_RECTANGLE"
);
}
void
SetEndPosition
(
const
wxPoint
&
aPosition
)
{
m_End
=
aPosition
;
}
/**
* Write rectangle object out to a FILE in "*.lib" format.
...
...
@@ -118,15 +119,15 @@ protected:
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_Pos
;
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_Pos
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
#endif // _LIB_RE
A
CTANGLE_H_
#endif // _LIB_RECTANGLE_H_
eeschema/lib_text.cpp
View file @
6566b0c5
...
...
@@ -227,7 +227,7 @@ void LIB_TEXT::DoOffset( const wxPoint& offset )
}
bool
LIB_TEXT
::
DoTestInside
(
EDA_Rect
&
rect
)
bool
LIB_TEXT
::
DoTestInside
(
EDA_Rect
&
rect
)
const
{
/*
* FIXME: This should calculate the text size and justification and
...
...
eeschema/lib_text.h
View file @
6566b0c5
...
...
@@ -144,13 +144,13 @@ protected:
virtual
int
DoCompare
(
const
LIB_DRAW_ITEM
&
aOther
)
const
;
virtual
void
DoOffset
(
const
wxPoint
&
aOffset
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
);
virtual
bool
DoTestInside
(
EDA_Rect
&
aRect
)
const
;
virtual
void
DoMove
(
const
wxPoint
&
aPosition
);
virtual
wxPoint
DoGetPosition
()
{
return
m_Pos
;
}
virtual
wxPoint
DoGetPosition
()
const
{
return
m_Pos
;
}
virtual
void
DoMirrorHorizontal
(
const
wxPoint
&
aCenter
);
virtual
void
DoPlot
(
PLOTTER
*
aPlotter
,
const
wxPoint
&
aOffset
,
bool
aFill
,
const
TRANSFORM
&
aTransform
);
virtual
int
DoGetWidth
()
{
return
m_Width
;
}
virtual
int
DoGetWidth
()
const
{
return
m_Width
;
}
virtual
void
DoSetWidth
(
int
aWidth
)
{
m_Width
=
aWidth
;
}
};
...
...
eeschema/libedit.cpp
View file @
6566b0c5
...
...
@@ -59,15 +59,15 @@ void WinEDA_LibeditFrame::SelectActiveLibrary()
*/
void
WinEDA_LibeditFrame
::
LoadOneLibraryPart
(
wxCommandEvent
&
event
)
{
int
i
;
wxString
msg
;
wxString
CmpName
;
CMP_LIB_ENTRY
*
LibEntry
=
NULL
;
int
i
;
wxString
msg
;
wxString
CmpName
;
LIB_ALIAS
*
LibEntry
=
NULL
;
DrawPanel
->
UnManageCursor
(
0
,
wxCURSOR_ARROW
);
if
(
GetBaseScreen
()
->
IsModify
()
&&
!
IsOK
(
this
,
_
(
"Current part not \
saved.
\n\n
Discard current changes?"
)
)
)
if
(
GetBaseScreen
()
->
IsModify
()
&&
!
IsOK
(
this
,
_
(
"Current part not
saved.
\n\n
Discard current changes?"
)
)
)
return
;
// No current lib, ask user for the library to use.
...
...
@@ -97,7 +97,7 @@ saved.\n\nDiscard current changes?" ) ) )
if
(
LibEntry
==
NULL
)
{
msg
.
Printf
(
_
(
"Component
or alias
name
\"
%s
\"
not found in library
\"
%s
\"
."
),
msg
.
Printf
(
_
(
"Component name
\"
%s
\"
not found in library
\"
%s
\"
."
),
GetChars
(
CmpName
),
GetChars
(
m_library
->
GetName
()
)
);
DisplayError
(
this
,
msg
);
...
...
@@ -125,7 +125,7 @@ saved.\n\nDiscard current changes?" ) ) )
* 1 if error
* m_component advanced copy and created
*/
bool
WinEDA_LibeditFrame
::
LoadOneLibraryPartAux
(
CMP_LIB_ENTRY
*
aEntry
,
CMP_LIBRARY
*
aLibrary
)
bool
WinEDA_LibeditFrame
::
LoadOneLibraryPartAux
(
LIB_ALIAS
*
aEntry
,
CMP_LIBRARY
*
aLibrary
)
{
wxString
msg
,
cmpName
,
rootName
;
LIB_COMPONENT
*
component
;
...
...
@@ -142,21 +142,14 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* aEntry, CMP_LIBR
cmpName
=
m_aliasName
=
aEntry
->
GetName
();
if
(
aEntry
->
isAlias
()
)
{
LIB_ALIAS
*
alias
=
(
LIB_ALIAS
*
)
aEntry
;
component
=
alias
->
GetComponent
();
LIB_ALIAS
*
alias
=
(
LIB_ALIAS
*
)
aEntry
;
component
=
alias
->
GetComponent
();
wxASSERT
(
component
!=
NULL
&&
component
->
isComponent
()
);
wxASSERT
(
component
!=
NULL
);
wxLogDebug
(
wxT
(
"
\"
<%s>
\"
is alias of
\"
<%s>
\"
"
),
GetChars
(
cmpName
),
GetChars
(
component
->
GetName
()
)
);
}
else
{
component
=
(
LIB_COMPONENT
*
)
aEntry
;
}
wxLogDebug
(
wxT
(
"
\"
<%s>
\"
is alias of
\"
<%s>
\"
"
),
GetChars
(
cmpName
),
GetChars
(
component
->
GetName
()
)
);
if
(
m_component
)
{
...
...
@@ -376,10 +369,10 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
*/
void
WinEDA_LibeditFrame
::
DeleteOnePart
(
wxCommandEvent
&
event
)
{
wxString
CmpName
;
CMP_LIB_ENTRY
*
LibEntry
;
wxArrayString
ListNames
;
wxString
msg
;
wxString
CmpName
;
LIB_ALIAS
*
LibEntry
;
wxArrayString
ListNames
;
wxString
msg
;
DrawPanel
->
UnManageCursor
(
0
,
wxCURSOR_ARROW
);
...
...
@@ -448,7 +441,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
All changes will be lost. Discard changes?"
)
)
)
return
;
CMP_LIB_ENTRY
*
nextEntry
=
m_library
->
RemoveEntry
(
LibEntry
);
LIB_ALIAS
*
nextEntry
=
m_library
->
RemoveEntry
(
LibEntry
);
if
(
nextEntry
!=
NULL
)
{
...
...
@@ -618,8 +611,6 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
m_drawItem
=
m_lastDrawItem
=
NULL
;
wxASSERT
(
m_component
->
isComponent
()
);
if
(
oldComponent
!=
NULL
)
Component
=
m_library
->
ReplaceComponent
(
oldComponent
,
m_component
);
else
...
...
eeschema/libedit_onleftclick.cpp
View file @
6566b0c5
...
...
@@ -161,7 +161,9 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
}
if
(
m_drawItem
==
NULL
)
{
EditComponentProperties
();
wxCommandEvent
cmd
(
wxEVT_COMMAND_MENU_SELECTED
);
cmd
.
SetId
(
ID_LIBEDIT_GET_FRAME_EDIT_PART
);
GetEventHandler
()
->
ProcessEvent
(
cmd
);
}
}
...
...
eeschema/libeditframe.h
View file @
6566b0c5
...
...
@@ -24,9 +24,9 @@ class Dialog_BodyGraphicText_Properties;
class
WinEDA_LibeditFrame
:
public
WinEDA_DrawFrame
{
LIB_COMPONENT
*
m_tempCopyComponent
;
///< Temporary copy of current component during edit.
wxString
m_oldRootName
;
///< The actual pointer of the component loaded from
///< a library. Do not do anything with this pointer.
///< It is to be used for reference purposes only.
wxString
m_oldRootName
;
///< The actual pointer of the component loaded from
///< a library. Do not do anything with this pointer.
///< It is to be used for reference purposes only.
public
:
WinEDAChoiceBox
*
m_SelpartBox
;
// a Box to select a part to edit (if any)
...
...
@@ -210,10 +210,9 @@ private:
void
SelectActiveLibrary
();
void
SaveActiveLibrary
(
wxCommandEvent
&
event
);
bool
LoadOneLibraryPartAux
(
CMP_LIB_ENTRY
*
LibEntry
,
CMP_LIBRARY
*
Library
);
bool
LoadOneLibraryPartAux
(
LIB_ALIAS
*
LibEntry
,
CMP_LIBRARY
*
Library
);
void
DisplayCmpDoc
();
void
EditComponentProperties
();
// General editing
public
:
...
...
eeschema/netform.cpp
View file @
6566b0c5
...
...
@@ -722,11 +722,11 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
xlibpart
->
AddAttribute
(
sPart
,
lcomp
->
GetName
()
);
//----- show the important properties -------------------------
if
(
!
lcomp
->
GetDescription
().
IsEmpty
()
)
xlibpart
->
AddChild
(
node
(
sDescr
,
lcomp
->
GetDescription
()
)
);
if
(
!
lcomp
->
Get
Alias
(
0
)
->
Get
Description
().
IsEmpty
()
)
xlibpart
->
AddChild
(
node
(
sDescr
,
lcomp
->
Get
Alias
(
0
)
->
Get
Description
()
)
);
if
(
!
lcomp
->
GetDocFileName
().
IsEmpty
()
)
xlibpart
->
AddChild
(
node
(
sDocs
,
lcomp
->
GetDocFileName
()
)
);
if
(
!
lcomp
->
Get
Alias
(
0
)
->
Get
DocFileName
().
IsEmpty
()
)
xlibpart
->
AddChild
(
node
(
sDocs
,
lcomp
->
GetAlias
(
0
)
->
GetDocFileName
()
)
);
// Write the footprint list
if
(
lcomp
->
GetFootPrints
().
GetCount
()
)
...
...
@@ -1581,10 +1581,10 @@ void EXPORT_HELP::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
{
wxASSERT
(
pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
);
if
(
pin
->
m_Unit
&&
pin
->
m_Unit
!=
unit2
)
if
(
pin
->
GetUnit
()
&&
pin
->
GetUnit
()
!=
unit2
)
continue
;
if
(
pin
->
m_Convert
&&
pin
->
m_Convert
!=
comp2
->
m_Convert
)
if
(
pin
->
GetConvert
()
&&
pin
->
GetConvert
()
!=
comp2
->
m_Convert
)
continue
;
// A suitable pin is found: add it to the current list
...
...
eeschema/netlist.cpp
View file @
6566b0c5
...
...
@@ -594,12 +594,11 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
{
wxASSERT
(
pin
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
);
if
(
pin
->
m_Unit
&&
(
pin
->
m_Unit
!=
DrawLibItem
->
GetUnitSelection
(
sheetlist
)
)
)
if
(
pin
->
GetUnit
()
&&
(
pin
->
GetUnit
()
!=
DrawLibItem
->
GetUnitSelection
(
sheetlist
)
)
)
continue
;
if
(
pin
->
m_Convert
&&
(
pin
->
m_Convert
!=
DrawLibItem
->
m_Convert
)
)
if
(
pin
->
GetConvert
()
&&
(
pin
->
GetConvert
()
!=
DrawLibItem
->
m_Convert
)
)
continue
;
wxPoint
pos2
=
DrawLibItem
->
m_Transform
.
TransformCoordinate
(
pin
->
m_Pos
)
+
...
...
eeschema/onrightclick.cpp
View file @
6566b0c5
...
...
@@ -244,18 +244,13 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
}
wxString
msg
;
CMP_LIB_ENTRY
*
libEntry
;
LIB_ALIAS
*
libEntry
;
LIB_COMPONENT
*
libComponent
=
NULL
;
libEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
Component
->
m_ChipName
);
if
(
libEntry
)
{
if
(
libEntry
->
isAlias
()
)
libComponent
=
(
(
LIB_ALIAS
*
)
libEntry
)
->
GetComponent
();
else
libComponent
=
(
LIB_COMPONENT
*
)
libEntry
;
}
libComponent
=
libEntry
->
GetComponent
();
if
(
!
Component
->
m_Flags
)
{
...
...
eeschema/pinedit.cpp
View file @
6566b0c5
...
...
@@ -105,8 +105,8 @@ void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event )
dlg
.
SetLength
(
ReturnStringFromValue
(
g_UserUnit
,
pin
->
m_PinLen
,
m_InternalUnits
)
);
dlg
.
SetLengthUnits
(
units
);
dlg
.
SetAddToAllParts
(
pin
->
m_Unit
==
0
);
dlg
.
SetAddToAllBodyStyles
(
pin
->
m_Convert
==
0
);
dlg
.
SetAddToAllParts
(
pin
->
GetUnit
()
==
0
);
dlg
.
SetAddToAllBodyStyles
(
pin
->
GetConvert
()
==
0
);
dlg
.
SetVisible
(
pin
->
IsVisible
()
);
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
...
...
@@ -429,9 +429,9 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
m_drawItem
=
pin
;
pin
->
m_Flags
=
IS_NEW
;
pin
->
m_Unit
=
m_unit
;
pin
->
m_Convert
=
m_convert
;
pin
->
m_Flags
=
IS_NEW
;
pin
->
SetUnit
(
m_unit
)
;
pin
->
SetConvert
(
m_convert
)
;
/* Flag pins to consider */
if
(
g_EditPinByPinIsOn
==
false
)
...
...
@@ -447,14 +447,14 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
pin
->
m_PinNumSize
=
LastPinNumSize
;
if
(
LastPinCommonConvert
)
pin
->
m_Convert
=
0
;
pin
->
SetConvert
(
0
)
;
else
pin
->
m_Convert
=
m_convert
;
pin
->
SetConvert
(
m_convert
)
;
if
(
LastPinCommonUnit
)
pin
->
m_Unit
=
0
;
pin
->
SetUnit
(
0
)
;
else
pin
->
m_Unit
=
m_unit
;
pin
->
SetUnit
(
m_unit
)
;
if
(
LastPinVisible
)
pin
->
m_Attributs
&=
~
PINNOTDRAW
;
...
...
@@ -497,38 +497,38 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorga
if
(
g_EditPinByPinIsOn
)
return
;
if
(
asDeMorgan
&&
(
Pin
->
m_Convert
!=
0
)
)
if
(
asDeMorgan
&&
(
Pin
->
GetConvert
()
!=
0
)
)
CreateConv
=
true
;
/* Create "convert" pin at the current position. */
if
(
CreateConv
==
true
)
{
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
if
(
Pin
->
m_Convert
>
1
)
NewPin
->
m_Convert
=
1
;
if
(
Pin
->
GetConvert
()
>
1
)
NewPin
->
SetConvert
(
1
)
;
else
NewPin
->
m_Convert
=
2
;
NewPin
->
SetConvert
(
2
)
;
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
}
for
(
ii
=
1
;
ii
<=
Pin
->
GetParent
()
->
GetPartCount
();
ii
++
)
{
if
(
ii
==
unit
||
Pin
->
m_Unit
==
0
)
if
(
ii
==
unit
||
Pin
->
GetUnit
()
==
0
)
continue
;
/* Pin common to all units. */
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
if
(
convert
!=
0
)
NewPin
->
m_Convert
=
1
;
NewPin
->
m_Unit
=
ii
;
NewPin
->
SetConvert
(
1
)
;
NewPin
->
SetUnit
(
ii
)
;
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
if
(
CreateConv
==
false
)
continue
;
NewPin
=
(
LIB_PIN
*
)
Pin
->
GenCopy
();
NewPin
->
m_Convert
=
2
;
if
(
Pin
->
m_Unit
!=
0
)
NewPin
->
m_Unit
=
ii
;
NewPin
->
SetConvert
(
2
)
;
if
(
Pin
->
GetUnit
()
!=
0
)
NewPin
->
SetUnit
(
ii
)
;
Pin
->
GetParent
()
->
AddDrawItem
(
NewPin
);
}
}
...
...
@@ -558,7 +558,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
Pin
=
m_component
->
GetNextPin
();
for
(
;
Pin
!=
NULL
;
Pin
=
m_component
->
GetNextPin
(
Pin
)
)
{
if
(
(
Pin
->
m_Convert
)
&&
(
Pin
->
m_Convert
!=
m_convert
)
)
if
(
(
Pin
->
GetConvert
()
)
&&
(
Pin
->
GetConvert
()
!=
m_convert
)
)
continue
;
// Is it the "selected mode" ?
...
...
@@ -639,11 +639,11 @@ bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
if
(
test
==
0
)
{
test
=
ref
->
m_Convert
-
tst
->
m_Convert
;
test
=
ref
->
GetConvert
()
-
tst
->
GetConvert
()
;
}
if
(
test
==
0
)
{
test
=
ref
->
m_Unit
-
tst
->
m_Unit
;
test
=
ref
->
GetUnit
()
-
tst
->
GetUnit
()
;
}
return
test
<
0
;
}
...
...
@@ -693,8 +693,8 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
Pin
=
PinList
[
ii
-
1
];
if
(
Pin
->
m_PinNum
!=
curr_pin
->
m_PinNum
||
Pin
->
m_Convert
!=
curr_pin
->
m_Convert
||
Pin
->
m_Unit
!=
curr_pin
->
m_Unit
)
||
Pin
->
GetConvert
()
!=
curr_pin
->
GetConvert
()
||
Pin
->
GetUnit
()
!=
curr_pin
->
GetUnit
()
)
continue
;
dup_error
++
;
...
...
@@ -713,13 +713,13 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
if
(
m_component
->
GetPartCount
()
>
1
)
{
aux_msg
.
Printf
(
_
(
" in part %c"
),
'A'
+
curr_pin
->
m_Unit
);
aux_msg
.
Printf
(
_
(
" in part %c"
),
'A'
+
curr_pin
->
GetUnit
()
);
msg
+=
aux_msg
;
}
if
(
m_showDeMorgan
)
{
if
(
curr_pin
->
m_Convert
)
if
(
curr_pin
->
GetConvert
()
)
msg
+=
_
(
" of converted"
);
else
msg
+=
_
(
" of normal"
);
...
...
@@ -752,13 +752,13 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
if
(
m_component
->
GetPartCount
()
>
1
)
{
aux_msg
.
Printf
(
_
(
" in part %c"
),
'A'
+
Pin
->
m_Unit
);
aux_msg
.
Printf
(
_
(
" in part %c"
),
'A'
+
Pin
->
GetUnit
()
);
msg
+=
aux_msg
;
}
if
(
m_showDeMorgan
)
{
if
(
Pin
->
m_Convert
)
if
(
Pin
->
GetConvert
()
)
msg
+=
_
(
" of converted"
);
else
msg
+=
_
(
" of normal"
);
...
...
eeschema/schedit.cpp
View file @
6566b0c5
...
...
@@ -637,14 +637,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
screen
->
GetCurItem
()
==
NULL
)
break
;
{
CMP_LIB_ENTRY
*
LibEntry
;
LIB_ALIAS
*
LibEntry
;
LibEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
(
(
SCH_COMPONENT
*
)
screen
->
GetCurItem
()
)
->
m_ChipName
);
if
(
LibEntry
&&
LibEntry
->
GetDocFileName
()
!=
wxEmptyString
)
{
GetAssociatedDocument
(
this
,
LibEntry
->
GetDocFileName
(),
&
wxGetApp
().
GetLibraryPathList
()
);
&
wxGetApp
().
GetLibraryPathList
()
);
}
}
break
;
...
...
eeschema/symbdraw.cpp
View file @
6566b0c5
...
...
@@ -36,7 +36,7 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
LIB_COMPONENT
*
component
=
DrawItem
->
GetParent
();
DIALOG_LIB_EDIT_DRAW_ITEM
dialog
(
this
,
DrawItem
->
m_typeName
);
DIALOG_LIB_EDIT_DRAW_ITEM
dialog
(
this
,
DrawItem
->
GetTypeName
()
);
dialog
.
SetWidthUnits
(
ReturnUnitSymbol
(
g_UserUnit
)
);
...
...
@@ -47,7 +47,7 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
dialog
.
SetApplyToAllConversions
(
!
m_drawSpecificConvert
);
dialog
.
EnableApplyToAllConversions
(
component
&&
component
->
HasConversion
()
);
// dialog.SetFillStyle( m_drawFillStyle ); // could better to show the current setting
dialog
.
SetFillStyle
(
DrawItem
->
m_Fill
);
dialog
.
SetFillStyle
(
DrawItem
->
GetFillMode
()
);
dialog
.
EnableFillStyle
(
DrawItem
->
IsFillable
()
);
if
(
dialog
.
ShowModal
()
==
wxID_CANCEL
)
...
...
@@ -73,17 +73,17 @@ void WinEDA_LibeditFrame::EditGraphicSymbol( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
SaveCopyInUndoList
(
DrawItem
->
GetParent
()
);
if
(
m_drawSpecificUnit
)
DrawItem
->
m_Unit
=
GetUnit
(
);
DrawItem
->
SetUnit
(
GetUnit
()
);
else
DrawItem
->
m_Unit
=
0
;
DrawItem
->
SetUnit
(
0
)
;
if
(
m_drawSpecificConvert
)
DrawItem
->
m_Convert
=
GetConvert
(
);
DrawItem
->
SetConvert
(
GetConvert
()
);
else
DrawItem
->
m_Convert
=
0
;
DrawItem
->
SetConvert
(
0
)
;
if
(
DrawItem
->
IsFillable
()
)
DrawItem
->
m_Fill
=
(
FILL_T
)
dialog
.
GetFillStyle
(
);
DrawItem
->
SetFillMode
(
(
FILL_T
)
dialog
.
GetFillStyle
()
);
DrawItem
->
SetWidth
(
m_drawLineWidth
);
...
...
@@ -183,12 +183,12 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
{
m_drawItem
->
BeginEdit
(
IS_NEW
,
drawPos
);
m_drawItem
->
SetWidth
(
m_drawLineWidth
);
m_drawItem
->
m_Fill
=
m_drawFillStyle
;
m_drawItem
->
SetFillMode
(
m_drawFillStyle
)
;
if
(
m_drawSpecificUnit
)
m_drawItem
->
m_Unit
=
m_unit
;
m_drawItem
->
SetUnit
(
m_unit
)
;
if
(
m_drawSpecificConvert
)
m_drawItem
->
m_Convert
=
m_convert
;
m_drawItem
->
SetConvert
(
m_convert
)
;
// Draw initial symbol:
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
...
...
@@ -253,8 +253,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
SetCursor
(
wxCURSOR_HAND
);
if
(
m_drawItem
->
m_Unit
!=
m_unit
)
m_drawItem
->
m_Unit
=
m_unit
;
if
(
m_drawItem
->
GetUnit
()
!=
m_unit
)
m_drawItem
->
SetUnit
(
m_unit
)
;
TempCopyComponent
();
m_drawItem
->
BeginEdit
(
IS_MOVED
,
GetScreen
()
->
GetCursorDrawPosition
()
);
...
...
eeschema/symbedit.cpp
View file @
6566b0c5
...
...
@@ -91,10 +91,10 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
{
if
(
item
.
Type
()
==
COMPONENT_FIELD_DRAW_TYPE
)
continue
;
if
(
item
.
m_Unit
)
item
.
m_Unit
=
m_unit
;
if
(
item
.
m_Convert
)
item
.
m_Convert
=
m_convert
;
if
(
item
.
GetUnit
()
)
item
.
SetUnit
(
m_unit
)
;
if
(
item
.
GetConvert
()
)
item
.
SetConvert
(
m_convert
)
;
item
.
m_Flags
=
IS_NEW
;
item
.
m_Selected
=
IS_SELECTED
;
...
...
@@ -202,9 +202,9 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if
(
item
.
Type
()
==
COMPONENT_FIELD_DRAW_TYPE
)
continue
;
/* Don't save unused parts or alternate body styles. */
if
(
m_unit
&&
item
.
m_Unit
&&
(
item
.
m_Unit
!=
m_unit
)
)
if
(
m_unit
&&
item
.
GetUnit
()
&&
(
item
.
GetUnit
()
!=
m_unit
)
)
continue
;
if
(
m_convert
&&
item
.
m_Convert
&&
(
item
.
m_Convert
!=
m_convert
)
)
if
(
m_convert
&&
item
.
GetConvert
()
&&
(
item
.
GetConvert
()
!=
m_convert
)
)
continue
;
if
(
!
item
.
Save
(
file
.
fp
()
)
)
...
...
eeschema/tool_viewlib.cpp
View file @
6566b0c5
...
...
@@ -17,16 +17,16 @@
void
WinEDA_ViewlibFrame
::
ReCreateHToolbar
()
{
int
ii
;
wxString
msg
;
int
ii
;
wxString
msg
;
CMP_LIBRARY
*
lib
;
LIB_COMPONENT
*
component
=
NULL
;
CMP_LIB_ENTRY
*
entry
=
NULL
;
LIB_ALIAS
*
entry
=
NULL
;
bool
asdeMorgan
=
false
;
if
(
m_HToolBar
==
NULL
)
{
m_HToolBar
=
new
WinEDA_Toolbar
(
TOOLBAR_MAIN
,
this
,
ID_H_TOOLBAR
,
true
);
m_HToolBar
=
new
WinEDA_Toolbar
(
TOOLBAR_MAIN
,
this
,
ID_H_TOOLBAR
,
true
);
// Set up toolbar
m_HToolBar
->
AddTool
(
ID_LIBVIEW_SELECT_LIB
,
wxEmptyString
,
...
...
@@ -105,8 +105,7 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
m_HToolBar
->
Realize
();
}
if
(
(
m_libraryName
!=
wxEmptyString
)
&&
(
m_entryName
!=
wxEmptyString
)
)
if
(
(
m_libraryName
!=
wxEmptyString
)
&&
(
m_entryName
!=
wxEmptyString
)
)
{
lib
=
CMP_LIBRARY
::
FindLibrary
(
m_libraryName
);
...
...
eeschema/viewlibs.cpp
View file @
6566b0c5
...
...
@@ -25,9 +25,9 @@
void
WinEDA_ViewlibFrame
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
{
wxString
msg
;
CMP_LIB_ENTRY
*
LibEntry
;
int
ii
,
id
=
event
.
GetId
();
wxString
msg
;
LIB_ALIAS
*
LibEntry
;
int
ii
,
id
=
event
.
GetId
();
switch
(
id
)
{
...
...
@@ -48,8 +48,7 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_LIBVIEW_VIEWDOC
:
LibEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
m_entryName
,
m_libraryName
);
LibEntry
=
CMP_LIBRARY
::
FindLibraryEntry
(
m_entryName
,
m_libraryName
);
if
(
LibEntry
&&
(
!
LibEntry
->
GetDocFileName
().
IsEmpty
()
)
)
GetAssociatedDocument
(
this
,
LibEntry
->
GetDocFileName
(),
...
...
@@ -168,7 +167,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
return
;
}
CMP_LIB_ENTRY
*
LibEntry
=
Lib
->
FindEntry
(
m_entryName
);
LIB_ALIAS
*
LibEntry
=
Lib
->
FindEntry
(
m_entryName
);
if
(
LibEntry
==
NULL
)
return
;
...
...
@@ -186,9 +185,9 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
/*************************************************/
void
WinEDA_ViewlibFrame
::
ViewOneLibraryContent
(
CMP_LIBRARY
*
Lib
,
int
Flag
)
{
int
NumOfParts
=
0
;
CMP_LIB_ENTRY
*
LibEntry
;
wxString
CmpName
;
int
NumOfParts
=
0
;
LIB_ALIAS
*
LibEntry
;
wxString
CmpName
;
if
(
Lib
)
NumOfParts
=
Lib
->
GetCount
();
...
...
@@ -249,7 +248,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
void
WinEDA_ViewlibFrame
::
RedrawActiveWindow
(
wxDC
*
DC
,
bool
EraseBg
)
{
LIB_COMPONENT
*
component
;
CMP_LIB_ENTRY
*
entry
;
LIB_ALIAS
*
entry
;
CMP_LIBRARY
*
lib
;
wxString
msg
;
wxString
tmp
;
...
...
@@ -266,22 +265,17 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if
(
entry
==
NULL
)
return
;
wxCHECK_RET
(
entry
->
isAlias
(),
wxT
(
"Entry
\"
"
)
+
entry
->
GetName
()
+
wxT
(
"
\"
found in library <"
)
+
lib
->
GetName
()
+
wxT
(
"> is not a LIB_ALIAS object."
)
);
LIB_ALIAS
*
alias
=
(
LIB_ALIAS
*
)
entry
;
component
=
alias
->
GetComponent
();
component
=
entry
->
GetComponent
();
DrawPanel
->
DrawBackGround
(
DC
);
if
(
!
alias
->
IsRoot
()
)
if
(
!
entry
->
IsRoot
()
)
{
if
(
component
==
NULL
)
// Should not occur
return
;
// Temporarily change the name field text to reflect the alias name.
msg
=
alias
->
GetName
();
msg
=
entry
->
GetName
();
tmp
=
component
->
GetName
();
component
->
SetName
(
msg
);
...
...
include/base_struct.h
View file @
6566b0c5
...
...
@@ -71,7 +71,8 @@ enum KICAD_T {
* If you add a new draw item, type, please make sure you add it so the
* sort order is logical.
*/
LIBCOMPONENT_STRUCT_TYPE
,
LIB_COMPONENT_T
,
LIB_ALIAS_T
,
COMPONENT_ARC_DRAW_TYPE
,
COMPONENT_CIRCLE_DRAW_TYPE
,
COMPONENT_GRAPHIC_TEXT_DRAW_TYPE
,
...
...
@@ -258,32 +259,25 @@ class DHEAD;
// These define are used for the .m_Flags and .m_UndoRedoStatus member of the
// class EDA_BaseStruct
#define IS_CHANGED (1 << 0)
#define IS_LINKED (1 << 1)
#define IN_EDIT (1 << 2)
#define IS_MOVED (1 << 3)
#define IS_NEW (1 << 4)
#define IS_RESIZED (1 << 5)
#define IS_DRAGGED (1 << 6)
#define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1 << 8)
#define STARTPOINT (1 << 9)
#define ENDPOINT (1 << 10)
#define SELECTED (1 << 11)
#define SELECTEDNODE (1 << 12) ///< flag indicating that the structure
// has already selected
#define STRUCT_DELETED (1 << 13) ///< flag indication structures to be
// erased
#define CANDIDATE (1 << 14) ///< flag indicating that the structure
// is connected
#define SKIP_STRUCT (1 << 15) ///< flag indicating that the structure
// should be ignored
#define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function
#define IS_CANCELLED (1 << 17) ///< flag set when edit dialogs are
// canceled when editing a new object
#define IS_CHANGED (1 << 0)
#define IS_LINKED (1 << 1)
#define IN_EDIT (1 << 2)
#define IS_MOVED (1 << 3)
#define IS_NEW (1 << 4)
#define IS_RESIZED (1 << 5)
#define IS_DRAGGED (1 << 6)
#define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1 << 8)
#define STARTPOINT (1 << 9)
#define ENDPOINT (1 << 10)
#define SELECTED (1 << 11)
#define SELECTEDNODE (1 << 12) ///< flag indicating that the structure has already selected
#define STRUCT_DELETED (1 << 13) ///< flag indication structures to be erased
#define CANDIDATE (1 << 14) ///< flag indicating that the structure is connected
#define SKIP_STRUCT (1 << 15) ///< flag indicating that the structure should be ignored
#define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function
#define IS_CANCELLED (1 << 17) ///< flag set when edit dialogs are canceled when editing a
///< new object
class
EDA_BaseStruct
{
...
...
@@ -350,6 +344,10 @@ public:
void
SetSon
(
EDA_BaseStruct
*
aSon
)
{
m_Son
=
aSon
;
}
void
SetList
(
DHEAD
*
aList
)
{
m_List
=
aList
;
}
inline
bool
IsNew
()
const
{
return
m_Flags
&
IS_NEW
;
}
inline
bool
IsModified
()
const
{
return
m_Flags
&
IS_CHANGED
;
}
inline
bool
IsMoving
()
const
{
return
m_Flags
&
IS_MOVED
;
}
inline
bool
IsDragging
()
const
{
return
m_Flags
&
IS_DRAGGED
;
}
int
GetState
(
int
type
)
const
{
...
...
include/wxEeschemaStruct.h
View file @
6566b0c5
...
...
@@ -20,7 +20,6 @@ class SCH_ITEM;
class
SCH_NO_CONNECT
;
class
CMP_LIBRARY
;
class
LIB_COMPONENT
;
class
CMP_LIB_ENTRY
;
class
LIB_DRAW_ITEM
;
class
EDA_BaseStruct
;
class
SCH_BUS_ENTRY
;
...
...
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