| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2018 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtSCriptTools module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qscriptedit_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptedit_p.h`/ |
| 41 | #include "qscriptsyntaxhighlighter_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptsyntaxhighlighter_p.h`/ |
| 42 | |
| 43 | #include <QtGui/qpainter.h> |
| 44 | #include <QtGui/qicon.h> |
| 45 | #include <QtWidgets/qboxlayout.h> |
| 46 | #include <QtWidgets/qlabel.h> |
| 47 | #include <QtWidgets/qlineedit.h> |
| 48 | #include <QtWidgets/qmenu.h> |
| 49 | #include <QtWidgets/qaction.h> |
| 50 | #include <QtWidgets/qwidgetaction.h> |
| 51 | #include <QtCore/qdebug.h> |
| 52 | |
| 53 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`! |
| 54 | |
| 55 | class QScriptEditExtraAreacxx . . $ QScriptEditExtraArea# : public QWidgetcxx . . $ QWidget# |
| 56 | { |
| 57 | public: |
| 58 | QScriptEditExtraAreacxx . . $ QScriptEditExtraArea#QScriptEditExtraArea(9be9f44e14ed5b23).(QScriptEditcxx . . $ QScriptEdit# *edit) |
| 59 | : QWidgetcxx . . $ QWidget#(edit) |
| 60 | { |
| 61 | setMouseTrackingcxx . . $ QWidget#setMouseTracking(b45ddcbc8423892c).(true); |
| 62 | } |
| 63 | |
| 64 | QSizecxx . . $ QSize# sizeHintcxx . . $ QScriptEditExtraArea#sizeHint(4b3b776e5ee2b367).() const { |
| 65 | return QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).()->extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).(), 0); |
| 66 | } |
| 67 | |
| 68 | protected: |
| 69 | void paintEventcxx . . $ QScriptEditExtraArea#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *event) |
| 70 | { |
| 71 | editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).()->extraAreaPaintEventcxx . . $ QScriptEdit#extraAreaPaintEvent(f239c9e85d61a220).(event); |
| 72 | } |
| 73 | void mousePressEventcxx . . $ QScriptEditExtraArea#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *event) |
| 74 | { |
| 75 | editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).()->extraAreaMouseEventcxx . . $ QScriptEdit#extraAreaMouseEvent(702858a82d06265c).(event); |
| 76 | } |
| 77 | void mouseMoveEventcxx . . $ QScriptEditExtraArea#mouseMoveEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *event) |
| 78 | { |
| 79 | editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).()->extraAreaMouseEventcxx . . $ QScriptEdit#extraAreaMouseEvent(702858a82d06265c).(event); |
| 80 | } |
| 81 | void mouseReleaseEventcxx . . $ QScriptEditExtraArea#mouseReleaseEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *event) |
| 82 | { |
| 83 | editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).()->extraAreaMouseEventcxx . . $ QScriptEdit#extraAreaMouseEvent(702858a82d06265c).(event); |
| 84 | } |
| 85 | bool eventcxx . . $ QScriptEditExtraArea#event(f123fa2ce489f0bd).(QEventcxx . . $ QEvent# *event) |
| 86 | { |
| 87 | if (editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).()->extraAreaEventcxx . . $ QScriptEdit#extraAreaEvent(f123fa2ce489f0bd).(event)) |
| 88 | return true; |
| 89 | return QWidgetcxx . . $ QWidget#::eventcxx . . $ QWidget#event(f123fa2ce489f0bd).(event); |
| 90 | } |
| 91 | |
| 92 | private: |
| 93 | QScriptEditcxx . . $ QScriptEdit# *editorcxx . . $ QScriptEditExtraArea#editor(f35780279541dff1).() const |
| 94 | { |
| 95 | return qobject_castcxx . . $ qobject_cast(529b296f76edd7b).<QScriptEditcxx . . $ QScriptEdit#*>(parentcxx . . $ QObject#parent(2dbb680a34285c44).()); |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | |
| 100 | |
| 101 | QScriptEditcxx . . $ QScriptEdit#::QScriptEditcxx . . $ QScriptEdit#QScriptEdit(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) |
| 102 | : QPlainTextEditcxx . . $ QPlainTextEdit#(parent) |
| 103 | { |
| 104 | m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber. = 1; |
| 105 | m_executionLineNumbercxx . . $ QScriptEdit#m_executionLineNumber. = -1; |
| 106 | |
| 107 | m_extraAreacxx . . $ QScriptEdit#m_extraArea. = new QScriptEditExtraAreacxx . . $ QScriptEditExtraArea#QScriptEditExtraArea(9be9f44e14ed5b23).(this); |
| 108 | |
| 109 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(835f87066c895669).(this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(blockCountChanged(int)), |
| 110 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(updateExtraAreaWidth())); |
| 111 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(835f87066c895669).(this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(updateRequest(QRect,int)), |
| 112 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(updateExtraArea(QRect,int))); |
| 113 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(835f87066c895669).(this, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(cursorPositionChanged()), |
| 114 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(highlightCurrentLine())); |
| 115 | |
| 116 | updateExtraAreaWidthcxx . . $ QScriptEdit#updateExtraAreaWidth(49f6e7a06ebc5aa8).(); |
| 117 | |
| 118 | #ifndef QT_NO_SYNTAXHIGHLIGHTER |
| 119 | (void) new QScriptSyntaxHighlightercxx . . $ QScriptSyntaxHighlighter#(documentcxx . . $ QPlainTextEdit#document(f21741221844491e).()); |
| 120 | #endif |
| 121 | } |
| 122 | |
| 123 | QScriptEditcxx . . $ QScriptEdit#::~cxx . . $ QScriptEdit#`~QScriptEdit`(ced63f7c635d850d).QScriptEditcxx . . $ QScriptEdit#() |
| 124 | { |
| 125 | } |
| 126 | |
| 127 | int QScriptEditcxx . . $ QScriptEdit#::baseLineNumbercxx . . $ QScriptEdit#baseLineNumber(455f465bc33b4cdf).() const |
| 128 | { |
| 129 | return m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 130 | } |
| 131 | |
| 132 | void QScriptEditcxx . . $ QScriptEdit#::setBaseLineNumbercxx . . $ QScriptEdit#setBaseLineNumber(d4f767463ce0a6b3).(int base) |
| 133 | { |
| 134 | m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber. = base; |
| 135 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 136 | } |
| 137 | |
| 138 | int QScriptEditcxx . . $ QScriptEdit#::executionLineNumbercxx . . $ QScriptEdit#executionLineNumber(455f465bc33b4cdf).() const |
| 139 | { |
| 140 | return m_executionLineNumbercxx . . $ QScriptEdit#m_executionLineNumber.; |
| 141 | } |
| 142 | |
| 143 | void QScriptEditcxx . . $ QScriptEdit#::setExecutionLineNumbercxx . . $ QScriptEdit#setExecutionLineNumber(918ebd27a9ddbad3).(int lineNumber, bool error) |
| 144 | { |
| 145 | m_executionLineNumbercxx . . $ QScriptEdit#m_executionLineNumber. = lineNumber; |
| 146 | m_executionLineNumberHasErrorcxx . . $ QScriptEdit#m_executionLineNumberHasError. = error; |
| 147 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 148 | updateExtraSelectionscxx . . $ QScriptEdit#updateExtraSelections(49f6e7a06ebc5aa8).(); |
| 149 | gotoLinecxx . . $ QScriptEdit#gotoLine(d4f767463ce0a6b3).(lineNumber); |
| 150 | } |
| 151 | |
| 152 | void QScriptEditcxx . . $ QScriptEdit#::setExecutableLineNumberscxx . . $ QScriptEdit#setExecutableLineNumbers(5f64d7721fa801f3).(const QSetcxx . . $ QSet#<int> &lineNumbers) |
| 153 | { |
| 154 | m_executableLineNumbers = lineNumbers; |
| 155 | } |
| 156 | |
| 157 | bool QScriptEditcxx . . $ QScriptEdit#::isExecutableLinecxx . . $ QScriptEdit#isExecutableLine(4a668f6de69bf818).(int lineNumber) const |
| 158 | { |
| 159 | #if 0 // ### enable me once we have information about the script again |
| 160 | return m_executableLineNumbers.contains(lineNumber); |
| 161 | #else |
| 162 | Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(lineNumber); |
| 163 | return true; |
| 164 | #endif |
| 165 | } |
| 166 | |
| 167 | int QScriptEditcxx . . $ QScriptEdit#::currentLineNumbercxx . . $ QScriptEdit#currentLineNumber(455f465bc33b4cdf).() const |
| 168 | { |
| 169 | return textCursorcxx . . $ QPlainTextEdit#textCursor(878247cba2fd3c00).().blockNumber() +cxx . . $ operator+(68a6fbfab4d187bc). m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 170 | } |
| 171 | |
| 172 | void QScriptEditcxx . . $ QScriptEdit#::gotoLinecxx . . $ QScriptEdit#gotoLine(d4f767463ce0a6b3).(int lineNumber) |
| 173 | { |
| 174 | #ifndef QT_NO_SYNTAXHIGHLIGHTER |
| 175 | int blockNumber = lineNumber - m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 176 | const QTextBlockcxx . . $ QTextBlock# &block = documentcxx . . $ QPlainTextEdit#document(f21741221844491e).()->findBlockByNumber(blockNumber); |
| 177 | if (block.isValidcxx . . $ QTextBlock#isValid(50ce9a9e25b4a850).()) { |
| 178 | setTextCursorcxx . . $ QPlainTextEdit#setTextCursor(a408cee6726ac3d5).(QTextCursorcxx . . $ QTextCursor#(block)); |
| 179 | centerCursorcxx . . $ QPlainTextEdit#centerCursor(49f6e7a06ebc5aa8).(); |
| 180 | } |
| 181 | #else |
| 182 | Q_UNUSED(lineNumber); |
| 183 | #endif |
| 184 | } |
| 185 | |
| 186 | void QScriptEditcxx . . $ QScriptEdit#::setBreakpointcxx . . $ QScriptEdit#setBreakpoint(d4f767463ce0a6b3).(int lineNumber) |
| 187 | { |
| 188 | m_breakpoints[lineNumber] = BreakpointData(); |
| 189 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 190 | } |
| 191 | |
| 192 | void QScriptEditcxx . . $ QScriptEdit#::setBreakpointEnabledcxx . . $ QScriptEdit#setBreakpointEnabled(918ebd27a9ddbad3).(int lineNumber, bool enable) |
| 193 | { |
| 194 | m_breakpoints[lineNumber].enabled = enable; |
| 195 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 196 | } |
| 197 | |
| 198 | void QScriptEditcxx . . $ QScriptEdit#::deleteBreakpointcxx . . $ QScriptEdit#deleteBreakpoint(d4f767463ce0a6b3).(int lineNumber) |
| 199 | { |
| 200 | m_breakpoints.remove(lineNumber); |
| 201 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 202 | } |
| 203 | |
| 204 | void QScriptEditcxx . . $ QScriptEdit#::paintEventcxx . . $ QScriptEdit#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *e) |
| 205 | { |
| 206 | QPlainTextEditcxx . . $ QPlainTextEdit#::paintEventcxx . . $ QPlainTextEdit#paintEvent(f239c9e85d61a220).(e); |
| 207 | } |
| 208 | |
| 209 | void QScriptEditcxx . . $ QScriptEdit#::resizeEventcxx . . $ QScriptEdit#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent# *e) |
| 210 | { |
| 211 | QPlainTextEditcxx . . $ QPlainTextEdit#::resizeEventcxx . . $ QPlainTextEdit#resizeEvent(eeeec21cf8dc0387).(e); |
| 212 | |
| 213 | QRectcxx . . $ QRect# cr = contentsRectcxx . . $ QWidget#contentsRect(d857385bac04cbf7).(); |
| 214 | int x = isLeftToRightcxx . . $ QWidget#isLeftToRight(50ce9a9e25b4a850).() ? cr.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() : cr.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() + cr.widthcxx . . $ QRect#width(ea6fe5115c70a13f).() - extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).(); |
| 215 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->setGeometrycxx . . $ QWidget#setGeometry(22ba0428947158b).(QRectcxx . . $ QRect#QRect(2261ffe5112eab06).(x, cr.topcxx . . $ QRect#top(ea6fe5115c70a13f).(), extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).(), cr.heightcxx . . $ QRect#height(ea6fe5115c70a13f).())); |
| 216 | } |
| 217 | |
| 218 | void QScriptEditcxx . . $ QScriptEdit#::updateExtraAreaWidthcxx . . $ QScriptEdit#updateExtraAreaWidth(49f6e7a06ebc5aa8).() |
| 219 | { |
| 220 | if (isLeftToRightcxx . . $ QWidget#isLeftToRight(50ce9a9e25b4a850).()) |
| 221 | setViewportMarginscxx . . $ QAbstractScrollArea#setViewportMargins(748afa4755bc9595).(extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).(), 0, 0, 0); |
| 222 | else |
| 223 | setViewportMarginscxx . . $ QAbstractScrollArea#setViewportMargins(748afa4755bc9595).(0, 0, extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).(), 0); |
| 224 | } |
| 225 | |
| 226 | void QScriptEditcxx . . $ QScriptEdit#::updateExtraAreacxx . . $ QScriptEdit#updateExtraArea(6958f325edff4c53).(const QRectcxx . . $ QRect# &rect, int dy) |
| 227 | { |
| 228 | if (dy) |
| 229 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->scrollcxx . . $ QWidget#scroll(f63dc8e7f68f6401).(0, dy); |
| 230 | else |
| 231 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(0, rect.ycxx . . $ QRect#y(ea6fe5115c70a13f).(), m_extraAreacxx . . $ QScriptEdit#m_extraArea.->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()); |
| 232 | |
| 233 | if (rect.containscxx . . $ QRect#contains(76cafc3544a3afad).(viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->rect())) |
| 234 | updateExtraAreaWidthcxx . . $ QScriptEdit#updateExtraAreaWidth(49f6e7a06ebc5aa8).(); |
| 235 | } |
| 236 | |
| 237 | void QScriptEditcxx . . $ QScriptEdit#::highlightCurrentLinecxx . . $ QScriptEdit#highlightCurrentLine(49f6e7a06ebc5aa8).() |
| 238 | { |
| 239 | updateExtraSelectionscxx . . $ QScriptEdit#updateExtraSelections(49f6e7a06ebc5aa8).(); |
| 240 | } |
| 241 | |
| 242 | void QScriptEditcxx . . $ QScriptEdit#::updateExtraSelectionscxx . . $ QScriptEdit#updateExtraSelections(49f6e7a06ebc5aa8).() |
| 243 | { |
| 244 | QListcxx . . $ QList#<QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection#> extraSelections; |
| 245 | |
| 246 | { |
| 247 | QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection# selection; |
| 248 | QColorcxx . . $ QColor# lineColor = QColorcxx . . $ QColor#QColor(408ec4d5924bfb00).(Qtcxx . . $ Qt/::yellowcxx . . $ Qt/yellow.).lightercxx . . $ QColor#lighter(a312dab4e0811e0).(160); |
| 249 | selection.format.setBackground(lineColor); |
| 250 | selection.format.setProperty(QTextFormatcxx . . $ QTextFormat#::FullWidthSelectioncxx . . $ QTextFormat#FullWidthSelection., true); |
| 251 | selection.cursor = textCursorcxx . . $ QPlainTextEdit#textCursor(878247cba2fd3c00).(); |
| 252 | selection.cursor.clearSelection(); |
| 253 | extraSelections.append(selection); |
| 254 | } |
| 255 | if (m_executionLineNumbercxx . . $ QScriptEdit#m_executionLineNumber. != -1) { |
| 256 | QTextEditcxx . . $ QTextEdit#::ExtraSelectioncxx . . $ QTextEdit#ExtraSelection# selection; |
| 257 | QColorcxx . . $ QColor# lineColorcxx . . $ QColor#QColor(ced63f7c635d850d).; |
| 258 | if (m_executionLineNumberHasErrorcxx . . $ QScriptEdit#m_executionLineNumberHasError.) |
| 259 | lineColor =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(408ec4d5924bfb00).(Qtcxx . . $ Qt/::redcxx . . $ Qt/red.); |
| 260 | else |
| 261 | lineColor =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). QColorcxx . . $ QColor#QColor(408ec4d5924bfb00).(Qtcxx . . $ Qt/::greencxx . . $ Qt/green.).lightercxx . . $ QColor#lighter(a312dab4e0811e0).(160); |
| 262 | selection.format.setBackground(lineColor); |
| 263 | selection.format.setProperty(QTextFormatcxx . . $ QTextFormat#::FullWidthSelectioncxx . . $ QTextFormat#FullWidthSelection., true); |
| 264 | #ifndef QT_NO_SYNTAXHIGHLIGHTER |
| 265 | int blockNumber = m_executionLineNumbercxx . . $ QScriptEdit#m_executionLineNumber. - m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 266 | selection.cursor = QTextCursorcxx . . $ QTextCursor#(documentcxx . . $ QPlainTextEdit#document(f21741221844491e).()->findBlockByNumber(blockNumber)); |
| 267 | #endif |
| 268 | selection.cursor.clearSelection(); |
| 269 | extraSelections.append(selection); |
| 270 | } |
| 271 | |
| 272 | setExtraSelectionscxx . . $ QPlainTextEdit#setExtraSelections(f699d81df9da7ae6).(extraSelections); |
| 273 | } |
| 274 | |
| 275 | int QScriptEditcxx . . $ QScriptEdit#::extraAreaWidthcxx . . $ QScriptEdit#extraAreaWidth(455f465bc33b4cdf).() const |
| 276 | { |
| 277 | int space = 0; |
| 278 | const QFontMetricscxx . . $ QFontMetrics# fm(fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).()); |
| 279 | |
| 280 | int digits = 1; |
| 281 | int max = qMaxcxx . . $ qMax(2a338fce5842aa6a).(1, blockCountcxx . . $ QPlainTextEdit#blockCount(455f465bc33b4cdf).() +cxx . . $ operator+(68a6fbfab4d187bc). m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.); |
| 282 | while (max >= 10) { |
| 283 | max /= 10; |
| 284 | ++digits; |
| 285 | } |
| 286 | space += fm.horizontalAdvancecxx . . $ QFontMetrics#horizontalAdvance(cb11a8ddef27242a).(QLatin1Charcxx . . $ QChar#QChar(a50889c09eec06d9).('9')) * digits; |
| 287 | |
| 288 | int markWidth = fm.lineSpacingcxx . . $ QFontMetrics#lineSpacing(455f465bc33b4cdf).(); |
| 289 | space += markWidth; |
| 290 | |
| 291 | space += 4; |
| 292 | |
| 293 | return space; |
| 294 | } |
| 295 | |
| 296 | void QScriptEditcxx . . $ QScriptEdit#::extraAreaPaintEventcxx . . $ QScriptEdit#extraAreaPaintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *e) |
| 297 | { |
| 298 | QRectcxx . . $ QRect# rect = e->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).(); |
| 299 | QPalettecxx . . $ QPalette# pal = palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).(); |
| 300 | pal.setCurrentColorGroupcxx . . $ QPalette#setCurrentColorGroup(42e8b9564ceed78b).(QPalettecxx . . $ QPalette#::Activecxx . . $ QPalette#Active.); |
| 301 | QPaintercxx . . $ QPainter# painter(m_extraAreacxx . . $ QScriptEdit#m_extraArea.); |
| 302 | painter.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(rect, Qtcxx . . $ Qt/::lightGraycxx . . $ Qt/lightGray.); |
| 303 | const QFontMetricscxx . . $ QFontMetrics# fm(fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).()); |
| 304 | |
| 305 | int markWidth = fm.lineSpacingcxx . . $ QFontMetrics#lineSpacing(455f465bc33b4cdf).(); |
| 306 | int extraAreaWidth = m_extraAreacxx . . $ QScriptEdit#m_extraArea.->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(); |
| 307 | |
| 308 | QLinearGradientcxx . . $ QLinearGradient# gradientcxx . . $ QLinearGradient#QLinearGradient(3628e2b324c1bb0).(QPointFcxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(extraAreaWidth - 10, 0), QPointFcxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(extraAreaWidth, 0)); |
| 309 | gradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0, pal.colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Windowcxx . . $ QPalette#Window.)); |
| 310 | gradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(1, pal.colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Basecxx . . $ QPalette#Base.)); |
| 311 | painter.fillRectcxx . . $ QPainter#fillRect(41bf02b42490ec39).(rect, gradient); |
| 312 | |
| 313 | QLinearGradientcxx . . $ QLinearGradient# gradient2cxx . . $ QLinearGradient#QLinearGradient(3628e2b324c1bb0).(QPointFcxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(0, 0), QPointFcxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(markWidth, 0)); |
| 314 | gradient2.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0, pal.colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Darkcxx . . $ QPalette#Dark.)); |
| 315 | gradient2.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(1, pal.colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Windowcxx . . $ QPalette#Window.)); |
| 316 | painter.fillRectcxx . . $ QPainter#fillRect(41bf02b42490ec39).(rect.intersectedcxx . . $ QRect#intersected(c87a5916684a953).(QRectcxx . . $ QRect#QRect(2261ffe5112eab06).(rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).(), rect.ycxx . . $ QRect#y(ea6fe5115c70a13f).(), markWidth, rect.heightcxx . . $ QRect#height(ea6fe5115c70a13f).())), gradient2); |
| 317 | |
| 318 | painter.setPencxx . . $ QPainter#setPen(af0a25dfda3214db).(QPen(pal.colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Windowcxx . . $ QPalette#Window.), 2)); |
| 319 | if (isLeftToRightcxx . . $ QWidget#isLeftToRight(50ce9a9e25b4a850).()) |
| 320 | painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).() + extraAreaWidth-1, rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).(), rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).() + extraAreaWidth-1, rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).()); |
| 321 | else |
| 322 | painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).(), rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).(), rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).(), rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).()); |
| 323 | painter.setRenderHintcxx . . $ QPainter#setRenderHint(df747a77a7bbbce1).(QPaintercxx . . $ QPainter#::Antialiasingcxx . . $ QPainter#Antialiasing.); |
| 324 | |
| 325 | #ifndef QT_NO_SYNTAXHIGHLIGHTER |
| 326 | QTextBlockcxx . . $ QTextBlock# block = firstVisibleBlockcxx . . $ QPlainTextEdit#firstVisibleBlock(fcb2c37f271a2a41).(); |
| 327 | int blockNumber = block.blockNumbercxx . . $ QTextBlock#blockNumber(455f465bc33b4cdf).(); |
| 328 | qrealcxx . . $ qreal# top = blockBoundingGeometrycxx . . $ QPlainTextEdit#blockBoundingGeometry(b25b5125f533bbfc).(block).translated(contentOffsetcxx . . $ QPlainTextEdit#contentOffset(a5b3784bf6777acb).()).top(); |
| 329 | qrealcxx . . $ qreal# bottom = top +cxx . . $ operator+(68a6fbfab4d187bc). blockBoundingRectcxx . . $ QPlainTextEdit#blockBoundingRect(b25b5125f533bbfc).(block).height(); |
| 330 | |
| 331 | QStringcxx . . $ QString# imagesPath = QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).(":/qt/scripttools/debugging/images"); |
| 332 | QStringcxx . . $ QString# imageExtcxx . . $ QString#QString(ced63f7c635d850d).; |
| 333 | // SVGs don't work on all platforms, even when QT_NO_SVG is not defined, so disable SVG usage for now. |
| 334 | // #ifndef QT_NO_SVG |
| 335 | #if 0 |
| 336 | imageExt = QString::fromLatin1("svg"); |
| 337 | #else |
| 338 | imageExt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("png"); |
| 339 | #endif |
| 340 | |
| 341 | while (block.isValidcxx . . $ QTextBlock#isValid(50ce9a9e25b4a850).() && top <= rect.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).()) { |
| 342 | if (block.isVisiblecxx . . $ QTextBlock#isVisible(50ce9a9e25b4a850).() && bottom >= rect.topcxx . . $ QRect#top(ea6fe5115c70a13f).()) { |
| 343 | |
| 344 | int lineNumber = blockNumber + m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 345 | if (m_breakpoints.contains(lineNumber)) { |
| 346 | int radius = fm.lineSpacingcxx . . $ QFontMetrics#lineSpacing(455f465bc33b4cdf).() - 1; |
| 347 | QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).(), (int)top, radius, radius); |
| 348 | QIconcxx . . $ QIcon# icon(m_breakpoints[lineNumber].enabled |
| 349 | ? QString::fromLatin1("%0/breakpoint.%1").arg(imagesPath).arg(imageExt) |
| 350 | : QString::fromLatin1("%0/d_breakpoint.%1").arg(imagesPath).arg(imageExt)); |
| 351 | icon.paintcxx . . $ QIcon#paint(227eadf532610836).(&painter, r, Qtcxx . . $ Qt/::AlignCentercxx . . $ Qt/AlignCenter.); |
| 352 | } |
| 353 | if (m_executionLineNumbercxx . . $ QScriptEdit#m_executionLineNumber. == lineNumber) { |
| 354 | int radius = fm.lineSpacingcxx . . $ QFontMetrics#lineSpacing(455f465bc33b4cdf).() - 1; |
| 355 | QRectcxx . . $ QRect# rcxx . . $ QRect#QRect(2261ffe5112eab06).(rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).(), (int)top, radius, radius); |
| 356 | QIconcxx . . $ QIcon# iconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("%0/location.%1").argcxx . . $ QString#arg(bc823072288cbbb5).(imagesPath).argcxx . . $ QString#arg(bc823072288cbbb5).(imageExt)); |
| 357 | icon.paintcxx . . $ QIcon#paint(227eadf532610836).(&painter, r, Qtcxx . . $ Qt/::AlignCentercxx . . $ Qt/AlignCenter.); |
| 358 | } |
| 359 | |
| 360 | if (!isExecutableLinecxx . . $ QScriptEdit#isExecutableLine(4a668f6de69bf818).(lineNumber)) |
| 361 | painter.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(pal.colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Midcxx . . $ QPalette#Mid.)); |
| 362 | else |
| 363 | painter.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(QColorcxx . . $ QColor#QColor(408ec4d5924bfb00).(Qtcxx . . $ Qt/::darkCyancxx . . $ Qt/darkCyan.)); |
| 364 | QStringcxx . . $ QString# number = QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(lineNumber); |
| 365 | painter.drawTextcxx . . $ QPainter#drawText(26e93c81cbf08633).(rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).() + markWidth, (int)top, rect.xcxx . . $ QRect#x(ea6fe5115c70a13f).() + extraAreaWidth - markWidth - 4, |
| 366 | fm.heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).(), Qtcxx . . $ Qt/::AlignRightcxx . . $ Qt/AlignRight., number); |
| 367 | } |
| 368 | |
| 369 | block =cxx . . $ QTextBlock#`operator=`(b837fc91fbe92fa9). block.nextcxx . . $ QTextBlock#next(fcb2c37f271a2a41).(); |
| 370 | top = bottom; |
| 371 | bottom = top +cxx . . $ operator+(68a6fbfab4d187bc). blockBoundingRectcxx . . $ QPlainTextEdit#blockBoundingRect(b25b5125f533bbfc).(block).height(); |
| 372 | ++blockNumber; |
| 373 | } |
| 374 | #endif |
| 375 | } |
| 376 | |
| 377 | void QScriptEditcxx . . $ QScriptEdit#::extraAreaMouseEventcxx . . $ QScriptEdit#extraAreaMouseEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *e) |
| 378 | { |
| 379 | QTextCursorcxx . . $ QTextCursor# cursor = cursorForPositioncxx . . $ QPlainTextEdit#cursorForPosition(4a0e9685946a717d).(QPointcxx . . $ QPoint#QPoint(3e454b8ccf442868).(0, e->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(455f465bc33b4cdf).())); |
| 380 | #ifndef QT_NO_SYNTAXHIGHLIGHTER |
| 381 | cursor.setPositioncxx . . $ QTextCursor#setPosition(f2a23d9eedd3abdd).(cursor.blockcxx . . $ QTextCursor#block(fcb2c37f271a2a41).().positioncxx . . $ QTextBlock#position(455f465bc33b4cdf).()); |
| 382 | #endif |
| 383 | |
| 384 | QFontMetricscxx . . $ QFontMetrics# fm(fontcxx . . $ QWidget#font(c5040538afc47120).()); |
| 385 | int markWidth = fm.lineSpacingcxx . . $ QFontMetrics#lineSpacing(455f465bc33b4cdf).(); |
| 386 | |
| 387 | if (e->typecxx . . $ QEvent#type(916a8de57f4d422b).() ==cxx . . $ `operator==`(abb235a625a921b3). QEventcxx . . $ QEvent#::MouseMovecxx . . $ QEvent#MouseMove. && e->buttons() ==cxx . . $ `operator==`(abb235a625a921b3). 0) { // mouse tracking |
| 388 | bool hand = (e->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).().xcxx . . $ QPoint#x(455f465bc33b4cdf).() <= markWidth); |
| 389 | int lineNumber = cursor.blockNumbercxx . . $ QTextCursor#blockNumber(455f465bc33b4cdf).() + m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 390 | hand = hand && isExecutableLinecxx . . $ QScriptEdit#isExecutableLine(4a668f6de69bf818).(lineNumber); |
| 391 | #ifndef QT_NO_CURSOR |
| 392 | if (hand !=cxx . . $ `operator!=`(abb235a625a921b3). (m_extraAreacxx . . $ QScriptEdit#m_extraArea.->cursorcxx . . $ QWidget#cursor(1091ef8f3dbf393d).().shape() ==cxx . . $ `operator==`(abb235a625a921b3). Qtcxx . . $ Qt/::PointingHandCursorcxx . . $ Qt/PointingHandCursor.)) |
| 393 | m_extraAreacxx . . $ QScriptEdit#m_extraArea.->setCursorcxx . . $ QWidget#setCursor(abdcfda6ee8376ea).(hand ? Qtcxx . . $ Qt/::PointingHandCursorcxx . . $ Qt/PointingHandCursor. : Qtcxx . . $ Qt/::ArrowCursorcxx . . $ Qt/ArrowCursor.); |
| 394 | #endif |
| 395 | } |
| 396 | |
| 397 | if (e->typecxx . . $ QEvent#type(916a8de57f4d422b).() ==cxx . . $ `operator==`(abb235a625a921b3). QEventcxx . . $ QEvent#::MouseButtonPresscxx . . $ QEvent#MouseButtonPress.) { |
| 398 | if (e->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton.) { |
| 399 | int lineNumber = cursor.blockNumbercxx . . $ QTextCursor#blockNumber(455f465bc33b4cdf).() + m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 400 | bool executable = isExecutableLinecxx . . $ QScriptEdit#isExecutableLine(4a668f6de69bf818).(lineNumber); |
| 401 | if ((e->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).().xcxx . . $ QPoint#x(455f465bc33b4cdf).() <= markWidth) && executable) |
| 402 | m_extraAreaToggleBlockNumbercxx . . $ QScriptEdit#m_extraAreaToggleBlockNumber. = cursor.blockNumbercxx . . $ QTextCursor#blockNumber(455f465bc33b4cdf).(); |
| 403 | else |
| 404 | m_extraAreaToggleBlockNumbercxx . . $ QScriptEdit#m_extraAreaToggleBlockNumber. = -1; |
| 405 | } |
| 406 | } else if (e->typecxx . . $ QEvent#type(916a8de57f4d422b).() ==cxx . . $ `operator==`(abb235a625a921b3). QEventcxx . . $ QEvent#::MouseButtonReleasecxx . . $ QEvent#MouseButtonRelease.) { |
| 407 | if (e->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton.) { |
| 408 | if ((m_extraAreaToggleBlockNumbercxx . . $ QScriptEdit#m_extraAreaToggleBlockNumber. != -1) && (e->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).().xcxx . . $ QPoint#x(455f465bc33b4cdf).() <= markWidth)) { |
| 409 | int lineNumber = m_extraAreaToggleBlockNumbercxx . . $ QScriptEdit#m_extraAreaToggleBlockNumber. + m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 410 | bool on = !m_breakpoints.contains(lineNumber); |
| 411 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! breakpointToggleRequestcxx . . $ QScriptEdit#breakpointToggleRequest(918ebd27a9ddbad3).(lineNumber, on); |
| 412 | } |
| 413 | } else if (e->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::RightButtoncxx . . $ Qt/RightButton.) { |
| 414 | int lineNumber = cursor.blockNumbercxx . . $ QTextCursor#blockNumber(455f465bc33b4cdf).() + m_baseLineNumbercxx . . $ QScriptEdit#m_baseLineNumber.; |
| 415 | if (!isExecutableLinecxx . . $ QScriptEdit#isExecutableLine(4a668f6de69bf818).(lineNumber)) |
| 416 | return; |
| 417 | bool has = m_breakpoints.contains(lineNumber); |
| 418 | QMenucxx . . $ QMenu# *popup = new QMenucxx . . $ QMenu#QMenu(108f35f7aa7f3cf9).(); |
| 419 | QActioncxx . . $ QAction# *toggleAct = new QAction(tr("Toggle Breakpoint"), popup); |
| 420 | popup->addActioncxx . . $ QMenu#addAction(92b1e80c0a7f1406).(toggleAct); |
| 421 | QActioncxx . . $ QAction# *disableAct = new QAction(tr("Disable Breakpoint"), popup); |
| 422 | QActioncxx . . $ QAction# *enableAct = new QAction(tr("Enable Breakpoint"), popup); |
| 423 | QWidgetcxx . . $ QWidget# *conditionWidget = new QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(); |
| 424 | { |
| 425 | QHBoxLayoutcxx . . $ QHBoxLayout# *hbox = new QHBoxLayoutcxx . . $ QHBoxLayout#(conditionWidget); |
| 426 | hbox->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(new QLabelcxx . . $ QLabel#(trcxx . . $ QScriptEdit#tr(75d9f1c324b4579d).("Breakpoint Condition:"))); |
| 427 | hbox->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(new QLineEditcxx . . $ QLineEdit#()); |
| 428 | } |
| 429 | // QWidgetAction *conditionAct = new QWidgetAction(popup); |
| 430 | // conditionAct->setDefaultWidget(conditionWidget); |
| 431 | if (has) { |
| 432 | popup->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 433 | popup->addActioncxx . . $ QMenu#addAction(92b1e80c0a7f1406).(m_breakpoints[lineNumber].enabled ? disableAct : enableAct); |
| 434 | // popup->addAction(conditionAct); |
| 435 | } |
| 436 | QActioncxx . . $ QAction# *ret = popup->execcxx . . $ QMenu#exec(2535b15b88c544d4).(e->globalPoscxx . . $ QMouseEvent#globalPos(75d69cfbd3c4b2dd).()); |
| 437 | if (ret) { |
| 438 | if (ret == toggleAct) { |
| 439 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! breakpointToggleRequestcxx . . $ QScriptEdit#breakpointToggleRequest(918ebd27a9ddbad3).(lineNumber, !has); |
| 440 | } else if (ret == disableAct) { |
| 441 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! breakpointEnableRequestcxx . . $ QScriptEdit#breakpointEnableRequest(918ebd27a9ddbad3).(lineNumber, false); |
| 442 | } else if (ret == enableAct) { |
| 443 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! breakpointEnableRequestcxx . . $ QScriptEdit#breakpointEnableRequest(918ebd27a9ddbad3).(lineNumber, true); |
| 444 | }// else if (ret == conditionAct) { |
| 445 | //} |
| 446 | } |
| 447 | popup->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | bool QScriptEditcxx . . $ QScriptEdit#::extraAreaEventcxx . . $ QScriptEdit#extraAreaEvent(f123fa2ce489f0bd).(QEventcxx . . $ QEvent# *e) |
| 453 | { |
| 454 | if (e->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::ToolTipcxx . . $ QEvent#ToolTip.) { |
| 455 | // ### show the breakpoint's condition, if any |
| 456 | return true; |
| 457 | } |
| 458 | return false; |
| 459 | } |
| 460 | |
| 461 | QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`! |