source: sepbar.c @ 521e600

release-1.10release-1.7release-1.8release-1.9
Last change on this file since 521e600 was 521e600, checked in by David Benjamin <davidben@mit.edu>, 14 years ago
Dirty windows when we init them
  • Property mode set to 100644
File size: 3.1 KB
Line 
1#include "owl.h"
2
3static void sepbar_redraw(owl_window *w, WINDOW *sepwin, void *user_data);
4
5void owl_sepbar_init(owl_window *w)
6{
7  g_signal_connect(w, "redraw", G_CALLBACK(sepbar_redraw), NULL);
8  owl_window_dirty(w);
9}
10
11void sepbar_dirty(void)
12{
13  owl_window_dirty(owl_global_get_curs_sepwin(&g));
14}
15
16static void sepbar_redraw(owl_window *w, WINDOW *sepwin, void *user_data)
17{
18  const owl_messagelist *ml;
19  const owl_view *v;
20  int x, y, i;
21  const char *foo, *appendtosepbar;
22
23  ml=owl_global_get_msglist(&g);
24  v=owl_global_get_current_view(&g);
25
26  werase(sepwin);
27  wattron(sepwin, A_REVERSE);
28  if (owl_global_is_fancylines(&g)) {
29    whline(sepwin, ACS_HLINE, owl_global_get_cols(&g));
30  } else {
31    whline(sepwin, '-', owl_global_get_cols(&g));
32  }
33
34  if (owl_global_is_sepbar_disable(&g)) {
35    getyx(sepwin, y, x);
36    wmove(sepwin, y, owl_global_get_cols(&g)-1);
37    return;
38  }
39
40  wmove(sepwin, 0, 2);
41
42  if (owl_messagelist_get_size(ml) == 0)
43    waddstr(sepwin, " (-/-) ");
44  else
45    wprintw(sepwin, " (%i/%i/%i) ", owl_global_get_curmsg(&g) + 1,
46            owl_view_get_size(v),
47            owl_messagelist_get_size(ml));
48
49  foo=owl_view_get_filtname(v);
50  if (strcmp(foo, owl_global_get_view_home(&g)))
51      wattroff(sepwin, A_REVERSE);
52  wprintw(sepwin, " %s ", owl_view_get_filtname(v));
53  if (strcmp(foo, owl_global_get_view_home(&g)))
54      wattron(sepwin, A_REVERSE);
55
56  if (owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g))) {
57    getyx(sepwin, y, x);
58    wmove(sepwin, y, x+2);
59    wattron(sepwin, A_BOLD);
60    waddstr(sepwin, " <truncated> ");
61    wattroff(sepwin, A_BOLD);
62  }
63
64  i=owl_mainwin_get_last_msg(owl_global_get_mainwin(&g));
65  if ((i != -1) &&
66      (i < owl_view_get_size(v)-1)) {
67    getyx(sepwin, y, x);
68    wmove(sepwin, y, x+2);
69    wattron(sepwin, A_BOLD);
70    waddstr(sepwin, " <more> ");
71    wattroff(sepwin, A_BOLD);
72  }
73
74  if (owl_global_get_rightshift(&g)>0) {
75    getyx(sepwin, y, x);
76    wmove(sepwin, y, x+2);
77    wprintw(sepwin, " right: %i ", owl_global_get_rightshift(&g));
78  }
79
80  if (owl_global_is_zaway(&g) || owl_global_is_aaway(&g)) {
81    getyx(sepwin, y, x);
82    wmove(sepwin, y, x+2);
83    wattron(sepwin, A_BOLD);
84    wattroff(sepwin, A_REVERSE);
85    if (owl_global_is_zaway(&g) && owl_global_is_aaway(&g)) {
86      waddstr(sepwin, " AWAY ");
87    } else if (owl_global_is_zaway(&g)) {
88      waddstr(sepwin, " Z-AWAY ");
89    } else if (owl_global_is_aaway(&g)) {
90      waddstr(sepwin, " A-AWAY ");
91    }
92    wattron(sepwin, A_REVERSE);
93    wattroff(sepwin, A_BOLD);
94  }
95
96  if (owl_global_get_curmsg_vert_offset(&g)) {
97    getyx(sepwin, y, x);
98    wmove(sepwin, y, x+2);
99    wattron(sepwin, A_BOLD);
100    wattroff(sepwin, A_REVERSE);
101    waddstr(sepwin, " SCROLL ");
102    wattron(sepwin, A_REVERSE);
103    wattroff(sepwin, A_BOLD);
104  }
105
106  appendtosepbar = owl_global_get_appendtosepbar(&g);
107  if (appendtosepbar && *appendtosepbar) {
108    getyx(sepwin, y, x);
109    wmove(sepwin, y, x+2);
110    waddstr(sepwin, " ");
111    waddstr(sepwin, owl_global_get_appendtosepbar(&g));
112    waddstr(sepwin, " ");
113  }
114
115  getyx(sepwin, y, x);
116  wmove(sepwin, y, owl_global_get_cols(&g)-1);
117   
118  wattroff(sepwin, A_BOLD);
119  wattroff(sepwin, A_REVERSE);
120}
Note: See TracBrowser for help on using the repository browser.