void ProcList::showList(int highlight) { int c = 0; Freeze(); DeleteAllItems(); for (std::vector<Database::Item>::const_iterator i = list.items.begin(); i != list.items.end(); i++) { const Database::Symbol *sym = i->symbol; double inclusive = i->inclusive; double exclusive = i->exclusive; float inclusivepercent = i->inclusive * 100.0f / list.totalcount; float exclusivepercent = i->exclusive * 100.0f / list.totalcount; InsertItem(c, sym->procname.c_str(), -1); if(sym->isCollapseFunction || sym->isCollapseModule) { SetItemTextColour(c,wxColor(0,128,0)); } setColumnValue(c, COL_EXCLUSIVE, wxString::Format("%0.2fs",exclusive)); setColumnValue(c, COL_INCLUSIVE, wxString::Format("%0.2fs",inclusive)); setColumnValue(c, COL_EXCLUSIVEPCT, wxString::Format("%0.2f%%",exclusivepercent)); setColumnValue(c, COL_INCLUSIVEPCT, wxString::Format("%0.2f%%",inclusivepercent)); setColumnValue(c, COL_SAMPLES, wxString::Format("%0.2fs",exclusive)); setColumnValue(c, COL_CALLSPCT, wxString::Format("%0.2f%%",exclusivepercent)); setColumnValue(c, COL_MODULE, sym->module.c_str()); setColumnValue(c, COL_SOURCEFILE, sym->sourcefile.c_str()); setColumnValue(c, COL_SOURCELINE, ::toString(sym->sourceline).c_str()); c++; } this->SetItemState(highlight, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED); Thaw(); EnsureVisible(highlight); }
void RKMatrixInput::tsvPropertyChanged () { if (updating_tsv_data) return; updating_tsv_data = true; RK_TRACE (PLUGIN); columns.clear (); QStringList coldata = fetchStringValue (tsv_data).split ('\n', QString::KeepEmptyParts); for (int i = 0; i < coldata.size (); ++i) { setColumnValue (i, coldata[i]); } updating_tsv_data = false; updateAll (); }
void ProcList::displayList() { theMainWin->setProgress(L"Saving list state..."); std::unordered_map<Database::Address, int> item_state; // TODO: use GetNextItem? for (long i=0; i<GetItemCount(); i++) if (int state = GetItemState(i, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED)) item_state[GetItemData(i)] = state; theMainWin->setProgress(L"Clearing list..."); Freeze(); DeleteAllItems(); theMainWin->setProgress(L"Populating list...", list.items.size()); const ViewState *viewstate = theMainWin->getViewState(); for (auto i = list.items.begin(); i != list.items.end(); ++i) { const Database::Symbol *sym = i->symbol; if (isroot && set_get(viewstate->filtered, sym->address)) continue; long c = GetItemCount(); wxListItem item; item.SetId(c); item.SetText(sym->procname); if (sym->isCollapseFunction || sym->isCollapseModule) item.SetTextColour(wxColor(0,128,0)); if (set_get(viewstate->highlighted, sym->address)) item.SetBackgroundColour(wxColor(255,255,0)); int state = map_get(item_state, sym->address, 0); item.SetData(sym->address); item.SetState(state); item.SetStateMask(wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED); InsertItem(item); wxString inclusive = wxString::Format("%0.2fs", i->inclusive); wxString exclusive = wxString::Format("%0.2fs", i->exclusive); wxString inclusivepercent = wxString::Format("%0.2f%%", i->inclusive * 100.0f / list.totalcount); wxString exclusivepercent = wxString::Format("%0.2f%%", i->exclusive * 100.0f / list.totalcount); setColumnValue(c, COL_EXCLUSIVE, exclusive); setColumnValue(c, COL_INCLUSIVE, inclusive); setColumnValue(c, COL_EXCLUSIVEPCT, exclusivepercent); setColumnValue(c, COL_INCLUSIVEPCT, inclusivepercent); setColumnValue(c, COL_SAMPLES, exclusive); setColumnValue(c, COL_CALLSPCT, exclusivepercent); setColumnValue(c, COL_MODULE, database->getModuleName(sym->module)); setColumnValue(c, COL_SOURCEFILE, database->getFileName (sym->sourcefile)); setColumnValue(c, COL_SOURCELINE, ::toString((int)database->getAddrInfo(i->address)->sourceline)); setColumnValue(c, COL_ADDRESS, ::toHexString(i->address)); if (state & wxLIST_STATE_FOCUSED) EnsureVisible(c); theMainWin->updateProgress(i-list.items.begin()); } Thaw(); theMainWin->setProgress(NULL); }