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

Method createUndoString

qucs/schematic_file.cpp:943–976  ·  view source on GitHub ↗

------------------------------------------------------------- Creates a Qucs file format (without document properties) in the returning string. This is used to save state for undo operation.

Source from the content-addressed store, hash-verified

941// Creates a Qucs file format (without document properties) in the returning
942// string. This is used to save state for undo operation.
943QString Schematic::createUndoString(char Op)
944{
945 Wire *pw;
946 Diagram *pd;
947 Painting *pp;
948 Component *pc;
949
950 // Build element document.
951 QString s = " \n";
952 s.replace(0,1,Op);
953 for(pc = DocComps.first(); pc != 0; pc = DocComps.next()) {
954 QTextStream str(&s);
955 saveComponent(str, pc);
956 s += "\n";
957 }
958 s += "</>\n"; // short end flag
959
960 for(pw = DocWires.first(); pw != 0; pw = DocWires.next())
961 s += pw->save()+"\n";
962 // save all labeled nodes as wires
963 for(Node *pn = DocNodes.first(); pn != 0; pn = DocNodes.next())
964 if(pn->Label) s += pn->Label->save()+"\n";
965 s += "</>\n";
966
967 for(pd = DocDiags.first(); pd != 0; pd = DocDiags.next())
968 s += pd->save()+"\n";
969 s += "</>\n";
970
971 for(pp = DocPaints.first(); pp != 0; pp = DocPaints.next())
972 s += "<"+pp->save()+">\n";
973 s += "</>\n";
974
975 return s;
976}
977
978// -------------------------------------------------------------
979// Same as "createUndoString(char Op)" but for symbol edit mode.

Callers

nothing calls this directly

Calls 3

replaceMethod · 0.80
nextMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected