| 1 | #cxx . . $ `<file>/src/HexViewer.cpp`/include "HexViewer.h"cxx . . $ `<file>/src/HexViewer.h`/ |
| 2 | #include "OpenMSXConnection.h"cxx . . $ `<file>/src/OpenMSXConnection.h`/ |
| 3 | #include "CommClient.h"cxx . . $ `<file>/src/CommClient.h`/ |
| 4 | #include "Settings.h"cxx . . $ `<file>/src/Settings.h`/ |
| 5 | #include <QScrollBar> |
| 6 | #include <QPaintEvent> |
| 7 | #include <QPainter> |
| 8 | #include <QToolTip> |
| 9 | #include <QAction> |
| 10 | #include <algorithm> |
| 11 | #include <cmath> |
| 12 | |
| 13 | static const int EXTRA_SPACINGcxx . . $ EXTRA_SPACING. = 4; |
| 14 | |
| 15 | class HexRequestcxx . . $ HexRequest# : public ReadDebugBlockCommandcxx . . $ ReadDebugBlockCommand# |
| 16 | { |
| 17 | public: |
| 18 | HexRequestcxx . . $ HexRequest#HexRequest(b209aadf4a971df4).(const QStringcxx . . $ QString#& debuggable, unsigned offset_, unsigned size, |
| 19 | uint8_tcxx . . $ uint8_t#* target, HexViewercxx . . $ HexViewer#& viewer_) |
| 20 | : ReadDebugBlockCommandcxx . . $ ReadDebugBlockCommand#(debuggable, offset_, size, target) |
| 21 | , offsetcxx . . $ HexRequest#offset.(offset_) |
| 22 | , viewercxx . . $ HexRequest#viewer.(viewer_) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | void replyOkcxx . . $ HexRequest#replyOk(3520e46b33348bf6).(const QStringcxx . . $ QString#& message) override |
| 27 | { |
| 28 | copyDatacxx . . $ ReadDebugBlockCommand#copyData(3520e46b33348bf6).(message); |
| 29 | viewercxx . . $ HexRequest#viewer..hexdataTransferedcxx . . $ HexViewer#hexdataTransfered(ec2c4844b45cf9f6).(this); |
| 30 | } |
| 31 | |
| 32 | void cancelcxx . . $ HexRequest#cancel(49f6e7a06ebc5aa8).() override |
| 33 | { |
| 34 | viewercxx . . $ HexRequest#viewer..transferCancelledcxx . . $ HexViewer#transferCancelled(ec2c4844b45cf9f6).(this); |
| 35 | } |
| 36 | |
| 37 | unsigned offsetcxx . . $ HexRequest#offset.; |
| 38 | |
| 39 | private: |
| 40 | HexViewercxx . . $ HexViewer#& viewercxx . . $ HexRequest#viewer.; |
| 41 | }; |
| 42 | |
| 43 | |
| 44 | HexViewercxx . . $ HexViewer#::HexViewercxx . . $ HexViewer#HexViewer(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 45 | : QFramecxx . . $ QFrame#(parent) |
| 46 | { |
| 47 | setFrameStylecxx . . $ QFrame#setFrameStyle(d4f767463ce0a6b3).(WinPanelcxx . . $ QFrame#WinPanel. |cxx . . $ `operator|`(44af6e16e9fc6bb). Sunkencxx . . $ QFrame#Sunken.); |
| 48 | setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::StrongFocuscxx . . $ Qt/StrongFocus.); |
| 49 | setBackgroundRolecxx . . $ QWidget#setBackgroundRole(656661f550a99654).(QPalettecxx . . $ QPalette#::Basecxx . . $ QPalette#Base.); |
| 50 | setSizePolicycxx . . $ QWidget#setSizePolicy(41340f53ecd443dd).(QSizePolicycxx . . $ QSizePolicy#QSizePolicy(dc90913e2b9d0ddb).(QSizePolicycxx . . $ QSizePolicy#::Preferredcxx . . $ QSizePolicy#Preferred., QSizePolicycxx . . $ QSizePolicy#::Expandingcxx . . $ QSizePolicy#Expanding.)); |
| 51 | |
| 52 | vertScrollBarcxx . . $ HexViewer#vertScrollBar. = new QScrollBarcxx . . $ QScrollBar#QScrollBar(370ffd1f04771b4e).(Qtcxx . . $ Qt/::Verticalcxx . . $ Qt/Vertical., this); |
| 53 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setMinimumcxx . . $ QAbstractSlider#setMinimum(d4f767463ce0a6b3).(0); |
| 54 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setSingleStepcxx . . $ QAbstractSlider#setSingleStep(d4f767463ce0a6b3).(1); |
| 55 | |
| 56 | frameLcxx . . $ HexViewer#frameL. = frameTcxx . . $ HexViewer#frameT. = frameBcxx . . $ HexViewer#frameB. = frameWidthcxx . . $ QFrame#frameWidth(455f465bc33b4cdf).(); |
| 57 | frameRcxx . . $ HexViewer#frameR. = frameLcxx . . $ HexViewer#frameL. + vertScrollBarcxx . . $ HexViewer#vertScrollBar.->sizeHintcxx . . $ QScrollBar#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(); |
| 58 | |
| 59 | settingsChangedcxx . . $ HexViewer#settingsChanged(49f6e7a06ebc5aa8).(); |
| 60 | |
| 61 | createActionscxx . . $ HexViewer#createActions(49f6e7a06ebc5aa8).(); |
| 62 | |
| 63 | connectcxx . . $ QObject#connect(835f87066c895669).(vertScrollBarcxx . . $ HexViewer#vertScrollBar., &QScrollBarcxx . . $ QScrollBar#::valueChangedcxx . . $ QAbstractSlider#valueChanged(d4f767463ce0a6b3)., |
| 64 | this, &HexViewercxx . . $ HexViewer#::scrollBarChangedcxx . . $ HexViewer#scrollBarChanged(d4f767463ce0a6b3).); |
| 65 | } |
| 66 | |
| 67 | void HexViewercxx . . $ HexViewer#::createActionscxx . . $ HexViewer#createActions(49f6e7a06ebc5aa8).() |
| 68 | { |
| 69 | fillWidthActioncxx . . $ HexViewer#fillWidthAction. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("&Fill with"), this); |
| 70 | fillWidthActioncxx . . $ HexViewer#fillWidthAction.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("Ctrl+F")); |
| 71 | fillWidthActioncxx . . $ HexViewer#fillWidthAction.->setStatusTipcxx . . $ QAction#setStatusTip(3520e46b33348bf6).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("Fill the width with as many bytes as possible.")); |
| 72 | |
| 73 | fillWidth2Actioncxx . . $ HexViewer#fillWidth2Action. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("Power of &2"), this); |
| 74 | fillWidth2Actioncxx . . $ HexViewer#fillWidth2Action.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("Ctrl+2")); |
| 75 | fillWidth2Actioncxx . . $ HexViewer#fillWidth2Action.->setStatusTipcxx . . $ QAction#setStatusTip(3520e46b33348bf6).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("Fill the with with the maximum power of 2 possible.")); |
| 76 | |
| 77 | setWith8Actioncxx . . $ HexViewer#setWith8Action. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("&8 bytes."), this); |
| 78 | setWith8Actioncxx . . $ HexViewer#setWith8Action.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("Ctrl+8")); |
| 79 | setWith8Actioncxx . . $ HexViewer#setWith8Action.->setStatusTipcxx . . $ QAction#setStatusTip(3520e46b33348bf6).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("Set width to 8 bytes.")); |
| 80 | |
| 81 | setWith16Actioncxx . . $ HexViewer#setWith16Action. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("&16 bytes."), this); |
| 82 | setWith16Actioncxx . . $ HexViewer#setWith16Action.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("Ctrl+6")); |
| 83 | setWith16Actioncxx . . $ HexViewer#setWith16Action.->setStatusTipcxx . . $ QAction#setStatusTip(3520e46b33348bf6).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("Set width to 16 bytes.")); |
| 84 | |
| 85 | setWith32Actioncxx . . $ HexViewer#setWith32Action. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("&32 bytes."), this); |
| 86 | setWith32Actioncxx . . $ HexViewer#setWith32Action.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("Ctrl+3")); |
| 87 | setWith32Actioncxx . . $ HexViewer#setWith32Action.->setStatusTipcxx . . $ QAction#setStatusTip(3520e46b33348bf6).(trcxx . . $ HexViewer#tr(75d9f1c324b4579d).("Set width to 32 bytes.")); |
| 88 | |
| 89 | connectcxx . . $ QObject#connect(835f87066c895669).(fillWidthActioncxx . . $ HexViewer#fillWidthAction., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &HexViewercxx . . $ HexViewer#::changeWidthcxx . . $ HexViewer#changeWidth(49f6e7a06ebc5aa8).); |
| 90 | connectcxx . . $ QObject#connect(835f87066c895669).(fillWidth2Actioncxx . . $ HexViewer#fillWidth2Action., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &HexViewercxx . . $ HexViewer#::changeWidthcxx . . $ HexViewer#changeWidth(49f6e7a06ebc5aa8).); |
| 91 | connectcxx . . $ QObject#connect(835f87066c895669).(setWith8Actioncxx . . $ HexViewer#setWith8Action., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &HexViewercxx . . $ HexViewer#::changeWidthcxx . . $ HexViewer#changeWidth(49f6e7a06ebc5aa8).); |
| 92 | connectcxx . . $ QObject#connect(835f87066c895669).(setWith16Actioncxx . . $ HexViewer#setWith16Action., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &HexViewercxx . . $ HexViewer#::changeWidthcxx . . $ HexViewer#changeWidth(49f6e7a06ebc5aa8).); |
| 93 | connectcxx . . $ QObject#connect(835f87066c895669).(setWith32Actioncxx . . $ HexViewer#setWith32Action., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &HexViewercxx . . $ HexViewer#::changeWidthcxx . . $ HexViewer#changeWidth(49f6e7a06ebc5aa8).); |
| 94 | |
| 95 | addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(fillWidthActioncxx . . $ HexViewer#fillWidthAction.); |
| 96 | addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(fillWidth2Actioncxx . . $ HexViewer#fillWidth2Action.); |
| 97 | addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(setWith8Actioncxx . . $ HexViewer#setWith8Action.); |
| 98 | addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(setWith16Actioncxx . . $ HexViewer#setWith16Action.); |
| 99 | addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(setWith32Actioncxx . . $ HexViewer#setWith32Action.); |
| 100 | setContextMenuPolicycxx . . $ QWidget#setContextMenuPolicy(de0fa9f0eb4c7210).(Qtcxx . . $ Qt/::ActionsContextMenucxx . . $ Qt/ActionsContextMenu.); |
| 101 | } |
| 102 | |
| 103 | void HexViewercxx . . $ HexViewer#::changeWidthcxx . . $ HexViewer#changeWidth(49f6e7a06ebc5aa8).() |
| 104 | { |
| 105 | if (sendercxx . . $ QObject#sender(2dbb680a34285c44).() == fillWidthActioncxx . . $ HexViewer#fillWidthAction.) setDisplayModecxx . . $ HexViewer#setDisplayMode(4496567c628f8dee).(FILL_WIDTHcxx . . $ HexViewer#FILL_WIDTH.); |
| 106 | else if (sendercxx . . $ QObject#sender(2dbb680a34285c44).() == fillWidth2Actioncxx . . $ HexViewer#fillWidth2Action.) setDisplayModecxx . . $ HexViewer#setDisplayMode(4496567c628f8dee).(FILL_WIDTH_POWEROF2cxx . . $ HexViewer#FILL_WIDTH_POWEROF2.); |
| 107 | else if (sendercxx . . $ QObject#sender(2dbb680a34285c44).() == setWith8Actioncxx . . $ HexViewer#setWith8Action.) setDisplayWidthcxx . . $ HexViewer#setDisplayWidth(68e3ae50fe6578a9).(8); |
| 108 | else if (sendercxx . . $ QObject#sender(2dbb680a34285c44).() == setWith16Actioncxx . . $ HexViewer#setWith16Action.) setDisplayWidthcxx . . $ HexViewer#setDisplayWidth(68e3ae50fe6578a9).(16); |
| 109 | else if (sendercxx . . $ QObject#sender(2dbb680a34285c44).() == setWith32Actioncxx . . $ HexViewer#setWith32Action.) setDisplayWidthcxx . . $ HexViewer#setDisplayWidth(68e3ae50fe6578a9).(32); |
| 110 | } |
| 111 | |
| 112 | void HexViewercxx . . $ HexViewer#::setIsEditablecxx . . $ HexViewer#setIsEditable(b45ddcbc8423892c).(bool enabled) |
| 113 | { |
| 114 | isEditablecxx . . $ HexViewer#isEditable. = enabled; |
| 115 | setUseMarkercxx . . $ HexViewer#setUseMarker(b45ddcbc8423892c).(true); |
| 116 | } |
| 117 | |
| 118 | void HexViewercxx . . $ HexViewer#::setUseMarkercxx . . $ HexViewer#setUseMarker(b45ddcbc8423892c).(bool enabled) |
| 119 | { |
| 120 | useMarkercxx . . $ HexViewer#useMarker. = enabled; |
| 121 | // below we should check if current marker is visible etc |
| 122 | // but since in the debugger we will set this at instantiation |
| 123 | // and then never change it again this is a quicky in case we do later on |
| 124 | if (useMarkercxx . . $ HexViewer#useMarker.) { |
| 125 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = hexTopAddresscxx . . $ HexViewer#hexTopAddress.; |
| 126 | } |
| 127 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 128 | } |
| 129 | |
| 130 | void HexViewercxx . . $ HexViewer#::setIsInteractivecxx . . $ HexViewer#setIsInteractive(b45ddcbc8423892c).(bool enabled) |
| 131 | { |
| 132 | isInteractivecxx . . $ HexViewer#isInteractive. = enabled; |
| 133 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(enabled); |
| 134 | } |
| 135 | |
| 136 | void HexViewercxx . . $ HexViewer#::setDisplayModecxx . . $ HexViewer#setDisplayMode(4496567c628f8dee).(Modecxx . . $ HexViewer#Mode# mode) |
| 137 | { |
| 138 | displayModecxx . . $ HexViewer#displayMode. = mode; |
| 139 | setSizescxx . . $ HexViewer#setSizes(49f6e7a06ebc5aa8).(); |
| 140 | } |
| 141 | |
| 142 | void HexViewercxx . . $ HexViewer#::setDisplayWidthcxx . . $ HexViewer#setDisplayWidth(68e3ae50fe6578a9).(short width) |
| 143 | { |
| 144 | displayModecxx . . $ HexViewer#displayMode. = FIXEDcxx . . $ HexViewer#FIXED.; |
| 145 | horBytescxx . . $ HexViewer#horBytes. = width; |
| 146 | setSizescxx . . $ HexViewer#setSizes(49f6e7a06ebc5aa8).(); |
| 147 | } |
| 148 | |
| 149 | void HexViewercxx . . $ HexViewer#::settingsChangedcxx . . $ HexViewer#settingsChanged(49f6e7a06ebc5aa8).() |
| 150 | { |
| 151 | QFontMetricscxx . . $ QFontMetrics# fmcxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(Settingscxx . . $ Settings#::getcxx . . $ Settings#get(493e506a9691bc24).().fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::HEX_FONTcxx . . $ Settings#HEX_FONT.)); |
| 152 | lineHeightcxx . . $ HexViewer#lineHeight. = fm.heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).(); |
| 153 | charWidthcxx . . $ HexViewer#charWidth. = fm.horizontalAdvancecxx . . $ QFontMetrics#horizontalAdvance(91f46685ef4c12b5).("W"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 154 | hexCharWidthcxx . . $ HexViewer#hexCharWidth. = fm.horizontalAdvancecxx . . $ QFontMetrics#horizontalAdvance(91f46685ef4c12b5).("0ABCDEF"cxx . . $ QString#QString(85c52e162fed56f9).) / 7; |
| 155 | xAddrcxx . . $ HexViewer#xAddr. = frameLcxx . . $ HexViewer#frameL. + 8; |
| 156 | xDatacxx . . $ HexViewer#xData. = xAddrcxx . . $ HexViewer#xAddr. + addressLengthcxx . . $ HexViewer#addressLength. * hexCharWidthcxx . . $ HexViewer#hexCharWidth. + charWidthcxx . . $ HexViewer#charWidth.; |
| 157 | dataWidthcxx . . $ HexViewer#dataWidth. = 3 * hexCharWidthcxx . . $ HexViewer#hexCharWidth.; |
| 158 | setSizescxx . . $ HexViewer#setSizes(49f6e7a06ebc5aa8).(); |
| 159 | } |
| 160 | |
| 161 | void HexViewercxx . . $ HexViewer#::setSizescxx . . $ HexViewer#setSizes(49f6e7a06ebc5aa8).() |
| 162 | { |
| 163 | visibleLinescxx . . $ HexViewer#visibleLines. = (heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameTcxx . . $ HexViewer#frameT. - frameBcxx . . $ HexViewer#frameB.) / lineHeightcxx . . $ HexViewer#lineHeight.; |
| 164 | partialBottomLinecxx . . $ HexViewer#partialBottomLine. = (heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameTcxx . . $ HexViewer#frameT. - frameBcxx . . $ HexViewer#frameB.) != lineHeightcxx . . $ HexViewer#lineHeight. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 165 | |
| 166 | frameRcxx . . $ HexViewer#frameR. = frameLcxx . . $ HexViewer#frameL.; |
| 167 | int w; |
| 168 | |
| 169 | // fit display to width |
| 170 | if (displayModecxx . . $ HexViewer#displayMode. != FIXEDcxx . . $ HexViewer#FIXED.) { |
| 171 | // scrollbar width |
| 172 | int sbw = vertScrollBarcxx . . $ HexViewer#vertScrollBar.->sizeHintcxx . . $ QScrollBar#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(); |
| 173 | horBytescxx . . $ HexViewer#horBytes. = 1; |
| 174 | int hb2 = 1; |
| 175 | w = widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameLcxx . . $ HexViewer#frameL. - frameRcxx . . $ HexViewer#frameR. - xDatacxx . . $ HexViewer#xData. - dataWidthcxx . . $ HexViewer#dataWidth. - 2 * charWidthcxx . . $ HexViewer#charWidth. - 8; |
| 176 | // calculate how many additional bytes can by displayed |
| 177 | while (w-sbw >= dataWidthcxx . . $ HexViewer#dataWidth. + charWidthcxx . . $ HexViewer#charWidth.) { |
| 178 | ++horBytescxx . . $ HexViewer#horBytes.; |
| 179 | if (horBytescxx . . $ HexViewer#horBytes. == 2 * hb2) hb2 = horBytescxx . . $ HexViewer#horBytes.; |
| 180 | w -= dataWidthcxx . . $ HexViewer#dataWidth. + charWidthcxx . . $ HexViewer#charWidth.; |
| 181 | if ((horBytescxx . . $ HexViewer#horBytes. & 3) == 0) w -= EXTRA_SPACINGcxx . . $ EXTRA_SPACING.; |
| 182 | if ((horBytescxx . . $ HexViewer#horBytes. & 7) == 0) w -= EXTRA_SPACINGcxx . . $ EXTRA_SPACING.; |
| 183 | // remove scrollbar |
| 184 | if (horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines. >= debuggableSizecxx . . $ HexViewer#debuggableSize.) sbw = 0; |
| 185 | } |
| 186 | // limit to power of two if needed |
| 187 | if (displayModecxx . . $ HexViewer#displayMode. == FILL_WIDTH_POWEROF2cxx . . $ HexViewer#FILL_WIDTH_POWEROF2.) |
| 188 | horBytescxx . . $ HexViewer#horBytes. = hb2; |
| 189 | } |
| 190 | |
| 191 | // check if a scrollbar is needed |
| 192 | if (horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines. < debuggableSizecxx . . $ HexViewer#debuggableSize.) { |
| 193 | int maxLine = int(ceil(double(debuggableSizecxx . . $ HexViewer#debuggableSize.) / horBytescxx . . $ HexViewer#horBytes.)) - visibleLinescxx . . $ HexViewer#visibleLines.; |
| 194 | maxLine = std::maxcxx . . $ std/max(2a338fce5842aa6a).(maxLine, 0); |
| 195 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setMaximumcxx . . $ QAbstractSlider#setMaximum(d4f767463ce0a6b3).(maxLine); |
| 196 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setPageStepcxx . . $ QAbstractSlider#setPageStep(d4f767463ce0a6b3).(visibleLinescxx . . $ HexViewer#visibleLines.); |
| 197 | frameRcxx . . $ HexViewer#frameR. += vertScrollBarcxx . . $ HexViewer#vertScrollBar.->sizeHintcxx . . $ QScrollBar#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(); |
| 198 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setGeometrycxx . . $ QWidget#setGeometry(748afa4755bc9595).(widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ HexViewer#frameR., frameTcxx . . $ HexViewer#frameT., |
| 199 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->sizeHintcxx . . $ QScrollBar#sizeHint(4b3b776e5ee2b367).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(), |
| 200 | heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameTcxx . . $ HexViewer#frameT. - frameBcxx . . $ HexViewer#frameB.); |
| 201 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).(); |
| 202 | } else { |
| 203 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->hidecxx . . $ QWidget#hide(49f6e7a06ebc5aa8).(); |
| 204 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. = 0; |
| 205 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = 0; |
| 206 | } |
| 207 | |
| 208 | // now see were the chars are drawn |
| 209 | rightValuePoscxx . . $ HexViewer#rightValuePos. = xDatacxx . . $ HexViewer#xData. + horBytescxx . . $ HexViewer#horBytes. * dataWidthcxx . . $ HexViewer#dataWidth.; |
| 210 | xCharcxx . . $ HexViewer#xChar. = rightValuePoscxx . . $ HexViewer#rightValuePos. + charWidthcxx . . $ HexViewer#charWidth. + EXTRA_SPACINGcxx . . $ EXTRA_SPACING. * (int(horBytescxx . . $ HexViewer#horBytes. / 4) + |
| 211 | int(horBytescxx . . $ HexViewer#horBytes. / 8)); |
| 212 | rightCharPoscxx . . $ HexViewer#rightCharPos. = xCharcxx . . $ HexViewer#xChar. + horBytescxx . . $ HexViewer#horBytes. * charWidthcxx . . $ HexViewer#charWidth.; |
| 213 | |
| 214 | if (isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).()) { |
| 215 | ///vertScrollBar->setValue(hexTopAddress / horBytes); |
| 216 | setTopLocationcxx . . $ HexViewer#setTopLocation(d4f767463ce0a6b3).(horBytescxx . . $ HexViewer#horBytes. * int(hexTopAddresscxx . . $ HexViewer#hexTopAddress. / horBytescxx . . $ HexViewer#horBytes.)); |
| 217 | } else { |
| 218 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | QSizecxx . . $ QSize# HexViewercxx . . $ HexViewer#::sizeHintcxx . . $ HexViewer#sizeHint(4b3b776e5ee2b367).() const |
| 223 | { |
| 224 | return {cxx . . $ QSize#QSize(c0d38f4800714fae).frameLcxx . . $ HexViewer#frameL. + 16 + (6 + 3 * horBytescxx . . $ HexViewer#horBytes. / 2) * fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).().horizontalAdvancecxx . . $ QFontMetrics#horizontalAdvance(91f46685ef4c12b5).("A"cxx . . $ QString#QString(85c52e162fed56f9).) + frameRcxx . . $ HexViewer#frameR., |
| 225 | frameTcxx . . $ HexViewer#frameT. + 10 * fontMetricscxx . . $ QWidget#fontMetrics(ee264e9e8967f9a7).().heightcxx . . $ QFontMetrics#height(455f465bc33b4cdf).() + frameBcxx . . $ HexViewer#frameB.}; |
| 226 | } |
| 227 | |
| 228 | void HexViewercxx . . $ HexViewer#::resizeEventcxx . . $ HexViewer#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#* e) |
| 229 | { |
| 230 | QFramecxx . . $ QFrame#::resizeEventcxx . . $ QWidget#resizeEvent(eeeec21cf8dc0387).(e); |
| 231 | setSizescxx . . $ HexViewer#setSizes(49f6e7a06ebc5aa8).(); |
| 232 | } |
| 233 | |
| 234 | void HexViewercxx . . $ HexViewer#::wheelEventcxx . . $ HexViewer#wheelEvent(92d40974398e4832).(QWheelEventcxx . . $ QWheelEvent#* e) |
| 235 | { |
| 236 | wheelRemaindercxx . . $ HexViewer#wheelRemainder. += e->angleDeltacxx . . $ QWheelEvent#angleDelta(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(455f465bc33b4cdf).(); |
| 237 | const int delta = wheelRemaindercxx . . $ HexViewer#wheelRemainder. / 40; |
| 238 | wheelRemaindercxx . . $ HexViewer#wheelRemainder. %= 40; |
| 239 | if (delta) { |
| 240 | int v = vertScrollBarcxx . . $ HexViewer#vertScrollBar.->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).() - delta; |
| 241 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(v); |
| 242 | } |
| 243 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 244 | } |
| 245 | |
| 246 | void HexViewercxx . . $ HexViewer#::paintEventcxx . . $ HexViewer#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent#* e) |
| 247 | { |
| 248 | // call parent for drawing the actual frame |
| 249 | QFramecxx . . $ QFrame#::paintEventcxx . . $ QFrame#paintEvent(f239c9e85d61a220).(e); |
| 250 | |
| 251 | // exit if no debuggable is set |
| 252 | if (debuggableNamecxx . . $ HexViewer#debuggableName..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) return; |
| 253 | |
| 254 | QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this); |
| 255 | |
| 256 | // set font info |
| 257 | p.setFontcxx . . $ QPainter#setFont(d0a4bd0c8524b912).(Settingscxx . . $ Settings#::getcxx . . $ Settings#get(493e506a9691bc24).().fontcxx . . $ Settings#font(feb6b15adc4fed84).(Settingscxx . . $ Settings#::HEX_FONTcxx . . $ Settings#HEX_FONT.)); |
| 258 | QColorcxx . . $ QColor# fccxx . . $ QColor#QColor(c396aab421781ee8).(Settingscxx . . $ Settings#::getcxx . . $ Settings#get(493e506a9691bc24).().fontColorcxx . . $ Settings#fontColor(28f2b0e220c74f2e).(Settingscxx . . $ Settings#::HEX_FONTcxx . . $ Settings#HEX_FONT.)); |
| 259 | int a = p.fontMetricscxx . . $ QPainter#fontMetrics(ee264e9e8967f9a7).().ascentcxx . . $ QFontMetrics#ascent(455f465bc33b4cdf).(); |
| 260 | |
| 261 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(fc); |
| 262 | |
| 263 | // calc and set drawing bounds |
| 264 | QRectcxx . . $ QRect# r(e->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).()); |
| 265 | if (r.leftcxx . . $ QRect#left(ea6fe5115c70a13f).() < frameLcxx . . $ HexViewer#frameL.) r.setLeftcxx . . $ QRect#setLeft(f349c77f591a7878).(frameLcxx . . $ HexViewer#frameL.); |
| 266 | if (r.topcxx . . $ QRect#top(ea6fe5115c70a13f).() < frameTcxx . . $ HexViewer#frameT.) r.setTopcxx . . $ QRect#setTop(f349c77f591a7878). (frameTcxx . . $ HexViewer#frameT.); |
| 267 | if (r.rightcxx . . $ QRect#right(ea6fe5115c70a13f).() > widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ HexViewer#frameR. - 1) r.setRightcxx . . $ QRect#setRight(f349c77f591a7878). (widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - frameRcxx . . $ HexViewer#frameR. - 1); |
| 268 | if (r.bottomcxx . . $ QRect#bottom(ea6fe5115c70a13f).() > heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ HexViewer#frameB. - 1) r.setBottomcxx . . $ QRect#setBottom(f349c77f591a7878).(heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - frameBcxx . . $ HexViewer#frameB. - 1); |
| 269 | p.setClipRectcxx . . $ QPainter#setClipRect(2f5004bd5eb598d2).(r); |
| 270 | |
| 271 | // redraw background |
| 272 | p.fillRectcxx . . $ QPainter#fillRect(b5c43933f089f858).(r, palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Basecxx . . $ QPalette#Base.)); |
| 273 | |
| 274 | int y = frameTcxx . . $ HexViewer#frameT.; |
| 275 | int address = hexTopAddresscxx . . $ HexViewer#hexTopAddress.; |
| 276 | for (int i = 0; i < visibleLinescxx . . $ HexViewer#visibleLines.+partialBottomLinecxx . . $ HexViewer#partialBottomLine.; ++i) { |
| 277 | // print address |
| 278 | QStringcxx . . $ QString# hexStr = QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(64ab2ed17cc11715).(address, addressLengthcxx . . $ HexViewer#addressLength., 16, QCharcxx . . $ QChar#('0')); |
| 279 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Textcxx . . $ QPalette#Text.)); |
| 280 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(xAddrcxx . . $ HexViewer#xAddr., y + a, hexStr.toUppercxx . . $ QString#toUpper(dca2c5857e9adf82).()); |
| 281 | |
| 282 | // print bytes |
| 283 | int x = xDatacxx . . $ HexViewer#xData.; |
| 284 | for (int j = 0; j < horBytescxx . . $ HexViewer#horBytes.; ++j) { |
| 285 | // print data |
| 286 | if (address + j < debuggableSizecxx . . $ HexViewer#debuggableSize.) { |
| 287 | hexStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(64ab2ed17cc11715).(hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + j], 2, 16, QCharcxx . . $ QChar#('0')).toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).(); |
| 288 | // draw marker if needed |
| 289 | if (useMarkercxx . . $ HexViewer#useMarker. || beingEditedcxx . . $ HexViewer#beingEdited.) { |
| 290 | QRectcxx . . $ QRect# bcxx . . $ QRect#QRect(2261ffe5112eab06).(x, y, dataWidthcxx . . $ HexViewer#dataWidth., lineHeightcxx . . $ HexViewer#lineHeight.); |
| 291 | if ((address + j) == hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) { |
| 292 | p.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(b, hasFocuscxx . . $ HexViewer#hasFocus. ? Qtcxx . . $ Qt/::cyancxx . . $ Qt/cyan. |
| 293 | : Qtcxx . . $ Qt/::lightGraycxx . . $ Qt/lightGray.); |
| 294 | } |
| 295 | // are we being edited ?? |
| 296 | if (hasFocuscxx . . $ HexViewer#hasFocus. && isEditablecxx . . $ HexViewer#isEditable. && !editedCharscxx . . $ HexViewer#editedChars. && |
| 297 | ((address + j) == hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.)) { |
| 298 | if (beingEditedcxx . . $ HexViewer#beingEdited.) { |
| 299 | p.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(b, Qtcxx . . $ Qt/::darkGreencxx . . $ Qt/darkGreen.); |
| 300 | if (cursorPositioncxx . . $ HexViewer#cursorPosition.) { |
| 301 | hexStr =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(64ab2ed17cc11715).(editValuecxx . . $ HexViewer#editValue., 2, 16).toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).(); |
| 302 | } |
| 303 | } else { |
| 304 | p.drawRectcxx . . $ QPainter#drawRect(22ba0428947158b).(b); |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | // determine value colour |
| 310 | if (highlitChangescxx . . $ HexViewer#highlitChanges.) { |
| 311 | QColorcxx . . $ QColor# penClr = palettecxx . . $ QColor#QColor(c396aab421781ee8).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Textcxx . . $ QPalette#Text.); |
| 312 | if (hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + j] != previousHexDatacxx . . $ HexViewer#previousHexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + j]) { |
| 313 | if ((address + j) != hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. || !beingEditedcxx . . $ HexViewer#beingEdited.) { |
| 314 | penClr =cxx . . $ QColor#`operator=`(7dc25a5504d99c29). Qtcxx . . $ Qt/::redcxx . . $ Qt/red.; |
| 315 | } |
| 316 | } |
| 317 | if (((address + j) == hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) && |
| 318 | beingEditedcxx . . $ HexViewer#beingEdited. && (cursorPositioncxx . . $ HexViewer#cursorPosition. == 0)) { |
| 319 | penClr =cxx . . $ QColor#`operator=`(7dc25a5504d99c29). Qtcxx . . $ Qt/::whitecxx . . $ Qt/white.; |
| 320 | } |
| 321 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(penClr); |
| 322 | } |
| 323 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(x, y + a, hexStr); |
| 324 | } |
| 325 | x += dataWidthcxx . . $ HexViewer#dataWidth.; |
| 326 | |
| 327 | // at extra spacing |
| 328 | if ((j & 3) == 3) x += EXTRA_SPACINGcxx . . $ EXTRA_SPACING.; |
| 329 | if ((j & 7) == 7) x += EXTRA_SPACINGcxx . . $ EXTRA_SPACING.; |
| 330 | } |
| 331 | |
| 332 | // print characters |
| 333 | x += charWidthcxx . . $ HexViewer#charWidth.; |
| 334 | for (int j = 0; j < horBytescxx . . $ HexViewer#horBytes.; ++j) { |
| 335 | if (address + j >= debuggableSizecxx . . $ HexViewer#debuggableSize.) break; |
| 336 | uint8_tcxx . . $ uint8_t# chr = hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + j]; |
| 337 | if (chr < 32 || chr > 127) chr = '.'; |
| 338 | // draw marker if needed |
| 339 | if (useMarkercxx . . $ HexViewer#useMarker. || beingEditedcxx . . $ HexViewer#beingEdited.) { |
| 340 | QRectcxx . . $ QRect# bcxx . . $ QRect#QRect(2261ffe5112eab06).(x, y, charWidthcxx . . $ HexViewer#charWidth., lineHeightcxx . . $ HexViewer#lineHeight.); |
| 341 | if ((address + j) == hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) { |
| 342 | p.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(b, hasFocuscxx . . $ HexViewer#hasFocus. ? Qtcxx . . $ Qt/::cyancxx . . $ Qt/cyan. |
| 343 | : Qtcxx . . $ Qt/::lightGraycxx . . $ Qt/lightGray.); |
| 344 | } |
| 345 | // are we being edited ?? |
| 346 | if (hasFocuscxx . . $ HexViewer#hasFocus. && isEditablecxx . . $ HexViewer#isEditable. && editedCharscxx . . $ HexViewer#editedChars. && |
| 347 | ((address + j) == hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.)) { |
| 348 | if (beingEditedcxx . . $ HexViewer#beingEdited.) { |
| 349 | p.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(b, Qtcxx . . $ Qt/::darkGreencxx . . $ Qt/darkGreen.); |
| 350 | } else { |
| 351 | p.drawRectcxx . . $ QPainter#drawRect(22ba0428947158b).(b); |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | // determine value colour |
| 356 | if (highlitChangescxx . . $ HexViewer#highlitChanges.) { |
| 357 | QColorcxx . . $ QColor# penClr = palettecxx . . $ QColor#QColor(c396aab421781ee8).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Textcxx . . $ QPalette#Text.); |
| 358 | if (hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + j] != previousHexDatacxx . . $ HexViewer#previousHexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + j]) { |
| 359 | penClr =cxx . . $ QColor#`operator=`(7dc25a5504d99c29). Qtcxx . . $ Qt/::redcxx . . $ Qt/red.; |
| 360 | } |
| 361 | if (((address + j) == hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) && beingEditedcxx . . $ HexViewer#beingEdited. && |
| 362 | (cursorPositioncxx . . $ HexViewer#cursorPosition. == 0)) { |
| 363 | penClr =cxx . . $ QColor#`operator=`(7dc25a5504d99c29). Qtcxx . . $ Qt/::whitecxx . . $ Qt/white.; |
| 364 | } |
| 365 | p.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(penClr); |
| 366 | } |
| 367 | p.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(x, y + a, QStringcxx . . $ QString#QString(f2c90172ce699d92).(chrcxx . . $ QChar#QChar(f349c77f591a7878).)); |
| 368 | x += charWidthcxx . . $ HexViewer#charWidth.; |
| 369 | } |
| 370 | |
| 371 | y += lineHeightcxx . . $ HexViewer#lineHeight.; |
| 372 | address += horBytescxx . . $ HexViewer#horBytes.; |
| 373 | if (address >= debuggableSizecxx . . $ HexViewer#debuggableSize.) break; |
| 374 | } |
| 375 | // copy the new values to the old-values buffer |
| 376 | if (debuggableSizecxx . . $ HexViewer#debuggableSize.) { // because memcpy of nullptr is undefined, even if copying zero bytes |
| 377 | memcpy(previousHexDatacxx . . $ HexViewer#previousHexData..datacxx . . $ std/vector#data(258ee1c9e0a18a5c).(), hexDatacxx . . $ HexViewer#hexData..datacxx . . $ std/vector#data(258ee1c9e0a18a5c).(), debuggableSizecxx . . $ HexViewer#debuggableSize.); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | void HexViewercxx . . $ HexViewer#::setDebuggablecxx . . $ HexViewer#setDebuggable(29ed8fcd127906b1).(const QStringcxx . . $ QString#& name, int size) |
| 382 | { |
| 383 | debuggableSizecxx . . $ HexViewer#debuggableSize. = size; |
| 384 | hexDatacxx . . $ HexViewer#hexData..assigncxx . . $ std/vector#assign(3804226c8c0acbc3).(size, 0); |
| 385 | previousHexDatacxx . . $ HexViewer#previousHexData..assigncxx . . $ std/vector#assign(3804226c8c0acbc3).(size, 0); |
| 386 | if (size) { |
| 387 | debuggableNamecxx . . $ HexViewer#debuggableName. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). name; |
| 388 | addressLengthcxx . . $ HexViewer#addressLength. = 2 * int(ceil(log(double(size)) / log(2.0) / 8)); |
| 389 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. = 0; |
| 390 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = 0; |
| 391 | settingsChangedcxx . . $ HexViewer#settingsChanged(49f6e7a06ebc5aa8).(); |
| 392 | } else { |
| 393 | debuggableNamecxx . . $ HexViewer#debuggableName..clearcxx . . $ QString#clear(49f6e7a06ebc5aa8).(); |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | void HexViewercxx . . $ HexViewer#::scrollBarChangedcxx . . $ HexViewer#scrollBarChanged(d4f767463ce0a6b3).(int addr) |
| 398 | { |
| 399 | int start = addr * horBytescxx . . $ HexViewer#horBytes.; |
| 400 | if (start == hexTopAddresscxx . . $ HexViewer#hexTopAddress.) { |
| 401 | // nothing changed or a callback since we changed the value to |
| 402 | // the current hexTopAddress |
| 403 | return; |
| 404 | } |
| 405 | |
| 406 | if (!useMarkercxx . . $ HexViewer#useMarker.) { |
| 407 | setTopLocationcxx . . $ HexViewer#setTopLocation(d4f767463ce0a6b3).(addr * horBytescxx . . $ HexViewer#horBytes.); |
| 408 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! locationChangedcxx . . $ HexViewer#locationChanged(d4f767463ce0a6b3).(addr * horBytescxx . . $ HexViewer#horBytes.); |
| 409 | } else { |
| 410 | //maybe marker is still "fully" visible? |
| 411 | int size = horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 412 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. = start; |
| 413 | if ((start > hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) || ((start + size -1) < hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.)) { |
| 414 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = (hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. % horBytescxx . . $ HexViewer#horBytes.) + |
| 415 | ((start < hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) ? size - horBytescxx . . $ HexViewer#horBytes. : 0); |
| 416 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. += start; |
| 417 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! locationChangedcxx . . $ HexViewer#locationChanged(d4f767463ce0a6b3).(hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.); |
| 418 | } |
| 419 | refreshcxx . . $ HexViewer#refresh(49f6e7a06ebc5aa8).(); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | void HexViewercxx . . $ HexViewer#::setLocationcxx . . $ HexViewer#setLocation(d4f767463ce0a6b3).(int addr) |
| 424 | { |
| 425 | if (!useMarkercxx . . $ HexViewer#useMarker.) { |
| 426 | setTopLocationcxx . . $ HexViewer#setTopLocation(d4f767463ce0a6b3).(addr); |
| 427 | } else { |
| 428 | // check if newmarker is in fully visible lines, |
| 429 | // if so we do not change hexTopAddress |
| 430 | if (addr != hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.) { |
| 431 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! locationChangedcxx . . $ HexViewer#locationChanged(d4f767463ce0a6b3).(addr); |
| 432 | } |
| 433 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = addr; |
| 434 | int size = horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 435 | if ((addr < hexTopAddresscxx . . $ HexViewer#hexTopAddress.) || (addr >= (hexTopAddresscxx . . $ HexViewer#hexTopAddress.+size))) { |
| 436 | setTopLocationcxx . . $ HexViewer#setTopLocation(d4f767463ce0a6b3).(addr); |
| 437 | } |
| 438 | refreshcxx . . $ HexViewer#refresh(49f6e7a06ebc5aa8).(); |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | void HexViewercxx . . $ HexViewer#::setTopLocationcxx . . $ HexViewer#setTopLocation(d4f767463ce0a6b3).(int addr) |
| 443 | { |
| 444 | if (debuggableNamecxx . . $ HexViewer#debuggableName..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 445 | return; |
| 446 | } |
| 447 | int start = horBytescxx . . $ HexViewer#horBytes. * int(addr / horBytescxx . . $ HexViewer#horBytes.); |
| 448 | if (!waitingForDatacxx . . $ HexViewer#waitingForData. || (start != hexTopAddresscxx . . $ HexViewer#hexTopAddress.)) { |
| 449 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. = start; |
| 450 | refreshcxx . . $ HexViewer#refresh(49f6e7a06ebc5aa8).(); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | void HexViewercxx . . $ HexViewer#::hexdataTransferedcxx . . $ HexViewer#hexdataTransfered(ec2c4844b45cf9f6).(HexRequestcxx . . $ HexRequest#* r) |
| 455 | { |
| 456 | transferCancelledcxx . . $ HexViewer#transferCancelled(ec2c4844b45cf9f6).(r); |
| 457 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 458 | } |
| 459 | |
| 460 | void HexViewercxx . . $ HexViewer#::transferCancelledcxx . . $ HexViewer#transferCancelled(ec2c4844b45cf9f6).(HexRequestcxx . . $ HexRequest#* r) |
| 461 | { |
| 462 | delete r; |
| 463 | waitingForDatacxx . . $ HexViewer#waitingForData. = false; |
| 464 | // check whether a new value is available |
| 465 | if (int(hexTopAddresscxx . . $ HexViewer#hexTopAddress. / horBytescxx . . $ HexViewer#horBytes.) != vertScrollBarcxx . . $ HexViewer#vertScrollBar.->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).()) { |
| 466 | vertScrollBarcxx . . $ HexViewer#vertScrollBar.->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(hexTopAddresscxx . . $ HexViewer#hexTopAddress. / horBytescxx . . $ HexViewer#horBytes.); |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | void HexViewercxx . . $ HexViewer#::refreshcxx . . $ HexViewer#refresh(49f6e7a06ebc5aa8).() |
| 471 | { |
| 472 | // calculate data request |
| 473 | int size = horBytescxx . . $ HexViewer#horBytes. * (visibleLinescxx . . $ HexViewer#visibleLines. + partialBottomLinecxx . . $ HexViewer#partialBottomLine.); |
| 474 | size = std::mincxx . . $ std/min(2a338fce5842aa6a).(size, debuggableSizecxx . . $ HexViewer#debuggableSize. - hexTopAddresscxx . . $ HexViewer#hexTopAddress.); |
| 475 | |
| 476 | // send data request |
| 477 | auto* req = new HexRequestcxx . . $ HexRequest#HexRequest(b209aadf4a971df4).( |
| 478 | debuggableNamecxx . . $ HexViewer#debuggableName., hexTopAddresscxx . . $ HexViewer#hexTopAddress., size, &hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).hexTopAddresscxx . . $ HexViewer#hexTopAddress.], *this); |
| 479 | CommClientcxx . . $ CommClient#::instancecxx . . $ CommClient#instance(8cca9d0b1334f685).().sendCommandcxx . . $ CommClient#sendCommand(6fe5d9dff2ed3a64).(req); |
| 480 | waitingForDatacxx . . $ HexViewer#waitingForData. = true; |
| 481 | } |
| 482 | |
| 483 | void HexViewercxx . . $ HexViewer#::keyPressEventcxx . . $ HexViewer#keyPressEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent#* e) |
| 484 | { |
| 485 | // don't hanlde if not interactive |
| 486 | if ((!beingEditedcxx . . $ HexViewer#beingEdited. && !useMarkercxx . . $ HexViewer#useMarker.) || !isInteractivecxx . . $ HexViewer#isInteractive.) { |
| 487 | QFramecxx . . $ QFrame#::keyPressEventcxx . . $ QWidget#keyPressEvent(c92999c1b6b09cc0).(e); |
| 488 | return; |
| 489 | } |
| 490 | |
| 491 | bool setValue = false; |
| 492 | int newAddress = hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.; |
| 493 | // entering a new digit ? |
| 494 | // for now hex only, do we need decimal entry also ?? |
| 495 | if (!editedCharscxx . . $ HexViewer#editedChars. && |
| 496 | ((e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() >= Qtcxx . . $ Qt/::Key_0cxx . . $ Qt/Key_0. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() <= Qtcxx . . $ Qt/::Key_9cxx . . $ Qt/Key_9.) || |
| 497 | (e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() >= Qtcxx . . $ Qt/::Key_Acxx . . $ Qt/Key_A. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() <= Qtcxx . . $ Qt/::Key_Fcxx . . $ Qt/Key_F.))) { |
| 498 | // calculate numercial value |
| 499 | int v = e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() - Qtcxx . . $ Qt/::Key_0cxx . . $ Qt/Key_0.; |
| 500 | if (v > 9) v -= Qtcxx . . $ Qt/::Key_Acxx . . $ Qt/Key_A. - Qtcxx . . $ Qt/::Key_0cxx . . $ Qt/Key_0. - 10; |
| 501 | if (beingEditedcxx . . $ HexViewer#beingEdited.) { |
| 502 | editValuecxx . . $ HexViewer#editValue. = (editValuecxx . . $ HexViewer#editValue. << 4) + v; |
| 503 | ++cursorPositioncxx . . $ HexViewer#cursorPosition.; |
| 504 | if (cursorPositioncxx . . $ HexViewer#cursorPosition. == 2) { |
| 505 | setValue = true; |
| 506 | ++newAddress; |
| 507 | } |
| 508 | } else { |
| 509 | editValuecxx . . $ HexViewer#editValue. = v; |
| 510 | beingEditedcxx . . $ HexViewer#beingEdited. = true; |
| 511 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 1; |
| 512 | } |
| 513 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Rightcxx . . $ Qt/Key_Right.) { |
| 514 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 515 | ++newAddress; |
| 516 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 517 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Leftcxx . . $ Qt/Key_Left.) { |
| 518 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 519 | --newAddress; |
| 520 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 521 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Upcxx . . $ Qt/Key_Up.) { |
| 522 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 523 | newAddress -= horBytescxx . . $ HexViewer#horBytes.; |
| 524 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 525 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Downcxx . . $ Qt/Key_Down.) { |
| 526 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 527 | newAddress += horBytescxx . . $ HexViewer#horBytes.; |
| 528 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 529 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Homecxx . . $ Qt/Key_Home.) { |
| 530 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 531 | newAddress = 0; |
| 532 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 533 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_PageUpcxx . . $ Qt/Key_PageUp.) { |
| 534 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 535 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. -= horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 536 | newAddress -= horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 537 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 538 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_PageDowncxx . . $ Qt/Key_PageDown.) { |
| 539 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 540 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. += horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 541 | newAddress += horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 542 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 543 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Endcxx . . $ Qt/Key_End.) { |
| 544 | setValue = beingEditedcxx . . $ HexViewer#beingEdited. & !editedCharscxx . . $ HexViewer#editedChars.; |
| 545 | newAddress = debuggableSizecxx . . $ HexViewer#debuggableSize. - 1; |
| 546 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 547 | } else if (useMarkercxx . . $ HexViewer#useMarker. && e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Backspacecxx . . $ Qt/Key_Backspace.) { |
| 548 | editedCharscxx . . $ HexViewer#editedChars. = !editedCharscxx . . $ HexViewer#editedChars.; |
| 549 | } else if (e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Returncxx . . $ Qt/Key_Return. || e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Entercxx . . $ Qt/Key_Enter.) { |
| 550 | if (beingEditedcxx . . $ HexViewer#beingEdited.) |
| 551 | setValue = true; |
| 552 | else |
| 553 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 554 | if (editedCharscxx . . $ HexViewer#editedChars.) |
| 555 | editValuecxx . . $ HexViewer#editValue. = previousHexDatacxx . . $ HexViewer#previousHexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.]; |
| 556 | newAddress++; |
| 557 | } else if (e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Shiftcxx . . $ Qt/Key_Shift. || |
| 558 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Controlcxx . . $ Qt/Key_Control. || |
| 559 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Metacxx . . $ Qt/Key_Meta. || |
| 560 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Altcxx . . $ Qt/Key_Alt. || |
| 561 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_AltGrcxx . . $ Qt/Key_AltGr. || |
| 562 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_CapsLockcxx . . $ Qt/Key_CapsLock. || |
| 563 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_NumLockcxx . . $ Qt/Key_NumLock. || |
| 564 | e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_ScrollLockcxx . . $ Qt/Key_ScrollLock.) { |
| 565 | // do nothing for these keys if editing chars |
| 566 | // if not editing chars they do nothing by deafult :-) |
| 567 | } else if (e->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() == Qtcxx . . $ Qt/::Key_Escapecxx . . $ Qt/Key_Escape.) { |
| 568 | beingEditedcxx . . $ HexViewer#beingEdited. = false; |
| 569 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 570 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 571 | return; |
| 572 | } else if (editedCharscxx . . $ HexViewer#editedChars.) { |
| 573 | editValuecxx . . $ HexViewer#editValue. = static_cast<uint8_tcxx . . $ uint8_t#>((e->textcxx . . $ QKeyEvent#text(6ef7b6c27b00b43d).().toLatin1cxx . . $ QString#toLatin1(7c2073558a834e49).())[cxx . . $ QByteArray#`operator[]`(6eaff86c84670f1a).0]); |
| 574 | setValue = true; |
| 575 | ++newAddress; |
| 576 | } else { |
| 577 | QFramecxx . . $ QFrame#::keyPressEventcxx . . $ QWidget#keyPressEvent(c92999c1b6b09cc0).(e); |
| 578 | return; |
| 579 | } |
| 580 | |
| 581 | //apply changes |
| 582 | if (setValue) { |
| 583 | //TODO actually write the values to openMSX memory |
| 584 | //for now we change the value in our local buffer |
| 585 | previousHexDatacxx . . $ HexViewer#previousHexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).hexMarkAddresscxx . . $ HexViewer#hexMarkAddress.] = char(editValuecxx . . $ HexViewer#editValue.); |
| 586 | auto* req = new WriteDebugBlockCommandcxx . . $ WriteDebugBlockCommand#( |
| 587 | debuggableNamecxx . . $ HexViewer#debuggableName., hexMarkAddresscxx . . $ HexViewer#hexMarkAddress., 1, previousHexDatacxx . . $ HexViewer#previousHexData..datacxx . . $ std/vector#data(258ee1c9e0a18a5c).()); |
| 588 | CommClientcxx . . $ CommClient#::instancecxx . . $ CommClient#instance(8cca9d0b1334f685).().sendCommandcxx . . $ CommClient#sendCommand(6fe5d9dff2ed3a64).(req); |
| 589 | |
| 590 | editValuecxx . . $ HexViewer#editValue. = 0; |
| 591 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 592 | beingEditedcxx . . $ HexViewer#beingEdited. = editedCharscxx . . $ HexViewer#editedChars.; // keep editing if we were inputing chars |
| 593 | refreshcxx . . $ HexViewer#refresh(49f6e7a06ebc5aa8).(); |
| 594 | } |
| 595 | |
| 596 | // indicate key Event handled |
| 597 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 598 | |
| 599 | // Move Marker if needed |
| 600 | if ((editedCharscxx . . $ HexViewer#editedChars. || useMarkercxx . . $ HexViewer#useMarker.) && (hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. != newAddress)) { |
| 601 | if (newAddress < 0) newAddress += debuggableSizecxx . . $ HexViewer#debuggableSize.; |
| 602 | if (newAddress >= debuggableSizecxx . . $ HexViewer#debuggableSize.) newAddress -= debuggableSizecxx . . $ HexViewer#debuggableSize.; |
| 603 | // influencing hexTopAddress during Key_PageUp/Down might need following 2 lines. |
| 604 | if (hexTopAddresscxx . . $ HexViewer#hexTopAddress. < 0) hexTopAddresscxx . . $ HexViewer#hexTopAddress. += debuggableSizecxx . . $ HexViewer#debuggableSize.; |
| 605 | if (hexTopAddresscxx . . $ HexViewer#hexTopAddress. >= debuggableSizecxx . . $ HexViewer#debuggableSize.) hexTopAddresscxx . . $ HexViewer#hexTopAddress. -= debuggableSizecxx . . $ HexViewer#debuggableSize.; |
| 606 | |
| 607 | // Make scrolling downwards using cursors more "intuitive" |
| 608 | int addr = hexTopAddresscxx . . $ HexViewer#hexTopAddress. + horBytescxx . . $ HexViewer#horBytes. * visibleLinescxx . . $ HexViewer#visibleLines.; |
| 609 | if ((newAddress >= addr) && (newAddress <= (addr + horBytescxx . . $ HexViewer#horBytes.))) { |
| 610 | hexTopAddresscxx . . $ HexViewer#hexTopAddress. += horBytescxx . . $ HexViewer#horBytes.; |
| 611 | } |
| 612 | if (useMarkercxx . . $ HexViewer#useMarker.) { |
| 613 | setLocationcxx . . $ HexViewer#setLocation(d4f767463ce0a6b3).(newAddress); |
| 614 | } else { |
| 615 | //we can only get here when not using Markers but if we |
| 616 | //are typing in chars in charEdit mode, so scrolling |
| 617 | //one line is covered in code above |
| 618 | hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = newAddress; |
| 619 | refreshcxx . . $ HexViewer#refresh(49f6e7a06ebc5aa8).(); |
| 620 | } |
| 621 | } else { |
| 622 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | int HexViewercxx . . $ HexViewer#::coorToOffsetcxx . . $ HexViewer#coorToOffset(adc74905ab378dc7).(int x, int y) const |
| 627 | { |
| 628 | int offset = -1; |
| 629 | if (x >= xDatacxx . . $ HexViewer#xData. && x < rightValuePoscxx . . $ HexViewer#rightValuePos.) { |
| 630 | offset = 0; |
| 631 | x -= xDatacxx . . $ HexViewer#xData.; |
| 632 | while (x > 4*dataWidthcxx . . $ HexViewer#dataWidth.) { |
| 633 | offset += 4; |
| 634 | x -= 4*dataWidthcxx . . $ HexViewer#dataWidth. + EXTRA_SPACINGcxx . . $ EXTRA_SPACING.; |
| 635 | if (offset % 8 == 0) x -= EXTRA_SPACINGcxx . . $ EXTRA_SPACING.; |
| 636 | } |
| 637 | offset += x / dataWidthcxx . . $ HexViewer#dataWidth.; |
| 638 | } else if (x >= xCharcxx . . $ HexViewer#xChar. && x < rightCharPoscxx . . $ HexViewer#rightCharPos.) { |
| 639 | offset = (x - xCharcxx . . $ HexViewer#xChar.) / charWidthcxx . . $ HexViewer#charWidth.; |
| 640 | } |
| 641 | int yMaxOffset = frameTcxx . . $ HexViewer#frameT. + (visibleLinescxx . . $ HexViewer#visibleLines.+partialBottomLinecxx . . $ HexViewer#partialBottomLine.) * lineHeightcxx . . $ HexViewer#lineHeight.; |
| 642 | if (offset >= 0 && y < yMaxOffset) { |
| 643 | offset += horBytescxx . . $ HexViewer#horBytes. * ((y - frameTcxx . . $ HexViewer#frameT.) / lineHeightcxx . . $ HexViewer#lineHeight.); |
| 644 | } |
| 645 | return offset; |
| 646 | } |
| 647 | |
| 648 | bool HexViewercxx . . $ HexViewer#::eventcxx . . $ HexViewer#event(f123fa2ce489f0bd).(QEventcxx . . $ QEvent#* e) |
| 649 | { |
| 650 | if (e->typecxx . . $ QEvent#type(916a8de57f4d422b).() != QEventcxx . . $ QEvent#::ToolTipcxx . . $ QEvent#ToolTip.) { |
| 651 | return QFramecxx . . $ QFrame#::eventcxx . . $ QFrame#event(f123fa2ce489f0bd).(e); |
| 652 | } |
| 653 | |
| 654 | // calculate address for tooltip |
| 655 | auto* helpEvent = static_cast<QHelpEventcxx . . $ QHelpEvent#*>(e); |
| 656 | int offset = coorToOffsetcxx . . $ HexViewer#coorToOffset(adc74905ab378dc7).(helpEvent->xcxx . . $ QHelpEvent#x(455f465bc33b4cdf).(), helpEvent->ycxx . . $ QHelpEvent#y(455f465bc33b4cdf).()); |
| 657 | if (offset >= 0 && (hexTopAddresscxx . . $ HexViewer#hexTopAddress. + offset) < debuggableSizecxx . . $ HexViewer#debuggableSize.) { |
| 658 | // create text with binary and decimal values |
| 659 | int address = hexTopAddresscxx . . $ HexViewer#hexTopAddress. + offset; |
| 660 | uint8_tcxx . . $ uint8_t# chr = hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address]; |
| 661 | QStringcxx . . $ QString# text = QStringcxx . . $ QString#QString(85c52e162fed56f9).("Address: %1").argcxx . . $ QString#arg(bc823072288cbbb5).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(64ab2ed17cc11715).(address, addressLengthcxx . . $ HexViewer#addressLength., 16, QCharcxx . . $ QChar#('0')).toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).()); |
| 662 | |
| 663 | // print 8 bit values |
| 664 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("\nBinary: %1 %2") |
| 665 | .argcxx . . $ QString#arg(64ab2ed17cc11715).(chr >> 4, 4, 2, QCharcxx . . $ QChar#('0')) |
| 666 | .argcxx . . $ QString#arg(64ab2ed17cc11715).(chr & 0x000F, 4, 2, QCharcxx . . $ QChar#('0')); |
| 667 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("\nDecimal: %1").argcxx . . $ QString#arg(64ab2ed17cc11715).(chr); |
| 668 | |
| 669 | // print 16 bit values if possible |
| 670 | if ((address + 1) < debuggableSizecxx . . $ HexViewer#debuggableSize.) { |
| 671 | unsigned wd = chr; |
| 672 | wd += 256 * hexDatacxx . . $ HexViewer#hexData.[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).address + 1]; |
| 673 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("\n\nWord: %1").argcxx . . $ QString#arg(bc823072288cbbb5).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("%1").argcxx . . $ QString#arg(173a29139b43af1f).(wd, 4, 16, QCharcxx . . $ QChar#('0')).toUppercxx . . $ QString#toUpper(30b3b70527b1c61a).()); |
| 674 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("\nBinary: %1 %2 %3 %4") |
| 675 | .argcxx . . $ QString#arg(173a29139b43af1f).((wd & 0xF000) >> 12, 4, 2, QCharcxx . . $ QChar#('0')) |
| 676 | .argcxx . . $ QString#arg(173a29139b43af1f).((wd & 0x0F00) >> 8, 4, 2, QCharcxx . . $ QChar#('0')) |
| 677 | .argcxx . . $ QString#arg(173a29139b43af1f).((wd & 0x00F0) >> 4, 4, 2, QCharcxx . . $ QChar#('0')) |
| 678 | .argcxx . . $ QString#arg(173a29139b43af1f).((wd & 0x000F) >> 0, 4, 2, QCharcxx . . $ QChar#('0')); |
| 679 | text +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).("\nDecimal: %1").argcxx . . $ QString#arg(173a29139b43af1f).(wd); |
| 680 | } |
| 681 | QToolTipcxx . . $ QToolTip#::showTextcxx . . $ QToolTip#showText(e9f52f9969479d3b).(helpEvent->globalPoscxx . . $ QHelpEvent#globalPos(6de9f7a200ca710c).(), text); |
| 682 | } else { |
| 683 | QToolTipcxx . . $ QToolTip#::hideTextcxx . . $ QToolTip#hideText(49f6e7a06ebc5aa8).(); |
| 684 | } |
| 685 | return QFramecxx . . $ QFrame#::eventcxx . . $ QFrame#event(f123fa2ce489f0bd).(e); |
| 686 | } |
| 687 | |
| 688 | void HexViewercxx . . $ HexViewer#::mousePressEventcxx . . $ HexViewer#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent#* e) |
| 689 | { |
| 690 | if (e->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton. && isInteractivecxx . . $ HexViewer#isInteractive.) { |
| 691 | int offset=coorToOffsetcxx . . $ HexViewer#coorToOffset(adc74905ab378dc7).(e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).(), e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).()); |
| 692 | if (offset >= 0) { |
| 693 | int addr = hexTopAddresscxx . . $ HexViewer#hexTopAddress. + offset; |
| 694 | if (useMarkercxx . . $ HexViewer#useMarker. && (hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. != addr)) { |
| 695 | setLocationcxx . . $ HexViewer#setLocation(d4f767463ce0a6b3).(addr); |
| 696 | } else { |
| 697 | if (!useMarkercxx . . $ HexViewer#useMarker.) hexMarkAddresscxx . . $ HexViewer#hexMarkAddress. = addr; |
| 698 | editValuecxx . . $ HexViewer#editValue. = 0; |
| 699 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 700 | beingEditedcxx . . $ HexViewer#beingEdited. = isEditablecxx . . $ HexViewer#isEditable.; |
| 701 | } |
| 702 | editedCharscxx . . $ HexViewer#editedChars. = (e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).() >= xCharcxx . . $ HexViewer#xChar.); |
| 703 | } |
| 704 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | void HexViewercxx . . $ HexViewer#::focusInEventcxx . . $ HexViewer#focusInEvent(897a5ce4b6676619).(QFocusEventcxx . . $ QFocusEvent#* /*e*/) |
| 709 | { |
| 710 | hasFocuscxx . . $ HexViewer#hasFocus. = true; |
| 711 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 712 | } |
| 713 | |
| 714 | void HexViewercxx . . $ HexViewer#::focusOutEventcxx . . $ HexViewer#focusOutEvent(897a5ce4b6676619).(QFocusEventcxx . . $ QFocusEvent#* e) |
| 715 | { |
| 716 | if (e->lostFocuscxx . . $ QFocusEvent#lostFocus(50ce9a9e25b4a850).()) { |
| 717 | editValuecxx . . $ HexViewer#editValue. = 0; |
| 718 | cursorPositioncxx . . $ HexViewer#cursorPosition. = 0; |
| 719 | beingEditedcxx . . $ HexViewer#beingEdited. = false; |
| 720 | hasFocuscxx . . $ HexViewer#hasFocus. = false; |
| 721 | } |
| 722 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 723 | } |