Changeset 8ae2de9


Ignore:
Timestamp:
Mar 2, 2010, 9:14:44 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.6, release-1.7, release-1.8, release-1.9
Children:
b928b3a
Parents:
be1ae91
git-author:
David Benjamin <davidben@mit.edu> (10/30/09 14:31:56)
git-committer:
David Benjamin <davidben@mit.edu> (03/02/10 21:14:44)
Message:
Attach PANELs to all of our WINDOWs

We replace wnoutrefresh with update_panels (except in set cursor; there
we have to guarantee that the window is empty.). The viewwin does not
get a PANEL because it's weird and currently leeches onto someone else's
WINDOW.

Resizing is also rather fiddly because panel wants to know about window
resizes. Not completely sure I got it right yet. The only library I know
of that does something like with with ncurses (libgnt) and they
endwin/refresh to resize the screen.

Signed-off-by: David Benjamin <davidben@mit.edu>
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r1a0874f r8ae2de9  
    26622662  owl_editwin_fullclear(e);
    26632663  owl_global_set_needrefresh(&g);
    2664   wnoutrefresh(owl_editwin_get_curswin(e));
     2664  update_panels();
    26652665  owl_global_set_typwin_inactive(&g);
    26662666  owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
     
    27302730  owl_free(cmd);
    27312731
    2732   wnoutrefresh(owl_editwin_get_curswin(e));
     2732  update_panels();
    27332733  owl_global_set_needrefresh(&g);
    27342734
     
    27472747  owl_global_pop_context(&g);
    27482748  owl_editwin_fullclear(e);
    2749   wnoutrefresh(owl_editwin_get_curswin(e));
     2749  update_panels();
    27502750  owl_global_set_needrefresh(&g);
    27512751}
     
    27652765  owl_global_pop_context(&g);
    27662766  owl_global_set_needrefresh(&g);
    2767   wnoutrefresh(owl_editwin_get_curswin(e));
     2767  update_panels();
    27682768}
    27692769
  • editwin.c

    rd41f773 r8ae2de9  
    567567  e->cursorx = x;
    568568
    569   wnoutrefresh(e->curswin);
     569  update_panels();
    570570  if (update == 1)
    571571    doupdate();
  • functions.c

    r91634ec r8ae2de9  
    218218    owl_popwin_refresh(owl_global_get_popwin(&g));
    219219  }
    220   wnoutrefresh(owl_global_get_curs_recwin(&g));
     220  update_panels();
    221221  owl_global_set_needrefresh(&g);
    222222}
     
    12521252void owl_function_set_cursor(WINDOW *win)
    12531253{
     1254  /* Be careful that this window is actually empty, otherwise panels get confused */
    12541255  wnoutrefresh(win);
    12551256}
     
    12651266      redrawwin(owl_global_get_curs_msgwin(&g));
    12661267
    1267   wnoutrefresh(owl_global_get_curs_recwin(&g));
    1268   wnoutrefresh(owl_global_get_curs_sepwin(&g));
    1269   wnoutrefresh(owl_global_get_curs_typwin(&g));
    1270   wnoutrefresh(owl_global_get_curs_msgwin(&g));
     1268  update_panels();
    12711269
    12721270  if (owl_popwin_is_active(owl_global_get_popwin(&g))) {
     
    34043402  owl_function_debugmsg("makemsg: %s", buff);
    34053403  waddstr(owl_global_get_curs_msgwin(&g), buff); 
    3406   wnoutrefresh(owl_global_get_curs_msgwin(&g));
     3404  update_panels();
    34073405  owl_global_set_needrefresh(&g);
    34083406  va_end(ap);
  • global.c

    r516c27e r8ae2de9  
    126126}
    127127
     128/* If *pan does not exist, we create a new panel, otherwise we replace the
     129   window in *pan with win.
     130
     131   libpanel PANEL objects cannot exist without owner a valid window. This
     132   maintains the invariant for _owl_global_setup_windows. */
     133void _owl_panel_set_window(PANEL **pan, WINDOW *win)
     134{
     135  WINDOW *oldwin;
     136  if (*pan) {
     137    oldwin = panel_window(*pan);
     138    replace_panel(*pan, win);
     139    delwin(oldwin);
     140  } else {
     141    *pan = new_panel(win);
     142  }
     143}
     144
    128145void _owl_global_setup_windows(owl_global *g) {
    129146  int cols, typwin_lines;
     
    142159
    143160  /* create the new windows */
    144   g->recwin=newwin(g->recwinlines, cols, 0, 0);
     161  g->recwin = newwin(g->recwinlines, cols, 0, 0);
    145162  if (g->recwin==NULL) {
    146163    owl_function_debugmsg("_owl_global_setup_windows: newwin returned NULL\n");
     
    148165    exit(50);
    149166  }
     167  _owl_panel_set_window(&g->recpan, g->recwin);
    150168     
    151   g->sepwin=newwin(1, cols, g->recwinlines, 0);
    152   g->msgwin=newwin(1, cols, g->recwinlines+1, 0);
    153   g->typwin=newwin(typwin_lines, cols, g->recwinlines+2, 0);
     169  g->sepwin = newwin(1, cols, g->recwinlines, 0);
     170  _owl_panel_set_window(&g->seppan, g->sepwin);
     171  g->msgwin = newwin(1, cols, g->recwinlines+1, 0);
     172  _owl_panel_set_window(&g->msgpan, g->msgwin);
     173  g->typwin = newwin(typwin_lines, cols, g->recwinlines+2, 0);
     174  _owl_panel_set_window(&g->typpan, g->typwin);
    154175
    155176  owl_editwin_set_curswin(g->tw, g->typwin, typwin_lines, g->cols);
     
    469490  if (!g->resizepending) return;
    470491
    471   /* delete the current windows */
    472   delwin(g->recwin);
    473   delwin(g->sepwin);
    474   delwin(g->msgwin);
    475   delwin(g->typwin);
    476492  if (!isendwin()) {
    477493    endwin();
    478494  }
    479 
    480   refresh();
    481495
    482496  /* get the new size */
  • mainwin.c

    r129e609 r8ae2de9  
    4343    mw->curtruncated=0;
    4444    mw->lastdisplayed=-1;
    45     wnoutrefresh(recwin);
     45    update_panels();
    4646    owl_global_set_needrefresh(&g);
    4747    return;
     
    141141  mw->lastdisplayed=i-1;
    142142
    143   wnoutrefresh(recwin);
     143  update_panels();
    144144  owl_global_set_needrefresh(&g);
    145145}
  • owl.c

    r91634ec r8ae2de9  
    599599  owl_function_source(NULL);
    600600
    601   wrefresh(sepwin);
     601  update_panels();
    602602
    603603  /* Set the default style */
     
    655655    /* update the terminal if we need to */
    656656    if (owl_global_is_needrefresh(&g)) {
     657      /* ensure that panels are clean, so that set_cursor doesn't break things */
     658      update_panels();
    657659      /* leave the cursor in the appropriate window */
    658660      if (owl_global_is_typwin_active(&g)) {
  • owl.h

    rbe1ae91 r8ae2de9  
    394394typedef struct _owl_popwin {
    395395  WINDOW *borderwin;
     396  PANEL *borderpanel;
    396397  WINDOW *popwin;
     398  PANEL *poppanel;
    397399  int lines;
    398400  int cols;
     
    556558  owl_messagelist msglist;
    557559  WINDOW *recwin, *sepwin, *msgwin, *typwin;
     560  PANEL *recpan, *seppan, *msgpan, *typpan;
    558561  int needrefresh;
    559562  int rightshift;
  • popwin.c

    r8240bce r8ae2de9  
    2525
    2626  pw->borderwin=newwin(pw->lines, pw->cols, startline, startcol);
     27  pw->borderpanel = new_panel(pw->borderwin);
    2728  pw->popwin=newwin(pw->lines-2, pw->cols-2, startline+1, startcol+1);
     29  pw->poppanel = new_panel(pw->popwin);
    2830  pw->needsfirstrefresh=1;
    2931 
     
    4850  }
    4951   
    50   wnoutrefresh(pw->popwin);
    51   wnoutrefresh(pw->borderwin);
     52  update_panels();
    5253  owl_global_set_needrefresh(&g);
    5354  pw->active=1;
     
    5758int owl_popwin_close(owl_popwin *pw)
    5859{
     60  del_panel(pw->poppanel);
     61  del_panel(pw->borderpanel);
    5962  delwin(pw->popwin);
    6063  delwin(pw->borderwin);
     
    7578int owl_popwin_refresh(const owl_popwin *pw)
    7679{
    77   touchwin(pw->borderwin);
    78   touchwin(pw->popwin);
    79 
    80   wnoutrefresh(pw->borderwin);
    81   wnoutrefresh(pw->popwin);
     80  update_panels();
    8281  owl_global_set_needrefresh(&g);
    8382  return(0);
  • util.c

    ra61daae r8ae2de9  
    120120  wattroff(sepwin, A_BOLD);
    121121  wattroff(sepwin, A_REVERSE);
    122   wnoutrefresh(sepwin);
     122  update_panels();
    123123}
    124124
  • viewwin.c

    r3e55268 r8ae2de9  
    8989  }
    9090  wattroff(v->curswin, A_REVERSE);
    91   wnoutrefresh(v->curswin);
     91  update_panels();
    9292
    9393  if (update==1) {
Note: See TracChangeset for help on using the changeset viewer.