void LLDBTooltip::Show(const wxString& displayName, LLDBVariable::Ptr_t variable) { DoCleanup(); wxTreeItemId item = m_treeCtrl->AddRoot( variable->ToString(displayName), wxNOT_FOUND, wxNOT_FOUND, new LLDBVariableClientData(variable)); if(variable->HasChildren()) { m_treeCtrl->AppendItem(item, "<dummy>"); } Move(::wxGetMousePosition()); wxPopupWindow::Show(); m_treeCtrl->SetFocus(); }
void LLDBLocalsView::GetWatchesFromSelections(wxArrayTreeItemIds& items) { items.Clear(); wxArrayTreeItemIds arr; m_treeList->GetSelections(arr); for(size_t i = 0; i < arr.GetCount(); ++i) { wxTreeItemId item = arr.Item(i); if(!GetItemData(item)) continue; LLDBVariableClientData* data = GetItemData(item); if(!data) continue; LLDBVariable::Ptr_t lldbVar = data->GetVariable(); if(!lldbVar) continue; if(lldbVar->IsWatch()) { items.Add(item); } } }
void LLDBLocalsView::OnLocalsContextMenu(wxContextMenuEvent& event) { wxMenu menu; menu.Append(wxID_COPY, _("Copy value to clipboard")); int selection = GetPopupMenuSelectionFromUser(menu); if(selection == wxID_COPY) { wxString content; wxArrayTreeItemIds arr; m_treeList->GetSelections(arr); for(size_t i = 0; i < arr.GetCount(); ++i) { wxString itemValue; wxTreeItemId item = arr.Item(i); if(!GetItemData(item)) continue; LLDBVariableClientData* data = GetItemData(item); if(!data) continue; LLDBVariable::Ptr_t lldbVar = data->GetVariable(); if(!lldbVar) continue; if(!lldbVar->GetValue().IsEmpty()) { itemValue << lldbVar->GetValue(); } if(!lldbVar->GetSummary().IsEmpty()) { if(!itemValue.IsEmpty()) itemValue << " "; itemValue << lldbVar->GetSummary(); } if(!itemValue.IsEmpty()) { if(!content.IsEmpty()) { content << "\n"; } content << itemValue; } } if(!content.IsEmpty()) { ::CopyToClipboard(content); } } }
void LLDBLocalsView::OnDelete(wxCommandEvent& event) { wxArrayTreeItemIds items; GetWatchesFromSelections(items); if(items.IsEmpty()) return; for(size_t i = 0; i < items.GetCount(); ++i) { wxTreeItemId item = items.Item(i); if(!GetItemData(item)) continue; LLDBVariableClientData* data = GetItemData(item); if(!data) continue; LLDBVariable::Ptr_t lldbVar = data->GetVariable(); if(!lldbVar) continue; if(lldbVar->IsWatch()) { m_plugin->GetLLDB()->DeleteWatch(lldbVar->GetLldbId()); } } // Refresh the locals view m_plugin->GetLLDB()->RequestLocals(); }
void LLDBLocalsView::DoAddVariableToView(const LLDBVariable::Vect_t& variables, wxTreeItemId parent) { for(size_t i = 0; i < variables.size(); ++i) { LLDBVariable::Ptr_t variable = variables.at(i); wxTreeItemId item = m_treeList->AppendItem( parent, variable->GetName(), wxNOT_FOUND, wxNOT_FOUND, new LLDBVariableClientData(variable)); m_treeList->SetItemText(item, LOCALS_VIEW_SUMMARY_COL_IDX, variable->GetSummary().IsEmpty() ? variable->GetValue() : variable->GetSummary()); m_treeList->SetItemText(item, LOCALS_VIEW_VALUE_COL_IDX, variable->GetValue()); m_treeList->SetItemText(item, LOCALS_VIEW_TYPE_COL_IDX, variable->GetType()); if(variable->IsValueChanged()) { m_treeList->SetItemTextColour(item, "RED"); } if(variable->HasChildren()) { // insert dummy item here m_treeList->AppendItem(item, "<dummy>"); } } if(!variables.empty()) { m_treeList->Expand(parent); } }