void TCluster::drawBox( const char *icon, char marker)
{
    TDrawBuffer b;
    ushort color;

    ushort cNorm = getColor( 0x0301 );
    ushort cSel = getColor( 0x0402 );
    for( int i = 0; i <= size.y; i++ )
        {
        for( int j = 0; j <= (strings->getCount()-1)/size.y + 1; j++ )
            {
            int cur = j * size.y + i;
            if( cur < strings->getCount() )
                {
                int col = column( cur );
                if( (cur == sel) && (state & sfSelected) != 0 )
                    color = cSel;
                else
                    color = cNorm;
                b.moveChar( col, ' ', color, size.x - col );
                b.moveCStr( col, icon, color );
                if( mark(cur) )
                    b.putChar( col+2, marker );
                b.moveCStr( col+5, (char *)(strings->at(cur)), color );
                if( showMarkers && (state & sfSelected) != 0 && cur == sel )
                    {
                    b.putChar( col, specialChars[0] );
                    b.putChar( column(cur+size.y)-1, specialChars[1] );
                    }
                }
            }
        writeBuf( 0, i, size.x, 1, b );
        }
    setCursor( column(sel)+2, row(sel) );
}
Ejemplo n.º 2
0
short TSystemError::sysErr( short errorCode, uchar drive )
{
    ushort c = ( (TScreen::screenMode & 0x00FF) != TDisplay::smMono  ) ?
                                        sysColorAttr : sysMonoAttr;
    char s[ 63 ];
    TDrawBuffer b;

//  bug-fix TV2B-31 ---------------------------------------
    /* There are 22 documented device errors, all of which have their
     * own strings in errorString[].  However, just in case we run into
     * something weird this will prevent a crash.
     */
//  end of bug-fix. ---------------------------------------
    if( errorCode < (sizeof(errorString) / sizeof(errorString[0])) )
        sprintf( s, errorString[ errorCode ], drive + 'A' );
    else
        sprintf( s, "Unknown critical error %d on drive %c", errorCode, drive + 'A' );

// modification #TV2N-04 ----------------------------------
    // EFW - Modified to be screen size aware.
    b.moveChar( 0, ' ', c, TScreen::screenWidth);
    b.moveCStr( 1, s, c);
    b.moveCStr( TScreen::screenWidth - cstrlen(sRetryOrCancel) - 1,
        sRetryOrCancel, c);
// end of modification ------------------------------------
    swapStatusLine(b);
    int res = selectKey();
    swapStatusLine(b);
    return res;
}
Ejemplo n.º 3
0
void TInterior::draw()       // modified for scroller
{
    ushort color = getColor(0x0301);
    for( int i = 0; i < size.y; i++ )
        // for each line:
    {
        TDrawBuffer b;
        b.moveChar( 0, ' ', color, size.x );
        // fill line buffer with spaces
        int j = delta.y + i;       // delta is scroller offset
        if( j < lineCount && lines[j] != 0 )
        {
            char s[maxLineLength];
            if( delta.x > strlen(lines[j] ) )
                s[0] = EOS;
            else
            {
                strncpy( s, lines[j]+delta.x, size.x );
                s[size.x] = EOS;
            }
            b.moveCStr( 0, s, color );
        }
        writeLine( 0, i, size.x, 1, b);
    }

}
Ejemplo n.º 4
0
void TIndicator::draw()
{
    uchar color, frame;
    TDrawBuffer b;
    char s[15];

    if( (state & sfDragging) == 0 )
        {
        color = getColor(1);
        frame = dragFrame;
        }
    else
        {
        color = getColor(2);
        frame = normalFrame;
        }

    b.moveChar( 0, frame, color, size.x );
    if( modified )
        b.putChar( 0, 15 );
    ostrstream os( s, 15 );

    os << ' ' << (location.y+1)
       << ':' << (location.x+1) << ' ' << ends;

    b.moveCStr( 8-int(strchr(s, ':')-s), s, color);
    writeBuf(0, 0, size.x, 1, b);
}
Ejemplo n.º 5
0
/*
 * Deseneaza textul pe ecran.
 */
void TInterior::draw()
{
	setLimit(maxLineLength, lineCount);
	ushort color = getColor(0x0301);
	for (int i = 0; i < size.y; i++)
	{
		TDrawBuffer b;
		b.moveChar(0, ' ', color, size.x);	// umplu cu spatii

		int j = delta.y + i;

		if (j < lineCount && lines[j] != 0)
		{
			char s[maxLineLength];
			if (delta.x > strlen(lines[j]))
				s[0] = EOS;
			else
			{
				strncpy(s, lines[j] + delta.x, size.x);
				s[size.x] = EOS;
			}

			b.moveCStr(0, s, color);
		}

		writeLine(0, i, size.x, 1, b);
	}
}
Ejemplo n.º 6
0
void TButton::drawTitle( TDrawBuffer &b,
                         int s,
                         int i,
                         ushort cButton,
                         Boolean down
                       )
{
    int l, scOff;
    if( (flags & bfLeftJust) != 0 )
        l = 1;
    else
        {
        l = (s - cstrlen(title) - 1)/2;
        if( l < 1 )
            l = 1;
        }
    b.moveCStr( i+l, title, cButton );

    if( showMarkers == True && !down )
        {
        if( (state & sfSelected) != 0 )
            scOff = 0;
        else if( amDefault )
            scOff = 2;
        else
            scOff = 4;
        b.putChar( 0, specialChars[scOff] );
        b.putChar( s, specialChars[scOff+1] );
        }
}
Ejemplo n.º 7
0
short TSystemError::sysErr( short errorCode, uchar drive )
{
    ushort c = ( (TScreen::screenMode & 0x00fF) != TDisplay::smMono  ) ?
                                        sysColorAttr : sysMonoAttr;
    char s[ 63 ];
    TDrawBuffer b;

    sprintf( s, errorString[ errorCode ], drive + 'a' );

    b.moveChar( 0, ' ', c, 80);
    b.moveCStr( 1, s, c);
    b.moveCStr( 79-cstrlen(sRetryOrCancel), sRetryOrCancel, c);
    swapStatusLine(b);
    int res = selectKey();
    swapStatusLine(b);
    return res;
}
Ejemplo n.º 8
0
void TStatusLine::drawSelect( TStatusItem *selected )
{
    TDrawBuffer b;
    ushort color;
    char hintBuf[256];

    ushort cNormal = getColor(0x0301);
    ushort cSelect = getColor(0x0604);
    ushort cNormDisabled = getColor(0x0202);
    ushort cSelDisabled = getColor(0x0505);
    b.moveChar( 0, ' ', cNormal, size.x );
    TStatusItem *T =  items;
    ushort i = 0;

    while( T != 0 )
        {
        if( T->text != 0 )
            {
            ushort l = cstrlen( T->text );
            if( i + l < size.x )
                {
                if( commandEnabled( T->command) )
                    if( T == selected )
                        color = cSelect;
                    else
                        color = cNormal;
                else
                    if( T == selected )
                        color = cSelDisabled;
                    else
                        color = cNormDisabled;

                b.moveChar( i, ' ', color, 1 );
                b.moveCStr( i+1, T->text, color );
                b.moveChar( i+l+1, ' ', color, 1 );
                }
            i += l+2;
            }
        T = T->next;
        }
    if( i < size.x - 2 )
        {
        strcpy( hintBuf, hint( helpCtx ) );
        if( *hintBuf != EOS )
            {
            b.moveStr( i, hintSeparator, cNormal );
            i += 2;
            if( strlen(hintBuf) + i > size.x )
                hintBuf[size.x-i] = EOS;
            b.moveStr( i, hintBuf, cNormal );
            i += strlen(hintBuf);
            }
        }
    writeLine( 0, 0, size.x, 1, b );
}
Ejemplo n.º 9
0
void TCluster::drawMultiBox(const char *icon, const char *marker) {
   TDrawBuffer b;
   ushort color;
   int i, j, cur;

   ushort cNorm = getColor(0x0301);
   ushort cSel = getColor(0x0402);
   ushort cDis = getColor(0x0505);
   for (i = 0; i <= size.y; i++) {
      b.moveChar(0, ' ', (uchar)cNorm, size.x);
      for (j = 0; j <= (strings->getCount() - 1) / size.y + 1; j++) {
         cur = j * size.y + i;
         if (cur < strings->getCount()) {
            int col = column(cur);

            if (((col + strlen((const char *)strings->at(cur)) + 5) <
                  (sizeof(b) / sizeof(ushort))) && (col < size.x)) {
               if (!buttonState(cur))
                  color = cDis;
               else if ((cur == sel) && (state & sfSelected) != 0)
                  color = cSel;
               else
                  color = cNorm;
               b.moveChar(col, ' ', color, size.x - col);
               b.moveCStr(col, icon, color);

               b.putChar(col + 2, marker[multiMark(cur)]);
               b.moveCStr(col + 5, (char *)(strings->at(cur)), color);
               if (showMarkers && ((state & sfSelected) != 0) && cur == sel) {
                  b.putChar(col, specialChars[0]);
                  b.putChar(column(cur + size.y) - 1, specialChars[1]);
               }

            }
         }
      }
      writeBuf(0, i, size.x, 1, b);
   }
   setCursor(column(sel) + 2, row(sel));
}
Ejemplo n.º 10
0
Boolean drawTree(TOutlineViewer *beingDrawn, TNode *cur, int level,
                 int position, long lines, ushort flags)
{
   ushort  color;
   char s[256];
   char *graph;

   if (position >= beingDrawn->delta.y) {
      if (position >= beingDrawn->delta.y + beingDrawn->size.y)
         return True;

      if ((position == beingDrawn->foc) && ((beingDrawn->state & sfFocused) != 0))
         color = beingDrawn->getColor(0x0202);
      else if (beingDrawn->isSelected(position))
         color = beingDrawn->getColor(0x0303);
      else
         color = beingDrawn->getColor(0x0401);
      dBuf.moveChar(0, ' ', color, beingDrawn->size.x);

      graph = beingDrawn->getGraph(level, lines, flags);
      strcpy(s, graph);
      delete graph;

      if ((flags & ovExpanded) == 0) {
         strcat(s, "~");
         strcat(s, beingDrawn->getText(cur));
         strcat(s, "~");
      } else
         strcat(s, beingDrawn->getText(cur));
      if (beingDrawn->delta.x <= strlen(s))
         dBuf.moveCStr(0, &s[beingDrawn->delta.x], color);
      else
         dBuf.moveCStr(0, "", color);
      beingDrawn->writeLine(0, position - beingDrawn->delta.y,
                            beingDrawn->size.x, 1, dBuf);
      auxPos = position;
   }

   return False;
}
Ejemplo n.º 11
0
void EnhancedStatusLine::draw()
{
    TStatusLine::draw();
    ushort cNormal = getColor(0x0301);
    for (int i=0; i < count; i++)
    {
        TDrawBuffer b;
        if (i != 0)
            b.moveChar(0, '\263', cNormal, 1);
        b.moveCStr(i ? 1 : 0, items[i].text, cNormal);
        writeBuf(items[i].offset - (i ? 1 : 0), 0, (i ? 1 : 0) + strlen(items[i].text), 1, b);
    }
}
Ejemplo n.º 12
0
short TSystemError::sysErr( short errorCode, uchar drive )
{
    ushort c = ( (TScreen::screenMode & 0x00FF) != TDisplay::smMono  ) ?
                                        sysColorAttr : sysMonoAttr;
    char s[ 63 ];
    TDrawBuffer b;

    /* There are 16 documented device errors, all of which have their
     * own strings in errorString[].  However, just in case we run into
     * something weird this will prevent a crash.
     */
    if( errorCode < (sizeof(errorString) / sizeof(errorString[0])) )
        sprintf( s, errorString[ errorCode ], drive + 'A' );
    else
        sprintf( s, "Unknown critical error %d on drive %c", errorCode, drive + 'A' );

    b.moveChar( 0, ' ', c, 80);
    b.moveCStr( 1, s, c);
    b.moveCStr( 79-cstrlen(sRetryOrCancel), sRetryOrCancel, c);
    swapStatusLine(b);
    int res = selectKey();
    swapStatusLine(b);
    return res;
}
Ejemplo n.º 13
0
void TLabel::draw()
{
    ushort color;
    TDrawBuffer b;
    uchar scOff;

    if( light )
        {
        color = getColor(0x0402);
        scOff = 0;
        }
    else
        {
        color = getColor(0x0301);
        scOff = 4;
        }

    b.moveChar( 0, ' ', color, size.x );
    if( text != 0 )
        b.moveCStr( 1, text, color );
    if( showMarkers )
        b.putChar( 0, specialChars[scOff] );
    writeLine( 0, 0, size.x, 1, b );
}