void GenericSliderProperties::OnButton(wxCommandEvent& event) { int id = event.GetId(); wxObject *obj = event.GetEventObject(); if(isDecimal)incr = 0.01; else incr = 1; if(id == ID_INCRUP) { if(obj == min_up)setMin(min+incr); if(obj == max_up)setMax(max+incr); if(obj == tick_up)setTick(tick+1); } if(id == ID_INCRDOWN) { if(obj == min_down)setMin(min-incr); if(obj == max_down)setMax(max-incr); if(obj == tick_down)setTick(tick-1); } if(id == ID_ACCEPT2) { winSlider->setCurrentMinMax(min,max); winSlider->setTicks(tick); winSlider->Refresh(false); Close(true); } if(id == ID_CANCEL2) { winSlider->setCurrentMinMax(minOld,maxOld); winSlider->setTicks(tickOld); winSlider->getValueText()->SetBackgroundColour(colorPanelOld); winSlider->Refresh(false); Close(true); } if(id == ID_APPLY) { winSlider->setCurrentMinMax(min,max); winSlider->setTicks(tick); winSlider->Refresh(false); } if(id == ID_COLOR2) { wxColourDialog dial(this); dial.SetTitle(wxT("Color Picker")); if(dial.ShowModal()!= wxID_OK)return; colorPanel = dial.GetColourData().GetColour(); winSlider->getValueText()->SetBackgroundColour(colorPanel); winSlider->Refresh(false); } event.Skip(); }
bool Ottava::setProperty(Pid propertyId, const QVariant& val) { switch (propertyId) { case Pid::OTTAVA_TYPE: setOttavaType(OttavaType(val.toInt())); break; case Pid::NUMBERS_ONLY: _numbersOnly = val.toBool(); break; case Pid::SPANNER_TICKS: setTicks(val.value<Fraction>()); staff()->updateOttava(); break; case Pid::SPANNER_TICK: setTick(val.value<Fraction>()); staff()->updateOttava(); break; default: if (!TextLineBase::setProperty(propertyId, val)) return false; break; } triggerLayout(); return true; }
void MidiEventBase::read(Xml& xml) { setType(Note); a = 0; b = 0; c = 0; int dataLen = 0; for (;;) { Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { case Xml::Error: case Xml::End: return; case Xml::TagStart: xml.unknown("Event"); break; case Xml::Text: { QByteArray ba = tag.toLatin1(); const char*s = ba.constData(); edata.data = new unsigned char[dataLen]; edata.dataLen = dataLen; unsigned char* d = edata.data; for (int i = 0; i < dataLen; ++i) { char* endp; *d++ = strtol(s, &endp, 16); s = endp; } } break; case Xml::Attribut: if (tag == "tick") setTick(xml.s2().toInt()); else if (tag == "type") setType(EventType(xml.s2().toInt())); else if (tag == "len") setLenTick(xml.s2().toInt()); else if (tag == "a") a = xml.s2().toInt(); else if (tag == "b") b = xml.s2().toInt(); else if (tag == "c") c = xml.s2().toInt(); else if (tag == "datalen") dataLen = xml.s2().toInt(); break; case Xml::TagEnd: if (tag == "event") return; default: break; } } }
Player& Player::init() { setChannelCount(kDefaultChannelCount); setFrameRate(kDefaultFrameRate); setFrameSize(kDefaultFrameSize); setSource(NULL); setTick(0); return *this; }
/// virtual func, this base version must be called by all derived classes void Element::zombieSwap( const Cinfo* c ) { // cout << name_ << ", cname=" << c->name() << ", t0 = " << this->tick_ << ", t1 = " << Clock::lookupDefaultTick( c->name() ) << endl; if ( tick_ == -1 ) { // Object is already disabled, let it be. return; } if ( tick_ == -2 ) { // Object was a zombie and wants to come home. int t = Clock::lookupDefaultTick( c->name() ); setTick( t ); } else if ( tick_ >= 0 ) { // disable clock, with option to return if ( c->name().substr(0, 6) == "Zombie" ) { setTick( -2 ); } else { int t = Clock::lookupDefaultTick( c->name() ); setTick( t ); } } }
Segment::Segment(Measure* m, SegmentType st, int t) : Element(m->score()) { setParent(m); setSubtype(st); setTick(t); init(); empty = true; }
MarkerItem::MarkerItem(QTreeWidget* parent, Marker* m) : QTreeWidgetItem(parent) { _marker = m; setText(COL_NAME, m->name()); setTick(m->tick()); if (m->type() == Pos::FRAMES) setIcon(COL_LOCK, QIcon(*lockIcon)); setLock(m->type() == Pos::FRAMES); }
void PosLen::setPos(const Pos& pos) { switch(pos.type()) { case FRAMES: setFrame(pos.frame()); break; case TICKS: setTick(pos.tick()); break; } }
void PosLen::read(Xml& xml, const char* name) { sn = -1; for (;;) { Xml::Token token = xml.parse(); const QString& tag = xml.s1(); switch (token) { case Xml::Error: case Xml::End: return; case Xml::TagStart: xml.unknown(name); break; case Xml::Attribut: if (tag == "tick") { setType(TICKS); setTick(xml.s2().toInt()); } else if (tag == "sample") { setType(FRAMES); setFrame(xml.s2().toInt()); } else if (tag == "len") { int n = xml.s2().toInt(); switch (type()) { case TICKS: setLenTick(n); break; case FRAMES: setLenFrame(n); break; } } else xml.unknown(name); break; case Xml::TagEnd: if (tag == name) return; default: break; } } }
void glt_stream_server_t::OnOpen() { init_gl(); reset_projection_mode(); setSwapBuffers(false); glDrawBuffer(GL_FRONT); setTick(100); }
bool Ottava::setProperty(P_ID propertyId, const QVariant& val) { switch (propertyId) { case P_ID::OTTAVA_TYPE: setOttavaType(Type(val.toInt())); break; case P_ID::PLACEMENT: if (val != getProperty(propertyId)) { // reverse hooks setBeginHookHeight(-beginHookHeight()); setEndHookHeight(-endHookHeight()); } TextLine::setProperty(propertyId, val); break; case P_ID::LINE_WIDTH: lineWidthStyle = PropertyStyle::UNSTYLED; TextLine::setProperty(propertyId, val); break; case P_ID::LINE_STYLE: lineStyleStyle = PropertyStyle::UNSTYLED; TextLine::setProperty(propertyId, val); break; case P_ID::NUMBERS_ONLY: setNumbersOnly(val.toBool()); setOttavaType(_ottavaType); numbersOnlyStyle = PropertyStyle::UNSTYLED; break; case P_ID::SPANNER_TICKS: setTicks(val.toInt()); staff()->updateOttava(); break; case P_ID::SPANNER_TICK: setTick(val.toInt()); staff()->updateOttava(); break; default: if (!TextLine::setProperty(propertyId, val)) return false; break; } score()->setLayoutAll(true); return true; }
void PosLen::read(XmlReader& e) { QString s; if (e.hasAttribute("tick")) { setType(TICKS); setTick(e.intAttribute("tick")); } if (e.hasAttribute("sample")) { setType(FRAMES); setFrame(e.intAttribute("sample")); } if (e.hasAttribute("len")) { int n = e.intAttribute("len"); if (type() == TICKS) setLenTick(n); else setLenFrame(n); } }
bool Ottava::setProperty(P_ID propertyId, const QVariant& val) { switch (propertyId) { case P_ID::OTTAVA_TYPE: setOttavaType(OttavaType(val.toInt())); break; case P_ID::LINE_WIDTH: lineWidthStyle = PropertyStyle::UNSTYLED; TextLine::setProperty(propertyId, val); break; case P_ID::LINE_STYLE: lineStyleStyle = PropertyStyle::UNSTYLED; TextLine::setProperty(propertyId, val); break; case P_ID::NUMBERS_ONLY: setNumbersOnly(val.toBool()); setOttavaType(_ottavaType); numbersOnlyStyle = PropertyStyle::UNSTYLED; break; case P_ID::SPANNER_TICK2: staff()->pitchOffsets().remove(tick2()); setTick2(val.toInt()); staff()->updateOttava(this); break; case P_ID::SPANNER_TICK: staff()->pitchOffsets().remove(tick()); setTick(val.toInt()); staff()->updateOttava(this); break; default: if (!TextLine::setProperty(propertyId, val)) return false; break; } score()->setLayoutAll(true); return true; }
void PosLen::read(QDomNode node) { const QDomElement& e = node.toElement(); QString s; if (e.hasAttribute("tick")) { setType(TICKS); setTick(e.attribute("tick").toInt()); } if (e.hasAttribute("sample")) { setType(FRAMES); setFrame(e.attribute("sample").toInt()); } if (e.hasAttribute("len")) { int n = e.attribute("len").toInt(); if (type() == TICKS) setLenTick(n); else setLenFrame(n); } }
void zTCPTask::checkSignal(const zRTime &ct) { ///Zebra::logger->debug("zTCPTask::checkSignal"); if (ifCheckSignal() && checkInterval(ct)) { if (checkTick()) { //测试信号在指定时间范围内没有返回 Zebra::logger->error("套接口检查测试信号失败"); Terminate(zTCPTask::terminate_active); } else { //发送测试信号 Cmd::t_NullCmd tNullCmd; //Zebra::logger->debug("服务端发送测试信号"); if (sendCmd(&tNullCmd,sizeof(tNullCmd))) setTick(); } } }
void GenericSliderProperties::OnEnter(wxCommandEvent& event) { double val; wxObject* obj = event.GetEventObject(); if(obj == min_box) { min_box->GetValue().ToDouble(&val); setMin(val); } if(obj == max_box) { max_box->GetValue().ToDouble(&val); setMax(val); } if(obj == tick_box) { tick_box->GetValue().ToDouble(&val); setTick(val); } event.Skip(); }
LyricWidget::LyricWidget(QWidget *parent) : QWidget(parent), ui(new Ui_LyricWidget), animWidget(nullptr), firstShowing(false), lyricGetter(new LyricGetter(this)), isShowing(false), haveSearchedLyric(false), saveTick(0) { ui->setupUi(this); ui->border->setText(QString("<font color='grey'>") + tr("无歌词") + QString("</font>")); ui->bg->lower(); connect(&DoubanPlayer::getInstance(), SIGNAL(positionChanged(qint64)), this, SLOT(setTick(qint64))); connect(lyricGetter, &LyricGetter::gotLyric, [this] (const QLyricList& lyric) { this->setLyric(lyric); }); connect(lyricGetter, &LyricGetter::gotLyricError, [this] (const QString&) { this->clear(); }); connect(&DoubanPlayer::getInstance(), SIGNAL(currentSongChanged(DoubanFMSong)), this, SLOT(setSong(DoubanFMSong))); }
void PosLen::read(QDomNode node) { QDomElement e = node.toElement(); QString s; s = e.attribute("tick"); if (!s.isEmpty()) { setType(TICKS); setTick(s.toInt()); } s = e.attribute("sample"); if (!s.isEmpty()) { setType(FRAMES); setFrame(s.toInt()); } s = e.attribute("len"); if (!s.isEmpty()) { int n = s.toInt(); if (type() == TICKS) setLenTick(n); else setLenFrame(n); } }
void Pos::snap(int raster) { setTick(sig->raster(tick(), raster)); }
void Pos::downSnap(int raster) { setTick(sig->raster1(tick(), raster)); }
void Pos::upSnap(int raster) { setTick(sig->raster2(tick(), raster)); }
void EventBase::move(int tickOffset) { setTick(tick() + tickOffset); }