summaryrefslogtreecommitdiffstats
path: root/src/calcurse.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/calcurse.h')
-rw-r--r--src/calcurse.h186
1 files changed, 108 insertions, 78 deletions
diff --git a/src/calcurse.h b/src/calcurse.h
index 383f53e..b1b8e75 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -100,22 +100,22 @@
#define DPID_PATH DIR_NAME DPID_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 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 STATUSHEIGHT 2
-#define NOTESIZ 6
+#define STATUSHEIGHT 2
+#define NOTESIZ 6
/* Format for appointment hours is: HH:MM */
#define HRMIN_SIZE 6
/* Maximum number of colors available. */
-#define NBUSERCOLORS 6
+#define NBUSERCOLORS 6
/* Side bar width acceptable boundaries. */
#define SBARMINWIDTH 32
@@ -131,68 +131,68 @@
#define TM_YEAR_BASE 1900
/* Calendar window. */
-#define CALHEIGHT 12
+#define CALHEIGHT 12
/* Key definitions. */
#define CTRLVAL 0x1F
#define CTRL(x) ((x) & CTRLVAL)
-#define ESCAPE 27
-#define TAB 9
+#define ESCAPE 27
+#define TAB 9
#define SPACE 32
-#define KEYS_KEYLEN 3 /* length of each keybinding */
-#define KEYS_LABELEN 8 /* length of command description */
-#define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */
-
-#define ERROR_MSG(...) do { \
- char msg[BUFSIZ]; \
- int len; \
- \
- len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
- (void)snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- fatalbox (msg); \
- else \
- (void)fprintf (stderr, "%s\n", msg); \
+#define KEYS_KEYLEN 3 /* length of each keybinding */
+#define KEYS_LABELEN 8 /* length of command description */
+#define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */
+
+#define ERROR_MSG(...) do { \
+ char msg[BUFSIZ]; \
+ int len; \
+ \
+ len = snprintf (msg, BUFSIZ, "%s: %d: ", __FILE__, __LINE__); \
+ (void)snprintf (msg + len, BUFSIZ - len, __VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ fatalbox (msg); \
+ else \
+ (void)fprintf (stderr, "%s\n", msg); \
} while (0)
-#define WARN_MSG(...) do { \
- char msg[BUFSIZ]; \
- \
- (void)snprintf (msg, BUFSIZ, __VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- warnbox (msg); \
- else \
- (void)fprintf (stderr, "%s\n", msg); \
+#define WARN_MSG(...) do { \
+ char msg[BUFSIZ]; \
+ \
+ (void)snprintf (msg, BUFSIZ, __VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ warnbox (msg); \
+ else \
+ (void)fprintf (stderr, "%s\n", msg); \
} while (0)
-#define EXIT(...) do { \
- ERROR_MSG(__VA_ARGS__); \
- if (ui_mode == UI_CURSES) \
- exit_calcurse (EXIT_FAILURE); \
- else \
- exit (EXIT_FAILURE); \
+#define EXIT(...) do { \
+ ERROR_MSG(__VA_ARGS__); \
+ if (ui_mode == UI_CURSES) \
+ exit_calcurse (EXIT_FAILURE); \
+ else \
+ exit (EXIT_FAILURE); \
} while (0)
-#define EXIT_IF(cond, ...) do { \
- if ((cond)) \
- EXIT(__VA_ARGS__); \
+#define EXIT_IF(cond, ...) do { \
+ if ((cond)) \
+ EXIT(__VA_ARGS__); \
} while (0)
-#define RETURN_IF(cond, ...) do { \
- if ((cond)) \
- { \
- ERROR_MSG(__VA_ARGS__); \
- return; \
- } \
+#define RETURN_IF(cond, ...) do { \
+ if ((cond)) \
+ { \
+ ERROR_MSG(__VA_ARGS__); \
+ return; \
+ } \
} while (0)
-#define RETVAL_IF(cond, val, ...) do { \
- if ((cond)) \
- { \
- ERROR_MSG(__VA_ARGS__); \
- return (val); \
- } \
+#define RETVAL_IF(cond, val, ...) do { \
+ if ((cond)) \
+ { \
+ ERROR_MSG(__VA_ARGS__); \
+ return (val); \
+ } \
} while (0)
#define STRING_BUILD(str) {str, sizeof (str) - 1}
@@ -200,6 +200,15 @@
#define TOSTRING(x) STRINGIFY(x)
#define __FILE_POS__ __FILE__ ":" TOSTRING(__LINE__)
+#define UTF8_MAXLEN 6
+#define UTF8_LENGTH(ch) ((unsigned char)ch >= 0xFC ? 6 : \
+ ((unsigned char)ch >= 0xF8 ? 5 : \
+ ((unsigned char)ch >= 0xF0 ? 4 : \
+ ((unsigned char)ch >= 0xE0 ? 3 : \
+ ((unsigned char)ch >= 0xC0 ? 2 : 1)))))
+#define UTF8_ISCONT(ch) ((unsigned char)ch >= 0x80 && \
+ (unsigned char)ch <= 0xBF)
+
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
@@ -214,7 +223,7 @@ struct conf {
char *editor;
char *pager;
char output_datefmt[BUFSIZ]; /* format for displaying date */
- int input_datefmt; /* format for reading date */
+ int input_datefmt; /* format for reading date */
};
/* Daemon-related configuration. */
@@ -236,16 +245,13 @@ enum datefmt {
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(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"))))
+#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"))))
struct date {
unsigned dd;
@@ -260,8 +266,8 @@ struct apoint
long dur; /* duration of the appointment in seconds */
#define APOINT_NULL 0x0
-#define APOINT_NOTIFY 0x1 /* Item needs to be notified */
-#define APOINT_NOTIFIED 0x2 /* Item was already notified */
+#define APOINT_NOTIFY 0x1 /* Item needs to be notified */
+#define APOINT_NOTIFIED 0x2 /* Item was already notified */
int state;
char *mesg;
@@ -392,6 +398,7 @@ enum key {
KEY_DEL_ITEM,
KEY_EDIT_ITEM,
KEY_VIEW_ITEM,
+ KEY_PIPE_ITEM,
KEY_FLAG_ITEM,
KEY_REPEAT_ITEM,
KEY_EDIT_NOTE,
@@ -452,13 +459,14 @@ struct pad {
/* Notification bar definition. */
struct nbar {
- int show; /* display or hide the notify-bar */
- int cntdwn; /* warn when time left before next app
- becomes lesser than cntdwn */
+ unsigned 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 */
+ char cmd[BUFSIZ]; /* notification command */
+ char *shell; /* user shell to launch notif. cmd */
+ unsigned notify_all; /* notify all appointments */
pthread_mutex_t mutex;
};
@@ -601,7 +609,7 @@ char *calendar_get_pom (time_t);
void custom_init_attr (void);
void custom_apply_attr (WINDOW *, int);
void custom_remove_attr (WINDOW *, int);
-void custom_load_conf (struct conf *, int);
+void custom_load_conf (struct conf *);
void custom_config_bar (void);
void custom_layout_config (void);
void custom_sidebar_config (void);
@@ -628,6 +636,7 @@ struct day_item *day_get_item (int);
int day_item_nb (long, int, int);
void day_edit_note (char *);
void day_view_note (char *);
+void day_pipe_item (struct conf *);
/* dmon.c */
void dmon_start (int);
@@ -650,6 +659,10 @@ void event_paste_item (void);
void help_wins_init (struct scrollwin *, int, int, int, int);
void help_screen (void);
+/* getstring.c */
+enum getstr getstring (WINDOW *, char *, int, int, int);
+int updatestring (WINDOW *, char **, int, int);
+
/* io.c */
unsigned io_fprintln (const char *, const char *, ...);
void io_init (char *, char *);
@@ -735,6 +748,11 @@ void mem_stats (void);
#endif /* CALCURSE_MEMORY_DEBUG */
+/* note.c */
+void edit_note (char **, char *);
+void view_note (char *, char *);
+void erase_note (char **, enum eraseflg);
+
/* notify.c */
int notify_time_left (void);
unsigned notify_needs_reminder (void);
@@ -778,6 +796,8 @@ struct recur_apoint *recur_apoint_scan (FILE *, struct tm, struct tm,
struct recur_event *recur_event_scan (FILE *, struct tm, int, char,
int, struct tm, char *,
llist_t *);
+void recur_apoint_write (struct recur_apoint *, FILE *);
+void recur_event_write (struct recur_event *, FILE *);
void recur_save_data (FILE *);
unsigned recur_item_inday (long, llist_t *, int, int, long, long);
unsigned recur_apoint_inday(struct recur_apoint *, long);
@@ -814,6 +834,7 @@ int todo_hilt_pos (void);
char *todo_saved_mesg (void);
void todo_new_item (void);
struct todo *todo_add (char *, int, char *);
+void todo_write (struct todo *, FILE *);
void todo_flag (void);
void todo_delete (struct conf *);
void todo_chg_priority (int);
@@ -821,9 +842,14 @@ void todo_edit_item (void);
void todo_update_panel (int);
void todo_edit_note (char *);
void todo_view_note (char *);
+void todo_pipe_item (void);
void todo_init_list (void);
void todo_free_list (void);
+/* utf8.c */
+int utf8_width (char *);
+int utf8_strwidth (char *);
+
/* utils.c */
void exit_calcurse (int) __attribute__((__noreturn__));
void free_user_data (void);
@@ -833,8 +859,6 @@ void status_mesg (char *, char *);
void erase_window_part (WINDOW *, int, int, int, int);
WINDOW *popup (int, int, int, int, char *, char *, int);
void print_in_middle (WINDOW *, int, int, int, char *);
-enum getstr getstring (WINDOW *, char *, int, int, int);
-int updatestring (WINDOW *, char **, int, int);
int is_all_digit (char *);
long get_item_time (long);
int get_item_hour (long);
@@ -856,17 +880,21 @@ long mystrtol (const char *);
void print_bool_option_incolor (WINDOW *, unsigned, int, int);
const char *get_tempdir (void);
char *new_tempfile (const char *, int);
-void erase_note (char **, enum eraseflg);
int parse_date (char *, enum datefmt, int *, int *, int *,
struct date *);
void str_toupper (char *);
void file_close (FILE *, const char *);
void psleep (unsigned);
+int fork_exec (int *, int *, const char *, char *const *);
+int shell_exec (int *, int *, char *);
+int child_wait (int *, int *, int);
+void press_any_key (void);
/* vars.c */
extern int col, row;
extern int resize;
extern unsigned colorize;
+extern int foreground, background;
extern enum ui_mode ui_mode;
extern int days[12];
extern char *monthnames[12];
@@ -915,7 +943,9 @@ void wins_update_border (void);
void wins_update_panels (void);
void wins_update (void);
void wins_reset (void);
-void wins_launch_external (const char *, const char *);
+void wins_prepare_external (void);
+void wins_unprepare_external (void);
+void wins_launch_external (char *, char *);
void wins_status_bar (void);
void wins_erase_status_bar (void);
void wins_other_status_page (int);