Пример #1
0
void RemarksFetcher::RemarksReceived(std::vector<Remark>& remarks) {

    Draw* d = m_draws_controller->GetSelectedDraw();
    if (d == NULL)
        return;

    DrawInfo* di = d->GetDrawInfo();

    wxDateTime start = d->GetTimeOfIndex(0);
    wxDateTime end = d->GetTimeOfIndex(d->GetValuesTable().size());

    wxString prefix = di->GetBasePrefix();
    wxString set = di->GetSetName();
    std::vector<wxDateTime> remarks_times;

    for (std::vector<Remark>::iterator i = remarks.begin(); i != remarks.end(); i++) {
        wxDateTime rt = i->GetTime();

        std::wstring rset = i->GetSet();

        if (prefix != i->GetAttachedPrefix()
                || (!rset.empty() && set != rset)
                || rt < start
                || rt >= end)
            continue;

        remarks_times.push_back(rt);
        m_remarks[i->GetId()] = *i;

    }

    if (remarks_times.size()) {
        d->SetRemarksTimes(remarks_times);
    }
}
Пример #2
0
void WxGraphs::DrawCurrentParamName(wxDC *dc) {
	DrawInfo *di = m_draws_wdg->GetCurrentDrawInfo();
	if (di == NULL)
		return;

	wxFont f = GetFont();

	int ps = f.GetPointSize();
	int fw = f.GetWeight();
	f.SetWeight(wxFONTWEIGHT_BOLD);
	f.SetPointSize(ps * 1.25);
	dc->SetFont(f);

	wxString text = m_cfg_mgr->GetConfigTitles()[di->GetBasePrefix()] + _T(":") + di->GetParamName();

	int tw, th;
	dc->GetTextExtent(text, &tw, &th);

	int w, h;
	GetSize(&w, &h);
	dc->SetTextForeground(di->GetDrawColor());
	dc->SetBrush(*wxBLACK_BRUSH);
	dc->SetPen(*wxWHITE_PEN);
	dc->DrawRectangle(w / 2 - tw / 2 - 1, h / 2 - th / 2 - 1, tw + 2, th + 2);
	dc->DrawText(text, w / 2 - tw / 2, h / 2 - th / 2);

	f.SetPointSize(ps);
	f.SetWeight(fw);
	dc->SetFont(f);

}
Пример #3
0
void
SelectDrawWidget::OnPSC(wxCommandEvent &event) {
	int i = GetClicked(event);
	if (i == -1)
		return;
	DrawInfo* info = m_draws_wdg->GetDrawInfo(i);
	m_cfg->EditPSC(info->GetBasePrefix(), info->GetParamName());
}
Пример #4
0
void WxGraphs::OnMouseRightDown(wxMouseEvent &event) {
	if (m_draws_wdg->GetSelectedDrawIndex() == -1)
		return;

	Draw *d = m_draws[m_draws_wdg->GetSelectedDrawIndex()];
	DrawInfo *di = d->GetDrawInfo();

	SetInfoDataObject wido(di->GetBasePrefix(), di->GetSetName(), d->GetPeriod(), d->GetCurrentTime().GetTicks(), m_draws_wdg->GetSelectedDrawIndex());
	wxDropSource ds(wido, this);
	ds.DoDragDrop(0);
}
Пример #5
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();
}
Пример #6
0
void SelectDrawWidget::OnEditParam(wxCommandEvent &event) {
	int i = GetClicked(event);
	if (i == -1)
		return;

	DrawInfo *d = m_draws_wdg->GetDrawInfo(i);

	DefinedParam *dp = dynamic_cast<DefinedParam*>(d->GetParam());
	if (dp == NULL)
		return;

	wxWindow *w = this;
	while (!w->IsTopLevel())
		w = w->GetParent();

	ParamEdit pe(w, m_cfg, m_dbmgr, m_remarks_handler);
	pe.SetCurrentConfig(d->GetBasePrefix());
	pe.Edit(dp);

}
Пример #7
0
void RemarksFetcher::Fetch() {
    if (!m_remarks_handler->Configured())
        return;

    Draw* d = m_draws_controller->GetSelectedDraw();
    if (d == NULL)
        return;

    wxDateTime start = d->GetTimeOfIndex(0);
    if (!start.IsValid())
        return;

    wxDateTime end = d->GetTimeOfIndex(d->GetValuesTable().size());
    DrawInfo *di = d->GetDrawInfo();

    m_remarks_handler->GetStorage()->GetRemarks(
        di->GetBasePrefix(),
        di->GetSetName(),
        start.GetTicks(),
        end.GetTicks(),
        this);

}
Пример #8
0
void ParamEdit::OnFormulaInsertParam(wxCommandEvent &event) {

	DrawsSets* drawsets = m_cfg_mgr->GetConfigByPrefix(m_base_prefix);
	assert(drawsets);
	wxString ct = drawsets->GetID();

	if (m_inc_search == NULL)
		m_inc_search = new IncSearch(m_cfg_mgr, m_remarks_handler, ct, this, -1, _("Find"), false, false);
	else
		m_inc_search->SetConfigName(ct);
	

	if (m_inc_search->ShowModal() != wxID_OK)
		return;

	long prev = -1;
	DrawInfo *draw;
	while ((draw = m_inc_search->GetDrawInfo(&prev)) != NULL) {
		DrawParam *p = draw->GetParam();
		wxString pname = p->GetParamName();
		m_formula_input->AddText(wxString::Format(_T("p(\"%s:%s\", t, pt) "), draw->GetBasePrefix().c_str(), pname.c_str()));
	}

}