Exemple #1
0
void DrawsWidget::SwitchCurrentDrawBlock() {
	Draw* draw = m_draws_controller->GetSelectedDraw();
	if (draw == NULL)
		return;

	BlockDraw(draw->GetDrawNo(), !draw->GetBlocked());
}
Exemple #2
0
void SelectDrawWidget::InsertSomeDraws(size_t start, size_t count) {
	wxSizer *sizer = GetSizer();
	int width = GetCheckBoxWidth();
	ConfigNameHash& cnm = const_cast<ConfigNameHash&>(m_cfg->GetConfigTitles());

	for (size_t i = start; count; count--, i++) {
		if (i >= m_cb_l.size()) {
			i = m_cb_l.size();
			m_cb_l.push_back(new wxCheckBox());
			m_cb_l[i]->Create(this, drawID_SELDRAWCB,
				wxString::Format(_T("%d."), i + 1),
				wxDefaultPosition, wxSize(width, -1), 0,
				SelectDrawValidator(m_draws_wdg, i, m_cb_l[i]));
			m_cb_l[i]->Enable(FALSE);
			m_cb_l[i]->SetToolTip(wxEmptyString);
			m_cb_l[i]->SetBackgroundColour(DRAW3_BG_COLOR);

			sizer->Add(m_cb_l[i], 0, wxTOP | wxLEFT | wxRIGHT, 1);
		}

		Draw* draw = m_dc->GetDraw(i);
		DrawInfo* draw_info = draw->GetDrawInfo();
		wxString label;
		if (draw_info->IsValid()) {
			m_cb_l[i]->Enable(TRUE);
			m_cb_l[i]->SetValue(draw->GetEnable());
			m_cb_l[i]->SetToolTip(cnm[draw_info->GetBasePrefix()] + _T(":") + draw_info->GetParamName());

			label = wxString::Format(_T("%d."), draw->GetInitialDrawNo() + 1) + draw_info->GetName();
			if (draw_info->GetParam()->GetIPKParam()->GetPSC())
				label += _T("*");
			if (draw->GetBlocked())
				label.Replace(wxString::Format(_T("%d."), draw->GetInitialDrawNo() + 1), wxString::Format(_("%d.[B]"), i + 1), false);
		} else {
			label = _T("***");
		}
		m_cb_l[i]->SetLabel(label);

		wxValidator* validator = m_cb_l[i]->GetValidator();
		if (validator)
			dynamic_cast<SelectDrawValidator*>(validator)->Set(m_draws_wdg, i, m_cb_l[i]);
		else
			m_cb_l[i]->SetValidator(SelectDrawValidator(m_draws_wdg, i, m_cb_l[i]));

		m_cb_l[i]->SetBackgroundColour(draw_info->GetDrawColor());

#ifdef MINGW32
		m_cb_l[i]->Refresh();
#endif

	}

	if (m_cb_l.size() > MIN_DRAWS_COUNT)
		SetScrollRate(10, 10);
	else
		SetScrollRate(0, 0);

	sizer->Layout();
}