1 /* $Id: tbclock.h,v 1.6 2007/02/28 12:47:35 tamentis Exp $
2  *
3  * Copyright (c) 2007 Bertrand Janin <tamentis@neopulsar.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  */
28 
29 
30 /* some text constants */
31 #define TBCVER		"tbclock 1.10"
32 #define TBCCOPY TBCVER	" - Tamentis Binary Clock (c) 2007 Bertrand Janin\n"
33 #define ERR_TSIZE	"The minimal terminal size for this module is %hhux%hhu."
34 #define MSG_UNKNOWNMOD	"I don't know this module (man tbclock).\n"
35 #define USAGE_FMT	"usage: %s [-abdefpvh] [-HMST color] [-m module]\n"
36 
37 
38 /* color definitions */
39 #define BLOCK_DEFAULT	0
40 #define BLOCK_RED	1
41 #define BLOCK_GREEN	2
42 #define BLOCK_BLUE	3
43 #define BLOCK_YELLOW	4
44 #define TEXT_DEFAULT	0
45 #define TEXT_RED	10
46 #define TEXT_GREEN	11
47 #define TEXT_BLACK	12
48 #define BACK_DEFAULT	0
49 #define BACK_YELLOW	20
50 #define BLOCK_HOUR	30
51 #define BLOCK_MINUTE	31
52 #define BLOCK_SECOND	32
53 #define BLOCK_TENTH	33
54 
55 /* keyboard definitions */
56 #define KB_SPACE	0x20
57 #define KB_BACKSPACE	0x7F
58 #define KB_RETURN	0x0A
59 #define KB_CLEAR	0x15
60 #define KB_LEFT		0x44
61 #define KB_RIGHT	0x43
62 #define KB_A		0x61
63 #define KB_H		0x68
64 #define KB_R		0x72
65 
66 struct tbclock_format {
67 	int top_margin;
68 	int left_margin;
69 	int dot_w;
70 	int dot_h;
71 	int res_x;
72 	int res_y;
73 	int height;
74 	int width;
75 };
76 
77 struct tbclock_options {
78 	int frame_default;
79 	int border_default;
80 	int frame;
81 	int border;
82 	int dots;
83 	int vertical;
84 	int helper;
85 	int ampm;
86 };
87 
88 struct tbclock_colors {
89 	int hour;
90 	int minute;
91 	int second;
92 	int tenth;
93 };
94 
95 /* main and only data type */
96 struct tbclock_data {
97 	time_t bigbang;
98 	struct tbclock_format format;
99 	struct tbclock_options options;
100 	struct tbclock_colors colors;
101 };
102 
103 /* prototypes for main.c */
104 void tbc_configure(void);
105 void tbc_next_help_value();
106 
107 /* prototypes for draw.c */
108 void tbc_display_init(void);
109 void tbc_clear(void);
110 void tbc_draw_time(int, int, int, int, int);
111 
112 /* prototypes for mod_*.c */
113 void mod_guessbin();
114 void mod_clock();
115 void mod_chrono();
116 
117