diff options
Diffstat (limited to 'src/calcurse.h')
-rw-r--r-- | src/calcurse.h | 178 |
1 files changed, 101 insertions, 77 deletions
diff --git a/src/calcurse.h b/src/calcurse.h index 2992db8..093b9af 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -53,6 +53,7 @@ #include <time.h> #include <stdlib.h> #include <stdio.h> +#include <regex.h> #include "llist.h" #include "htable.h" @@ -143,8 +144,10 @@ #define DAYINSEC (DAYINMIN * MININSEC) #define HOURINSEC (HOURINMIN * MININSEC) +#define MAXDAYSPERMONTH 31 + /* Calendar window. */ -#define CALHEIGHT 12 +#define CALHEIGHT 8 /* Key definitions. */ #define CTRLVAL 0x1F @@ -157,6 +160,9 @@ #define KEYS_LABELEN 8 /* length of command description */ #define KEYS_CMDS_PER_LINE 6 /* max number of commands per line */ +/* Register definitions. */ +#define REG_BLACK_HOLE 37 + /* Size of the hash table the note garbage collector uses. */ #define NOTE_GC_HSIZE 1024 @@ -227,6 +233,15 @@ #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y)) +enum win { + CAL, + APP, + TOD, + NOT, + STA, + NBWINS +}; + /* General configuration variables. */ struct conf { unsigned auto_save; @@ -234,6 +249,8 @@ struct conf { unsigned periodic_save; unsigned confirm_quit; unsigned confirm_delete; + enum win default_panel; + unsigned compact_panels; unsigned system_dialogs; unsigned progress_bar; const char *editor; @@ -308,18 +325,6 @@ struct day_items_nb { unsigned nb_apoints; }; -/* Generic item description (to hold appointments, events...). */ -struct day_item { - long start; /* seconds since 1 jan 1970 */ - long appt_dur; /* appointment duration in seconds */ - int type; /* (recursive or normal) event or appointment */ - int evnt_id; /* event identifier */ - int appt_pos; /* real position in recurrent list */ - char state; /* appointment state */ - char *mesg; /* item description */ - char *note; /* note attached to item */ -}; - struct excp { long st; /* beggining of the considered day, in seconds */ }; @@ -361,6 +366,21 @@ struct recur_event { char *note; /* note attached to event */ }; +/* Generic pointer data type for appointments and events. */ +union aptev_ptr { + struct apoint *apt; + struct event *ev; + struct recur_apoint *rapt; + struct recur_event *rev; +}; + +/* Generic item description (to hold appointments, events...). */ +struct day_item { + int type; /* (recursive or normal) event or appointment */ + long start; /* start time of the repetition occurrence */ + union aptev_ptr item; /* pointer to the actual item */ +}; + /* Available view for the calendar panel. */ enum { CAL_MONTH_VIEW, @@ -389,7 +409,7 @@ enum key { KEY_GENERIC_HELP, KEY_GENERIC_QUIT, KEY_GENERIC_SAVE, - KEY_GENERIC_CUT, + KEY_GENERIC_COPY, KEY_GENERIC_PASTE, KEY_GENERIC_CHANGE_VIEW, KEY_GENERIC_IMPORT, @@ -440,15 +460,6 @@ struct binding { enum key action; }; -enum win { - CAL, - APP, - TOD, - NOT, - STA, - NBWINS -}; - #define FLAG_CAL (1 << CAL) #define FLAG_APP (1 << APP) #define FLAG_TOD (1 << TOD) @@ -526,14 +537,6 @@ enum item_type { MAX_TYPES = APPT }; -/* Flags used to adapt processing when erasing an item. */ -enum eraseflg { - ERASE_DONT_FORCE, - ERASE_FORCE, - ERASE_FORCE_ONLY_NOTE, - ERASE_CUT -}; - /* Return codes for the getstring() function. */ enum getstr { GETSTRING_VALID, @@ -602,6 +605,8 @@ enum save_display { /* apoint.c */ extern llist_ts_t alist_p; void apoint_free_bkp(void); +struct apoint *apoint_dup(struct apoint *); +void apoint_free(struct apoint *); void apoint_llist_init(void); void apoint_llist_free(void); void apoint_hilt_set(int); @@ -609,22 +614,17 @@ void apoint_hilt_decrease(int); void apoint_hilt_increase(int); int apoint_hilt(void); struct apoint *apoint_new(char *, char *, long, long, char); -void apoint_add(void); -void apoint_delete(unsigned *, unsigned *); -int apoint_cut(unsigned *, unsigned *); -void apoint_paste(unsigned *, unsigned *, int); -unsigned apoint_inday(struct apoint *, long); +unsigned apoint_inday(struct apoint *, long *); void apoint_sec2str(struct apoint *, long, char *, char *); void apoint_write(struct apoint *, FILE *); struct apoint *apoint_scan(FILE *, struct tm, struct tm, char, char *); -struct apoint *apoint_get(long, int); -void apoint_delete_bynum(long, unsigned, enum eraseflg); +void apoint_delete(struct apoint *); void apoint_scroll_pad_down(int, int); void apoint_scroll_pad_up(int); struct notify_app *apoint_check_next(struct notify_app *, long); -void apoint_switch_notify(void); +void apoint_switch_notify(struct apoint *); void apoint_update_panel(int); -void apoint_paste_item(void); +void apoint_paste_item(struct apoint *, long); /* args.c */ int parse_args(int, char **); @@ -644,6 +644,7 @@ void calendar_store_current_date(struct date *); void calendar_init_slctd_day(void); struct date *calendar_get_slctd_day(void); long calendar_get_slctd_day_sec(void); +void calendar_monthly_view_cache_set_invalid(void); void calendar_update_panel(struct window *); void calendar_goto_today(void); void calendar_change_day(int); @@ -674,21 +675,28 @@ void custom_config_main(void); /* day.c */ void day_free_list(void); +char *day_item_get_mesg(struct day_item *); +char *day_item_get_note(struct day_item *); +void day_item_erase_note(struct day_item *); +long day_item_get_duration(struct day_item *); +int day_item_get_state(struct day_item *); +void day_item_add_exc(struct day_item *, long); +void day_item_fork(struct day_item *, struct day_item *); +int day_store_items(long, unsigned *, unsigned *, regex_t *); struct day_items_nb *day_process_storage(struct date *, unsigned, struct day_items_nb *); void day_write_pad(long, int, int, int); -void day_popup_item(void); +void day_write_stdout(long, const char *, const char *, const char *, + const char *); +void day_popup_item(struct day_item *); int day_check_if_item(struct date); unsigned day_chk_busy_slices(struct date, int, int *); -void day_edit_item(void); -int day_erase_item(long, int, enum eraseflg); -int day_cut_item(long, int); -int day_paste_item(long, int); +struct day_item *day_cut_item(long, int); +int day_paste_item(struct day_item *, long); struct day_item *day_get_item(int); -int day_item_nb(long, int, int); -void day_edit_note(const char *); -void day_view_note(const char *); -void day_pipe_item(void); +void day_edit_note(struct day_item *, const char *); +void day_view_note(struct day_item *, const char *); +void day_item_switch_notify(struct day_item *); /* dmon.c */ void dmon_start(int); @@ -697,15 +705,16 @@ void dmon_stop(void); /* event.c */ extern llist_t eventlist; void event_free_bkp(void); +struct event *event_dup(struct event *); +void event_free(struct event *); void event_llist_init(void); void event_llist_free(void); struct event *event_new(char *, char *, long, int); -unsigned event_inday(struct event *, long); +unsigned event_inday(struct event *, long *); void event_write(struct event *, FILE *); struct event *event_scan(FILE *, struct tm, int, char *); -struct event *event_get(long, int); -void event_delete_bynum(long, unsigned, enum eraseflg); -void event_paste_item(void); +void event_delete(struct event *); +void event_paste_item(struct event *, long); /* help.c */ void help_wins_init(struct scrollwin *, int, int, int, int); @@ -720,6 +729,20 @@ void ical_import_data(FILE *, FILE *, unsigned *, unsigned *, unsigned *, unsigned *, unsigned *); void ical_export_data(FILE *); +/* interaction.c */ +void interact_day_item_add(void); +void interact_day_item_delete(unsigned *, unsigned *, unsigned); +void interact_day_item_edit(void); +void interact_day_item_pipe(void); +void interact_day_item_repeat(void); +void interact_day_item_cut_free(unsigned); +void interact_day_item_copy(unsigned *, unsigned *, unsigned); +void interact_day_item_paste(unsigned *, unsigned *, unsigned); +void interact_todo_add(void); +void interact_todo_delete(void); +void interact_todo_edit(void); +void interact_todo_pipe(void); + /* io.c */ unsigned io_fprintln(const char *, const char *, ...); void io_init(const char *, const char *); @@ -731,13 +754,12 @@ void io_save_cal(enum save_display); void io_load_app(void); void io_load_todo(void); void io_load_keys(const char *); -void io_check_dir(char *, int *); -unsigned io_file_exist(char *); -void io_check_file(char *, int *); +int io_check_dir(const char *); +unsigned io_file_exist(const char *); +int io_check_file(const char *); int io_check_data_files(void); void io_startup_screen(int); void io_export_data(enum export_type); -void io_export_bar(void); void io_import_data(enum import_type, const char *); struct io_file *io_log_init(void); void io_log_print(struct io_file *, int, const char *); @@ -757,7 +779,7 @@ void keys_free(void); void keys_dump_defaults(char *); const char *keys_get_label(enum key); enum key keys_get_action(int); -enum key keys_getch(WINDOW * win, int *); +enum key keys_getch(WINDOW * win, int *, int *); int keys_assign_binding(int, enum key); void keys_remove_binding(int, enum key); int keys_str2int(const char *); @@ -843,8 +865,12 @@ void pcal_export_data(FILE *); /* recur.c */ extern llist_ts_t recur_alist_p; extern llist_t recur_elist; +struct recur_event *recur_event_dup(struct recur_event *); +struct recur_apoint *recur_apoint_dup(struct recur_apoint *); void recur_event_free_bkp(void); void recur_apoint_free_bkp(void); +void recur_event_free(struct recur_event *); +void recur_apoint_free(struct recur_apoint *); void recur_apoint_llist_init(void); void recur_apoint_llist_free(void); void recur_event_llist_free(void); @@ -867,18 +893,17 @@ unsigned recur_item_find_occurrence(long, long, llist_t *, int, unsigned recur_apoint_find_occurrence(struct recur_apoint *, long, unsigned *); unsigned recur_event_find_occurrence(struct recur_event *, long, unsigned *); unsigned recur_item_inday(long, long, llist_t *, int, int, long, long); -unsigned recur_apoint_inday(struct recur_apoint *, long); -unsigned recur_event_inday(struct recur_event *, long); -void recur_event_erase(long, unsigned, unsigned, enum eraseflg); -void recur_apoint_erase(long, unsigned, unsigned, enum eraseflg); -void recur_repeat_item(void); +unsigned recur_apoint_inday(struct recur_apoint *, long *); +unsigned recur_event_inday(struct recur_event *, long *); +void recur_event_add_exc(struct recur_event *, long); +void recur_apoint_add_exc(struct recur_apoint *, long); +void recur_event_erase(struct recur_event *); +void recur_apoint_erase(struct recur_apoint *); void recur_exc_scan(llist_t *, FILE *); struct notify_app *recur_apoint_check_next(struct notify_app *, long, long); -struct recur_apoint *recur_get_apoint(long, int); -struct recur_event *recur_get_event(long, int); -void recur_apoint_switch_notify(long, int); -void recur_event_paste_item(void); -void recur_apoint_paste_item(void); +void recur_apoint_switch_notify(struct recur_apoint *); +void recur_event_paste_item(struct recur_event *, long); +void recur_apoint_paste_item(struct recur_apoint *, long); /* sigs.c */ void sigs_init(void); @@ -888,6 +913,7 @@ void sigs_unignore(void); /* todo.c */ extern llist_t todolist; +struct todo *todo_get_item(int); void todo_hilt_set(int); void todo_hilt_decrease(int); void todo_hilt_increase(int); @@ -899,17 +925,16 @@ void todo_first_increase(int); void todo_first_decrease(int); 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(void); -void todo_chg_priority(int); -void todo_edit_item(void); +void todo_delete_note(struct todo *); +void todo_delete(struct todo *); +void todo_flag(struct todo *); +void todo_chg_priority(struct todo *, int); void todo_update_panel(int); -void todo_edit_note(const char *); -void todo_view_note(const char *); -void todo_pipe_item(void); +void todo_edit_note(struct todo *, const char *); +void todo_view_note(struct todo *, const char *); +void todo_free(struct todo *); void todo_init_list(void); void todo_free_list(void); @@ -1009,7 +1034,6 @@ unsigned wins_sbar_wperc(void); void wins_set_sbar_width(unsigned); void wins_sbar_winc(void); void wins_sbar_wdec(void); -void wins_slctd_init(void); enum win wins_slctd(void); void wins_slctd_set(enum win); void wins_slctd_next(void); |