BOOL _XList::movePosition( _XItem* curPosItem, int newPosition ) { if( !curPosItem || newPosition > this->itemcount-1 ) return FALSE; // 옮기려는 스프라이트가 조상(리스트의 헤더)일때 조상 재설정 if( firstItem()==curPosItem ) { if( newPosition == 0 ) return FALSE; setAnchor( curPosItem->getright() ); curPosItem->unlink(); resetList(); for(int i=0; i < newPosition; i++) nextItem(); insertItem( curPosItem ); return TRUE; } if( newPosition > 0 ) { curPosItem->unlink(); resetList(); for(int i=0; i < newPosition; i++) nextItem(); insertItem( curPosItem ); } else // 리스트의 헤더로 옮기고자 할때 헤더 재설정 { curPosItem->unlink(); resetList(); insertItem( curPosItem ); setAnchor( curPosItem ); } return TRUE; }
bool Articulation::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); switch (propertyId) { case P_DIRECTION: setDirection(MScore::Direction(v.toInt())); break; case P_ARTICULATION_ANCHOR: anchorStyle = PropertyStyle::UNSTYLED; setAnchor(ArticulationAnchor(v.toInt())); break; case P_TIME_STRETCH: setTimeStretch(v.toDouble()); score()->fixTicks(); break; default: return Element::setProperty(propertyId, v); } score()->addRefresh(canvasBoundingRect()); // layout: if (chordRest()) chordRest()->layoutArticulations(); else if (parent() && parent()->type() == BAR_LINE) static_cast<BarLine*>(parent())->layout(); score()->addRefresh(canvasBoundingRect()); score()->setLayoutAll(false); //DEBUG return true; }
void ImageMolecule::insertAtom(const Ptr<ImageAtom>& atom) throw () { if (!hasAtom(atom)) atoms_.insert(atom); if (anchor_.empty()) setAnchor(atom); }
ConfirmationDialog::ConfirmationDialog(const std::string& text) : _label(new Text()), _yesButton(new Button()), _noButton(new Button()) { _label->setText(text); setSize({_label->getSize().x + 10, 75.0f}); // Default positioning: centered in parent widget setAnchor({0.5f, 0.5f}); setParentAnchor({0.5f, 0.5f}); _yesButton->setText("Yes"); _yesButton->setSize({50.0f, 30.0f}); _yesButton->setAnchor({1.0f, 1.0f}); _yesButton->setParentAnchor({0.5f, 1.0f}); _yesButton->setRelativePosition({-5.0f, -5.0f}); _noButton->setText("No"); _noButton->setSize({50.0f, 30.0f}); _noButton->setAnchor({0.0f, 1.0f}); _noButton->setParentAnchor({0.5f, 1.0f}); _noButton->setRelativePosition({5.0f, -5.0f}); _yesButton->signalClicked.connect(std::bind(&ConfirmationDialog::slotYesClicked, this)); _noButton->signalClicked.connect(std::bind(&ConfirmationDialog::slotNoClicked, this)); addWidget(_label); addWidget(_yesButton); addWidget(_noButton); }
void Overlay::setProperties(const QScriptValue& properties) { QScriptValue color = properties.property("color"); if (color.isValid()) { QScriptValue red = color.property("red"); QScriptValue green = color.property("green"); QScriptValue blue = color.property("blue"); if (red.isValid() && green.isValid() && blue.isValid()) { _color.red = red.toVariant().toInt(); _color.green = green.toVariant().toInt(); _color.blue = blue.toVariant().toInt(); } } if (properties.property("alpha").isValid()) { setAlpha(properties.property("alpha").toVariant().toFloat()); } if (properties.property("visible").isValid()) { setVisible(properties.property("visible").toVariant().toBool()); } if (properties.property("anchor").isValid()) { QString property = properties.property("anchor").toVariant().toString(); if (property == "MyAvatar") { setAnchor(MY_AVATAR); } } }
Jewel::Jewel(int jewel_id) { state = jsNormal; Set(jewel_id); setTouchEnabled(false); setAnchor(0.5f, 0.5f); }
bool SLine::readProperties(XmlReader& e) { const QStringRef& tag(e.name()); if (tag == "tick2") // obsolete __setTick2(score()->fileDivision(e.readInt())); else if (tag == "tick") // obsolete __setTick1(score()->fileDivision(e.readInt())); else if (tag == "Segment") { LineSegment* ls = createLineSegment(); ls->read(e); add(ls); } else if (tag == "length") setLen(e.readDouble()); else if (tag == "diagonal") setDiagonal(e.readInt()); else if (tag == "anchor") setAnchor(Anchor(e.readInt())); else if (Element::readProperties(e)) ; else return false; return true; }
Slur::Slur(Score* s) : SlurTie(s) { setId(-1); _track2 = 0; setAnchor(ANCHOR_CHORD); }
std::shared_ptr<Actor> AIFactory::create() { irr::scene::ISceneManager* smgr = GameApp::getSingleton().getSceneManager(); std::string animDataPath = "../../../art/" + aiName + ".xml"; auto sprData = animationEngine.load(animDataPath.c_str()); assert(sprData); auto spr = std::make_shared<AnimatedSprite>(sprData, smgr->getRootSceneNode(), smgr); spr->setAnchor(irr::core::vector3df(spr->getSize().Width/2, 0.f, spr->getSize().Height)); animationEngine.addSprite(spr); std::shared_ptr<Actor> ai = std::make_shared<Actor>(); // initialize state machine auto stateMachine = std::make_shared<AIStateMachine>(ai, HashedString("idle")); stateMachine->setTeamMembership(membershipSupplier->requestMembership()); stateMachine->initStates(); ai->setStateMachine(stateMachine); ai->setSprite(spr); aiEventSource->addListener(ai); ai->start(); return ai; }
void KPassivePopup::setVisible( bool visible ) { if (! visible ) { QFrame::setVisible( visible ); return; } if ( size() != sizeHint() ) resize( sizeHint() ); if ( d->fixedPosition.isNull() ) positionSelf(); else { if( d->popupStyle == Balloon ) setAnchor( d->fixedPosition ); else move( d->fixedPosition ); } QFrame::setVisible( /*visible=*/ true ); int delay = d->hideDelay; if ( delay < 0 ) { delay = DEFAULT_POPUP_TIME; } if ( delay > 0 ) { d->hideTimer->start( delay ); } }
BOOL _XList::movePosition( int curPosition, int newPosition ) { if( curPosition == newPosition ) return FALSE; _XItem* curItem = getItem( curPosition ); if( !curItem ) return FALSE; if( firstItem()==curItem ) { if( newPosition == 0 ) return FALSE; removeItem( curItem ); resetList(); for(int i=0; i < newPosition; i++) nextItem(); insertItem( curItem ); return TRUE; } if( newPosition > 0 ) { removeItem( curItem ); resetList(); for(int i=0; i < newPosition; i++) nextItem(); insertItem( curItem ); } else // 리스트의 헤더로 옮기고자 할때 헤더 재설정 { removeItem( curItem ); resetList(); insertItem( curItem ); setAnchor( curItem ); } return TRUE; }
bool SLine::readProperties(const QDomElement& e) { if (Element::readProperties(e)) return true; const QString& tag(e.tagName()); const QString& val(e.text()); int i = val.toInt(); if (tag == "tick2") // obsolete __setTick2(score()->fileDivision(i)); else if (tag == "tick") // obsolete __setTick1(score()->fileDivision(i)); else if (tag == "Segment") { LineSegment* ls = createLineSegment(); ls->read(e); add(ls); } else if (tag == "track") setTrack(i); else if (tag == "length") setLen(val.toDouble()); else if (tag == "diagonal") setDiagonal(i); else if (tag == "anchor") setAnchor(Anchor(i)); else return false; return true; }
bool Articulation::setProperty(P_ID propertyId, const QVariant& v) { switch (propertyId) { case P_ID::DIRECTION: setDirection(v.value<Direction>()); break; case P_ID::ARTICULATION_ANCHOR: setAnchor(ArticulationAnchor(v.toInt())); break; case P_ID::PLAY: setPlayArticulation(v.toBool()); break; case P_ID::ORNAMENT_STYLE: setOrnamentStyle(MScore::OrnamentStyle(v.toInt())); break; case P_ID::TIME_STRETCH: setTimeStretch(v.toDouble()); score()->fixTicks(); break; default: return Element::setProperty(propertyId, v); } triggerLayout(); return true; }
void TailDrawable::Simulation::setPosition(const sf::Vector2f& position) { setAnchor(position); for (auto& m : m_masses) { m->setPosition(m->getPosition() + (position / pixelScale)); } }
void KPassivePopup::moveNear( const QRect &target ) { QPoint pos = calculateNearbyPoint(target); if( d->popupStyle == Balloon ) setAnchor( pos ); else move( pos.x(), pos.y() ); }
/***************************************************************************\ * Class Specific * \***************************************************************************/ void PhysicsHinge2Joint::initHinge2Joint() { setAnchor(PhysicsHinge2JointBase::getAnchor()); setAxis1(PhysicsHinge2JointBase::getAxis1()); setAxis2(PhysicsHinge2JointBase::getAxis2()); setWorld(PhysicsHinge2JointBase::getWorld()); initJoint(); }
void QmlAnchors::beautify() { return; if ((instanceHasAnchor(AnchorLine::Left) && instanceHasAnchor(AnchorLine::Right) && instanceHasAnchor(AnchorLine::Top) && instanceHasAnchor(AnchorLine::Bottom)) && (instanceAnchor(AnchorLine::Left).type() == AnchorLine::Left && instanceAnchor(AnchorLine::Right).type() == AnchorLine::Right && instanceAnchor(AnchorLine::Top).type() == AnchorLine::Top && instanceAnchor(AnchorLine::Bottom).type() == AnchorLine::Bottom) && (instanceAnchor(AnchorLine::Left).qmlItemNode() == instanceAnchor(AnchorLine::Right).qmlItemNode() && instanceAnchor(AnchorLine::Top).qmlItemNode() == instanceAnchor(AnchorLine::Bottom).qmlItemNode()) && (instanceAnchor(AnchorLine::Left).qmlItemNode() == instanceAnchor(AnchorLine::Bottom).qmlItemNode())) { if (instanceHasAnchor(AnchorLine::Fill)) return; //avoid recursion QmlItemNode targetNode(instanceAnchor(AnchorLine::Left).qmlItemNode()); removeAnchors(); setAnchor(AnchorLine::Fill, targetNode, AnchorLine::Fill); } if ((instanceHasAnchor(AnchorLine::VerticalCenter) && instanceHasAnchor(AnchorLine::HorizontalCenter)) && (instanceAnchor(AnchorLine::VerticalCenter).type() == AnchorLine::VerticalCenter && instanceAnchor(AnchorLine::HorizontalCenter).type() == AnchorLine::HorizontalCenter) && (instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode() == instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode())) { if (instanceHasAnchor(AnchorLine::Center)) return; //avoid recursion QmlItemNode targetNode(instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode()); removeAnchors(); setAnchor(AnchorLine::Center, targetNode, AnchorLine::Center); } }
LyricsLine::LyricsLine(Score* s) : SLine(s, ElementFlag::NOT_SELECTABLE) { setGenerated(true); // no need to save it, as it can be re-generated setDiagonal(false); setLineWidth(score()->styleP(Sid::lyricsDashLineThickness)); setAnchor(Spanner::Anchor::SEGMENT); _nextLyrics = 0; }
Scene::Scene() { LEAK_DETECT_INC("Scene"); setRelativeAnchor(false); Point p = PointMake(0.5f, 0.5f); setAnchor(p); setContentSize(Director::sharedDirector()->winSize()); }
static QGraphicsLayout* createLayouts(int whichLayout) { QSizeF min(0, 10); QSizeF pref(50, 10); QSizeF max(100, 10); QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *b = createItem(min, pref, max, "b"); QGraphicsWidget *c = createItem(min, pref, max, "c"); QGraphicsWidget *d = createItem(min, pref, max, "d"); QGraphicsLayout *l; if (whichLayout == 0) { l = new QGraphicsLinearLayout; QGraphicsLinearLayout *linear = static_cast<QGraphicsLinearLayout *>(l); linear->setContentsMargins(0, 0, 0, 0); linear->addItem(a); linear->addItem(b); linear->addItem(c); linear->addItem(d); } else { l = new QGraphicsAnchorLayout; QGraphicsAnchorLayout *anchor = static_cast<QGraphicsAnchorLayout *>(l); anchor->setContentsMargins(0, 0, 0, 0); // Horizontal setAnchor(anchor, anchor, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); setAnchor(anchor, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); setAnchor(anchor, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); setAnchor(anchor, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); setAnchor(anchor, d, Qt::AnchorRight, anchor, Qt::AnchorRight, 0); // Vertical anchor->addAnchors(anchor, a, Qt::Vertical); anchor->addAnchors(anchor, b, Qt::Vertical); anchor->addAnchors(anchor, c, Qt::Vertical); anchor->addAnchors(anchor, d, Qt::Vertical); } return l; }
LyricsLine::LyricsLine(Score* s) : SLine(s) { setFlags(0); setGenerated(true); // no need to save it, as it can be re-generated setDiagonal(false); setLineWidth(Spatium(LYRICS_DASH_DEFAULT_LINE_THICKNESS)); setAnchor(Spanner::Anchor::SEGMENT); _nextLyrics = nullptr; }
RotationViewportAnchor::RotationViewportAnchor( FrameView& rootFrameView, VisualViewport& visualViewport, const FloatSize& anchorInInnerViewCoords, PageScaleConstraintsSet& pageScaleConstraintsSet) : m_rootFrameView(&rootFrameView), m_visualViewport(&visualViewport), m_anchorInInnerViewCoords(anchorInInnerViewCoords), m_pageScaleConstraintsSet(pageScaleConstraintsSet) { setAnchor(); }
Glissando::Glissando(Score* s) : SLine(s) { setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE); _glissandoType = Type::STRAIGHT; _text = "gliss."; _showText = true; setDiagonal(true); setLineWidth(Spatium(GLISS_DEFAULT_LINE_TICKNESS)); setAnchor(Spanner::Anchor::NOTE); }
Bullet::Bullet(Vector2 _position, double _angle, double _speed, int _team) { bullet = new Sprite(); bullet->setResAnim(config::resources.getResAnim("Bullet")); bullet->setAnchor(0.5, 0.5); team = _team; setAnchor(0.5,0.5); setPosition(_position); addChild(bullet); speed = _speed; setRotationDegrees(_angle); }
Volta::Volta(Score* s) : TextLine(s) { setLineWidth(Spatium(.18)); setBeginText("1.", TEXT_STYLE_VOLTA); setBeginTextPlace(PLACE_BELOW); setContinueTextPlace(PLACE_BELOW); setBeginHook(true); setBeginHookHeight(Spatium(1.9)); setYoff(-4.0); setEndHookHeight(Spatium(1.9)); setAnchor(ANCHOR_MEASURE); }
Volta::Volta(Score* s) : TextLine(s) { _voltaType = VoltaType::OPEN; setBeginText("1.", s->textStyle(TEXT_STYLE_VOLTA)); setBeginTextPlace(PLACE_BELOW); setContinueTextPlace(PLACE_BELOW); setBeginHook(true); Spatium hook(s->styleS(ST_voltaHook)); setBeginHookHeight(hook); setEndHookHeight(hook); setAnchor(ANCHOR_MEASURE); }
Volta::Volta(Score* s) : TextLineBase(s) { setBeginText("1.", TextStyleType::VOLTA); setBeginTextPlace(PlaceText::BELOW); setContinueTextPlace(PlaceText::BELOW); setBeginHook(true); setAnchor(Anchor::MEASURE); resetProperty(P_ID::BEGIN_HOOK_HEIGHT); resetProperty(P_ID::END_HOOK_HEIGHT); resetProperty(P_ID::LINE_WIDTH); resetProperty(P_ID::LINE_STYLE); }
Flame::Flame() { setTypeID(Boss_Flame); setCurrHealth(200); setMaxHealth(200); SetAttackRange(200); setAttackSpeed(0.25f); setAnchor(Vector2(1200,1200)); setDefense(20); setSight(500); setLevel(6); setAllAnimationsArray(); currentAnimation = allAnimations[Animation_East]; }
void Cell::initializeAnchor (matvar_t *anchorStructure) { int length = vectorLength (anchorStructure); anchor *a = new anchor [length]; assert (a != NULL); setAnchorDim (length); for (int i = 0; i < length; i++) readNumber (anchorStructure, NULL, &(a[i].array), &(a[i].dim), i); setAnchor (a); delete[] a; }
Volta::Volta(Score* s) : TextLineBase(s) { setBeginTextPlace(PlaceText::BELOW); setContinueTextPlace(PlaceText::BELOW); setBeginHookType(HookType::HOOK_90); setAnchor(Anchor::MEASURE); resetProperty(P_ID::BEGIN_HOOK_HEIGHT); resetProperty(P_ID::END_HOOK_HEIGHT); resetProperty(P_ID::LINE_WIDTH); resetProperty(P_ID::LINE_STYLE); resetProperty(P_ID::BEGIN_TEXT_OFFSET); resetProperty(P_ID::BEGIN_TEXT_ALIGN); }