Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
wawuwo committed Mar 8, 2024
1 parent 1180af6 commit 779da7a
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions qucs/schematic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1280,22 +1280,22 @@ void Schematic::sizeOfAll(int &xmin, int &ymin, int &xmax, int &ymax)
}
}

QRect Schematic::sizeOfSelection() const
{
QRect Schematic::sizeOfSelection() const {
int xmin = INT_MAX;
int ymin = INT_MAX;
int xmax = INT_MIN;
int ymax = INT_MIN;

bool isAnySelected = false;

if (Components->isEmpty() && Wires->isEmpty() && Diagrams->isEmpty() && Paintings->isEmpty()) {
if (Components->isEmpty() && Wires->isEmpty() && Diagrams->isEmpty() &&
Paintings->isEmpty()) {
return QRect{};
}

int x1, y1, x2, y2;
// find boundings of all components
for (auto *pc : *Components) {
for (auto* pc : *Components) {
if (!pc->isSelected) {
continue;
}
Expand All @@ -1308,17 +1308,17 @@ QRect Schematic::sizeOfSelection() const
}

// find boundings of all wires
for (auto *pw : *Wires) {
for (auto* pw : *Wires) {
if (!pw->isSelected) {
continue;
}
isAnySelected = true;
xmin = std::min(pw->x1, xmin);
xmax = std::max(pw->x2, xmax);
ymin = std::min(pw->y1, ymin);
ymax = std::max(pw->y2, ymax);
xmin = std::min(pw->x1, xmin);
xmax = std::max(pw->x2, xmax);
ymin = std::min(pw->y1, ymin);
ymax = std::max(pw->y2, ymax);

if (auto *pl = pw->Label; pl) { // check position of wire label
if (auto* pl = pw->Label; pl) { // check position of wire label
pl->getLabelBounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
xmax = std::max(x2, xmax);
Expand All @@ -1328,12 +1328,12 @@ QRect Schematic::sizeOfSelection() const
}

// find boundings of all node labels
for (auto *pn : *Nodes) {
for (auto* pn : *Nodes) {
if (!pn->isSelected) {
continue;
}

if (auto *pl = pn->Label; pl) { // check position of node label
if (auto* pl = pn->Label; pl) { // check position of node label
isAnySelected = true;
pl->getLabelBounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
Expand All @@ -1344,7 +1344,7 @@ QRect Schematic::sizeOfSelection() const
}

// find boundings of all diagrams
for (auto *pd : *Diagrams) {
for (auto* pd : *Diagrams) {
if (!pd->isSelected) {
continue;
}
Expand All @@ -1355,19 +1355,20 @@ QRect Schematic::sizeOfSelection() const
ymin = std::min(y1, ymin);
ymax = std::max(y2, ymax);

for (Graph *pg : pd->Graphs)
for (Graph* pg : pd->Graphs) {
// test all markers of diagram
for (Marker *pm : pg->Markers) {
for (Marker* pm : pg->Markers) {
pm->Bounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
xmax = std::max(x2, xmax);
ymin = std::min(y1, ymin);
ymax = std::max(y2, ymax);
}
}
}

// find boundings of all Paintings
for (auto *pp : *Paintings) {
for (auto* pp : *Paintings) {
if (!pp->isSelected) {
continue;
}
Expand Down

0 comments on commit 779da7a

Please sign in to comment.