Пример #1
0
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);
        }
    }
}
Пример #2
0
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);
    }
}