Ejemplo n.º 1
0
Archivo: color.c Proyecto: ryoon/eCos
int start_color(void)
{
    PDC_LOG(("start_color() - called\n"));

    if (SP->mono)
        return ERR;

    pdc_color_started = TRUE;

    PDC_set_blink(FALSE);   /* Also sets COLORS, to 8 or 16 */

    if (!default_colors && SP->orig_attr && getenv("PDC_ORIGINAL_COLORS"))
        default_colors = TRUE;

    PDC_init_atrtab();

    memset(pair_set, 0, PDC_COLOR_PAIRS);

    return OK;
}
Ejemplo n.º 2
0
//------------------------------------------------------------------------------
__QOR_INTERFACE( QURSES_QOR ) int start_color( void )
{
    __QCS_FCONTEXT( "start_color" );

    if( SP->mono )
	{
        return ERR;
	}

    pdc_color_started = TRUE;

    PDC_set_blink( FALSE );   // Also sets COLORS, to 8 or 16

    if( !default_colors && SP->orig_attr && getenv( "PDC_ORIGINAL_COLORS" ) )
	{
        default_colors = TRUE;
	}

    PDC_init_atrtab();

    memset( pair_set, 0, PDC_COLOR_PAIRS );

    return 0;
}
Ejemplo n.º 3
0
WINDOW *Xinitscr(int argc, char *argv[])
{
    int i;

    PDC_LOG(("Xinitscr() - called\n"));

    if (SP && SP->alive)
        return NULL;

    if (PDC_scr_open(argc, argv) == ERR)
    {
        fprintf(stderr, "initscr(): Unable to create SP\n");
        exit(8);
    }

    SP->autocr = TRUE;       /* cr -> lf by default */
    SP->raw_out = FALSE;     /* tty I/O modes */
    SP->raw_inp = FALSE;     /* tty I/O modes */
    SP->cbreak = TRUE;
    SP->save_key_modifiers = FALSE;
    SP->return_key_modifiers = FALSE;
    SP->echo = TRUE;
    SP->visibility = 1;
    SP->resized = FALSE;
    SP->_trap_mbe = 0L;
    SP->_map_mbe_to_key = 0L;
    SP->linesrippedoff = 0;
    SP->linesrippedoffontop = 0;
    SP->delaytenths = 0;
    SP->line_color = -1;

    SP->orig_cursor = PDC_get_cursor_mode();

    LINES = SP->lines;
    COLS = SP->cols;

    if (LINES < 2 || COLS < 2)
    {
        fprintf(stderr, "initscr(): LINES=%d COLS=%d: too small.\n",
                LINES, COLS);
        exit(4);
    }

    if ((curscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *)NULL)
    {
        fprintf(stderr, "initscr(): Unable to create curscr.\n");
        exit(2);
    }

    if ((pdc_lastscr = newwin(LINES, COLS, 0, 0)) == (WINDOW *)NULL)
    {
        fprintf(stderr, "initscr(): Unable to create pdc_lastscr.\n");
        exit(2);
    }

    wattrset(pdc_lastscr, (chtype)(-1));
    werase(pdc_lastscr);

    PDC_slk_initialize();
    LINES -= SP->slklines;

    /* We have to sort out ripped off lines here, and reduce the height
       of stdscr by the number of lines ripped off */

    for (i = 0; i < linesrippedoff; i++)
    {
        if (linesripped[i].line < 0)
            (*linesripped[i].init)(newwin(1, COLS, LINES - 1, 0), COLS);
        else
            (*linesripped[i].init)(newwin(1, COLS,
                                   SP->linesrippedoffontop++, 0), COLS);

        SP->linesrippedoff++;
        LINES--;
    }

    linesrippedoff = 0;

    if (!(stdscr = newwin(LINES, COLS, SP->linesrippedoffontop, 0)))
    {
        fprintf(stderr, "initscr(): Unable to create stdscr.\n");
        exit(1);
    }

    wclrtobot(stdscr);

    /* If preserving the existing screen, don't allow a screen clear */

    if (SP->_preserve)
    {
        untouchwin(curscr);
        untouchwin(stdscr);
        stdscr->_clear = FALSE;
        curscr->_clear = FALSE;
    }
    else
        curscr->_clear = TRUE;

    PDC_init_atrtab();  /* set up default colors */

    MOUSE_X_POS = MOUSE_Y_POS = -1;
    BUTTON_STATUS(1) = BUTTON_RELEASED;
    BUTTON_STATUS(2) = BUTTON_RELEASED;
    BUTTON_STATUS(3) = BUTTON_RELEASED;
    Mouse_status.changes = 0;

    SP->alive = TRUE;

    def_shell_mode();

    sprintf(ttytype, "pdcurses|PDCurses for %s", PDC_sysname());

    return stdscr;
}