| 74 | } |
| 75 | |
| 76 | BufferFormatSpecifier::BufferFormatSpecifier(QWidget *parent) |
| 77 | : QWidget(parent), ui(new Ui::BufferFormatSpecifier) |
| 78 | { |
| 79 | ui->setupUi(this); |
| 80 | |
| 81 | formatText = new ScintillaEdit(this); |
| 82 | |
| 83 | formatText->styleSetFont(STYLE_DEFAULT, Formatter::FixedFont().family().toUtf8().data()); |
| 84 | formatText->styleSetSize(STYLE_DEFAULT, Formatter::FixedFont().pointSize()); |
| 85 | |
| 86 | formatText->styleSetFont(ERROR_STYLE, Formatter::FixedFont().family().toUtf8().data()); |
| 87 | formatText->styleSetSize(ERROR_STYLE, Formatter::FixedFont().pointSize()); |
| 88 | |
| 89 | QColor base = formatText->palette().color(QPalette::Base); |
| 90 | |
| 91 | QColor backCol = QColor::fromHslF(0.0f, 1.0f, qBound(0.1, base.lightnessF(), 0.9)); |
| 92 | QColor foreCol = contrastingColor(backCol, QColor(0, 0, 0)); |
| 93 | |
| 94 | formatText->styleSetBack(ERROR_STYLE, |
| 95 | SCINTILLA_COLOUR(backCol.red(), backCol.green(), backCol.blue())); |
| 96 | formatText->styleSetFore(ERROR_STYLE, |
| 97 | SCINTILLA_COLOUR(foreCol.red(), foreCol.green(), foreCol.blue())); |
| 98 | |
| 99 | ConfigureSyntax(formatText, SCLEX_BUFFER); |
| 100 | |
| 101 | formatText->setTabWidth(4); |
| 102 | |
| 103 | formatText->setScrollWidth(1); |
| 104 | formatText->setScrollWidthTracking(true); |
| 105 | |
| 106 | formatText->annotationSetVisible(ANNOTATION_BOXED); |
| 107 | |
| 108 | formatText->colourise(0, -1); |
| 109 | |
| 110 | formatText->setMarginWidthN(0, 0); |
| 111 | formatText->setMarginWidthN(1, 0); |
| 112 | formatText->setMarginWidthN(2, 0); |
| 113 | |
| 114 | QFrame *formatContainer = new QFrame(this); |
| 115 | { |
| 116 | QVBoxLayout *layout = new QVBoxLayout; |
| 117 | layout->setContentsMargins(2, 2, 2, 2); |
| 118 | layout->addWidget(formatText); |
| 119 | |
| 120 | formatContainer->setLayout(layout); |
| 121 | } |
| 122 | |
| 123 | QPalette pal = formatContainer->palette(); |
| 124 | pal.setColor(QPalette::Window, pal.color(QPalette::Base)); |
| 125 | formatContainer->setPalette(pal); |
| 126 | formatContainer->setAutoFillBackground(true); |
| 127 | |
| 128 | formatContainer->setFrameShape(QFrame::Panel); |
| 129 | formatContainer->setFrameShadow(QFrame::Plain); |
| 130 | |
| 131 | QObject::connect(formatText, &ScintillaEdit::modified, |
| 132 | [this](int type, int, int, int, const QByteArray &, int, int, int) { |
| 133 | ui->savedList->clearSelection(); |
nothing calls this directly
no test coverage detected