Пример #1
0
/*
 * 文字表示下請ルーチン
 */
static void
PutChar(Lvns *lvns, int code, int attr)
{
	int i,j;
	struct TextVram *c;

	c = &lvns->tvram[lvns->current_tvram].row[i = lvns->tvram[lvns->current_tvram].cur_y].column[j = lvns->tvram[lvns->current_tvram].cur_x];
    c->code      = code;
    c->attribute = attr;

    lvns->tvram[lvns->current_tvram].cur_x++;

	if (code) {
		int x = XPOS(j, i);
		int y = YPOS(i);
		LVNS->drawChar(lvns, x, y, code, attr);
		lvns->flushWindowArea(lvns, x, y, CHARDRAWSIZE, CHARDRAWSIZE);
	}

#ifdef USE_MGL
    if (lvns->tvram[lvns->current_tvram].cur_x >= TEXT_WIDTH - 1) {
      lvns->tvram[lvns->current_tvram].cur_x = 0;
      lvns->tvram[lvns->current_tvram].cur_y++;
    }
#endif
}
//----------------------------------------------------------------------------
bool Context::paint(CDC* pDC,
                    CPoint location,
                    long inputCount, 
                    long outputCount,
                    char* param){
//----------------------------------------------------------------------------
   AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

   m_bigFont.SetDC(pDC->m_hDC);
   m_smallFont.SetDC(pDC->m_hDC);
   // BEGIN_TODO
   //
   long xSize  = getSize(inputCount,outputCount).cx;
   long ySize  = getSize(inputCount,outputCount).cy;
   pDC->SetBkMode(TRANSPARENT);
   pDC->SelectObject(&m_smallFont);

   pDC->Rectangle(location.x , location.y, location.x+ xSize, location.y-ySize);

   //  >
   //
   pDC->MoveTo(XPOS( 0), YPOS(35));   
   pDC->LineTo(XPOS(20), YPOS(40));   
   pDC->LineTo(XPOS( 0), YPOS(45));   

   // Q
   //
   pDC->MoveTo(XPOS(80), YPOS(15));   
   pDC->LineTo(XPOS(90), YPOS(15));   
   pDC->LineTo(XPOS(90), YPOS(25));   

   // Qnot
   //
   pDC->MoveTo(XPOS(80), YPOS(75));   
   pDC->LineTo(XPOS(90), YPOS(75));   
   pDC->LineTo(XPOS(90), YPOS(85));   

   pDC->TextOut( location.x+ 18 , YPOS(10)                  , "J" );
   pDC->TextOut( location.x+ 28 , YPOS(40) + (SMALL_FONT/2) , "1C");
   pDC->TextOut( location.x+ 18 , YPOS(55)                  , "K" );
   pDC->TextOut( location.x+ 18 , YPOS(90) +  SMALL_FONT    , "R" );

   
// return true;    // The parent object draw nothing (no ports, .....)
                   // You must handle all the painting here.

   return false;   // the parent object draw additional objects like the ports.
   // END_TODO
}
Пример #3
0
void actlist_verify(actlist_t*a, int32_t y)
{
    segment_t*s = a->list;
    assert(!s || !s->left);
    segment_t*l = 0;
    while(s) {
        if(y) {
            if(l) {
                /* we need to re-evaluate the x of the previous segment. if we
                   try to store it, it might end up being converted to a double,
                   which will make it non-equal to (and possibly larger than) the
                   "long double" the FPU has in its register. This only happens
                   when compiler optimizations are turned on. */
                assert((XPOS(s, y) - XPOS(l, y)) >= 0);
                assert(XDIFF(s,l,y) >= 0);
            }
            l = s;
        }
        assert(!s->left || s->left->right == s);
        assert(!s->right || s->right->left == s);
        s = s->right;
    }
}
Пример #4
0
void CAsciiwDlg::printAscii(CDC &dc1, int radix) {

  CStatic *st = (CStatic*)GetDlgItem(IDC_STATIC);

  int charactersPerLine = CHARSPERLINE(radix);
  TCHAR *form =          (radix == 16) ? _T("%02X") : _T("%3d");

  WINDOWPLACEMENT wp;
  st->GetWindowPlacement(&wp);
  wp.rcNormalPosition.left   = BOXPOSX;
  wp.rcNormalPosition.top    = BOXPOSY;
  wp.rcNormalPosition.right  = BOXPOSX + XPOS(charactersPerLine+1) + 20;
  wp.rcNormalPosition.bottom = BOXPOSY + YPOS(256/(charactersPerLine)+3) + 4;
  st->SetWindowPlacement(&wp);

  int lineCount = 0;
  CClientDC dc(st);
  dc.SelectObject(m_currentFont);
  dc.SetBkColor(RGB(236,233,216));

  printHeader(dc,lineCount++,radix);

  for(int ch = 0; ch < 256;) {
    dc.SelectObject(&m_defaultFont);
    dc.TextOut(POS0(lineCount,-1), format(form, ch).cstr());
    dc.TextOut(POS(lineCount,charactersPerLine), format(form, ch+charactersPerLine-1).cstr());

    dc.SelectObject(m_currentFont);
    for(int j = 0; j < charactersPerLine; j++,ch++) {
      dc.TextOut(POS(lineCount,j),formatCh3(ch).cstr());
    }

    lineCount++;
  }
  printHeader(dc,lineCount++,radix);
}