| 1583 | } |
| 1584 | |
| 1585 | void ParametricViewer::OnGridColLabelRightClick(wxGridEvent & evt) |
| 1586 | { |
| 1587 | m_selected_grid_col = evt.GetCol(); |
| 1588 | m_selected_grid_row = evt.GetRow(); |
| 1589 | if (m_selected_grid_row < 0) |
| 1590 | { |
| 1591 | if (m_selected_grid_col < 0) // upper left corner of grid |
| 1592 | { |
| 1593 | // Grid menu |
| 1594 | wxPoint point = evt.GetPosition(); |
| 1595 | wxMenu *menu = new wxMenu; |
| 1596 | menu->Append(ID_OUTPUTMENU_CLIPBOARD, _T("Copy to clipboard")); |
| 1597 | menu->Append(ID_OUTPUTMENU_CSV, _T("Save as CSV")); |
| 1598 | #ifdef __WXMSW__ |
| 1599 | menu->Append(ID_OUTPUTMENU_EXCEL, _T("Send to Excel")); |
| 1600 | #endif |
| 1601 | if (m_grid_data->IsSorted()) { |
| 1602 | menu->AppendSeparator(); |
| 1603 | menu->Append(ID_CLEAR_SORTING, _T("Clear column sorting")); |
| 1604 | } |
| 1605 | if (m_columnFilters.size() > 0) { |
| 1606 | menu->AppendSeparator(); |
| 1607 | menu->Append(ID_CLEAR_FILTERS, _T("Clear all column filters")); |
| 1608 | } |
| 1609 | PopupMenu(menu, point); |
| 1610 | } |
| 1611 | else // header with variables |
| 1612 | { |
| 1613 | if (m_grid_data->IsInput(m_selected_grid_col)) |
| 1614 | { |
| 1615 | // input menu |
| 1616 | wxPoint point = evt.GetPosition(); |
| 1617 | wxMenu *menu = new wxMenu; |
| 1618 | menu->Append(ID_INPUTMENU_FILL_DOWN_ONE_VALUE, _T("Fill down one value")); |
| 1619 | menu->Append(ID_INPUTMENU_FILL_DOWN_SEQUENCE, _T("Fill down sequence")); |
| 1620 | menu->Append(ID_INPUTMENU_FILL_DOWN_EVENLY, _T("Fill down evenly")); |
| 1621 | if (auto vv = m_grid_data->GetVarValue(0, m_selected_grid_col)) { |
| 1622 | if (vv->Type() == VV_NUMBER) { |
| 1623 | menu->AppendSeparator(); |
| 1624 | menu->Append(ID_FILTER_COLUMN, _T("Filter column")); |
| 1625 | } |
| 1626 | } |
| 1627 | PopupMenu(menu, point); |
| 1628 | } |
| 1629 | else |
| 1630 | { |
| 1631 | // Output menu |
| 1632 | wxPoint point = evt.GetPosition(); |
| 1633 | wxMenu *menu = new wxMenu; |
| 1634 | menu->Append(ID_OUTPUTMENU_ADD_PLOT, _T("Add plot")); |
| 1635 | menu->Append(ID_OUTPUTMENU_REMOVE_PLOT, _T("Remove plot")); |
| 1636 | menu->AppendSeparator(); |
| 1637 | menu->Append(ID_OUTPUTMENU_SHOW_DATA, _T("Show all data")); |
| 1638 | int ndx = m_plot_var_names.Index(m_grid_data->GetVarName(0,m_selected_grid_col)); |
| 1639 | menu->Enable(ID_OUTPUTMENU_ADD_PLOT, (ndx == wxNOT_FOUND)); |
| 1640 | menu->Enable(ID_OUTPUTMENU_REMOVE_PLOT, (ndx != wxNOT_FOUND)); |
| 1641 | if (auto vv = m_grid_data->GetVarValue(0, m_selected_grid_col)) { |
| 1642 | if (vv->Type() == VV_NUMBER) { |
nothing calls this directly
no test coverage detected