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