git-svn-id: svn://db.shs.com.ru/libs@173 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -499,6 +499,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
|
||||
foreach (QGraphicsItem * b, sel_items)
|
||||
if (b->data(1006) == "item")
|
||||
ci << b;
|
||||
simplifyBuses();
|
||||
emitActionEvent(BlockItemBase::BlockMove, ci);
|
||||
reconnectAll();
|
||||
}
|
||||
@@ -1114,16 +1115,16 @@ void BlockView::matchBus() {
|
||||
}
|
||||
}
|
||||
if (sp >= 0) {
|
||||
if (b->endpointCount() + b->pointSegments(sp) - 2 >= b->max_ep) {
|
||||
if (b->endpointCount() + b->pointSegmentsCount(sp) - 2 >= b->max_ep) {
|
||||
b->setBusState(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int sep = b->endpointCount() + bus_from->endpointCount();
|
||||
if (b->pointSegments(sp) == 1) sep--;
|
||||
if (b->pointSegmentsCount(sp) == 1) sep--;
|
||||
if (bus_from->selPoint >= 0)
|
||||
if (bus_from->pointSegments(bus_from->selPoint) == 1) sep--;
|
||||
if (bus_from->pointSegmentsCount(bus_from->selPoint) == 1) sep--;
|
||||
if (sep > b->max_ep) {
|
||||
b->setBusState(false);
|
||||
return;
|
||||
@@ -1205,6 +1206,13 @@ void BlockView::unhoverPins() {
|
||||
}
|
||||
|
||||
|
||||
void BlockView::simplifyBuses() {
|
||||
QList<BlockBusItem*> bl = buses();
|
||||
foreach (BlockBusItem * b, bl)
|
||||
b->simplify();
|
||||
}
|
||||
|
||||
|
||||
void BlockView::moveBuses(const QList<QGraphicsItem * > & items, QPointF dp) {
|
||||
if (dp.isNull()) return;
|
||||
QList<QGraphicsItem * > gi = scene_->items();
|
||||
@@ -1230,7 +1238,7 @@ void BlockView::moveBuses(const QList<QGraphicsItem * > & items, QPointF dp) {
|
||||
foreach (BlockItemPin * p, pins) {
|
||||
QList<int> ends = b->connections_.keys(p);
|
||||
for (int i = 0; i < ends.size(); ++i) {
|
||||
int isp = b->segmentPointPair(ends[i]);
|
||||
/*int isp = b->segmentPointPair(ends[i]);
|
||||
QPointF sdp;
|
||||
if (isp >= 0 && b->pol.size() > 2) {
|
||||
sdp = b->pol[isp] - b->pol[ends[i]];
|
||||
@@ -1245,7 +1253,13 @@ void BlockView::moveBuses(const QList<QGraphicsItem * > & items, QPointF dp) {
|
||||
if (p->alignment() == Qt::AlignLeft || p->alignment() == Qt::AlignRight)
|
||||
b->movePoint(isp, QPointF(0., dp.y()));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
QPointF pdp = dp;
|
||||
if (p->alignment() == Qt::AlignTop || p->alignment() == Qt::AlignBottom) pdp.setY(0.);
|
||||
if (p->alignment() == Qt::AlignLeft || p->alignment() == Qt::AlignRight) pdp.setX(0.);
|
||||
QVector<int> epl = b->endpointLine(ends[i]);
|
||||
foreach (int e, epl)
|
||||
b->movePoint(e, pdp);
|
||||
b->movePoint(ends[i], dp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user