Code

Added optional support for a wide_cursor.
authorKalle Wallin <kaw@linux.se>
Wed, 14 Apr 2004 20:27:18 +0000 (20:27 +0000)
committerKalle Wallin <kaw@linux.se>
Wed, 14 Apr 2004 20:27:18 +0000 (20:27 +0000)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@760 09075e82-0dd4-0310-85a5-a0d7c8717e4f

conf.c
list_window.c
options.h

diff --git a/conf.c b/conf.c
index 80f40db35fc44c98a92dfad3693d74459f024637..a8deb89a3b07d14dd3d7b06de4c4162b7e3000e4 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -40,6 +40,7 @@
 #define CONF_COLOR_PROGRESS          "progress_color"
 #define CONF_COLOR_STATUS            "status_color"
 #define CONF_COLOR_ALERT             "alert_color"
+#define CONF_WIDE_CURSOR             "wide_cursor"
 #define CONF_KEY_DEFINITION          "key"
 
 typedef enum {
@@ -292,73 +293,71 @@ read_rc_file(char *filename, options_t *options)
                }
              value[j] = '\0';
              
-             match_found = 0;
+             match_found = 1;
              
              if( !strcasecmp(CONF_KEY_DEFINITION, name) )
                {
                  parse_key_definition(value);
-                 match_found = 1;
                }
              /* enable colors */
              else if( !strcasecmp(CONF_ENABLE_COLORS, name) )
                {
                  options->enable_colors = str2bool(value);
-                 match_found = 1;
                }
              /* auto center */
              else if( !strcasecmp(CONF_AUTO_CENTER, name) )
                {
                  options->auto_center = str2bool(value);
-                 match_found = 1;
                }
              /* background color */
              else if( !strcasecmp(CONF_COLOR_BACKGROUND, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->bg_color = color;
-                 match_found = 1;
                }
              /* color - top (title) window */
              else if( !strcasecmp(CONF_COLOR_TITLE, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->title_color = color;
-                 match_found = 1;
                }
              /* color - line (title) window */
              else if( !strcasecmp(CONF_COLOR_LINE, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->line_color = color;
-                 match_found = 1;
                }
              /* color - list window */
              else if( !strcasecmp(CONF_COLOR_LIST, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->list_color = color;
-                 match_found = 1;
                }
              /* color - progress bar */
              else if( !strcasecmp(CONF_COLOR_PROGRESS, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->progress_color = color;
-                 match_found = 1;
                }
              /* color - status window */
              else if( !strcasecmp(CONF_COLOR_STATUS, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->status_color = color;
-                 match_found = 1;
                }
              /* color - alerts */
              else if( !strcasecmp(CONF_COLOR_ALERT, name) )
                {
                  if( (color=str2color(value)) >= 0 )
                    options->alert_color = color;
-                 match_found = 1;
+               }
+             else if( !strcasecmp(CONF_WIDE_CURSOR, name) )
+               {
+                 options->wide_cursor = str2bool(value);
+               }
+             else
+               {
+                 match_found = 0;
                }
              
 
index c086fca5782ef4807a808888f75b0ce788f39916..5a07f603fd5910551dae1f7cec94aed7cbc9e8ee 100644 (file)
@@ -5,6 +5,7 @@
 #include <ncurses.h>
 
 #include "config.h"
+#include "options.h"
 #include "support.h"
 #include "command.h"
 #include "list_window.h"
@@ -118,6 +119,7 @@ list_window_paint(list_window_t *lw,
                  void *callback_data)
 {
   int i;
+  int fill = options.wide_cursor;
 
   while( lw->selected < lw->start )
     {
@@ -137,7 +139,7 @@ list_window_paint(list_window_t *lw,
 
       label = (callback) (lw->start+i, &highlight, callback_data);
       wmove(lw->w, i, 0);
-      if( lw->clear )
+      if( lw->clear && (!fill || !label) )
        wclrtoeol(lw->w);
       if( label )
        {
@@ -147,6 +149,8 @@ list_window_paint(list_window_t *lw,
            wattron(lw->w, A_REVERSE);
          
          waddnstr(lw->w, label, lw->cols-1);
+         if( fill )
+           mvwhline(lw->w, i, strlen(label), ' ', lw->cols-1);
 
          if( highlight )
            wattroff(lw->w, A_BOLD);
index d3bbc80dc3f27c677e90daa121bbdfa687169ab2..a06eda2ed964824b70f58bf722744bb45caec554 100644 (file)
--- a/options.h
+++ b/options.h
@@ -2,9 +2,6 @@
 #define MPD_HOST_ENV "MPD_HOST"
 #define MPD_PORT_ENV "MPD_PORT"
 
-#define NCMPCRC_ENV  "NCMPCRC"
-
-
 typedef struct 
 {
   char *host;
@@ -24,6 +21,7 @@ typedef struct
   int   progress_color;
   int   status_color;
   int   alert_color;
+  int   wide_cursor;
 
 } options_t;