[Igarden-commit] Garden/source/LayoutDB BSPNode.cpp, 1.28.2.2, 1.28.2.3 Layer.cpp, 1.21.2.2, 1.21.2
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2007-01-31 01:16:52
|
Update of /cvsroot/igarden/Garden/source/LayoutDB In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31248 Modified Files: Tag: Release_branch_v1 BSPNode.cpp Layer.cpp BSPNode.h Log Message: Fix an issue where objects change draw order when being dragged Index: BSPNode.h =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/BSPNode.h,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -C2 -d -r1.15.2.1 -r1.15.2.2 *** BSPNode.h 15 Nov 2006 03:54:56 -0000 1.15.2.1 --- BSPNode.h 31 Jan 2007 01:16:47 -0000 1.15.2.2 *************** *** 79,82 **** --- 79,83 ---- void RemoveWarningsMatching(warningType_t wtype); void ExecuteForEachElementWithin(elementCB_t callback, void *ref, planRectangle_t clipRect); + bool ContainsElement( Element * item ); protected: Index: BSPNode.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/BSPNode.cpp,v retrieving revision 1.28.2.2 retrieving revision 1.28.2.3 diff -C2 -d -r1.28.2.2 -r1.28.2.3 *** BSPNode.cpp 15 Nov 2006 03:54:56 -0000 1.28.2.2 --- BSPNode.cpp 31 Jan 2007 01:16:47 -0000 1.28.2.3 *************** *** 500,504 **** } } ! if(!found && (_nodes[0] != NULL)) found = _nodes[0]->RemoveElement(item); --- 500,504 ---- } } ! if(!found && (_nodes[0] != NULL)) found = _nodes[0]->RemoveElement(item); *************** *** 517,520 **** --- 517,550 ---- // --------------------------------------------------------------------------- + // bool BSPNode::ContainsElement( Element * item ) + // --------------------------------------------------------------------------- + // + /* Remove an element from the tree, and stop persisting the element. Returns true if the element is found as a speed optimization. */ + bool BSPNode::ContainsElement( Element * item ) + { + bool found = false; + Element *elem; + Int32 n, count; + + PRECONDITION(_lockDepth == 0); + count = _elements.Length(); + for(n = 0; !found && n < count; n++) + { + elem = _elements[n]; + if(elem == item) + found = true; + } + + if(!found && (_nodes[0] != NULL)) + found = _nodes[0]->ContainsElement(item); + if(!found && (_nodes[1] != NULL)) + found = _nodes[1]->ContainsElement(item); + + return found; + } + + + + // --------------------------------------------------------------------------- // bool BSPNode::AddToSelect( planRectangle_t within, SelectedElements* selected, PlanView* view ) // --------------------------------------------------------------------------- *************** *** 861,864 **** --- 891,896 ---- bool needsReAdd = false; + PRECONDITION(ContainsElement(element)); + if(_nodes[0] != NULL) { Index: Layer.cpp =================================================================== RCS file: /cvsroot/igarden/Garden/source/LayoutDB/Layer.cpp,v retrieving revision 1.21.2.2 retrieving revision 1.21.2.3 diff -C2 -d -r1.21.2.2 -r1.21.2.3 *** Layer.cpp 28 Jan 2007 23:28:19 -0000 1.21.2.2 --- Layer.cpp 31 Jan 2007 01:16:47 -0000 1.21.2.3 *************** *** 219,225 **** --- 219,230 ---- short i, count; + // printf("Start Print\n"); count = _roots.Length(); for(i = 0; i < count; i++) + { + // printf("Printing depth %d\n", i); _roots[i]->Draw(view, _bounds); + } + // printf("End Print\n"); } } *************** *** 270,276 **** short i, count; count = _roots.Length(); ! for(i = 0; i < count; i++) ! _roots[i]->RemoveElement(item); item->ClearLayer(); SetModified(); --- 275,283 ---- short i, count; + bool found = false; + count = _roots.Length(); ! for(i = 0; i < count && !found; i++) ! found = _roots[i]->RemoveElement(item); item->ClearLayer(); SetModified(); *************** *** 290,301 **** short i, count; - bool moved = false; count = _roots.Length(); ! for(i = 0; i < count && !moved; i++) { ! if(_roots[i]->MoveElement(fromRect, toRect, item)) ! moved = true; ! else ! ItemBoundRectChanged(toRect); // If not changed bucket, might still need to grow rect } SetModified(); --- 297,309 ---- short i, count; count = _roots.Length(); ! for(i = 0; i < count; i++) { ! if(_roots[i]->ContainsElement(item)) ! { ! if(!_roots[i]->MoveElement(fromRect, toRect, item)) ! ItemBoundRectChanged(toRect); // If not changed bucket, might still need to grow rect ! break; ! } } SetModified(); |