Changeset ad788b5 for util.c


Ignore:
Timestamp:
Jun 3, 2010, 1:48:07 AM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
0e98d87
Parents:
c1fd7e2
Message:
Move the sepbar stuff into a separate file
File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

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