color config for code blocks
[smdp.git] / include / viewer.h
1 #if !defined( VIEWER_H )
2 #define VIEWER_H
3
4 /*
5  * Functions necessary to display a deck of slides in different color modes
6  * using ncurses. Only white, red, and blue are supported, as they can be
7  * faded in 256 color mode.
8  * Copyright (C) 2018 Michael Goehler
9  *
10  * This file is part of mdp.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  *
26  * function: ncurses_display initializes ncurses, defines colors, calculates
27  *           window geometry and handles key strokes
28  * function: add_line detects inline markdown formatting and prints line char
29  *           by char
30  * function: fade_in, fade_out implementing color fading in 256 color mode
31  * function: int_length to calculate decimal length of slide count
32  *
33  */
34
35 #define _GNU_SOURCE              // enable ncurses wchar support
36 #define _XOPEN_SOURCE_EXTENDED 1 // enable ncurses wchar support
37
38 #if defined( WIN32 )
39 #include <curses.h>
40 #else
41 #include <ncurses.h>
42 #endif
43
44 #include "common.h"
45 #include "parser.h"
46 #include "cstack.h"
47 #include "url.h"
48
49 #define CP_FG     1
50 #define CP_HEADER 2
51 #define CP_BOLD   3
52 #define CP_TITLE  4
53 #define CP_CODE   5
54
55 int ncurses_display(deck_t *deck, int reload, int noreload, int slidenum);
56 void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols, int colors);
57 void inline_display(WINDOW *window, const wchar_t *c, const int colors);
58 int int_length (int val);
59 int get_slide_number(char init);
60 void setup_list_strings(void);
61 bool evaluate_binding(const int bindings[], char c);
62
63 #endif // !defined( VIEWER_H )