示例#1
0
bool DrawPileupCorr(Str jetAlgo) {
  JetCalibrationTool *theJES = new JetCalibrationTool(jetAlgo,_jesFile,false);
  bool residual = theJES->JetAreaJES();

  TH1D *temp = new TH1D("","",100,-5,5);
  temp->SetXTitle("Jet #eta"); temp->SetYTitle("Jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
  if (residual) temp->SetYTitle("Residual jet offset at "+GetConstScale(jetAlgo)+"-scale [GeV]");
  temp->SetMinimum(-20); temp->SetMaximum(15); temp->SetStats(0);
  if ( residual && theJES->ResidualOffsetCorr_Description() == "" ) return false;
  Can->Clear(); temp->Draw();
  for (int npv=0;npv<9;++npv) {
    double NPV=(npv%3)*10, mu=(npv/3)*10;
    if (NPV==0) NPV=1;
    Graph *g = new Graph();
    FormatGraph(g,npv);
    for (int ieta=-50;ieta<50;++ieta) {
      double eta=0.05 + 0.1*ieta;
      double O = residual ? theJES->GetResidualOffset(eta,mu,NPV)/1000 :
	theJES->GetOffset(eta,mu,NPV)/1000; // convert to GeV
      g->SetPoint(g->GetN(),eta,O);
    }
    if (npv<4) DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.18,0.35-0.04*npv,npv);
    else DrawLabel(Form("N_{PV} = %.0f, #LT#mu#GT = %.0f",NPV,mu),0.48,0.35-0.04*(npv-4),npv);
    
    g->Draw("P");
  }
  tex->SetNDC(); tex->SetTextAlign(12);
  if (residual)
    tex->DrawLatex(0.18,0.975,theJES->ResidualOffsetCorr_Description());
  else 
    tex->DrawLatex(0.18,0.975,theJES->OffsetCorr_Description());
  tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
  return true;
}
示例#2
0
void DrawInsituCorr_vs_Eta(Str jetAlgo) {
  Nbins=sizeof(Ebins)/sizeof(double);
  myJES = new JetCalibrationTool(jetAlgo,_jesFile);

  TH1F *h = new TH1F("","",100,-4.8,4.8);
  h->SetXTitle("Jet #eta_{det}");
  h->SetYTitle("Residual correction for data only");
  h->SetMaximum(1.1); h->SetMinimum(0.85);

  h->Draw();
  TLine *l = new TLine(); 
  l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
  l->DrawLine(-4.65,1,4.65,1);
  
  for (int i=0;i<Nbins;++i) {
    Graph *g = GetInsituGraph(Ebins[i]);
    FormatGraph(g,i); g->Draw("PL");
    double x=0.52, y=0.3-0.05*i;
    if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
    DrawLabel(Form("p_{T} = %.0f GeV",Ebins[i]),x,y,i);
  }

  l->SetLineWidth(2);
  l->SetLineColor(kGray+2);
  l->SetLineStyle(1);

  tex->SetNDC(); tex->SetTextAlign(12);
  //tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
  tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
}
示例#3
0
/* virtual */ void
CFlowInspectorDefault::DrawRecords(const std::deque<TFlowRecord>& inRecords, int inBaseRow, float inMaxAge) const
{
	// records are pushed back, but we want to draw new records on top
	// so we draw from bottom to top, ensuring linear mem access
	int row=inRecords.size() -1 + inBaseRow; 
	string val;
	ColorF color;

	std::deque<TFlowRecord>::const_iterator	iter (inRecords.begin());
	while (iter != inRecords.end())
	{
		const TFlowRecord& rec (*iter);
		float age = (m_currentTime - rec.m_tstamp).GetSeconds()-0.5f;  // -0.5 grace time
		float ageFactor = inMaxAge > 0 ? age / inMaxAge : 0;
		if (ageFactor < 0) ageFactor = 0;
		if (ageFactor > 1) ageFactor = 1;
		ageFactor = smoothstep(1.0f - ageFactor);
		color = DRAW_COLORS[rec.m_type];
		color.a *= ageFactor;
		DrawLabel(2.f,(float)row,color,0.0f, rec.m_message.c_str());
		--row;
		++iter;
	}
}
void updateLabel(tlabel *lbl, char *str){
  TFT_Set_Font(lbl->Fontname, Box1.Color, FO_HORIZONTAL);
  TFT_Write_Text(lbl->Caption, lbl->Left, lbl->Top);
  strcpy(lbl->Caption, str);
  TFT_Set_Font(lbl->Fontname, lbl->Font_Color, FO_HORIZONTAL);
  DrawLabel(lbl);
}
bool CDriveItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const
{
	if (subitem == COL_NAME)
	{
		DrawLabel(m_list, GetMyImageList(), pdc, rc, state, width, focusLeft);
		return true;
	}
	else if (subitem == COL_GRAPH)
	{
		if (!m_success)
		{
			return false;
		}
		

		if (width != NULL)
		{		
			*width= 100;
			return true;
		}

		DrawSelection(m_list, pdc, rc, state);

		rc.DeflateRect(3, 5);
	
		DrawPercentage(pdc, rc, m_used, RGB(0,0,170));

		return true;
	}
	else
	{
		return false;
	}
}
示例#6
0
void RoundCaptionButton9Click() {
  // green
  RC1_bit = !RC1_bit;
  
  Label5.Font_Color = T6963C_BLACK;
  DrawLabel(&Label5);
  Label5.Font_Color = T6963C_WHITE;
  
  if (RC1_bit == 1) {
    strcpy(Label5_Caption, "OFF");
    }
  else if (RC1_bit == 0)
    strcpy(Label5_Caption, "ON ");

  DrawLabel(&Label5);
}
void DrawTimeFrequencyGrid::DrawVerticalGrid( int nVerticalLines, double time0, double time1 )
{
	if ( nVerticalLines <= 0 ) return;

	// Draw vertical gridlines
	for ( int i = 0; i < nVerticalLines; i++ )
	{
		double fraction = (double) i  / ( double ) nVerticalLines;
		float fx = (float) fraction * rectangleSize.width;
		pRenderTarget->DrawLine( D2D1::Point2F(fx, 0.0f), D2D1::Point2F(fx, rectangleSize.height ), pVGridBrush, 1.0f );
		
		CString timeLabel;
		double timeScale = time1 - time0;
		if ( timeScale < 0.01 )
		{
			timeLabel.Format( _T("%-7.4f"), time0 + fraction * (time1 - time0 ) );
		} else if ( timeScale < 0.1 )
		{
			timeLabel.Format( _T("%-6.3f"), time0 + fraction * (time1 - time0 ) );
		}
		else
		{
			timeLabel.Format( _T("%-6.2f"), time0 + fraction * (time1 - time0 ) );
		}
		DrawLabel( timeLabel, fx, 0.0f );
	}
}
示例#8
0
void DrawInsituCorr_vs_Pt(Str jetAlgo) {
  myJES = new JetCalibrationTool(jetAlgo,_jesFile);
  TH1F *h = new TH1F("","",100,15,2500);
  h->SetXTitle("Jet p_{T}");
  h->SetYTitle("Residual correction for data only");
  h->SetMaximum(1.1); h->SetMinimum(0.85);
  h->Draw();
  TLine *l = new TLine(); 
  l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
  l->DrawLine(16,1,2400,1);
  for (int i=0;i<6;++i) {
    double eta=4.0*i/5;
    Graph *g = GetInsituGraphVsPt(eta);
    FormatGraph(g,i); g->Draw("PL");
    double x=0.52, y=0.3-0.05*i;
    if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
    DrawLabel(Form("#eta = %.1f",eta),x,y,i);
  }

  l->SetLineWidth(2);
  l->SetLineColor(kGray+2);
  l->SetLineStyle(1);

  tex->SetNDC(); tex->SetTextAlign(12);
  //tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
  tex->DrawLatex(0.18,0.9,GetJetDesc(jetAlgo));
}
示例#9
0
void DrawJMS_vs_Eta(Str jetAlgo) {
  double massEbins[] = {50, 100, 250, 500, 750, 1500};
  double massNbins = sizeof(massEbins)/sizeof(double);
  myJES = new JetCalibrationTool(jetAlgo,_jesFile);
  TH1F *h = new TH1F("","",100,-4.8,4.8);
  h->SetXTitle("Jet #eta_{det}"); h->SetYTitle("Jet mass response");
  h->SetMaximum(1.4); h->SetMinimum(0.6);
  h->Draw();
  
  TLine *l = new TLine(); 
  l->SetLineWidth(2); l->SetLineColor(kGray+2); l->SetLineStyle(4);
  l->DrawLine(-4.65,1,4.65,1);

  for (int i=0;i<massNbins;++i) {
    Graph *g = GetJMSGraph(massEbins[i]);
    FormatGraph(g,i);
    g->Draw("PL");
    double x=0.52, y=0.3-0.05*i;
    if (i>2) { x=0.74; y=0.3-0.05*(i-3); }
    DrawLabel(Form("E = %.0f GeV",massEbins[i]),x,y,i);
  }
  
  tex->SetNDC(); tex->SetTextAlign(12);
  tex->DrawLatex(0.18,0.975,myJES->AbsoluteJES_Description());
  tex->DrawLatex(0.18,0.9,jetAlgo);
}
示例#10
0
void CZoneView::Draw(CDC* pDC, const std::vector<CElement*>& selection, CElement* highlight)
{
	//Dessiner la zone
	DrawZone(pDC, selection, highlight);

	//Dessiner le label
	DrawLabel(pDC, selection, highlight);
}
示例#11
0
void RoundCaptionButton8Click() {
  // blue
  RG0_bit = !RG0_bit;
  
  Label4.Font_Color = T6963C_BLACK;
  DrawLabel(&Label4);
  Label4.Font_Color = T6963C_WHITE;

  
  if (RG0_bit == 1) {
    strcpy(Label4_Caption, "OFF");
    }
  else if (RG0_bit == 0)
    strcpy(Label4_Caption, "ON ");

  DrawLabel(&Label4);
}
示例#12
0
void CMeasuredGrid::Draw(Display::IDisplayPtr pDisplay)
{
	IMapGrid::Draw(pDisplay);

	DrawBorder(pDisplay);
	DrawGrid(pDisplay);
	DrawTick(pDisplay);
	DrawLabel(pDisplay);
}
示例#13
0
void do_redraw(char *userdata, GraphWin * wi)
{
  if ( TransformCompute(wi) ) {
    DrawTitle(userdata, wi);
    DrawLegend(userdata, wi);
    DrawGridAndAxis(userdata, wi);
    DrawData(userdata, wi);
    DrawLabel(userdata, wi);
  }
}
示例#14
0
void wxNewBitmapButton::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
    wxPaintDC dc(this);

    // first, make sure images for current state are prepared
    //RenderLabelImages();

    DrawLabel( dc );

    DrawDecorations( dc );
}
示例#15
0
void wxStdRenderer::DrawFrameWithLabel(wxDC& dc,
                                       const wxString& label,
                                       const wxRect& rectFrame,
                                       const wxRect& rectText,
                                       int flags,
                                       int alignment,
                                       int indexAccel)
{
    wxRect rectLabel;
    DrawLabel(dc, label, rectText, flags, alignment, indexAccel, &rectLabel);

    DrawFrameWithoutLabel(dc, rectFrame, rectLabel);
}
// Draw Horizontal lines with labels at places that may be pre-defined
void DrawTimeFrequencyGrid::DrawHorizontalGrid( MAPDOUBLE *pLabelMap, int nHorizontalLines, double lowFrequencyLimit, double highFrequencyLimit )
{
	if ( pLabelMap == nullptr )
	{
		// Must be left to our own devices
		for ( int i = 0; i < nHorizontalLines; i++ )
		{
			float fy;
			double fraction = (double) i  / ( double ) nHorizontalLines;
			fy = (float) ( lowFrequencyLimit + fraction * ( highFrequencyLimit - lowFrequencyLimit) );
			if ( fy > highFrequencyLimit ) break;

			float yCoord = (float) DrawScaledGridLine( 0.0, fy, rectangleSize.width, fy, pVGridBrush );
		
			CString frequencyLabel;
			if ( fy < 0.01 )
				frequencyLabel.Format( _T("%-7.4f"), fy );
			else if ( fy < 1.0 )
				frequencyLabel.Format( _T("%-7.2f"), fy );
			else
				frequencyLabel.Format( _T("%-7.0f"), fy );
			DrawLabel( frequencyLabel, 0.0f, yCoord );
		}
	} else
	{
		MAPDOUBLEIT it;
		for ( it = pLabelMap->begin(); it != pLabelMap->end(); it++ )
		{
			float fy = (float) it->second;
			if ( fy > highFrequencyLimit || fy < lowFrequencyLimit )
				continue;

			float yCoord = (float) DrawScaledGridLine( 0.0, fy, rectangleSize.width, fy, pVGridBrush );
			CStringA frequencyLabel = it->first;
			DrawLabel( CString(frequencyLabel), 0.0f, yCoord );
		}
	}
}
示例#17
0
void AngularMeter::OnPaint(wxPaintEvent &event)
{

	wxPaintDC old_dc(this);

//	wxPaintDC dc((wxWindow *) this);

	int w,h ;
	GetClientSize(&w,&h);

	if (w != _currentWidth || h != _currentHeight){
		delete (_memBitmap);
		_currentWidth = w;
		_currentHeight = h;
		_memBitmap = new wxBitmap(_currentWidth, _currentHeight);
	}
	/////////////////
	// Create a memory DC
	wxMemoryDC dc;
	dc.SelectObject(*_memBitmap);

	dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(_backgroundColor,wxSOLID));
	dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(_backgroundColor,wxSOLID));
	dc.Clear();

	///////////////////
	//Rettangolo

	dc.SetPen(*wxThePenList->FindOrCreatePen(_borderColor, 1, wxSOLID));
	dc.DrawRectangle(0,0,w,h);

	//settori
	DrawSectors(dc) ;

	//tacche
	DrawTicks( dc );

	//indicatore lancetta


	DrawLabel(dc);

	//testo valore
	if (_shouldDrawCurrent) DrawValue(dc);

	DrawNeedle(dc);

	//blit into the real DC
	old_dc.Blit(0,0,_currentWidth,_currentHeight,&dc,0,0);
}
示例#18
0
void
BMenuField::Draw(BRect update)
{
	BRect bounds(Bounds());
	bool active = IsFocus() && Window()->IsActive();

	DrawLabel(bounds, update);

	BRect frame(fMenuBar->Frame());

	if (be_control_look != NULL) {
		frame.InsetBy(-kVMargin, -kVMargin);
		rgb_color base = fMenuBar->LowColor();
		rgb_color background = LowColor();
		uint32 flags = 0;
		if (!fMenuBar->IsEnabled())
			flags |= BControlLook::B_DISABLED;
		if (active)
			flags |= BControlLook::B_FOCUSED;
		be_control_look->DrawMenuFieldFrame(this, frame, update, base,
			background, flags);
		return;
	}

	if (frame.InsetByCopy(-kVMargin, -kVMargin).Intersects(update)) {
		SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
		StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
			BPoint(frame.left - 1.0f, frame.bottom - 1.0f));
		StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
			BPoint(frame.right - 1.0f, frame.top - 1.0f));

		StrokeLine(BPoint(frame.left + 1.0f, frame.bottom + 1.0f),
			BPoint(frame.right + 1.0f, frame.bottom + 1.0f));
		StrokeLine(BPoint(frame.right + 1.0f, frame.top + 1.0f));

		SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_4_TINT));
		StrokeLine(BPoint(frame.left - 1.0f, frame.bottom),
			BPoint(frame.left - 1.0f, frame.bottom));
		StrokeLine(BPoint(frame.right, frame.top - 1.0f),
			BPoint(frame.right, frame.top - 1.0f));
	}

	if (active || fTransition) {
		SetHighColor(active ? ui_color(B_KEYBOARD_NAVIGATION_COLOR) :
			ViewColor());
		StrokeRect(frame.InsetByCopy(-kVMargin, -kVMargin));

		fTransition = false;
	}
}
示例#19
0
文件: tpcal.c 项目: LucidOne/Rovio
void DoPaint(HDC hdc)
{
	const char szInstructions[] = "Please touch the center of the target.";

	POINT p;
	int i, n;
	int old_rop;
	POINT last = current_target_location;
	HPEN hOldPen;
	
	if (current_target == total_targets) {
		RECT r = {10, yext/2,  xext - 10, yext/2 + 40};
		DrawDone(hdc, r);
		return;
	}
	
	if (current_target == 0)
	{
		RECT r = {10, yext - 85, xext - 10, yext - 10};
		DrawAbout(hdc, r);
	}

	current_target_location = GetTarget(current_target);

	old_rop = SetROP2(hdc, R2_XORPEN);
	hOldPen = SelectObject(hdc, GetStockObject(WHITE_PEN));

	n = 20;
	for (i=0; i < n; i++)
	{
		p.x = last.x + ((current_target_location.x - last.x) * i / n);
		p.y = last.y + ((current_target_location.y - last.y) * i / n);
		DrawTarget(hdc, p);
		Sleep(60);
		DrawTarget(hdc, p);
	}

	// final position
	SetROP2(hdc, R2_COPYPEN);
	SelectObject(hdc, GetStockObject(BLACK_PEN));

	DrawTarget(hdc, current_target_location);
	DrawLabel(hdc, current_target_location, szInstructions);

	// put things back
	SetROP2(hdc, old_rop);
	SelectObject(hdc, hOldPen);
}
示例#20
0
//------------------------------------------------------------------------------
void BMenuField::Draw(BRect update)
{
	BRect bounds(Bounds());
	bool active = false;

	if (IsFocus())
		active = Window()->IsActive();

	/*
	SetHighColor(0, 255, 0);
	FillRect(bounds);
	*/

	DrawLabel(bounds, update);

	BRect frame(fMenuBar->Frame());
	//rgb_color color = HighColor();

	if (frame.InsetByCopy(-2, -2).Intersects(update))
	{
		SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
		StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
			BPoint(frame.left - 1.0f, frame.bottom - 1.0f));
		StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
			BPoint(frame.right - 1.0f, frame.top - 1.0f));

		StrokeLine(BPoint(frame.left + 1.0f, frame.bottom + 1.0f),
			BPoint(frame.right + 1.0f, frame.bottom + 1.0f));
		StrokeLine(BPoint(frame.right + 1.0f, frame.top + 1.0f));

		SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_4_TINT));
		StrokeLine(BPoint(frame.left - 1.0f, frame.bottom),
			BPoint(frame.left - 1.0f, frame.bottom));
		StrokeLine(BPoint(frame.right, frame.top - 1.0f),
			BPoint(frame.right, frame.top - 1.0f));

	}

	if (active || fTransition)
	{
		SetHighColor(active ? ui_color(B_KEYBOARD_NAVIGATION_COLOR) :
			ViewColor());
		StrokeRect(frame.InsetByCopy(-kVMargin, -kVMargin));

		fTransition = false;
	}
}
示例#21
0
bool CExtensionListControl::CListItem::DrawSubitem(int subitem, CDC *pdc, CRect rc, UINT state, int *width, int *focusLeft) const
{
    if(subitem == COL_EXTENSION)
    {
        DrawLabel(m_list, GetMyImageList(), pdc, rc, state, width, focusLeft);
    }
    else if(subitem == COL_COLOR)
    {
        DrawColor(pdc, rc, state, width);
    }
    else
    {
        return false;
    }

    return true;
}
示例#22
0
void YabTabView::DrawTab(BRect frame, int32 current, tab_position position, bool full)
{

    BView *owner = this;
	rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);

//		uint32 borders = BControlLook::B_RIGHT_BORDER
//			| BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER;
//		if (frame.left == owner->Bounds().left)
//			borders |= BControlLook::B_LEFT_BORDER;
//		be_control_look->DrawButtonFrame(owner, frame, frame,
//			no_tint, 0, borders);
//		if (position == B_TAB_FRONT)
//			no_tint = tint_color(no_tint, B_DARKEN_2_TINT);
//		be_control_look->DrawButtonBackground(owner, frame, frame, no_tint);

	uint32 borders = BControlLook::B_TOP_BORDER
		| BControlLook::B_BOTTOM_BORDER;
	if (frame.left == owner->Bounds().left)
		borders |= BControlLook::B_LEFT_BORDER;
	if (frame.right == owner->Bounds().right)
		borders |= BControlLook::B_RIGHT_BORDER;

	if (position == B_TAB_FRONT) {
		if(fTabOrientation == B_TAB_TOP)
		{
			frame.bottom += 1;
			be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0, borders);
		}
		else
		{
			frame.top -= 1;
			fYabControlLook.DrawActiveTabBottom(owner, frame, frame, no_tint, 0, borders);
		}
	} else {
		if(fTabOrientation == B_TAB_TOP)
			be_control_look->DrawInactiveTab(owner, frame, frame, no_tint, 0, borders);
		else
			fYabControlLook.DrawInactiveTabBottom(owner, frame, frame, no_tint, 0, borders);
	}

	DrawLabel(current, frame);
	return;

} 
示例#23
0
void wxStdRenderer::DrawStatusField(wxDC& dc,
                                    const wxRect& rect,
                                    const wxString& label,
                                    int flags,
                                    int style)
{
    wxRect rectIn;

    if ( style == wxSB_RAISED )
        DrawBorder(dc, wxBORDER_RAISED, rect, flags, &rectIn);
    else if ( style != wxSB_FLAT )
        DrawBorder(dc, wxBORDER_STATIC, rect, flags, &rectIn);

    rectIn.Deflate(GetStatusBarFieldMargins());

    wxDCClipper clipper(dc, rectIn);
    DrawLabel(dc, label, rectIn, flags, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
}
示例#24
0
void
TGUITargetView::DrawBlinkingGoal()
{
    goalState = blinkActive;
    // Draw a "blinking" goal into the goalBuffer.
    if( goalBuffer == NULL )
        return;

    int width = viewTRect.Width(),
        height = viewTRect.Height();
    goalBuffer->Width = width;
    goalBuffer->Height = height;
    TCanvas *canvas = goalBuffer->Canvas;
    int penWidth = TGUIView::GetElementWidth( targetBorderBlinking );
    canvas->Pen->Width = penWidth;
    canvas->Pen->Color = TGUIView::GetElementColor( targetBorderBlinking ).cl;
    canvas->Brush->Color = TGUIView::GetElementColor( targetFillBlinking ).cl;
    canvas->Rectangle( penWidth / 2, penWidth / 2, width - penWidth / 2 + 1, height - penWidth / 2 + 1 );
    DrawLabel( targetTextBlinking );
}
示例#25
0
/*******************************************************************************
* Function UpdateTime(TTime *RTCC_Time)
* ------------------------------------------------------------------------------
* Overview: Function reads Time and displays it on Home screen
* Input: Nothing
* Output: Nothing
*******************************************************************************/
void UpdateTime(TTime *RTCC_Time){
  Label19_Caption[0] = (RTCC_Time->hours / 10) + 48;
  Label19_Caption[1] = (RTCC_Time->hours % 10) + 48;
  Label19_Caption[2] = ':';
  Label19_Caption[3] = (RTCC_Time->minutes / 10) + 48;
  Label19_Caption[4] = (RTCC_Time->minutes % 10) + 48;
  Label19_Caption[5] = ' ';
  if (RTCC_Time->ampm == 0){
    Label19_Caption[6] = 'A';
    Label19_Caption[7] = 'M';
  }
  else if (RTCC_Time->ampm == 1){
    Label19_Caption[6] = 'P';
    Label19_Caption[7] = 'M';
  }
  Label19_Caption[8] = 0;
  TFT_Set_Brush(1, Home.Color, 0, 0, 0, 0);
  TFT_Set_Pen(Home.Color, 0);
  TFT_Rectangle(Label19.Left, Label19.Top, Label19.Left + 60, Label19.Top + 20);
  DrawLabel(&Label19);
}
示例#26
0
void DrawControl(const struct zzControl* ctrl) {

	short state = GetControlState(ctrl);

	if(state == -1)
		return;

	switch ( ctrl->type ) {
    case BUTTON:
		DrawButton((struct zzButton*) ctrl);
        break;
	case LABEL:
		DrawLabel((struct zzLabel*) ctrl);
		break;
	case TEXTFIELD:
		DrawTextField((struct zzTextField*) ctrl);
		break;
    default:
        break;
    }
}
示例#27
0
void wxStdRenderer::DrawCheckOrRadioButton(wxDC& dc,
                                           const wxString& label,
                                           const wxBitmap& bitmap,
                                           const wxRect& rect,
                                           int flags,
                                           wxAlignment align,
                                           int indexAccel)
{
    // calculate the position of the bitmap and of the label
    wxCoord heightBmp = bitmap.GetHeight();
    wxCoord xBmp,
            yBmp = rect.y + (rect.height - heightBmp) / 2;

    wxRect rectLabel;
    dc.GetMultiLineTextExtent(label, NULL, &rectLabel.height);
    rectLabel.y = rect.y + (rect.height - rectLabel.height) / 2;

    // align label vertically with the bitmap - looks nicer like this
    rectLabel.y -= (rectLabel.height - heightBmp) % 2;

    // calc horz position
    if ( align == wxALIGN_RIGHT )
    {
        xBmp = rect.GetRight() - bitmap.GetWidth();
        rectLabel.x = rect.x + 3;
        rectLabel.SetRight(xBmp);
    }
    else // normal (checkbox to the left of the text) case
    {
        xBmp = rect.x;
        rectLabel.x = xBmp + bitmap.GetWidth() + 5;
        rectLabel.SetRight(rect.GetRight());
    }

    dc.DrawBitmap(bitmap, xBmp, yBmp, true /* use mask */);

    DrawLabel(dc, label, rectLabel, flags,
              wxALIGN_LEFT | wxALIGN_TOP, indexAccel);
}
示例#28
0
// ============================================================================
// Draw points and curves
// ============================================================================
void CBezierWnd::Draw()
{
    // Draw control point handles and labels
  for ( PointSetIt i = m_Points.begin(); i != m_Points.end(); ++i )
  {
    DrawHandle( *i );
    DrawLabel( *i );
  }

  if ( m_Points.size() < 3)
    return;

    // Draw curve
  PointList lPoints;
  for ( PointSetIt i = m_Points.begin(); i != m_Points.end(); ++i )
    lPoints.push_back( *i );

  CPoint2D p2DStart =  *m_Points.begin();
  float fStep = 1.f / ( 10.f * ( float ) lPoints.size() );
  for ( float i = 0.f; i <= 1.f; i+= fStep )
  {

    CPoint2D p2D = GetBezierPoint( lPoints, i );
    DrawLine( p2DStart, p2D );
    p2DStart = p2D;
  }
  DrawLine( p2DStart, lPoints.back() );

    // Draw control polygon
  if ( m_bDrawPoly )
  {
    PointSetIt i = m_Points.begin(), iPrev = i++;
    do {
      DrawLine( *iPrev, *i );
      iPrev = i++;
    } while ( i != m_Points.end() );
  }
}
void dRuntimeProfiler::DrawConcurrentChart(int count, const dFloat* const times, const dVector* colors)
{
    int leftBorder = 10;
    int rightBorder = 70;

    glBegin(GL_LINES);
    glVertex3f (leftBorder, m_height - m_nextLine, 0.0f);
    glVertex3f (m_width - rightBorder, m_height - m_nextLine, 0.0f);

    int samples = 12;

    dFloat with = m_width - leftBorder - rightBorder;
    for (int i = 0 ; i <= samples; i ++) {
        dFloat x = i * with / samples;
        glVertex3f (leftBorder + x, m_height - m_nextLine - 4, 0.0f);
        glVertex3f (leftBorder + x, m_height - m_nextLine + 4, 0.0f);
    }
    glEnd();

    dFloat timeStep = ((1.0f / 60.0f) * 1000.0f) / 4.0f;
    dFloat x0 = 0;
    for (int i = 0; i < count; i ++) {
        dFloat step = times[i] * with / (timeStep * samples);
        DrawRectangle(leftBorder + x0, m_nextLine - 5.0f, step, 10, colors[i]);
        x0 += step;
    }

    dFloat acc = 0.0f;
    for (int i = 0 ; i <= samples; i ++) {
        char text[256];
        sprintf (text, "%4.2f ms", acc);
        dFloat x = i * with / samples;
        DrawLabel (leftBorder + x, m_height - m_nextLine, text);
        acc += timeStep;
    }
}
示例#30
0
/* virtual */ void
CFlowInspectorDefault::PostUpdate(IFlowGraph * pGraph)
{
	ColorF headColor   ( 1.0f,0.5f,0.5f,1.0f );
	ColorF filterColor ( 1.0f,0.1f,0.1f,1.0f );
	if (!m_bPaused)
	{
		UpdateRecords();
	}

#if 1
	if (m_newCont <= MAX_ROWS_CONT) 
		DrawLabel(2,0,headColor,0.2f, "Continuous Flows:");
	else
		DrawLabel(2,0,headColor,0.2f, "Continuous Flows [truncated]:");

	DrawRecords(m_contRecords,1, m_bPaused ? 0.0f : MAX_AGE_CONT);
	if (m_newOneTime <= MAX_ROWS) 
		DrawLabel(2,1+MAX_ROWS_CONT,headColor,0.2f, "Flows:");
	else
		DrawLabel(2,1+MAX_ROWS_CONT,headColor,0.2f, "Flows [truncated]:");

	if (m_bPaused)
		DrawLabel(2,-1,headColor,0.5f, "Paused:");
	
	if (m_filters.empty() == false)
		DrawLabel(11,-1,filterColor,0.0, "Filter Active");

	DrawRecords(m_oneTimeRecords,1+1+MAX_ROWS_CONT, m_bPaused ? 0.0f : MAX_AGE);
#endif

	m_bProcessing = true; // FIXME: actually we should set it to 'false' now, but then we don't get EntityEvents, which occur not during the FG update phase
	m_curRecords.resize(0);

	if (gEnv->pInput)
	{
		static TKeyName scrollKey("scrolllock");
		if (gEnv->pInput->InputState(scrollKey, eIS_Pressed))
			m_bPaused = !m_bPaused;
	}
}