Exemplo n.º 1
0
Arquivo: color.c Projeto: ryoon/eCos
int assume_default_colors(int f, int b)
{
    PDC_LOG(("assume_default_colors() - called: f %d b %d\n", f, b));

    if (f < -1 || f >= COLORS || b < -1 || b >= COLORS)
        return ERR;

    if (pdc_color_started)
    {
        short fg, bg, oldfg, oldbg;

        fg = f;
        bg = b;

        _normalize(&fg, &bg);

        PDC_pair_content(0, &oldfg, &oldbg);

        if (oldfg != fg || oldbg != bg)
            curscr->_clear = TRUE;

        PDC_init_pair(0, fg, bg);
    }

    return OK;
}
Exemplo n.º 2
0
Arquivo: color.c Projeto: ryoon/eCos
int init_pair(short pair, short fg, short bg)
{
    PDC_LOG(("init_pair() - called: pair %d fg %d bg %d\n", pair, fg, bg));

    if (!pdc_color_started || pair < 1 || pair >= COLOR_PAIRS ||
        fg < first_col || fg >= COLORS || bg < first_col || bg >= COLORS)
        return ERR;

    _normalize(&fg, &bg);

    /* To allow the PDC_PRESERVE_SCREEN option to work, we only reset 
       curscr if this call to init_pair() alters a color pair created by 
       the user. */

    if (pair_set[pair])
    {
        short oldfg, oldbg;

        PDC_pair_content(pair, &oldfg, &oldbg);

        if (oldfg != fg || oldbg != bg)
            curscr->_clear = TRUE;
    }

    PDC_init_pair(pair, fg, bg);

    pair_set[pair] = TRUE;

    return OK;
}
Exemplo n.º 3
0
__QCMP_ENDLINKAGE_C

//------------------------------------------------------------------------------
void PDC_init_atrtab( void )
{
	__QCS_FCONTEXT( "PDC_init_atrtab" );

    int i;
    short fg, bg;

    if( pdc_color_started && !default_colors )
    {
        fg = COLOR_WHITE;
        bg = COLOR_BLACK;
    }
    else
	{
        fg = bg = -1;
	}

    _normalize( &fg, &bg );

    for( i = 0; i < PDC_COLOR_PAIRS; i++ )
	{
        PDC_init_pair( (short)i, fg, bg );
	}
}
Exemplo n.º 4
0
//------------------------------------------------------------------------------
__QOR_INTERFACE( QURSES_QOR ) int assume_default_colors( int f, int b )
{
    __QCS_FCONTEXT( "assume_default_colors" );

    if( f < -1 || f >= COLORS || b < -1 || b >= COLORS )
	{
        return ERR;
	}

    if( pdc_color_started )
    {
        short fg, bg, oldfg, oldbg;

        fg = (short)f;
        bg = (short)b;

        _normalize( &fg, &bg );

        PDC_pair_content( 0, &oldfg, &oldbg );

        if( oldfg != fg || oldbg != bg )
		{
            curscr->_clear = TRUE;
		}

        PDC_init_pair( 0, fg, bg );
    }

    return 0;
}
Exemplo n.º 5
0
//------------------------------------------------------------------------------
__QOR_INTERFACE( QURSES_QOR ) int init_pair( short pair, short fg, short bg )
{
    __QCS_FCONTEXT( "init_pair" );

    if( !pdc_color_started || pair < 1 || pair >= COLOR_PAIRS || fg < first_col || fg >= COLORS || bg < first_col || bg >= COLORS )
	{
        return ERR;
	}

    _normalize( &fg, &bg );

    // To allow the PDC_PRESERVE_SCREEN option to work, we only reset curscr if this call to init_pair() alters a color pair created by the user.

    if( pair_set[ pair ] )
    {
        short oldfg, oldbg;

        PDC_pair_content( pair, &oldfg, &oldbg );

        if( oldfg != fg || oldbg != bg )
		{
            curscr->_clear = TRUE;
		}
    }

    PDC_init_pair( pair, fg, bg );

    pair_set[ pair ] = TRUE;

    return 0;
}
Exemplo n.º 6
0
Arquivo: color.c Projeto: ryoon/eCos
void PDC_init_atrtab(void)
{
    int i;
    short fg, bg;

    if (pdc_color_started && !default_colors)
    {
        fg = COLOR_WHITE;
        bg = COLOR_BLACK;
    }
    else
        fg = bg = -1;

    _normalize(&fg, &bg);

    for (i = 0; i < PDC_COLOR_PAIRS; i++)
        PDC_init_pair(i, fg, bg);
}