/*
* Copyright (C) 2012 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/>.
*/
/* Day init */
void day_init(WINDOW *_win)
{
- win = _win; // lines cols y x
+ win = _win; // lines cols y x
head = derwin(win, 1, COLS, 0, 0);
times = derwin(win, LINES-2-2, 5, 2, 0);
body = derwin(win, LINES-2-2, COLS-6, 2, 6);
/* Day size */
void day_size(int rows, int cols)
{
- wresize(head, 1, cols );
- wresize(times, rows-2, 5);
- wresize(body, rows-2, cols-6);
+ mvderwin(times, 2-COMPACT, 0);
+ mvderwin(body, 2-COMPACT, 6);
+ wresize(head, 1, cols);
+ wresize(times, rows-2-COMPACT, 5);
+ wresize(body, rows-2-COMPACT, cols-6);
}
/* Day draw */
const char *dstr = day_to_string(day_of_week(YEAR, MONTH, DAY));
/* Print Header */
- mvwprintw(head, 0, 0, "%s, %s %d", dstr, mstr, DAY+1);
+ if (COMPACT) wattron(head, A_REVERSE | A_BOLD);
+ mvwprintw(head, 0, 0, "%s, %s %-*d", dstr, mstr, COLS, DAY+1);
mvwprintw(head, 0, COLS-10, "%d-%02d-%02d", YEAR, MONTH, DAY+1);
+ if (COMPACT) wattroff(head, A_REVERSE | A_BOLD);
/* Print times */
mvwprintw(times, 0, 0, "%02d:%02d", ((line/4)-1)%12+1, (line*15)%60);
}
/* Print lines */
- mvwhline(win, 1, 0, ACS_HLINE, COLS);
- mvwvline(win, 2, 5, ACS_VLINE, LINES-4);
+ if (!COMPACT)
+ mvwhline(win, 1, 0, ACS_HLINE, COLS);
+ mvwvline(win, 2-COMPACT, 5, ACS_VLINE, LINES-4+COMPACT+COMPACT);
}
/* Day run */
day_draw();
wrefresh(win);
}
- return 0;
+ return ref;
}