/**************************************************************************
 *
 *  Name       : DlgQuatro(*HPS phps,int i, int j, LONG lColor)
 *
 *  Description: рисует квадратик в любом месте любого цвета
 *
 *  Concepts:  Родной брат обычного квадратика. Необходимость
 *	       в нем возникла при разработке диалога. Старый не
 *        подходил, и переделывать его значило бы
 *        перелопачивать всю программу. Елки-палки.
 *
 *  Parameters :  phps - указатель на hps
 *                i,j - координаты
 *                lColor - цвет
 *************************************************************************/
VOID DlgQuatro(PHPS phps,int i, int j, LONG lColor)
{  RECTL rec;//где рисовать
   POINTL ptl;//куда и откуда рисовать
   //рисуем квадрат
   rec.xLeft   = j+1;
   rec.xRight  = j+bs;
   rec.yBottom = i;
   rec.yTop    = i+bs-1;
   WinFillRect(*phps, &rec, lColor);
   if(st){//рисуем линии 3D
      if(lColor>6)
         GpiSetColor(*phps,CLR_DARKGRAY);
      else
         GpiSetColor(*phps,lColor+8);
      ptl.x=j;
      ptl.y=i;
      GpiMove(*phps,&ptl);
      ptl.x=j+bs-1;
      GpiLine(*phps,&ptl);
      GpiMove(*phps,&ptl);
      ptl.y=i+bs;
      GpiLine(*phps,&ptl);
      ptl.x=j+bs-2;
      ptl.y=i+bs-1;
      GpiMove(*phps,&ptl);
      ptl.y=i+1;
      GpiLine(*phps,&ptl);
      GpiMove(*phps,&ptl);
      ptl.x=j+1;
      GpiLine(*phps,&ptl);}
}   /* End of DlgQuatro */
/**************************************************************************
 *
 *  Name       : Quatro(*HPS phps,int i, int j)
 *
 *  Description: рисует квадратик
 *
 *  Concepts:  Получает указатель на пространство отображения
 *	       и рисует квадрат размером BmpSize с координатами
 *        i и j
 *
 *
 *  API's      :
 *
 *  Parameters :  phps - указатель на hps
 *                i,j - номера элемента матрицы Field
 *************************************************************************/
VOID Quatro(PHPS phps,int i, int j)
{  RECTL rec;//где рисовать
   POINTL ptl;//куда и откуда рисовать
   //рисуем квадрат
   if(Field == NULL) return;//если инициализации не было
   rec.xLeft   = j*BmpSize+1;
   rec.xRight  = j*BmpSize+BmpSize;
   rec.yBottom = i*BmpSize;
   rec.yTop    = i*BmpSize+BmpSize-1;
   WinFillRect(*phps, &rec, Field[i][j]);
   if(bStyle){//рисуем линии 3D
      if(Field[i][j]>6)
         GpiSetColor(*phps,CLR_DARKGRAY);
      else
         GpiSetColor(*phps,Field[i][j]+8);
      ptl.x=j*BmpSize;
      ptl.y=i*BmpSize;
      GpiMove(*phps,&ptl);
      ptl.x=j*BmpSize+BmpSize-1;
      GpiLine(*phps,&ptl);
      GpiMove(*phps,&ptl);
      ptl.y=i*BmpSize+BmpSize;
      GpiLine(*phps,&ptl);
      ptl.x=j*BmpSize+BmpSize-2;
      ptl.y=i*BmpSize+BmpSize-1;
      GpiMove(*phps,&ptl);
      ptl.y=i*BmpSize+1;
      GpiLine(*phps,&ptl);
      GpiMove(*phps,&ptl);
      ptl.x=j*BmpSize+1;
      GpiLine(*phps,&ptl);}
}   /* End of Quatro */
示例#3
0
VOID ShowStatusLine( const HPS hps, const char Moves,
							const char Ships, const LONG Width,
							const LONG Height )
{
    RECTL Rect = { 0, Height, Width, Height + 30 };
    POINTL Point = { Width, Height };
    CHAR text[256];
 
    WinFillRect( hps, &Rect, CLR_WHITE ); //SYSCLR_WINDOW );	// clear background
    GpiSetColor( hps, CLR_BLACK );
    GpiSetLineType( hps, LINETYPE_SHORTDASH );
    GpiSetLineWidth( hps, LINEWIDTH_NORMAL );
    GpiSetMix( hps, FM_OVERPAINT );
    GpiMove( hps, &Point );
    Point.x = 0;
    GpiLine( hps, &Point );
    Point.x += 10;
    Point.y += 10;
    GpiMove( hps, &Point );
    if( Ships )
	sprintf( text, "%d %s made     %d %s still lost", Moves,
		 Moves == 1 ? "move" : "moves", Ships, Ships == 1 ? "ship" : "ships" );
    else
	sprintf( text, "%d %s made     All ships found", Moves,
		 Moves == 1 ? "move" : "moves" );

    GpiCharString( hps, strlen(text), text );
    DosSleep( 1 );	// free time slice 
} 
示例#4
0
void drawAxis(HPS hps,long yAxis12Dx,long yAxis12Dy,long yAxis22Dx,long yAxis22Dy,long xAxis12Dx,long xAxis12Dy,long xAxis22Dx,long xAxis22Dy,long zAxis12Dx,long zAxis12Dy,long zAxis22Dx,long zAxis22Dy,int drawIt )
{
    POINTL p;

    if (drawIt )
        GpiSetColor (hps,CLR_GREEN );
    else
        GpiSetColor (hps,CLR_BLACK );

    p.x=yAxis12Dx;
    p.y=yAxis12Dy;
    GpiMove(hps,&p);

    p.x=yAxis22Dx;
    p.y=yAxis22Dy;
    GpiLine(hps,&p);

    p.x=xAxis12Dx;
    p.y=xAxis12Dy;
    GpiMove(hps,&p);

    p.x=xAxis22Dx;
    p.y=xAxis22Dy;
    GpiLine(hps,&p);

    p.x=zAxis12Dx;
    p.y=zAxis12Dy;
    GpiMove(hps,&p);

    p.x=zAxis22Dx;
    p.y=zAxis22Dy;
    GpiLine(hps,&p);

}
示例#5
0
void drawGrid(HPS hps,long gridX,long gridY,int drawIt,char *str,BOOL tracename)
{
    POINTL p;

    if (!tracename)
        return;

    if (drawIt )
        GpiSetColor (hps,CLR_CYAN );
    else
        GpiSetColor (hps,CLR_BLACK );

    p.x=gridX-10;
    p.y=gridY-10;
    GpiMove(hps,&p);

    p.x=gridX-13;
    p.y=gridY-9;
    GpiLine(hps,&p);

    p.x=gridX-13;
    p.y=gridY+9;
    GpiLine(hps,&p);

    p.x=gridX-10;
    p.y=gridY+10;
    GpiLine(hps,&p);

    p.x=gridX+10;
    p.y=gridY-10;
    GpiMove(hps,&p);

    p.x=gridX+13;
    p.y=gridY-9;
    GpiLine(hps,&p);

    p.x=gridX+13;
    p.y=gridY+9;
    GpiLine(hps,&p);

    p.x=gridX+10;
    p.y=gridY+10;
    GpiLine(hps,&p);

    p.x=gridX;
    p.y=gridY-15;

    if (drawIt )
        GpiSetColor (hps,CLR_WHITE );
    
    GpiCharStringAt(hps,&p,strlen(str),str);

}
/*--------------------------------------------------
 * Draws the 3D border
 *-------------------------------------------------*/
void PMWindow::draw_3dborder( HPS ps, const SHAPE& rect, long thickness )
{
  LONG palette_format;

  if( !GpiQueryColorData( ps, 1, &palette_format ))
    PM_THROW_GUIERROR();

  LONG white    = palette_format == LCOLF_RGB ? RGB_WHITE    : CLR_WHITE;
  LONG darkgray = palette_format == LCOLF_RGB ? RGB_DARKGRAY : CLR_DARKGRAY;
  LONG palegray = palette_format == LCOLF_RGB ? RGB_PALEGRAY : CLR_PALEGRAY;
  LONG black    = palette_format == LCOLF_RGB ? RGB_BLACK    : CLR_BLACK;

  POINTL pos;
  GpiSetLineWidth( ps, LINEWIDTH_NORMAL );

  pos.y = rect.y;
  pos.x = rect.x;
  GpiMove( ps, &pos );

  GpiSetColor( ps, white );
  pos.x = rect.x+rect.cx-1;
  GpiLine( ps, &pos );
  pos.y = rect.y+rect.cy-1;
  GpiLine( ps, &pos );

  GpiSetColor( ps, darkgray );
  pos.x = rect.x;
  GpiLine( ps, &pos );
  pos.y = rect.y;
  GpiLine( ps, &pos );

  if( thickness > 1 )
  {
    pos.y = rect.y+1;
    pos.x = rect.x+1;
    GpiMove( ps, &pos );

    GpiSetColor( ps, palegray );
    pos.x = rect.x+rect.cx-2;
    GpiLine( ps, &pos );
    pos.y = rect.y+rect.cy-2;
    GpiLine( ps, &pos );

    GpiSetColor( ps, black );
    pos.x = rect.x+1;
    GpiLine( ps, &pos );
    pos.y = rect.y+1;
    GpiLine( ps, &pos );
  }
}
示例#7
0
/*------------------------------------------------------------------------*/
VOID DrawGrid(WINDOWINFO *pwi, RECTL *rcl)
{
   POINTL ptl;
   LONG   lForeColor;
   LONG   lBackColor;
   ULONG  ulcx = pwi->ulgridcx;
   ULONG  ulcy = pwi->ulgridcy;


   lForeColor = GpiQueryColor(pwi->hps);
   lBackColor = GpiQueryBackColor(pwi->hps);

   if (view.iZoom == 2)
   {
      ulcx /=2;
      ulcy /=2;
   }
   else if (view.iZoom && view.iZoom != 2)
   {
      ulcx *= view.iZoom;
      ulcy *= view.iZoom;
      ulcx /= 100;
      ulcy /= 100;
   }
   GpiSetColor(pwi->hps,lBackColor);
   GpiSetMix(pwi->hps,FM_INVERT);

   for (ptl.x= rcl->xLeft; ptl.x <  rcl->xRight; ptl.x += (ulcx * pwi->ulgriddisp))
      for (ptl.y=rcl->yBottom; ptl.y <  rcl->yTop; ptl.y += (ulcy * pwi->ulgriddisp))
      {
         GpiMove(pwi->hps,&ptl);
         GpiLine(pwi->hps,&ptl);
      }
   GpiSetColor(pwi->hps,lForeColor);
}
示例#8
0
/*------------------------------------------------------------------------*/
void BlockTextMoveOutLine(POBJECT pObj,WINDOWINFO *pwi, SHORT dx, SHORT dy)
{
   blocktext *pT = (blocktext *)pObj;
   POINTL ptl1,ptl2;
   RECTL  rcl;

   if (!pObj)
      return;

   rcl.xLeft   = pT->rclf[0].xLeft  * pwi->usFormWidth;
   rcl.xRight  = pT->rclf[0].xRight * pwi->usFormWidth;
   rcl.yTop    = pT->rclf[0].yTop   * pwi->usFormHeight;
   rcl.yBottom = pT->rclf[0].yBottom* pwi->usFormHeight;

   ptl1.x = rcl.xLeft;
   ptl1.y = rcl.yTop;

   ptl1.y += (LONG)dy;
   ptl1.x += (LONG)dx;
 
   ptl2.x = rcl.xRight;
   ptl2.y = rcl.yBottom;

   ptl2.y += (LONG)dy;
   ptl2.x += (LONG)dx;

   GpiMove(pwi->hps,&ptl1);
   GpiBox(pwi->hps,DRO_OUTLINE,&ptl2,0,0);
   return;
}
void XBox::Draw(XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
      XLine::SetupDevice(dev);

      POINTL ptl[5], po;

      po.x = p.x;
      po.y = p.y;
      ptl[0].x = ptl[4].x = p.x;
      ptl[0].y = ptl[4].y = p.y;
      ptl[1].x = p.x;
      ptl[1].y = ptl[2].y = height + p.y;
      ptl[3].x = ptl[2].x = width + p.x;
      ptl[3].y = p.y;

      GpiBeginPath(dev->hps, 1);
      GpiMove(dev->hps, &po);
      GpiPolyLine(dev->hps, 5, ptl);
      GpiEndPath(dev->hps);

      if (fill)
         GpiFillPath(dev->hps, 1, FPATH_ALTERNATE);
      else
         GpiOutlinePath(dev->hps, 1, 0);
//          GpiStrokePath( dev->hps, 1, 0);
   }
}
示例#10
0
static void drawLine(pLines pLin, HPS hps,WINDOWINFO *pwi,POINTL ptl1, POINTL ptl2)
{

      GpiSetLineType(hps,pLin->bt.line.LineType);
      GpiMove(hps, &ptl1);
      if (pLin->bt.line.LineWidth > 1 && pwi->uXfactor >= (float)1)
      {
         LONG lLineWidth = pLin->bt.line.LineWidth;

         if (pwi->ulUnits == PU_PELS)
         {
            lLineWidth = (lLineWidth * pwi->xPixels)/10000;
         }
         GpiSetPattern(hps, PATSYM_SOLID);
         GpiSetLineJoin(hps,pLin->bt.line.LineJoin);
         GpiSetLineEnd(hps,pLin->bt.line.LineEnd);
         GpiSetLineWidthGeom (hps,lLineWidth);
         GpiBeginPath( hps, 1L);  /* define a clip path    */
      }
      GpiLine(hps,&ptl2);

      if (pwi->uXfactor >= (float)1)
      {
         GpiSetLineType(hps,LINETYPE_SOLID);
         drwEndPoints(pwi,pLin->bt.arrow,ptl1,ptl2);
      }

      if (pLin->bt.line.LineWidth > 1 && pwi->uXfactor >= (float)1)
      {
         GpiEndPath(hps);
         GpiStrokePath (hps, 1, 0);
      }
}
示例#11
0
/*------------------------------------------------------------------------*/
void BlockTextStretch(POBJECT pObj,PRECTL prclNew,WINDOWINFO *pwi,ULONG ulMsg)
{
   POINTL ptl;
   blocktext *pT = (blocktext *)pObj;

   switch (ulMsg)
   {
      case WM_BUTTON1DOWN:
         break;
      case WM_BUTTON1UP:
         pT->rclf[0].xLeft  = (float)prclNew->xLeft;
         pT->rclf[0].xRight = (float)prclNew->xRight;
         pT->rclf[0].yTop   = (float)prclNew->yTop;
         pT->rclf[0].yBottom= (float)prclNew->yBottom;
         pT->rclf[0].xLeft  /= (float)pwi->usFormWidth;
         pT->rclf[0].xRight /= (float)pwi->usFormWidth;
         pT->rclf[0].yTop   /= (float)pwi->usFormHeight;
         pT->rclf[0].yBottom/= (float)pwi->usFormHeight;
         break;
      case WM_MOUSEMOVE:
         GpiSetLineType(pwi->hps,LINETYPE_DOT);
         ptl.x = prclNew->xLeft;
         ptl.y = prclNew->yBottom;
         GpiMove(pwi->hps, &ptl);
         ptl.x = prclNew->xRight;
         ptl.y = prclNew->yTop;
         GpiBox(pwi->hps,DRO_OUTLINE,&ptl,0L,0L);
         break;
      default:
         break;
   }
   return;
}
QRegion::QRegion( const QRect &r, RegionType t )
{
    data = new QRegionData;
    Q_CHECK_PTR( data );
    data->hgt = 0;
    data->is_null = FALSE;
    if ( r.isEmpty() ) {
	data->rgn = 0;
    } else {
        HPS hps = qt_display_ps();
	if ( t == Rectangle ) {			// rectangular region
            RECTL rcl = { r.left(), -(r.bottom()+1), r.right()+1, -r.top() };
            data->rgn = GpiCreateRegion( hps, 1, &rcl );
	} else if ( t == Ellipse ) {		// elliptic region
            // if the width or height of the ellipse is odd, GPI always
            // converts it to a nearest even value, which is obviously stupid
            // (see also QPainter::drawArcInternal()). So, we don't use
            // GpiCreateEllipticRegion(), but create an array of points to
            // call GpiCreatePolygonRegion() instead.
            QPointArray a;
            a.makeArc( r.x(), r.y(), r.width(), r.height(), 0, 360 * 16 );
            for ( uint i = 0; i < a.size(); ++ i )
                a[i].ry() = -(a[i].y() + 1);
            // GpiCreatePolygonRegion() is bogus and always starts a poligon from
            // the current position. Make the last point the current one and reduce
            // the number of points by one.
            GpiMove( hps, (PPOINTL) &a[ a.size() - 1 ] );
            POLYGON poly = { a.size() - 1, (PPOINTL) a.data() };
            data->rgn = GpiCreatePolygonRegion( hps, 1, &poly, POLYGON_ALTERNATE );
	}
    }
}
QRegion::QRegion( const QPointArray &a, bool winding )
{
    data = new QRegionData;
    Q_CHECK_PTR( data );
    data->hgt = 0;
    data->is_null = FALSE;
    QRect r = a.boundingRect();
    if ( a.isEmpty() || r.isEmpty() ) {
	data->rgn = 0;
    } else {
        HPS hps = qt_display_ps();
        POINTL *pts = new POINTL[ a.size() ]; 
        for ( uint i = 0; i < a.size(); ++ i ) {
            pts[i].x = a[i].x();
            pts[i].y = - (a[i].y() + 1);
        }
        // GpiCreatePolygonRegion() is bogus and always starts a poligon from
        // the current position. Make the last point the current one and reduce
        // the number of points by one.
        GpiMove( hps, &pts[ a.size() - 1 ] );
        POLYGON poly = { a.size() - 1, pts };
        ULONG opts = winding ? POLYGON_WINDING : POLYGON_ALTERNATE;
        data->rgn = GpiCreatePolygonRegion( hps, 1, &poly, opts );
        delete[] pts;
    }
}
MRESULT
DrawMenuItem( POWNERITEM poi )
{
  TASKDATA* data = (TASKDATA*)poi->hItem;
  BOOL   select  = (poi->fsAttribute & MIA_HILITED) ? TRUE : FALSE;
  ULONG  cx_icon = WinQuerySysValue( HWND_DESKTOP, SV_CXICON );
  ULONG  cy_icon = WinQuerySysValue( HWND_DESKTOP, SV_CYICON );
  POINTL pos;
  RECTL  rect = poi->rclItem;

  WinFillRect( poi->hps, &rect, select ? SYSCLR_MENUHILITEBGND : SYSCLR_MENU );

  rect.xLeft += 2;
  rect.yBottom += ( rect.yTop - rect.yBottom - cy_icon/2 ) / 2;
  if( data->hIcon != NULLHANDLE ) {
    WinDrawPointer( poi->hps, rect.xLeft + 1, rect.yBottom + 1, data->hIcon, DP_MINI );
  }

  rect.xLeft += cx_icon/2 + 5;
  rect.yBottom = poi->rclItem.yBottom;
  WinDrawText( poi->hps, -1, data->szTitle, &rect,
                    select ? SYSCLR_MENUHILITE : SYSCLR_MENUTEXT, 0,
                    DT_LEFT | DT_VCENTER );

  // Well well well... And now ;) we are going to fix A great-Warp4-Menu-Bug
  // Make to redraw erased parts of menu's window border
  // Define something like #ifdef WARP_3 if you are running OS/2 Warp 3.x

  // vertical "light" line
  pos.x = poi->rclItem.xLeft;
  pos.y = 1;
  GpiSetColor( poi->hps, SYSCLR_BUTTONLIGHT );
  GpiMove( poi->hps, &pos );
  pos.y = poi->rclItem.yTop;
  GpiLine( poi->hps, &pos );

  // horizontal "dark" line
  pos.x = 1;
  pos.y = 1;
  GpiSetColor( poi->hps, SYSCLR_BUTTONDARK );
  GpiMove( poi->hps, &pos );
  pos.x = poi->rclItem.xRight;
  GpiLine( poi->hps, &pos );

  poi->fsAttributeOld = (poi->fsAttribute &= ~MIA_HILITED);
  return MRFROMLONG( TRUE );
}
示例#15
0
VOID DrawCrossHairsInner (HWND hwnd)
     {
     POINTL ptl1;

     GpiSetMix (cp.hpsScreen, FM_INVERT) ;

     ptl1.x = 0; ptl1.y = ptlCrossHairs.y;
     GpiMove (cp.hpsScreen, &ptl1);
     ptl1.x = cxClient-1;
     GpiLine (cp.hpsScreen, &ptl1);
     ptl1.x = ptlCrossHairs.x; ptl1.y = 0;
     GpiMove (cp.hpsScreen, &ptl1);
     ptl1.y = cyClient-1;
     GpiLine (cp.hpsScreen, &ptl1);

     GpiSetMix (cp.hpsScreen, FM_DEFAULT);
     }
void XArc::Draw( XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
      SetupDevice(dev);

      POINTL po;
      po.x = p.x;
      po.y = p.y;
      GpiMove(dev->hps, &po);
      ARCPARAMS a;

      a.lQ = w;
      a.lP = h;
      a.lR = x;
      a.lS = y;

      GpiSetArcParams(dev->hps, &a);

      if (vis)
      {
         GpiBeginPath(dev->hps, 1);
         GpiPartialArc(dev->hps, &po, MAKEFIXED(1, 0), MAKEFIXED(st, 0), MAKEFIXED(en, 0));
         GpiLine(dev->hps, &po);
         GpiEndPath(dev->hps);
         if (filled)
            GpiFillPath(dev->hps, 1, FPATH_WINDING);
         else
            GpiOutlinePath(dev->hps, 1, 0);
      }
      else
      {
         POINTL pt[3];

//berechnen!
         pt[0].x = pt[0].y = 0;
         GpiMove(dev->hps, &pt[0]);
         pt[1].x = pt[1].y = 100;
         pt[2].x = 200;
         pt[2].y = 0;
         GpiPointArc(dev->hps, &pt[1]);
      }
   }
}
示例#17
0
VOID DrawZoomBoxInner (HWND hwnd)
     {

     GpiSetMix (cp.hpsScreen, FM_INVERT) ;

     GpiMove (cp.hpsScreen, &ptlZBox1);
     GpiBox (cp.hpsScreen, DRO_OUTLINE, &ptlZBox2, 0L, 0L);

     GpiSetMix (cp.hpsScreen, FM_DEFAULT);
     }
示例#18
0
static HPS hpsDrawText(HPS hPS,	PTEXTFIELD ptf)

{
FONTMETRICS fm3D;		   /* Font Metrics Holder		*/
RECTL	    rcl;		   /* Rectangle	Holder			*/
register LONG i, k, n;		   /* String Length Counter		*/

		       /* Get the presentation space for the control	*/
		       /* and set the colour table to RGB mode		*/

GpiCreateLogColorTable(hPS, 0L,	LCOLF_RGB, 0L, 0L, (PLONG)NULL);

		       /* Check	to see if any text present and if the	*/
		       /* case,	draw it	within the rectangle		*/

if ( ptf->cText	)
		       /* Check	to see if the text is to be broken over	*/
		       /* more than one	line if	the length of the text	*/
		       /* is greater than the width of the control	*/

   if (	ptf->flStyle & DT_WORDBREAK )
       {
		       /* Word break style specified, set the drawing	*/
		       /* of the text within a loop such that it can	*/
		       /* be drawn on successive lines			*/
       n = ptf->cText;
       GpiQueryFontMetrics(hPS,	sizeof(FONTMETRICS), &fm3D);
       rcl = ptf->rcl;
       i = 0;
       do
	   {
	   n -=	(k = WinDrawText(hPS, n, &ptf->pszText[i], &rcl, ptf->lClrText,
				 ptf->lClrBackground, ptf->flFormat));
	   i +=	k;
	   if (	(rcl.yTop -= fm3D.lMaxBaselineExt) < rcl.yBottom )
	       break;
	   } while ( n > 0 );
       }
   else
       WinDrawText(hPS,	ptf->cText, ptf->pszText, &ptf->rcl, ptf->lClrText,
		   ptf->lClrBackground,	ptf->flFormat);
else
   WinFillRect(hPS, &ptf->rcl, ptf->lClrBackground);

GpiSetColor(hPS, ptf->lClrLeftTop);

GpiMove(hPS, &ptf->aptl[3]);
GpiPolyLine(hPS, 2L, ptf->aptl);

GpiSetColor(hPS, ptf->lClrBottomRight);
GpiPolyLine(hPS, 2L, &ptf->aptl[2]);

return(hPS);
}
void XMarker::Draw( XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
      SetupDevice(dev);
      POINTL po;
      po.x = p.x;
      po.y = p.y;
      GpiMove(dev->hps, &po);
      GpiMarker(dev->hps, &po);
   }
}
static void draw ( IPresSpaceHandle hps,
                   IListBox *lb, 
                   const TgtLocation &target )
  {
  if ( target.index != nil )
    {
    // First, get offset from top of listbox:
    unsigned
      offset = target.index - lb->top() + 1,
      height = ListBoxItem::itemHeight( lb );
    // Next, adjust if before this item:
    if ( target.type == ListBoxItem::before )
      offset--;
    // Calculate that item's rectangle's bottom:
    unsigned
      bottom = lb->rect().height() - height * offset;
    // Lower 2 pels 'cause it looks better!
    bottom -= 2;
    // Draw line or box:
    IPoint
      origin( 0, bottom );
    if ( target.type == ListBoxItem::on )
      {
      IPoint
        topRight( lb->rect().width(), bottom + height );
      origin += 1;
      topRight -= IPoint( WinQuerySysValue( HWND_DESKTOP,
                                            SV_CXVSCROLL ) + 1, 1 );
      GpiMove( hps, PPOINTL( &origin ) );
      GpiBox( hps, DRO_OUTLINE, PPOINTL( &topRight ), 0, 0 );
      }
    else
      {
      IPoint
        end( lb->rect().width(), bottom );
      GpiMove( hps, PPOINTL( &origin ) );
      GpiLine( hps, PPOINTL( &end ) );
      }
    }
  }
示例#21
0
VOID GRAPHBOARD::ShowPointerPos( HPS hps, LONG ptx, LONG pty )
{
    POINTL Point;

    Point.x = LowerLeftPlace.x + (GetBoardCol( ptx ) - 1) * dist;
    Point.y = LowerLeftPlace.y + (GetBoardRow( pty ) - 1) * dist;
    if( Point.x == DrawPoint.x && Point.y == DrawPoint.y ) return;
    // nothing to do

    if( GetfShowLines() ){	// if the help lines are visible, turn them off
	SetfShowLines( FALSE );
	DisplayLines( hps );
    }

    GpiSetMix( hps, FM_XOR );
    GpiSetColor( hps, CLR_DARKGRAY );
    if( DrawPoint.x >= LowerLeftPlace.x && DrawPoint.y >= LowerLeftPlace.y ) {
	// there exists a visible square that must be removed
	DrawPoint.x -= dist / 3;
	DrawPoint.y -= dist / 3;
	GpiMove( hps, &DrawPoint );
	DrawPoint.x += 2 * dist / 3;
	DrawPoint.y += 2 * dist / 3;
	GpiBox( hps, DRO_OUTLINEFILL, &DrawPoint, 0, 0 );

    }
    DrawPoint.x = Point.x;	// DrawPoint is set to the new point
    DrawPoint.y = Point.y;
    if( Point.x >= LowerLeftPlace.x && Point.y >= LowerLeftPlace.y ){
	// neither GetBoardCol nor GetBoardRow returned 0 => point is visible
	Point.x -= dist / 3;
	Point.y -= dist / 3;
	GpiMove( hps, &Point );
	Point.x += 2 * dist / 3;
	Point.y += 2 * dist / 3;
	GpiBox( hps, DRO_OUTLINEFILL, &Point, 0, 0 );
    }
    GpiSetMix( hps, FM_OVERPAINT );
}
/* Dialog-Procedure f�r die AboutBox (OS/2-Standard) */
MRESULT EXPENTRY AboutBoxDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,MPARAM mp2)
{
   HWND  TextPos;
   IString textstr;
   SHORT i;
   ULONG   ulScrWidth, ulScrHeight;
   RECTL   Rectl;
   SWP     Swp;
   HPS     hps;

   switch(msg) {
   case WM_PAINT:
      hps = WinBeginPaint (hwnd,0,0);
      WinQueryWindowRect (hwnd, &Rectl);
      WinFillRect (hps, &Rectl, SYSCLR_DIALOGBACKGROUND);
      Rectl.yTop -= WinQuerySysValue(HWND_DESKTOP,SV_CYTITLEBAR),

      WinDrawBorder (hps, &Rectl,
          WinQuerySysValue(HWND_DESKTOP,SV_CXDLGFRAME),
          WinQuerySysValue(HWND_DESKTOP,SV_CYDLGFRAME),
          CLR_DARKGRAY, CLR_WHITE, DB_RAISED);
      GpiMove (hps, (PPOINTL)&Rectl);
      Rectl.xRight--;
      Rectl.yTop--;
      WinQueryWindowPos (WinWindowFromID (hwnd, IDD_ACOPYRIGHTFRAME), &Swp);
      Rectl.xLeft   = Swp.x-1;
      Rectl.yBottom = Swp.y-1;
      Rectl.xRight  = Swp.x + Swp.cx + 1;
      Rectl.yTop    = Swp.y + Swp.cy + 1;
      WinDrawBorder (hps, &Rectl, 1L, 1L,
          CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
      WinQueryWindowPos (WinWindowFromID (hwnd, IDD_APROGRAMFRAME), &Swp);
      Rectl.xLeft   = Swp.x-1;
      Rectl.yBottom = Swp.y-1;
      Rectl.xRight  = Swp.x + Swp.cx + 1;
      Rectl.yTop    = Swp.y + Swp.cy + 1;
      WinDrawBorder (hps, &Rectl, 1L, 1L,
          CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
      WinEndPaint (hps);
      break;
   case WM_COMMAND:
     /* no matter what the command, close the dialog */
      WinDismissDlg(hwnd, TRUE);
      break;

   default:
      return(WinDefDlgProc(hwnd, msg, mp1, mp2));
   }
   return(MPVOID);
}  /* AboutBoxWndProc() */
SOM_Scope void  SOMLINK ShapePartDrawFrame(ShapePart *somSelf,
                                            Environment *ev,
                                            ODFacet* facet,
                                            ODShape* invalidShape)
{
    ShapePartData *somThis = ShapePartGetData(somSelf);
    ShapePartMethodDebug("ShapePart","ShapePartDrawFrame");

    ODFrame* displayFrame = facet->GetFrame(ev);
    TempODShape shape = displayFrame->AcquireFrameShape(ev, facet->GetCanvas(ev));
    ODRect rect;
    shape->GetBoundingBox(ev, &rect);


#if defined(_PLATFORM_WIN32_)
    Rect frameRect;
    SetRect(&frameRect, FixedToInt(rect.left),
                       FixedToInt(rect.top),
                       FixedToInt(rect.right),
                       FixedToInt(rect.bottom));

    HDC hdc;
    CFocus focus(facet, invalidShape, &hdc);

    HBRUSH hbr = CreateSolidBrush (_fBackgroundColor);
    FillRect (hdc, &frameRect, hbr);
    DeleteObject (hbr);

#elif defined (_PLATFORM_OS2_)

    RECTL frameRect;
    frameRect.xLeft = FixedToInt(rect.left);
    frameRect.yTop  = FixedToInt(rect.top);
    frameRect.xRight  = FixedToInt(rect.right);
    frameRect.yBottom  = FixedToInt(rect.bottom);

    HPS hdc;
    CFocus focus(facet, invalidShape, &hdc);

    GpiCreateLogColorTable (hdc, 0L, LCOLF_RGB, 0L, 0L, 0L);
    GpiSetColor(hdc, _fBackgroundColor);
    POINTL orig = {0, 0};
    GpiMove(hdc, &orig);
    POINTL ptl = {frameRect.xRight, frameRect.yTop};
    GpiBox(hdc, DRO_FILL, &ptl, 0, 0);


#endif
}
示例#24
0
文件: hchlb.c 项目: komh/hanedit2
MRESULT hchlb_wmPaint( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
    HPS     hps;
    RECTL   rcl;
    POINTL  ptl;

    hps = WinBeginPaint( hwnd, NULLHANDLE, &rcl );
    WinQueryWindowRect( hwnd, &rcl );

    GpiSetColor( hps, SYSCLR_BUTTONDARK);

    ptl.x = rcl.xRight - 1;
    ptl.y = rcl.yTop - 1;
    GpiMove( hps, &ptl );

    ptl.x = rcl.xLeft;
    GpiLine( hps, &ptl );

    ptl.y = rcl.yBottom;
    GpiLine( hps, &ptl );

    GpiSetColor( hps, SYSCLR_BUTTONLIGHT );

    ptl.x = rcl.xLeft + 1;
    GpiMove( hps, &ptl );

    ptl.x = rcl.xRight - 1;
    GpiLine( hps, &ptl );

    ptl.y = rcl.yTop - 1;
    GpiLine( hps, &ptl );

    WinEndPaint( hps );

    return 0;
}
VOID DrawHand (HPS hps, POINTL aptlIn[], INT iNum, INT iAngle,
               PWINDOWINFO pwi)
     {
     INT    iIndex ;
     POINTL aptl [5] ;

     for (iIndex = 0 ; iIndex < iNum ; iIndex++)
          aptl [iIndex] = aptlIn [iIndex] ;

     RotatePoint    (aptl, iNum, iAngle) ;
     ScalePoint     (aptl, iNum, pwi) ;
     TranslatePoint (aptl, iNum, pwi) ;

     GpiMove (hps, aptl) ;
     GpiPolyLine (hps, iNum - 1L, aptl + 1) ;
     }
void DrawFigure (HPS hps, INT i, INT cxClient, INT cyClient)
     {
     POINTL ptl ;

     ptl.x = (1 + 10 * i) * cxClient / 30 ;
     ptl.y = 3 * cyClient / 4 ;
     GpiMove (hps, &ptl) ;

     ptl.x = (5 + 10 * i) * cxClient / 30 ;
     ptl.y = cyClient / 4 ;
     GpiLine (hps, &ptl) ;

     ptl.x = (9 + 10 * i) * cxClient / 30 ;
     ptl.y = 3 * cyClient / 4 ;
     GpiLine (hps, &ptl) ;
     }
示例#27
0
// disegna il controllo groupbox
MRESULT PaintGroupBox(HWND hwnd) {
   PCTL pgb = stGetData(hwnd);
   if (pgb) {
      RECTL rcl = {0, 0, pgb->wr.cx, pgb->wr.cy};
      HPS hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
      ULONG brd = pgb->fl & 0x7;
      ULONG frm = brd;
      GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
      // disegna bordo groupbox
      WinDrawBorder(hps, &rcl, brd, brd, 0, 0,
                    (pgb->fl & CCTL_RAISED? 0x400: 0x800));
      // se necessario disegnare anche frame
      if (pgb->fl & CCTL_FRAME6) {
         frm = brd * ((pgb->fl & 0x38) >> 3);
         rcl.xLeft = frm;
         rcl.yBottom = frm;
         rcl.xRight -= frm; 
         rcl.yTop -= frm; 
         WinDrawBorder(hps, &rcl, brd, brd, 0, 0,
                       (pgb->fl & CCTL_RAISED? 0x800: 0x400));
      } /* endif */
      // se il testo Š presente
      if (pgb->psz) {
         // cancella background
         rcl.xLeft = frm;
         rcl.yBottom = pgb->wr.cy - pgb->cyFont - 2 * frm - 2;
         rcl.xRight = pgb->wrtxt.cx + 2 * frm + 3;
         rcl.yTop = pgb->wr.cy - frm;
         WinFillRect(hps, &rcl, pgb->lbkgnd);
         // disegna testo
         rcl.yBottom += 2;
         WinDrawText(hps, -1, pgb->psz, &rcl, pgb->lfgnd, pgb->lbkgnd,
                     DT_CENTER | DT_TOP | DT_MNEMONIC | DT_EXTERNALLEADING |
                     ((pgb->fl & WS_DISABLED)? DT_HALFTONE: 0));
         // disegna bordo inferiore e a destra del testo
         rcl.yBottom -= 2;
         GpiSetColor(hps, (pgb->fl & CCTL_RAISED? pgb->lshadow: pgb->lhilite));
         GpiMove(hps, (PPOINTL)&rcl);
         rcl.xLeft = rcl.xRight;
         rcl.yTop -= 1;
         GpiPolyLine(hps, 2, (PPOINTL)&rcl);
      } /* endif */
      WinEndPaint(hps);
   } /* endif */
void XLine::Draw( XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
      POINTL po;
      po.x = p.x;
      po.y = p.y;
      SetupDevice(dev);
      GpiBeginPath(dev->hps, 1);
      GpiMove(dev->hps, &po);
      //POINTL ptl;// = po;

      po.x = p.x + width;
      po.y = p.y + height;
      GpiLine(dev->hps, &po);
      GpiEndPath(dev->hps);
      GpiOutlinePath(dev->hps, 1, 0);
   }
}
示例#29
0
/*----------------------------------------------------------------------*/
VOID DrawLine(WINDOWINFO *pwi,POINTL ptlSt,POINTL ptlE, short mode,POBJECT pObj)
{
   pLines pLin;

   if (pObj && pObj->usClass == CLS_LIN)
      pLin = (pLines)pObj;
   else
      pLin = (pLines)0;

   if ( mode == CREATEMODE)
      GpiSetMix(pwi->hps,FM_INVERT);
   else
   {
      GpiSetMix(pwi->hps,FM_DEFAULT);
      GpiSetColor(pwi->hps,pwi->ulOutLineColor);
      GpiSetLineType(pwi->hps,pwi->lLntype);
   }

  if ( mode != CREATEMODE && pwi->lLnWidth > 1)
  {
     GpiSetPattern(pwi->hps,PATSYM_SOLID);
     GpiSetLineJoin(pwi->hps,pwi->lLnJoin);
     GpiSetLineEnd(pwi->hps,pwi->lLnEnd);
     GpiSetLineWidthGeom (pwi->hps,pwi->lLnWidth);
     GpiBeginPath( pwi->hps, 1L);
  }

  GpiMove(pwi->hps,&ptlSt);
  GpiLine(pwi->hps,&ptlE);

  if ( mode != CREATEMODE && pwi->lLnWidth > 1)
  {
     GpiEndPath(pwi->hps);
     GpiStrokePath (pwi->hps, 1, 0);
  }
  
  if (pLin)
     drwEndPoints(pwi,pLin->bt.arrow,ptlSt,ptlE);
  else
     drwEndPoints(pwi,pwi->arrow,ptlSt,ptlE);
}
void XCircle::Draw( XGraphicDevice * dev)
{
   if (!(settings & GO_HIDE))
   {
//       SHORT modify = ( w> 10 ? 10 : 1);

      SetupDevice(dev);
      POINTL po;
      po.x = p.x;
      po.y = p.y;
      GpiMove(dev->hps, &po);
      ARCPARAMS a;

      a.lQ = w / 10;
      a.lP = h / 10;
      a.lR = x / 10;
      a.lS = y / 10;
      GpiSetArcParams(dev->hps, &a);
      GpiFullArc(dev->hps, (filled == FALSE ? DRO_OUTLINE : DRO_FILL), MAKEFIXED(10, 0));
   }
}