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

Method copyComponents2

qucs/schematic_element.cpp:2918–2952  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2916
2917// ---------------------------------------------------
2918void Schematic::copyComponents2(int& x1, int& y1, int& x2, int& y2,
2919 QList<Element *> *ElementCache)
2920{
2921 Component *pc;
2922 // find bounds of all selected components
2923 for(pc = Components->first(); pc != 0; )
2924 {
2925 if(pc->isSelected)
2926 {
2927 // is better for unsymmetrical components
2928 if(pc->cx < x1) x1 = pc->cx;
2929 if(pc->cx > x2) x2 = pc->cx;
2930 if(pc->cy < y1) y1 = pc->cy;
2931 if(pc->cy > y2) y2 = pc->cy;
2932
2933 ElementCache->append(pc);
2934
2935 // rescue non-selected node labels
2936 foreach(Port *pp, pc->Ports)
2937 if(pp->Connection->Label)
2938 if(pp->Connection->Connections.count() < 2)
2939 {
2940 ElementCache->append(pp->Connection->Label);
2941 pp->Connection->Label = 0;
2942 // Don't set pp->Connection->Label->pOwner=0,
2943 // so text position stays unchanged.
2944 }
2945
2946 deleteComp(pc);
2947 pc = Components->current();
2948 continue;
2949 }
2950 pc = Components->next();
2951 }
2952}
2953
2954
2955/* *******************************************************************

Callers

nothing calls this directly

Calls 3

countMethod · 0.80
nextMethod · 0.80
foreachFunction · 0.70

Tested by

no test coverage detected