コード例 #1
0
int32 FSequencerTimeSliderController::OnPaintTimeSlider( bool bMirrorLabels, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
	const bool bEnabled = bParentEnabled;
	const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;

	TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
	const float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
	const float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
	const float LocalSequenceLength = LocalViewRangeMax-LocalViewRangeMin;
	
	FVector2D Scale = FVector2D(1.0f,1.0f);
	if ( LocalSequenceLength > 0)
	{
		FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size );
	
		const float MajorTickHeight = 9.0f;
	
		FDrawTickArgs Args;
		Args.AllottedGeometry = AllottedGeometry;
		Args.bMirrorLabels = bMirrorLabels;
		Args.bOnlyDrawMajorTicks = false;
		Args.TickColor = FLinearColor::White;
		Args.ClippingRect = MyClippingRect;
		Args.DrawEffects = DrawEffects;
		Args.StartLayer = LayerId;
		Args.TickOffset = bMirrorLabels ? 0.0f : FMath::Abs( AllottedGeometry.Size.Y - MajorTickHeight );
		Args.MajorTickHeight = MajorTickHeight;

		DrawTicks( OutDrawElements, RangeToScreen, Args );

		const float HandleSize = 13.0f;
		float HalfSize = FMath::TruncToFloat(HandleSize/2.0f);

		// Draw the scrub handle
		const float XPos = RangeToScreen.InputToLocalX( TimeSliderArgs.ScrubPosition.Get() );

		// Should draw above the text
		const int32 ArrowLayer = LayerId + 2;
		FPaintGeometry MyGeometry =	AllottedGeometry.ToPaintGeometry( FVector2D( XPos-HalfSize, 0 ), FVector2D( HandleSize, AllottedGeometry.Size.Y ) );
		FLinearColor ScrubColor = InWidgetStyle.GetColorAndOpacityTint();

		// @todo Sequencer this color should be specified in the style
		ScrubColor.A = ScrubColor.A*0.5f;
		ScrubColor.B *= 0.1f;
		ScrubColor.G *= 0.2f;
		FSlateDrawElement::MakeBox( 
			OutDrawElements,
			ArrowLayer, 
			MyGeometry,
			bMirrorLabels ? ScrubHandleUp : ScrubHandleDown,
			MyClippingRect, 
			DrawEffects, 
			ScrubColor
			);

		return ArrowLayer;
	}

	return LayerId;
}
コード例 #2
0
void kwxAngularMeter::ConstructBackground()
{
    m_BackgroundDc.SelectObject(*membitmap);
    m_BackgroundDc.SetBackground(GetBackgroundColour());
    m_BackgroundDc.Clear();
    m_BackgroundDc.SetPen(*wxRED_PEN);
    //m_BackgroundDc.SetBrush(*wxTRANSPARENT_BRUSH);
    m_BackgroundDc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*wxRED,wxSOLID));

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

    ///////////////////

	//Rectangle

	//m_BackgroundDc.SetPen(*wxThePenList->FindOrCreatePen(m_cBorderColour, 1, wxSOLID));
	//m_BackgroundDc.DrawRectangle(0,0,w,h);

	//Fields
	DrawSectors(m_BackgroundDc) ;
	//Ticks
	if (m_nTick > 0)
		DrawTicks(m_BackgroundDc);
}
コード例 #3
0
void kwxAngularMeter::OnPaint(wxPaintEvent& WXUNUSED(event))
{
	wxPaintDC old_dc(this);
	
	int w,h ;
	
	GetClientSize(&w,&h);

	/////////////////


	// Create a memory DC
	wxMemoryDC dc;
	dc.SelectObject(*membitmap);

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



    if (m_pPreviewBmp && m_pPreviewBmp->Ok())
		dc.DrawBitmap( *m_pPreviewBmp, 1, 1 );



	///////////////////

	//Rettangolo

	dc.SetPen(*wxThePenList->FindOrCreatePen(m_cBorderColour, 1, wxSOLID));
	dc.DrawRectangle(0,0,w,h);
	
	//settori
	DrawSectors(dc) ;

	//tacche
	if (m_nTick > 0)
		DrawTicks(dc);

	//indicatore lancetta

	DrawNeedle(dc);

	
	//testo valore
	if (m_bDrawCurrent) 
	{
		wxString valuetext;
		valuetext.Printf("%d",m_nRealVal);
		dc.SetFont(m_Font);
		dc.DrawText(valuetext, (w / 2) - 10, (h / 2) + 10);
	}

	// We can now draw into the memory DC...
	// Copy from this DC to another DC.
	old_dc.Blit(0, 0, w, h, &dc, 0, 0);
}
コード例 #4
0
int32 FSequencerTimeSliderController::OnPaintSectionView( const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, bool bEnabled, bool bDisplayTickLines, bool bDisplayScrubPosition  ) const
{
	const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;

	TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
	float LocalScrubPosition = TimeSliderArgs.ScrubPosition.Get();

	float ViewRange = LocalViewRange.Size<float>();
	float PixelsPerInput = ViewRange > 0 ? AllottedGeometry.Size.X / ViewRange : 0;
	float LinePos =  (LocalScrubPosition - LocalViewRange.GetLowerBoundValue()) * PixelsPerInput;

	FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size );

	if( bDisplayTickLines )
	{
		// Draw major tick lines in the section area
		FDrawTickArgs Args;
		Args.AllottedGeometry = AllottedGeometry;
		Args.bMirrorLabels = false;
		Args.bOnlyDrawMajorTicks = true;
		Args.TickColor = FLinearColor( 0.3f, 0.3f, 0.3f, 0.3f );
		Args.ClippingRect = MyClippingRect;
		Args.DrawEffects = DrawEffects;
		// Draw major ticks under sections
		Args.StartLayer = LayerId-1;
		// Draw the tick the entire height of the section area
		Args.TickOffset = 0.0f;
		Args.MajorTickHeight = AllottedGeometry.Size.Y;

		DrawTicks( OutDrawElements, RangeToScreen, Args );
	}

	if( bDisplayScrubPosition )
	{
		// Draw a line for the scrub position
		TArray<FVector2D> LinePoints;
		LinePoints.AddUninitialized(2);
		LinePoints[0] = FVector2D( 1.0f, 0.0f );
		LinePoints[1] = FVector2D( 1.0f, FMath::RoundToFloat( AllottedGeometry.Size.Y ) );

		FSlateDrawElement::MakeLines(
			OutDrawElements,
			LayerId+1,
			AllottedGeometry.ToPaintGeometry( FVector2D(LinePos, 0.0f ), FVector2D(1.0f,1.0f) ),
			LinePoints,
			MyClippingRect,
			DrawEffects,
			FLinearColor::White,
			false
			);
	}

	return LayerId;
}
コード例 #5
0
ファイル: AngularMeter.cpp プロジェクト: BMWPower/gaugeWorks
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);
}
コード例 #6
0
bool THISCLASS::Paint(wxPaintDC &dc) {
	// Get timeline
	const SwisTrackCoreEventRecorder::Timeline *timeline = mSwisTrack->mSwisTrackCore->mEventRecorder->GetLastTimeline();
	if (timeline == 0) {
		return false;
	}

	// Draw background
	dc.SetBackground(wxBrush(wxColour(0xff, 0xff, 0xff)));
	dc.Clear();

	// Draw
	DrawTrigger(dc, timeline);
	DrawTicks(dc, timeline);
	DrawComponentSteps(dc, timeline);
	DrawStepLapTimes(dc, timeline);
	DrawSteps(dc, timeline);
	DrawStartStop(dc, timeline);
	DrawBeginEnd(dc, timeline);
	DrawTimelineOverflow(dc, timeline);

	return true;
}
コード例 #7
0
int32 FSequencerTimeSliderController::OnPaintTimeSlider( bool bMirrorLabels, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const
{
	const bool bEnabled = bParentEnabled;
	const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect;

	TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get();
	const float LocalViewRangeMin = LocalViewRange.GetLowerBoundValue();
	const float LocalViewRangeMax = LocalViewRange.GetUpperBoundValue();
	const float LocalSequenceLength = LocalViewRangeMax-LocalViewRangeMin;
	
	FVector2D Scale = FVector2D(1.0f,1.0f);
	if ( LocalSequenceLength > 0)
	{
		FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size );
	
		const float MajorTickHeight = 9.0f;
	
		FDrawTickArgs Args;
		Args.AllottedGeometry = AllottedGeometry;
		Args.bMirrorLabels = bMirrorLabels;
		Args.bOnlyDrawMajorTicks = false;
		Args.TickColor = FLinearColor::White;
		Args.ClippingRect = MyClippingRect;
		Args.DrawEffects = DrawEffects;
		Args.StartLayer = LayerId;
		Args.TickOffset = bMirrorLabels ? 0.0f : FMath::Abs( AllottedGeometry.Size.Y - MajorTickHeight );
		Args.MajorTickHeight = MajorTickHeight;

		DrawTicks( OutDrawElements, RangeToScreen, Args );

		FPaintPlaybackRangeArgs PlaybackRangeArgs(
			bMirrorLabels ? FEditorStyle::GetBrush("Sequencer.Timeline.PlayRange_Bottom_L") : FEditorStyle::GetBrush("Sequencer.Timeline.PlayRange_Top_L"),
			bMirrorLabels ? FEditorStyle::GetBrush("Sequencer.Timeline.PlayRange_Bottom_R") : FEditorStyle::GetBrush("Sequencer.Timeline.PlayRange_Top_R"),
			6.f
		);
		LayerId = DrawPlaybackRange(AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, RangeToScreen, PlaybackRangeArgs);

		float HalfSize = FMath::CeilToFloat(ScrubHandleSize/2.0f);

		// Draw the scrub handle
		float XPos = RangeToScreen.InputToLocalX( TimeSliderArgs.ScrubPosition.Get() );

		// Should draw above the text
		const int32 ArrowLayer = LayerId + 2;
		FPaintGeometry MyGeometry =	AllottedGeometry.ToPaintGeometry( FVector2D( XPos-HalfSize, 0 ), FVector2D( ScrubHandleSize, AllottedGeometry.Size.Y ) );
		FLinearColor ScrubColor = InWidgetStyle.GetColorAndOpacityTint();

		// @todo Sequencer this color should be specified in the style
		ScrubColor.A = ScrubColor.A*0.75f;
		ScrubColor.B *= 0.1f;
		ScrubColor.G *= 0.2f;
		FSlateDrawElement::MakeBox( 
			OutDrawElements,
			ArrowLayer, 
			MyGeometry,
			bMirrorLabels ? ScrubHandleUp : ScrubHandleDown,
			MyClippingRect, 
			DrawEffects, 
			ScrubColor
			);

		// Draw the current time next to the scrub handle
		float Time = TimeSliderArgs.ScrubPosition.Get();

		FString FrameString;
		if (SequencerSnapValues::IsTimeSnapIntervalFrameRate(TimeSliderArgs.Settings->GetTimeSnapInterval()) && TimeSliderArgs.Settings->GetShowFrameNumbers())
		{
			float FrameRate = 1.0f/TimeSliderArgs.Settings->GetTimeSnapInterval();
			float FrameTime = Time * FrameRate;
			int32 Frame = SequencerHelpers::TimeToFrame(Time, FrameRate);
					
			const float FrameTolerance = 0.001f;
			if (FMath::IsNearlyEqual(FrameTime, (float)Frame, FrameTolerance))
			{
				FrameString = FString::Printf( TEXT("%d"), TimeToFrame(Time));
			}
			else
			{
				FrameString = FString::Printf( TEXT("%.3f"), FrameTime);
			}
		}
		else
		{
			FrameString = FString::Printf( TEXT("%.2f"), Time );
		}

		FSlateFontInfo SmallLayoutFont( FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), 10 );

		const TSharedRef< FSlateFontMeasure > FontMeasureService = FSlateApplication::Get().GetRenderer()->GetFontMeasureService();
		FVector2D TextSize = FontMeasureService->Measure(FrameString, SmallLayoutFont);

		// Flip the text position if getting near the end of the view range
		if ((AllottedGeometry.Size.X - XPos) < (TextSize.X + 14.f))
		{
			XPos = XPos - TextSize.X - 12.f;
		}
		else
		{
			XPos = XPos + 10.f;
		}

		FVector2D TextOffset( XPos,  Args.bMirrorLabels ? TextSize.Y-6.f : Args.AllottedGeometry.Size.Y - (Args.MajorTickHeight+TextSize.Y) );

		FSlateDrawElement::MakeText(
			OutDrawElements,
			Args.StartLayer+1, 
			Args.AllottedGeometry.ToPaintGeometry( TextOffset, TextSize ), 
			FrameString, 
			SmallLayoutFont, 
			Args.ClippingRect, 
			Args.DrawEffects,
			Args.TickColor 
		);
		
		if (MouseDragType == DRAG_SETTING_RANGE)
		{
			float MouseStartPosX = RangeToScreen.InputToLocalX(MouseDownRange[0]);
			float MouseEndPosX = RangeToScreen.InputToLocalX(MouseDownRange[1]);

			float RangePosX = MouseStartPosX < MouseEndPosX ? MouseStartPosX : MouseEndPosX;
			float RangeSizeX = FMath::Abs(MouseStartPosX - MouseEndPosX);

			FSlateDrawElement::MakeBox(
				OutDrawElements,
				LayerId+1,
				AllottedGeometry.ToPaintGeometry( FVector2D(RangePosX, 0.f), FVector2D(RangeSizeX, AllottedGeometry.Size.Y) ),
				bMirrorLabels ? ScrubHandleDown : ScrubHandleUp,
				MyClippingRect,
				DrawEffects,
				MouseStartPosX < MouseEndPosX ? FLinearColor(0.5f, 0.5f, 0.5f) : FLinearColor(0.25f, 0.3f, 0.3f)
			);
		}

		return ArrowLayer;
	}

	return LayerId;
}
コード例 #8
0
ファイル: plotter.cpp プロジェクト: asimay/ScaViSLAM_ros
void Plotter::Render()
{
  if( track_front )
  {
    const float d = int_x[1] - log->x;
    int_x[0] -= d;
    int_x[1] -= d;
  }

  ActivateScissorAndClear();
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(int_x[0], int_x[1], int_y[0], int_y[1]);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  glPushAttrib(GL_ENABLE_BIT);
  glEnable(GL_LINE_SMOOTH);
  glDisable(GL_LIGHTING);

  DrawTicks();

  if( log && log->sequences.size() > 0 )
  {
    if( plot_mode==XY )
    {
      for( unsigned int s=0; s < log->sequences.size() / 2; ++s )
      {
        if( (s > 9) ||  show[s] )
        {
          glColor3fv(plot_colours[s%num_plot_colours]);
          DrawSequence(log->sequences[2*s],log->sequences[2*s+1]);
        }
      }
    }
    else if( plot_mode==TIME_SERIES)
    {
      for( unsigned int s=0; s < log->sequences.size(); ++s )
      {
        if( (s > 9) ||  show[s] )
        {
          glColor3fv(plot_colours[s%num_plot_colours]);
          DrawSequence(log->sequences[s]);
        }
      }
    }
    else if( plot_mode==STACKED_HISTOGRAM )
    {
      DrawSequenceHistogram(log->sequences);
    }
    else
    {
      assert(false);
    }
  }

  if( mouse_state & MouseButtonLeft )
  {
    if( plot_mode==XY )
    {
      glColor3fv(colour_ms);
      glBegin(GL_LINE_STRIP);
      glVertex2f(mouse_xy[0],int_y[0]);
      glVertex2f(mouse_xy[0],int_y[1]);
      glEnd();
      glBegin(GL_LINE_STRIP);
      glVertex2f(int_x[0],mouse_xy[1]);
      glVertex2f(int_x[1],mouse_xy[1]);
      glEnd();
      stringstream ss;
      ss << "(" << mouse_xy[0] << "," << mouse_xy[1] << ")";
      glColor3f(1.0,1.0,1.0);
      OpenGlRenderState::ApplyWindowCoords();
      glRasterPos2f( v.l+5,v.b+5 );
      glutBitmapString(font,(unsigned char*)ss.str().c_str());
    }else{
      int xu = (int)mouse_xy[0];
      glColor3fv(colour_ms);
      glBegin(GL_LINE_STRIP);
      glVertex2f(xu,int_y[0]);
      glVertex2f(xu,int_y[1]);
      glEnd();
      stringstream ss;
      glColor3f(1.0,1.0,1.0);
      ss << "x=" << xu << " ";
      OpenGlRenderState::ApplyWindowCoords();
      int tx = v.l+5;
      glRasterPos2f( tx,v.b+5 );
      glutBitmapString(font,(unsigned char*)ss.str().c_str());
      tx += glutBitmapLength(font,(unsigned char*)ss.str().c_str());
      for( unsigned int s=0; s<log->sequences.size(); ++s )
      {
        if( (s > show_n || show[s]) && log->sequences[s].HasData(xu) )
        {
          stringstream ss;
          ss << " " << log->sequences[s][xu];
          glColor3fv(plot_colours[s%num_plot_colours]);
          glRasterPos2f( tx,v.b+5 );
          glutBitmapString(font,(unsigned char*)ss.str().c_str());
          tx += glutBitmapLength(font,(unsigned char*)ss.str().c_str());
        }
      }
    }
  }

  float ty = v.h-15;
  for (size_t i=0; i<log->labels.size(); ++i)
  {
    glColor3fv(plot_colours[i%num_plot_colours]);

    OpenGlRenderState::ApplyWindowCoords();
    glRasterPos2f( v.l+5,ty);
    glutBitmapString(font,(unsigned char*)log->labels[i].c_str());
    ty -= 15;
  }

  glPopAttrib();
}
コード例 #9
0
ファイル: PlotDlg.cpp プロジェクト: jhp333/aux
void CPlotDlg::OnPaint() 
{
	PAINTSTRUCT  ps;
	if (hDlg==NULL) return;
	HDC hdc = BeginPaint(hDlg, &ps);
	if (hdc==NULL) return;
	CDC dc(hdc, hDlg);
	int radius = 5;
	CPen **pen, **txtPen;
	CRect circleRt;
	CPoint pt;
	CAxis *ax;
	Win32xx::CRect rt;
	double x,y;
	CStdString s;
	CSignals signal;

	GetClientRect(hDlg, &rt);
	if (rt.Height()<15) return;
	dc.SolidFill(gcf->color, rt);

	for (int j=0; j<gcf->nAxes; j++)
	{
		ax = gcf->ax[j];
		if (ax->xlim[1]<ax->xlim[0])
			ax->setRangeFromLines('x');
		if (ax->ylim[1]<ax->ylim[0])
			ax->setRangeFromLines('y');
		ax->rcAx=DrawAxis(&dc,ax);
		pen = new CPen*[ax->nLines];
		for (int i=0; i<ax->nLines; i++) {
			pen[i] = new CPen;
			pen[i]->CreatePen(PS_SOLID, 1, ax->m_ln[i]->color);
			dc.SelectObject(pen[i]);
			if (ax->m_ln[i]->symbol!=0)
			{
				for (int k=0; k<ax->m_ln[i]->len; k++) {
					pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->m_ln[i]->ydata[k]);
					if(IsInsideRect(&ax->rcAx, &pt))
					{
						circleRt.SetRect(pt+CPoint(-radius,-radius), pt+CPoint(radius,radius));
						dc.Ellipse(circleRt);
					}
				}
			}
			if (ax->m_ln[i]->lineWidth>0)
			{
				bool fLineStarted = false;
				for (int k=0; k<ax->m_ln[i]->len; k++) {
					for (int l=0; l<2; ++l) {	// to retry at the edge
						if (l==0)
							pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->m_ln[i]->ydata[k]);
						else if (ax->ylim[1] - ax->m_ln[i]->ydata[k] < ax->m_ln[i]->ydata[k] - ax->ylim[0]) 
							pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->ylim[1]);	// top edge
						else
							pt = ax->GetPixelAbs(ax->m_ln[i]->xdata[k],ax->ylim[0]);	// bottom edge

						if (IsInsideRect(&ax->rcAx, &pt))
						{
							if (fLineStarted)
								dc.LineTo(pt);
							else {
								dc.MoveTo(pt);
								fLineStarted = true;
							}
							break;
						}
					}
				}
			}
			pen[i]->DeleteObject();
			delete pen[i];
		}
		// add ticks and ticklabels
		DrawTicks(&dc, ax);
		delete[] pen;
	}

	//Drawing texts
	dc.SetTextAlign(TA_LEFT);
	txtPen = new CPen*[gcf->nTexts];
	for (int j=0; j<gcf->nTexts; j++) {
		txtPen[j] = new CPen;
		txtPen[j]->CreatePen(PS_SOLID, 1, gcf->text[j]->color);
		dc.SelectObject(txtPen[j]);
		dc.SelectObject(&gcf->text[j]->font);
		pt.x = (int)((double)rt.right * gcf->text[j]->pos.x0+.5);
		pt.y = (int)((double)rt.bottom * gcf->text[j]->pos.y0+.5);
		dc.TextOut(pt.x, pt.y, gcf->text[j]->string);
		txtPen[j]->DeleteObject();
		delete txtPen[j];
	}
	delete[] txtPen;

	// Drawing coordiate
	if (gcmp.x!=-1 &&gcmp.y!=-1 && gca->nLines>0)
	{
		if(!GetSignalInRange(signal,0))		{	return;	}
		gca->GetCoordinate(&gcmp, x, y);
		s.Format("%f, %f %7.2fdBrms", x,y, signal.LevelLT());
		dc.TextOut(gca->axRect.right-200, gca->axRect.top-10, s);
	}

	//Sound play buffer done (each block)
	if (soundID>-1)
	{
 		s.Format("%d", (int)((double)soundID*block));
		dc.TextOut(gca->axRect.right-200, gca->axRect.top+30, s);
	}


	EndPaint(hDlg, &ps);
}
コード例 #10
0
kwxAngularMeter::kwxAngularMeter(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size)
	: wxWindow(parent, id, pos, size, 0)
{

  if (parent)
    SetBackgroundColour(parent->GetBackgroundColour());
  else
    SetBackgroundColour(*wxLIGHT_GREY);

    //SetSize(size);
    SetAutoLayout(TRUE);
	Refresh();

	m_id = id;

	//Default values

	m_nScaledVal = 0;		//degrees
	m_nRealVal = 0;
	m_nTick = 0;	//number of notches
	m_nSec = 1;		//default number of sectors
	m_nRangeStart = 0;
	m_nRangeEnd = 220;
	m_nAngleStart = -20;
	m_nAngleEnd = 200;
	m_aSectorColor[0] = *wxWHITE;
//	m_cBackColour = *wxLIGHT_GREY;
	m_cBackColour = GetBackgroundColour() ;		//default background application
	m_cNeedleColour = *wxRED;	//indicator
	m_cBorderColour = GetBackgroundColour() ;
	m_dPI = 4.0 * atan(1.0);
	m_Font = *wxSWISS_FONT;	//font
	m_bDrawCurrent = true ;

	membitmap = new wxBitmap(size.GetWidth(), size.GetHeight()) ;

    m_BackgroundDc.SelectObject(*membitmap);
    m_BackgroundDc.SetBackground(parent->GetBackgroundColour());
    m_BackgroundDc.Clear();
    m_BackgroundDc.SetPen(*wxRED_PEN);
    //m_BackgroundDc.SetBrush(*wxTRANSPARENT_BRUSH);
    m_BackgroundDc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*wxRED,wxSOLID));

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

    ///////////////////

	//Rectangle

	//m_BackgroundDc.SetPen(*wxThePenList->FindOrCreatePen(m_cBorderColour, 1, wxSOLID));
	//m_BackgroundDc.DrawRectangle(0,0,w,h);

	//Fields
	DrawSectors(m_BackgroundDc) ;

	//Ticks
	if (m_nTick > 0)
		DrawTicks(m_BackgroundDc);



    //m_BackgroundDc.DrawRectangle(wxRect(10, 10, 100, 100));

	/////////////// TODO : Test for BMP image loading /////////////////
/*

	m_pPreviewBmp = NULL ;

    wxBitmap bitmap( 300, 300 );
    wxImage image = bitmap.ConvertToImage();

    image.Destroy();

    if ( !image.LoadFile( "thumbnail.bmp", wxBITMAP_TYPE_BMP ) )
        wxLogError(wxT("Can't load BMP image"));
    else
        m_pPreviewBmp = new wxBitmap( image );
*/
    m_bNeedRedrawBackground = false;

}