int heap_insert(Vector *h, int val) { // if(!h) // return ERROR_NULL_VECTOR; // if(h->size == h->capacity) // _vector_increase(h); int temp = h->size; while (temp > 0 && h->v[_parent(temp)] < val) { h->v[temp] = h->v[_parent(temp)]; temp = _parent(temp); } h->v[temp] = val; h->size++; return OK; }
BlendMode Widget::_getBlendMode() const { Container * pParent = _parent(); if( pParent ) return pParent->_getBlendMode(); else return BlendMode::Blend; // We always start out with BlendMode::Blend. }
PopupLayer * Container::_getPopupLayer() const { const Container * p = _parent(); if( p ) return p->_getPopupLayer(); else return 0; }
void daemon_t::run( ) { if ( _args.daemonize ) { DLOG( "daemonizing..." ); _parent(); } else { DLOG( "running in foreground..." ); _init(); _body(); }; // if }; // run
RootPanel * Hook::_root() const { Container * pParent = _parent(); if( pParent ) { Hook * pParentHook = pParent->_hook(); if( pParentHook ) return pParentHook->_root(); } return 0; }
/* ** Layout function. Here, we have to call MUI_Layout() for each ** our children. MUI wants us to place them in a rectangle ** defined by (0,0,lm->lm_Layout.Width-1,lm->lm_Layout.Height-1) ** You are free to put the children anywhere in this rectangle. */ BOOL MUI_Layout (Object *obj, LONG left, LONG top, LONG width, LONG height, ULONG flags) { static ULONG method = MUIM_Layout; Object *parent = _parent(obj); /* * Called only by groups, never by windows */ g_assert(parent != NULL); _left(obj) = left + _mleft(parent); _top(obj) = top + _mtop(parent); _width(obj) = width; _height(obj) = height; DoMethodA(obj, (Msg)&method); return TRUE; }
/************************************************************************** OM_SET **************************************************************************/ IPTR Numeric__OM_SET(struct IClass *cl, Object * obj, struct opSet *msg) { struct MUI_NumericData *data = INST_DATA(cl, obj); struct TagItem *tags, *tag; LONG oldval, oldmin, oldmax; STRPTR oldfmt; IPTR ret; BOOL values_changed = FALSE; oldval = data->value; oldfmt = data->format; oldmin = data->min; oldmax = data->max; for (tags = msg->ops_AttrList; (tag = NextTagItem((const struct TagItem **)&tags));) { switch (tag->ti_Tag) { case MUIA_Numeric_CheckAllSizes: _handle_bool_tag(data->flags, tag->ti_Data, NUMERIC_CHECKALLSIZES); break; case MUIA_Numeric_Default: /* data->defvalue = CLAMP(tag->ti_Data, data->min, data->max); */ data->defvalue = tag->ti_Data; break; case MUIA_Numeric_Format: data->format = (STRPTR)tag->ti_Data; break; case MUIA_Numeric_Max: data->max = tag->ti_Data; break; case MUIA_Numeric_Min: data->min = tag->ti_Data; break; case MUIA_Numeric_Reverse: _handle_bool_tag(data->flags, tag->ti_Data, NUMERIC_REVERSE); break; case MUIA_Numeric_RevLeftRight: _handle_bool_tag(data->flags, tag->ti_Data, NUMERIC_REVLEFTRIGHT); break; case MUIA_Numeric_RevUpDown: _handle_bool_tag(data->flags, tag->ti_Data, NUMERIC_REVUPDOWN); break; case MUIA_Numeric_Value: tag->ti_Data = CLAMP((LONG)tag->ti_Data, data->min, data->max); if (data->value == (LONG)tag->ti_Data) tag->ti_Tag = TAG_IGNORE; else data->value = (LONG)tag->ti_Data; break; } } /* If the max, min or format values changed, then the minimum and maximum sizes of the string output by MUIM_Numeric_Strigify maye have changed, so give the subclass a chance to recalculate them and relayout the group accordingly. Basically, the subclass will have to react on changes to these values as well (by setting a notification on them, or by overriding OM_SET) and then recalculate the minimum and maximum sizes for the object. */ if (data->format != oldfmt || data->min != oldmin || data->max != oldmax) { values_changed = TRUE; DoMethod(_parent(obj), MUIM_Group_InitChange); DoMethod(_parent(obj), MUIM_Group_ExitChange); } ret = DoSuperMethodA(cl, obj, (Msg)msg); if (data->value != oldval || values_changed) { MUI_Redraw(obj, MADF_DRAWUPDATE); } return ret; }
Panel_p PanelHook::parent() const { return static_cast<Panel*>(_parent()); }
void NodeManager::updateTransforms(const NodeRefArray& p_Nodes) { for (uint32_t nodeIdx = 0u; nodeIdx < p_Nodes.size(); ++nodeIdx) { NodeRef nodeRef = p_Nodes[nodeIdx]; NodeRef parentNodeRef = _parent(nodeRef); if (!parentNodeRef.isValid()) { _worldPosition(nodeRef) = _position(nodeRef); _worldOrientation(nodeRef) = _orientation(nodeRef); _worldSize(nodeRef) = _size(nodeRef); } else { const glm::vec3& parentPos = _worldPosition(parentNodeRef); const glm::quat& parentOrient = _worldOrientation(parentNodeRef); const glm::vec3& parentSize = _worldSize(parentNodeRef); const glm::vec3& localPos = _position(nodeRef); const glm::quat& localOrient = _orientation(nodeRef); const glm::vec3& localSize = _size(nodeRef); const glm::vec3 worldPos = parentPos + (parentOrient * localPos); const glm::quat worldOrient = parentOrient * localOrient; const glm::vec3 worldSize = parentSize * localSize; _worldPosition(nodeRef) = worldPos; _worldOrientation(nodeRef) = worldOrient; _worldSize(nodeRef) = worldSize; } glm::mat4 rot = glm::mat4_cast(NodeManager::_worldOrientation(nodeRef)); glm::mat4 trans = glm::translate(glm::mat4(1.0f), NodeManager::_worldPosition(nodeRef)); glm::mat4 scale = glm::scale(glm::mat4(1.0f), NodeManager::_worldSize(nodeRef)); _worldMatrix(nodeRef) = trans * rot * scale; _inverseWorldMatrix(nodeRef) = glm::inverse(_worldMatrix(nodeRef)); // Update AABB // TODO: Merge sub meshes Components::MeshRef meshCompRef = Components::MeshManager::getComponentForEntity(_entity(nodeRef)); if (meshCompRef.isValid()) { Name& meshName = Components::MeshManager::_descMeshName(meshCompRef); Resources::MeshRef meshRef = Resources::MeshManager::_getResourceByName(meshName); if (meshRef.isValid()) { const uint32_t aabbCount = (uint32_t)Resources::MeshManager::_aabbPerSubMesh(meshRef).size(); if (aabbCount > 0u) { _localAABB(nodeRef) = Resources::MeshManager::_aabbPerSubMesh(meshRef)[0u]; _worldAABB(nodeRef) = _localAABB(nodeRef); Math::transformAABBAffine(_worldAABB(nodeRef), _worldMatrix(nodeRef)); _worldBoundingSphere(nodeRef) = { Math::calcAABBCenter(_worldAABB(nodeRef)), glm::length(Math::calcAABBHalfExtent(_worldAABB(nodeRef)))}; } } } else { _worldAABB(nodeRef) = Math::AABB(_worldPosition(nodeRef) - glm::vec3(0.5f), _worldPosition(nodeRef) + glm::vec3(0.5f)); } } }
WgPanelPtr WgPanelHook::Parent() const { return static_cast<WgPanel*>(_parent()); }
Container_p Hook::parent() const { return _parent(); }