Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateview.cpp
Show First 20 Lines • Show All 3638 Lines • ▼ Show 20 Line(s) | |||||
3639 | 3639 | | |||
3640 | void KTextEditor::ViewPrivate::printPreview() | 3640 | void KTextEditor::ViewPrivate::printPreview() | ||
3641 | { | 3641 | { | ||
3642 | KatePrinter::printPreview(this); | 3642 | KatePrinter::printPreview(this); | ||
3643 | } | 3643 | } | ||
3644 | 3644 | | |||
3645 | //END | 3645 | //END | ||
3646 | 3646 | | |||
3647 | //BEGIN KTextEditor::InlineNoteInterface | ||||
3648 | void KTextEditor::ViewPrivate::registerInlineNoteProvider(KTextEditor::InlineNoteProvider *provider) | ||||
3649 | { | ||||
3650 | if (! m_inlineNoteProviders.contains(provider)) { | ||||
3651 | m_inlineNoteProviders.append(provider); | ||||
3652 | | ||||
3653 | connect(provider, &KTextEditor::InlineNoteProvider::reset, this, &ViewPrivate::inlineNotesReset); | ||||
3654 | connect(provider, &KTextEditor::InlineNoteProvider::lineChanged, this, &ViewPrivate::inlineNotesLineChanged); | ||||
anthonyfieroni: Use new syntax connect | |||||
3655 | | ||||
3656 | inlineNotesReset(); | ||||
3657 | } | ||||
3658 | } | ||||
3659 | | ||||
3660 | void KTextEditor::ViewPrivate::unregisterInlineNoteProvider(KTextEditor::InlineNoteProvider *provider) | ||||
3661 | { | ||||
3662 | const int index = m_inlineNoteProviders.indexOf(provider); | ||||
3663 | if (index >= 0) { | ||||
3664 | m_inlineNoteProviders.removeAt(index); | ||||
3665 | | ||||
3666 | disconnect(provider, nullptr, this, nullptr); | ||||
anthonyfieroni: ```
provider->disconnect(this);
``` | |||||
3667 | | ||||
3668 | inlineNotesReset(); | ||||
3669 | } | ||||
3670 | } | ||||
3671 | | ||||
3672 | QVarLengthArray<KTextEditor::InlineNote, 8> KTextEditor::ViewPrivate::inlineNotes(int line) const | ||||
3673 | { | ||||
3674 | QVarLengthArray<KTextEditor::InlineNote, 8> allInlineNotes; | ||||
3675 | for (KTextEditor::InlineNoteProvider *provider: m_inlineNoteProviders) { | ||||
3676 | int index = 0; | ||||
3677 | for (auto column: provider->inlineNotes(line)) { | ||||
3678 | KTextEditor::InlineNote note = { | ||||
3679 | provider, | ||||
3680 | {line, column}, | ||||
3681 | index | ||||
3682 | }; | ||||
3683 | auto activeNote = m_viewInternal->m_activeInlineNote; | ||||
3684 | if ( note == activeNote ) { | ||||
3685 | note.activeState = activeNote.activeState; | ||||
3686 | } | ||||
3687 | allInlineNotes.append(note); | ||||
3688 | index++; | ||||
3689 | } | ||||
3690 | } | ||||
3691 | return allInlineNotes; | ||||
3692 | } | ||||
3693 | | ||||
3694 | void KTextEditor::ViewPrivate::inlineNotesReset() | ||||
3695 | { | ||||
3696 | m_viewInternal->m_activeInlineNote = {}; | ||||
3697 | repaintText(false); | ||||
3698 | } | ||||
3699 | | ||||
3700 | void KTextEditor::ViewPrivate::inlineNotesLineChanged(int line) | ||||
3701 | { | ||||
3702 | if ( line == m_viewInternal->m_activeInlineNote.location.line() ) { | ||||
3703 | m_viewInternal->m_activeInlineNote = {}; | ||||
3704 | } | ||||
3705 | tagLines(line, line); | ||||
3706 | repaintText(true); | ||||
3707 | } | ||||
3708 | | ||||
3709 | //END KTextEditor::InlineNoteInterface | ||||
3710 | | ||||
3647 | KTextEditor::Attribute::Ptr KTextEditor::ViewPrivate::defaultStyleAttribute(KTextEditor::DefaultStyle defaultStyle) const | 3711 | KTextEditor::Attribute::Ptr KTextEditor::ViewPrivate::defaultStyleAttribute(KTextEditor::DefaultStyle defaultStyle) const | ||
3648 | { | 3712 | { | ||
3649 | KateRendererConfig * renderConfig = const_cast<KTextEditor::ViewPrivate*>(this)->renderer()->config(); | 3713 | KateRendererConfig * renderConfig = const_cast<KTextEditor::ViewPrivate*>(this)->renderer()->config(); | ||
3650 | 3714 | | |||
3651 | KTextEditor::Attribute::Ptr style = m_doc->highlight()->attributes(renderConfig->schema()).at(defaultStyle); | 3715 | KTextEditor::Attribute::Ptr style = m_doc->highlight()->attributes(renderConfig->schema()).at(defaultStyle); | ||
3652 | if (!style->hasProperty(QTextFormat::BackgroundBrush)) { | 3716 | if (!style->hasProperty(QTextFormat::BackgroundBrush)) { | ||
3653 | // make sure the returned style has the default background color set | 3717 | // make sure the returned style has the default background color set | ||
3654 | style = new KTextEditor::Attribute(*style); | 3718 | style = new KTextEditor::Attribute(*style); | ||
Show All 30 Lines |
Use new syntax connect