| 1 | #cxx . . $ `<file>/HercConfiguration/ConfigurationFreeEditor.cpp`/include "ConfigurationFreeEditor.h"cxx . . $ `<file>/HercConfiguration/ConfigurationFreeEditor.h`/ |
| 2 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 3 | |
| 4 | #include <QtGui> |
| 5 | |
| 6 | ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#ConfigurationFreeEditor(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) : |
| 7 | QPlainTextEditcxx . . $ QPlainTextEdit#(parent) |
| 8 | { |
| 9 | mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea. = new LineNumberAreacxx . . $ LineNumberArea#(this); |
| 10 | |
| 11 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(blockCountChanged(int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(updateLineNumberAreaWidth(int))); |
| 12 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(updateRequest(QRect,int)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(updateLineNumberArea(QRect,int))); |
| 13 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(cursorPositionChanged()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(highlightCurrentLine())); |
| 14 | |
| 15 | updateLineNumberAreaWidthcxx . . $ ConfigurationFreeEditor#updateLineNumberAreaWidth(d4f767463ce0a6b3).(0); |
| 16 | highlightCurrentLinecxx . . $ ConfigurationFreeEditor#highlightCurrentLine(49f6e7a06ebc5aa8).(); |
| 17 | } |
| 18 | |
| 19 | int ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::lineNumberAreaWidthcxx . . $ ConfigurationFreeEditor#lineNumberAreaWidth(b126dc7c1de90089).() |
| 20 | { |
| 21 | int digits = 1; |
| 22 | int max = qMaxcxx . . $ qMax(2a338fce5842aa6a).(1, blockCountcxx . . $ QPlainTextEdit#blockCount(455f465bc33b4cdf).()); |
| 23 | while (max >= 10) { |
| 24 | max /= 10; |
| 25 | ++digits; |
| 26 | } |
| 27 | |
| 28 | int space = 3 + fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).().widthcxx . . $ QFontMetrics#width(cb11a8ddef27242a).(QLatin1Charcxx . . $ QChar#QChar(3c55a7a0aea1b63a).('9')) * digits; |
| 29 | |
| 30 | return space; |
| 31 | } |
| 32 | |
| 33 | void ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::updateLineNumberAreaWidthcxx . . $ ConfigurationFreeEditor#updateLineNumberAreaWidth(d4f767463ce0a6b3).(int /* newBlockCount */) |
| 34 | { |
| 35 | setViewportMarginscxx . . $ QAbstractScrollArea#setViewportMargins(748afa4755bc9595).(lineNumberAreaWidthcxx . . $ ConfigurationFreeEditor#lineNumberAreaWidth(b126dc7c1de90089).(), 0, 0, 0); |
| 36 | } |
| 37 | |
| 38 | |
| 39 | |
| 40 | void ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::updateLineNumberAreacxx . . $ ConfigurationFreeEditor#updateLineNumberArea(6958f325edff4c53).(const QRectcxx . . $ QRect# &rect, int dy) |
| 41 | { |
| 42 | if (dy) |
| 43 | mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea.->scrollcxx . . $ QWidget#scroll(3e454b8ccf442868).(0, dy); |
| 44 | else |
| 45 | mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea.->updatecxx . . $ QWidget#update(748afa4755bc9595).(0, rect.ycxx . . $ QRect#y(455f465bc33b4cdf).(), mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea.->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), rect.heightcxx . . $ QRect#height(455f465bc33b4cdf).()); |
| 46 | |
| 47 | if (rect.containscxx . . $ QRect#contains(5bf0d0fc1552ade2).(viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->rectcxx . . $ QWidget#rect(d857385bac04cbf7).())) |
| 48 | updateLineNumberAreaWidthcxx . . $ ConfigurationFreeEditor#updateLineNumberAreaWidth(d4f767463ce0a6b3).(0); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | |
| 53 | void ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::resizeEventcxx . . $ ConfigurationFreeEditor#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent# *e) |
| 54 | { |
| 55 | QPlainTextEditcxx . . $ QPlainTextEdit#::resizeEventcxx . . $ QPlainTextEdit#resizeEvent(eeeec21cf8dc0387).(e); |
| 56 | |
| 57 | QRectcxx . . $ QRect# cr = contentsRectcxx . . $ QWidget#contentsRect(d857385bac04cbf7).(); |
| 58 | mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea.->setGeometrycxx . . $ QWidget#setGeometry(22ba0428947158b).(QRectcxx . . $ QRect#QRect(748afa4755bc9595).(cr.leftcxx . . $ QRect#left(455f465bc33b4cdf).(), cr.topcxx . . $ QRect#top(455f465bc33b4cdf).(), lineNumberAreaWidthcxx . . $ ConfigurationFreeEditor#lineNumberAreaWidth(b126dc7c1de90089).(), cr.heightcxx . . $ QRect#height(455f465bc33b4cdf).())); |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |
| 63 | void ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::highlightCurrentLinecxx . . $ ConfigurationFreeEditor#highlightCurrentLine(49f6e7a06ebc5aa8).() |
| 64 | { |
| 65 | QListcxx . . $ QList#<QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection#> extraSelectionscxx . . $ QList#QList(49f6e7a06ebc5aa8).; |
| 66 | |
| 67 | if (!isReadOnlycxx . . $ QPlainTextEdit#isReadOnly(50ce9a9e25b4a850).()) |
| 68 | { |
| 69 | QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection# selection; |
| 70 | |
| 71 | QColorcxx . . $ QColor# lineColor = QColorcxx . . $ QColor#QColor(c2a45ff37f9550ed).(Qtcxx . . $ Qt/::yellowcxx . . $ Qt/yellow.).lightercxx . . $ QColor#lighter(579fadac8368efbd).(170); |
| 72 | |
| 73 | selection.formatcxx . . $ QTextEdit#ExtraSelection#format..setBackgroundcxx . . $ QTextFormat#setBackground(ffc9f5d0bda78261).(lineColorcxx . . $ QBrush#QBrush(b50947b0752ea6ac).); |
| 74 | selection.formatcxx . . $ QTextEdit#ExtraSelection#format..setPropertycxx . . $ QTextFormat#setProperty(e71f85060bf8a055).(QTextFormatcxx . . $ QTextFormat#::FullWidthSelectioncxx . . $ QTextFormat#FullWidthSelection., truecxx . . $ QVariant#QVariant(b45ddcbc8423892c).); |
| 75 | selection.cursorcxx . . $ QTextEdit#ExtraSelection#cursor. =cxx . . $ QTextCursor#`operator=`(ea0024a71e5897e6). textCursorcxx . . $ QPlainTextEdit#textCursor(878247cba2fd3c00).(); |
| 76 | selection.cursorcxx . . $ QTextEdit#ExtraSelection#cursor..clearSelectioncxx . . $ QTextCursor#clearSelection(49f6e7a06ebc5aa8).(); |
| 77 | extraSelections.appendcxx . . $ QList#append(77d9f17553126ecb).(selection); |
| 78 | } |
| 79 | |
| 80 | setExtraSelectionscxx . . $ QPlainTextEdit#setExtraSelections(f699d81df9da7ae6).(extraSelections); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | |
| 85 | void ConfigurationFreeEditorcxx . . $ ConfigurationFreeEditor#::lineNumberAreaPaintEventcxx . . $ ConfigurationFreeEditor#lineNumberAreaPaintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *event) |
| 86 | { |
| 87 | QPaintercxx . . $ QPainter# paintercxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea.); |
| 88 | painter.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(event->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).(), Qtcxx . . $ Qt/::graycxx . . $ Qt/gray.); |
| 89 | |
| 90 | |
| 91 | QTextBlockcxx . . $ QTextBlock# block = firstVisibleBlockcxx . . $ QTextBlock#QTextBlock(ca9d602f58d4ee04).(); |
| 92 | int blockNumber = block.blockNumbercxx . . $ QTextBlock#blockNumber(455f465bc33b4cdf).(); |
| 93 | int top = (int) blockBoundingGeometrycxx . . $ QPlainTextEdit#blockBoundingGeometry(b25b5125f533bbfc).(block).translatedcxx . . $ QRectF#translated(a6d1c92b1040154a).(contentOffsetcxx . . $ QPlainTextEdit#contentOffset(a5b3784bf6777acb).()).topcxx . . $ QRectF#top(21b6c25e127938e2).(); |
| 94 | int bottom = top + (int) blockBoundingRectcxx . . $ QPlainTextEdit#blockBoundingRect(b25b5125f533bbfc).(block).heightcxx . . $ QRectF#height(21b6c25e127938e2).(); |
| 95 | |
| 96 | while (block.isValidcxx . . $ QTextBlock#isValid(50ce9a9e25b4a850).() && top <= event->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).().bottomcxx . . $ QRect#bottom(455f465bc33b4cdf).()) |
| 97 | { |
| 98 | if (block.isVisiblecxx . . $ QTextBlock#isVisible(50ce9a9e25b4a850).() && bottom >= event->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).().topcxx . . $ QRect#top(455f465bc33b4cdf).()) |
| 99 | { |
| 100 | QStringcxx . . $ QString# number = QStringcxx . . $ QString#QString(e1217c004a86c950).::numbercxx . . $ QString#number(f4fd9db251ca774b).(blockNumber + 1); |
| 101 | painter.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(Qtcxx . . $ QColor#QColor(cd98eb3c6d110ca7).::blackcxx . . $ Qt/black.); |
| 102 | painter.drawTextcxx . . $ QPainter#drawText(26e93c81cbf08633).(0, top, mLineNumberAreacxx . . $ ConfigurationFreeEditor#mLineNumberArea.->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).().heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).(), |
| 103 | Qtcxx . . $ Qt/::AlignRightcxx . . $ Qt/AlignRight., number); |
| 104 | } |
| 105 | |
| 106 | block =cxx . . $ QTextBlock#`operator=`(b837fc91fbe92fa9). block.nextcxx . . $ QTextBlock#next(fcb2c37f271a2a41).(); |
| 107 | top = bottom; |
| 108 | bottom = top + (int) blockBoundingRectcxx . . $ QPlainTextEdit#blockBoundingRect(b25b5125f533bbfc).(block).heightcxx . . $ QRectF#height(21b6c25e127938e2).(); |
| 109 | ++blockNumber; |
| 110 | } |
| 111 | } |