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
135a6274
Commit
135a6274
authored
Apr 18, 2011
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eeschema: enhanced Pin editor dialog.
parent
8e538ddd
Changes
24
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
2588 additions
and
2374 deletions
+2588
-2374
dialog_lib_edit_pin.cpp
eeschema/dialogs/dialog_lib_edit_pin.cpp
+65
-2
dialog_lib_edit_pin.h
eeschema/dialogs/dialog_lib_edit_pin.h
+8
-3
dialog_lib_edit_pin_base.cpp
eeschema/dialogs/dialog_lib_edit_pin_base.cpp
+115
-89
dialog_lib_edit_pin_base.fbp
eeschema/dialogs/dialog_lib_edit_pin_base.fbp
+2155
-2105
dialog_lib_edit_pin_base.h
eeschema/dialogs/dialog_lib_edit_pin_base.h
+22
-30
lib_arc.cpp
eeschema/lib_arc.cpp
+1
-1
lib_arc.h
eeschema/lib_arc.h
+1
-1
lib_bezier.cpp
eeschema/lib_bezier.cpp
+1
-1
lib_bezier.h
eeschema/lib_bezier.h
+1
-1
lib_circle.cpp
eeschema/lib_circle.cpp
+1
-1
lib_circle.h
eeschema/lib_circle.h
+1
-1
lib_draw_item.h
eeschema/lib_draw_item.h
+1
-1
lib_field.cpp
eeschema/lib_field.cpp
+1
-1
lib_field.h
eeschema/lib_field.h
+2
-2
lib_pin.cpp
eeschema/lib_pin.cpp
+201
-125
lib_pin.h
eeschema/lib_pin.h
+1
-1
lib_polyline.cpp
eeschema/lib_polyline.cpp
+1
-1
lib_polyline.h
eeschema/lib_polyline.h
+1
-1
lib_rectangle.cpp
eeschema/lib_rectangle.cpp
+1
-1
lib_rectangle.h
eeschema/lib_rectangle.h
+1
-1
lib_text.cpp
eeschema/lib_text.cpp
+3
-3
lib_text.h
eeschema/lib_text.h
+1
-1
pinedit.cpp
eeschema/pinedit.cpp
+1
-1
dialog_pad_properties.cpp
pcbnew/dialogs/dialog_pad_properties.cpp
+2
-0
No files found.
eeschema/dialogs/dialog_lib_edit_pin.cpp
View file @
135a6274
#include "fctsys.h"
#include "macros.h"
#include "gr_basic.h"
#include "libeditframe.h"
#include "class_libentry.h"
#include "lib_pin.h"
#include "dialog_lib_edit_pin.h"
...
...
@@ -7,17 +12,24 @@
wxPoint
DIALOG_LIB_EDIT_PIN
::
s_LastPos
(
-
1
,
-
1
);
wxSize
DIALOG_LIB_EDIT_PIN
::
s_LastSize
;
DIALOG_LIB_EDIT_PIN
::
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
)
:
DIALOG_LIB_EDIT_PIN
::
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
,
LIB_PIN
*
aPin
)
:
DIALOG_LIB_EDIT_PIN_BASE
(
parent
)
{
m_dummyPin
=
new
LIB_PIN
(
*
aPin
);
m_panelShowPin
->
SetBackgroundColour
(
MakeColour
(
g_DrawBgColor
)
);
/* Required to make escape key work correctly in wxGTK. */
SetFocus
();
// Set tab order
m_textPinName
->
MoveAfterInTabOrder
(
this
);
m_textPadName
->
MoveAfterInTabOrder
(
m_textPinName
);
m_sdbSizerButtonsOK
->
SetDefault
();
}
DIALOG_LIB_EDIT_PIN
::~
DIALOG_LIB_EDIT_PIN
()
{
delete
m_dummyPin
;
}
void
DIALOG_LIB_EDIT_PIN
::
SetLastSizeAndPosition
()
{
if
(
s_LastPos
.
x
!=
-
1
)
...
...
@@ -32,6 +44,37 @@ void DIALOG_LIB_EDIT_PIN::SetLastSizeAndPosition()
Center
();
}
/*
* Draw (on m_panelShowPin) the pin currently edited
* accroding to current settings in dialog
*/
void
DIALOG_LIB_EDIT_PIN
::
OnPaintShowPanel
(
wxPaintEvent
&
event
)
{
wxPaintDC
dc
(
m_panelShowPin
);
wxSize
dc_size
=
dc
.
GetSize
();
dc
.
SetDeviceOrigin
(
dc_size
.
x
/
2
,
dc_size
.
y
/
2
);
// Calculate a suitable scale to fit the available draw area
EDA_RECT
bBox
=
m_dummyPin
->
GetBoundingBox
();
double
xscale
=
(
double
)
dc_size
.
x
/
bBox
.
GetWidth
();
double
yscale
=
(
double
)
dc_size
.
y
/
bBox
.
GetHeight
();
double
scale
=
MIN
(
xscale
,
yscale
);
// Give a 10% margin
scale
*=
0.9
;
dc
.
SetUserScale
(
scale
,
scale
);
wxPoint
offset
=
bBox
.
Centre
();
NEGATE
(
offset
.
x
);
NEGATE
(
offset
.
y
);
GRResetPenAndBrush
(
&
dc
);
m_dummyPin
->
Draw
(
NULL
,
&
dc
,
offset
,
-
1
,
wxCOPY
,
NULL
,
DefaultTransform
);
event
.
Skip
();
}
void
DIALOG_LIB_EDIT_PIN
::
OnCloseDialog
(
wxCloseEvent
&
event
)
{
// Save the dialog's position
...
...
@@ -56,6 +99,26 @@ void DIALOG_LIB_EDIT_PIN::OnOKButtonClick( wxCommandEvent& event )
EndModal
(
wxID_OK
);
}
// Called when a pin properties changes
void
DIALOG_LIB_EDIT_PIN
::
OnPropertiesChange
(
wxCommandEvent
&
event
)
{
int
units
=
((
LIB_EDIT_FRAME
*
)
GetParent
())
->
m_InternalUnits
;
int
pinNameSize
=
ReturnValueFromString
(
g_UserUnit
,
GetNameTextSize
(),
units
);
int
pinNumSize
=
ReturnValueFromString
(
g_UserUnit
,
GetPadNameTextSize
(),
units
);
int
pinOrient
=
LIB_PIN
::
GetOrientationCode
(
GetOrientation
()
);
int
pinLength
=
ReturnValueFromString
(
g_UserUnit
,
GetLength
(),
units
);
int
pinShape
=
LIB_PIN
::
GetStyleCode
(
GetStyle
()
);
m_dummyPin
->
SetName
(
GetName
()
);
m_dummyPin
->
SetNameTextSize
(
pinNameSize
);
m_dummyPin
->
SetNumber
(
GetPadName
()
);
m_dummyPin
->
SetNumberTextSize
(
pinNumSize
);
m_dummyPin
->
SetOrientation
(
pinOrient
);
m_dummyPin
->
SetLength
(
pinLength
);
m_dummyPin
->
SetShape
(
pinShape
);
m_panelShowPin
->
Refresh
();
}
void
DIALOG_LIB_EDIT_PIN
::
SetOrientationList
(
const
wxArrayString
&
list
,
...
...
eeschema/dialogs/dialog_lib_edit_pin.h
View file @
135a6274
...
...
@@ -16,14 +16,19 @@ class DIALOG_LIB_EDIT_PIN : public DIALOG_LIB_EDIT_PIN_BASE
static
wxSize
s_LastSize
;
///< last position and size
static
wxPoint
s_LastPos
;
LIB_PIN
*
m_dummyPin
;
// a working copy used to show changes
public
:
/** Constructor */
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
);
DIALOG_LIB_EDIT_PIN
(
wxWindow
*
parent
,
LIB_PIN
*
aPin
);
~
DIALOG_LIB_EDIT_PIN
();
void
SetLastSizeAndPosition
();
void
OnCloseDialog
(
wxCloseEvent
&
event
);
void
OnCancelButtonClick
(
wxCommandEvent
&
event
);
void
OnOKButtonClick
(
wxCommandEvent
&
event
);
void
OnPaintShowPanel
(
wxPaintEvent
&
event
);
void
OnPropertiesChange
(
wxCommandEvent
&
event
);
void
SetOrientationList
(
const
wxArrayString
&
list
,
const
char
***
aBitmaps
);
void
SetOrientation
(
int
orientation
)
...
...
eeschema/dialogs/dialog_lib_edit_pin_base.cpp
View file @
135a6274
This diff is collapsed.
Click to expand it.
eeschema/dialogs/dialog_lib_edit_pin_base.fbp
View file @
135a6274
This diff is collapsed.
Click to expand it.
eeschema/dialogs/dialog_lib_edit_pin_base.h
View file @
135a6274
...
...
@@ -22,6 +22,8 @@ class wxBitmapComboBox;
#include <wx/combobox.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
...
...
@@ -33,60 +35,48 @@ class wxBitmapComboBox;
///////////////////////////////////////////////////////////////////////////////
class
DIALOG_LIB_EDIT_PIN_BASE
:
public
wxDialog
{
DECLARE_EVENT_TABLE
()
private
:
// Private event handlers
void
_wxFB_OnCloseDialog
(
wxCloseEvent
&
event
){
OnCloseDialog
(
event
);
}
void
_wxFB_OnCBpartSelection
(
wxCommandEvent
&
event
){
OnCBpartSelection
(
event
);
}
void
_wxFB_OnCancelButtonClick
(
wxCommandEvent
&
event
){
OnCancelButtonClick
(
event
);
}
void
_wxFB_OnOKButtonClick
(
wxCommandEvent
&
event
){
OnOKButtonClick
(
event
);
}
protected
:
enum
{
ID_M_TEXTPINNAME
=
1000
,
ID_M_TEXTPINNAMETEXTSIZE
,
ID_M_STATICTEXTPADNAME
,
ID_M_TEXTPADNAME
,
ID_M_STATICTEXTNAMESIZE
,
ID_M_TEXTPINNAMETEXTSIZE
,
ID_M_STATICNAMETEXTSIZEUNITS
,
ID_M_STATICTEXTPADNAMESIZE
,
ID_M_TEXTPADNAMETEXTSIZE
,
ID_M_STATICNUMBERTEXTSIZEUNITS
,
ID_M_STATICTEXTPINLEN
,
ID_M_TEXTLENGTH
,
ID_M_STATICLENGTHUNITS
,
};
wxStaticText
*
m_staticTextPinName
;
wxTextCtrl
*
m_textPinName
;
wxStaticText
*
m_staticTextNameSize
;
wxTextCtrl
*
m_textPinNameTextSize
;
wxStaticText
*
m_staticNameTextSizeUnits
;
wxStaticText
*
m_staticTextPadName
;
wxTextCtrl
*
m_textPadName
;
wxStaticText
*
m_staticTextPadNameSize
;
wxTextCtrl
*
m_textPadNameTextSize
;
wxStaticText
*
m_staticNumberTextSizeUnits
;
wxStaticText
*
m_staticTextOrient
;
wxBitmapComboBox
*
m_choiceOrientation
;
wxStaticText
*
m_staticTextPinLen
;
wxTextCtrl
*
m_textLength
;
wxStaticText
*
m_staticLengthUnits
;
wxStaticText
*
m_staticTextEType
;
wxBitmapComboBox
*
m_choiceElectricalType
;
wxStaticText
*
m_staticTextGstyle
;
wxBitmapComboBox
*
m_choiceStyle
;
wxCheckBox
*
m_checkApplyToAllParts
;
wxCheckBox
*
m_checkApplyToAllConversions
;
wxCheckBox
*
m_checkShow
;
wxStaticText
*
m_staticTextNameSize
;
wxTextCtrl
*
m_textPinNameTextSize
;
wxStaticText
*
m_staticNameTextSizeUnits
;
wxStaticText
*
m_staticTextPadNameSize
;
wxTextCtrl
*
m_textPadNameTextSize
;
wxStaticText
*
m_staticNumberTextSizeUnits
;
wxStaticText
*
m_staticTextPinLen
;
wxTextCtrl
*
m_textLength
;
wxStaticText
*
m_staticLengthUnits
;
wxPanel
*
m_panelShowPin
;
wxStaticLine
*
m_staticline1
;
wxStdDialogButtonSizer
*
m_sdbSizerButtons
;
wxButton
*
m_sdbSizerButtonsOK
;
...
...
@@ -94,14 +84,16 @@ class DIALOG_LIB_EDIT_PIN_BASE : public wxDialog
// Virtual event handlers, overide them in your derived class
virtual
void
OnCloseDialog
(
wxCloseEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnPropertiesChange
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnCBpartSelection
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnPaintShowPanel
(
wxPaintEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnCancelButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnOKButtonClick
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
public
:
DIALOG_LIB_EDIT_PIN_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Pin Properties"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
4
87
,
344
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
DIALOG_LIB_EDIT_PIN_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"Pin Properties"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
4
99
,
372
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_LIB_EDIT_PIN_BASE
();
};
...
...
eeschema/lib_arc.cpp
View file @
135a6274
...
...
@@ -319,7 +319,7 @@ void LIB_ARC::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_ARC
::
GetPenSize
()
int
LIB_ARC
::
GetPenSize
()
const
{
return
(
m_Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_Width
;
}
...
...
eeschema/lib_arc.h
View file @
135a6274
...
...
@@ -102,7 +102,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
(
);
virtual
int
GetPenSize
(
)
const
;
/**
* See LIB_DRAW_ITEM::BeginEdit().
...
...
eeschema/lib_bezier.cpp
View file @
135a6274
...
...
@@ -236,7 +236,7 @@ void LIB_BEZIER::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_BEZIER
::
GetPenSize
()
int
LIB_BEZIER
::
GetPenSize
()
const
{
return
(
m_Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_Width
;
}
...
...
eeschema/lib_bezier.h
View file @
135a6274
...
...
@@ -72,7 +72,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
(
);
virtual
int
GetPenSize
(
)
const
;
virtual
void
DisplayInfo
(
EDA_DRAW_FRAME
*
aFrame
);
...
...
eeschema/lib_circle.cpp
View file @
135a6274
...
...
@@ -191,7 +191,7 @@ void LIB_CIRCLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_CIRCLE
::
GetPenSize
()
int
LIB_CIRCLE
::
GetPenSize
()
const
{
return
(
m_Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_Width
;
}
...
...
eeschema/lib_circle.h
View file @
135a6274
...
...
@@ -67,7 +67,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
(
);
virtual
int
GetPenSize
(
)
const
;
virtual
EDA_RECT
GetBoundingBox
()
const
;
virtual
void
DisplayInfo
(
EDA_DRAW_FRAME
*
aFrame
);
...
...
eeschema/lib_draw_item.h
View file @
135a6274
...
...
@@ -185,7 +185,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
()
=
0
;
virtual
int
GetPenSize
()
const
=
0
;
/**
* Write draw item object to \a aFile in "*.lib" format.
...
...
eeschema/lib_field.cpp
View file @
135a6274
...
...
@@ -272,7 +272,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg )
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_FIELD
::
GetPenSize
()
int
LIB_FIELD
::
GetPenSize
()
const
{
return
(
m_Thickness
==
0
)
?
g_DrawDefaultLineThickness
:
m_Thickness
;
}
...
...
eeschema/lib_field.h
View file @
135a6274
...
...
@@ -86,10 +86,10 @@ public:
void
SetId
(
int
aId
)
{
m_id
=
aId
;
}
/**
* Function GetPenSize virtual
pure
* Function GetPenSize virtual
* @return the size of the "pen" that be used to draw or plot this item
*/
int
GetPenSize
(
)
;
virtual
int
GetPenSize
(
)
const
;
/**
* Writes field object out to a FILE in "*.lib" format.
...
...
eeschema/lib_pin.cpp
View file @
135a6274
This diff is collapsed.
Click to expand it.
eeschema/lib_pin.h
View file @
135a6274
...
...
@@ -355,7 +355,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item.
*/
virtual
int
GetPenSize
();
virtual
int
GetPenSize
()
const
;
void
DrawPinSymbol
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
int
aOrientation
,
int
aDrawMode
,
int
aColor
=
-
1
);
...
...
eeschema/lib_polyline.cpp
View file @
135a6274
...
...
@@ -233,7 +233,7 @@ void LIB_POLYLINE::AddPoint( const wxPoint& point )
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_POLYLINE
::
GetPenSize
()
int
LIB_POLYLINE
::
GetPenSize
()
const
{
return
(
m_Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_Width
;
}
...
...
eeschema/lib_polyline.h
View file @
135a6274
...
...
@@ -86,7 +86,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
(
);
virtual
int
GetPenSize
(
)
const
;
virtual
void
DisplayInfo
(
EDA_DRAW_FRAME
*
aFrame
);
...
...
eeschema/lib_rectangle.cpp
View file @
135a6274
...
...
@@ -166,7 +166,7 @@ void LIB_RECTANGLE::DoPlot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFil
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_RECTANGLE
::
GetPenSize
()
int
LIB_RECTANGLE
::
GetPenSize
()
const
{
return
(
m_Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_Width
;
}
...
...
eeschema/lib_rectangle.h
View file @
135a6274
...
...
@@ -72,7 +72,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
(
);
virtual
int
GetPenSize
(
)
const
;
virtual
EDA_RECT
GetBoundingBox
()
const
;
...
...
eeschema/lib_text.cpp
View file @
135a6274
...
...
@@ -286,7 +286,7 @@ void LIB_TEXT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int
LIB_TEXT
::
GetPenSize
(
)
int
LIB_TEXT
::
GetPenSize
(
)
const
{
int
pensize
=
m_Thickness
;
...
...
eeschema/lib_text.h
View file @
135a6274
...
...
@@ -94,7 +94,7 @@ public:
/**
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual
int
GetPenSize
(
);
virtual
int
GetPenSize
(
)
const
;
virtual
void
DisplayInfo
(
EDA_DRAW_FRAME
*
aFrame
);
...
...
eeschema/pinedit.cpp
View file @
135a6274
...
...
@@ -46,7 +46,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
int
item_flags
=
m_drawItem
->
m_Flags
;
// save flags to restore them after editing
LIB_PIN
*
pin
=
(
LIB_PIN
*
)
m_drawItem
;
DIALOG_LIB_EDIT_PIN
dlg
(
this
);
DIALOG_LIB_EDIT_PIN
dlg
(
this
,
pin
);
wxString
units
=
GetUnitsLabel
(
g_UserUnit
);
dlg
.
SetOrientationList
(
LIB_PIN
::
GetOrientationNames
(),
LIB_PIN
::
GetOrientationSymbols
()
);
...
...
pcbnew/dialogs/dialog_pad_properties.cpp
View file @
135a6274
...
...
@@ -5,6 +5,7 @@
#include "fctsys.h"
#include "common.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
...
...
@@ -133,6 +134,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
scale
*=
0.7
;
dc
.
SetUserScale
(
scale
,
scale
);
GRResetPenAndBrush
(
&
dc
);
m_dummyPad
->
DrawShape
(
NULL
,
&
dc
,
drawInfo
);
event
.
Skip
();
...
...
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