Skip to content

Commit 3c038b2

Browse files
committed
[kicad:model] Renamed Pin::layer to Pin::unit to unify with Draw::unit and kicad naming
1 parent 8aaca7b commit 3c038b2

6 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/kicad/model/pin.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Pin::Pin()
2525
_pinType(Pin::Normal),
2626
_electricalType(Pin::Input)
2727
{
28-
_layer = 1;
28+
_unit = 1;
2929
_length = 300;
3030
_textNameSize = 50;
3131
_textPadSize = 50;
@@ -39,7 +39,7 @@ Pin::Pin(const QString &name, const QString &padName)
3939
_pinType(Pin::Normal),
4040
_electricalType(Pin::Input)
4141
{
42-
_layer = 1;
42+
_unit = 1;
4343
_length = 300;
4444
_textNameSize = 50;
4545
_textPadSize = 50;
@@ -59,7 +59,7 @@ Pin::Pin(const Pin &other)
5959
_direction = other._direction;
6060
_pinType = other._pinType;
6161
_electricalType = other._electricalType;
62-
_layer = other._layer;
62+
_unit = other._unit;
6363
_length = other._length;
6464

6565
_textNameSize = other._textNameSize;
@@ -215,16 +215,16 @@ void Pin::setTextPadSize(int textPadSize)
215215
}
216216
}
217217

218-
int Pin::layer() const
218+
int Pin::unit() const
219219
{
220-
return _layer;
220+
return _unit;
221221
}
222222

223-
void Pin::setLayer(int layer)
223+
void Pin::setUnit(int unit)
224224
{
225-
if (layer > 0)
225+
if (unit > 0)
226226
{
227-
_layer = layer;
227+
_unit = unit;
228228
}
229229
}
230230

src/kicad/model/pin.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ class KICAD_EXPORT Pin
9999
int textPadSize() const;
100100
void setTextPadSize(int textPadSize);
101101

102-
int layer() const; // change to unit
103-
void setLayer(int layer);
102+
int unit() const;
103+
void setUnit(int unit);
104104

105105
int length() const;
106106
void setLength(int length);
@@ -123,7 +123,7 @@ class KICAD_EXPORT Pin
123123
ElectricalType _electricalType;
124124
int _textNameSize;
125125
int _textPadSize;
126-
int _layer;
126+
int _unit;
127127
int _length;
128128

129129
QString _className;

src/kicad/parser/kicadlibparser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void KicadLibParser::writePin(Pin *pin)
230230
<< " " // name text size
231231
<< "50"
232232
<< " " // pad name text size
233-
<< pin->layer() << " "
233+
<< pin->unit() << " "
234234
<< "1"
235235
<< " " << pinElectricalTypeString(pin->electricalType());
236236
if (pin->pinType() != Pin::Normal)
@@ -641,7 +641,7 @@ Pin *KicadLibParser::readPin()
641641
delete pin;
642642
return nullptr;
643643
}
644-
pin->setLayer(layer);
644+
pin->setUnit(layer);
645645

646646
QString dummy;
647647
_stream.skipWhiteSpace();

src/kicad/pinruler/pinruler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void PinRuler::organize(Component *component)
7070
}
7171
else
7272
{
73-
pin->setLayer(1);
73+
pin->setUnit(1);
7474
QString className; // = rules.first()->className(pin->name());
7575
for (PinRule *rule : rules)
7676
{

src/kicad/viewer/componentitem.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
const int ComponentItem::ratio = 5;
2929

30-
ComponentItem::ComponentItem(Component *component, int layer)
30+
ComponentItem::ComponentItem(Component *component, int unit)
3131
{
32-
setComponent(component, layer);
32+
setComponent(component, unit);
3333
_showElectricalType = true;
3434
}
3535

@@ -50,16 +50,16 @@ Component *ComponentItem::component() const
5050
return _component;
5151
}
5252

53-
void ComponentItem::setComponent(Component *component, int layer)
53+
void ComponentItem::setComponent(Component *component, int unit)
5454
{
5555
prepareGeometryChange();
5656
_component = component;
5757
_pinItemMap.clear();
58-
_layer = layer;
58+
_unit = unit;
5959

6060
for (Pin *pin : component->pins())
6161
{
62-
if (pin->layer() == _layer || pin->layer() == 0)
62+
if (pin->unit() == _unit || pin->unit() == 0)
6363
{
6464
PinItem *pinItem = new PinItem(pin);
6565
pinItem->setParentItem(this);
@@ -68,7 +68,7 @@ void ComponentItem::setComponent(Component *component, int layer)
6868
}
6969
for (Draw *draw : component->draws())
7070
{
71-
if (draw->unit() == _layer || draw->unit() == 0)
71+
if (draw->unit() == _unit || draw->unit() == 0)
7272
{
7373
DrawItem *drawItem = DrawItem::fromDraw(draw);
7474
if (drawItem != nullptr)

src/kicad/viewer/componentitem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PinItem;
3131
class KICAD_EXPORT ComponentItem : public QGraphicsItem
3232
{
3333
public:
34-
ComponentItem(Component *component = nullptr, int layer = 1);
34+
ComponentItem(Component *component = nullptr, int unit = 1);
3535

3636
enum
3737
{
@@ -46,7 +46,7 @@ class KICAD_EXPORT ComponentItem : public QGraphicsItem
4646
QRectF boundingRect() const override;
4747

4848
Component *component() const;
49-
void setComponent(Component *component, int layer = 1);
49+
void setComponent(Component *component, int unit = 1);
5050

5151
PinItem *pinItem(Pin *pin);
5252
void removePin(Pin *pin);
@@ -58,7 +58,7 @@ class KICAD_EXPORT ComponentItem : public QGraphicsItem
5858

5959
private:
6060
Component *_component;
61-
int _layer;
61+
int _unit;
6262
bool _showElectricalType;
6363

6464
QRectF _numRect;

0 commit comments

Comments
 (0)