void tex::handle_right_brace () { scal d; int f; ptr p; ptr q; switch (cur_group) { case SIMPLE_GROUP: unsave(); break; case BOTTOM_LEVEL: print_err("Too many }'s"); help_close_group(); error(); break; case SEMI_SIMPLE_GROUP: case MATH_SHIFT_GROUP: case MATH_LEFT_GROUP: extra_right_brace(); break; case HBOX_GROUP: package(0); break; case ADJUSTED_HBOX_GROUP: tex::adjust_tail = tex::adjust_head; package(0); break; case VBOX_GROUP: end_graf(); package(0); break; case VTOP_GROUP: end_graf(); package(VTOP_CODE); break; case INSERT_GROUP: end_graf(); q = split_top_skip; add_glue_ref(q); d = split_max_depth; f = floating_penalty; unsave(); decr(save_ptr); p = vpack(link(head), 0, ADDITIONAL); pop_nest(); if (saved(0) < 255) { tail_append(new_node(INS_NODE_SIZE)); type(tail) = INS_NODE; subtype(tail) = saved(0); ins_height(tail) = box_height(p) + box_depth(p); ins_ptr(tail) = list_ptr(p); split_top_ptr(tail) = q; ins_depth(tail) = d; float_cost(tail) = f; } else { tail_append(new_node(SMALL_NODE_SIZE)); type(tail) = ADJUST_NODE; subtype(tail) = 0; adjust_ptr(tail) = list_ptr(p); delete_glue_ref(q); } free_node(p, BOX_NODE_SIZE); if (nest_ptr == nest) build_page(); break; case OUTPUT_GROUP: if (loc != null || (token_type != OUTPUT_TEXT && token_type != BACKED_UP)) { print_err("Unbalanced output routine"); help_output_balance(); error(); do get_token(); while (loc != null); } end_token_list(); end_graf(); unsave(); output_active = FALSE; insert_penalties = 0; if (box(255) != null) { print_err("Output routine didn't use all of "); print_esc("box255"); help_output(); box_error(255); } if (tail != head) { link(page_tail) = link(head); page_tail = tail; } if (link(page_head) != null) { if (link(contrib_head) == null) contrib_tail = page_tail; link(page_tail) = link(contrib_head); link(contrib_head) = link(page_head); link(page_head) = null; page_tail = page_head; } pop_nest(); build_page(); break; case DISC_GROUP: build_discretionary(); break; case ALIGN_GROUP: back_input(); cur_tok = sym2tok(FROZEN_CR); print_err("Missing "); print_esc("cr"); print(" inserted"); help_align_cr(); ins_error(); break; case NO_ALIGN_GROUP: end_graf(); unsave(); align_peek(); break; case VCENTER_GROUP: end_graf(); unsave(); save_ptr -= 2; p = vpackage(link(head), saved(1), saved(0), MAX_DIMEN); pop_nest(); tail_append(new_noad()); type(tail) = VCENTER_NOAD; math_type(nucleus(tail)) = SUB_BOX; info(nucleus(tail)) = p; break; case MATH_CHOICE_GROUP: build_choices(); break; case MATH_GROUP: unsave(); decr(save_ptr); math_type(saved(0)) = SUB_MLIST; p = fin_mlist(null); math_link(saved(0)) = p; if (p != null) { if (link(p) == null) { if (type(p) == ORD_NOAD) { if (math_type(subscr(p)) == EMPTY && math_type(supscr(p)) == EMPTY) { mcopy(saved(0), nucleus(p)); free_node(p, NOAD_SIZE); } } else if (type(p) == ACCENT_NOAD && saved(0) == nucleus(tail) && type(tail) == ORD_NOAD) { q = head; while (link(q) != tail) q = link(q); link(q) = p; free_node(tail, NOAD_SIZE); tail = p; } } } break; default: confusion("rightbrace"); break; } }
void TextLineSegment::layout1() { TextLine* tl = textLine(); if (!tl->diagonal()) _userOff2.setY(0); switch (subtype()) { case SEGMENT_SINGLE: case SEGMENT_BEGIN: if (tl->beginText()) { if (_text == 0) { _text = new Text(*tl->beginText()); _text->setFlag(ELEMENT_MOVABLE, false); _text->setParent(this); } } else { delete _text; _text = 0; } break; case SEGMENT_MIDDLE: case SEGMENT_END: if (tl->continueText()) { if (_text == 0) { _text = new Text(*tl->continueText()); _text->setFlag(ELEMENT_MOVABLE, false); _text->setParent(this); } } else { delete _text; _text = 0; } break; } if (_text) _text->layout(); QPointF pp1; QPointF pp2(pos2()); if (!_text && pp2.y() != 0) { setbbox(QRectF(pp1, pp2).normalized()); return; } qreal y1 = point(-textLine()->lineWidth()); qreal y2 = -y1; int sym = textLine()->beginSymbol(); if (_text) { qreal h = _text->height(); if (textLine()->beginTextPlace() == PLACE_ABOVE) y1 = -h; else if (textLine()->beginTextPlace() == PLACE_BELOW) y2 = h; else { y1 = -h * .5; y2 = h * .5; } } else if (sym != -1) { qreal hh = symbols[score()->symIdx()][sym].height(magS()) * .5; y1 = -hh; y2 = hh; } if (textLine()->endHook()) { qreal h = point(textLine()->endHookHeight()); if (h > y2) y2 = h; else if (h < y1) y1 = h; } if (textLine()->beginHook()) { qreal h = point(textLine()->beginHookHeight()); if (h > y2) y2 = h; else if (h < y1) y1 = h; } bbox().setRect(.0, y1, pp2.x(), y2 - y1); }
const char* Accidental::subtypeUserName() const { return accList[subtype()].name; }
Dot11EndCFAck::Dot11EndCFAck(const address_type &dst_addr, const address_type &target_addr) : Dot11ControlTA(dst_addr, target_addr) { subtype(CF_END_ACK); }
void Dot11BlockAckRequest::init_block_ack() { subtype(BLOCK_ACK_REQ); std::memset(&_bar_control, 0, sizeof(_bar_control)); std::memset(&_start_sequence, 0, sizeof(_start_sequence)); }
bool LayoutBreak::acceptDrop(MuseScoreView*, const QPointF&, Element* e) const { return e->type() == LAYOUT_BREAK && static_cast<LayoutBreak*>(e)->subtype() != subtype(); }
Dot11PSPoll::Dot11PSPoll(const address_type &dst_addr, const address_type &target_addr) : Dot11ControlTA(dst_addr, target_addr) { subtype(PS); }
QString Articulation::subtypeUserName() const { return articulationList[subtype()].description; }
void Articulation::layout() { SymId sym = _up ? articulationList[subtype()].upSym : articulationList[subtype()].downSym; setbbox(symbols[score()->symIdx()][sym].bbox(magS())); }
qreal Articulation::timeStretch() const { return articulationList[subtype()].timeStretch; }
ArticulationType Articulation::articulationType() const { return ArticulationType(subtype()); }
QString Articulation::subtypeName() const { return articulationList[subtype()].name; }
QString Tremolo::subtypeName() const { return qApp->translate("Tremolo", tremoloName[subtype()]); }
void tex::box_end(int box_context) { ptr p; #define LEADERS "Leaders not followed by proper glue" if (box_context < BOX_FLAG) { if (cur_box != null) { shift_amount(cur_box) = box_context; if (abs(mode) == VMODE) { append_to_vlist(cur_box); if (tex::adjust_tail != null) { if (tex::adjust_head != tex::adjust_tail) { link(tail) = link(tex::adjust_head); tail = tex::adjust_tail; } tex::adjust_tail = null; } if (mode > 0) build_page(); } else { if (abs(mode) == HMODE) { space_factor = 1000; } else { p = new_noad(); math_type(nucleus(p)) = SUB_BOX; info(nucleus(p)) = cur_box; cur_box = p; } tail_append(cur_box); } } } else if (box_context < SHIP_OUT_FLAG) { if (box_context < BOX_FLAG + 256) { reg_define(box_reg[box_context - BOX_FLAG], BOX_REG, cur_box); } else { reg_gdefine(box_reg[box_context - BOX_FLAG - 256], BOX_REG, cur_box); } } else if (cur_box != null) { if (box_context > SHIP_OUT_FLAG) { get_nbrx_token(); if (cur_cmd == HSKIP && abs(mode) != VMODE || cur_cmd == VSKIP && abs(mode) == VMODE || cur_cmd == MSKIP && abs(mode) == MMODE) { append_glue(); leader_ptr(tail) = cur_box; subtype(tail) = box_context - (LEADER_FLAG - A_LEADERS); } else { print_err(LEADERS); help_leaders(); back_error(); flush_node_list(cur_box); } } else { ship_out(cur_box); } } }
void BarLine::draw(QPainter* painter) const { qreal lw = point(score()->styleS(ST_barWidth)); qreal y1, y2; getY(&y1, &y2); QPen pen(curColor(), lw, Qt::SolidLine, Qt::FlatCap); painter->setPen(pen); qreal mags = magS(); switch(subtype()) { case BROKEN_BAR: pen.setStyle(Qt::DashLine); painter->setPen(pen); case NORMAL_BAR: painter->drawLine(QLineF(lw * .5, y1, lw * .5, y2)); break; case END_BAR: { qreal lw2 = point(score()->styleS(ST_endBarWidth)); qreal d = point(score()->styleS(ST_endBarDistance)); painter->drawLine(QLineF(lw * .5, y1, lw * .5, y2)); pen.setWidthF(lw2); painter->setPen(pen); qreal x = d + lw2 * .5 + lw; painter->drawLine(QLineF(x, y1, x, y2)); } break; case DOUBLE_BAR: { lw = point(score()->styleS(ST_doubleBarWidth)); qreal d = point(score()->styleS(ST_doubleBarDistance)); pen.setWidthF(lw); painter->setPen(pen); qreal x = lw * .5; painter->drawLine(QLineF(x, y1, x, y2)); x += d + lw; painter->drawLine(QLineF(x, y1, x, y2)); } break; case START_REPEAT: { qreal lw2 = point(score()->styleS(ST_endBarWidth)); qreal d1 = point(score()->styleS(ST_endBarDistance)); qreal x2 = lw2 * .5; // thick line (lw2) qreal x1 = lw2 + d1 + lw * .5; // thin line (lw) qreal x0 = lw2 + d1 + lw + d1; // dot position drawDots(painter, x0); painter->drawLine(QLineF(x1, y1, x1, y2)); pen.setWidthF(lw2); painter->setPen(pen); painter->drawLine(QLineF(x2, y1, x2, y2)); if (score()->styleB(ST_repeatBarTips)) { symbols[score()->symIdx()][brackettipsRightUp].draw(painter, mags, QPointF(0.0, y1)); symbols[score()->symIdx()][brackettipsRightDown].draw(painter, mags, QPointF(0.0, y2)); } } break; case END_REPEAT: { qreal lw2 = point(score()->styleS(ST_endBarWidth)); qreal d1 = point(score()->styleS(ST_endBarDistance)); const Sym& dotsym = symbols[score()->symIdx()][dotSym]; qreal dotw = dotsym.width(mags); qreal x1 = dotw + d1 + lw * .5; qreal x2 = dotw + d1 + lw + d1 + lw2 * .5; drawDots(painter, 0.0); painter->drawLine(QLineF(x1, y1, x1, y2)); pen.setWidthF(lw2); painter->setPen(pen); painter->drawLine(QLineF(x2, y1, x2, y2)); if (score()->styleB(ST_repeatBarTips)) { qreal x = x2 + lw2 * .5; symbols[score()->symIdx()][brackettipsLeftUp].draw(painter, mags, QPointF(x, y1)); symbols[score()->symIdx()][brackettipsLeftDown].draw(painter, mags, QPointF(x, y2)); } } break; case END_START_REPEAT: { qreal lw2 = point(score()->styleS(ST_endBarWidth)); qreal d1 = point(score()->styleS(ST_endBarDistance)); const Sym& dotsym = symbols[score()->symIdx()][dotSym]; qreal dotw = dotsym.width(mags); qreal x1 = dotw + d1 + lw * .5; // thin bar qreal x2 = dotw + d1 + lw + d1 + lw2 * .5; // thick bar qreal x3 = dotw + d1 + lw + d1 + lw2 + d1 + lw * .5; // thin bar qreal x4 = dotw + d1 + lw + d1 + lw2 + d1 + lw + d1; // dot position drawDots(painter, .0); drawDots(painter, x4); painter->drawLine(QLineF(x1, y1, x1, y2)); pen.setWidthF(lw2); painter->setPen(pen); painter->drawLine(QLineF(x2, y1, x2, y2)); pen.setWidthF(lw); painter->setPen(pen); painter->drawLine(QLineF(x3, y1, x3, y2)); } break; } }
void TrillSegment::draw(QPainter* painter) const { qreal mag = magS(); int idx = score()->symIdx(); QRectF b2(symbols[idx][trillelementSym].bbox(mag)); qreal w2 = symbols[idx][trillelementSym].width(mag); qreal x2 = pos2().x(); painter->setPen(curColor()); if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_BEGIN) { int sym = 0; qreal x0 = 0.0, x1 = 0.0, y = 0.0; int n = 0; QRectF b1; switch(trill()->subtype()) { case Trill::TRILL_LINE: sym = trillSym; b1 = symbols[idx][sym].bbox(mag); x0 = -b1.x(); x1 = x0 + b1.width(); n = int(floor((x2-x1) / w2)); y = 0.0; break; case Trill::UPPRALL_LINE: sym = upprallSym; b1 = symbols[idx][sym].bbox(mag); x0 = -b1.x(); x1 = b1.width(); n = int(floor((x2-x1) / w2)); y = -b1.height(); break; case Trill::DOWNPRALL_LINE: sym = downprallSym; b1 = symbols[idx][sym].bbox(mag); x0 = -b1.x(); x1 = b1.width(); n = int(floor((x2-x1) / w2)); y = -b1.height(); break; case Trill::PRALLPRALL_LINE: sym = prallprallSym; b1 = symbols[idx][sym].bbox(mag); x0 = -b1.x(); x1 = b1.width(); n = int(floor((x2-x1) / w2)); y = -b1.height(); break; case Trill::PURE_LINE: sym = noSym; x0 = 0; x1 = 0; n = int(floor((x2-x1) / w2)); y = 0.0; } if (n <= 0) n = 1; if (sym != noSym) symbols[idx][sym].draw(painter, mag, QPointF(x0, y)); symbols[idx][trillelementSym].draw(painter, mag, QPointF(x1, b2.y() * .9), n); } else { qreal x1 = 0.0; int n = int(floor((x2-x1) / w2)); symbols[idx][trillelementSym].draw(painter, mag, QPointF(x1, b2.y() * .9), n); } }
void BarLine::layout() { qreal y1, y2; getY(&y1, &y2); qreal _spatium = spatium(); qreal dw = score()->styleS(ST_barWidth).val() * _spatium; qreal dotwidth = symbols[score()->symIdx()][dotSym].width(magS()); switch(subtype()) { case DOUBLE_BAR: dw = (score()->styleS(ST_doubleBarWidth) * 2 + score()->styleS(ST_doubleBarDistance)).val() * _spatium; break; case START_REPEAT: dw += dotwidth + (score()->styleS(ST_endBarWidth) + 2 * score()->styleS(ST_endBarDistance)).val() * _spatium; break; case END_REPEAT: dw += dotwidth + (score()->styleS(ST_endBarWidth) + 2 * score()->styleS(ST_endBarDistance)).val() * _spatium; break; case END_BAR: dw += (score()->styleS(ST_endBarWidth) + score()->styleS(ST_endBarDistance)).val() * _spatium; break; case END_START_REPEAT: dw += 2 * dotwidth + (score()->styleS(ST_barWidth) + score()->styleS(ST_endBarWidth) + 4 * score()->styleS(ST_endBarDistance)).val() * _spatium; break; case BROKEN_BAR: case NORMAL_BAR: break; default: qDebug("illegal bar line type\n"); break; } QRectF r(0.0, y1, dw, y2-y1); if (score()->styleB(ST_repeatBarTips)) { // qreal mags = magS(); switch (subtype()) { case START_REPEAT: //r |= symbols[brackettipsRightUp].bbox(mags).translated(0, y1); //r |= symbols[brackettipsRightDown].bbox(mags).translated(0, y2); break; case END_REPEAT: //r |= symbols[brackettipsLeftUp].bbox(mags).translated(0, y1); //r |= symbols[brackettipsLeftDown].bbox(mags).translated(0, y2); break; default: break; } } foreach(Element* e, _el) { e->layout(); if (e->type() == ARTICULATION) { Articulation* a = static_cast<Articulation*>(e); ArticulationAnchor aa = a->anchor(); qreal distance = 0.5 * _spatium; qreal topY = y1 - distance; qreal botY = y2 + distance; qreal x = width() - (a->width() * .5); if (aa == A_TOP_STAFF) a->setPos(QPointF(x, topY)); else if (aa == A_BOTTOM_STAFF) a->setPos(QPointF(x, botY)); } }
void tex::insert_page(ptr p) { int n; ptr q, r; scal h, w; scal delta; if (page_contents == EMPTY) freeze_page_specs(INSERTS_ONLY); n = subtype(p); r = page_ins_head; while (n >= subtype(link(r))) r = link(r); if (subtype(r) != n) { q = new_node(PAGE_INS_NODE_SIZE); link(q) = link(r); r = link(r) = q; subtype(r) = n; type(r) = INSERTING; ensure_vbox(n); page_ins_height(r) = (box(n) == null) ? 0 : box_height(box(n)) + box_depth(box(n)); best_ins_ptr(r) = null; q = skip(n); if (count(n) == 1000) h = page_ins_height(r); else h = x_over_n(page_ins_height(r), 1000) * count(n); page_goal -= h + glue_width(q); page_so_far[2 + stretch_order(q)] += stretch(q); page_shrink += shrink(q); if (shrink_order(q) != NORMAL && shrink(q) != 0) { print_err("Infinite glue shrinkage inserted from "); print_esc("skip"); print_int(n); help_inf_shrink_ins(); error(); } } if (type(r) == SPLIT_UP) { insert_penalties += float_cost(p); return; } last_ins_ptr(r) = p; delta = page_goal - page_total - page_depth + page_shrink; if (count(n) == 1000) { h = ins_height(p); } else { h = x_over_n(ins_height(p), 1000) * count(n); } if ((h <= 0 || h <= delta) && ins_height(p) + page_ins_height(r) <= dimen(n)) { page_goal -= h; page_ins_height(r) += ins_height(p); } else { if (count(n) <= 0) { w = MAX_DIMEN; } else { w = page_goal - page_total - page_depth; if (count(n) != 1000) { w = x_over_n(w, count(n)) * 1000; } } if (w > dimen(n) - page_ins_height(r)) { w = dimen(n) - page_ins_height(r); } q = vert_break(ins_ptr(p), w, ins_depth(p)); page_ins_height(r) += best_height_plus_depth; if (tracing_pages > 0) show_split(n, w, q); if (count(n) != 1000) { best_height_plus_depth = x_over_n(best_height_plus_depth, 1000) * count(n); } page_goal -= best_height_plus_depth; type(r) = SPLIT_UP; broken_ptr(r) = q; broken_ins(r) = p; if (q == null) { insert_penalties += EJECT_PENALTY; } else if (type(q) == PENALTY_NODE) { insert_penalties += penalty(q); } } }
bool LineSegment::edit(MuseScoreView* sv, int curGrip, int key, Qt::KeyboardModifiers modifiers, const QString&) { if (!((modifiers & Qt::ShiftModifier) && ((subtype() == SEGMENT_SINGLE) || (subtype() == SEGMENT_BEGIN && curGrip == GRIP_LINE_START) || (subtype() == SEGMENT_END && curGrip == GRIP_LINE_END)))) return false; LineSegment* ls = 0; SLine* l = line(); bool bspDirty = false; SpannerSegmentType st = subtype(); int track = l->track(); if (l->anchor() == ANCHOR_SEGMENT) { Segment* s1 = static_cast<Segment*>(l->startElement()); Segment* s2 = static_cast<Segment*>(l->endElement()); bool removeSegment = false; if (key == Qt::Key_Left) { if (curGrip == GRIP_LINE_START) { s1 = prevSeg1(s1, track); } else if (curGrip == GRIP_LINE_END) { s2 = prevSeg1(s2, track); if (s2 && (s2->system()->firstMeasure() == s2->measure()) && (s2->tick() == s2->measure()->tick())) { removeSegment = true; } } } else if (key == Qt::Key_Right) { if (curGrip == GRIP_LINE_START) s1 = nextSeg1(s1, track); else if (curGrip == GRIP_LINE_END) { if ((s2->system()->firstMeasure() == s2->measure()) && (s2->tick() == s2->measure()->tick())) bspDirty = true; s2 = nextSeg1(s2, track); } } if (s1 == 0 || s2 == 0 || s1->tick() >= s2->tick()) return true; if (l->startElement() != s1) { if (s1->system() != (static_cast<Segment*>(l->startElement())->system())) { bspDirty = true; if (key == Qt::Key_Right) ls = l->takeFirstSegment(); } static_cast<Segment*>(l->startElement())->remove(l); l->setStartElement(s1); s1->add(l); } else if (l->endElement() != s2) { if (removeSegment) { bspDirty = true; if (key == Qt::Key_Left) ls = l->takeLastSegment(); } static_cast<Segment*>(l->endElement())->removeSpannerBack(l); l->setEndElement(s2); s2->addSpannerBack(l); } } else { Measure* m1 = static_cast<Measure*>(l->startElement()); Measure* m2 = static_cast<Measure*>(l->endElement()); bool removeSegment = false; if (key == Qt::Key_Left) { if (curGrip == GRIP_LINE_START) { if (m1->prevMeasure()) m1 = m1->prevMeasure(); } else if (curGrip == GRIP_LINE_END) { if (m2 && (m2->system()->firstMeasure() == m2)) removeSegment = true; Measure* m = m2->prevMeasure(); if (m) m2 = m; } } else if (key == Qt::Key_Right) { if (curGrip == GRIP_LINE_START) { if (m1->nextMeasure()) m1 = m1->nextMeasure(); } else if (curGrip == GRIP_LINE_END) { if (m2->nextMeasure()) m2 = m2->nextMeasure(); if (m2->system()->firstMeasure() == m2) bspDirty = true; } } if (m1->tick() > m2->tick()) return true; if (l->startElement() != m1) { if (m1->system() != (static_cast<Measure*>(l->startElement())->system())) { bspDirty = true; if (key == Qt::Key_Right) ls = l->takeFirstSegment(); } l->startElement()->remove(l); l->setStartElement(m1); m1->add(l); } else if (l->endElement() != m2) { if (removeSegment) { bspDirty = true; if (key == Qt::Key_Left) ls = l->takeLastSegment(); } static_cast<Measure*>(l->endElement())->removeSpannerBack(l); l->setEndElement(m2); m2->addSpannerBack(l); } } l->layout(); LineSegment* nls = 0; if (st == SEGMENT_SINGLE) { if (curGrip == GRIP_LINE_START) nls = l->frontSegment(); else if (curGrip == GRIP_LINE_END) nls = l->backSegment(); } else if (st == SEGMENT_BEGIN) nls = l->frontSegment(); else if (st == SEGMENT_END) nls = l->backSegment(); if (nls && (nls != this)) sv->changeEditElement(nls); if (bspDirty) _score->rebuildBspTree(); if (ls) _score->undoRemoveElement(ls); return true; }
void tex::fire_up(ptr c) { int n; bool wait; ptr prev_p; scal save_vfuzz; int save_vbadness; ptr save_split_top_skip; ptr p, q, r; if (type(best_page_break) == PENALTY_NODE) { set_output_penalty(penalty(best_page_break)); penalty(best_page_break) = INF_PENALTY; } else { set_output_penalty(INF_PENALTY); } if (bot_mark != null) { if (top_mark != null) delete_token_ref(top_mark); top_mark = bot_mark; add_token_ref(top_mark); delete_token_ref(first_mark); first_mark = null; } if (c == best_page_break) { best_page_break = null; } if (box(255) != null) { print_err(null_str); print_esc("box"); print("255 is not void"); help_box_255(); box_error(255); } insert_penalties = 0; save_split_top_skip = split_top_skip; if (holding_inserts <= 0) { r = link(page_ins_head); while (r != page_ins_head) { if (best_ins_ptr(r) != null) { n = subtype(r); ensure_vbox(n); if (box(n) == null) box(n) = new_null_box(); p = node_list(box(n)); while (link(p) != null) { p = link(p); } last_ins_ptr(r) = p; } r = link(r); } } q = hold_head; link(q) = null; prev_p = page_head; p = link(prev_p); while (p != best_page_break) { if (type(p) == INS_NODE) { if (holding_inserts <= 0) { wait = insert_box(p); link(prev_p) = link(p); link(p) = null; if (wait) { q = link(q) = p; incr(insert_penalties); } else { delete_glue_ref(split_top_ptr(p)); free_node(p, INS_NODE_SIZE); } p = prev_p; } } else if (type(p) == MARK_NODE) { if (first_mark == null) { first_mark = mark_ptr(p); add_token_ref(first_mark); } if (bot_mark != null) delete_token_ref(bot_mark); bot_mark = mark_ptr(p); add_token_ref(bot_mark); } prev_p = p; p = link(prev_p); } split_top_skip = save_split_top_skip; if (p != null) { if (link(contrib_head) == null) { if (nest_ptr == nest) { tail = page_tail; } else { contrib_tail = page_tail; } } link(page_tail) = link(contrib_head); link(contrib_head) = p; link(prev_p) = null; } save_vbadness = vbadness; save_vfuzz = vfuzz; vbadness = INF_BAD; vfuzz = MAX_DIMEN; box(255) = vpackage(link(page_head), best_size, EXACTLY, page_max_depth); vbadness = save_vbadness; vfuzz = save_vfuzz; if (last_glue != null) delete_glue_ref(last_glue); start_new_page(); if (q != hold_head) { link(page_head) = link(hold_head); page_tail = q; } r = link(page_ins_head); while (r != page_ins_head) { q = link(r); free_node(r, PAGE_INS_NODE_SIZE); r = q; } link(page_ins_head) = page_ins_head; if (top_mark != null && first_mark == null) { first_mark = top_mark; add_token_ref(top_mark); } if (output_routine != null) { if (dead_cycles >= max_dead_cycles) { print_err("Output loop---"); print_int(dead_cycles); print(" consecutive dead cycles"); help_dead_cycles(); error(); } else { output_active = TRUE; incr(dead_cycles); push_nest(); mode = -VMODE; prev_depth = IGNORE_DEPTH; mode_line = -line; begin_token_list(output_routine, OUTPUT_TEXT); new_save_level(OUTPUT_GROUP); normal_paragraph(); scan_left_brace(); return; } } if (link(page_head) != null) { if (link(contrib_head) == null) { if (nest_ptr == nest) { tail = page_tail; } else { contrib_tail = page_tail; } } else { link(page_tail) = link(contrib_head); } link(contrib_head) = link(page_head); link(page_head) = null; page_tail = page_head; } ship_out(box(255)); box(255) = null; }
Dot11CFEnd::Dot11CFEnd(const address_type &dst_addr, const address_type &target_addr) : Dot11ControlTA(dst_addr, target_addr) { subtype(CF_END); }
void Bracket::layout() { qreal _spatium = spatium(); path = QPainterPath(); if (h2 == 0.0) return; qreal h = h2 + yoff * .5; // qreal d = 0.0; if (subtype() == BRACKET_AKKOLADE) { qreal w = point(score()->styleS(ST_akkoladeWidth)); #if 0 const qreal X1 = 2.0 * w; const qreal X2 = -0.7096 * w; const qreal X3 = -1.234 * w; const qreal X4 = 1.734 * w; const qreal Y1 = .3359 * h; const qreal Y2 = .5089 * h; const qreal Y3 = .5025 * h; const qreal Y4 = .2413 * h; path.moveTo(0, h); path.cubicTo(X1, h + Y1, X2, h + Y2, w, 2 * h); path.cubicTo(X3, h + Y3, X4, h + Y4, 0, h); path.cubicTo(X1, h - Y1, X2, h - Y2, w, 0); path.cubicTo(X3, h - Y3, X4, h - Y4, 0, h); #endif #define XM(a) (a+700)*w/700 #define YM(a) (a+7100)*h2/7100 path.moveTo( XM( -8), YM(-2048)); path.cubicTo(XM( -8), YM(-3192), XM(-360), YM(-4304), XM( -360), YM(-5400)); // c 0 path.cubicTo(XM( -360), YM(-5952), XM(-264), YM(-6488), XM( 32), YM(-6968)); // c 1 path.cubicTo(XM( 40), YM(-6976), XM( 40), YM(-6976), XM( 40), YM(-6984)); // c 0 path.cubicTo(XM( 40), YM(-7000), XM( 16), YM(-7024), XM( 0), YM(-7024)); // c 0 path.cubicTo(XM( -8), YM(-7024), XM( -24), YM(-7024), XM( -32), YM(-7008)); // c 1 path.cubicTo(XM( -416), YM(-6392), XM(-544), YM(-5680), XM( -544), YM(-4960)); // c 0 path.cubicTo(XM( -544), YM(-3800), XM(-168), YM(-2680), XM( -168), YM(-1568)); // c 0 path.cubicTo(XM( -168), YM(-1016), XM(-264), YM( -496), XM( -560), YM( -16)); // c 1 path.lineTo( XM( -560), YM( 0)); // l 1 path.lineTo( XM( -560), YM( 16)); // l 1 path.cubicTo(XM( -264), YM( 496), XM(-168), YM( 1016), XM( -168), YM( 1568)); // c 0 path.cubicTo(XM( -168), YM( 2680), XM(-544), YM( 3800), XM( -544), YM( 4960)); // c 0 path.cubicTo(XM( -544), YM( 5680), XM(-416), YM( 6392), XM( -32), YM( 7008)); // c 1 path.cubicTo(XM( -24), YM( 7024), XM( -8), YM( 7024), XM( 0), YM( 7024)); // c 0 path.cubicTo(XM( 16), YM( 7024), XM( 40), YM( 7000), XM( 40), YM( 6984)); // c 0 path.cubicTo(XM( 40), YM( 6976), XM( 40), YM( 6976), XM( 32), YM( 6968)); // c 1 path.cubicTo(XM( -264), YM( 6488), XM(-360), YM( 5952), XM( -360), YM( 5400)); // c 0 path.cubicTo(XM( -360), YM( 4304), XM( -8), YM( 3192), XM( -8), YM( 2048)); // c 0 path.cubicTo(XM( - 8), YM( 1320), XM(-136), YM( 624), XM( -512), YM( 0)); // c 1 path.cubicTo(XM( -136), YM( -624), XM( -8), YM(-1320), XM( -8), YM(-2048)); // c 0 } else if (subtype() == BRACKET_NORMAL) { qreal w = point(score()->styleS(ST_bracketWidth)); QChar up = symbols[score()->symIdx()][brackettipsRightUp].code(); QChar down = symbols[score()->symIdx()][brackettipsRightDown].code(); QFont f(fontId2font(0)); f.setPointSizeF(2.0 * _spatium); qreal o = _spatium * .17; qreal slw = point(score()->styleS(ST_staffLineWidth)); path.setFillRule(Qt::WindingFill); path.addText(QPointF(0.0, -o), f, QString(up)); path.addText(QPointF(0.0, h * 2.0 + o), f, QString(down)); path.addRect(0.0, -slw * .5, w, h * 2.0 + slw); } QRectF r(path.boundingRect()); setbbox(path.boundingRect()); }
Dot11Ack::Dot11Ack(const address_type &dst_addr) : Dot11Control(dst_addr) { subtype(ACK); }
int Dynamic::velocity() const { return _velocity <= 0 ? dynList[subtype()].velocity : _velocity; }
Dot11RTS::Dot11RTS(const address_type &dst_addr, const address_type &target_addr) : Dot11ControlTA(dst_addr, target_addr) { subtype(RTS); }
const QString Dynamic::subtypeName() const { return dynList[subtype()].tag; }
void TextLineSegment::draw(QPainter* painter) const { TextLine* tl = textLine(); qreal _spatium = spatium(); qreal textlineLineWidth = tl->lineWidth().val() * _spatium; qreal textlineTextDistance = _spatium * .5; QPointF pp2(pos2()); QColor color; bool normalColor = false; if (selected() && !(score() && score()->printing())) color = MScore::selectColor[0]; else if (!visible()) color = Qt::gray; else { color = curColor(); normalColor = true; } qreal l = 0.0; int sym = subtype() == SEGMENT_MIDDLE ? tl->continueSymbol() : tl->beginSymbol(); if (_text) { SpannerSegmentType st = subtype(); if ( ((st == SEGMENT_SINGLE || st == SEGMENT_BEGIN) && (tl->beginTextPlace() == PLACE_LEFT)) || ((st == SEGMENT_MIDDLE || st == SEGMENT_END) && (tl->continueTextPlace() == PLACE_LEFT)) ) { QRectF bb(_text->bbox()); l = _text->pos().x() + bb.width() + textlineTextDistance; } painter->translate(_text->pos()); painter->setPen(normalColor ? _text->curColor() : color); _text->draw(painter); painter->translate(-_text->pos()); } else if (sym != -1) { const QRectF& bb = symbols[score()->symIdx()][sym].bbox(magS()); qreal h = bb.height() * .5; QPointF o = tl->beginSymbolOffset() * _spatium; painter->setPen(color); symbols[score()->symIdx()][sym].draw(painter, 1.0, QPointF(o.x(), h + o.y())); l = bb.width() + textlineTextDistance; } QPen pen(normalColor ? tl->lineColor() : color, textlineLineWidth); pen.setStyle(tl->lineStyle()); painter->setPen(pen); if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_END) { if (tl->endSymbol() != -1) { int sym = tl->endSymbol(); const QRectF& bb = symbols[score()->symIdx()][sym].bbox(magS()); qreal h = bb.height() * .5; QPointF o = tl->endSymbolOffset() * _spatium; pp2.setX(pp2.x() - bb.width() + textlineTextDistance); symbols[score()->symIdx()][sym].draw(painter, 1.0, QPointF(pp2.x() + textlineTextDistance + o.x(), h + o.y())); } } QPointF pp1(l, 0.0); if (tl->beginHook() && tl->beginHookType() == HOOK_45) pp1.rx() += fabs(tl->beginHookHeight().val() * _spatium * .4); if (tl->endHook() && tl->endHookType() == HOOK_45) pp2.rx() -= fabs(tl->endHookHeight().val() * _spatium * .4); painter->drawLine(QLineF(pp1.x(), pp1.y(), pp2.x(), pp2.y())); if (tl->beginHook()) { qreal hh = tl->beginHookHeight().val() * _spatium; if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_BEGIN) { if (tl->beginHookType() == HOOK_45) painter->drawLine(QLineF(pp1.x(), pp1.y(), pp1.x() - fabs(hh * .4), pp1.y() + hh)); else painter->drawLine(QLineF(pp1.x(), pp1.y(), pp1.x(), pp1.y() + hh)); } } if (tl->endHook()) { qreal hh = tl->endHookHeight().val() * _spatium; if (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_END) { if (tl->endHookType() == HOOK_45) painter->drawLine(QLineF(pp2.x(), pp2.y(), pp2.x() + fabs(hh * .4), pp2.y() + hh)); else painter->drawLine(QLineF(pp2.x(), pp2.y(), pp2.x(), pp2.y() + hh)); } } }
void Dynamic::layout() { setSubtype(subtype()); // re-apply style Text::layout(); }
int Accidental::symbol() const { return accList[subtype()].sym; }
void Clef::layout() { qreal smag = _small ? score()->style(ST_smallClefMag).toDouble() : 1.0; qreal _spatium = spatium(); qreal msp = _spatium * smag; qreal yoff = 0.0; elements.clear(); Symbol* symbol = new Symbol(score()); int st = subtype(); if (staff() && staff()->useTablature() && clefTable[st].staffGroup != TAB_STAFF) st = CLEF_TAB; switch (st) { case CLEF_G: symbol->setSym(trebleclefSym); yoff = 3.0; break; case CLEF_G1: { symbol->setSym(trebleclefSym); yoff = 3.0; Symbol* number = new Symbol(score()); number->setMag(smag); number->setSym(clefEightSym); add(number, 1.0 * msp, -5.0 * msp + yoff * _spatium); } break; case CLEF_G2: { symbol->setSym(trebleclefSym); yoff = 3.0; Symbol* number = new Symbol(score()); symbol->setMag(smag); number->setSym(clefOneSym); add(number, .6 * msp, -5.0 * msp + yoff * _spatium); number = new Symbol(score()); number->setSym(clefFiveSym); add(number, 1.4 * msp, -5.0 * msp + yoff * _spatium); } break; case CLEF_G3: { symbol->setSym(trebleclefSym); yoff = 3.0; Symbol* number = new Symbol(score()); symbol->setMag(smag); number->setSym(clefEightSym); add(number, 1.0 * msp, 4.0 * msp + yoff * _spatium); } break; case CLEF_F: symbol->setSym(bassclefSym); yoff = 1.0; break; case CLEF_F8: { symbol->setSym(bassclefSym); yoff = 1.0; Symbol* number = new Symbol(score()); symbol->setMag(smag); number->setSym(clefEightSym); add(number, .0, 4.5 * msp + yoff * _spatium); } break; case CLEF_F15: { symbol->setSym(bassclefSym); yoff = 1.0; Symbol* number = new Symbol(score()); symbol->setMag(smag); number->setSym(clefOneSym); add(number, .0, 4.5 * msp + yoff * _spatium); number = new Symbol(score()); number->setSym(clefFiveSym); add(number, .8 * msp, 4.5 * msp + yoff * _spatium); } break; case CLEF_F_B: // baritone clef symbol->setSym(bassclefSym); yoff = 2.0; break; case CLEF_F_C: // subbass clef symbol->setSym(bassclefSym); yoff = 0.0; break; case CLEF_C1: symbol->setSym(altoclefSym); yoff = 4.0; break; case CLEF_C2: symbol->setSym(altoclefSym); yoff = 3.0; break; case CLEF_C3: symbol->setSym(altoclefSym); yoff = 2.0; break; case CLEF_C4: symbol->setSym(altoclefSym); yoff = 1.0; break; case CLEF_C5: symbol->setSym(altoclefSym); yoff = 0.0; break; case CLEF_TAB: { symbol->setSym(tabclefSym); Staff* st = staff(); if (st && st->useTablature()) { Tablature* tab = st->part()->instr()->tablature(); switch(tab->strings()) { default: case 6: yoff = 2.5 * 1.5; break; case 4: yoff = 1.5 * 1.5; break; } } else yoff = 2.0; } break; case CLEF_TAB2: { symbol->setSym(tabclef2Sym); Staff* st = staff(); if (st && st->useTablature()) { Tablature* tab = st->part()->instr()->tablature(); switch(tab->strings()) { default: case 6: yoff = 2.5 * 1.5; break; case 4: yoff = 1.5 * 1.5; break; } } else yoff = 2.0; } break; case CLEF_PERC: case CLEF_PERC2: symbol->setSym(percussionclefSym); yoff = 2.0; //(staff()->lines() - 1) * 0.5; break; case CLEF_G4: symbol->setSym(trebleclefSym); yoff = 4.0; break; case CLEF_F_8VA: { symbol->setSym(bassclefSym); yoff = 1.0; Symbol* number = new Symbol(score()); number->setMag(smag); number->setSym(clefEightSym); add(number, .5 * msp, -1.5 * msp + yoff * _spatium); } break; case CLEF_F_15MA: { symbol->setSym(bassclefSym); yoff = 1.0; Symbol* number = new Symbol(score()); symbol->setMag(smag); number->setSym(clefOneSym); add(number, .0 * msp, -1.5 * msp + yoff * _spatium); number = new Symbol(score()); number->setSym(clefFiveSym); add(number, .8 * msp, -1.5 * msp + yoff * _spatium); } break; } add(symbol, .0, yoff * _spatium); symbol->setMag(smag * mag()); _bbox = QRectF(); for (iElement i = elements.begin(); i != elements.end(); ++i) { Element* e = *i; _bbox |= e->bbox().translated(e->pos()); } }