CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlockList& bList ) : blockList(bList), formatLength(0) { length=line.size(); if (line.size() > 0) { formatLength=1; int k=1; // count number of different formats in this text line Character c = line[0]; while ( k<length ) { if ( !(line[k].equalsFormat(c))) { formatLength++; // format change detected c=line[k]; } k++; } //kDebug() << "number of different formats in string: " << formatLength; formatArray = (CharacterFormat*) blockList.allocate(sizeof(CharacterFormat)*formatLength); Q_ASSERT (formatArray!=nullptr); text = (quint16*) blockList.allocate(sizeof(quint16)*line.size()); Q_ASSERT (text!=nullptr); length=line.size(); wrapped=false; // record formats and their positions in the format array c=line[0]; formatArray[0].setFormat ( c ); formatArray[0].startPos=0; // there's always at least 1 format (for the entire line, unless a change happens) k=1; // look for possible format changes int j=1; while ( k<length && j<formatLength ) { if (!(line[k].equalsFormat(c))) { c=line[k]; formatArray[j].setFormat(c); formatArray[j].startPos=k; //kDebug() << "format entry " << j << " at pos " << formatArray[j].startPos << " " << &(formatArray[j].startPos) ; j++; } k++; } // copy character values for ( int i=0; i<line.size(); i++ ) { text[i]=line[i].character; //kDebug() << "char " << i << " at mem " << &(text[i]); } } //kDebug() << "line created, length " << length << " at " << &(length); }
ASFUNCTIONBODY(TextBlock, createTextLine) { TextBlock* th=static_cast<TextBlock*>(obj); _NR<TextLine> previousLine; int32_t width; ARG_UNPACK (previousLine, NullRef) (width, MAX_LINE_WIDTH); if (argslen > 2) LOG(LOG_NOT_IMPLEMENTED, "TextBlock::createTextLine ignored some parameters"); if (width <= 0 || width > MAX_LINE_WIDTH) throw Class<ArgumentError>::getInstanceS("Invalid width"); if (!previousLine.isNull()) { LOG(LOG_NOT_IMPLEMENTED, "TextBlock::createTextLine supports a single line only"); return getSys()->getNullRef(); } th->incRef(); TextLine *textLine = Class<TextLine>::getInstanceS(th->content, _MNR(th)); textLine->width = (uint32_t)width; textLine->updateSizes(); return textLine; }
void TextDisplay::HideCaret () { if (Interactor::ValidCanvas(canvas) && caretline >= topline && caretline <= bottomline ) { TextLine* l = Line(caretline, true); l->Draw(this, caretline, caretindex-1, caretindex); } }
IntCoord TextDisplay::Right (int line, int index) { TextLine* l = Line(line, false); if (l == nil) { return xmin + x0; } else { return xmin + x0 + l->Offset(this, index+1) - 1; } }
int TextDisplay::LineIndex (int line, IntCoord x, boolean between) { TextLine* l = Line(line, false); if (l == nil) { return 0; } else { return l->Index(this, x - (xmin + x0), between); } }
void Text::layout() { if (styled() && !_editMode) { SimpleText::layout(); } else { _doc->setDefaultFont(textStyle().font(spatium())); qreal w = -1.0; qreal x = 0.0; qreal y = 0.0; if (parent() && layoutToParentWidth()) { w = parent()->width(); if (parent()->type() == HBOX || parent()->type() == VBOX || parent()->type() == TBOX) { Box* box = static_cast<Box*>(parent()); x += box->leftMargin() * MScore::DPMM; y += box->topMargin() * MScore::DPMM; w = box->width() - ((box->leftMargin() + box->rightMargin()) * MScore::DPMM); } } QTextOption to = _doc->defaultTextOption(); to.setUseDesignMetrics(true); to.setWrapMode(w <= 0.0 ? QTextOption::NoWrap : QTextOption::WrapAtWordBoundaryOrAnywhere); _doc->setDefaultTextOption(to); if (w < 0.0) w = _doc->idealWidth(); _doc->setTextWidth(w); setbbox(QRectF(QPointF(0.0, 0.0), _doc->size())); if (hasFrame()) layoutFrame(); _doc->setModified(false); textStyle().layout(this); // process alignment #if 0 // TODO TEXT_STYLE_TEXTLINE if ((textStyle().align() & ALIGN_VCENTER) && (textStyle() == TEXT_STYLE_TEXTLINE)) { // special case: vertically centered text with TextLine needs to // take into account the line width TextLineSegment* tls = static_cast<TextLineSegment*>(parent()); TextLine* tl = tls->textLine(); if (tl) { qreal textlineLineWidth = point(tl->lineWidth()); rypos() -= textlineLineWidth * .5; } } #endif rxpos() += x; rypos() += y; } if (parent() && parent()->type() == SEGMENT) { Segment* s = static_cast<Segment*>(parent()); rypos() += s ? s->measure()->system()->staff(staffIdx())->y() : 0.0; } adjustReadPos(); }
void LineRenderer::refresh_tokens( TextLine & line ) { if ( AudicleWindow::main()->m_syntax_query->parseLine ( line.str(), tokenized ) ) { //if ( fakeTokenizer( line.str() , tokenized ) ) { line.tokens() = tokenized; } line.dirty() = false; }
PDFTextWordInterop *PDFTextLineInterop::getWords() { if(_words == NULL) { TextLine *line = (TextLine *)_textLine; TextWord *words = line->getWords(); _words = new PDFTextWordInterop(_textBlock, this, words, 0); } return _words; }
const char& TextFileIterator::operator *() const { if (mLineIndex == mFile->getLineCount()) { return *"\0"; } TextLine *line = mFile->mLines[mLineIndex]; if (mLineFeedIndex != -1) { const char *lfBytes = line->getLineFeed(); assert((size_t) mLineFeedIndex < sizeof(lfBytes) - 1); return lfBytes[mLineFeedIndex]; } return (*line)[mColumnIndex]; }
PDFTextLineInterop *PDFTextLineInterop::getNext() { if(next == NULL) { TextLine *line = (TextLine *)_textLine; TextLine *nextLine = line->getNext(); if(nextLine == NULL) return NULL; next = new PDFTextLineInterop(_textBlock, nextLine, _currentLine +1); } return next; }
TextFileIterator& TextFileIterator::operator --() { if (0 < mColumnIndex) { mColumnIndex--; } else { if (0 < mLineIndex) { mLineIndex--; TextLine *beforeLine = mFile->mLines[mLineIndex]; mColumnIndex = beforeLine->size() - 1; } } return *this; }
IntCoord TextDisplay::Width () { if (width < 0) { if (painter != nil) { width = 0; for (int i = firstline; i <= lastline; ++i) { TextLine* line = Line(i, false); if (line != nil) { width = Math::max(width, line->Offset(this, 10000)); } } } } return width; }
void TextCursor::setPosition(const KTextEditor::Cursor& position, bool init) { // any change or init? else do nothing if (!init && position.line() == line() && position.column() == m_column) return; // remove cursor from old block in any case if (m_block) m_block->removeCursor (this); // first: validate the line and column, else invalid if (position.column() < 0 || position.line () < 0 || position.line () >= m_buffer.lines ()) { if (!m_range) m_buffer.m_invalidCursors.insert (this); m_block = 0; m_line = m_column = -1; return; } // else, find block TextBlock *block = m_buffer.blockForIndex (m_buffer.blockForLine (position.line())); Q_ASSERT(block); // get line TextLine textLine = block->line (position.line()); #if 0 // this is no good idea, smart cursors don't do that, too, for non-wrapping cursors // now, validate column, else stay invalid if (position.column() > textLine->text().size()) { if (!m_range) m_buffer.m_invalidCursors.insert (this); m_block = 0; m_line = m_column = -1; return; } #endif // if cursor was invalid before, remove it from invalid cursor list if (!m_range && !m_block && !init) { Q_ASSERT(m_buffer.m_invalidCursors.contains (this)); m_buffer.m_invalidCursors.remove (this); } // else: valid cursor m_block = block; m_line = position.line () - m_block->startLine (); m_column = position.column (); m_block->insertCursor (this); }
void TextDisplay::DeleteText (int l, int i, int c) { TextLine* line = Line(l, true); line->Delete(this, l, i, c); if (painter != nil && width != -1) { if (l == widestline) { IntCoord w = line->Offset(this, 10000); if (w < width) { width = -1; } } } if (l == caretline) { ShowCaret(); } }
int PDFTextLineInterop::getWordCount() { if(_wordCount == -1) { TextLine *line = (TextLine *)_textLine; TextWord *words = line->getWords(); TextWord *word = NULL; _wordCount = 0; while(words) { word = words; words = words->getNext(); _wordCount++; } } return _wordCount; }
stl::wstring towstring (const TextLine& line) { if (sizeof (wchar_t) == 4) return stl::wstring ((const wchar_t*)line.TextUtf32 (), line.TextLength ()); stl::wstring result; result.fast_resize (line.TextLength ()); const void* source = line.TextUtf32 (); size_t source_size = line.TextLength () * sizeof (unsigned int); void* destination = &result [0]; size_t destination_size = result.size () * sizeof (wchar_t); convert_encoding (common::Encoding_UTF32LE, source, source_size, common::Encoding_UTF16LE, destination, destination_size); return result; }
void ShellContent::drawPromptLine( TextLine &s ) { glLineWidth ( _fontWeight * 1.0 ); bufferFont->draw_sub( _prompt + "% " ); // we lose kerning from one to the next, but otherwise this is pretty legal. glLineWidth ( _fontWeight * 2.0 ); bufferFont->draw_sub( s.str() ); }
void TextBuffer::addTextLine( TextLine &t, int pos ) { if ( empty() ) _lines[0] = t; else if ( pos > (int)_lines.size() || pos == -1 ) _lines.push_back(t); else _lines.insert(_lines.begin()+pos, t ); t.dirty() = true; }
void TextDisplay::InsertText (int l, int i, const char* t, int c) { TextLine* line = Line(l, true); line->Insert(this, l, i, t, c); if (painter != nil && width != -1) { IntCoord w = line->Offset(this, 10000); if (w > width) { width = w; widestline = l; } } if (autosized) { IntCoord dw = Width() - (xmax - xmin); if (dw > 0) { xmax += dw; Redraw(xmax - dw + 1, ymin, xmax, ymax); } } if (l == caretline) { ShowCaret(); } }
void TextEdit::drawCursor(int cx, int cy, bool on, bool createGC /* = false */) { bool cursorOn = on; if (!focusIn || inputDisabled) cursorOn = false; if (cx < windowX || cy < windowY || cx >= windowX + windowWidth || cy >= windowY + windowHeight) return; // Cursor outside of window GC savedGC; if (createGC) { // Save the previous graphic contex, create a temporary GC savedGC = m_GC; m_GC = XCreateGC(m_Display, m_Window, 0, 0); setFont(textFont); } if (cursorOn) setForeground(fgColor); else setForeground(bgColor); int x = leftMargin + (cx - windowX) * dx; int y = topMargin + (cy - windowY) * dy; fillRectangle(I2Rectangle(x, y, dx, ascent + descent)); if (cursorOn) setForeground(bgColor); else setForeground(fgColor); if (cy <= text.size()) { TextLine* line; if (cy == text.size()) { line = &(endOfText); } else { line = &(text.getLine(cy)); } if (cx < line->length()) { drawString(x, y + ascent, line->getString() + cx, 1); } } if (createGC) { // Release the temporary graphic contex, restore the previous GC XFreeGC(m_Display, m_GC); m_GC = savedGC; } }
void LineRenderer::draw_tokens( TextLine &line ) { char lc = 0; int last = 0; std::vector<SyntaxToken>::size_type i; SyntaxToken tk; if ( line.dirty() ) refresh_tokens( line ); SyntaxTokenList tklist = line.tokens(); if ( tklist.howmany == 0 ) { draw(line); return; } for ( i = 0 ; i < tklist.howmany ; i++ ) { tk = tklist.list[i]; if ( last != tk.begin ) lc = font->draw_sub( line.substr(last, tk.begin - last ), lc ); glColor4dv( token_colors[ tk.type ].data() ); lc = font->draw_sub( tk.token, lc ); last = tk.end; } }
TextFileIterator& TextFileIterator::operator ++() { TextLine *line = mFile->mLines[mLineIndex]; if (line->size() - 1 > mColumnIndex) { mColumnIndex++; } else { if (mFile->mLines.size() > mLineIndex) { bool needChangeLine = false; const char *lfBytes = line->getLineFeed(); int lfBytesLen = (int) sizeof(lfBytes) - 1; mLineFeedIndex++; if (mLineFeedIndex == lfBytesLen) { mLineFeedIndex = -1; needChangeLine = true; } if (needChangeLine) { mLineIndex++; mColumnIndex = 0; } } } return *this; }
void TextDisplay::Redraw (IntCoord l, IntCoord b, IntCoord r, IntCoord t) { if (canvas != nil) { int first = LineNumber(t); int last = LineNumber(b); for (int i = first; i <= last; ++i) { int begin = LineIndex(i, l, false); int end = LineIndex(i, r, false); TextLine* line = Line(i, false); if (line != nil) { line->Draw(this, i, begin, end); } else { IntCoord base = Base(i); IntCoord top = Top(i); painter->ClearRect( canvas, l, Math::max(base, b), r, Math::min(top, t) ); } if (caretline == i && caretindex >= begin && caretindex <= end) { ShowCaret(); } } } }
// ------------------------------------------------------ // StartWork // ------------------------------------------------------ bool UpgradeWork::start(Island* island, const TextLine& line) { int x = line.get_int(1); int y = line.get_int(2); Tiles* tiles = island->getTiles(); int idx = x + y * tiles->width; if ( tiles->getBuildingID(idx) == -1 ) { gContext->messages.report_error("There is no building at %d %d",x,y); return false; } // FIXME: check if there is only a regular work item if ( tiles->isActive(idx)) { gContext->messages.report_error("The building is active - upgrade is not available"); return false; } if (island->checkRequirements(tiles->getBuildingID(idx), tiles->getLevel(idx) + 1)) { tiles->set_state(x,y,TS_ACTIVE); island->createWork(PT_UPGRADE,x,y,tiles->getBuildingID(idx),tiles->getLevel(idx)+1); return true; } return false; }
Palette* MuseScore::newLinesPalette() { Palette* sp = new Palette; sp->setName(QT_TRANSLATE_NOOP("Palette", "Lines")); sp->setMag(.8); sp->setGrid(82, 35); sp->setDrawGrid(true); qreal w = gscore->spatium() * 8; Slur* slur = new Slur(gscore); slur->setId(0); sp->append(slur, qApp->translate("lines", "Slur")); Hairpin* gabel0 = new Hairpin(gscore); gabel0->setHairpinType(Hairpin::Type::CRESCENDO); gabel0->setLen(w); sp->append(gabel0, qApp->translate("lines", "Crescendo")); Hairpin* gabel1 = new Hairpin(gscore); gabel1->setHairpinType(Hairpin::Type::DECRESCENDO); gabel1->setLen(w); sp->append(gabel1, QT_TRANSLATE_NOOP("Palette", "Diminuendo")); Volta* volta = new Volta(gscore); volta->setVoltaType(Volta::Type::CLOSED); volta->setLen(w); volta->setText("1."); QList<int> il; il.append(1); volta->setEndings(il); sp->append(volta, QT_TRANSLATE_NOOP("Palette", "Prima volta")); volta = new Volta(gscore); volta->setVoltaType(Volta::Type::CLOSED); volta->setLen(w); volta->setText("2."); il.clear(); il.append(2); volta->setEndings(il); sp->append(volta, QT_TRANSLATE_NOOP("Palette", "Seconda volta")); volta = new Volta(gscore); volta->setVoltaType(Volta::Type::CLOSED); volta->setLen(w); volta->setText("3."); il.clear(); il.append(3); volta->setEndings(il); sp->append(volta, QT_TRANSLATE_NOOP("Palette", "Terza volta")); volta = new Volta(gscore); volta->setVoltaType(Volta::Type::OPEN); volta->setLen(w); volta->setText("2."); il.clear(); il.append(2); volta->setEndings(il); sp->append(volta, QT_TRANSLATE_NOOP("Palette", "Seconda volta 2")); Ottava* ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::Type::OTTAVA_8VA); ottava->setLen(w); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "8va")); ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::Type::OTTAVA_8VB); ottava->setLen(w); ottava->setPlacement(Element::Placement::BELOW); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "8vb")); ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::Type::OTTAVA_15MA); ottava->setLen(w); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "15ma")); ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::Type::OTTAVA_15MB); ottava->setLen(w); ottava->setPlacement(Element::Placement::BELOW); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "15mb")); ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::Type::OTTAVA_22MA); ottava->setLen(w); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "22ma")); ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::Type::OTTAVA_22MB); ottava->setLen(w); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "22mb")); Pedal* pedal = new Pedal(gscore); pedal->setLen(w); pedal->setBeginText("<sym>keyboardPedalPed</sym>"); sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal")); pedal->setEndHook(true); pedal = new Pedal(gscore); pedal->setLen(w); pedal->setBeginHook(true); pedal->setEndHook(true); sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal")); pedal = new Pedal(gscore); pedal->setLen(w); pedal->setBeginHook(true); pedal->setEndHook(true); pedal->setEndHookType(HookType::HOOK_45); sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal")); pedal = new Pedal(gscore); pedal->setLen(w); pedal->setBeginHook(true); pedal->setBeginHookType(HookType::HOOK_45); pedal->setEndHook(true); pedal->setEndHookType(HookType::HOOK_45); sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal")); pedal = new Pedal(gscore); pedal->setLen(w); pedal->setBeginHook(true); pedal->setBeginHookType(HookType::HOOK_45); pedal->setEndHook(true); sp->append(pedal, QT_TRANSLATE_NOOP("Palette", "Pedal")); Trill* trill = new Trill(gscore); trill->setLen(w); sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Trill line")); trill = new Trill(gscore); trill->setTrillType("upprall"); trill->setLen(w); sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Upprall line")); trill = new Trill(gscore); trill->setTrillType("downprall"); trill->setLen(w); sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Downprall line")); trill = new Trill(gscore); trill->setTrillType("prallprall"); trill->setLen(w); sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Prallprall line")); trill = new Trill(gscore); trill->setTrillType("pure"); trill->setLen(w); sp->append(trill, QT_TRANSLATE_NOOP("Palette", "Wavy line")); TextLine* textLine = new TextLine(gscore); textLine->setLen(w); textLine->setBeginText("VII"); textLine->setEndHook(true); sp->append(textLine, QT_TRANSLATE_NOOP("Palette", "Text line")); TextLine* line = new TextLine(gscore); line->setLen(w); line->setDiagonal(true); sp->append(line, QT_TRANSLATE_NOOP("Palette", "Line")); Ambitus* a = new Ambitus(gscore); sp->append(a, QT_TRANSLATE_NOOP("Palette", "Ambitus")); return sp; }
void LineRenderer::draw( TextLine &line ) { //easy! font->draw(line.str()); }
void CompactHistoryScroll::addCells ( const Character a[], int count ) { TextLine newLine ( count ); qCopy ( a,a+count,newLine.begin() ); addCellsVector ( newLine ); }
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); }
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 TextDisplay::HideCaret () { if (canvas != nil && caretline >= topline && caretline <= bottomline) { TextLine* l = Line(caretline, true); l->Draw(this, caretline, caretindex-1, caretindex); } }