1
0
Fork 0

GUI: memory map breakpoint color

This commit is contained in:
Mr. eXoDia 2014-06-25 16:25:38 +02:00
parent a9ecc85792
commit dbf74ae723
9 changed files with 59 additions and 4 deletions

View File

@ -742,7 +742,8 @@ BRIDGE_IMPEXP void GuiUpdateAllViews()
GuiUpdateBreakpointsView(); GuiUpdateBreakpointsView();
GuiUpdateDumpView(); GuiUpdateDumpView();
GuiUpdateThreadView(); GuiUpdateThreadView();
GuiupdateSideBar(); GuiUpdateSideBar();
GuiRepaintTableView();
} }
BRIDGE_IMPEXP void GuiUpdateRegisterView() BRIDGE_IMPEXP void GuiUpdateRegisterView()
@ -979,11 +980,16 @@ BRIDGE_IMPEXP void GuiAddStatusBarMessage(const char* msg)
_gui_sendmessage(GUI_ADD_MSG_TO_STATUSBAR, (void*)msg, 0); _gui_sendmessage(GUI_ADD_MSG_TO_STATUSBAR, (void*)msg, 0);
} }
BRIDGE_IMPEXP void GuiupdateSideBar() BRIDGE_IMPEXP void GuiUpdateSideBar()
{ {
_gui_sendmessage(GUI_UPDATE_SIDEBAR, 0, 0); _gui_sendmessage(GUI_UPDATE_SIDEBAR, 0, 0);
} }
BRIDGE_IMPEXP void GuiRepaintTableView()
{
_gui_sendmessage(GUI_REPAINT_TABLE_VIEW, 0, 0);
}
//Main //Main
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {

View File

@ -619,7 +619,7 @@ enum GUIMSG
GUI_SCRIPT_ENABLEHIGHLIGHTING, // param1=bool enable, param2=unused GUI_SCRIPT_ENABLEHIGHLIGHTING, // param1=bool enable, param2=unused
GUI_ADD_MSG_TO_STATUSBAR, // param1=const char* msg, param2=unused GUI_ADD_MSG_TO_STATUSBAR, // param1=const char* msg, param2=unused
GUI_UPDATE_SIDEBAR, // param1=unused, param2=unused GUI_UPDATE_SIDEBAR, // param1=unused, param2=unused
GUI_REPAINT_REGISTER_VIEW // param1=unused, param2=unused GUI_REPAINT_TABLE_VIEW // param1=unused, param2=unused
}; };
//GUI structures //GUI structures
@ -688,7 +688,8 @@ BRIDGE_IMPEXP void GuiAutoCompleteAddCmd(const char* cmd);
BRIDGE_IMPEXP void GuiAutoCompleteDelCmd(const char* cmd); BRIDGE_IMPEXP void GuiAutoCompleteDelCmd(const char* cmd);
BRIDGE_IMPEXP void GuiAutoCompleteClearAll(); BRIDGE_IMPEXP void GuiAutoCompleteClearAll();
BRIDGE_IMPEXP void GuiAddStatusBarMessage(const char* msg); BRIDGE_IMPEXP void GuiAddStatusBarMessage(const char* msg);
BRIDGE_IMPEXP void GuiupdateSideBar(); BRIDGE_IMPEXP void GuiUpdateSideBar();
BRIDGE_IMPEXP void GuiRepaintTableView();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,4 +1,5 @@
#include "StdTable.h" #include "StdTable.h"
#include "Bridge.h"
/* /*
@ -17,6 +18,8 @@ StdTable::StdTable(QWidget *parent) : AbstractTableView(parent)
mIsMultiSelctionAllowed = false; mIsMultiSelctionAllowed = false;
mData = new QList< QList<QString>* >(); mData = new QList< QList<QString>* >();
connect(Bridge::getBridge(), SIGNAL(repaintTableView()), this, SLOT(reloadData()));
} }

View File

@ -362,6 +362,11 @@ void Bridge::emitUpdateSideBar()
emit updateSideBar(); emit updateSideBar();
} }
void Bridge::emitRepaintTableView()
{
emit repaintTableView();
}
/************************************************************************************ /************************************************************************************
Static Functions Static Functions
************************************************************************************/ ************************************************************************************/
@ -718,6 +723,12 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
} }
break; break;
case GUI_REPAINT_TABLE_VIEW:
{
Bridge::getBridge()->emitRepaintTableView();
}
break;
default: default:
{ {
} }

View File

@ -78,6 +78,7 @@ public:
void emitAutoCompleteClearAll(); void emitAutoCompleteClearAll();
void emitAddMsgToStatusBar(QString msg); void emitAddMsgToStatusBar(QString msg);
void emitUpdateSideBar(); void emitUpdateSideBar();
void emitRepaintTableView();
//Public variables //Public variables
void* winId; void* winId;
@ -136,6 +137,7 @@ signals:
void autoCompleteClearAll(); void autoCompleteClearAll();
void addMsgToStatusBar(QString msg); void addMsgToStatusBar(QString msg);
void updateSideBar(); void updateSideBar();
void repaintTableView();
private: private:
QMutex* mBridgeMutex; QMutex* mBridgeMutex;

View File

@ -509,6 +509,7 @@ void AppearanceDialog::colorInfoListInit()
colorInfoListAppend("Other:", "", ""); colorInfoListAppend("Other:", "", "");
colorInfoListAppend("Current Thread", "ThreadCurrentColor", "ThreadCurrentBackgroundColor"); colorInfoListAppend("Current Thread", "ThreadCurrentColor", "ThreadCurrentBackgroundColor");
colorInfoListAppend("Memory Map Breakpoint", "MemoryMapBreakpointColor", "MemoryMapBreakpointBackgroundColor");
//dev helper //dev helper
const QMap<QString, QColor>* Colors=&Config()->defaultColors; const QMap<QString, QColor>* Colors=&Config()->defaultColors;

View File

@ -1,4 +1,5 @@
#include "MemoryMapView.h" #include "MemoryMapView.h"
#include "Configuration.h"
MemoryMapView::MemoryMapView(StdTable *parent) : StdTable(parent) MemoryMapView::MemoryMapView(StdTable *parent) : StdTable(parent)
{ {
@ -54,6 +55,32 @@ QString MemoryMapView::getProtectionString(DWORD Protect)
return wS; return wS;
} }
QString MemoryMapView::paintContent(QPainter *painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
{
if(col==0) //address
{
QString wStr = getCellContent(rowBase + rowOffset, col);
#ifdef _WIN64
uint_t addr=wStr.toULongLong(0, 16);
#else //x86
uint_t addr=wStr.toULong(0, 16);
#endif //_WIN64
if((DbgGetBpxTypeAt(addr)&bp_memory)==bp_memory)
{
QString wStr = getCellContent(rowBase + rowOffset, col);
QColor bpBackgroundColor=ConfigColor("MemoryMapBreakpointBackgroundColor");
if(bpBackgroundColor.alpha())
painter->fillRect(QRect(x, y, w - 1, h), QBrush(bpBackgroundColor));
painter->setPen(ConfigColor("MemoryMapBreakpointColor"));
painter->drawText(QRect(x + 4, y, getColumnWidth(col) - 4, getRowHeight()), Qt::AlignVCenter | Qt::AlignLeft, wStr);
return "";
}
else if(isSelected(rowBase, rowOffset) == true)
painter->fillRect(QRect(x, y, w, h), QBrush(selectionColor));
}
return StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
}
void MemoryMapView::stateChangedSlot(DBGSTATE state) void MemoryMapView::stateChangedSlot(DBGSTATE state)
{ {
if(state == paused) if(state == paused)

View File

@ -10,6 +10,7 @@ class MemoryMapView : public StdTable
Q_OBJECT Q_OBJECT
public: public:
explicit MemoryMapView(StdTable *parent = 0); explicit MemoryMapView(StdTable *parent = 0);
QString paintContent(QPainter *painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
signals: signals:

View File

@ -130,6 +130,9 @@ Configuration::Configuration() : QObject()
defaultColors.insert("ThreadCurrentColor", QColor("#FFFFFF")); defaultColors.insert("ThreadCurrentColor", QColor("#FFFFFF"));
defaultColors.insert("ThreadCurrentBackgroundColor", QColor("#000000")); defaultColors.insert("ThreadCurrentBackgroundColor", QColor("#000000"));
defaultColors.insert("MemoryMapBreakpointColor", QColor("#FFFBF0"));
defaultColors.insert("MemoryMapBreakpointBackgroundColor", QColor("#FF0000"));
//bool settings //bool settings
QMap<QString, bool> disassemblyBool; QMap<QString, bool> disassemblyBool;
disassemblyBool.insert("ArgumentSpaces", false); disassemblyBool.insert("ArgumentSpaces", false);