GUI: getCharWidth in AbstractTable + display patched bytes
This commit is contained in:
		
							parent
							
								
									b8754441d7
								
							
						
					
					
						commit
						4529e210c9
					
				|  | @ -825,7 +825,6 @@ QString AbstractTableView::getColTitle(int index) | |||
|     return ""; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /************************************************************************************
 | ||||
|                                 Getter & Setter | ||||
| ************************************************************************************/ | ||||
|  | @ -834,19 +833,16 @@ int_t AbstractTableView::getRowCount() | |||
|     return mRowCount; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getColumnCount() | ||||
| { | ||||
|     return mColumnList.size(); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getRowHeight() | ||||
| { | ||||
|     return mRowHeight; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getColumnWidth(int index) | ||||
| { | ||||
|     if(index < 0) | ||||
|  | @ -870,13 +866,11 @@ int AbstractTableView::getColumnWidth(int index) | |||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void AbstractTableView::setColumnWidth(int index, int width) | ||||
| { | ||||
|     mColumnList[index].width = width; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getHeaderHeight() | ||||
| { | ||||
|     if(mHeader.isVisible == true) | ||||
|  | @ -885,25 +879,21 @@ int AbstractTableView::getHeaderHeight() | |||
|         return 0; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getTableHeigth() | ||||
| { | ||||
|     return this->height() - getHeaderHeight(); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getGuiState() | ||||
| { | ||||
|     return mGuiState; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int AbstractTableView::getNbrOfLineToPrint() | ||||
| { | ||||
|     return mNbrOfLineToPrint; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void AbstractTableView::setNbrOfLineToPrint(int parNbrOfLineToPrint) | ||||
| { | ||||
|     mNbrOfLineToPrint = parNbrOfLineToPrint; | ||||
|  | @ -914,6 +904,10 @@ void AbstractTableView::setShowHeader(bool show) | |||
|     mHeader.isVisible=show; | ||||
| } | ||||
| 
 | ||||
| int AbstractTableView::getCharWidth() | ||||
| { | ||||
|     return QFontMetrics(this->font()).width(QChar(' ')); | ||||
| } | ||||
| 
 | ||||
| /************************************************************************************
 | ||||
|                            Table Offset Management | ||||
|  |  | |||
|  | @ -69,6 +69,7 @@ public: | |||
|     int getNbrOfLineToPrint(); | ||||
|     void setNbrOfLineToPrint(int parNbrOfLineToPrint); | ||||
|     void setShowHeader(bool show); | ||||
|     int getCharWidth(); | ||||
| 
 | ||||
|     // Table Offset Management
 | ||||
|     int_t getTableOffset(); | ||||
|  |  | |||
|  | @ -26,11 +26,9 @@ Disassembly::Disassembly(QWidget *parent) : AbstractTableView(parent) | |||
| 
 | ||||
|     setRowCount(mMemPage->getSize()); | ||||
| 
 | ||||
|     mCharWidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
| 
 | ||||
|     addColumnAt(mCharWidth*2*sizeof(int_t)+8, "", false); //address
 | ||||
|     addColumnAt(mCharWidth*2*12+8, "", false); //bytes
 | ||||
|     addColumnAt(mCharWidth*40, "", false); //disassembly
 | ||||
|     addColumnAt(getCharWidth()*2*sizeof(int_t)+8, "", false); //address
 | ||||
|     addColumnAt(getCharWidth()*2*12+8, "", false); //bytes
 | ||||
|     addColumnAt(getCharWidth()*40, "", false); //disassembly
 | ||||
|     addColumnAt(100, "", false); //comments
 | ||||
| 
 | ||||
|     setShowHeader(false); //hide header
 | ||||
|  | @ -336,12 +334,24 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse | |||
|         int jumpsize = paintJumpsGraphic(painter, x + funcsize, y, wRVA); //jump line
 | ||||
| 
 | ||||
|         //draw bytes
 | ||||
|         painter->setPen(ConfigColor("DisassemblyBytesColor")); | ||||
|         QString wBytes = ""; | ||||
|         for(int i = 0; i < mInstBuffer.at(rowOffset).dump.size(); i++) | ||||
|             wBytes += QString("%1").arg((unsigned char)(mInstBuffer.at(rowOffset).dump.at(i)), 2, 16, QChar('0')).toUpper()+" "; | ||||
| 
 | ||||
|         painter->drawText(QRect(x + jumpsize + funcsize, y, getColumnWidth(col) - jumpsize - funcsize, getRowHeight()), 0, wBytes); | ||||
|         QColor bytesColor = ConfigColor("DisassemblyBytesColor"); | ||||
|         QColor patchedBytesColor = ConfigColor("DisassemblyModifiedBytesColor"); | ||||
|         QList<RichTextPainter::CustomRichText_t> richBytes; | ||||
|         RichTextPainter::CustomRichText_t space; | ||||
|         space.highlight=false; | ||||
|         space.flags=RichTextPainter::FlagNone; | ||||
|         space.text=" "; | ||||
|         RichTextPainter::CustomRichText_t curByte; | ||||
|         curByte.highlight = false; | ||||
|         curByte.flags = RichTextPainter::FlagColor; | ||||
|         for(int i=0; i<mInstBuffer.at(rowOffset).dump.size(); i++) | ||||
|         { | ||||
|             curByte.text = QString("%1").arg((unsigned char)(mInstBuffer.at(rowOffset).dump.at(i)), 2, 16, QChar('0')).toUpper(); | ||||
|             curByte.textColor = DbgFunctions()->PatchGet(cur_addr+i) ? patchedBytesColor : bytesColor; | ||||
|             richBytes.push_back(curByte); | ||||
|             richBytes.push_back(space); | ||||
|         } | ||||
|         RichTextPainter::paintRichText(painter, x + jumpsize + funcsize, y, getColumnWidth(col), getRowHeight(), 0, &richBytes, getCharWidth()); | ||||
|     } | ||||
|     break; | ||||
| 
 | ||||
|  | @ -398,7 +408,7 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse | |||
|         if(DbgGetCommentAt(rvaToVa(mInstBuffer.at(rowOffset).rva), comment)) | ||||
|         { | ||||
|             painter->setPen(ConfigColor("DisassemblyCommentColor")); | ||||
|             int width = QFontMetrics(this->font()).width(comment)+4; | ||||
|             int width = getCharWidth() * QString(comment).length() + 4; | ||||
|             if(width > w) | ||||
|                 width=w; | ||||
|             if(width) | ||||
|  | @ -495,7 +505,7 @@ void Disassembly::mousePressEvent(QMouseEvent* event) | |||
|                     if(rowOffset<mInstBuffer.size()) | ||||
|                     { | ||||
|                         BeaTokenizer::BeaSingleToken token; | ||||
|                         if(BeaTokenizer::TokenFromX(&mInstBuffer.at(rowOffset).tokens, &token, event->x(), mCharWidth)) | ||||
|                         if(BeaTokenizer::TokenFromX(&mInstBuffer.at(rowOffset).tokens, &token, event->x(), getCharWidth())) | ||||
|                         { | ||||
|                             if(BeaTokenizer::IsHighlightableToken(&token) && !BeaTokenizer::TokenEquals(&token, &mHighlightToken)) | ||||
|                                 mHighlightToken=token; | ||||
|  |  | |||
|  | @ -131,7 +131,6 @@ private: | |||
| 
 | ||||
|     QList<HistoryData_t> mVaHistory; | ||||
|     int mCurrentVa; | ||||
|     int mCharWidth; | ||||
|     BeaTokenizer::BeaSingleToken mHighlightToken; | ||||
| 
 | ||||
| protected: | ||||
|  |  | |||
|  | @ -29,6 +29,7 @@ void HexDump::colorsUpdated() | |||
|     backgroundColor=ConfigColor("HexDumpBackgroundColor"); | ||||
|     textColor=ConfigColor("HexDumpTextColor"); | ||||
|     selectionColor=ConfigColor("HexDumpSelectionColor"); | ||||
|     reloadData(); | ||||
| } | ||||
| 
 | ||||
| void HexDump::printDumpAt(int_t parVA, bool select) | ||||
|  | @ -199,7 +200,9 @@ QString HexDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, i | |||
|     else if(mDescriptor.at(col - 1).isData == true) //paint data
 | ||||
|     { | ||||
|         printSelected(painter, rowBase, rowOffset, col, x, y, w, h); | ||||
|         wStr += getString(col - 1, wRva); | ||||
|         QList<RichTextPainter::CustomRichText_t> richText; | ||||
|         getString(col - 1, wRva, &richText); | ||||
|         RichTextPainter::paintRichText(painter, x, y, w, h, 4, &richText, getCharWidth()); | ||||
|     } | ||||
|     else //paint non-data
 | ||||
|     { | ||||
|  | @ -216,7 +219,7 @@ void HexDump::printSelected(QPainter* painter, int_t rowBase, int rowOffset, int | |||
|         int wBytePerRowCount = getBytePerRowCount(); | ||||
|         int_t wRva = (rowBase + rowOffset) * wBytePerRowCount - mByteOffset; | ||||
|         int wItemPixWidth = getItemPixelWidth(mDescriptor.at(col - 1)); | ||||
|         int wCharWidth = QFontMetrics(this->font()).width(QChar('C')); | ||||
|         int wCharWidth = getCharWidth(); | ||||
|         if(wItemPixWidth == wCharWidth) | ||||
|             x += 4; | ||||
|         int wSelectionX; | ||||
|  | @ -287,7 +290,7 @@ bool HexDump::isSelected(int_t rva) | |||
|         return false; | ||||
| } | ||||
| 
 | ||||
| QString HexDump::getString(int col, int_t rva) | ||||
| void HexDump::getString(int col, int_t rva, QList<RichTextPainter::CustomRichText_t>* richText) | ||||
| { | ||||
|     int wI; | ||||
|     QString wStr = ""; | ||||
|  | @ -302,6 +305,12 @@ QString HexDump::getString(int col, int_t rva) | |||
| 
 | ||||
|     mMemPage->read(wData, rva, wBufferByteCount); | ||||
| 
 | ||||
|     RichTextPainter::CustomRichText_t curData; | ||||
|     curData.highlight = false; | ||||
|     curData.flags = RichTextPainter::FlagColor; | ||||
| 
 | ||||
|     QColor highlightColor = ConfigColor("HexDumpModifiedBytesColor"); | ||||
| 
 | ||||
|     for(wI = 0; wI < mDescriptor.at(col).itemCount && (rva + wI) < (int_t)mMemPage->getSize(); wI++) | ||||
|     { | ||||
|         int maxLen = getStringMaxLength(mDescriptor.at(col).data); | ||||
|  | @ -309,14 +318,17 @@ QString HexDump::getString(int col, int_t rva) | |||
|         if(!maxLen) | ||||
|             append=""; | ||||
|         if((rva + wI + wByteCount - 1) < (int_t)mMemPage->getSize()) | ||||
|             wStr += toString(mDescriptor.at(col).data, (void*)(wData + wI * wByteCount)).rightJustified(maxLen, ' ') + append; | ||||
|             wStr = toString(mDescriptor.at(col).data, (void*)(wData + wI * wByteCount)).rightJustified(maxLen, ' ') + append; | ||||
|         else | ||||
|             wStr += QString("?").rightJustified(maxLen, ' ') + append; | ||||
|             wStr = QString("?").rightJustified(maxLen, ' ') + append; | ||||
|         curData.text = wStr; | ||||
|         int_t start = rvaToVa(rva + wI * wByteCount); | ||||
|         int_t end = start + wByteCount - 1; | ||||
|         curData.textColor = DbgFunctions()->PatchInRange(start, end) ? highlightColor : textColor; | ||||
|         richText->push_back(curData); | ||||
|     } | ||||
| 
 | ||||
|     delete[] wData; | ||||
| 
 | ||||
|     return wStr; | ||||
| } | ||||
| 
 | ||||
| QString HexDump::toString(DataDescriptor_t desc, void* data) //convert data to string
 | ||||
|  | @ -845,7 +857,7 @@ int HexDump::getItemIndexFromX(int x) | |||
|         int wRelativeX = x - wColStartingPos; | ||||
| 
 | ||||
|         int wItemPixWidth = getItemPixelWidth(mDescriptor.at(wColIndex - 1)); | ||||
|         int wCharWidth = QFontMetrics(this->font()).width(QChar('C')); | ||||
|         int wCharWidth = getCharWidth(); | ||||
|         if(wItemPixWidth == wCharWidth) | ||||
|             wRelativeX -= 4; | ||||
| 
 | ||||
|  | @ -885,7 +897,7 @@ int HexDump::getBytePerRowCount() | |||
| 
 | ||||
| int HexDump::getItemPixelWidth(ColumnDescriptor_t desc) | ||||
| { | ||||
|     int wCharWidth = QFontMetrics(this->font()).width(QChar('C')); | ||||
|     int wCharWidth = getCharWidth(); | ||||
|     int wItemPixWidth = getStringMaxLength(desc.data) * wCharWidth + wCharWidth; | ||||
| 
 | ||||
|     return wItemPixWidth; | ||||
|  | @ -915,7 +927,7 @@ void HexDump::clearDescriptors() | |||
| { | ||||
|     deleteAllColumns(); | ||||
|     mDescriptor.clear(); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     addColumnAt(8+charwidth*2*sizeof(uint_t), "Address", false); //address
 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| #include "QBeaEngine.h" | ||||
| #include "Bridge.h" | ||||
| #include <sstream> | ||||
| #include "RichTextPainter.h" | ||||
| 
 | ||||
| class HexDump : public AbstractTableView | ||||
| { | ||||
|  | @ -101,7 +102,7 @@ public: | |||
|     int_t getSelectionEnd(); | ||||
|     bool isSelected(int_t rva); | ||||
| 
 | ||||
|     QString getString(int col, int_t rva); | ||||
|     void getString(int col, int_t rva, QList<RichTextPainter::CustomRichText_t>* richText); | ||||
|     int getSizeOf(DataSize_e size); | ||||
| 
 | ||||
|     QString toString(DataDescriptor_t desc, void *data); | ||||
|  |  | |||
|  | @ -40,10 +40,7 @@ void ReferenceView::setupContextMenu() | |||
| 
 | ||||
| void ReferenceView::addColumnAt(int width, QString title) | ||||
| { | ||||
|     QFont wFont("Monospace", 8); | ||||
|     wFont.setStyleHint(QFont::Monospace); | ||||
|     wFont.setFixedPitch(true); | ||||
|     int charwidth=QFontMetrics(wFont).width(QChar(' ')); | ||||
|     int charwidth=mList->getCharWidth(); | ||||
|     if(width) | ||||
|         width=charwidth*width+8; | ||||
|     else | ||||
|  |  | |||
|  | @ -365,7 +365,7 @@ void StdTable::copyTableSlot() | |||
|     } | ||||
|     else | ||||
|     { | ||||
|         int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|         int charwidth=getCharWidth(); | ||||
|         for(int i=0; i<colCount; i++) | ||||
|         { | ||||
|             if(i) | ||||
|  |  | |||
|  | @ -418,6 +418,7 @@ void AppearanceDialog::colorInfoListInit() | |||
|     colorInfoListAppend("Background", "DisassemblyBackgroundColor", ""); | ||||
|     colorInfoListAppend("Selection", "DisassemblySelectionColor", ""); | ||||
|     colorInfoListAppend("Bytes", "DisassemblyBytesColor", ""); | ||||
|     colorInfoListAppend("Modified Bytes", "DisassemblyModifiedBytesColor", ""); | ||||
| #ifdef _WIN64 | ||||
|     colorInfoListAppend("RIP", "DisassemblyCipColor", "DisassemblyCipBackgroundColor"); | ||||
| #else //x86
 | ||||
|  | @ -488,6 +489,7 @@ void AppearanceDialog::colorInfoListInit() | |||
| 
 | ||||
|     colorInfoListAppend("HexDump:", "", ""); | ||||
|     colorInfoListAppend("Text", "HexDumpTextColor", ""); | ||||
|     colorInfoListAppend("Modified Bytes", "HexDumpModifiedBytesColor", ""); | ||||
|     colorInfoListAppend("Background", "HexDumpBackgroundColor", ""); | ||||
|     colorInfoListAppend("Selection", "HexDumpSelectionColor", ""); | ||||
|     colorInfoListAppend("Addresses", "HexDumpAddressColor", "HexDumpAddressBackgroundColor"); | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ BreakpointsView::BreakpointsView(QWidget *parent) : QWidget(parent) | |||
| { | ||||
|     // Software
 | ||||
|     mSoftBPTable = new StdTable(this); | ||||
|     int wCharWidth = QFontMetrics(mSoftBPTable->font()).width(QChar(' ')); | ||||
|     int wCharWidth = mSoftBPTable->getCharWidth(); | ||||
|     mSoftBPTable->setContextMenuPolicy(Qt::CustomContextMenu); | ||||
|     mSoftBPTable->addColumnAt(8+wCharWidth*2*sizeof(uint_t), "Software", false, "Address"); | ||||
|     mSoftBPTable->addColumnAt(8+wCharWidth*32, "Name", false); | ||||
|  |  | |||
|  | @ -452,7 +452,7 @@ void CPUDump::gotoExpressionSlot() | |||
| void CPUDump::hexAsciiSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewHexAscii); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -483,7 +483,7 @@ void CPUDump::hexAsciiSlot() | |||
| void CPUDump::hexUnicodeSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewHexUnicode); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -514,7 +514,7 @@ void CPUDump::hexUnicodeSlot() | |||
| void CPUDump::textAsciiSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewTextAscii); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -538,7 +538,7 @@ void CPUDump::textAsciiSlot() | |||
| void CPUDump::textUnicodeSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewTextUnicode); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -562,7 +562,7 @@ void CPUDump::textUnicodeSlot() | |||
| void CPUDump::integerSignedShortSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerSignedShort); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -585,7 +585,7 @@ void CPUDump::integerSignedShortSlot() | |||
| void CPUDump::integerSignedLongSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerSignedLong); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -608,7 +608,7 @@ void CPUDump::integerSignedLongSlot() | |||
| void CPUDump::integerSignedLongLongSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerSignedLongLong); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -631,7 +631,7 @@ void CPUDump::integerSignedLongLongSlot() | |||
| void CPUDump::integerUnsignedShortSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerUnsignedShort); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -654,7 +654,7 @@ void CPUDump::integerUnsignedShortSlot() | |||
| void CPUDump::integerUnsignedLongSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerUnsignedLong); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -677,7 +677,7 @@ void CPUDump::integerUnsignedLongSlot() | |||
| void CPUDump::integerUnsignedLongLongSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerUnsignedLongLong); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -700,7 +700,7 @@ void CPUDump::integerUnsignedLongLongSlot() | |||
| void CPUDump::integerHexShortSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerHexShort); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -723,7 +723,7 @@ void CPUDump::integerHexShortSlot() | |||
| void CPUDump::integerHexLongSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerHexLong); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -746,7 +746,7 @@ void CPUDump::integerHexLongSlot() | |||
| void CPUDump::integerHexLongLongSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewIntegerHexLongLong); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -769,7 +769,7 @@ void CPUDump::integerHexLongLongSlot() | |||
| void CPUDump::floatFloatSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewFloatFloat); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -792,7 +792,7 @@ void CPUDump::floatFloatSlot() | |||
| void CPUDump::floatDoubleSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewFloatDouble); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -815,7 +815,7 @@ void CPUDump::floatDoubleSlot() | |||
| void CPUDump::floatLongDoubleSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewFloatLongDouble); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -838,7 +838,7 @@ void CPUDump::floatLongDoubleSlot() | |||
| void CPUDump::addressSlot() | ||||
| { | ||||
|     Config()->setUint("HexDump", "DefaultView", (uint_t)ViewAddress); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
| CPUStack::CPUStack(QWidget *parent) : HexDump(parent) | ||||
| { | ||||
|     setShowHeader(false); | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     ColumnDescriptor_t wColDesc; | ||||
|     DataDescriptor_t dDesc; | ||||
| 
 | ||||
|  | @ -189,12 +189,21 @@ QString CPUStack::paintContent(QPainter* painter, int_t rowBase, int rowOffset, | |||
|     } | ||||
|     else if(mDescriptor.at(col - 1).isData == true) //paint stack data
 | ||||
|     { | ||||
|         QString wStr=HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h); | ||||
|         if(wActiveStack) | ||||
|             painter->setPen(QPen(textColor)); | ||||
|         else | ||||
|             painter->setPen(QPen(ConfigColor("StackInactiveTextColor"))); | ||||
|         painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, wStr); | ||||
|         int wBytePerRowCount = getBytePerRowCount(); | ||||
|         int_t wRva = (rowBase + rowOffset) * wBytePerRowCount - mByteOffset; | ||||
|         printSelected(painter, rowBase, rowOffset, col, x, y, w, h); | ||||
|         QList<RichTextPainter::CustomRichText_t> richText; | ||||
|         getString(col - 1, wRva, &richText); | ||||
|         if(!wActiveStack) | ||||
|         { | ||||
|             QColor inactiveColor = ConfigColor("StackInactiveTextColor"); | ||||
|             for(int i=0; i<richText.size(); i++) | ||||
|             { | ||||
|                 richText[i].flags == RichTextPainter::FlagColor; | ||||
|                 richText[i].textColor = inactiveColor; | ||||
|             } | ||||
|         } | ||||
|         RichTextPainter::paintRichText(painter, x, y, w, h, 4, &richText, getCharWidth()); | ||||
|     } | ||||
|     else if(DbgStackCommentGet(rvaToVa(wRva), &comment)) //paint stack comments
 | ||||
|     { | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ MemoryMapView::MemoryMapView(StdTable *parent) : StdTable(parent) | |||
| { | ||||
|     enableMultiSelection(false); | ||||
| 
 | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
| 
 | ||||
|     addColumnAt(8+charwidth*2*sizeof(uint_t), "ADDR", false, "Address"); //addr
 | ||||
|     addColumnAt(8+charwidth*2*sizeof(uint_t), "SIZE", false, "Size"); //size
 | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ ScriptView::ScriptView(StdTable *parent) : StdTable(parent) | |||
|     mEnableSyntaxHighlighting=false; | ||||
|     enableMultiSelection(false); | ||||
| 
 | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
| 
 | ||||
|     addColumnAt(8+charwidth*4, "Line", false); | ||||
|     addColumnAt(8+charwidth*60, "Text", false); | ||||
|  | @ -96,7 +96,7 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset | |||
|         if(mEnableSyntaxHighlighting) | ||||
|         { | ||||
|             //initialize
 | ||||
|             int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|             int charwidth=getCharWidth(); | ||||
|             int xadd=charwidth; //for testing
 | ||||
|             QList<RichTextPainter::CustomRichText_t> richText; | ||||
|             RichTextPainter::CustomRichText_t newRichText; | ||||
|  |  | |||
|  | @ -17,14 +17,9 @@ SymbolView::SymbolView(QWidget *parent) : | |||
|     mSearchListView = new SearchListView(); | ||||
|     mSearchListView->mSearchStartCol = 1; | ||||
| 
 | ||||
|     // Get font information
 | ||||
|     QFont wFont("Monospace", 8); | ||||
|     wFont.setStyleHint(QFont::Monospace); | ||||
|     wFont.setFixedPitch(true); | ||||
|     int charwidth=QFontMetrics(wFont).width(QChar(' ')); | ||||
| 
 | ||||
|     // Create module list
 | ||||
|     mModuleList = new StdTable(); | ||||
|     int charwidth = mModuleList->getCharWidth(); | ||||
|     mModuleList->setCopyMenuOnly(true); | ||||
|     mModuleList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Base", false); | ||||
|     mModuleList->addColumnAt(0, "Module", true); | ||||
|  | @ -53,7 +48,7 @@ SymbolView::SymbolView(QWidget *parent) : | |||
| #endif //_WIN64
 | ||||
| 
 | ||||
|     // Setup log edit
 | ||||
|     ui->symbolLogEdit->setFont(wFont); | ||||
|     ui->symbolLogEdit->setFont(mModuleList->font()); | ||||
|     ui->symbolLogEdit->setStyleSheet("QTextEdit { background-color: rgb(255, 251, 240) }"); | ||||
|     ui->symbolLogEdit->setUndoRedoEnabled(false); | ||||
|     ui->symbolLogEdit->setReadOnly(true); | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| 
 | ||||
| ThreadView::ThreadView(StdTable *parent) : StdTable(parent) | ||||
| { | ||||
|     int charwidth=QFontMetrics(this->font()).width(QChar(' ')); | ||||
|     int charwidth=getCharWidth(); | ||||
|     addColumnAt(8+charwidth*sizeof(unsigned int)*2, "Number", false); | ||||
|     addColumnAt(8+charwidth*sizeof(unsigned int)*2, "ID", false); | ||||
|     addColumnAt(8+charwidth*sizeof(uint_t)*2, "Entry", false); | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ bool MemoryPage::read(byte_t* parDest, uint_t parRVA, uint_t parSize) | |||
| 
 | ||||
| bool MemoryPage::write(const void* parDest, uint_t parRVA, uint_t parSize) | ||||
| { | ||||
|     return DbgMemWrite(mBase + parRVA, (unsigned char*)parDest, parSize); | ||||
|     return DbgFunctions()->MemPatch(mBase + parRVA, (unsigned char*)parDest, parSize); | ||||
| } | ||||
| 
 | ||||
| bool MemoryPage::write(const byte_t* parDest, uint_t parRVA, uint_t parSize) | ||||
|  |  | |||
|  | @ -34,6 +34,7 @@ Configuration::Configuration() : QObject() | |||
|     defaultColors.insert("DisassemblyConditionalJumpLineFalseColor", QColor("#808080")); | ||||
|     defaultColors.insert("DisassemblyUnconditionalJumpLineColor", QColor("#FF0000")); | ||||
|     defaultColors.insert("DisassemblyBytesColor", QColor("#000000")); | ||||
|     defaultColors.insert("DisassemblyModifiedBytesColor", QColor("#FF0000")); | ||||
|     defaultColors.insert("DisassemblyCommentColor", QColor("#000000")); | ||||
|     defaultColors.insert("DisassemblyCommentBackgroundColor", Qt::transparent); | ||||
| 
 | ||||
|  | @ -107,6 +108,7 @@ Configuration::Configuration() : QObject() | |||
|     defaultColors.insert("InstructionSseRegisterBackgroundColor", Qt::transparent); | ||||
| 
 | ||||
|     defaultColors.insert("HexDumpTextColor", QColor("#000000")); | ||||
|     defaultColors.insert("HexDumpModifiedBytesColor", QColor("#FF0000")); | ||||
|     defaultColors.insert("HexDumpBackgroundColor", QColor("#FFF8F0")); | ||||
|     defaultColors.insert("HexDumpSelectionColor", QColor("#C0C0C0")); | ||||
|     defaultColors.insert("HexDumpAddressColor", QColor("#000000")); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue