//JT void ObjList::AuditHeeksObjTree4Constraints(HeeksObj * SketchPtr ,HeeksObj * mom, int level,bool ShowMsgInConsole,bool *ConstraintsAreOk ) { wxString message=wxT(""); message.Pad(level*3,' ',true); message+=wxString::Format(wxT("%s ID=%d ") ,GetTypeString(),m_id); if (GetNumChildren() > 0)message+=wxString::Format(wxT(" (Kids:%d)") ,GetNumChildren()); if (ShowMsgInConsole)wxPuts(message); //At this point need to get some info about mom whether or not shee has kids //What's you lastman //How about your first name_id //Where to you really reside in memory if (GetNumChildren() > 0) { std::list<HeeksObj*>::iterator It; for(It=m_objects.begin(); It!=m_objects.end() ;It++) { if(((*It)==NULL)||((*It)==0)) wxMessageBox(wxT("this is a problem 201011260146")); (*It)->AuditHeeksObjTree4Constraints(SketchPtr ,this,level+1,ShowMsgInConsole,ConstraintsAreOk); } } }
int nsMsgSendPart::SetMimeDeliveryState(nsIMsgSend *state) { m_state = state; if (GetNumChildren() > 0) { for (int i = 0; i < GetNumChildren(); i++) { nsMsgSendPart *part = GetChild(i); if (part) part->SetMimeDeliveryState(state); } } return 0; }
nsresult nsMsgThread::ReparentNonReferenceChildrenOf(nsIMsgDBHdr *oldTopLevelHdr, nsMsgKey newParentKey, nsIDBChangeAnnouncer *announcer) { nsCOMPtr <nsIMsgDBHdr> curHdr; uint32_t numChildren; uint32_t childIndex = 0; GetNumChildren(&numChildren); for (childIndex = 0; childIndex < numChildren; childIndex++) { nsMsgKey oldTopLevelHdrKey; oldTopLevelHdr->GetMessageKey(&oldTopLevelHdrKey); nsresult rv = GetChildHdrAt(childIndex, getter_AddRefs(curHdr)); if (NS_SUCCEEDED(rv) && curHdr) { nsMsgKey oldThreadParent, curHdrKey; nsMsgHdr* oldTopLevelMsgHdr = static_cast<nsMsgHdr*>(oldTopLevelHdr); // closed system, cast ok curHdr->GetThreadParent(&oldThreadParent); curHdr->GetMessageKey(&curHdrKey); if (oldThreadParent == oldTopLevelHdrKey && curHdrKey != newParentKey && !oldTopLevelMsgHdr->IsParentOf(curHdr)) { curHdr->GetThreadParent(&oldThreadParent); curHdr->SetThreadParent(newParentKey); // OK, this is a reparenting - need to send notification if (announcer) announcer->NotifyParentChangedAll(curHdrKey, oldThreadParent, newParentKey, nullptr); } } } return NS_OK; }
void FlowPanel::Reflow() { if( !Rows || !Cols ) { return; } FVector2D ColsRows( Cols, Rows ); FVector2D tileDims = ( Size - (Pad*ColsRows) ) / ColsRows; //info( FS( "%s tileDims = %f %f", *Name, tileDims.X, tileDims.Y ) ); // +---+---+---+ // | | | | // +---+---+---+ // | | | | // +---+---+---+ // 0 1 2 // Set new bounds for container for( int i = 0; i < GetNumChildren(); i++ ) { int row = i / Cols; int col = i % Cols; FVector2D pos = Pad/2.f + ( Pad + tileDims ) * FVector2D( col, row ); GetChild(i)->Margin = pos; GetChild(i)->Size = tileDims; } Image::Reflow(); }
nsresult nsMsgGroupThread::ReparentNonReferenceChildrenOf(nsIMsgDBHdr *topLevelHdr, nsMsgKey newParentKey, nsIDBChangeAnnouncer *announcer) { #if 0 nsCOMPtr <nsIMsgDBHdr> curHdr; PRUint32 numChildren; PRUint32 childIndex = 0; GetNumChildren(&numChildren); for (childIndex = 0; childIndex < numChildren; childIndex++) { nsMsgKey msgKey; topLevelHdr->GetMessageKey(&msgKey); nsresult ret = GetChildHdrAt(childIndex, getter_AddRefs(curHdr)); if (NS_SUCCEEDED(ret) && curHdr) { nsMsgKey oldThreadParent, curHdrKey; nsIMsgDBHdr *curMsgHdr = curHdr; curHdr->GetThreadParent(&oldThreadParent); curHdr->GetMessageKey(&curHdrKey); if (oldThreadParent == msgKey && curHdrKey != newParentKey && topLevelMsgHdr->IsParentOf(curHdr)) { curHdr->GetThreadParent(&oldThreadParent); curHdr->SetThreadParent(newParentKey); // OK, this is a reparenting - need to send notification if (announcer) announcer->NotifyParentChangedAll(curHdrKey, oldThreadParent, newParentKey, nsnull); } } } #endif return NS_OK; }
nsresult nsMsgGroupThread::AddChildFromGroupView(nsIMsgDBHdr *child, nsMsgDBView *view) { PRUint32 newHdrFlags = 0; PRUint32 msgDate; nsMsgKey newHdrKey = 0; child->GetFlags(&newHdrFlags); child->GetMessageKey(&newHdrKey); child->GetDateInSeconds(&msgDate); if (msgDate > m_newestMsgDate) SetNewestMsgDate(msgDate); child->AndFlags(~(MSG_FLAG_WATCHED), &newHdrFlags); PRUint32 numChildren; // get the num children before we add the new header. GetNumChildren(&numChildren); // if this is an empty thread, set the root key to this header's key if (numChildren == 0) m_threadRootKey = newHdrKey; if (! (newHdrFlags & MSG_FLAG_READ)) ChangeUnreadChildCount(1); return AddMsgHdrInDateOrder(child, view); }
void CSketch::GetTools(std::list<Tool*>* t_list, const wxPoint* p) { sketch_for_tools = this; if (GetNumChildren() > 1) { t_list->push_back(&split_sketch); } t_list->push_back(&convert_sketch_to_face); // t_list->push_back(&convert_sketch_to_wire); t_list->push_back(&sketch_arcs_to_lines); t_list->push_back(©_parallel); t_list->push_back(&enter_sketch_mode); Drawing *pDrawingMode = dynamic_cast<Drawing *>(wxGetApp().input_mode_object); if (pDrawingMode != NULL) { // We're drawing something. Allow these options. t_list->push_back(&click_midpoint_of_sketch); t_list->push_back(&click_northern_midpoint_of_sketch); t_list->push_back(&click_southern_midpoint_of_sketch); t_list->push_back(&click_eastern_midpoint_of_sketch); t_list->push_back(&click_western_midpoint_of_sketch); } }
void ObjList::FindConstrainedObj(HeeksObj * CurrentObject,HeeksObj * ObjectToFind,int * occurrences,int FromLevel,int Level,bool ShowMsgInConsole) { //if we hit this it's the end of the line wxString searchmessage; //Moving the next two line inside the if,but it will reduce the output to view on big projectes searchmessage.Pad((FromLevel+1)*3+9+Level,' '); searchmessage += wxString::Format(wxT("%s ID=%d ") ,GetTypeString(),m_id);//I if (this == ObjectToFind) { //Originally had the next two lines outside the if,but it generated too much output to view on big projectes (*occurrences)++; searchmessage += wxT(" $$$ MATCH $$$"); } if (ShowMsgInConsole)wxPuts(searchmessage); if (GetNumChildren() > 0) { std::list<HeeksObj*>::iterator It; for(It=m_objects.begin(); It!=m_objects.end() ;It++) { (*It)->FindConstrainedObj((*It),ObjectToFind, occurrences,FromLevel,Level+1,ShowMsgInConsole); } } }
void RadialPlot::ScanTree(void const *node, unsigned int level, double startAngle, double endAngle) { if (numItems >= maxNumItems) Grow(); if (autoLevel && level > maxLevel) maxLevel = level; items[numItems].handle = node; items[numItems].level = level; items[numItems].startAngle = startAngle; items[numItems].endAngle = endAngle; items[numItems].id = GetId(node); items[numItems].color = GenerateElementColor(node); numItems++; int numChildren = GetNumChildren(node); unsigned int value = GetValue(node); double cAngle = startAngle; for (int i =0; i < numChildren ; i++) { void const *child = GetChild(node, i); unsigned int cValue = GetValue(child); double arc = (endAngle - startAngle) * cValue / value; ScanTree(child, level + 1, cAngle, cAngle + arc); cAngle += arc; } }
bool COrientationModifier::CanAdd(HeeksObj* object) { if (object == NULL) return(false); // We only want a single sketch. Make sure we don't already have one. if (GetNumChildren() > 0) { // Don't popup a warning as this code gets called by the Undo engine // when the file is initially read in as well. /* wxString message; message << _("Only a single sketch is supported"); wxMessageBox(message); */ return(false); } switch (object->GetType()) { case SketchType: return(true); default: return(false); } // End switch }
void GuiList::SetSelected(int child, bool selected) { Assert(child < GetNumChildren()); #ifdef LB_DEBUG GuiText* text = dynamic_cast<GuiText*>(GetChild(child)); if (text) { std::cout << "List box " << m_name << ": " << text->GetText() << (selected ? " selected" : " UNselected") << "\n"; } #endif if (selected && !IsMultiSel()) { // Not multi select, so at most one member in set. for (SelSet::iterator it = m_selset.begin(); it != m_selset.end(); ++it) { int i = *it; GetChild(i)->SetSelected(false); } m_selset.clear(); } GetChild(child)->SetSelected(selected); if (selected) { m_selset.insert(child); } else { m_selset.erase(child); } }
NS_IMETHODIMP nsMsgXFViewThread::GetNewestMsgDate(PRUint32 *aResult) { // if this hasn't been set, figure it out by enumerating the msgs in the thread. if (!m_newestMsgDate) { PRUint32 numChildren; nsresult rv = NS_OK; GetNumChildren(&numChildren); if ((PRInt32) numChildren < 0) numChildren = 0; for (PRUint32 childIndex = 0; childIndex < numChildren; childIndex++) { nsCOMPtr<nsIMsgDBHdr> child; rv = GetChildHdrAt(childIndex, getter_AddRefs(child)); if (NS_SUCCEEDED(rv) && child) { PRUint32 msgDate; child->GetDateInSeconds(&msgDate); if (msgDate > m_newestMsgDate) m_newestMsgDate = msgDate; } } } *aResult = m_newestMsgDate; return NS_OK; }
/** Accumulate a list of TopoDS_Edge objects along with their lengths. We will use this repeatedly while we're rendering this text string. We don't want to re-aquire this information for every point of every character. Cache it here. This method should be called once before each rendering session for the text string. */ void COrientationModifier::InitializeFromSketch() { m_edges.clear(); m_total_edge_length = 0.0; if (GetNumChildren() > 0) { std::list<TopoDS_Shape> wires; if (::ConvertSketchToFaceOrWire( GetFirstChild(), wires, false)) { // Aggregate a list of TopoDS_Edge objects and each of their lengths. We can // use this list to skip through edges that we're not interested in. i.e. the // text won't sit on top of them. for (std::list<TopoDS_Shape>::iterator itWire = wires.begin(); itWire != wires.end(); itWire++) { TopoDS_Wire wire(TopoDS::Wire(*itWire)); for(BRepTools_WireExplorer expEdge(TopoDS::Wire(wire)); expEdge.More(); expEdge.Next()) { TopoDS_Edge edge(TopoDS_Edge(expEdge.Current())); BRepAdaptor_Curve curve(edge); double edge_length = GCPnts_AbscissaPoint::Length(curve); m_edges.push_back( std::make_pair(edge,edge_length) ); m_total_edge_length += edge_length; } // End for } // End for } // End if - then } // End if - then }
NS_IMETHODIMP nsMsgXFViewThread::GetFirstUnreadChild(nsIMsgDBHdr **aResult) { NS_ENSURE_ARG(aResult); PRUint32 numChildren; nsresult rv = NS_OK; GetNumChildren(&numChildren); if ((PRInt32) numChildren < 0) numChildren = 0; for (PRUint32 childIndex = 0; childIndex < numChildren; childIndex++) { nsCOMPtr<nsIMsgDBHdr> child; rv = GetChildHdrAt(childIndex, getter_AddRefs(child)); if (NS_SUCCEEDED(rv) && child) { nsMsgKey msgKey; child->GetMessageKey(&msgKey); bool isRead; nsCOMPtr<nsIMsgDatabase> db; nsresult rv = m_folders[childIndex]->GetMsgDatabase(getter_AddRefs(db)); if (NS_SUCCEEDED(rv)) rv = db->IsRead(msgKey, &isRead); if (NS_SUCCEEDED(rv) && !isRead) { NS_ADDREF(*aResult = child); break; } } } return rv; }
NS_IMETHODIMP nsMsgGroupThread::GetFirstUnreadChild(nsIMsgDBHdr **result) { NS_ENSURE_ARG(result); uint32_t numChildren; nsresult rv = NS_OK; GetNumChildren(&numChildren); if ((int32_t) numChildren < 0) numChildren = 0; for (uint32_t childIndex = 0; childIndex < numChildren; childIndex++) { nsCOMPtr <nsIMsgDBHdr> child; rv = GetChildHdrAt(childIndex, getter_AddRefs(child)); if (NS_SUCCEEDED(rv) && child) { nsMsgKey msgKey; child->GetMessageKey(&msgKey); bool isRead; rv = m_db->IsRead(msgKey, &isRead); if (NS_SUCCEEDED(rv) && !isRead) { *result = child; NS_ADDREF(*result); break; } } } return rv; }
nsresult nsMsgGroupThread::GetChildHdrForKey(nsMsgKey desiredKey, nsIMsgDBHdr **result, int32_t *resultIndex) { uint32_t numChildren; uint32_t childIndex = 0; nsresult rv = NS_OK; // XXX or should this default to an error? if (!result) return NS_ERROR_NULL_POINTER; GetNumChildren(&numChildren); if ((int32_t) numChildren < 0) numChildren = 0; for (childIndex = 0; childIndex < numChildren; childIndex++) { rv = GetChildHdrAt(childIndex, result); if (NS_SUCCEEDED(rv) && *result) { nsMsgKey msgKey; // we're only doing one level of threading, so check if caller is // asking for children of the first message in the thread or not. // if not, we will tell him there are no children. (*result)->GetMessageKey(&msgKey); if (msgKey == desiredKey) break; NS_RELEASE(*result); } } if (resultIndex) *resultIndex = childIndex; return rv; }
nsMsgViewIndex nsMsgGroupThread::AddChildFromGroupView(nsIMsgDBHdr *child, nsMsgDBView *view) { uint32_t newHdrFlags = 0; uint32_t msgDate; nsMsgKey newHdrKey = 0; child->GetFlags(&newHdrFlags); child->GetMessageKey(&newHdrKey); child->GetDateInSeconds(&msgDate); if (msgDate > m_newestMsgDate) SetNewestMsgDate(msgDate); child->AndFlags(~(nsMsgMessageFlags::Watched), &newHdrFlags); uint32_t numChildren; // get the num children before we add the new header. GetNumChildren(&numChildren); // if this is an empty thread, set the root key to this header's key if (numChildren == 0) m_threadRootKey = newHdrKey; if (! (newHdrFlags & nsMsgMessageFlags::Read)) ChangeUnreadChildCount(1); return AddMsgHdrInDateOrder(child, view); }
NS_IMETHODIMP nsMsgThread::GetFirstUnreadChild(nsIMsgDBHdr **result) { NS_ENSURE_ARG_POINTER(result); uint32_t numChildren; nsresult rv = NS_OK; uint8_t minLevel = 0xff; GetNumChildren(&numChildren); if ((int32_t) numChildren < 0) numChildren = 0; nsCOMPtr <nsIMsgDBHdr> retHdr; for (uint32_t childIndex = 0; childIndex < numChildren; childIndex++) { nsCOMPtr <nsIMsgDBHdr> child; rv = GetChildHdrAt(childIndex, getter_AddRefs(child)); if (NS_SUCCEEDED(rv) && child) { nsMsgKey msgKey; child->GetMessageKey(&msgKey); bool isRead; rv = m_mdbDB->IsRead(msgKey, &isRead); if (NS_SUCCEEDED(rv) && !isRead) { // this is the root, so it's the best we're going to do. if (msgKey == m_threadRootKey) { retHdr = child; break; } uint8_t level = 0; nsMsgKey parentId; child->GetThreadParent(&parentId); nsCOMPtr <nsIMsgDBHdr> parent; // count number of ancestors - that's our level while (parentId != nsMsgKey_None) { rv = m_mdbDB->GetMsgHdrForKey(parentId, getter_AddRefs(parent)); if (parent) { parent->GetThreadParent(&parentId); level++; } } if (level < minLevel) { minLevel = level; retHdr = child; } } } } NS_IF_ADDREF(*result = retHdr); return rv; }
const DeltaDrawable* DeltaDrawablePrivate::GetChild(unsigned int idx) const { if (idx >= GetNumChildren()) { return NULL; } return mChildList[idx].get(); }
void CSketch::WriteXML(TiXmlNode *root) { if (GetNumChildren() > 0) { TiXmlElement * element = new TiXmlElement( "Sketch" ); root->LinkEndChild( element ); element->SetAttribute("title", m_title.utf8_str()); WriteBaseXML(element); } }
NS_IMETHODIMP nsMsgGroupThread::GetRootHdr(int32_t *resultIndex, nsIMsgDBHdr **result) { if (!result) return NS_ERROR_NULL_POINTER; *result = nullptr; if (m_threadRootKey != nsMsgKey_None) { nsresult ret = GetChildHdrForKey(m_threadRootKey, result, resultIndex); if (NS_SUCCEEDED(ret) && *result) return ret; else { printf("need to reset thread root key\n"); uint32_t numChildren; nsMsgKey threadParentKey = nsMsgKey_None; GetNumChildren(&numChildren); for (int32_t childIndex = 0; childIndex < (int32_t) numChildren; childIndex++) { nsCOMPtr <nsIMsgDBHdr> curChild; ret = GetChildHdrAt(childIndex, getter_AddRefs(curChild)); if (NS_SUCCEEDED(ret) && curChild) { nsMsgKey parentKey; curChild->GetThreadParent(&parentKey); if (parentKey == nsMsgKey_None) { NS_ASSERTION(!(*result), "two top level msgs, not good"); curChild->GetMessageKey(&threadParentKey); m_threadRootKey = threadParentKey; if (resultIndex) *resultIndex = childIndex; *result = curChild; NS_ADDREF(*result); // ReparentMsgsWithInvalidParent(numChildren, threadParentKey); // return NS_OK; } } } if (*result) { return NS_OK; } } // if we can't get the thread root key, we'll just get the first hdr. // there's a bug where sometimes we weren't resetting the thread root key // when removing the thread root key. } if (resultIndex) *resultIndex = 0; return GetChildHdrAt(0, result); }
void CullGrid (void) { int i; for (i = 0; i < numnodes; i++) { // delete nodes that have no children if (GetNumChildren(i, numnodes) < 1) DeleteNode(i); } }
void PlayListFolder::DumpToTTY(int level) { std::string indent = ""; for (int i = 0; i < level; ++i) indent += " "; LOG4CPLUS_DEBUG(logger, (boost::format("Folder [%s]") % GetName())); ++level; int numPlayLists = GetNumChildren(); for (int i = 0; i < numPlayLists; i++) GetChild(i)->DumpToTTY(level); }
bool ConfigToken::Compare(const ConfigToken *compareToken) const { if(!compareToken) { return false; } //Compare the name/values count/children count if(GetName() != compareToken->GetName() || GetNumValues() != compareToken->GetNumValues() || GetNumChildren() != compareToken->GetNumChildren()) { return false; } //Compare the values for(uint i=0;i<GetNumValues();i++) { //Compare each array value if(values[i] != compareToken->values[i]) { return false; } } //Loop and compare the children for(uint childNum=0; childNum<GetNumChildren(); childNum++) { //Recurse through all the children // (without setting the accessed flag) if(!children[childNum].Compare(&compareToken->children[childNum])) { return false; } } return true; }
void CBaseContainerNode::FullHierachyUpdate() { #if 0 CUtlVector< CBaseNode* > hListTopNodes; for ( int i = 0; i < GetNumChildren(); i++ ) { CBaseNode *nChild = GetChild( i ); nChild->Recursive_AddTailNodes( hListTopNodes, true, false, this ); } for ( int i = 0; i < hListTopNodes.Count(); i++ ) { hListTopNodes[ i ]->OnUpdateHierachy( NULL, NULL ); } hListTopNodes.Purge(); #elif 0 bool bHierachyError = ERRORLEVEL_NONE; int CurrentHierachy = HLSLHIERACHY_NONE; for ( int i = 0; i < GetNumChildren(); i++ ) { int NodeHierachy = GetChild( i )->GetHierachyTypeIterateFullyRecursive(); if ( CurrentHierachy != HLSLHIERACHY_NONE && (NodeHierachy != CurrentHierachy || CurrentHierachy == HLSLHIERACHY_MULTIPLE) ) bHierachyError = true; else CurrentHierachy = NodeHierachy; if ( bHierachyError ) break; } int iErrorLevel = ERRORLEVEL_NONE; if ( bHierachyError ) iErrorLevel = ERRORLEVEL_FAIL; for ( int i = 0; i < GetNumChildren(); i++ ) iErrorLevel = max( iErrorLevel, GetChild( i )->GetErrorLevel() ); if ( iErrorLevel != ERRORLEVEL_NONE ) { for ( int i = 0; i < GetNumChildren(); i++ ) GetChild( i )->SetErrorLevel( iErrorLevel ); } for ( int i = 0; i < GetNumChildren(); i++ ) { GetChild( i )->OnUpdateHierachy( NULL, NULL ); } #else if ( !IsAffectingSolver() ) return; for ( int i = 0; i < GetNumChildren(); i++ ) { GetChild( i )->OnUpdateHierachy( NULL, NULL ); } #endif }
bool PlayListContainer::IsLoading(bool recursive) { if (loading_) return true; if (recursive) { int numPlayLists = GetNumChildren(); for (int i = 0; i < numPlayLists; i++) { if (playlists_[i]->IsLoading(recursive)) return true; } } return false; }
int GuiList::GetSelectedItem() const { // only for non-multi-select lists Assert(!IsMultiSel()); int c = GetNumChildren(); for (int i = 0; i < c; i++) { if (IsSelected(i)) { return i; } } return -1; }
Core::Element* ElementTabSet::GetChildByTag(const Rocket::Core::String& tag) { // Look for the existing child for (int i = 0; i < GetNumChildren(); i++) { if (GetChild(i)->GetTagName() == tag) return GetChild(i); } // If it doesn't exist, create it Core::Element* element = Core::Factory::InstanceElement(this, "*", tag, Rocket::Core::XMLAttributes()); AppendChild(element); element->RemoveReference(); return element; }
bool ConfigToken::RemoveChild(const string &childString) { //Loop and search for the child name for(uint i=0; i<GetNumChildren(); i++) { // If found, remove it if(children[i].GetName() == childString) { children.erase(children.begin() + i); return true; } } return false; }
/* * A few notes on the delay transform properties... * * The kCanEverDelayTransform prop is independent of any parents/children. * It means this particular node must always update its transform in response * to a plTransformMsg. It is intended for objects with physics, because they * need to be up-to-date before the simulationMgr updates the physical world. * * The kDelayedTransformEval prop is for nodes that are free of physics. (So no * physical descendants either). If the property is set, we won't update our * transform until AFTER the simulationMgr does its work. * * When we attach a child that can't delay its eval (at the moment), we recurse * up to the root, turning off the kDelayedTransformEval prop as we go. When we * remove such a child, we check if that child was the only reason we weren't * delaying our transform. If so, we update ourself and tell our parent to check. * * BTW: The POINT of all this is that when we update our l2w transforms because * we're animated, and then we update AGAIN after a parent node of ours involved * in physics gets a slight nudge, the first update becomes pointless. The * delay prop bookkeeping keeps us from doing the wasted calculations. And since * nearly all bones on the avatar are in this exact situation, it's worth doing. */ void plCoordinateInterface::IUpdateDelayProp() { int i; if (!GetProperty(kCanEverDelayTransform)) return; for (i = 0; i < GetNumChildren(); i++) { // If we still have a child that needs the delay... if (!GetChild(i)->GetProperty(kDelayedTransformEval)) return; } // Cool, we can delay now, which means maybe our parent can too. SetProperty(kDelayedTransformEval, true); if (GetParent()) GetParent()->IUpdateDelayProp(); }