Exemplo n.º 1
0
//===========================================================================
void TWave::DrawElementFace()
{
    TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
    int         aw       = VisualElementParam->Width;
    int         ah       = VisualElementParam->Height;

    dbCanvas->Brush->Color = clWhite;
    dbCanvas->Pen  ->Color = clBlack;

    dbCanvas->Rectangle(0, 0, aw, ah);

    // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
    if (DesignPhase != dpAllreadyTesting) {
        if (DesignPhase == dpNotTesting  ) {
            dbCanvas->Pen  ->Color = clRed;
        }
        if (DesignPhase == dpNeedModified) {
            dbCanvas->Pen  ->Color = clRed;
            dbCanvas->Pen  ->Style = psDot;
        }

        dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

        dbCanvas->Pen->Color = clBlack;
        dbCanvas->Pen->Style = psSolid;
    }
    // -------------- Отрисовка ресурса если он есть ----------
    dbCanvas->Draw((aw - ResourseBitmapFaceElement->Width) / 2, (ah - ResourseBitmapFaceElement->Height) / 2,ResourseBitmapFaceElement);
}
Exemplo n.º 2
0
//===========================================================================
void TSigCorection::DrawElementFace()
{
    TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
    int         aw       = VisualElementParam->Width ;
    int         ah       = VisualElementParam->Height;
    AnsiString  as       = "A B";

    dbCanvas->Brush->Color = clWhite;
    dbCanvas->Pen  ->Color = clBlack;

    dbCanvas->Rectangle(0, 0, aw, ah);

    // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
    if (DesignPhase != dpAllreadyTesting) {
        if (DesignPhase == dpNotTesting  ) {
            dbCanvas->Pen  ->Color = clRed;
        }
        if (DesignPhase == dpNeedModified) {
            dbCanvas->Pen  ->Color = clRed;
            dbCanvas->Pen  ->Style = psDot;
        }

        dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

        dbCanvas->Pen->Color = clBlack;
        dbCanvas->Pen->Style = psSolid;
    }

    dbCanvas->TextOut((aw - dbCanvas->TextWidth(as))/2, (ah - dbCanvas->TextHeight(as))/2, as);
    dbCanvas->Ellipse(aw / 2 - 1, ah / 2 - 1, aw / 2 + 1, ah / 2 + 1);
}
Exemplo n.º 3
0
//===========================================================================
void TTransromXYZ_RoQE::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width ;
      int         ah       = VisualElementParam->Height;

      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;

      dbCanvas->Rectangle(0, 0, aw, ah);

   // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
     if (DesignPhase != dpAllreadyTesting) {
         if (DesignPhase == dpNotTesting  ) {dbCanvas->Pen  ->Color = clRed;}
         if (DesignPhase == dpNeedModified) {dbCanvas->Pen  ->Color = clRed; dbCanvas->Pen  ->Style = psDot;}

         dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

         dbCanvas->Pen->Color = clBlack;
         dbCanvas->Pen->Style = psSolid;
      }   

      dbCanvas->MoveTo(5, 2     );   dbCanvas->LineTo(5, ah - 2);
      dbCanvas->MoveTo(2, ah - 5);   dbCanvas->LineTo(aw - 2, ah - 5);

      dbCanvas->Pen->Color = clBlue;
      dbCanvas->MoveTo(8, ah - 10);   dbCanvas->LineTo(aw - 4, 6);

      dbCanvas->Pen->Color = clBlack;
}
Exemplo n.º 4
0
//===========================================================================
void TProportional::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width;
      int         ah       = VisualElementParam->Height;

      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;

      dbCanvas->Rectangle(0, 0, aw, ah);

   // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
     if (DesignPhase != dpAllreadyTesting) {
         if (DesignPhase == dpNotTesting  ) {dbCanvas->Pen  ->Color = clRed;}
         if (DesignPhase == dpNeedModified) {dbCanvas->Pen  ->Color = clRed; dbCanvas->Pen  ->Style = psDot;}

         dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

         dbCanvas->Pen->Color = clBlack;
         dbCanvas->Pen->Style = psSolid;
      }

      str_K = FloatToStr(K);
      dbCanvas->TextOut((aw - dbCanvas->TextWidth(str_K))/2, (ah - dbCanvas->TextHeight(str_K))/2, str_K);
}
Exemplo n.º 5
0
void __fastcall TClipMaker::BPOnPaint(TObject *Sender)
{
	TMxPanel* bp 		= dynamic_cast<TMxPanel*>(Sender); VERIFY(bp);
    CEditableObject* O	= 	m_CurrentObject; VERIFY(O);
    TCanvas* canvas 	= bp->Canvas;
    canvas->Font->Name 	= "MS Sans Serif";
    canvas->Font->Style	= TFontStyles();
    canvas->Font->Color = clBlack;
    canvas->Pen->Color	= clBlack;
    canvas->Pen->Style	= psSolid;
    canvas->Brush->Style= bsSolid;
    if (-2==bp->Tag){
        for (UIClipIt it=clips.begin(); it!=clips.end(); it++){
	        canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR;
            TRect R 			= TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15);
    	    AnsiString fx_name	= (*it)->FXName();
            if (!fx_name.IsEmpty()){
                canvas->Rectangle	(R);
                R.Top				+= 1;
                R.Bottom			-= 1;
                R.Left				+= 1;
                R.Right				-= 1;
                canvas->TextRect	(R,R.Left,R.Top,fx_name);
            }
        }
    }else if ((bp->Tag>=0)&&(bp->Tag<(int)O->BoneParts().size())){
        AnsiString mn_prev		= "";
        for (UIClipIt it=clips.begin(); it!=clips.end(); it++){
            AnsiString mn		= (*it)->CycleName(u16(bp->Tag));
            TRect R 			= TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15);
            if (!mn.IsEmpty()){
                canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR;
                canvas->Rectangle	(R);
                R.Top				+= 1;
                R.Bottom			-= 1;
                R.Left				+= 1;
                R.Right				-= 1;
                canvas->TextRect	(R,R.Left,R.Top,mn);
	            mn_prev				= mn;
            }else if (!mn_prev.IsEmpty()){
	            canvas->MoveTo		((*it)->PLeft()+1,13);
                canvas->LineTo		(R.Right,13);
                canvas->LineTo		(R.Width()>5?R.Right-5:R.Right-R.Width(),8);
                R.Top				+= 1;
                R.Bottom			-= 1;
                R.Left				+= 1;
                R.Right				-= 1;
            }
        }
    }
}
Exemplo n.º 6
0
//---------------------------------------------------------------------------
void __fastcall TForm1::OvcTCString1OwnerDraw(TObject *Sender,
  TCanvas *TableCanvas, const TRect &CellRect, int RowNum, int ColNum,
  const TOvcCellAttributes &CellAttr, Pointer Data, bool &DoneIt)
{
  bool F;
  TRect R;
  TCanvas* C;
  char Buf[255];

  DoneIt = True;
  R = CellRect;
  C = TableCanvas;

  // paint background
  C->Brush->Style = bsClear;
  C->Pen->Color = clBtnFace;
  C->Rectangle(R.Left, R.Top, R.Right, R.Bottom);

  // draw button
  F = (RowNum == TBL->ActiveRow) && (ColNum == TBL->ActiveCol);
  DrawButtonFace(C, R, 1, bsNew, true, F, F);

  // draw data
  if ((RowNum % 2) == 1)
    C->Font->Color = clRed;
  else
    C->Font->Color = clBlack;
  sprintf(Buf, "%d:%d", RowNum, ColNum);
  DrawText(C->Handle, Buf, StrLen(Buf),
    (RECT*)&R, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
Exemplo n.º 7
0
void __fastcall TEditTiffForm::Fog1Paint(TObject *Sender) {
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
    TCanvas *c = Fog1->Canvas;
    c->Brush->Style = bsSolid;
    c->Brush->Color = clBtnFace;
    c->Rectangle(0, 0, Fog1->Width, Fog1->Height);

    // ti->DrawCenter(Fog1->Canvas, Fog1->Width / 2, Fog1->Height / 2, Fog1->Width - 4, Fog1->Height - 4);
    tb->DrawCenter(Fog1->Canvas, Fog1->Width / 2, Fog1->Height / 2, Fog1->Width - 4, Fog1->Height - 4);
}
Exemplo n.º 8
0
//===========================================================================
void TKalmanBajas::DrawElementFace()
{
      AnsiString  as       = "ОФК (Б)";

      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width;
      int         ah       = VisualElementParam->Height;

      int         FontSize   = dbCanvas->Font->Size;
      AnsiString  FontName   = dbCanvas->Font->Name;
      TFontStyles FontStyles = dbCanvas->Font->Style;
      TColor      FontColor  = dbCanvas->Font->Color;

      dbCanvas->Font->Style = TFontStyles();
      dbCanvas->Font->Style = TFontStyles() << fsBold;
      dbCanvas->Font->Color = clMaroon;
      if (dbCanvas->TextWidth(as) > aw - 4) dbCanvas->Font->Name = "Times New Roman";
      while (dbCanvas->TextWidth(as) > aw - 4)  dbCanvas->Font->Size--;

      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;

      dbCanvas->Rectangle(0, 0, aw, ah);

   // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
     if (DesignPhase != dpAllreadyTesting) {
         if (DesignPhase == dpNotTesting  ) {dbCanvas->Pen  ->Color = clRed;}
         if (DesignPhase == dpNeedModified) {dbCanvas->Pen  ->Color = clRed; dbCanvas->Pen  ->Style = psDot;}

         dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

         dbCanvas->Pen->Color = clBlack;
         dbCanvas->Pen->Style = psSolid;
      }
      dbCanvas->TextOut((aw - dbCanvas->TextWidth(as))/2, (ah - dbCanvas->TextHeight(as))/2, as);

      dbCanvas->Font->Size = FontSize;
      dbCanvas->Font->Name = FontName;
      dbCanvas->Font->Style = FontStyles;
      dbCanvas->Font->Color = FontColor;
}
Exemplo n.º 9
0
//===========================================================================
void TExtrapoljator::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width;
      int         ah       = VisualElementParam->Height;

      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;

      dbCanvas->Rectangle(0, 0, aw, ah);

   // -------------- Отрисовка ресурса если он есть ----------
      dbCanvas->Draw((aw - ResourseBitmapFaceElement->Width) / 2, (ah - ResourseBitmapFaceElement->Height) / 2,ResourseBitmapFaceElement);
}
Exemplo n.º 10
0
//===========================================================================
void TSumator::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width;
      int         ah       = VisualElementParam->Height;
  // --------
      int x1 = 0.35 * aw;
      int y1 = 0.32 * ah;
      int x2 = 0.35 * aw;
      int y2 = 0.50  * ah;
      int x3 = x2 + (aw - x2 - x1) / 2;
  // --------
      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;
  // --------
      dbCanvas->Rectangle(0, 0, aw, ah);
   // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
     if (DesignPhase != dpAllreadyTesting) {
         if (DesignPhase == dpNotTesting  ) {dbCanvas->Pen  ->Color = clRed;}
         if (DesignPhase == dpNeedModified) {dbCanvas->Pen  ->Color = clRed; dbCanvas->Pen  ->Style = psDot;}

         dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

         dbCanvas->Pen->Color = clBlack;
         dbCanvas->Pen->Style = psSolid;
      }   
  // --------
      dbCanvas->Pen->Width = 1;
      dbCanvas->MoveTo(aw - x1,      1.1*y1);
      dbCanvas->LineTo(aw - x1,          y1);
      dbCanvas->LineTo(x2     ,          y1);
      dbCanvas->LineTo(x3     ,          y2);
      dbCanvas->LineTo(x2     , ah -     y1);
      dbCanvas->LineTo(aw - x1, ah -     y1);
      dbCanvas->LineTo(aw - x1, ah - 1.1*y1);
      dbCanvas->Pen->Width = 1;
}
Exemplo n.º 11
0
//===========================================================================
void Tasd::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width;
      int         ah       = VisualElementParam->Height;
  // --------
      int w  = 0.35 * aw;
      int h  = 0.35 * ah;
      int cx = VisualElementParam->sLeft + aw / 2;
      int cy = VisualElementParam->sTop  + ah / 2;
  // --------
      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;
  // --------
      dbCanvas->Rectangle(0, 0, aw, ah);
  // --------
      dbCanvas->Ellipse(cx - w/2, cy - h/2, cx + w/2, cy + h/2);
}
Exemplo n.º 12
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.º 13
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 );
}
Exemplo n.º 14
0
/*-----------------------------------------------------------------*/
void __fastcall TAboutBox::pbInfosPaint(TObject *Sender)
{
    // Infos ausgeben
    TCanvas* canvas = pbInfos->Canvas;

    // Hintergrund passend zum Bild
    canvas->Brush->Color = TColor(RGB(240,240,230));
    canvas->Pen->Color = canvas->Brush->Color;
    canvas->Rectangle (0, 0, pbInfos->Width, pbInfos->Height);

    canvas->Font->Color = clBlack;
    int dy = canvas->Font->Height;
    if (dy<0) {
        dy = -dy;
        if (PixelsPerInch==96) dy += 3;
        else if (PixelsPerInch>96) dy += int(3.0*PixelsPerInch/96); 
    }
    int x0 = 35;
    int y0 = 20;

    // Infos über DB-WEAVE ausgeben
    if (active_language==GE) {
        canvas->Font->Style = canvas->Font->Style << fsBold;
        canvas->TextOut (x0, y0, "Was DB-WEAVE ist"); y0 += dy*3/2;
        canvas->Font->Style = canvas->Font->Style >> fsBold;
        canvas->TextOut (x0, y0, "DB-WEAVE ist eine Software um Gewebe"); y0+=dy;
        canvas->TextOut (x0, y0, "zu entwickeln und auf einem Schaftweb-"); y0+=dy;
        canvas->TextOut (x0, y0, "stuhl zu weben. Sie können Muster ent-"); y0+=dy;
        canvas->TextOut (x0, y0, "werfen und diese nachher manuell weben."); y0+=dy;
        canvas->TextOut (x0, y0, "Oder Sie können die Muster direkt auf"); y0+=dy;
        canvas->TextOut (x0, y0, "einem computergesteuerten Webstuhl weben."); y0+=2*dy;
        canvas->Font->Style = canvas->Font->Style << fsBold;
        canvas->TextOut (x0, y0, "DB-WEAVE benutzen"); y0 += dy*3/2;
        canvas->Font->Style = canvas->Font->Style >> fsBold;
        canvas->TextOut (x0, y0, "Da DB-WEAVE ein normales Windows-Programm"); y0+=dy;
        canvas->TextOut (x0, y0, "ist, können Sie es ähnlich bedienen wie"); y0+=dy;
        canvas->TextOut (x0, y0, "andere Windows-Software. Wenn Sie zum"); y0+=dy;
        canvas->TextOut (x0, y0, "Beispiel Microsoft Word oder auch CorelDraw"); y0+=dy;
        canvas->TextOut (x0, y0, "kennen, so können Sie schnell mit DB-WEAVE"); y0+=dy;
        canvas->TextOut (x0, y0, "umgehen.");
    } else { // Default ist Englisch
Exemplo n.º 15
0
void __fastcall TClipMaker::ClipPaint(TObject *Sender)
{
	TMxPanel* P 		= dynamic_cast<TMxPanel*>(Sender); VERIFY(P);
    TCanvas* canvas 	= P->Canvas;
    canvas->Font->Name 	= "MS Sans Serif";
    canvas->Font->Style	= TFontStyles();
    canvas->Font->Color = clBlack;
    canvas->Pen->Color 	= clBlack;
    canvas->Pen->Style	= psSolid;
    canvas->Brush->Style= bsSolid;
    for (UIClipIt it=clips.begin(); it!=clips.end(); it++){
        TRect R 		= TRect((*it)->PLeft(), 1, (*it)->PRight()-1, paClips->Height);
        canvas->Pen->Width	= 1;
        canvas->Brush->Color= (*it==sel_clip)?(drag_obj==P->Tag?CLIP_ACTIVE_DRAG_COLOR:CLIP_ACTIVE_COLOR):CLIP_INACTIVE_COLOR;
        canvas->Rectangle	(R);
        R.Top				+= 1;
        R.Bottom			-= 1;
        R.Left				+= 1;
        R.Right				-= 1;
        canvas->TextRect	(R,R.Left,R.Top,*(*it)->name);
    }
}
Exemplo n.º 16
0
void
RectangularShape::OnPaint( const GUI::DrawContext& inDC )
{
#ifdef __BORLANDC__
  TCanvas* pCanvas = new TCanvas;
  try
  {
    pCanvas->Handle = inDC.handle;
    TRect winRect( inDC.rect.left, inDC.rect.top, inDC.rect.right, inDC.rect.bottom );
    if( this->FillColor() == RGBColor::NullColor )
    {
      pCanvas->Brush->Style = bsClear;
    }
    else
    {
      pCanvas->Brush->Style = bsSolid;
      pCanvas->Brush->Color = TColor( this->FillColor().ToWinColor() );
    }
    if( this->Color() == RGBColor::NullColor )
    {
      pCanvas->Pen->Style = psClear;
    }
    else
    {
      pCanvas->Pen->Style = psSolid;
      pCanvas->Pen->Color = TColor( this->Color().ToWinColor() );
      pCanvas->Pen->Width = this->LineWidth();
    }
    pCanvas->Rectangle( winRect );
  }
  __finally
  {
    delete pCanvas;
  }
#endif // __BORLANDC__
}
Exemplo n.º 17
0
/*-----------------------------------------------------------------*/
void __fastcall TOverviewForm::SBPrintClick(TObject *Sender)
{
    // Ausdrucken der Geschichte...
    TCursor savecursor = Cursor;
    Cursor = crHourGlass;

    Printer()->Title = (String)APP_TITLE+" - "+ExtractFileName(frm->filename);
    Printer()->BeginDoc();

    CalcPrintDimensions();

    int mx = min(maxi, frm->kette.count());
    int my = min(maxj, frm->schuesse.count());

    TCanvas* canvas = Printer()->Canvas;

    if (frm->GewebeNormal->Checked) {
        for (int i=frm->kette.a; i<frm->kette.a+mx; i++)
            for (int j=frm->schuesse.a; j<frm->schuesse.a+my; j++) {
                int x;
                if (frm->righttoleft) x = (mx+1)*gw - (i-frm->kette.a+1)*gw;
                else x = (i-frm->kette.a)*gw;
                int y = (my+1)*gh - (j-frm->schuesse.a+1)*gh;
                if (frm->gewebe.feld.Get(i, j)>0) {
                    canvas->Brush->Style = bsSolid;
                    canvas->Pen->Color = GetRangeColor(frm->gewebe.feld.Get(i, j));
                    canvas->Brush->Color = GetRangeColor(frm->gewebe.feld.Get(i, j));
                    canvas->Rectangle (mleft+x, mtop+y, mleft+x+gw, mtop+y+gh);
                }
                if (grid) {
                    canvas->Pen->Color = clBlack;
                    canvas->MoveTo (mleft+x, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y);
                }
            }
    } else if (frm->GewebeFarbeffekt->Checked || frm->GewebeSimulation->Checked) {
        // Nach Farben getrennt malen, schneller...
        for (int i=frm->kette.a; i<frm->kette.a+mx; i++)
            for (int j=frm->schuesse.a; j<frm->schuesse.a+my; j++) {
                bool drawhebung = frm->gewebe.feld.Get(i,j)>0;
                if (frm->sinkingshed) drawhebung = !drawhebung;
                canvas->Brush->Style = bsSolid;
                if (drawhebung) {
                    canvas->Brush->Color = GETPALCOL(frm->kettfarben.feld.Get(i));
                    canvas->Pen->Color = GETPALCOL(frm->kettfarben.feld.Get(i));
                } else {
                    canvas->Brush->Color = GETPALCOL(frm->schussfarben.feld.Get(j));
                    canvas->Pen->Color = GETPALCOL(frm->schussfarben.feld.Get(j));
                }
                int x;
                if (frm->righttoleft) x = pwidth - (i-frm->kette.a+1)*gw;
                else x = (i-frm->kette.a)*gw;
                int y = (my+1)*gh - (j-frm->schuesse.a+1)*gh;
                canvas->Rectangle (mleft+x, mtop+y, mleft+x+gw, mtop+y+gh);
                if (grid) {
                    canvas->Pen->Color = clBlack;
                    canvas->MoveTo (mleft+x, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y);
                }
            }
    }

    Printer()->EndDoc();
    Cursor = savecursor;
    ::MessageBeep (-1);
}
Exemplo n.º 18
0
void __fastcall TBeadForm::PrintItAll()
{
    Printer()->BeginDoc();
    String title = APP_TITLE;
    title += " - " + ExtractFileName(savedialog->FileName);
    Printer()->Title = title;
    TCanvas* canvas = Printer()->Canvas;

    int sx = GetDeviceCaps(Printer()->Handle, LOGPIXELSX);
    int sy = GetDeviceCaps(Printer()->Handle, LOGPIXELSY);

    int gx = (15+zoomidx*5)*sx/254;
    int gy = (15+zoomidx*5)*sy/254;

    int draftleft, normalleft, simulationleft, reportleft;
    int reportcols;

    int m = MM2PRx(10);
    if (draft->Visible) {
        draftleft = m;
        m += MM2PRx(13) + field.Width()*gx + MM2PRx(7);
    }

    if (normal->Visible) {
        normalleft = m;
        m += MM2PRx(7) + (field.Width()+1)*gx;
    }

    if (simulation->Visible) {
        simulationleft = m;
        m += MM2PRx(7) + (field.Width()/2+1)*gx;
    }

    if (report->Visible) {
        reportleft = m;
        reportcols = (Printer()->PageWidth - m - 10) / (MM2PRx(5) + MM2PRx(8));
    }

    int h = Printer()->PageHeight - MM2PRy(10);

    ////////////////////////////////////////
    //
    //   Draft
    //
    ////////////////////////////////////////

    // Grid
    canvas->Pen->Color = clBlack;
    int left = draftleft+MM2PRx(13);
    if (left<0) left=0;
    int maxj = min(field.Height(), (h-MM2PRy(10))/gy);
    for (int i=0; i<field.Width()+1; i++) {
        canvas->MoveTo(left+i*gx, h-(maxj)*gy);
        canvas->LineTo(left+i*gx, h-1);
    }
    for (int j=0; j<=maxj; j++) {
        canvas->MoveTo(left, h-1-j*gy);
        canvas->LineTo(left+field.Width()*gx, h-1-j*gy);
    }

    // Daten
    for (int i=0; i<field.Width(); i++)
        for (int j=0; j<maxj; j++) {
            char c = field.Get (i, j);
            assert(c>=0 && c<=9);
            if (c>0) {
                canvas->Brush->Color = coltable[c];
                canvas->Pen->Color = canvas->Brush->Color;
                canvas->Rectangle (left+i*gx+1, h-(j+1)*gy,
                                    left+(i+1)*gx, h-1-j*gy);
            }
        }
    canvas->Brush->Color = clWhite;

    // Zehnermarkierungen
    canvas->Pen->Color = clBlack;
    for (int j=0; j<maxj; j++) {
        if ((j%10)==0) {
            canvas->MoveTo (draftleft, h - j*gy - 1);
            canvas->LineTo (left-MM2PRx(3), h - j*gy - 1);
            canvas->TextOutA (draftleft, h - j*gy + MM2PRy(1), IntToStr(j));
        }
    }

    // Rapportmarkierung
#if(0)
    if (rapport!=0) {
        canvas->Pen->Color = clRed;
        canvas->MoveTo (draftleft, h - (rapport)*gx - 1);
        canvas->LineTo (left-MM2PRx(3), h - (rapport)*gx - 1);
    }
#endif

    ////////////////////////////////////////
    //
    //   Korrigiert (normal)
    //
    ////////////////////////////////////////

    // Grid
    canvas->Pen->Color = clBlack;
    left = normalleft+gx/2;
    if (left<0) left=gx/2;
    maxj = min(field.Height(), (h-MM2PRy(10))/gy);
    for (int i=0; i<field.Width()+1; i++) {
        for (int jj=0; jj<maxj; jj+=2) {
            canvas->MoveTo(left+i*gx, h-(jj+1)*gy);
            canvas->LineTo(left+i*gx, h-jj*gy);
        }
    }
    for (int i=0; i<=field.Width()+1; i++) {
        for (int jj=1; jj<maxj; jj+=2) {
            canvas->MoveTo(left+i*gx-gx/2, h-(jj+1)*gy);
            canvas->LineTo(left+i*gx-gx/2, h-jj*gy);
        }
    }
    canvas->MoveTo(left, h-1);
    canvas->LineTo(left+field.Width()*gx+1, h-1);
    for (int jj=1; jj<=maxj; jj++) {
        canvas->MoveTo(left-gx/2, h-1-jj*gy);
        canvas->LineTo(left+field.Width()*gx+gx/2+1, h-1-jj*gy);
    }

    // Daten
    for (int i=0; i<field.Width(); i++)
        for (int jj=0; jj<maxj; jj++) {
            char c = field.Get (i, jj+scroll);
            assert(c>=0 && c<=9);
            if (c==0) continue;
            canvas->Brush->Color = coltable[c];
            canvas->Pen->Color = canvas->Brush->Color;
            int ii = i;
            int j1 = jj;
            CorrectCoordinates (ii, j1);
            if (j1%2==0) {
                canvas->Rectangle (left+ii*gx+1,
                                           h-(j1+1)*gy,
                                           left+(ii+1)*gx,
                                           h-1-j1*gy);
            } else {
                canvas->Rectangle (left-gx/2+ii*gx+1,
                                           h-(j1+1)*gy,
                                           left-gx/2+(ii+1)*gx,
                                           h-1-j1*gy);
            }
        }
    canvas->Brush->Color = clWhite;


    ////////////////////////////////////////
    //
    //   Simulation
    //
    ////////////////////////////////////////

    // Grid
    canvas->Pen->Color = clBlack;
    left = simulationleft+gx/2;
    if (left<0) left=gx/2;
    maxj = min(field.Height(), (h-MM2PRy(10))/gy);
    int w = field.Width()/2;
    for (int j=0; j<maxj; j+=2) {
        for (int i=0; i<w+1; i++) {
            canvas->MoveTo(left+i*gx, h-(j+1)*gy);
            canvas->LineTo(left+i*gx, h-j*gy);
        }
        if (j>0 || scroll>0) {
            canvas->MoveTo (left-gx/2, h-(j+1)*gy);
            canvas->LineTo (left-gx/2, h-j*gy);
        }
    }
    for (int j=1; j<maxj; j+=2) {
        for (int i=0; i<w+1; i++) {
            canvas->MoveTo(left+i*gx-gx/2, h-(j+1)*gy);
            canvas->LineTo(left+i*gx-gx/2, h-j*gy);
        }
        canvas->MoveTo(left+w*gx, h-(j+1)*gy);
        canvas->LineTo(left+w*gx, h-j*gy);
    }
    canvas->MoveTo(left, h-1);
    canvas->LineTo(left+w*gx+1, h-1);
    for (int j=1; j<=maxj; j++) {
        canvas->MoveTo(left-gx/2, h-1-j*gy);
        canvas->LineTo(left+w*gx+1, h-1-j*gy);
    }

    // Daten
    for (int i=0; i<field.Width(); i++)
        for (int j=0; j<maxj; j++) {
            char c = field.Get (i, j+scroll);
            assert(c>=0 && c<=9);
            if (c==0) continue;
            canvas->Brush->Color = coltable[c];
            canvas->Pen->Color = canvas->Brush->Color;
            int ii = i;
            int jj = j;
            CorrectCoordinates (ii, jj);
            if (ii>w && ii!=field.Width()) continue;
            if (jj%2==0) {
                if (ii==w) continue;
                canvas->Rectangle (left+ii*gx+1,
                                           h-(jj+1)*gy,
                                           left+(ii+1)*gx,
                                           h-1-jj*gy);
            } else {
                if (ii!=field.Width() && ii!=w) {
                    canvas->Rectangle (left-gx/2+ii*gx+1,
                                               h-(jj+1)*gy,
                                               left-gx/2+(ii+1)*gx,
                                               h-1-jj*gy);
                } else if (ii==w) {
                    canvas->Rectangle (left-gx/2+ii*gx+1,
                                               h-(jj+1)*gy,
                                               left-gx/2+ii*gx+gx/2,
                                               h-1-jj*gy);
                } else {
                    canvas->Rectangle (left-gx/2+1,
                                               h-(jj+2)*gy,
                                               left,
                                               h-1-(jj+1)*gy-1);
                }
            }
        }
    canvas->Brush->Color = clWhite;



    ////////////////////////////////////////
    //
    //   Auswertung
    //
    ////////////////////////////////////////

    int x1 = reportleft;
    int x2 = reportleft + MM2PRx(30);
    int y = MM2PRy(10);
    int dy = MM2PRy(5);
    int dx = MM2PRx(5);

    // Mustername
    canvas->Pen->Color = clBlack;
    canvas->TextOut (x1, y, LANG_STR("Pattern:", "Muster:"));
    canvas->TextOut (x2, y, ExtractFileName(savedialog->FileName));
    y += dy;
    // Umfang
    canvas->TextOut (x1, y, LANG_STR("Circumference:", "Umfang:"));
    canvas->TextOut (x2, y, IntToStr(field.Width()));
    y += dy;
    // Musterrapport
#if(0)
    canvas->TextOut (x1, y, LANG_STR("Repeat of pattern:", "Musterrapport:"));
    canvas->TextOut (x2, y, IntToStr(rapport) + LANG_STR(" turns", " Umgänge"));
    y += dy;
#endif
    // Farbrapport
    canvas->TextOut (x1, y, LANG_STR("Repeat of colors:", "Farbrapport:"));
    canvas->TextOut (x2, y, IntToStr(farbrapp) + LANG_STR(" beads", " Perlen"));
    y += dy;
    // Fädelliste...
    if (farbrapp>0) {
        int page = 1;
        int column = 0;
        canvas->TextOut (x1, y, LANG_STR("List of beads", "Fädelliste"));
        y += dy;
        int ystart = y;
        char col = field.Get(farbrapp-1);
        int  count = 1;
        for (signed int i=farbrapp-2; i>=0; i--) {
            if (field.Get(i)==col) {
                count++;
            } else {
                if (col!=0) {
                    canvas->Brush->Color = coltable[col];
                    canvas->Pen->Color = clWhite;
                } else {
                    canvas->Brush->Color = clWhite;
                    canvas->Pen->Color = clBlack;
                }
                canvas->Rectangle (x1, y, x1+dx-MM2PRx(1), y+dy-MM2PRy(1));
                canvas->Pen->Color = clBlack;
                canvas->Brush->Color = clWhite;
                canvas->TextOut (x1+dx+3, y, IntToStr(count));
                y += dy;
                col = field.Get(i);
                count = 1;
            }
            if (y>=Printer()->PageHeight-MM2PRy(10)) {
                x1 += dx + MM2PRx(8);
                y = ystart;
                column++;
                if (column>=reportcols) { // neue Seite und weiter...
                    Printer()->NewPage();
                    x1 = draftleft;
                    x2 = draftleft + MM2PRx(30);
                    y = MM2PRy(10);
                    reportcols = (Printer()->PageWidth - draftleft - 10) / (MM2PRx(5) + MM2PRx(8));
                    column = 0;
                    page++;
                    canvas->Pen->Color = clBlack;
                    canvas->TextOut (x1, y, String(LANG_STR("Pattern ", "Muster "))+ExtractFileName(savedialog->FileName) + " - " + LANG_STR("page ", "Seite ") + IntToStr(page));
                    y += dy;
                    ystart = y;
                }
            }
        }
        if (y<Printer()->PageHeight-MM2PRy(10)) {
            if (col!=0) {
                canvas->Brush->Color = coltable[col];
                canvas->Pen->Color = clWhite;
            } else {
                canvas->Brush->Color = clWhite;
                canvas->Pen->Color = clBlack;
            }
            canvas->Rectangle (x1, y, x1+dx-MM2PRx(1), y+dy-MM2PRy(1));
            canvas->Pen->Color = clBlack;
            canvas->Brush->Color = clWhite;
            canvas->TextOut (x1+dx+3, y, IntToStr(count));
        }
    }

g_exit:
    Printer()->EndDoc();
}