From 0c2f81e02a64791e5e8850979cf2ba7dcb7f2fc6 Mon Sep 17 00:00:00 2001
From: Frederic Culot <calcurse@culot.org>
Date: Fri, 16 Oct 2009 15:52:00 +0000
Subject: Changes in the calendar weekly view.

---
 src/calendar.c | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

(limited to 'src')

diff --git a/src/calendar.c b/src/calendar.c
index 72cc330..811d23c 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,4 +1,4 @@
-/*	$calcurse: calendar.c,v 1.28 2009/10/08 16:28:06 culot Exp $	*/
+/*	$calcurse: calendar.c,v 1.29 2009/10/16 15:52:00 culot Exp $	*/
 
 /*
  * Calcurse - text-based organizer
@@ -529,18 +529,36 @@ draw_weekly_view (window_t *cwin, date_t *current_day, unsigned sunday_first)
       if (day_chk_busy_slices (date, DAYSLICESNO, slices))
         {
           for (i = 0; i < DAYSLICESNO; i++)
-            if (slices[i])
-              {
-                wattron (cwin->p, A_REVERSE);
-                mvwprintw (cwin->p, 5 + i, 3 + 4 * j, " ");                
-                wattroff (cwin->p, A_REVERSE);
-              }
+            {
+              if (j != WEEKINDAYS - 1 && i != DAYSLICESNO - 1)
+                mvwhline (cwin->p, 5 + i, 4 + 4 * j, ACS_S9, 2);
+              if (slices[i])
+                {
+                  int highlight;
+
+                  highlight = (t.tm_mday == slctd_day.dd) ? 1 : 0;
+                  if (highlight)
+                    custom_apply_attr (cwin->p, attr);
+                  wattron (cwin->p, A_REVERSE);
+                  mvwprintw (cwin->p, 5 + i, 2 + 4 * j, " ");
+                  mvwprintw (cwin->p, 5 + i, 3 + 4 * j, " ");
+                  wattroff (cwin->p, A_REVERSE);
+                  if (highlight)
+                    custom_remove_attr (cwin->p, attr);                    
+                }
+            }
         }
       
       /* get next day */
       (void)date_change (&t, 0, 1);
     }
-  
+
+  /* Draw marks to indicate midday on the sides of the calendar. */
+  custom_apply_attr (cwin->p, ATTR_HIGHEST);
+  mvwhline (cwin->p, 4 + DAYSLICESNO / 2, 1, ACS_S9, 1);
+  mvwhline (cwin->p, 4 + DAYSLICESNO / 2, cwin->w - 2, ACS_S9, 1);
+  custom_remove_attr (cwin->p, ATTR_HIGHEST);
+
 #undef DAYSLICESNO  
 }
 
-- 
cgit v1.2.3-70-g09d2