1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/* $calcurse: vars.h,v 1.32 2009/06/21 18:16:23 culot Exp $ */
/*
* Calcurse - text-based organizer
* Copyright (c) 2004-2009 Frederic Culot
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Send your feedback or comments to : calcurse@culot.org
* Calcurse home page : http://culot.org/calcurse
*
*/
#ifndef CALCURSE_VARS_H
#define CALCURSE_VARS_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#elif defined HAVE_NCURSES_NCURSES_H
#include <ncurses/ncurses.h>
#elif defined HAVE_NCURSESW_NCURSES_H
#include <ncursesw/ncurses.h>
#else
#error "Missing ncurses header. Aborting..."
#endif
#include <pthread.h>
#include <stdbool.h>
#define DIR_NAME ".calcurse/"
#define TODO_PATH_NAME "todo"
#define APTS_PATH_NAME "apts"
#define CONF_PATH_NAME "conf"
#define KEYS_PATH_NAME "keys"
#define LOCK_PATH_NAME ".calcurse.lock"
#define NOTES_DIR_NAME "notes/"
#define TODO_PATH DIR_NAME TODO_PATH_NAME
#define APTS_PATH DIR_NAME APTS_PATH_NAME
#define CONF_PATH DIR_NAME CONF_PATH_NAME
#define KEYS_PATH DIR_NAME KEYS_PATH_NAME
#define LOCK_PATH DIR_NAME LOCK_PATH_NAME
#define NOTES_DIR DIR_NAME NOTES_DIR_NAME
#define ATTR_FALSE 0
#define ATTR_TRUE 1
#define ATTR_LOWEST 2
#define ATTR_LOW 3
#define ATTR_MIDDLE 4
#define ATTR_HIGH 5
#define ATTR_HIGHEST 6
#define DAYINSEC 86400
#define HOURINSEC 3600
#define MININSEC 60
#define WEEKINDAYS 7
#define STATUSHEIGHT 2
#define NOTESIZ 6
enum {
DATEFMT_MMDDYYYY = 1,
DATEFMT_DDMMYYYY,
DATEFMT_YYYYMMDD,
DATEFMT_ISO,
DATE_FORMATS
};
#define DATEFMT(datefmt) (datefmt == DATEFMT_MMDDYYYY ? "%m/%d/%Y" : \
(datefmt == DATEFMT_DDMMYYYY ? "%d/%m/%Y" : \
(datefmt == DATEFMT_YYYYMMDD ? "%Y/%m/%d" : "%Y-%m-%d")))
#define DATEFMT_DESC(datefmt) (datefmt == DATEFMT_MMDDYYYY ? \
_("mm/dd/yyyy") : \
(datefmt == DATEFMT_DDMMYYYY ? \
_("dd/mm/yyyy") : \
(datefmt == DATEFMT_YYYYMMDD ? \
_("yyyy/mm/dd") : _("yyyy-mm-dd"))))
typedef enum {
UI_CURSES,
UI_CMDLINE,
UI_MODES
} ui_mode_e;
struct pad_s
{
int width;
int length;
int first_onscreen; /* first line to be displayed inside window */
WINDOW *ptrwin; /* pointer to the pad window */
};
struct nbar_s
{
int show; /* display or hide the notify-bar */
int cntdwn; /* warn when time left before next app
* becomes lesser than cntdwn */
char datefmt[BUFSIZ]; /* format for displaying date */
char timefmt[BUFSIZ]; /* format for displaying time */
char cmd[BUFSIZ]; /* notification command */
char *shell; /* user shell to launch notif. cmd */
pthread_mutex_t mutex;
};
/* General configuration variables */
typedef struct
{
bool auto_save;
unsigned periodic_save;
bool confirm_quit;
bool confirm_delete;
bool skip_system_dialogs;
bool skip_progress_bar;
char *editor;
char *pager;
char output_datefmt[BUFSIZ]; /* format for displaying date */
int input_datefmt; /* format for reading date */
}
conf_t;
extern int col, row;
extern bool colorize;
extern ui_mode_e ui_mode;
extern int days[12];
extern char *monthnames[12];
extern char *daynames[8];
extern char path_dir[BUFSIZ];
extern char path_todo[BUFSIZ];
extern char path_apts[BUFSIZ];
extern char path_conf[BUFSIZ];
extern char path_keys[BUFSIZ];
extern char path_notes[BUFSIZ];
extern char path_lock[BUFSIZ];
extern struct pad_s apad;
extern struct nbar_s nbar;
void vars_init (conf_t *);
#endif /* CALCURSE_VARS_H */
|