GUI: resolved issue #202 (separator feature in HexDump)
This commit is contained in:
parent
bdda41563c
commit
9c1e22800e
|
@ -267,26 +267,30 @@ void HexDump::printSelected(QPainter* painter, int_t rowBase, int rowOffset, int
|
|||
{
|
||||
if((col > 0) && ((col - 1) < mDescriptor.size()))
|
||||
{
|
||||
int wI = 0;
|
||||
ColumnDescriptor_t curDescriptor = mDescriptor.at(col - 1);
|
||||
int wBytePerRowCount = getBytePerRowCount();
|
||||
int_t wRva = (rowBase + rowOffset) * wBytePerRowCount - mByteOffset;
|
||||
int wItemPixWidth = getItemPixelWidth(mDescriptor.at(col - 1));
|
||||
int wItemPixWidth = getItemPixelWidth(curDescriptor);
|
||||
int wCharWidth = getCharWidth();
|
||||
if(wItemPixWidth == wCharWidth)
|
||||
x += 4;
|
||||
int wSelectionX;
|
||||
int wSelectionWidth;
|
||||
|
||||
for(wI = 0; wI < mDescriptor.at(col - 1).itemCount; wI++)
|
||||
for(int i = 0; i < curDescriptor.itemCount; i++)
|
||||
{
|
||||
if(isSelected(wRva + wI * getSizeOf(mDescriptor.at(col - 1).data.itemSize)) == true)
|
||||
int wSelectionX = x + i * wItemPixWidth;
|
||||
if(isSelected(wRva + i * getSizeOf(curDescriptor.data.itemSize)) == true)
|
||||
{
|
||||
wSelectionX = x + wI * wItemPixWidth;
|
||||
wSelectionWidth = wItemPixWidth > w - (wSelectionX - x) ? w - (wSelectionX - x) : wItemPixWidth;
|
||||
int wSelectionWidth = wItemPixWidth > w - (wSelectionX - x) ? w - (wSelectionX - x) : wItemPixWidth;
|
||||
wSelectionWidth = wSelectionWidth < 0 ? 0 : wSelectionWidth;
|
||||
painter->setPen(textColor);
|
||||
painter->fillRect(QRect(wSelectionX, y, wSelectionWidth, h), QBrush(selectionColor));
|
||||
}
|
||||
int separator = curDescriptor.separator;
|
||||
if(i && separator && !(i % separator))
|
||||
{
|
||||
painter->setPen(separatorColor);
|
||||
painter->drawLine(wSelectionX, y, wSelectionX, y + h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
{
|
||||
bool isData;
|
||||
int itemCount;
|
||||
int separator;
|
||||
DataDescriptor_t data;
|
||||
} ColumnDescriptor_t;
|
||||
|
||||
|
|
|
@ -561,6 +561,7 @@ void CPUDump::hexAsciiSlot()
|
|||
|
||||
wColDesc.isData = true; //hex byte
|
||||
wColDesc.itemCount = 16;
|
||||
wColDesc.separator = 4;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = HexByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -568,6 +569,7 @@ void CPUDump::hexAsciiSlot()
|
|||
|
||||
wColDesc.isData = true; //ascii byte
|
||||
wColDesc.itemCount = 16;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -575,6 +577,7 @@ void CPUDump::hexAsciiSlot()
|
|||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -592,6 +595,7 @@ void CPUDump::hexUnicodeSlot()
|
|||
|
||||
wColDesc.isData = true; //hex byte
|
||||
wColDesc.itemCount = 16;
|
||||
wColDesc.separator = 4;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = HexByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -599,6 +603,7 @@ void CPUDump::hexUnicodeSlot()
|
|||
|
||||
wColDesc.isData = true; //unicode short
|
||||
wColDesc.itemCount = 8;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Word;
|
||||
dDesc.wordMode = UnicodeWord;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -606,6 +611,7 @@ void CPUDump::hexUnicodeSlot()
|
|||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -623,6 +629,7 @@ void CPUDump::textAsciiSlot()
|
|||
|
||||
wColDesc.isData = true; //ascii byte
|
||||
wColDesc.itemCount = 64;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -630,6 +637,7 @@ void CPUDump::textAsciiSlot()
|
|||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -647,6 +655,7 @@ void CPUDump::textUnicodeSlot()
|
|||
|
||||
wColDesc.isData = true; //unicode short
|
||||
wColDesc.itemCount = 64;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Word;
|
||||
dDesc.wordMode = UnicodeWord;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -654,6 +663,7 @@ void CPUDump::textUnicodeSlot()
|
|||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -671,12 +681,14 @@ void CPUDump::integerSignedShortSlot()
|
|||
|
||||
wColDesc.isData = true; //signed short
|
||||
wColDesc.itemCount = 8;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Word;
|
||||
wColDesc.data.wordMode = SignedDecWord;
|
||||
appendResetDescriptor(8 + charwidth * 55, "Signed short (16-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -694,12 +706,14 @@ void CPUDump::integerSignedLongSlot()
|
|||
|
||||
wColDesc.isData = true; //signed long
|
||||
wColDesc.itemCount = 4;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Dword;
|
||||
wColDesc.data.dwordMode = SignedDecDword;
|
||||
appendResetDescriptor(8 + charwidth * 47, "Signed long (32-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -717,12 +731,14 @@ void CPUDump::integerSignedLongLongSlot()
|
|||
|
||||
wColDesc.isData = true; //signed long long
|
||||
wColDesc.itemCount = 2;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Qword;
|
||||
wColDesc.data.qwordMode = SignedDecQword;
|
||||
appendResetDescriptor(8 + charwidth * 41, "Signed long long (64-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -740,12 +756,14 @@ void CPUDump::integerUnsignedShortSlot()
|
|||
|
||||
wColDesc.isData = true; //unsigned short
|
||||
wColDesc.itemCount = 8;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Word;
|
||||
wColDesc.data.wordMode = UnsignedDecWord;
|
||||
appendResetDescriptor(8 + charwidth * 47, "Unsigned short (16-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -763,12 +781,14 @@ void CPUDump::integerUnsignedLongSlot()
|
|||
|
||||
wColDesc.isData = true; //unsigned long
|
||||
wColDesc.itemCount = 4;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Dword;
|
||||
wColDesc.data.dwordMode = UnsignedDecDword;
|
||||
appendResetDescriptor(8 + charwidth * 43, "Unsigned long (32-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -786,12 +806,14 @@ void CPUDump::integerUnsignedLongLongSlot()
|
|||
|
||||
wColDesc.isData = true; //unsigned long long
|
||||
wColDesc.itemCount = 2;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Qword;
|
||||
wColDesc.data.qwordMode = UnsignedDecQword;
|
||||
appendResetDescriptor(8 + charwidth * 41, "Unsigned long long (64-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -809,12 +831,14 @@ void CPUDump::integerHexShortSlot()
|
|||
|
||||
wColDesc.isData = true; //hex short
|
||||
wColDesc.itemCount = 8;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Word;
|
||||
wColDesc.data.wordMode = HexWord;
|
||||
appendResetDescriptor(8 + charwidth * 34, "Hex short (16-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -832,12 +856,14 @@ void CPUDump::integerHexLongSlot()
|
|||
|
||||
wColDesc.isData = true; //hex long
|
||||
wColDesc.itemCount = 4;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Dword;
|
||||
wColDesc.data.dwordMode = HexDword;
|
||||
appendResetDescriptor(8 + charwidth * 35, "Hex long (32-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -855,12 +881,14 @@ void CPUDump::integerHexLongLongSlot()
|
|||
|
||||
wColDesc.isData = true; //hex long long
|
||||
wColDesc.itemCount = 2;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Qword;
|
||||
wColDesc.data.qwordMode = HexQword;
|
||||
appendResetDescriptor(8 + charwidth * 33, "Hex long long (64-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -878,12 +906,14 @@ void CPUDump::floatFloatSlot()
|
|||
|
||||
wColDesc.isData = true; //float dword
|
||||
wColDesc.itemCount = 4;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Dword;
|
||||
wColDesc.data.dwordMode = FloatDword;
|
||||
appendResetDescriptor(8 + charwidth * 55, "Float (32-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -901,12 +931,14 @@ void CPUDump::floatDoubleSlot()
|
|||
|
||||
wColDesc.isData = true; //float qword
|
||||
wColDesc.itemCount = 2;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Qword;
|
||||
wColDesc.data.qwordMode = DoubleQword;
|
||||
appendResetDescriptor(8 + charwidth * 47, "Double (64-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -924,12 +956,14 @@ void CPUDump::floatLongDoubleSlot()
|
|||
|
||||
wColDesc.isData = true; //float qword
|
||||
wColDesc.itemCount = 2;
|
||||
wColDesc.separator = 0;
|
||||
wColDesc.data.itemSize = Tword;
|
||||
wColDesc.data.twordMode = FloatTword;
|
||||
appendResetDescriptor(8 + charwidth * 59, "Long double (80-bit)", false, wColDesc);
|
||||
|
||||
wColDesc.isData = false; //empty column
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
@ -947,6 +981,7 @@ void CPUDump::addressSlot()
|
|||
|
||||
wColDesc.isData = true; //void*
|
||||
wColDesc.itemCount = 1;
|
||||
wColDesc.separator = 0;
|
||||
#ifdef _WIN64
|
||||
wColDesc.data.itemSize = Qword;
|
||||
wColDesc.data.qwordMode = HexQword;
|
||||
|
@ -958,6 +993,7 @@ void CPUDump::addressSlot()
|
|||
|
||||
wColDesc.isData = false; //comments
|
||||
wColDesc.itemCount = 1;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
|
|
@ -17,6 +17,7 @@ CPUStack::CPUStack(QWidget* parent) : HexDump(parent)
|
|||
|
||||
wColDesc.isData = true; //void*
|
||||
wColDesc.itemCount = 1;
|
||||
wColDesc.separator = 0;
|
||||
#ifdef _WIN64
|
||||
wColDesc.data.itemSize = Qword;
|
||||
wColDesc.data.qwordMode = HexQword;
|
||||
|
@ -28,6 +29,7 @@ CPUStack::CPUStack(QWidget* parent) : HexDump(parent)
|
|||
|
||||
wColDesc.isData = false; //comments
|
||||
wColDesc.itemCount = 0;
|
||||
wColDesc.separator = 0;
|
||||
dDesc.itemSize = Byte;
|
||||
dDesc.byteMode = AsciiByte;
|
||||
wColDesc.data = dDesc;
|
||||
|
|
Loading…
Reference in New Issue