示例#1
0
ofxDatGuiMatrix* ofxDatGui::getMatrix(string ml, string fl)
{
    ofxDatGuiMatrix* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGuiMatrix*>(f->getComponent(ofxDatGuiType::MATRIX, ml));
    }   else {
        o = static_cast<ofxDatGuiMatrix*>(getComponent(ofxDatGuiType::MATRIX, ml));
    }
    if (o==nullptr) {
        o = ofxDatGuiMatrix::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+ml : ml);
        trash.push_back(o);
    }
    return o;
}
示例#2
0
ofxDatGuiWaveMonitor* ofxDatGui::getWaveMonitor(string cl, string fl)
{
    ofxDatGuiWaveMonitor* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGuiWaveMonitor*>(f->getComponent(ofxDatGuiType::WAVE_MONITOR, cl));
    }   else {
        o = static_cast<ofxDatGuiWaveMonitor*>(getComponent(ofxDatGuiType::WAVE_MONITOR, cl));
    }
    if (o==nullptr) {
        o = ofxDatGuiWaveMonitor::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+cl : cl);
        trash.push_back(o);
    }
    return o;
}
示例#3
0
ofxDatGuiValuePlotter* ofxDatGui::getValuePlotter(string cl, string fl)
{
    ofxDatGuiValuePlotter* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGuiValuePlotter*>(f->getComponent(ofxDatGuiType::VALUE_PLOTTER, cl));
    }   else {
        o = static_cast<ofxDatGuiValuePlotter*>(getComponent(ofxDatGuiType::VALUE_PLOTTER, cl));
    }
    if (o==nullptr) {
        o = ofxDatGuiValuePlotter::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+cl : cl);
        trash.push_back(o);
    }
    return o;
}
示例#4
0
ofxDatGuiTextInput* ofxDatGui::getTextInput(string tl, string fl)
{
    ofxDatGuiTextInput* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGuiTextInput*>(f->getComponent(ofxDatGuiType::TEXT_INPUT, tl));
    }   else {
        o = static_cast<ofxDatGuiTextInput*>(getComponent(ofxDatGuiType::TEXT_INPUT, tl));
    }
    if (o==nullptr) {
        o = ofxDatGuiTextInput::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+tl : tl);
        trash.push_back(o);
    }
    return o;
}
示例#5
0
ofxDatGui2dPad* ofxDatGui::get2dPad(string pl, string fl)
{
    ofxDatGui2dPad* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGui2dPad*>(f->getComponent(ofxDatGuiType::PAD2D, pl));
    }   else {
        o = static_cast<ofxDatGui2dPad*>(getComponent(ofxDatGuiType::PAD2D, pl));
    }
    if (o==nullptr) {
        o = ofxDatGui2dPad::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+pl : pl);
        trash.push_back(o);
    }
    return o;
}
示例#6
0
ofxDatGuiButton* ofxDatGui::getButton(string bl, string fl)
{
    ofxDatGuiButton* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGuiButton*>(f->getComponent(ofxDatGuiType::BUTTON, bl));
    }   else {
        o = static_cast<ofxDatGuiButton*>(getComponent(ofxDatGuiType::BUTTON, bl));
    }
    if (o==nullptr) {
        o = ofxDatGuiButton::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+bl : bl);
        trash.push_back(o);
    }
    return o;
}
示例#7
0
ofxDatGuiSlider* ofxDatGui::getSlider(string sl, string fl)
{
    ofxDatGuiSlider* o = nullptr;
    if (fl != "") {
        ofxDatGuiFolder* f = static_cast<ofxDatGuiFolder*>(getComponent(ofxDatGuiType::FOLDER, fl));
        if (f) o = static_cast<ofxDatGuiSlider*>(f->getComponent(ofxDatGuiType::SLIDER, sl));
    }   else {
        o = static_cast<ofxDatGuiSlider*>(getComponent(ofxDatGuiType::SLIDER, sl));
    }
    if (o==nullptr) {
        o = ofxDatGuiSlider::getInstance();
        ofxDatGuiLog::write(ofxDatGuiMsg::COMPONENT_NOT_FOUND, fl!="" ? fl+"-"+sl : sl);
        trash.push_back(o);
    }
    return o;
}
示例#8
0
void MLDrawing::resizeWidget(const MLRect& b, const int u)
{
	// adapt vrect to juce rect
	Component* pC = getComponent();
	if(pC)
	{
		MLRect bb = b + mPixelOffset;
		if (bb.height() == 0) bb.setHeight(1);
		if (bb.width() == 0) bb.setWidth(1);
	
		// adapt vrect to juce rect
		Rectangle<int> c(bb.left(), bb.top(), bb.width(), bb.height());
		
		pC->setBounds(c);
	}
	
	// iterate over points
	int size = mGridPoints.size();
	for(int i = 0; i<size; ++i)
	{
		mTransformedPoints[i] = mGridPoints[i]*u;
//debug() << "pt. " << i << ":" << mTransformedPoints[i] <<  " ";
	}
//debug() << "\n";
}
 bool undo()
 {
     showCorrectTab();
     getComponent()->setExplicitFocusOrder (oldValue);
     changed();
     return true;
 }
示例#10
0
 bool perform()
 {
     showCorrectTab();
     getComponent()->setExplicitFocusOrder (newValue);
     changed();
     return true;
 }
示例#11
0
void Parameters::setParameter(int index, float newValue) {
  ParameterComponent *component = getComponent(index);
	if (component) {
		std::string name = component->getName(componentsParameterOffset(index));		
		component->onChange(componentsParameterOffset(index), newValue);
	}
}
示例#12
0
PaperUnit Instance::getHeight() const
{
  const size_t count = getComponent()->maxPortCount();
  return (count-1) * InstanceAppearance::verticalPortDistance() +
      InstanceAppearance::topPortDistance() +
      InstanceAppearance::bottomPortDistance();
}
ConnectorBase * KSimIoJoinBoolIn::createConnector()
{
	ConnectorBoolOut * conn = new ConnectorBoolOut(getComponent(), QString::null, QString::null);
	Q_CHECK_PTR(conn);
	conn->setErasable(true);
	setConnector(conn);
	return conn;
}
void Desktop::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel)
{
    currentLookAndFeel = newDefaultLookAndFeel;

    for (int i = getNumComponents(); --i >= 0;)
        if (Component* const c = getComponent (i))
            c->sendLookAndFeelChange();
}
Boolean TPZSimpleRouterFlowLigero :: checkFlowControl(unsigned Port, TPZMessageQueue* queue, unsigned numBubble, unsigned BufferSize) const
{
   unsigned bubble = ((TPZSimulation*)getComponent().getSimulation())->
                        getPacketLength((TPZNetwork*)getOwnerRouter().getOwner())*numBubble;
   if(BufferSize - queue[Port].numberOfElements() < bubble) return false;

   return true;
}
示例#16
0
void GameObject::removeComponent(ComponentId key) {
	IComponent* component = getComponent(key);
	if(component != currentUpdateComponent) {
		delete component;
	} else {
		deleteAfterUpdateFinishes = true;
	}
}
示例#17
0
void MultiBlock3D::evaluateStatistics() {
    std::vector<plint> const& blocks = getLocalInfo().getBlocks();
    for (pluint iBlock=0; iBlock<blocks.size(); ++iBlock) {
        plint blockId = blocks[iBlock];
        getComponent(blockId).evaluateStatistics();
    }
    if (isInternalStatisticsOn()) reduceStatistics();
}
示例#18
0
unsigned TPZCrossbarFlowCTMux :: extractOutputPortNumber( TPZROUTINGTYPE dir,
                                                     unsigned channel )
{
   unsigned oPort = ((TPZCrossbar&)getComponent()).getOutputWith( dir,1 );
   if( !oPort )
   {
      TPZString err;
      err.sprintf( ERR_TPZCMFLO_003,
                   (char*)getComponent().asString(),
                   (char*)_routingType2string(dir) );
      EXIT_PROGRAM(err);
   }
   
   if( ((TPZCrossbar&)getComponent()).isLocalNodeOutput(oPort) )
      oPort += ( channel - 1 );
   return oPort;
}
示例#19
0
unsigned TPZCrossbarFlowCTMux :: extractOutputPortNumber(TPZMessage* msg)
{
   unsigned oPort = ((TPZCrossbar&)getComponent()).getOutputWith( msg->getRoutingPort(),1 );
   if( !oPort )
   {
      TPZString err;
      err.sprintf( ERR_TPZCMFLO_003,
                   (char*)getComponent().asString(),
                   (char*)msg->asString(),
                   (char*)_routingType2string(msg->getRoutingPort()) );
      EXIT_PROGRAM(err);
   }
   
   if( ((TPZCrossbar&)getComponent()).isLocalNodeOutput(oPort) )
      oPort += ( msg->getChannel() - 1 );
   return oPort;
}
// Implementation skeleton destructor
enumpropTestDeviceImpl::~enumpropTestDeviceImpl (void)
{
  ACS_TRACE("enumpropTestDeviceImpl::~enumpropTestDeviceImpl");
  if (getComponent())
      ACS_DEBUG_PARAM("::BaciTestClassImpl::~BaciTestClassImpl", "Destroying %s...", getComponent()->getName());

  // stop threads
  if (getComponent())
      getComponent()->stopAllThreads();

  // properties
  if (m_currentState) { m_currentState->destroy(); m_currentState=0; }
  if (m_currentStateRW) { m_currentStateRW->destroy(); m_currentStateRW=0; }

  ACS_DEBUG("::eumpropTestDeviceImpl::~enumpropTestDeviceImpl", "Properties destroyed");
  
  ACS_DEBUG("::enumpropTestDeviceImpl::~enumpropTestDeviceImpl", "Component destroyed");
}//~
示例#21
0
void ComponentMenuItem::updateComponentBounds(void)
{
    if(getComponent() != NULL)
    {
        Pnt2f InsideBorderTopLeft, InsideBorderBottomRight;
        getInsideBorderBounds(InsideBorderTopLeft, InsideBorderBottomRight);

        if(getComponent()->getPosition() != InsideBorderTopLeft)
        {
            getComponent()->setPosition(InsideBorderTopLeft);
        }
        Vec2f Size(InsideBorderBottomRight - InsideBorderTopLeft);
        if(getComponent()->getSize() != Size)
        {
            getComponent()->setSize(Size);
        }
    }
}
示例#22
0
SpriteAnimation* GameObject::getAnimation() {
	if(!animation) {
		IComponent* component = getComponent(ANIMATION_ID);
		if(component != NULL) {
			animation = dynamic_cast<SpriteAnimation*>(component);
		}
	}
	return animation;
}
示例#23
0
SpriteRenderNode* GameObject::getSprite() {
	if(!sprite) {
		IComponent* component = getComponent(SPRITE_RENDER_NODE_ID);
		if(component != NULL) {
			sprite = dynamic_cast<SpriteRenderNode*>(component);
		}
	}
	return sprite;
}
示例#24
0
Collision* GameObject::getCollision() {
	if(!collision) {
		IComponent* component = getComponent(COLLISION_ID);
		if(component != NULL) {
			collision = dynamic_cast<Collision*>(component);
		}
	}
	return collision;
}
示例#25
0
Transform* GameObject::getTransform() {
	if(!transform) {
		IComponent* component = getComponent(TRANSFORM_ID);
		if(component != NULL) {
			transform = dynamic_cast<Transform*>(component);
		}
	}
	return transform;
}
示例#26
0
ComponentPtr Entity::getComponent(const char* name) const
{
	Type* type = ReflectionDatabase::GetDatabase().findType(name);

	if (!type->isComposite())
		return nullptr;

	return getComponent((Class*) type);
}
int main() {
  
  fruit::NormalizedComponent<> normalizedComponent(getComponent());
  fruit::Injector<XAnnot> injector(normalizedComponent, getComponent2());
  
  injector.get<XAnnot>();
  
  return 0;
}
示例#28
0
Dynamics* GameObject::getDynamics() {
	if(!dynamics) {
		IComponent* component = getComponent(DYNAMICS_ID);
		if(component != NULL) {
			dynamics = dynamic_cast<Dynamics*>(component);
		}
	}
	return dynamics;
}
示例#29
0
void MultiBlock3D::reduceStatistics() {
    std::vector<plint> const& blocks = getLocalInfo().getBlocks();
    std::vector<BlockStatistics const*> individualStatistics;
    // Prepare a vector containing the BlockStatistics of all components
    for (pluint iBlock=0; iBlock<blocks.size(); ++iBlock) {
        plint blockId = blocks[iBlock];
        individualStatistics.push_back(&getComponent(blockId).getInternalStatistics());
    }

    // Execute reduction operation on all individual statistics and store result into
    //   statistics of current MultiBlock.
    combinedStatistics -> combine(individualStatistics, this->getInternalStatistics());
    // Copy result to each individual statistics
    for (pluint iBlock=0; iBlock<blocks.size(); ++iBlock) {
        plint blockId = blocks[iBlock];
        (getComponent(blockId).getInternalStatistics()) = (this->getInternalStatistics());
    }
}
示例#30
0
void MLMultiSlider::resizeWidget(const MLRect& b, const int )
{
//	MLLookAndFeel* myLookAndFeel = (&(getRootViewResources(this).mLookAndFeel));

	Component* pC = getComponent();
	mPos.setBounds(b);
	pC->setBounds(MLToJuceRectInt(mPos.getBounds()));

	int s = mNumSliders;
	mPos.setElements(s);
	mPos.setGeometry(MLPositioner::kHorizontal); 
	mPos.setSizeFlags(0);//(MLPositioner::kOnePixelOverlap); 
	mPos.setMargin(0.);	
	Vec2 panelSize = mPos.getElementSize();
	
	/*
	// setup ImageBank
	mImageBank.setImages(kMLStepDisplayImages);
	mImageBank.setDims(panelSize[0], panelSize[1]);
	mImageBank.clearPanels();
	for(int i = 0; i < panels; ++i)
	{
		mImageBank.addPanel(myPos.getElementPosition(i));
	}
	*/
	
	/*
	// colors
	Colour stepOnColor (findColour (MLStepDisplay::stepOnColourId));	
	Colour stepOffColor (findColour (MLStepDisplay::stepOffColourId));	
	Colour outlineOnColor = findColour(MLLookAndFeel::outlineColor).overlaidWith(stepOnColor.withAlpha(0.5f));
	Colour outlineOffColor = findColour(MLLookAndFeel::outlineColor);
	Colour stepColor, outlineColor;
	
	// draw images to ImageBank
	for (int i=0; i<kMLStepDisplayImages; ++i)
	{
		Image& img = mImageBank.getImage(i);
		Graphics g(img);	
		
		float val = (float)i / (float)(kMLStepDisplayImages-1);
		stepColor = stepOffColor.overlaidWith(stepOnColor.withAlpha(val));
		outlineColor = outlineOffColor.overlaidWith(outlineOnColor.withAlpha(val));

		const Colour onAlphaColor = stepOnColor.withMultipliedAlpha(val);
		const Colour blinkerColor = stepOffColor.overlaidWith(onAlphaColor);
		const Colour myOutlineColor = outlineOffColor.overlaidWith(outlineOnColor.withMultipliedAlpha(val));

		const float outlineThickness = 0.75f;
		myLookAndFeel->drawMLButtonShape (g, 0, 0, panelSize[0], panelSize[1],
			r, blinkerColor, myOutlineColor, outlineThickness, eMLAdornNone, 0., 0.);	
			
	}
	*/
	
	// Component::resized();
}