| 455 | } |
| 456 | |
| 457 | void ScatterPlotMatFrame::SetupPanelForNumVariables(int num_vars) |
| 458 | { |
| 459 | if (!panel || !bag_szr) return; |
| 460 | if (message_win) { |
| 461 | message_win->Unbind(wxEVT_MOTION, &ScatterPlotMatFrame::OnMouseEvent, this); |
| 462 | bool detatch_success = bag_szr->Detach(0); |
| 463 | message_win->Destroy(); |
| 464 | message_win = 0; |
| 465 | } |
| 466 | bag_szr->Clear(); |
| 467 | panel_v_szr->Remove(bag_szr); // bag_szr is deleted automatically |
| 468 | bag_szr = new wxGridBagSizer(0, 0); // 0 vgap, 0 hgap |
| 469 | for (size_t i=0, sz=scatt_plots.size(); i<sz; ++i) { |
| 470 | if (scatt_plots[i]) { |
| 471 | scatt_plots[i]->Unbind(wxEVT_MOTION, |
| 472 | &ScatterPlotMatFrame::OnMouseEvent, |
| 473 | this); |
| 474 | scatt_plots[i]->Destroy(); |
| 475 | } |
| 476 | } |
| 477 | scatt_plots.clear(); |
| 478 | for (size_t i=0, sz=hist_plots.size(); i<sz; ++i) { |
| 479 | if (hist_plots[i]) { |
| 480 | hist_plots[i]->Unbind(wxEVT_MOTION, |
| 481 | &ScatterPlotMatFrame::OnMouseEvent, |
| 482 | this); |
| 483 | hist_plots[i]->Destroy(); |
| 484 | } |
| 485 | } |
| 486 | hist_plots.clear(); |
| 487 | for (size_t i=0, sz=vert_labels.size(); i<sz; ++i) { |
| 488 | if (vert_labels[i]) vert_labels[i]->Destroy(); |
| 489 | } |
| 490 | vert_labels.clear(); |
| 491 | for (size_t i=0, sz=horiz_labels.size(); i<sz; ++i) { |
| 492 | if (horiz_labels[i]) horiz_labels[i]->Destroy(); |
| 493 | } |
| 494 | horiz_labels.clear(); |
| 495 | if (num_vars < 2) { |
| 496 | message_win = new wxHtmlWindow(panel, wxID_ANY, wxDefaultPosition, wxSize(200,-1)); |
| 497 | message_win->Bind(wxEVT_MOTION, &ScatterPlotMatFrame::OnMouseEvent, this); |
| 498 | UpdateMessageWin(); |
| 499 | bag_szr->Add(message_win, wxGBPosition(0,0), wxGBSpan(1,1), wxEXPAND); |
| 500 | |
| 501 | bag_szr->SetFlexibleDirection(wxBOTH); |
| 502 | if (bag_szr->IsColGrowable(0)) |
| 503 | bag_szr->RemoveGrowableCol(0); |
| 504 | bag_szr->AddGrowableCol(0, 1); |
| 505 | if (bag_szr->IsRowGrowable(0)) |
| 506 | bag_szr->RemoveGrowableRow(0); |
| 507 | bag_szr->AddGrowableRow(0, 1); |
| 508 | |
| 509 | } else { |
| 510 | for (int row=0; row<num_vars; ++row) { |
| 511 | wxString row_nm; |
| 512 | row_nm = var_man.GetName(row); |
| 513 | int row_tm(var_man.GetTime(row)); |
| 514 |
nothing calls this directly
no test coverage detected