当前位置: 首页>>代码示例>>C++>>正文


C++ DrawInfo类代码示例

本文整理汇总了C++中DrawInfo的典型用法代码示例。如果您正苦于以下问题:C++ DrawInfo类的具体用法?C++ DrawInfo怎么用?C++ DrawInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DrawInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _do_input

/* Called when a DrawingArea has input (either mouse or keyboard).
 */
static void _do_input(Widget w, void *data, XADCS *call_data)
{
  char *input;
  DrawInfo *di = (DrawInfo *) data;

  SetDrawArea(w);
  if (call_data->event->type == ButtonPress)
   {
     if (di->button_down)
       di->button_down(w, call_data->event->xbutton.button,
                       call_data->event->xbutton.x,call_data->event->xbutton.y,
                       di->user_data);
   }
  else if (call_data->event->type == ButtonRelease)
   {
     if (di->button_up)
       di->button_up(w, call_data->event->xbutton.button,
                     call_data->event->xbutton.x, call_data->event->xbutton.y,
                     di->user_data);
   }
  else if (call_data->event->type == KeyPress)
   {
     input = TranslateKeyCode(call_data->event);

     if (input && *input != '\0' && di->keypress)
       di->keypress(w, input, 0, di->user_data);
   }
  else if (call_data->event->type == KeyRelease)
   {
     input = TranslateKeyCode(call_data->event);

     if (input && *input != '\0' && di->keypress)
       di->keypress(w, input, 1, di->user_data);
   }
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:37,代码来源:draw.cpp

示例2: GetCurrentTime

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;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例3: RemarksReceived

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);
    }
}
开发者ID:hermixy,项目名称:szarp,代码行数:35,代码来源:remarksfetcher.cpp

示例4: dc

void WxGraphs::SetMargins() {
	int leftmargin = 36;
	int bottommargin = 12;
	int topmargin = 24;

	wxClientDC dc(this);
	dc.SetFont(GetFont());
	for (size_t i = 0; i < m_graphs.size(); i++) {
		int tw, th;
		DrawInfo *di = m_draws[i]->GetDrawInfo();
		wxString sval = di->GetValueStr(di->GetMax(), _T(""));

		dc.GetTextExtent(sval, &tw, &th);
		if (leftmargin < tw + 1)
			leftmargin = tw + 1;
		if (bottommargin < th + 1)
			bottommargin = th + 1;

		if (topmargin < th + m_screen_margins.infotopmargin)
			topmargin = th + m_screen_margins.infotopmargin;

	}

	m_screen_margins.leftmargin = leftmargin;
	m_screen_margins.bottommargin = bottommargin;
	m_screen_margins.topmargin = topmargin;

	m_bg_view->SetMargins(m_screen_margins.leftmargin, m_screen_margins.rightmargin, m_screen_margins.topmargin, m_screen_margins.bottommargin);
	for (size_t i = 0; i < m_graphs.size(); i++)
		m_graphs.at(i)->SetMargins(m_screen_margins.leftmargin, m_screen_margins.rightmargin, m_screen_margins.topmargin, m_screen_margins.bottommargin);
}
开发者ID:marta09,项目名称:szarp,代码行数:31,代码来源:wxgraphs.cpp

示例5: GetClicked

void SelectDrawWidget::OnAverageValueCalucatedMethodChange(wxCommandEvent &event) {
	int i = GetClicked(event);
	if (i == -1)
		return;
	DrawInfo *d = m_draws_wdg->GetDrawInfo(i);
	AverageValueCalculationMethod qt = d->GetAverageValueCalculationMethod();
	switch (event.GetId()) {
		case seldrawID_CTX_AVERAGE_VALUE:
			if (qt == AVERAGE_VALUE_CALCULATION_AVERAGE) 
				return;
			d->SetAverageValueCalculationMethod(AVERAGE_VALUE_CALCULATION_AVERAGE);
			break;
		case seldrawID_CTX_LAST_VALUE:
			if (qt == AVERAGE_VALUE_CALCULATION_LAST) 
				return;
			d->SetAverageValueCalculationMethod(AVERAGE_VALUE_CALCULATION_LAST);
			break;
		case seldrawID_CTX_DIFFERENCE_VALUE:
			if (qt == AVERAGE_VALUE_CALCULATION_LAST_FIRST) 
				return;
			d->SetAverageValueCalculationMethod(AVERAGE_VALUE_CALCULATION_LAST_FIRST);
			break;
	}

	m_cfg->DrawInfoAverageValueCalculationChanged(d);
}
开发者ID:cyclefusion,项目名称:szarp,代码行数:26,代码来源:seldraw.cpp

示例6: drawNonIndexed

void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
                                  int startVertex,
                                  int vertexCount,
                                  const SkRect* devBounds) {
    if (vertexCount > 0 && this->checkDraw(type, startVertex, -1, vertexCount, -1)) {
        DrawInfo info;
        info.fPrimitiveType = type;
        info.fStartVertex   = startVertex;
        info.fStartIndex    = 0;
        info.fVertexCount   = vertexCount;
        info.fIndexCount    = 0;

        info.fInstanceCount         = 0;
        info.fVerticesPerInstance   = 0;
        info.fIndicesPerInstance    = 0;

        if (NULL != devBounds) {
            info.setDevBounds(*devBounds);
        }
        // TODO: We should continue with incorrect blending.
        if (!this->setupDstReadIfNecessary(&info)) {
            return;
        }
        this->onDraw(info);
    }
}
开发者ID:danielbak,项目名称:skia,代码行数:26,代码来源:GrDrawTarget.cpp

示例7: wxDynamicCast

void XYDialog::OnDrawChange(wxCommandEvent &event) {
	DrawInfo **draw;
	wxButton *button;

	int i = event.GetId() - XY_XAXIS_BUTTON;
	draw = &m_di[i];

	button = wxDynamicCast(FindWindowById(event.GetId()), wxButton);

	if (m_draw_search->ShowModal() == wxID_CANCEL)
		return;
#ifdef __WXMSW__
	//hilarious...
	Raise();
#endif

	long previous = -1;
	DrawInfo *choosen = m_draw_search->GetDrawInfo(&previous);
	if (choosen == NULL)
		return;
	
	*draw = choosen;
	button->SetLabel(choosen->GetName());

}
开发者ID:cyclefusion,项目名称:szarp,代码行数:25,代码来源:xydiag.cpp

示例8: DrawCurrentParamName

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);

}
开发者ID:marta09,项目名称:szarp,代码行数:31,代码来源:wxgraphs.cpp

示例9: RecalculateMargins

void GCDCGraphs::RecalculateMargins(wxGraphicsContext &dc) {
	if (!m_recalulate_margins)
		return;

	double leftmargin = 36;
	double bottommargin = 12;
	double topmargin = 24;

	for (size_t i = 0; i < m_draws.size(); i++) {
		double tw, th, td, tel;
		DrawInfo *di = m_draws[i]->GetDrawInfo();
		wxString sval = di->GetValueStr(di->GetMax(), _T(""));

		dc.GetTextExtent(sval, &tw, &th, &td, &tel);
		if (leftmargin < tw + 1)
			leftmargin = tw + 1;
		if (bottommargin < th + 1)
			bottommargin = th + 1;

		if (topmargin < th + m_screen_margins.infotopmargin)
			topmargin = th + m_screen_margins.infotopmargin;

		dc.GetTextExtent(di->GetUnit(), &tw, &th, &td, &tel);
		if (leftmargin < tw + 6)
			leftmargin = tw + 6;
	}

	m_screen_margins.leftmargin = leftmargin;
	m_screen_margins.bottommargin = bottommargin;
	m_screen_margins.topmargin = topmargin;

	m_recalulate_margins = false;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例10: onDraw

void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {

    GeometryPoolState& poolState = fGeoPoolStateStack.back();
    const GrDrawState& drawState = this->getDrawState();
    AutoClipReenable acr;

    if (drawState.isClipState() &&
        info.getDevBounds() &&
        this->quickInsideClip(*info.getDevBounds())) {
        acr.set(this->drawState());
    }

    this->recordClipIfNecessary();
    this->recordStateIfNecessary();

    const GrVertexBuffer* vb;
    if (kBuffer_GeometrySrcType == this->getGeomSrc().fVertexSrc) {
        vb = this->getGeomSrc().fVertexBuffer;
    } else {
        vb = poolState.fPoolVertexBuffer;
    }

    const GrIndexBuffer* ib = NULL;
    if (info.isIndexed()) {
        if (kBuffer_GeometrySrcType == this->getGeomSrc().fIndexSrc) {
            ib = this->getGeomSrc().fIndexBuffer;
        } else {
            ib = poolState.fPoolIndexBuffer;
        }
    }

    Draw* draw;
    if (info.isInstanced()) {
        int instancesConcated = this->concatInstancedDraw(info);
        if (info.instanceCount() > instancesConcated) {
            draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, vb, ib));
            draw->fInfo.adjustInstanceCount(-instancesConcated);
        } else {
            return;
        }
    } else {
        draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info, vb, ib));
    }
    this->recordTraceMarkersIfNecessary();

    // Adjust the starting vertex and index when we are using reserved or array sources to
    // compensate for the fact that the data was inserted into a larger vb/ib owned by the pool.
    if (kBuffer_GeometrySrcType != this->getGeomSrc().fVertexSrc) {
        size_t bytes = (info.vertexCount() + info.startVertex()) * drawState.getVertexStride();
        poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, bytes);
        draw->fInfo.adjustStartVertex(poolState.fPoolStartVertex);
    }
    
    if (info.isIndexed() && kBuffer_GeometrySrcType != this->getGeomSrc().fIndexSrc) {
        size_t bytes = (info.indexCount() + info.startIndex()) * sizeof(uint16_t);
        poolState.fUsedPoolIndexBytes = SkTMax(poolState.fUsedPoolIndexBytes, bytes);
        draw->fInfo.adjustStartIndex(poolState.fPoolStartIndex);
    }
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:59,代码来源:GrInOrderDrawBuffer.cpp

示例11: onDraw

void GrGpu::onDraw(const DrawInfo& info) {
    this->handleDirtyContext();
    GrDrawState::AutoRestoreEffects are;
    if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()),
                                      info.getDstCopy(), &are, info.getDevBounds())) {
        return;
    }
    this->onGpuDraw(info);
}
开发者ID:rgraebert,项目名称:skia,代码行数:9,代码来源:GrGpu.cpp

示例12: SetDrawInfo

void InfoWidget::SetDrawInfo(Draw *draw) {
	DrawInfo *info = draw->GetDrawInfo();
	if (info == NULL)
		return;
	SetUnit(info->GetUnit());
	SetColor(info->GetDrawColor());
	SetPrec(info->GetPrec());
	SetPeriod(draw->GetPeriod());
}
开发者ID:firebitsbr,项目名称:szarp,代码行数:9,代码来源:infowdg.cpp

示例13: _do_motion

static void _do_motion(Widget w, void *data,  XADCS *call_data)
{
  DrawInfo *di = (DrawInfo *) data;

  SetDrawArea(w);
  if (di->motion)
    di->motion(w, call_data->event->xmotion.x,  call_data->event->xmotion.y,
               di->user_data);
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:9,代码来源:draw.cpp

示例14: wxMenu

void
SelectDrawValidator::OnMouseRightDown(wxMouseEvent &event) {
	DrawInfo* di = m_draws_wdg->GetDrawInfo(m_index);
	if (di == NULL)
		return;

	wxMenu menu;

	DrawParam* dp = di->GetParam();
	if (di->IsValid() && dp->GetIPKParam()->GetPSC())
		menu.Append(seldrawID_PSC,_("Set parameter"));

	menu.SetClientData(m_cb);

	if (m_draws_wdg->GetDrawBlocked(m_index)) {
		wxMenuItem* item = menu.AppendCheckItem(seldrawID_CTX_BLOCK_MENU, _("Draw blocked\tCtrl-B"));
		item->Check();
	} else {
		int non_blocked_count = 0;
		for (unsigned int i = 0; i < m_draws_wdg->GetDrawsCount(); ++i)
			if (!m_draws_wdg->GetDrawBlocked(i))
				non_blocked_count++;

		//one draw shall be non-blocked
		if (non_blocked_count > 1)
			menu.AppendCheckItem(seldrawID_CTX_BLOCK_MENU, _("Draw blocked\tCtrl-B"));
	}

	menu.Append(seldrawID_CTX_DOC_MENU, _("Parameter documentation\tCtrl-H"));
	menu.Append(seldrawID_CTX_COPY_PARAM_NAME_MENU, _("Copy parameter name\tCtrl+Shift+C"));

	wxMenu* submenu = new wxMenu();
	submenu->SetClientData(m_cb);
	wxMenuItem* averageItem = submenu->AppendRadioItem(seldrawID_CTX_AVERAGE_VALUE, _("Average value for selected period"));
	wxMenuItem* lastItem = submenu->AppendRadioItem(seldrawID_CTX_LAST_VALUE, _("Last value"));
	wxMenuItem* diffItem = submenu->AppendRadioItem(seldrawID_CTX_DIFFERENCE_VALUE, _("Difference between last and first value"));
	menu.AppendSubMenu(submenu, _("Type of average values shown"));

	switch (di->GetAverageValueCalculationMethod()) {
		case AVERAGE_VALUE_CALCULATION_AVERAGE:
			averageItem->Check(true);
			break;
		case AVERAGE_VALUE_CALCULATION_LAST:
			lastItem->Check(true);
			break;
		case AVERAGE_VALUE_CALCULATION_LAST_FIRST:
			diffItem->Check(true);
			break;
	}

	if (dynamic_cast<DefinedParam*>(dp) != NULL)
		menu.Append(seldrawID_CTX_EDIT_PARAM, _("Edit parameter associated with graph\tCtrl-E"));

	m_cb->PopupMenu(&menu);

}
开发者ID:cyclefusion,项目名称:szarp,代码行数:56,代码来源:seldraw.cpp

示例15: OnMouseRightDown

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);
}
开发者ID:marta09,项目名称:szarp,代码行数:11,代码来源:wxgraphs.cpp


注:本文中的DrawInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。