source: popwin.c @ 03c5bdd

release-1.10release-1.6release-1.7release-1.8release-1.9
Last change on this file since 03c5bdd was 03c5bdd, checked in by David Benjamin <davidben@mit.edu>, 14 years ago
Drop owl_popwin's first_refresh book-keeping b928b3a911f5fc1f205c12ca900557d21f47e7e2 removed all uses of the value.
  • Property mode set to 100644
File size: 2.0 KB
Line 
1#include "owl.h"
2
3int owl_popwin_init(owl_popwin *pw)
4{
5  pw->active=0;
6  pw->lines=0;
7  pw->cols=0;
8  return(0);
9}
10
11int owl_popwin_up(owl_popwin *pw)
12{
13  int glines, gcols, startcol, startline;
14  WINDOW *popwin, *borderwin;
15
16  /* calculate the size of the popwin */
17  glines=owl_global_get_lines(&g);
18  gcols=owl_global_get_cols(&g);
19
20  pw->lines = owl_util_min(glines,24)*3/4 + owl_util_max(glines-24,0)/2;
21  startline = (glines-pw->lines)/2;
22
23  pw->cols = owl_util_min(gcols,90)*15/16 + owl_util_max(gcols-90,0)/2;
24  startcol = (gcols-pw->cols)/2;
25
26  borderwin = newwin(pw->lines, pw->cols, startline, startcol);
27  pw->borderpanel = new_panel(borderwin);
28  popwin = newwin(pw->lines-2, pw->cols-2, startline+1, startcol+1);
29  pw->poppanel = new_panel(popwin);
30 
31  meta(popwin,TRUE);
32  nodelay(popwin, 1);
33  keypad(popwin, TRUE);
34
35  werase(popwin);
36  werase(borderwin);
37  if (owl_global_is_fancylines(&g)) {
38    box(borderwin, 0, 0);
39  } else {
40    box(borderwin, '|', '-');
41    wmove(borderwin, 0, 0);
42    waddch(borderwin, '+');
43    wmove(borderwin, pw->lines-1, 0);
44    waddch(borderwin, '+');
45    wmove(borderwin, pw->lines-1, pw->cols-1);
46    waddch(borderwin, '+');
47    wmove(borderwin, 0, pw->cols-1);
48    waddch(borderwin, '+');
49  }
50   
51  update_panels();
52  owl_global_set_needrefresh(&g);
53  pw->active=1;
54  return(0);
55}
56
57int owl_popwin_close(owl_popwin *pw)
58{
59  WINDOW *popwin, *borderwin;
60
61  popwin = panel_window(pw->poppanel);
62  borderwin = panel_window(pw->borderpanel);
63
64  del_panel(pw->poppanel);
65  del_panel(pw->borderpanel);
66  delwin(popwin);
67  delwin(borderwin);
68
69  pw->active=0;
70  owl_global_set_needrefresh(&g);
71  owl_mainwin_redisplay(owl_global_get_mainwin(&g));
72  owl_function_full_redisplay();
73  return(0);
74}
75
76int owl_popwin_is_active(const owl_popwin *pw)
77{
78  if (pw->active==1) return(1);
79  return(0);
80}
81
82WINDOW *owl_popwin_get_curswin(const owl_popwin *pw)
83{
84  return panel_window(pw->poppanel);
85}
86
87int owl_popwin_get_lines(const owl_popwin *pw)
88{
89  return(pw->lines-2);
90}
91
92int owl_popwin_get_cols(const owl_popwin *pw)
93{
94  return(pw->cols-2);
95}
Note: See TracBrowser for help on using the repository browser.