Exemplo n.º 1
0
void __fastcall TTScope::PaintPosition(void)
{
	TCanvas *pCanvas = pBitmap->Canvas;

	TRect rc;
	rc.Top = 0;
	rc.Bottom = GAGEWIDTH;
	rc.Left = 0;
	rc.Right = pBitmap->Width;

	pCanvas->Brush->Color = clBlack;
	pCanvas->FillRect(rc);

	int xw = (m_XW * rc.Right) / pScope->m_ScopeSize;
	int x = (m_XOFF * rc.Right) / pScope->m_ScopeSize;
	int xc = (m_CursorX * rc.Right) / pScope->m_ScopeSize;
	pCanvas->Brush->Color = clGreen;
	rc.Left = x;
	rc.Right = x + xw;
	pCanvas->FillRect(rc);

	pCanvas->Pen->Color = clYellow;
	pCanvas->Pen->Style = psSolid;
	pCanvas->MoveTo(xc, rc.Top);
	pCanvas->LineTo(xc, rc.Bottom);

	pCanvas->Font->Color = clWhite;
	pCanvas->Font->Size = 8;
	char bf[32];
	sprintf(bf, "Gain:%.1lf", m_Gain);
	::SetBkMode(pCanvas->Handle, TRANSPARENT);
	pCanvas->TextOut(0, 0, bf);
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawLevel(void)
{
	if( m_pRxSet == NULL ) return;
	if( !m_pBitmapLevel ) return;

    TCanvas *pCanvas = m_pBitmapLevel->Canvas;
    TRect rc;
    rc.Left = 0; rc.Top = 0;
    rc.Right = m_levelXW; rc.Bottom = m_levelYW;
    pCanvas->Brush->Color = clBlack;
    pCanvas->Pen->Color = clBlack;
    pCanvas->FillRect(rc);

//	pCanvas->Pen->Color = clYellow;
	int d = m_pRxSet->m_StgFFT.Sig - 500;
	if( m_pRxSet->IsMFSK() && sys.m_MFSK_SQ_Metric ){
		d = m_pRxSet->m_pDem->GetMFSKMetric(0);
	}
   	if( d > LEVELMAX ) d = LEVELMAX;

	if( m_pRxSet->m_pDem->m_AGC.GetOver() && !MainVARI->m_TX ){
		pCanvas->Brush->Color = clRed;
    }
	else if( !m_pRxSet->m_pDem->m_Lock ){
		pCanvas->Brush->Color = m_pRxSet->m_SQ ? clBlue : clGray;
    }
    else {
		pCanvas->Brush->Color = m_pRxSet->m_SQ ? TColor(RGB(0,255,0)) : clGray;
    }
  	rc.Right = (d * m_levelXW / LEVELMAX);
   	pCanvas->FillRect(rc);
    pCanvas->Pen->Color = m_pRxSet->m_SQ ? clBlack : clWhite;
	d = (m_pRxSet->m_SQLevel * m_levelXW / LEVELMAX);
	pCanvas->MoveTo(d, 0); pCanvas->LineTo(d, m_levelYW);
}
void __fastcall TfrmMainFormServer::lstModulesDrawItem(
      TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
    TRect cRect(0, 0, lstModules->Width, lstModules->Height);


    TCanvas*        pCanvas     = ((TListBox*)Control)->Canvas;

    pCanvas->FillRect(Rect);  //This clears the rect

    Graphics::TBitmap* bitmap = new Graphics::TBitmap();
    AnsiString moduleName = lstModules->Items->Strings[Index];

    if(Index == 0){
        imgList->GetBitmap(1, bitmap);    //table image
    }else{
        imgList->GetBitmap(0, bitmap);    //table image
    }

    
    pCanvas->Draw(Rect.Left + 1, Rect.Top, bitmap);
    delete bitmap;

    pCanvas->TextOut(Rect.Left + 22, Rect.Top + 2, moduleName);


}
Exemplo n.º 4
0
//---------------------------------------------------------------------------
void __fastcall TConfDlg::HostBoxDrawItem(TWinControl *Control, int Index,
	TRect &Rect, TOwnerDrawState State)
{
	int Offset = 2;// default offset
    TColor FC,BC,PC;
	TListBox *ListBox = dynamic_cast<TListBox*>(Control);
	TCanvas *Canvas = ListBox->Canvas;
    BC=Canvas->Brush->Color;
    PC=Canvas->Pen->Color;
    Canvas->Brush->Color=clWindow;
    HostData *actHost;

	// display the text
   FC=Canvas->Font->Color;
   if(!Servers->Refreshing) {
	   actHost=(*Servers)[ListBox->Items->Strings[Index].c_str()];
	   	if(!(actHost)||!actHost->Alive||!(actHost->State) || !(actHost->State->Valid))
   			Canvas->Font->Color=clRed;
   		else
   			Canvas->Font->Color=clWindowText;
    } else Canvas->Font->Color=clGrayText;

   if((ListBox->Focused() || AddBtn->Focused()) && State.Contains(odSelected)) {
   		Canvas->Brush->Color=Canvas->Font->Color;
        Canvas->Font->Color=clHighlightText;
   }
   Canvas->Pen->Color=Canvas->Brush->Color;
   Canvas->FillRect(Rect);                       // clear the rectangle
   Canvas->TextOut(Rect.Left + Offset, Rect.Top, ListBox->Items->Strings[Index]);
   Canvas->Font->Color=FC;
   Canvas->Brush->Color=BC;
   Canvas->Pen->Color=PC;
}
Exemplo n.º 5
0
void
TGUIScoreView::InvalidateBuffer()
{
    TCanvas *canvas = buffer->Canvas;
    canvas->Font->Height = viewTRect.Height() / 2;

    AnsiString  successTrialsString = IntToStr( successTrials ),
                totalTrialsString = IntToStr( totalTrials );

    int successTrialsWidth = canvas->TextWidth( successTrialsString ),
        totalTrialsWidth = canvas->TextWidth( totalTrialsString ),
        maxWidth = MAX( successTrialsWidth, totalTrialsWidth );

    buffer->Height = viewTRect.Height();
    buffer->Width = maxWidth;

    canvas->FillRect( TRect( 0, 0, buffer->Width, buffer->Height ) );
    canvas->TextOut( maxWidth - successTrialsWidth, 0, successTrialsString );
    canvas->TextOut( maxWidth - totalTrialsWidth, buffer->Height / 2, totalTrialsString );

    TGUIView::InvalidateRect( TRect( viewTRect.Left,
                                     viewTRect.Top,
                                     viewTRect.Left + buffer->Width,
                                     viewTRect.Top + buffer->Height ) );
}
Exemplo n.º 6
0
void __fastcall TConfDlg::SelectedBoxDrawItem(TWinControl *Control, int Index,
	TRect &Rect, TOwnerDrawState State)
{
	int Offset = 2;// default offset
    TColor FC,BC,PC;
	TListBox *ListBox = dynamic_cast<TListBox*>(Control);
	TCanvas *Canvas = ListBox->Canvas;
    BC=Canvas->Brush->Color;
    PC=Canvas->Pen->Color;
    FC = Canvas->Font->Color;
    Canvas->Brush->Color=clWindow;
    CHostRef *actHost;
    TFontStyles FS;


    FS = Canvas->Font->Style;
    actHost=(CHostRef *)ListBox->Items->Objects[Index];
    if((*actHost)->ProcData || (*actHost)->Account)
   		Canvas->Font->Style = FS<<fsBold;

	Canvas->Font->Color=clWindowText;
   	if((ListBox->Focused() || RemoveBtn->Focused()) && State.Contains(odSelected)) {
   		Canvas->Brush->Color=Canvas->Font->Color;
        Canvas->Font->Color=clHighlightText;
   	}
   	Canvas->Pen->Color=Canvas->Brush->Color;
   	Canvas->FillRect(Rect);                       // clear the rectangle
   	Canvas->TextOut(Rect.Left + Offset, Rect.Top, ListBox->Items->Strings[Index]);
   	Canvas->Font->Color=FC;
   	Canvas->Brush->Color=BC;
   	Canvas->Pen->Color=PC;
   	Canvas->Font->Style=FS;
}
Exemplo n.º 7
0
void
TGUIBackgroundView::Paint()
{
    TCanvas *canvas = GetCanvas();
    canvas->Pen->Color = TGUIView::GetElementColor( fbBackground ).cl;
    canvas->Brush->Color = canvas->Pen->Color;
    canvas->FillRect( viewTRect );
}
Exemplo n.º 8
0
void LBMessage_DrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
	TListBox* lbox = dynamic_cast<TListBox*>(Control);
	if (!lbox) return;

	TCanvas* canvas = lbox->Canvas;

	// Set defaults:
	canvas->Brush->Color = lbox->Color;
	canvas->Font->Style = lbox->Font->Style;

	TLBMessageStyle style = (TLBMessageStyle)lbox->Items->Objects[Index];

	switch (style)
	{
		default:
		case smtDefaultB:
		case smtDefB:
			canvas->Font->Style = canvas->Font->Style << fsBold;
		case smtDefault:
		case smtDef:
			canvas->Font->Color = clWindowText;
			break;

		case smtNotificationB:
		case smtNotifB:
			canvas->Font->Color = clNavy;
			canvas->Font->Style = canvas->Font->Style << fsBold;
			canvas->Brush->Color = (TColor)0xFFF0F0;
			break;
		case smtNotification:
		case smtNotif:
			canvas->Font->Color = clBlue;
			break;

		case smtWarning:
			//canvas->Font->Color = clFuchsia;
			canvas->Font->Color = (TColor)0x9900cc;
			break;

		case smtError:
			canvas->Font->Color = clRed;
			canvas->Brush->Color = clCream;
			break;

		case smtAppError:
			canvas->Font->Color = clYellow;
			canvas->Brush->Color = clRed;
			break;
	}

	// Clear the rectangle: (NECESSARY!)
	canvas->FillRect(Rect);

	// Display text:
	canvas->TextOut(Rect.Left + 2, Rect.Top, lbox->Items->Strings[Index]);
}
Exemplo n.º 9
0
 void DoubleBufferedCanvas::clear()
 {
   if (doubleBuffered)
   {
     TCanvas *canvas = bitmap->Canvas;
     canvas->Brush->Color = clBlack;
     canvas->FillRect(TRect(0, 0, width, height));
   }
 };
Exemplo n.º 10
0
//---------------------------------------------------------------------------
void __fastcall TDialogZeroConf::PaintBoxIPPaint(TObject *Sender)
{
  String S = IP.ToString();
  TCanvas *C = PaintBoxIP->Canvas;
  C->Brush->Color = RGB(51, 51, 51);
  C->FillRect(Bounds(0, 0, 32767, 32767));
  C->Font->Color = clLime;
  C->Font->Size = 40;
  C->TextOut(PaintBoxIP->Width / 2 - C->TextWidth(S) / 2, 5, S);
}
Exemplo n.º 11
0
void __fastcall TTScope::PaintScope(CScope *sp, int n)
{
	TRect rc;

	int YW = (pBitmap->Height - GAGEWIDTH) / 2;
	rc.Top = (YW * n) + GAGEWIDTH;
	rc.Bottom = rc.Top + YW;
	rc.Left = 0;
	rc.Right = pBitmap->Width;

	TCanvas *pCanvas = pBitmap->Canvas;

	pCanvas->Brush->Color = clBlack;
	pCanvas->FillRect(rc);

	if( !sp->GetFlag() ) return;

	if( n < 2 ){
		pCanvas->Pen->Color = clWhite;
		pBitmap->Canvas->Pen->Style = psDot;
		pCanvas->MoveTo(rc.Left, rc.Top + YW/2);
		pCanvas->LineTo(rc.Right, rc.Top + YW/2);
	}

	pCanvas->Pen->Color = clWhite;
	pBitmap->Canvas->Pen->Style = psSolid;
	double d;
	int x, y, xx, xe;
	for( x = 0; x < rc.Right; x++ ){
		xx = (x * m_XW / rc.Right) + m_XOFF;
		xe = xx + (m_XW / rc.Right);
		if( xe >= sp->m_ScopeSize ) xe = sp->m_ScopeSize - 1;
		double *dp = &sp->pScopeData[xx];
		for( ; xx <= xe; xx++, dp++ ){
			d = *dp;
			if( n < 1 ){
				y = rc.Bottom - int(d * YW * m_Gain/16384.0) - 1;
			}
			else {
				y = rc.Bottom - int(d * YW * m_Gain/32768.0) - YW/2;
			}
			if( y < rc.Top ) y = rc.Top;
			if( y > rc.Bottom ) y = rc.Bottom;
			if( x ){
				pCanvas->LineTo(x, y);
			}
			else {
				pCanvas->MoveTo(x, y);
			}
		}
	}
}
Exemplo n.º 12
0
void __fastcall TFwCalcMainDlg::PaintBoxPaint(TObject *Sender)
{
TRect r = TRect(0,0,PaintBox->Width, PaintBox->Height);
TCanvas *cv = PaintBox->Canvas;
	// Paint background
	cv->FillRect(r);
	cv->TextFlags = 0;
	cv->Font->Style = TFontStyles() << fsBold;
	cv->Font->Name = "Courier New";

	SetBkMode(cv->Handle, TRANSPARENT);

int lh = cv->TextHeight("X");
int y_off = r.Height() - lh;
int index = 0;

	while(y_off + lh >= 0)
	{
	// Determine number to write
	AnsiString txt = m_engine->RegisterValue[index].UpperCase();

		if(txt != "")
		{
			if(txt == "ERR")
			{
			AnsiString err_text = AnsiString("ERROR - ") + m_engine->LastError;
				cv->Font->Size = m_font_size;
				cv->Font->Color = clRed;
				cv->TextOut(r.Right - 10 - cv->TextWidth(err_text), y_off, err_text);
			}
			else
			{
				if(m_engine->BaseMode == eBaseDec)
				{
				int tw = CalcWidthOfDecNumber(cv, txt);
					PaintDecNumber(cv, r.Right - 10 - tw, y_off, txt);
				}
				else
				{
					cv->Font->Size = m_font_size;

					cv->TextOut(r.Right-cv->TextWidth(txt)-10, y_off, txt);
				}
			}
		}

		y_off -= lh;
		index++;
	}
}
Exemplo n.º 13
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::PCFFTResize(TObject *Sender)
{
    m_pBitmapFFT->Width = PBoxFFT->Width;
    m_pBitmapFFT->Height = PBoxFFT->Height;
	TCanvas *pCanvas = m_pBitmapFFT->Canvas;
   	pCanvas->Brush->Color = MainVARI->m_tFFTColset[0].c;
	TRect rc;
    rc.Left = 0; rc.Top = 0;
    rc.Right = m_pBitmapFFT->Width;
    rc.Bottom = m_pBitmapFFT->Height;
    pCanvas->FillRect(rc);
	m_fftXW = m_pBitmapFFT->Width;
    m_fftYW = m_pBitmapFFT->Height;
    DrawFFT(TRUE);
}
Exemplo n.º 14
0
void __fastcall TfrmRetrievalJobList::sgJobsDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State) {
    LCDbCryoJob * job;
    TColor background = clWindow;
    if (0 == ARow)
        job = NULL;
    else
        job = (LCDbCryoJob *)sgJobs->Objects[0][ARow];
    if (NULL == job) {
        if (0 == ARow) {
            background = clBtnFace; // header row
        } else {
            background = RETRIEVAL_ASSISTANT_ERROR_COLOUR; // error
        }
    } else {
        switch (job->getStatus()) {
        case LCDbCryoJob::Status::NEW_JOB:
            background = RETRIEVAL_ASSISTANT_JOB_NEW_COLOUR; break;
        case LCDbCryoJob::Status::INPROGRESS:
            background = RETRIEVAL_ASSISTANT_JOB_INPROGRESS_COLOUR; break;
        case LCDbCryoJob::Status::DONE:
            background = RETRIEVAL_ASSISTANT_JOB_COMPLETED_COLOUR; break;
        case LCDbCryoJob::Status::DELETED:
            background = RETRIEVAL_ASSISTANT_JOB_DELETED_COLOUR; break;
        default:
            background = RETRIEVAL_ASSISTANT_ERROR_COLOUR;
        }
    }
    TCanvas * cnv = sgJobs->Canvas;
	cnv->Brush->Color = background;
	cnv->FillRect(Rect);
    if (State.Contains(gdSelected)) {
        TFontStyles oldFontStyle = cnv->Font->Style;
        TPenStyle oldPenStyle = cnv->Pen->Style;
        cnv->Pen->Style = psDot;
        cnv->Rectangle(Rect.Left+1, Rect.Top+1, Rect.Right-1, Rect.Bottom-1);
        cnv->Font->Style = TFontStyles() << fsBold; // << fsItalic;
    	cnv->TextOut(Rect.Left+5, Rect.Top+5, sgJobs->Cells[ACol][ARow]);
        cnv->Pen->Style     = oldPenStyle;
        cnv->Font->Style    = oldFontStyle;
	} else {
        cnv->TextOut(Rect.Left+5, Rect.Top+5, sgJobs->Cells[ACol][ARow]);
    }
}
Exemplo n.º 15
0
void  TfrmSoundLib::OnAttenuationDraw(CanvasValue* sender, void* _canvas, const Irect& _rect)
{
	TCanvas* canvas 	= (TCanvas*)_canvas;
    const TRect& rect	= *((TRect*)&_rect);
//	canvas
    int w = rect.Width();
    int h = rect.Height();
    int x0= rect.left;
    int y0= rect.top;

    canvas->Brush->Color = clBlack;
    canvas->FillRect(rect);
    canvas->Pen->Color = TColor(0x00006600);
    canvas->MoveTo(x0,y0);
    for (int i=0; i<X_GRID+1; i++){
        canvas->LineTo(x0+i*w/X_GRID,y0+h);
        canvas->MoveTo(x0+(i+1)*w/X_GRID,y0+0);
    }
    canvas->MoveTo(x0+0,y0+0);
    for (int j=0; j<Y_GRID+1; j++){
        canvas->LineTo(x0+w,y0+j*h/Y_GRID);
        canvas->MoveTo(x0+0,y0+(j+1)*h/Y_GRID);
    }
    canvas->Pen->Color = clYellow;
    canvas->MoveTo(x0+0,y0+iFloor(float(h)-float(h)*0.01f)); // snd cull = 0.01f
    canvas->LineTo(x0+w,y0+iFloor(float(h)-float(h)*0.01f));

    ESoundThumbnail* thm	= m_THM_Current.back();
    float d_cost 			= thm->MaxDist()/w;
    AnsiString temp;
//    float v = m_D3D.range;
//    temp.sprintf("Range = %.2f",v); lbRange->Caption = temp;
    canvas->Pen->Color = clLime;
    for (int d=1; d<w; d++){
        float R = d*d_cost;
    	float b = thm->MinDist()/(psSoundRolloff*R);
//		float b = m_Brightness/(m_Attenuation0+m_Attenuation1*R+m_Attenuation2*R*R);
        float bb = h-(h*b);
        int y = iFloor(y0+bb); clamp(y,int(rect.Top),int(rect.Bottom));
        if (1==d)	canvas->MoveTo(x0+d,y);
        else		canvas->LineTo(x0+d,y);
    }
}
Exemplo n.º 16
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::PCTResize(TObject *Sender)
{
	BOOL f = m_pBitmapT->Width != PBoxT->Width;

    m_pBitmapT->Width = PBoxT->Width;
    m_pBitmapT->Height = PBoxT->Height;
	if( f ){
		TCanvas *pCanvas = m_pBitmapT->Canvas;
   		pCanvas->Brush->Color = clBlack;
		TRect rc;
    	rc.Left = 0; rc.Top = 0;
	    rc.Right = m_pBitmapT->Width;
	    rc.Bottom = m_pBitmapT->Height;
	    pCanvas->FillRect(rc);

    	m_Clock.Create(PBoxT->Width);
        DrawMsg();
		m_PointRX = 0;
    }
}
Exemplo n.º 17
0
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
      const TRect &Rect, int DataCol, TColumn *Column,
      TGridDrawState State)
{
  iz=0;
  if((!onEdit)&&(ADOTable1->RecordCount!=0))
  {
  String k=ADOTable1->FieldByName("Кабинет")->Value;
  if(k!=Edit2->Text)
  {
     iz++;
     TField *F = Column->Field;
     TCanvas *Cvs = DBGrid1->Canvas;
     Cvs->Brush->Color = clRed;
     Cvs->FillRect(Rect);
     Cvs->Font->Color = clWhite;
     Cvs->TextOut(Rect.Left+2, Rect.Top+2, F->Text);
     Cvs->TextOut(Rect.Left+2, Rect.Top+2, F->Text);
   }
  else DBGrid1->DefaultDrawColumnCell(Rect,DataCol,Column,State);
  }
}
Exemplo n.º 18
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::PBoxTMouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
	if( Button == mbLeft ){
		if( m_Point ){
			m_Point = 0;
			if( m_PointY2 != m_PointY ){
				m_SampFreq = GetPointSamp();
				char bf[256];
				sprintf(bf, "%.2lf", m_SampFreq);
				EditClock->Text = bf;
                m_Clock.SetSampleFreq(m_SampFreq);
			    UpdatePPM();

				TRect rc;
                rc.Left = 0; rc.Right = m_pBitmapT->Width;
                rc.Top = 0;
                rc.Bottom = m_PointRX;
                TCanvas *pCanvas = m_pBitmapT->Canvas;
                pCanvas->Brush->Color = clBlack;
                pCanvas->FillRect(rc);
                m_PointRX = 0;
			}
		}
		else {
			m_PointX2 = m_PointX = X;
			m_PointY2 = m_PointY = Y;
			m_Point = 1;
		}
	}
	else if( m_Point ){
		m_Point = 0;
	}
	else {
		m_CursorX = X;
	}
	PBoxTPaint(NULL);
}
Exemplo n.º 19
0
//---------------------------------------------------------------------------
void __fastcall TMainWindow::NodesBoxDrawItem(TWinControl *Control, int Index,
   TRect &Rect, TOwnerDrawState State)
{
	
    TClientForm *Window;
    CHostRef *ref = NULL;
    HostData *refdata = NULL; //si
   	TColor FC,BC;
    TFontStyles FS;

	long int i = 0;  //si
    bool DoStrikeOut = false; //si

    if (Index >= NodesBox->Items->Count)
     return;
    memcpy(&ref,&i,sizeof(ref));//ref = NULL; is ignored by compiler //si
    memcpy(&refdata,&i,sizeof(refdata));//refdata = NULL; is ignored by compiler  //si
	TListBox *ListBox = dynamic_cast<TListBox*>(Control);
	TCanvas *Canvas = ListBox->Canvas;
   	BC=Canvas->Brush->Color;

   	Canvas->Brush->Color=clWindow;
	// display the text
   	FC=Canvas->Font->Color;
    FS = Canvas->Font->Style;
    ref = (CHostRef*)NodesBox->Items->Objects[Index];
    refdata = (*ref);

    /*Si: memory-access error occured sometimes in original code:
    if(!ref || !(*ref)->ProcData ||
       !(*ref)->ProcData->Executable ||
       !(*ref)->Account) {
       	Canvas->Font->Style = FS<<fsStrikeOut;
        Canvas->Font->Color=clWindowText;
    }   */

    //replace (*ref) with refdata and divide if-expression
    // original fails when *ref==NULL
    if (!ref)
    {
        DoStrikeOut = true;
    }
    else
    {
    	if (! refdata)
        {
           DoStrikeOut = true;
        }
        else
          if(!(refdata->ProcData))  //ERROR refdata invalid!!!
          {
            DoStrikeOut = true;
         	}
    	  else
          {
        	if ((!(refdata->ProcData->Executable)) || (!(refdata->Account)))
            {
            	DoStrikeOut = true;
            }
          }
     }   

    if(DoStrikeOut) {
       	Canvas->Font->Style = FS<<fsStrikeOut; //strike out invalid host
        Canvas->Font->Color=clWindowText;
    }
	else {
    	Window = ref->GetWindow();
   		if(Window) {
			switch(Window->state) {
                case killing: Canvas->Font->Color=clFuchsia; break;
                case running: Canvas->Font->Color=clGreen; break;
       			//case init: Canvas->Font->Color=clOlive; break;  //si
                case init: Canvas->Font->Color=clBlue; break;
       			default: Canvas->Font->Color=clWindowText; break;
     		}
   		} else Canvas->Font->Color=clGrayText;
    }
   	if(State.Contains(odSelected)) {
    	Canvas->Brush->Color=Canvas->Font->Color;
        Canvas->Font->Color=clHighlightText;
   	}

	Canvas->FillRect(Rect);                       // clear the rectangle
   	Canvas->TextOut(Rect.Left + 2, Rect.Top, ListBox->Items->Strings[Index]);
   	Canvas->Font->Color=FC;
   	Canvas->Brush->Color=BC;
    Canvas->Font->Style = FS;
}
Exemplo n.º 20
0
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawWater(BOOL fClear)
{
	if( m_pRxSet == NULL ) return;
	if( !m_pBitmapFFT ) return;

    TCanvas *pCanvas = m_pBitmapFFT->Canvas;

    int fo = m_pRxSet->m_pDem->m_CarrierFreq;
	if( !m_MouseDown ){
		int ww = m_WaterWidth / ((m_pRxSet->Is170()||m_pRxSet->IsMFSK()) ? 4 : 8);
		int cfo = fo;
        if( m_pRxSet->IsMFSK() ){
			int off = m_pRxSet->m_pDem->m_MFSK_BW/2;
			if( m_pRxSet->m_Mode == MODE_mfsk_L ){
				cfo -= off;
            }
            else {
				cfo += off;
            }
        }
		if( (cfo < (m_WaterLowFQ+ww)) || (cfo > (m_WaterHighFQ-ww)) ){
			CalcWaterCenter();
	    }
    }

    TRect rc;
   	rc.Left = 0; rc.Top = 0; rc.Right = m_fftXW; rc.Bottom = m_fftYW;
	if( fClear ){
	   	pCanvas->Brush->Color = MainVARI->m_tWaterColset[0].c;
   		pCanvas->Pen->Color = MainVARI->m_tWaterColset[0].c;
   		pCanvas->FillRect(rc);
        InitWater();
    }

	TRect trc = rc;
    rc.Bottom--;
	trc.Top++;
	pCanvas->CopyRect(trc, pCanvas, rc);
	int xo = ((m_WaterLowFQ+(MainVARI->m_FFTSampFreq/FFT_SIZE))*FFT_SIZE/MainVARI->m_FFTSampFreq) + 0.5;
	int xl = 0.5 + (fo - m_pRxSet->m_Speed - m_WaterLowFQ) * m_fftXW / m_WaterWidth;
	int xh = 0.5 + (fo + m_pRxSet->m_Speed - m_WaterLowFQ) * m_fftXW / m_WaterWidth;
   	int x, y, xx;
	int sum = 0;
    int max = 0;
    int wmax = 0;
    double k = 256.0 / m_StgWater.VW;
   	for( x = 0; x < m_fftXW; x++ ){
		xx = xo + (x * m_FFTWindow / m_fftXW);
        y = MainVARI->m_fftout[xx];
        if( max < y ) max = y;
		if( (x >= xl) && (x <= xh) ){
            if( wmax < y ) wmax = y;
        }
		sum += y;

        y = (y - m_StgWater.Sum) * k;
		if( y < 0 ) y = 0;
        if( y >= 256 ) y = 255;

        pCanvas->Pixels[x][0] = MainVARI->m_tWaterColors[y];
   	}
    sum /= m_fftXW;
	if( (wmax-sum) >= 320 ){
       	max = wmax;
    }
	m_StgWater.Sum = (m_StgWater.Sum + sum) / 2;
    m_StgWater.Max = (m_StgWater.Max + max) / 2;
    m_StgWater.VW = m_StgWater.Max - m_StgWater.Sum;
	int low, high;
	if( m_pRxSet->m_pFFT->m_FFTGain ){
       	low = 5120; high = 7000;
    }
    else {
       	low = 6000; high = 6000;
    }
    if( MainVARI->m_TX == txINTERNAL ) high = 100000;
    if( m_StgWater.VW < low ) m_StgWater.VW = low;
    if( m_StgWater.VW > high ) m_StgWater.VW = high;
}
Exemplo n.º 21
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::DrawFFT(BOOL fClear)
{
	if( !m_pBitmapFFT ) return;

    TCanvas *pCanvas = m_pBitmapFFT->Canvas;
    TRect rc;
    rc.Left = 0; rc.Top = 0;
    rc.Right = m_fftXW; rc.Bottom = m_fftYW;
    pCanvas->Brush->Color = MainVARI->m_tFFTColset[0].c;
    pCanvas->Pen->Color = MainVARI->m_tFFTColset[0].c;
    pCanvas->FillRect(rc);

	pCanvas->Pen->Style = psDot;
    int xx, y;
    int fh = pCanvas->TextHeight("A");

	switch(MainVARI->m_FFTVType){
		case 0:
			pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
			for( y = 6; y <= 86; y += 20 ){
				xx = y * m_fftYW / 100;
    			pCanvas->MoveTo(0, xx); pCanvas->LineTo(m_fftXW, xx);
    		}
        	break;
        case 1:
			pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
			for( y = 6; y <= 66; y += 20 ){
				xx = y * m_fftYW / 60;
    			pCanvas->MoveTo(0, xx); pCanvas->LineTo(m_fftXW, xx);
    		}
        	break;
    }

#if 1
	pCanvas->Font->Height = -12;
	pCanvas->Font->Color = MainVARI->m_tFFTColset[2].c;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
	MainVARI->DrawFreqScale(pCanvas, m_fftXW, m_fftYW, 0, 3000, fh, FALSE);
#else
	int A, L;
	A = 500; L = 500;
	f = 0;
    int f, fw;
	char bf[128];
	pCanvas->Font->Height = -12;
	pCanvas->Font->Color = MainVARI->m_tFFTColset[2].c;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
    y = 0;
	for( ; f < 3000; f += A ){
	    xx = f * m_fftXW / 3000;
        if( xx >= m_fftXW ) break;
		if( !(f % 1000) || !(f % L) ){
			sprintf(bf, "%u", f);
            fw = pCanvas->TextWidth(bf)/2;
            if( (xx - fw) > 0 ) pCanvas->TextOut(xx - fw, y, bf);
//    		pCanvas->MoveTo(xx, y ? 0 : fh); pCanvas->LineTo(xx, y ? m_fftYW-fh : m_fftYW);
    		pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
        }
        else {
    		pCanvas->MoveTo(xx, 0); pCanvas->LineTo(xx, m_fftYW);
        }
    }
#endif
	pCanvas->Pen->Color = clGreen;
	xx = (DEMSAMPFREQ*0.5) * m_fftXW / 3000;
   	pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
	int rfo = m_ToneFreq;
	pCanvas->Pen->Style = psSolid;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[4].c;
	xx = 0.5 + rfo * m_fftXW / 3000;
   	pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
	POINT pt[4];
	pt[0].x = xx; pt[0].y = fh;
    pt[1].x = xx - 3; pt[1].y = fh+3;
    pt[2].x = xx; pt[2].y = fh + 6;
    pt[3].x = xx + 3; pt[3].y = fh+3;
	pCanvas->Brush->Color = MainVARI->m_tFFTColset[4].c;
	pCanvas->Polygon(pt, 3);

    if( !fClear ){
		pCanvas->Pen->Style = psSolid;
		pCanvas->Pen->Color = MainVARI->m_tFFTColset[1].c;

		double k = double(PBoxFFT->Height)/double(MainVARI->PBoxFFT->Height);
		int *pFFT = MainVARI->m_fftout;
		int xo = 0;
    	int x, y;
		if( MainVARI->m_FFTVType == 1 ){
			int yo = m_fftYW * 40;
	    	for( x = 0; x < m_fftXW; x++ ){
				xx = xo + (x * m_FFTWindow / m_fftXW);
        	    y = pFFT[xx] * k;
				y = m_fftYW - ((y-yo)/60);
				if( x ){
	    		    pCanvas->LineTo(x, y);
            	}
            	else {
					pCanvas->MoveTo(x, y);
            	}
    		}
        }
        else {
	    	for( x = 0; x < m_fftXW; x++ ){
				xx = xo + (x * m_FFTWindow / m_fftXW);
        	    y = pFFT[xx] * k;
				y = m_fftYW - (y/100);
				if( x ){
	    		    pCanvas->LineTo(x, y);
            	}
            	else {
					pCanvas->MoveTo(x, y);
            	}
    		}
		}
    }
}
Exemplo n.º 22
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::FormResize(TObject *Sender)
{
	CWaitCursor tw;
	AlignList.NewAlign(this);
	if( pBitmap != NULL ){
		delete pBitmap;
	}
	pBitmap = new Graphics::TBitmap();
	if( sys.m_Palette ) pBitmap->PixelFormat = pf16bit;
	pBitmap->Width = PaintBox->Width;
	pBitmap->Height = PaintBox->Height;

	TRect rc;
	int XL = 0;
	int XR = pBitmap->Width - 1;
	int YT = 0;
	int YB = pBitmap->Height - 1;
	rc.Left = XL;
	rc.Right = XR;
	rc.Top = YT;
	rc.Bottom = YB+1;
	TCanvas *cp = pBitmap->Canvas;
	cp->Brush->Color = clBlack;
	cp->FillRect(rc);

	m_CursorX = XR - 20;

	cp->Font->Name = Font->Name;
	cp->Font->Charset = Font->Charset;
	cp->Font->Color = clWhite;
	cp->Font->Size = 10;
	int FH = cp->TextHeight("A");
	int Y = 5;
	if( MsgEng ){
		Caption = "Calibrating the Sound Card with a Time Standard Broadcast Station";
//        "Adjust Sampling Frequency using an off-air time signal";
//		Caption = "Adjust Sampling freq. (Recive WWV tick sound on Mark freq.)";
		CancelBtn->Caption = "Cancel";

		cp->TextOut(10, Y, "1) Receive standard radio wave (e.g., WWV, BPM)."); Y+=FH;
		cp->TextOut(10, Y, "2) Tune into the tick sound."); Y+=FH;
		cp->TextOut(10, Y, "3) Continue listening to the sound for a while.  You have a vertical line."); Y+=FH;
		cp->TextOut(10, Y, "4) Click the lower point of the line."); Y+=FH;
		cp->TextOut(10, Y, "5) Click the upper point of the line."); Y+=FH;
		Y+=FH;
		cp->TextOut(10, Y, "You could use FAX broadcasting instead of WWV or JJY, but be sure it has"); Y+=FH;
		cp->TextOut(10, Y, "exact timing.");
	}
	else {
		cp->TextOut(10, Y, "1.BPMをAMまたはSSBで受信し、この画面の下にあるToneに1000Hzまたは"); Y+=FH;
		cp->TextOut(10, Y, "  1600Hzを設定します."); Y+=FH;
		cp->TextOut(10, Y, "2.SSBの場合は1秒チック音がToneに重なるように受信周波数を調整します."); Y+=FH;
		cp->TextOut(10, Y, "3.しばらく受信して縦または斜めの帯線が表示されるのを待ちます(数分)."); Y+=FH;
		cp->TextOut(10, Y, "4.表示された帯線の下の端点をクリックします."); Y+=FH;
		cp->TextOut(10, Y, "5.更に同じ帯線の上の端点をクリックするとクロック値が自動的に"); Y+=FH;
		cp->TextOut(10, Y, "  設定されます.(2点間の距離が長いほうが正確です)"); Y+=FH;
		cp->TextOut(10, Y, "傾斜が非常に大きい場合、上記の手続きをもう一度繰り返して下さい."); Y+=FH+FH;
		cp->TextOut(10, Y, "BPMの代わりに、JMH,JMGなどのFAX放送の0.5秒毎のデッドセクタを利用しても"); Y+=FH;
		cp->TextOut(10, Y, "OKのようです."); Y+=FH;
		cp->TextOut(10, Y, "左クリック - 調整の開始"); Y+=FH;
		cp->TextOut(10, Y, "右クリック - 垂直カーソル移動");
	}
}
Exemplo n.º 23
0
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::lbUnitItemsDrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
    int         flags;
    TColor      _color;
    TListBox    *lb;
    TCanvas     *canvas;
    String      text, str;

    lb = (TListBox*)Control;
    canvas = lb->Canvas;
    SaveCanvas(canvas);

    if (Index < lb->Count)
    {
        flags = Control->DrawTextBiDiModeFlags(DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
        if (!Control->UseRightToLeftAlignment())
            Rect.Left += 2;
        else
            Rect.Right -= 2;
        canvas->FillRect(Rect);

        text = lb->Items->Strings[Index];
        //lb->ItemHeight = canvas->TextHeight(text);
        str = text.SubString(2, text.Length() - 1);
        //Procs with Xrefs
        if (text[1] & 6)
        {
            //Xrefs from user units
            if (text[1] & 4)
            {
                if (!State.Contains(odSelected))
                    _color = TColor(0x00B000); //Green
                else
                    _color = TColor(0xBBBBBB); //LightGray
            }
            //No Xrefs from user units, only from KB units 
            else
            {
                if (!State.Contains(odSelected))
                    _color = TColor(0xC08000); //Blue
                else
                    _color = TColor(0xBBBBBB); //LightGray
            }
        }
        //Unresolved items
        else if (text[1] & 1)
        {
            if (!State.Contains(odSelected))
                _color = TColor(0x8080FF); //Red
            else
                _color = TColor(0xBBBBBB); //LightGray
        }
        //Other
        else
        {
            if (!State.Contains(odSelected))
                _color = TColor(0);        //Black
            else
                _color = TColor(0xBBBBBB); //LightGray
        }
        Rect.Right = Rect.Left;
        DrawOneItem(str, canvas, Rect, _color, flags);
    }
    RestoreCanvas(canvas);
}
Exemplo n.º 24
0
void TForm1::RedrawBitmap(){
    if(!bmp) return;
    TCanvas *pCanvas = bmp->Canvas;
    int width=lblPic->Width, height=lblPic->Height;
    if(width != bmp->Width) bmp->Width = width;
    if(height != bmp->Height) bmp->Height = height;

    //clear the bitmap first
    pCanvas->Brush->Color = (TColor)0xFFFFFF;
    pCanvas->Brush->Style = bsSolid;
    pCanvas->FillRect(TRect(0, 0, width-1, height-1));
    
    if(theBuffer){

        //calculate number of text rows & columns
        textCols = (lblPic->Width / charWidth);
        textRows = (lblPic->Height / charHeight);
        pCanvas->Pen->Color = clBlack;
        pCanvas->Font->Color = clBlack;

        if(textCols && textRows){
            //draw text
            char* textLine = new char[textCols+1];
            int pos=textPosition, x=lblPic->Left, y=lblPic->Top;
            for(int j=0; j<textRows; j++){
                if(pos >= bufSize) break;
                memcpy(textLine, &theBuffer[pos], pos+textCols < bufSize ? textCols : bufSize - pos);
                textLine[pos+textCols < bufSize ? textCols : bufSize - pos] = 0;
                pos += textCols;
                pCanvas->TextOut(x, y, String(textLine));
                y += charHeight;
            }

            delete [] textLine;

            if(lstResults->Selected){

                MyResult *r = (MyResult*)lstResults->Selected->Data;
                for(int i=0; i<r->numWords; i++){

                    pCanvas->Pen->Color = myColors[i];
                    pCanvas->Pen->Width = 3;
                    pCanvas->Pen->Mode = pmNotXor;
                    int lx, ly;
                    bool lineStarted=false;

                    for(unsigned int j=0; j<r->words[i].length; j++){
                        int localPosition = r->words[i].start - textPosition;
                        localPosition += (j*r->words[i].delta);
                        lx = (localPosition % textCols)*charWidth + (charWidth/2);
                        ly = (localPosition / textCols)*charHeight + (charHeight/2);
                        if((lx<0) || (ly<0)) continue;
                        if((lx>width) || (ly>height)) continue;

                        if(!lineStarted){
                            pCanvas->MoveTo(lx, ly);
                            lineStarted = true;
                        }else{
                            pCanvas->LineTo(lx, ly);
                        }
                    }

                    pCanvas->Brush->Color = myColors[i];
                    pCanvas->Pen->Color = clWhite;
                    pCanvas->Pen->Width = 1;
                    pCanvas->Pen->Mode = pmCopy;
                    pCanvas->Font->Color = clWhite;

                    for(unsigned int j=0; j<r->words[i].length; j++){
                        int localPosition = r->words[i].start - textPosition;
                        localPosition += (j*r->words[i].delta);
                        lx = (localPosition % textCols)*charWidth;
                        ly = (localPosition / textCols)*charHeight;
                        if((lx<0) || (ly<0)) continue;
                        if((lx>width) || (ly>height)) continue;

                        pCanvas->TextOut(lx, ly, String(theBuffer[r->words[i].start+(j*r->words[i].delta)]));
                    }
                }
            }
        }
    }
    
    FormPaint(NULL);
}
Exemplo n.º 25
0
void __fastcall TPaletteForm::DoPalette()
{
	 int PaperWidth  = 0;
	 int PaperHeight = 0;
	 int ImageWidth  = 0;
	 int ImageHeight = 0;
	 // получим размер бумаги
	 this->GetPaperSize(PaperWidth, PaperHeight);
	 // получим размер изображения
	 GetImageSize(PaperWidth, PaperHeight, ImageWidth, ImageHeight);

	 Graphics::TBitmap* bmp = new Graphics::TBitmap();
	 bmp->Width = ImageWidth;
	 bmp->Height = ImageHeight;
	 // отрисовка палитры.

	 TCanvas* cnv = bmp->Canvas;
	 cnv->Brush->Color = clBlack;
	 TRect r;r.init(0,0,bmp->Width, bmp->Height);
	 cnv->FillRect(r);
	 switch(ComboBox1->ItemIndex)
	 {
		case 0:
			 DrawPantone(cnv, ImageWidth, ImageHeight);
		break;
		case 1:
			DrawCube(cnv, ImageWidth, ImageHeight,1);
		break;
		case 2:
			DrawCube(cnv, ImageWidth, ImageHeight,2);
		break;
		case 3:
			DrawCube(cnv, ImageWidth, ImageHeight,3);
		break;
		case 4:
			DrawPantoneRandom(cnv, ImageWidth, ImageHeight);
		break;
		case 5:
			DrawCubeRandom(cnv, ImageWidth, ImageHeight);
		break;
		case 6:
			DrawPantoneCube(cnv, ImageWidth, ImageHeight,1);
		break;
		case 7:
			DrawPantone27Cube(cnv, ImageWidth, ImageHeight,1);
		break;

		case 8:
			DrawPantone8Polar(cnv, ImageWidth, ImageHeight,1);
		break;

		case 9:
			DrawPantone27Polar(cnv, ImageWidth, ImageHeight,1);
		break;

		case 10:
			DrawRGBPolar8(cnv, ImageWidth, ImageHeight,1);
		break;
		case 11:
			DrawRGBPolar27(cnv, ImageWidth, ImageHeight,1);
		break;
		default:
			DrawCube(cnv, ImageWidth, ImageHeight,1);
	 }

	 this->Image1->Picture->Assign(bmp);
	 delete bmp;

}
Exemplo n.º 26
0
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::lbUnitsDrawItem(
      TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
    char        *s, *pos;
    int         flags, len;
    TColor      _color;
    TListBox    *lb;
    TCanvas     *canvas;
    String      text, str1, str2;

    lb = (TListBox*)Control;
    canvas = lb->Canvas;
    SaveCanvas(canvas);

    if (Index < lb->Count)
    {
        flags = Control->DrawTextBiDiModeFlags(DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX);
        if (!Control->UseRightToLeftAlignment())
            Rect.Left += 2;
        else
            Rect.Right -= 2;

        text = lb->Items->Strings[Index];
        //lb->ItemHeight = canvas->TextHeight(text);
        canvas->FillRect(Rect);

        s = text.c_str();
        //*XXXXXXXX #XXX XX NAME
        pos = strrchr(s, ' ');
        len = pos - s;
        str1 = text.SubString(2, len - 1);
        str2 = text.SubString(len + 1, text.Length() - len);

        if (!State.Contains(odSelected))
            _color = TColor(0);        //Black
        else
            _color = TColor(0xBBBBBB); //LightGray
        Rect.Right = Rect.Left;
        DrawOneItem(str1, canvas, Rect, _color, flags);

        //Unit name
        //Trivial unit - red
        if (text[1] & TRIV_UNIT)
        {
            if (!State.Contains(odSelected))
                _color = TColor(0x0000B0); //Red
            else
                _color = TColor(0xBBBBBB); //LightGray
        }
        else
        {
            //User unit - green
            if (text[1] & USER_UNIT)
            {
                if (!State.Contains(odSelected))
                {
                	if (text[1] & UNEXP_UNIT)
                    	_color = TColor(0xC0C0FF); //Light Red
                    else
                    	_color = TColor(0x00B000); //Green
                }
                else
                    _color = TColor(0xBBBBBB); //LightGray
            }
            //From knowledge base - blue
            else
            {
                if (!State.Contains(odSelected))
                    _color = TColor(0xC08000); //Blue
                else
                    _color = TColor(0xBBBBBB); //LightGray
            }
        }
        DrawOneItem(str2, canvas, Rect, _color, flags);
    }
    RestoreCanvas(canvas);
}
Exemplo n.º 27
0
void TMainForm::UpdateGraph()
{
	if(!m_Animator)				return;
    TCanvas *canvas 			 = Image->Picture->Bitmap->Canvas;
    canvas->Brush->Color 		 = clWhite;
    canvas->FillRect 			 (TRect (0, 0, Image->Picture->Bitmap->Width, Image->Picture->Bitmap->Height));
    canvas->Pen->Color 			 = clBlack;
    canvas->MoveTo 				 (0, Image->Picture->Bitmap->Height / 2);
    canvas->LineTo               (Image->Picture->Bitmap->Width, Image->Picture->Bitmap->Height / 2);
    canvas->MoveTo               (0, 0);
    canvas->LineTo               (Image->Picture->Bitmap->Width, 0);
    canvas->MoveTo               (0, Image->Picture->Bitmap->Height - 1);
    canvas->LineTo               (Image->Picture->Bitmap->Width, Image->Picture->Bitmap->Height - 1);
    canvas->TextOutA             (0, Image->Picture->Bitmap->Height / 2 - 14, "0.0");
    canvas->TextOutA             (0, Image->Picture->Bitmap->Height - 14, "-1.0");
    canvas->TextOutA             (0, 2, "1.0");


    float alltime 				= m_Animator->GetLength ();
    string128 					buf;
    sprintf 					(buf, "Effect time : %.3f", alltime);
    StatusBar->Panels->Items[0]->Text = buf;
    if (alltime == 0.0f) 		return;
    
    float width 				= (float)Image->Picture->Bitmap->Width, height = (float)Image->Picture->Bitmap->Height * 0.5f;
    //draw marker
    int left 					= (int)(width / alltime * m_Marker);
    canvas->MoveTo 				(left, 0);
    canvas->Pen->Style 			= psDot;
    canvas->LineTo 				(left, Image->Picture->Bitmap->Height);
    canvas->Pen->Style 			= psSolid;

    SPPInfo						m_EffectorParams;
    ZeroMemory 					(&m_EffectorParams, sizeof (SPPInfo));

    float increment 			= alltime / (float)Image->Width;

    for (float t = 0.0f; t < alltime; t += increment)
    {
        m_Animator->Process 	(t, m_EffectorParams);
        int x 					= (int)(width / alltime * t);
        
        for(u32 idx =pp_base_color;idx<pp_last;++idx)
        {
            if(!m_ActiveShowForm->DrawChannel((_pp_params)idx))
                continue;
            
            switch (idx)
                   {
                   case pp_base_color:
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_base.r * height + height)] = clRed;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_base.g * height + height)] = clGreen;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_base.b * height + height)] = clBlue;
                        break;
                   case pp_add_color:
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_add.r * height + height)] = clRed;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_add.g * height + height)] = clGreen;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_add.b * height + height)] = clBlue;
                        break;
                   case pp_gray_color:
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_gray.r * height + height)] = clRed;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_gray.g * height + height)] = clGreen;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_gray.b * height + height)] = clBlue;
                        break;
                   case pp_gray_value:
                        canvas->Pixels[x][(int)(-m_EffectorParams.blur * height + height)] = clBlack;
                        break;
                   case pp_blur:
                        canvas->Pixels[x][(int)(-m_EffectorParams.gray * height + height)] = clBlack;
                        break;
                   case pp_dual_h:
                        canvas->Pixels[x][(int)(-m_EffectorParams.duality.h * height + height)] = clRed;
                        break;
                   case pp_dual_v:
                        canvas->Pixels[x][(int)(-m_EffectorParams.duality.v * height + height)] = clGreen;
                        break;
                   case pp_noise_i:
                        canvas->Pixels[x][(int)(-m_EffectorParams.noise.intensity * height + height)] = clRed;
                        break;
                   case pp_noise_g:
                        canvas->Pixels[x][(int)(-m_EffectorParams.noise.grain * height + height)] = clGreen;
                        break;
                   case pp_noise_f:
                        canvas->Pixels[x][(int)(-m_EffectorParams.noise.fps * height + height)] = clBlue;
                        break;
                   }//switch
           	}//channel
    }//time
}
Exemplo n.º 28
0
void
StatusBar::OnPaint( const DrawContext& dc )
{
  const int heightRatioGoal = 1,
            heightRatioResult = 1;
  RGBColor  dividerColor = RGBColor::Black,
            backgroundColor = mColor,
            textColor = mTextColor;
  string    line1, line2;

  if( mGoalText.empty() )
  {
    size_t spacePos = mResultText.rfind( ' ' );
    if( spacePos != string::npos )
    {
      line1 = mResultText.substr( 0, spacePos );
      line2 = mResultText.substr( spacePos + 1, string::npos );
    }
    else
    {
      line1 = "";
      line2 = mResultText;
    }
  }
  else
  {
    line1 = mGoalText;
    line2 = mResultText;
  }

#ifdef __BORLANDC__
  TCanvas* pCanvas = new TCanvas;
  try
  {
    pCanvas->Handle = dc.handle;
    TRect winRect( dc.rect.left, dc.rect.top, dc.rect.right, dc.rect.bottom );
    if( backgroundColor != RGBColor::NullColor )
    {
      pCanvas->Brush->Style = bsSolid;
      pCanvas->Brush->Color = TColor( backgroundColor.ToWinColor() );
      pCanvas->FillRect( winRect );
    }
    pCanvas->Font->Name = "Arial";
    pCanvas->Font->Height = -mTextHeight * ( dc.rect.bottom - dc.rect.top );
    pCanvas->Font->Style = TFontStyles() << fsBold;
    pCanvas->Font->Color = TColor( textColor.ToWinColor() );
    int charWidth = pCanvas->TextWidth( "x" );

    int dividerPos = winRect.top + ( winRect.Height() * heightRatioGoal )
                                  / ( heightRatioGoal + heightRatioResult );
    if( !mGoalText.empty() )
    {
      TRect dividerRect = winRect;
      dividerRect.top = dividerPos;
      dividerRect.bottom = dividerPos + 1;
      pCanvas->Brush->Color = TColor( dividerColor.ToWinColor() );
      pCanvas->FillRect( dividerRect );
    }

    AnsiString text = line1.c_str();
    TRect line1Rect = winRect;
    line1Rect.bottom = dividerPos;
    TSize size = pCanvas->TextExtent( text );
    while( size.cx > line1Rect.Width() - 2 * charWidth )
    {
      text = text.SubString( 2, text.Length() );
      size = pCanvas->TextExtent( text );
    }
    int xPos = line1Rect.left + charWidth,
        yPos = line1Rect.top + ( line1Rect.Height() - size.cy ) / 2;
    pCanvas->Brush->Style = bsClear;
    pCanvas->TextRect( line1Rect, xPos, yPos, text );

    text = line2.c_str();
    TRect line2Rect = winRect;
    line2Rect.top = dividerPos;
    size = pCanvas->TextExtent( text );
    while( size.cx > line2Rect.Width() - 2 * charWidth )
    {
      text = text.SubString( 2, text.Length() );
      size = pCanvas->TextExtent( text );
    }
    xPos = line2Rect.left + charWidth;
    yPos = line2Rect.top + ( line2Rect.Height() - size.cy ) / 2;
    pCanvas->Brush->Style = bsClear;
    pCanvas->TextRect( line2Rect, xPos, yPos, text );
  }
  __finally
  {
    delete pCanvas;
  }
#endif // __BORLANDC__
}