1
0
Fork 0

traced background in references and source (#1209)

This commit is contained in:
Torusrxxx 2016-11-01 13:36:06 +00:00 committed by Duncan Ogilvie
parent 7376b2516e
commit 248b49e18e
7 changed files with 44 additions and 5 deletions

View File

@ -31,12 +31,17 @@ void SearchListViewTable::updateColors()
mSelectedAddressColor = ConfigColor("DisassemblySelectedAddressColor");
mAddressBackgroundColor = ConfigColor("DisassemblyAddressBackgroundColor");
mAddressColor = ConfigColor("DisassemblyAddressColor");
mTracedBackgroundColor = ConfigColor("DisassemblyTracedBackgroundColor");
auto a = selectionColor, b = mTracedBackgroundColor;
mTracedSelectedAddressBackgroundColor = QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2, (a.blue() + b.blue()) / 2);
}
QString SearchListViewTable::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
{
bool isaddr = true;
QString text = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
bool wIsSelected = isSelected(rowBase, rowOffset);
QString text = getCellContent(rowBase + rowOffset, col);
if(!DbgIsDebugging())
isaddr = false;
if(!getRowCount())
@ -47,6 +52,31 @@ QString SearchListViewTable::paintContent(QPainter* painter, dsint rowBase, int
isaddr = false;
else
wVA = val;
auto wIsTraced = isaddr && DbgFunctions()->GetTraceRecordHitCount(wVA) != 0;
QColor lineBackgroundColor;
bool isBackgroundColorSet;
if(wIsSelected && wIsTraced)
{
lineBackgroundColor = mTracedSelectedAddressBackgroundColor;
isBackgroundColorSet = true;
}
else if(wIsSelected)
{
lineBackgroundColor = selectionColor;
isBackgroundColorSet = true;
}
else if(wIsTraced)
{
lineBackgroundColor = mTracedBackgroundColor;
isBackgroundColorSet = true;
}
else
{
isBackgroundColorSet = false;
}
if(isBackgroundColorSet)
painter->fillRect(QRect(x, y, w, h), QBrush(lineBackgroundColor));
if(col == 0 && isaddr)
{
char label[MAX_LABEL_SIZE] = "";
@ -61,8 +91,6 @@ QString SearchListViewTable::paintContent(QPainter* painter, dsint rowBase, int
BPXTYPE bpxtype = DbgGetBpxTypeAt(wVA);
bool isbookmark = DbgGetBookmarkAt(wVA);
auto wIsSelected = rowBase + rowOffset == getInitialSelection();
if(wVA == mCip) //cip + not running
{
painter->fillRect(QRect(x, y, w, h), QBrush(mCipBackgroundColor));

View File

@ -37,6 +37,8 @@ private:
QColor mSelectedAddressColor;
QColor mAddressBackgroundColor;
QColor mAddressColor;
QColor mTracedBackgroundColor;
QColor mTracedSelectedAddressBackgroundColor;
duint mCip;
bool bCipBase;
};

View File

@ -41,6 +41,8 @@ CustomizeMenuDialog::CustomizeMenuDialog(QWidget* parent) :
viewName = tr("Graph");
else if(id == "CPUStack")
viewName = tr("Stack");
else if(id == "SourceView")
viewName = tr("Source");
else if(id == "File")
viewName = tr("File");
else if(id == "Debug")

View File

@ -1870,17 +1870,21 @@ void MainWindow::onMenuCustomized()
QMenu* currentMenu = menus[i];
QMenu* moreCommands = nullptr;
bool moreCommandsUsed = false;
moreCommands = currentMenu->actions().last()->menu();
QList<QAction*> & list = currentMenu->actions();
moreCommands = list.last()->menu();
if(moreCommands && moreCommands->title().compare(tr("More Commands")) == 0)
{
for(auto & j : moreCommands->actions())
moreCommands->removeAction(j);
QAction* separatorMoreCommands = list.at(list.length() - 2);
currentMenu->removeAction(separatorMoreCommands); // Separator
delete separatorMoreCommands;
}
else
{
moreCommands = new QMenu(tr("More Commands"), currentMenu);
}
for(auto & j : currentMenu->actions())
for(auto & j : list)
currentMenu->removeAction(j);
for(int j = 0; j < menuTextStrings.at(i)->size() - 1; j++)
{

View File

@ -30,6 +30,7 @@ SourceView::SourceView(QString path, int line, QWidget* parent)
mMenuBuilder = new MenuBuilder(this);
mMenuBuilder->addAction(makeAction(tr("Open source file"), SLOT(openSourceFileSlot())));
mMenuBuilder->addAction(makeAction(tr("Show source file in directory"), SLOT(showInDirectorySlot())));
mMenuBuilder->loadFromConfig();
}
void SourceView::setSelection(int line)

View File

@ -555,6 +555,7 @@ void SymbolView::moduleSetParty()
mLineEdit.setWindowIcon(DIcon("bookmark.png"));
mLineEdit.setWindowTitle(tr("Mark the party of the module as"));
mLineEdit.setText(QString::number(party));
mLineEdit.setPlaceholderText(tr("0 is user module, 1 is system module."));
if(mLineEdit.exec() == QDialog::Accepted)
{
bool ok;

View File

@ -220,6 +220,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
insertMenuBuilderBools(&guiBool, "CallStackView", 50); //CallStackView
insertMenuBuilderBools(&guiBool, "ThreadView", 50); //Thread
insertMenuBuilderBools(&guiBool, "CPUStack", 50); //Stack
insertMenuBuilderBools(&guiBool, "SourceView", 10); //Source
insertMenuBuilderBools(&guiBool, "DisassemblerGraphView", 50); //Graph
insertMenuBuilderBools(&guiBool, "File", 50); //Main Menu : File
insertMenuBuilderBools(&guiBool, "Debug", 50); //Main Menu : Debug