Changeset 1834


Ignore:
Timestamp:
09/30/07 19:12:21 (6 years ago)
Author:
sam
Message:
  • Display miniatures from all other windows at the bottom of the screen.
Location:
neercs/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/main.c

    r1459 r1834  
    4343    static caca_display_t *dp; 
    4444    static struct screen *screen; 
    45     int pty = 0, prevpty = 0, i, n, w, h, eof = 0, refresh = 1, command = 0; 
     45    int pty = 0, prevpty = 0, i, n, w, h; 
     46    int eof = 0, refresh = 1, command = 0, mini = 1; 
    4647 
    4748    if(argc < 2) 
     
    6465 
    6566    w = w <= XTAB * n ? 1 : w - XTAB * (n - 1) - 2; 
    66     h = h <= YTAB * n ? 1 : h - YTAB * (n - 1) - 2; 
     67    h = h <= YTAB * n ? 1 : h - YTAB * (n - 1) - 2 - 6; 
    6768 
    6869    for(i = 0; i < n; i++) 
     
    175176                    prevpty ^= pty; 
    176177                    pty ^= prevpty; 
     178                    refresh = 1; 
     179                    break; 
     180                case 'm': 
     181                case 0x0d: //CACA_KEY_CTRL_M: 
     182                    mini = !mini; 
    177183                    refresh = 1; 
    178184                    break; 
     
    232238            refresh = 0; 
    233239 
     240            cucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_BLACK); 
     241 
    234242            for(i = 0; i < n; i++) 
    235243            { 
     
    240248                                     w + (n - 1 - j) * XTAB + 1, h + j * YTAB + 1); 
    241249            } 
     250 
     251            if(mini) 
     252            { 
     253                char const * const *fonts; 
     254                cucul_dither_t *d; 
     255                cucul_font_t *f; 
     256                uint8_t *buf; 
     257                int miniw, minih; 
     258 
     259                fonts = cucul_get_font_list(); 
     260                f = cucul_load_font(fonts[0], 0); 
     261 
     262                miniw = cucul_get_canvas_width(screen[0].cv) 
     263                         * cucul_get_font_width(f); 
     264                minih = cucul_get_canvas_height(screen[0].cv) 
     265                         * cucul_get_font_height(f); 
     266                buf = malloc(4 * miniw * minih); 
     267 
     268#if defined(HAVE_ENDIAN_H) 
     269                if(__BYTE_ORDER == __BIG_ENDIAN) 
     270#else 
     271                /* This is compile-time optimised with at least -O1 or -Os */ 
     272                uint32_t const tmp = 0x12345678; 
     273                if(*(uint8_t const *)&tmp == 0x12) 
     274#endif 
     275                    d = cucul_create_dither(32, miniw, minih, 4 * miniw, 
     276                                            0xff0000, 0xff00, 0xff, 0x0); 
     277                else 
     278                    d = cucul_create_dither(32, miniw, minih, 4 * miniw, 
     279                                            0xff00, 0xff0000, 0xff000000, 0x0); 
     280 
     281                for(i = 0; i < n; i++) 
     282                { 
     283                    cucul_render_canvas(screen[i].cv, f, buf, 
     284                                        miniw, minih, miniw * 4); 
     285                    cucul_dither_bitmap(cv, 20 * i, 
     286                              cucul_get_canvas_height(cv) - 6, 19, 6, d, buf); 
     287                    cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE); 
     288                    cucul_printf(cv, 20 * i, 
     289                                 cucul_get_canvas_height(cv) - 6, "(%i)", i); 
     290                } 
     291 
     292                cucul_free_dither(d); 
     293                cucul_free_font(f); 
     294 
     295                free(buf); 
     296            } 
     297 
    242298            caca_refresh_display(dp); 
    243299        } 
  • neercs/trunk/src/term.c

    r1459 r1834  
    4242    { 
    4343        sc->dfg = CUCUL_DEFAULT; 
    44         sc->dbg = CUCUL_TRANSPARENT; 
     44        sc->dbg = CUCUL_DEFAULT; 
    4545 
    4646        cucul_set_color_ansi(sc->cv, sc->dfg, sc->dbg); 
Note: See TracChangeset for help on using the changeset viewer.