MCPcopy Create free account
hub / github.com/Qucs/qucs / copyComponents

Method copyComponents

qucs/schematic_element.cpp:2874–2915  ·  view source on GitHub ↗

---------------------------------------------------

Source from the content-addressed store, hash-verified

2872
2873// ---------------------------------------------------
2874int Schematic::copyComponents(int& x1, int& y1, int& x2, int& y2,
2875 QList<Element *> *ElementCache)
2876{
2877 Component *pc;
2878 int bx1, by1, bx2, by2, count=0;
2879 // find bounds of all selected components
2880 for(pc = Components->first(); pc != 0; )
2881 {
2882 if(pc->isSelected)
2883 {
2884 pc->Bounding(bx1, by1, bx2, by2); // is needed because of "distribute
2885 if(bx1 < x1) x1 = bx1; // uniformly"
2886 if(bx2 > x2) x2 = bx2;
2887 if(by1 < y1) y1 = by1;
2888 if(by2 > y2) y2 = by2;
2889
2890 count++;
2891 ElementCache->append(pc);
2892
2893 // rescue non-selected node labels
2894 foreach(Port *pp, pc->Ports)
2895 if(pp->Connection->Label)
2896 if(pp->Connection->Connections.count() < 2)
2897 {
2898 ElementCache->append(pp->Connection->Label);
2899
2900 // Don't set pp->Connection->Label->pOwner=0,
2901 // so text position stays unchanged, but
2902 // remember component for align/distribute.
2903 pp->Connection->Label->pOwner = (Node*)pc;
2904
2905 pp->Connection->Label = 0;
2906 }
2907
2908 deleteComp(pc);
2909 pc = Components->current();
2910 continue;
2911 }
2912 pc = Components->next();
2913 }
2914 return count;
2915}
2916
2917// ---------------------------------------------------
2918void Schematic::copyComponents2(int& x1, int& y1, int& x2, int& y2,

Callers

nothing calls this directly

Calls 4

countMethod · 0.80
nextMethod · 0.80
foreachFunction · 0.70
BoundingMethod · 0.45

Tested by

no test coverage detected