Ejemplo n.º 1
0
void WxGraphs::ResetDraws(DrawsController *controller) {
	m_draws.resize(0);
	for (size_t i = 0; i < controller->GetDrawsCount(); i++)
		m_draws.push_back(controller->GetDraw(i));

	size_t pc = m_graphs.size();
	if (pc > m_draws.size()) for (size_t i = m_draws.size(); i < pc; i++)
			delete m_graphs.at(i);
	m_graphs.resize(m_draws.size());

	for (size_t i = pc; i < m_draws.size(); i++) {
		m_graphs.at(i) = new GraphView(this);
		m_graphs.at(i)->Attach(m_draws[i]);
		m_graphs.at(i)->DrawAll();
	}

	Draw* d = controller->GetSelectedDraw();
	if (d)
		m_bg_view->Attach(m_draws[d->GetDrawNo()]);

	for (size_t i = 0; i < std::min(pc, m_graphs.size()); i++)
		m_graphs.at(i)->DrawInfoChanged(m_draws[i]);


	SetMargins();

	Refresh();

}
Ejemplo n.º 2
0
wxString DrawsWidget::GetUrl(bool with_infinity) {
	Draw* d = m_draws_controller->GetSelectedDraw();
	if (d == NULL)
		return wxEmptyString;

	time_t t;

	if (with_infinity && m_draws_controller->AtTheNewestValue()) {
		t = std::numeric_limits<time_t>::max();
	} else {
		t = GetCurrentTime().GetTicks();
	}

	wxString prefix = m_draws_controller->GetSet()->GetDrawsSets()->GetPrefix();

	DrawInfo* di = d->GetDrawInfo();

	SetInfoDataObject* wido =
		new SetInfoDataObject(prefix, di->GetSetName(), d->GetPeriod(), t , d->GetDrawNo());

	wxString tmp = wido->GetUrl();

	delete wido;

	return tmp;
}
Ejemplo n.º 3
0
void DrawsWidget::SwitchCurrentDrawBlock() {
	Draw* draw = m_draws_controller->GetSelectedDraw();
	if (draw == NULL)
		return;

	BlockDraw(draw->GetDrawNo(), !draw->GetBlocked());
}
Ejemplo n.º 4
0
void DrawsWidget::CopyToClipboard() {
	Draw *d = m_draws_controller->GetSelectedDraw();

	if (d == NULL)
		return;

	if (wxTheClipboard->Open() == false)
		return;

	DrawInfo *di = d->GetDrawInfo();

	SetInfoDataObject* wido =
		new SetInfoDataObject(di->GetBasePrefix(), di->GetSetName(), d->GetPeriod(), d->GetCurrentTime().GetTicks(), d->GetDrawNo());

	wxTheClipboard->SetData(wido);
	wxTheClipboard->Close();
}