- Timestamp:
- May 29, 2010, 1:14:57 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- 5f7eadf
- Parents:
- d3814ff
- git-author:
- David Benjamin <davidben@mit.edu> (05/27/10 12:08:01)
- git-committer:
- David Benjamin <davidben@mit.edu> (05/29/10 13:14:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
viewwin.c
r68f63a2 rc447d9c 54 54 if (v->window) { 55 55 owl_window_set_redraw_cb(v->window, 0, 0, 0); 56 owl_window_set_resize_cb(v->window, 0, 0, 0);57 56 } 58 57 v->window = w; 59 58 if (w) { 60 owl_window_get_position(w, &v->winlines, &v->wincols, 0, 0);61 59 owl_window_set_redraw_cb(w, owl_viewwin_redisplay, v, 0); 62 owl_window_set_resize_cb(w, owl_viewwin_resize_hook, v, 0);63 60 } 64 61 } … … 69 66 } 70 67 71 void owl_viewwin_resize_hook(owl_window *w, void *user_data)72 {73 owl_viewwin *v = user_data;74 owl_window_get_position(w, &v->winlines, &v->wincols, 0, 0);75 }76 77 68 /* regenerate text on the curses window. */ 78 69 void owl_viewwin_redisplay(owl_window *w, WINDOW *curswin, void *user_data) … … 80 71 owl_fmtext fm1, fm2; 81 72 owl_viewwin *v = user_data; 73 int winlines, wincols; 74 75 owl_window_get_position(w, &winlines, &wincols, 0, 0); 82 76 83 77 werase(curswin); … … 87 81 owl_fmtext_init_null(&fm2); 88 82 89 owl_fmtext_truncate_lines(&(v->fmtext), v->topline, v->winlines-BOTTOM_OFFSET, &fm1);90 owl_fmtext_truncate_cols(&fm1, v->rightshift, v->wincols-1+v->rightshift, &fm2);83 owl_fmtext_truncate_lines(&(v->fmtext), v->topline, winlines-BOTTOM_OFFSET, &fm1); 84 owl_fmtext_truncate_cols(&fm1, v->rightshift, wincols-1+v->rightshift, &fm2); 91 85 92 86 owl_fmtext_curs_waddstr_without_search(&fm2, curswin); 93 87 94 88 /* print the message at the bottom */ 95 wmove(curswin, v->winlines-1, 0);89 wmove(curswin, winlines-1, 0); 96 90 wattrset(curswin, A_REVERSE); 97 if (v->textlines - v->topline > v->winlines-BOTTOM_OFFSET) {91 if (v->textlines - v->topline > winlines-BOTTOM_OFFSET) { 98 92 waddstr(curswin, "--More-- (Space to see more, 'q' to quit)"); 99 93 } else { … … 108 102 void owl_viewwin_pagedown(owl_viewwin *v) 109 103 { 110 v->topline+=v->winlines - BOTTOM_OFFSET; 111 if ( (v->topline+v->winlines-BOTTOM_OFFSET) > v->textlines) { 112 v->topline = v->textlines - v->winlines + BOTTOM_OFFSET; 104 int winlines; 105 owl_window_get_position(v->window, &winlines, 0, 0, 0); 106 v->topline+=winlines - BOTTOM_OFFSET; 107 if ( (v->topline+winlines-BOTTOM_OFFSET) > v->textlines) { 108 v->topline = v->textlines - winlines + BOTTOM_OFFSET; 113 109 } 114 110 owl_window_dirty(v->window); … … 117 113 void owl_viewwin_linedown(owl_viewwin *v) 118 114 { 115 int winlines; 116 owl_window_get_position(v->window, &winlines, 0, 0, 0); 119 117 v->topline++; 120 if ( (v->topline+ v->winlines-BOTTOM_OFFSET) > v->textlines) {121 v->topline = v->textlines - v->winlines + BOTTOM_OFFSET;118 if ( (v->topline+winlines-BOTTOM_OFFSET) > v->textlines) { 119 v->topline = v->textlines - winlines + BOTTOM_OFFSET; 122 120 } 123 121 owl_window_dirty(v->window); … … 126 124 void owl_viewwin_pageup(owl_viewwin *v) 127 125 { 128 v->topline-=v->winlines; 126 int winlines; 127 owl_window_get_position(v->window, &winlines, 0, 0, 0); 128 v->topline-=winlines; 129 129 if (v->topline<0) v->topline=0; 130 130 owl_window_dirty(v->window); … … 160 160 void owl_viewwin_bottom(owl_viewwin *v) 161 161 { 162 v->topline = v->textlines - v->winlines + BOTTOM_OFFSET; 162 int winlines; 163 owl_window_get_position(v->window, &winlines, 0, 0, 0); 164 v->topline = v->textlines - winlines + BOTTOM_OFFSET; 163 165 owl_window_dirty(v->window); 164 166 }
Note: See TracChangeset
for help on using the changeset viewer.