Ignore:
Timestamp:
Aug 2, 2008, 12:53:55 PM (13 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added window list and window selection by name using ctrl-a-"
File:
1 edited

Legend:

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

    r2627 r2641  
    213213}
    214214
    215 
     215int update_window_list(int c, struct screen_list *screen_list)
     216{
     217    debug("Got %x\n", c);
     218
     219    switch(c)
     220    {
     221    case 0x111:
     222        if(screen_list->cur_in_list>0)
     223            screen_list->cur_in_list--;
     224        break;
     225    case 0x112:
     226        if(screen_list->cur_in_list<screen_list->count-1)
     227            screen_list->cur_in_list++;
     228        break;
     229    case 0xd:
     230        screen_list->window_list = 0;
     231        screen_list->prevpty = screen_list->pty;
     232        screen_list->pty     = screen_list->cur_in_list;
     233        break;
     234    case 0x22:
     235        screen_list->window_list = 0;
     236        break;
     237    default:
     238        break;
     239    }
     240
     241    return 1;
     242}
     243
     244void draw_list(struct screen_list *screen_list)
     245{
     246    int i;
     247    int w = (cucul_get_canvas_width(screen_list->cv));
     248    int h = (cucul_get_canvas_height(screen_list->cv));
     249
     250    debug("Drawing list\n");
     251    cucul_set_color_ansi(screen_list->cv, CUCUL_BLACK, CUCUL_BLACK);
     252    cucul_fill_box(screen_list->cv,
     253                   0, 0,
     254                   w, h, '#');
     255    cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_DEFAULT);
     256    cucul_draw_cp437_box(screen_list->cv,
     257                         0, 0,
     258                         w, h);
     259
     260    cucul_printf(screen_list->cv, 2, 1, "Num \tName");
     261    for(i = 0; i < screen_list->count; i++)
     262    {
     263        char line[1024];
     264        if(screen_list->cur_in_list == i)
     265            cucul_set_color_ansi(screen_list->cv, CUCUL_BLACK, CUCUL_WHITE);
     266        else
     267            cucul_set_color_ansi(screen_list->cv, CUCUL_DEFAULT, CUCUL_DEFAULT);
     268        sprintf(line, "%d \t%s", i+1, screen_list->screen[i]->title);
     269
     270        cucul_printf(screen_list->cv, 2, i+3, line);
     271    }
     272}
    216273
    217274/* Close a window by animating it collapsing */
Note: See TracChangeset for help on using the changeset viewer.