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
d60caed4
Commit
d60caed4
authored
May 06, 2011
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pin edit: fix some minor issues.
parent
883929f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
22 deletions
+30
-22
dialog_lib_edit_pin.cpp
eeschema/dialogs/dialog_lib_edit_pin.cpp
+7
-3
lib_pin.cpp
eeschema/lib_pin.cpp
+21
-17
lib_pin.h
eeschema/lib_pin.h
+2
-2
No files found.
eeschema/dialogs/dialog_lib_edit_pin.cpp
View file @
d60caed4
...
@@ -15,10 +15,13 @@ wxSize DIALOG_LIB_EDIT_PIN::s_LastSize;
...
@@ -15,10 +15,13 @@ wxSize DIALOG_LIB_EDIT_PIN::s_LastSize;
DIALOG_LIB_EDIT_PIN
::
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
,
LIB_PIN
*
aPin
)
:
DIALOG_LIB_EDIT_PIN
::
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
,
LIB_PIN
*
aPin
)
:
DIALOG_LIB_EDIT_PIN_BASE
(
parent
)
DIALOG_LIB_EDIT_PIN_BASE
(
parent
)
{
{
// Creates a dummy pin to show on a panel, insside this dialog:
m_dummyPin
=
new
LIB_PIN
(
*
aPin
);
m_dummyPin
=
new
LIB_PIN
(
*
aPin
);
// m_dummyPin changes do not proparagte to a parent, so set parent to null
// m_dummyPin changes do not proparagte to other pins of the current lib component,
// so set parent to null and clear flags
m_dummyPin
->
SetParent
(
NULL
);
m_dummyPin
->
SetParent
(
NULL
);
m_dummyPin
->
ClearFlags
();
m_panelShowPin
->
SetBackgroundColour
(
MakeColour
(
g_DrawBgColor
)
);
m_panelShowPin
->
SetBackgroundColour
(
MakeColour
(
g_DrawBgColor
)
);
...
@@ -60,7 +63,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
...
@@ -60,7 +63,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
// Give a parent to m_dummyPin only from draw purpose.
// Give a parent to m_dummyPin only from draw purpose.
// In fact m_dummyPin should not have a parent, but draw functions need a parent
// In fact m_dummyPin should not have a parent, but draw functions need a parent
// to know some options
// to know some options
, about pin texts
LIB_EDIT_FRAME
*
libframe
=
(
LIB_EDIT_FRAME
*
)
GetParent
();
LIB_EDIT_FRAME
*
libframe
=
(
LIB_EDIT_FRAME
*
)
GetParent
();
m_dummyPin
->
SetParent
(
libframe
->
GetComponent
()
);
m_dummyPin
->
SetParent
(
libframe
->
GetComponent
()
);
...
@@ -79,7 +82,6 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
...
@@ -79,7 +82,6 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
NEGATE
(
offset
.
y
);
NEGATE
(
offset
.
y
);
GRResetPenAndBrush
(
&
dc
);
GRResetPenAndBrush
(
&
dc
);
m_dummyPin
->
SetVisible
(
true
);
// TODO find a better way to show invisible pin here
m_dummyPin
->
Draw
(
NULL
,
&
dc
,
offset
,
-
1
,
wxCOPY
,
m_dummyPin
->
Draw
(
NULL
,
&
dc
,
offset
,
-
1
,
wxCOPY
,
NULL
,
DefaultTransform
);
NULL
,
DefaultTransform
);
...
@@ -115,6 +117,8 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event )
...
@@ -115,6 +117,8 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event )
// Called when a pin properties changes
// Called when a pin properties changes
void
DIALOG_LIB_EDIT_PIN
::
OnPropertiesChange
(
wxCommandEvent
&
event
)
void
DIALOG_LIB_EDIT_PIN
::
OnPropertiesChange
(
wxCommandEvent
&
event
)
{
{
if
(
!
IsShown
()
)
// do nothing at init time
return
;
int
units
=
((
LIB_EDIT_FRAME
*
)
GetParent
())
->
m_InternalUnits
;
int
units
=
((
LIB_EDIT_FRAME
*
)
GetParent
())
->
m_InternalUnits
;
int
pinNameSize
=
ReturnValueFromString
(
g_UserUnit
,
GetNameTextSize
(),
units
);
int
pinNameSize
=
ReturnValueFromString
(
g_UserUnit
,
GetNameTextSize
(),
units
);
int
pinNumSize
=
ReturnValueFromString
(
g_UserUnit
,
GetPadNameTextSize
(),
units
);
int
pinNumSize
=
ReturnValueFromString
(
g_UserUnit
,
GetPadNameTextSize
(),
units
);
...
...
eeschema/lib_pin.cpp
View file @
d60caed4
...
@@ -470,9 +470,9 @@ void LIB_PIN::SetVisible( bool visible )
...
@@ -470,9 +470,9 @@ void LIB_PIN::SetVisible( bool visible )
return
;
return
;
if
(
visible
)
if
(
visible
)
m_attributes
&=
~
PIN
NOTDRAW
;
m_attributes
&=
~
PIN
_INVISIBLE
;
else
else
m_attributes
|=
PIN
NOTDRAW
;
m_attributes
|=
PIN
_INVISIBLE
;
SetModified
();
SetModified
();
...
@@ -488,9 +488,9 @@ void LIB_PIN::SetVisible( bool visible )
...
@@ -488,9 +488,9 @@ void LIB_PIN::SetVisible( bool visible )
continue
;
continue
;
if
(
visible
)
if
(
visible
)
pinList
[
i
]
->
m_attributes
&=
~
PIN
NOTDRAW
;
pinList
[
i
]
->
m_attributes
&=
~
PIN
_INVISIBLE
;
else
else
pinList
[
i
]
->
m_attributes
|=
PIN
NOTDRAW
;
pinList
[
i
]
->
m_attributes
|=
PIN
_INVISIBLE
;
SetModified
();
SetModified
();
}
}
...
@@ -619,13 +619,12 @@ bool LIB_PIN::Save( FILE* ExportFile )
...
@@ -619,13 +619,12 @@ bool LIB_PIN::Save( FILE* ExportFile )
m_Unit
,
m_Convert
,
Etype
)
<
0
)
m_Unit
,
m_Convert
,
Etype
)
<
0
)
return
false
;
return
false
;
if
(
(
m_shape
)
||
(
m_attributes
&
PINNOTDRAW
)
)
if
(
m_shape
||
!
IsVisible
(
)
)
{
{
if
(
fprintf
(
ExportFile
,
" "
)
<
0
)
if
(
fprintf
(
ExportFile
,
" "
)
<
0
)
return
false
;
return
false
;
}
}
if
(
m_attributes
&
PINNOTDRAW
if
(
!
IsVisible
()
&&
fprintf
(
ExportFile
,
"N"
)
<
0
)
&&
fprintf
(
ExportFile
,
"N"
)
<
0
)
return
false
;
return
false
;
if
(
m_shape
&
INVERT
if
(
m_shape
&
INVERT
&&
fprintf
(
ExportFile
,
"I"
)
<
0
)
&&
fprintf
(
ExportFile
,
"I"
)
<
0
)
...
@@ -741,7 +740,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
...
@@ -741,7 +740,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
break
;
break
;
case
'N'
:
case
'N'
:
m_attributes
|=
PIN
NOTDRAW
;
m_attributes
|=
PIN
_INVISIBLE
;
break
;
break
;
case
'I'
:
case
'I'
:
...
@@ -797,16 +796,21 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
...
@@ -797,16 +796,21 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
void
*
aData
,
void
*
aData
,
const
TRANSFORM
&
aTransform
)
const
TRANSFORM
&
aTransform
)
{
{
// Invisible pins are only drawn on request. In libedit they are drawn
// Invisible pins are only drawn on request.
// in g_InvisibleItemColor because we must see them.
// They are drawn in g_InvisibleItemColor.
SCH_EDIT_FRAME
*
frame
=
(
SCH_EDIT_FRAME
*
)
wxGetApp
().
GetTopWindow
();
// in schematic, they are drawn only if m_ShowAllPins is true.
// In other windows, they are always drawn because we must see them.
if
(
!
IsVisible
()
)
{
EDA_DRAW_FRAME
*
frame
=
NULL
;
if
(
aPanel
&&
aPanel
->
GetParent
()
)
frame
=
(
EDA_DRAW_FRAME
*
)
aPanel
->
GetParent
();
if
(
frame
&&
frame
->
m_Ident
==
SCHEMATIC_FRAME
&&
!
((
SCH_EDIT_FRAME
*
)
frame
)
->
m_ShowAllPins
)
return
;
if
(
m_attributes
&
PINNOTDRAW
)
{
if
(
frame
->
m_LibeditFrame
&&
frame
->
m_LibeditFrame
->
IsActive
()
)
aColor
=
g_InvisibleItemColor
;
aColor
=
g_InvisibleItemColor
;
else
if
(
!
frame
->
m_ShowAllPins
)
return
;
}
}
LIB_COMPONENT
*
Entry
=
GetParent
();
LIB_COMPONENT
*
Entry
=
GetParent
();
...
@@ -1673,7 +1677,7 @@ void LIB_PIN::DoMirrorHorizontal( const wxPoint& center )
...
@@ -1673,7 +1677,7 @@ void LIB_PIN::DoMirrorHorizontal( const wxPoint& center )
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_attributes
&
PINNOTDRAW
)
if
(
!
IsVisible
()
)
return
;
return
;
int
orient
=
ReturnPinDrawOrient
(
aTransform
);
int
orient
=
ReturnPinDrawOrient
(
aTransform
);
...
...
eeschema/lib_pin.h
View file @
d60caed4
...
@@ -52,7 +52,7 @@ enum ElectricPinType {
...
@@ -52,7 +52,7 @@ enum ElectricPinType {
extern
const
wxChar
*
MsgPinElectricType
[];
extern
const
wxChar
*
MsgPinElectricType
[];
/* Pin visibility flag bit. */
/* Pin visibility flag bit. */
#define PIN
NOTDRAW
1
/* Set makes pin invisible */
#define PIN
_INVISIBLE
1
/* Set makes pin invisible */
/**
/**
...
@@ -350,7 +350,7 @@ public:
...
@@ -350,7 +350,7 @@ public:
*
*
* @return True if draw object is visible otherwise false.
* @return True if draw object is visible otherwise false.
*/
*/
bool
IsVisible
()
{
return
(
m_attributes
&
PIN
NOTDRAW
)
==
0
;
}
bool
IsVisible
()
{
return
(
m_attributes
&
PIN
_INVISIBLE
)
==
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.
...
...
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