Changeset 7b4f3be


Ignore:
Timestamp:
May 1, 2011, 5:29:25 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
1753ea0, 3fa0181
Parents:
9efa5bd
git-author:
David Benjamin <davidben@mit.edu> (04/26/11 21:46:58)
git-committer:
David Benjamin <davidben@mit.edu> (05/01/11 17:29:25)
Message:
Punt owl_global_hascolors

There's not much point as we're hardly abstracting ncurses away. Either
call has_colors directly or just don't bother and let another layer take
care of it.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    r9efa5bd r7b4f3be  
    184184}
    185185
    186 static void _owl_fmtext_update_colorpair(short fg, short bg, short *pair)
    187 {
    188   if (owl_global_get_hascolors(&g)) {
    189     *pair = owl_fmtext_get_colorpair(fg, bg);
    190   }
    191 }
    192 
    193186static void _owl_fmtext_wcolor_set(WINDOW *w, short pair)
    194187{
    195   if (owl_global_get_hascolors(&g)) {
     188  if (has_colors()) {
    196189      wcolor_set(w,pair,NULL);
    197190      wbkgdset(w, COLOR_PAIR(pair));
     
    221214  bg = default_bgcolor;
    222215  _owl_fmtext_wattrset(w, attr);
    223   _owl_fmtext_update_colorpair(fg, bg, &pair);
     216  pair = owl_fmtext_get_colorpair(fg, bg);
    224217  _owl_fmtext_wcolor_set(w, pair);
    225218
     
    270263      if (bg == OWL_COLOR_DEFAULT) bg = default_bgcolor;
    271264      _owl_fmtext_wattrset(w, attr);
    272       _owl_fmtext_update_colorpair(fg, bg, &pair);
     265      pair = owl_fmtext_get_colorpair(fg, bg);
    273266      _owl_fmtext_wcolor_set(w, pair);
    274267
     
    662655           continue */
    663656      } else if (!strcasecmp(buff, "@color")
    664                  && owl_global_get_hascolors(&g)
    665657                 && owl_global_is_colorztext(&g)) {
    666658        g_free(buff);
     
    820812    }
    821813  }
    822   if (owl_global_get_hascolors(&g)) {
     814  if (has_colors()) {
    823815    for(i = 0; i < 8; i++) {
    824816      short fg, bg;
     
    835827  owl_colorpair_mgr *cpmgr;
    836828  short pair;
     829
     830  if (!has_colors())
     831    return 0;
    837832
    838833  /* Sanity (Bounds) Check */
  • functions.c

    r9efa5bd r7b4f3be  
    18171817          owl_global_get_cols(&g));
    18181818
    1819   if (owl_global_get_hascolors(&g)) {
     1819  if (has_colors()) {
    18201820    owl_fmtext_append_normal(&fm, "Color: Yes\n");
    18211821    owl_fmtext_appendf_normal(&fm, "Number of color pairs: %i\n", owl_util_get_colorpairs());
     
    22262226    f = fl->data;
    22272227    owl_fmtext_append_normal(&fm, "   ");
    2228     if (owl_global_get_hascolors(&g)) {
    2229       owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f), owl_filter_get_fgcolor(f), owl_filter_get_bgcolor(f));
    2230     } else {
    2231       owl_fmtext_append_normal(&fm, owl_filter_get_name(f));
    2232     }
     2228    owl_fmtext_append_normal_color(&fm, owl_filter_get_name(f),
     2229                                   owl_filter_get_fgcolor(f),
     2230                                   owl_filter_get_bgcolor(f));
    22332231    owl_fmtext_append_normal(&fm, "\n");
    22342232  }
  • global.c

    r9efa5bd r7b4f3be  
    5151  g->direction=OWL_DIRECTION_DOWNWARDS;
    5252  g->zaway=0;
    53   if (has_colors()) {
    54     g->hascolors=1;
    55   }
    5653  owl_fmtext_init_colorpair_mgr(&(g->cpmgr));
    5754  g->debug=OWL_DEBUG;
     
    573570owl_view *owl_global_get_current_view(owl_global *g) {
    574571  return(&(g->current_view));
    575 }
    576 
    577 /* has colors */
    578 
    579 int owl_global_get_hascolors(const owl_global *g) {
    580   if (g->hascolors) return(1);
    581   return(0);
    582572}
    583573
  • owl.h

    r9efa5bd r7b4f3be  
    610610  char *startupargs;
    611611  int nextmsgid;
    612   int hascolors;
    613612  owl_colorpair_mgr cpmgr;
    614613  pid_t newmsgproc_pid;
Note: See TracChangeset for help on using the changeset viewer.