Example #1
0
void UIWidget::focusChild(const UIWidgetPtr& child, Fw::FocusReason reason)
{
    if(m_destroyed)
        return;

    if(child == m_focusedChild)
        return;

    if(child && !hasChild(child)) {
        g_logger.error("attempt to focus an unknown child in a UIWidget");
        return;
    }

    UIWidgetPtr oldFocused = m_focusedChild;
    m_focusedChild = child;

    if(child) {
        child->setLastFocusReason(reason);
        child->updateState(Fw::FocusState);
        child->updateState(Fw::ActiveState);

        child->onFocusChange(true, reason);
    }

    if(oldFocused) {
        oldFocused->setLastFocusReason(reason);
        oldFocused->updateState(Fw::FocusState);
        oldFocused->updateState(Fw::ActiveState);

        oldFocused->onFocusChange(false, reason);
    }

    onChildFocusChange(child, oldFocused, reason);
}
TIME OptimisticLowOverheadCommSyncAlgo::GetNextTime(TIME currentTime, TIME nextTime)
{
    if(nextTime < grantedTime)
        return grantedTime;
#if DEBUG
    CERR << "Start sync " << currentTime << " " << nextTime << endl;
#endif
    if(currentTime > this->specFailTime){ //we passed beyond spec. failure time. We can speculatie again.
        this->specFailTime=Infinity;
    }

    /*if(this->isChild) //if a child comes here, algorithm is not working!
      throw SyncStateException("Child wants to sync but parent is still alive cannot happen!");*/

    uint64_t diff=interface->reduceTotalSendReceive();

    if(diff > 0)
        this->interface->packetLostCalculator(currentTime);

    TIME minnetworkdelay=interface->reduceNetworkDelay();
    //We never wait for comm sim, instead we wait for oter sims
    TIME specNextTime=Infinity; //netsim follows what the power simulates do
    TIME minNextTime=Infinity;

#ifdef DEBUG
    CERR << "Consensus on message-diff " << diff << endl;
#endif
    if(diff == 0)
        if(!hasChild()){
            interface->aggreateReduceMin(minNextTime,specNextTime);

        }else{
            globalAction=comm->action;
            interface->aggreateReduceMin(minNextTime,globalAction);
        }
        else{//diff!=0 only reduce min op
        	checkChild(diff);
            minNextTime=(TIME)interface->reduceMinTime(Infinity);
            specNextTime=0;
        }
#ifdef DEBUG
    CERR << "Consensus " << minNextTime << " spec: " << specNextTime << endl;
#endif
    //speculation stuff!!
    TIME specResult=testSpeculationState(specNextTime,currentTime);
    if(specResult > 0) //we are in child! We are granted up to specNextTime
        minNextTime=specNextTime;
    //normal convervative algorithm!!!
    //If min time is infinity then there is something with the comm!
    if(minNextTime==Infinity){
#if DEBUG
        CERR << "End Signaled!" << endl;
#endif
        this->finished=true;
        return Infinity;
    }
    this->grantedTime=minNextTime;

    return minNextTime;    
}
Example #3
0
void initializeExtendedSystem() {
	// Configure the ISA IRQs.
	// TODO: This is a hack. We assume that HPET will use legacy replacement
	// and that SCI is routed to IRQ 9.
	frigg::infoLogger() << "thor: Configuring ISA IRQs." << frigg::endLog;
	commitIrq(resolveIrq(0));
	commitIrq(resolveIrq(1));
	commitIrq(resolveIrq(4));
	commitIrq(resolveIrq(9));
	commitIrq(resolveIrq(12));
	commitIrq(resolveIrq(14));
	
	frigg::infoLogger() << "thor: Entering ACPI mode." << frigg::endLog;
	ACPICA_CHECK(AcpiEnableSubsystem(ACPI_FULL_INITIALIZATION));

	ACPICA_CHECK(AcpiInstallFixedEventHandler(ACPI_EVENT_POWER_BUTTON,
			&handlePowerButton, nullptr));
	ACPICA_CHECK(AcpiInstallGlobalEventHandler(&dispatchEvent, nullptr));

	ACPICA_CHECK(AcpiInitializeObjects(ACPI_FULL_INITIALIZATION));
	
	if(hasChild(ACPI_ROOT_OBJECT, "_PIC")) {
		frigg::infoLogger() << "thor: Invoking \\_PIC method" << frigg::endLog;
		evaluateWith1(getChild(ACPI_ROOT_OBJECT, "_PIC"));
	}

	bootOtherProcessors();
	enumerateSystemBusses();

	initializePmInterface();
	
	frigg::infoLogger() << "thor: System configuration complete." << frigg::endLog;
}
// Return the occurence Bounding Box
GLC_BoundingBox GLC_StructOccurence::boundingBox() const
{
	GLC_BoundingBox boundingBox;

	if (!isOrphan() && (NULL != m_pWorldHandle))
	{
		if (m_HasRepresentation)
		{
			Q_ASSERT(m_pWorldHandle->collection()->contains(id()));
			boundingBox= m_pWorldHandle->collection()->instanceHandle(id())->boundingBox();
		}
		else
		{
			if (hasChild())
			{
				QList<GLC_StructOccurence*> childrenList= children();
				const int size= childrenList.size();

				for (int i= 0; i < size; ++i)
				{
					boundingBox.combine(childrenList.at(i)->boundingBox());
				}
			}
		}
	}
	return boundingBox;
}
Example #5
0
void UIWidget::removeChild(UIWidgetPtr child)
{
    // remove from children list
    if(hasChild(child)) {
        // defocus if needed
        bool focusAnother = false;
        if(m_focusedChild == child) {
            focusChild(nullptr, Fw::ActiveFocusReason);
            focusAnother = true;
        }

        if(isChildLocked(child))
            unlockChild(child);

        auto it = std::find(m_children.begin(), m_children.end(), child);
        m_children.erase(it);

        // reset child parent
        assert(child->getParent() == static_self_cast<UIWidget>());
        child->setParent(nullptr);

        m_layout->removeWidget(child);

        // update child states
        child->updateStates();
        updateChildrenIndexStates();

        if(m_autoFocusPolicy != Fw::AutoFocusNone && focusAnother && !m_focusedChild)
            focusPreviousChild(Fw::ActiveFocusReason, true);

        g_ui.onWidgetDisappear(child);
    } else
        g_logger.traceError("attempt to remove an unknown child from a UIWidget");
}
Example #6
0
void UIWidget::lockChild(const UIWidgetPtr& child)
{
    if(m_destroyed)
        return;

    if(!child)
        return;

    if(!hasChild(child)) {
        logTraceError("cannot find child");
        return;
    }

    // prevent double locks
    if(isChildLocked(child))
        unlockChild(child);

    // disable all other children
    for(const UIWidgetPtr& otherChild : m_children) {
        if(otherChild == child)
            child->setEnabled(true);
        else
            otherChild->setEnabled(false);
    }

    m_lockedChildren.push_front(child);

    // lock child focus
    if(child->isFocusable())
        focusChild(child, Fw::ActiveFocusReason);
}
Example #7
0
void UIWidget::lockChild(const UIWidgetPtr& child)
{
    if(!child)
        return;

    assert(hasChild(child));

    // prevent double locks
    if(isChildLocked(child))
        unlockChild(child);

    // disable all other children
    for(const UIWidgetPtr& otherChild : m_children) {
        if(otherChild == child)
            child->setEnabled(true);
        else
            otherChild->setEnabled(false);
    }

    m_lockedChildren.push_front(child);

    // lock child focus
    if(child->isFocusable())
        focusChild(child, Fw::ActiveFocusReason);

    moveChildToTop(child);
}
Example #8
0
void LLFloaterTOS::setSiteIsAlive( bool alive )
{
	mSiteAlive = alive;
	
	// only do this for TOS pages
	if (hasChild("tos_html"))
	{
		// if the contents of the site was retrieved
		if ( alive )
		{
			// navigate to the "real" page 
			if(!mRealNavigateBegun && mSiteAlive)
			{
				LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
				if(web_browser)
				{
					mRealNavigateBegun = true;
					web_browser->navigateTo( getString( "real_url" ) );
				}
			}
		}
		else
		{
			LL_INFOS("TOS") << "ToS page: ToS page unavailable!" << LL_ENDL;
			// normally this is set when navigation to TOS page navigation completes (so you can't accept before TOS loads)
			// but if the page is unavailable, we need to do this now
			LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk");
			tos_agreement->setEnabled( true );
		}
	}
}
Example #9
0
void UIWidget::addChild(const UIWidgetPtr& child)
{
    if(!child) {
        logWarning("attempt to add a null child into a UIWidget");
        return;
    }

    if(hasChild(child)) {
        logWarning("attempt to add a child again into a UIWidget");
        return;
    }

    m_children.push_back(child);
    child->setParent(asUIWidget());

    // create default layout
    if(!m_layout)
        m_layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));

    // add to layout and updates it
    m_layout->addWidget(child);

    // update new child states
    child->updateStates();
    updateChildrenIndexStates();
}
Example #10
0
void UIWidget::focusChild(const UIWidgetPtr& child, Fw::FocusReason reason)
{
    if(child == m_focusedChild)
        return;

    if(child && !hasChild(child)) {
        logError("attempt to focus an unknown child in a UIWidget");
        return;
    }

    UIWidgetPtr oldFocused = m_focusedChild;
    m_focusedChild = child;

    if(child) {
        child->setLastFocusReason(reason);
        child->updateState(Fw::FocusState);
        child->updateState(Fw::ActiveState);
    }

    if(oldFocused) {
        oldFocused->setLastFocusReason(reason);
        oldFocused->updateState(Fw::FocusState);
        oldFocused->updateState(Fw::ActiveState);
    }
}
Example #11
0
void UIWidget::removeChild(const UIWidgetPtr& child)
{
    // remove from children list
    if(hasChild(child)) {
        // defocus if needed
        bool focusAnother = false;
        if(m_focusedChild == child) {
            focusChild(nullptr, Fw::ActiveFocusReason);
            focusAnother = true;
        }

        if(isChildLocked(child))
            unlockChild(child);

        auto it = std::find(m_children.begin(), m_children.end(), child);
        m_children.erase(it);

        // reset child parent
        assert(child->getParent() == asUIWidget());
        child->setParent(nullptr);

        m_layout->removeWidget(child);

        // update child states
        child->updateStates();
        updateChildrenIndexStates();

        if(focusAnother && !m_focusedChild)
            focusPreviousChild(Fw::ActiveFocusReason);
    } else
        logError("Attempt to remove an unknown child from a UIWidget");
}
Example #12
0
void UIWidget::insertChild(int index, const UIWidgetPtr& child)
{
    if(!child) {
        logWarning("attempt to insert a null child into a UIWidget");
        return;
    }

    if(hasChild(child)) {
        logWarning("attempt to insert a child again into a UIWidget");
        return;
    }

    index = index <= 0 ? (m_children.size() + index) : index-1;

    assert(index >= 0 && (uint)index <= m_children.size());

    // retrieve child by index
    auto it = m_children.begin() + index;
    m_children.insert(it, child);
    child->setParent(asUIWidget());

    // create default layout if needed
    if(!m_layout)
        m_layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));

    // add to layout and updates it
    m_layout->addWidget(child);

    // update new child states
    child->updateStates();
    updateChildrenIndexStates();
}
BOOL LLPanelDirFind::postBuild()
{
	LLPanelDirBrowser::postBuild();

	childSetAction("back_btn", onClickBack, this);
	childSetAction("home_btn", onClickHome, this);
	childSetAction("forward_btn", onClickForward, this);
	childSetCommitCallback("search_editor", onCommitSearch, this);
	childSetAction("search_btn", onClickSearch, this);
	childSetAction("?", onClickHelp, this);

	// showcase doesn't have maturity flags -- it's all PG
	if (hasChild("incmature"))
	{
		// Teens don't get mature checkbox
		if (gAgent.wantsPGOnly())
		{
			childSetValue("incmature", FALSE);
			childSetValue("incadult", FALSE);
			childHide("incmature");
			childHide("incadult");
			childSetValue("incpg", TRUE);
			childDisable("incpg");
		}		
		
		if (!gAgent.canAccessMature())
		{
			childSetValue("incmature", FALSE);
			childDisable("incmature");
		}
		
		if (!gAgent.canAccessAdult())
		{
			childSetValue("incadult", FALSE);
			childDisable("incadult");
		}
	}
	
	
	mWebBrowser = getChild<LLMediaCtrl>(mBrowserName);
	if (mWebBrowser)
	{
		mWebBrowser->addObserver(this);
		
		// new pages appear in same window as the results page now
		mWebBrowser->setOpenInInternalBrowser( false );
		mWebBrowser->setOpenInExternalBrowser( false );	

		// need to handle inworldz:///app/ URLs for direct teleports
		mWebBrowser->setTrusted( true );

		// redirect 404 pages from S3 somewhere else
		mWebBrowser->set404RedirectUrl( getString("redirect_404_url") );

		navigateToDefaultPage();
	}

	return TRUE;
}
void OptimisticTickSyncAlgo::checkChild(uint64_t diff){

	if(diff>0 && hasChild()){
		//diff is greater than zero and we have child! not good!
		childDied();
		specFailTime=Infinity; //we ignore what the child has reported as fail time.
	}
}
Example #15
0
void ParentTile::Render(CIwFVec2 position, CIwFVec2 scale)
{
	parent->Render(position, scale);
	if (hasChild())
	{
		child->Render(position, scale);
	}
}
Example #16
0
void ParentTile::Update(float delta_time)
{
	parent->Update(delta_time);
	if (hasChild())
	{
		child->Update(delta_time);
	}
}
Example #17
0
PropertyNode &PropertyNode::addNode( const std::string &name ) {
	if (!hasChild( name )) {
		PropertyNode *node = new PropertyNode( name );
		_pnodes.push_back( node );
		return *node;
	} else {
		throw std::runtime_error( "Node already exists: " + name );
	}
}
Example #18
0
void UIWidget::unlockChild(const UIWidgetPtr& child)
{
    if(m_destroyed)
        return;

    if(!child)
        return;

    if(!hasChild(child)) {
        g_logger.traceError("cannot find child");
        return;
    }

    auto it = std::find(m_lockedChildren.begin(), m_lockedChildren.end(), child);
    if(it == m_lockedChildren.end())
        return;

    m_lockedChildren.erase(it);

    // find new child to lock
    UIWidgetPtr lockedChild;
    if(m_lockedChildren.size() > 0) {
        lockedChild = m_lockedChildren.front();
        assert(hasChild(lockedChild));
    }

    for(const UIWidgetPtr& otherChild : m_children) {
        // lock new child
        if(lockedChild) {
            if(otherChild == lockedChild)
                lockedChild->setEnabled(true);
            else
                otherChild->setEnabled(false);
        }
        // else unlock all
        else
            otherChild->setEnabled(true);
    }

    if(lockedChild) {
        if(lockedChild->isFocusable())
            focusChild(lockedChild, Fw::ActiveFocusReason);
    }
}
Example #19
0
  // adding children implementation
  void FSMNode::addChildInternal(StringIter it, StringIter end, L result) {
    if ((it + 1) == end) {

      // last element, we generate a new node for the child
      if (hasChild(*it)) {
        children[*it].value = result;
      } else {
        children.insert(std::pair<char, FSMNode>(*it, FSMNode(*it, result)));
      }

    } else {

      // if the element doesn't exist
      if (hasChild(*it)) {
        children.insert(std::pair<char, FSMNode>(*it, FSMNode(*it, BAD_TOKEN)));
      }
      children[*it].addChildInternal(++it, end, result);
    }
  }
Example #20
0
// --------------------------------------------------
Result SavexitViewer::initialize()
// --------------------------------------------------
{
	if (hasChild()) { if (child->initialize() == PARENT_STEP) ; else return CHILD_STEP; }
	// Viewer::initialize(); // Not useful here!
	
	consoleClear();

	return SUCCESS_STEP;
}
static void showGraph(Node n){
  printf("Noeud %d\n", getNodeValue(n));

  if (hasChild(n)){
    showGraph(getChild(n));
  }

  if (hasBrother(n)){
    showGraph(getBrother(n));
  }
}
Example #22
0
void Bone::addChild( Bone* bone )
{
	zhAssert( bone != NULL );

	if( hasChild( bone->getId() ) )
		return;

	bone->mParent = this;
	mChildrenById.insert( std::make_pair( bone->getId(), bone ) );
	mChildrenByName.insert( std::make_pair( bone->getName(), bone ) );
}
void LLFloaterPreference::onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name)
{
	std::string ctrl_name = name.asString();
	
	if((ctrl_name =="" )|| !hasChild(ctrl_name, true))
		return;
	
	LLTextBox* text_box = getChild<LLTextBox>(name.asString());
	LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(ctrl);
	updateSliderText(slider, text_box);
}
void LLPanelDirFind::navigateToDefaultPage()
{
	std::string start_url = "";
	// Note: we use the web panel in OpenSim as well as Second Life -- MC
	if (gHippoGridManager->getConnectedGrid()->getSearchUrl().empty() && 
		!gHippoGridManager->getConnectedGrid()->isSecondLife())
	{
		// OS-based but doesn't have its own web search url -- MC
		start_url = gSavedSettings.getString("SearchURLDefaultOpenSim");
	}
	else
	{
		if (gHippoGridManager->getConnectedGrid()->isSecondLife()) 
		{
			if (mBrowserName == "showcase_browser")
			{
				// note that the showcase URL in floater_directory.xml is no longer used
				start_url = gSavedSettings.getString("ShowcaseURLDefault");
			}
			else
			{
				start_url = gSavedSettings.getString("SearchURLDefault");
			}
		}
		else
		{
			// OS-based but has its own web search url -- MC
			start_url = gHippoGridManager->getConnectedGrid()->getSearchUrl();
			start_url += "panel=" + getName() + "&";
		}

		if (hasChild("incmature"))
		{
			bool inc_pg = childGetValue("incpg").asBoolean();
			bool inc_mature = childGetValue("incmature").asBoolean();
			bool inc_adult = childGetValue("incadult").asBoolean();
			if (!(inc_pg || inc_mature || inc_adult))
			{
				// if nothing's checked, just go for pg; we don't notify in
				// this case because it's a default page.
				inc_pg = true;
			}
	
			start_url += getSearchURLSuffix(inc_pg, inc_mature, inc_adult, true);
		}
	}

	llinfos << "default web search url: "  << start_url << llendl;

	if (mWebBrowser)
	{
		mWebBrowser->navigateTo( start_url );
	}
}
Example #25
0
void Bone::moveChild( const std::string& childName, Bone* bone )
{
	zhAssert( hasChild(childName) );
	zhAssert( bone != NULL );

	std::map<std::string, Bone*>::iterator ci = mChildrenByName.find(childName);
	Bone* child = ci->second;

	mChildrenByName.erase(ci);
	mChildrenById.erase( child->getId() );
	bone->addChild(child);
}
Example #26
0
void Bone::moveChild( unsigned short childId, Bone* bone )
{
	zhAssert( hasChild(childId) );
	zhAssert( bone != NULL );

	std::map<unsigned short, Bone*>::iterator ci = mChildrenById.find(childId);
	Bone* child = ci->second;

	mChildrenById.erase(ci);
	mChildrenByName.erase( child->getName() );
	bone->addChild(child);
}
Example #27
0
    std::vector<std::shared_ptr<Node> > Node::childrenRecursive(const std::string &name)
    {
      std::vector<std::shared_ptr<Node> > found;
      if (hasChild(name))
        found.push_back(child(name).shared_from_this());

      for (auto &child : properties.children) {
          std::vector<std::shared_ptr<Node> > found2 = child.second->childrenRecursive(name);
          found.insert(found.end(), found2.begin(),found2.end());
      }
      return found;
    }
Example #28
0
 void FrameBuffer::postTraverse(RenderContext &ctx, const std::string& operation)
 {
   Node::postTraverse(ctx, operation);
   if (operation == "commit") {
     // ensure we can react on changed tonemapper (which could be shared by
     // multiple framebuffers but is only commited once)
     bool toneMapperEnabled = hasChild("toneMapper")
       && child("toneMapper").child("enabled").valueAs<bool>();
     if (toneMapperActive ^ toneMapperEnabled)
       postCommit(ctx);
   }
 }
Example #29
0
    bool Node::hasChildRecursive(const std::string &name)
    {
      bool found = hasChild(name);

      for (auto &child : properties.children) {
        try {
          found |= child.second->hasChildRecursive(name);
        }
        catch (const std::runtime_error &) {}
      }

      return found;
    }
Example #30
0
  // getting children
  L FSMNode::getValueInternal(StringIter it, StringIter end) {
    if (!hasChild(*it)) {
      return BAD_TOKEN;
    }

    FSMNode node = children[*it];

    if ((it + 1) == end) {
      return node.value;
    } else {
      return node.getValueInternal(++it, end);
    }
  }