]> Pileus Git - lackey/blobdiff - views/year.c
Bump copyright on files modified in 2013
[lackey] / views / year.c
index 5aecc42b67c11242161d085fc24a48b1d6a4c32b..56bc8436be1a6bffc89564d2b9c150ea888a9016 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (C) 2012 Andy Spencer <andy753421@gmail.com>
- * 
+ * Copyright (C) 2012-2013 Andy Spencer <andy753421@gmail.com>
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -81,6 +81,9 @@ void year_draw(void)
        int y = 0;
        int h[4] = {};
 
+       /* Load cal data */
+       cal_load(YEAR, 0, 0, 366);
+
        /* Determine heights */
        for (int m = 0; m < 12; m++) {
                int weeks = weeks_in_month(YEAR, m);
@@ -89,7 +92,10 @@ void year_draw(void)
        int sum = h[0]+h[1]+h[2]+h[3];
 
        /* Print Header */
+       if (COMPACT) wattron(win, A_REVERSE | A_BOLD);
+       if (COMPACT) mvwhline(win, y, 0, A_REVERSE | A_BOLD, COLS);
        mvwprintw(win, y++, COLS/2-2, "%d", YEAR);
+       if (COMPACT) wattroff(win, A_REVERSE | A_BOLD);
 
        /* Print Months */
        for (int m = 0; m < 12; m++) {
@@ -164,8 +170,10 @@ int year_run(int key, mmask_t btn, int row, int col)
        }
 
        /* Refresh */
-       werase(win);
-       year_draw();
-       wrefresh(win);
-       return 0;
+       if (dir || y != YEAR) {
+               werase(win);
+               year_draw();
+               wrefresh(win);
+       }
+       return dir || y != YEAR;
 }