From: Matthew G. <mat...@us...> - 2007-03-04 08:14:05
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29022/src/gui Modified Files: doc.cpp Log Message: Add new function: If a component is deleted and there is only one input and one output, the previous and next component be connected automatically. Index: doc.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/doc.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** doc.cpp 24 Feb 2007 18:39:08 -0000 1.9 --- doc.cpp 4 Mar 2007 08:13:57 -0000 1.10 *************** *** 474,485 **** if (shape) { ! shape->Select (false); ! // Generate commands to explicitly remove each connected line. ! RemoveLines (shape); ! GetActiveDiagram()->RemoveShape (shape); ! shape->Unlink (); ! shape->GetCanvas ()->Refresh (); } } --- 474,518 ---- if (shape) { ! shape->Select (false); ! // Generate commands to explicitly remove each connected line. ! MISOShape * cshape = wxDynamicCast( shape, MISOShape); ! if (cshape && cshape->GetLines().GetCount() > 1) ! { ! wxObjectList::compatibility_iterator node = cshape->GetLines ().GetFirst (); ! wxLineShape *remainLine=NULL; ! wxShape *upshape=NULL; ! int m = 99999; ! while (node) ! { ! wxLineShape *line = (wxLineShape *) node->GetData (); ! if (line->GetFrom() == cshape) ! { ! remainLine=line; ! } ! else ! { ! if (line->GetAttachmentTo() < m) ! { ! upshape = line->GetFrom(); ! m = line->GetAttachmentTo(); ! } ! line->Select (false); ! GetActiveDiagram()->RemoveShape (line); ! line->Unlink (); ! } ! node = node->GetNext (); ! } ! remainLine->SetFrom(upshape); ! MISOShape::NormalizeLine(remainLine); ! } ! else ! { ! RemoveLines (shape); ! } ! GetActiveDiagram()->RemoveShape (shape); ! shape->Unlink (); ! shape->GetCanvas ()->Refresh (); } } |