global variable 'colr' suppressed

This commit is contained in:
Frederic Culot 2007-03-10 15:54:24 +00:00
parent b1d02bf4ff
commit f82590c811
14 changed files with 119 additions and 112 deletions

View File

@ -1,4 +1,4 @@
/* $calcurse: args.c,v 1.14 2007/01/16 11:11:47 culot Exp $ */ /* $calcurse: args.c,v 1.15 2007/03/10 15:54:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -50,7 +50,7 @@
* Parse the command-line arguments and call the appropriate * Parse the command-line arguments and call the appropriate
* routines to handle those arguments. Also initialize the data paths. * routines to handle those arguments. Also initialize the data paths.
*/ */
int parse_args(int argc, char **argv, int colr) int parse_args(int argc, char **argv)
{ {
int ch, add_line = 0; int ch, add_line = 0;
int unknown_flag = 0, app_found = 0; int unknown_flag = 0, app_found = 0;
@ -154,10 +154,10 @@ int parse_args(int argc, char **argv, int colr)
io_init(cfile); io_init(cfile);
no_file = check_data_files(); no_file = check_data_files();
if (dflag || aflag || nflag) if (dflag || aflag || nflag)
load_app(colr); load_app();
} }
if (tflag) { if (tflag) {
todo_arg(tnum, colr); todo_arg(tnum);
non_interactive = 1; non_interactive = 1;
} }
if (nflag) { if (nflag) {
@ -240,13 +240,13 @@ void help_arg()
* Print todo list and exit. If a priority number is given (say not equal to * Print todo list and exit. If a priority number is given (say not equal to
* zero), then only todo items that have this priority will be displayed. * zero), then only todo items that have this priority will be displayed.
*/ */
void todo_arg(int priority, int colr) void todo_arg(int priority)
{ {
struct todo_s *i; struct todo_s *i;
int nb_tod, title = 1; int nb_tod, title = 1;
char priority_str[MAX_LENGTH] = ""; char priority_str[MAX_LENGTH] = "";
nb_tod = load_todo(colr); nb_tod = load_todo();
for (i = todolist; i != 0; i = i->next) { for (i = todolist; i != 0; i = i->next) {
if (priority == 0 || i->id == priority) { if (priority == 0 || i->id == priority) {
if (title) { if (title) {

View File

@ -1,8 +1,8 @@
/* $calcurse: args.h,v 1.4 2006/12/15 15:33:05 culot Exp $ */ /* $calcurse: args.h,v 1.5 2007/03/10 15:54:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2006 Frederic Culot * Copyright (c) 2004-2007 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,10 +29,10 @@
void usage(); void usage();
void usage_try(); void usage_try();
int parse_args(int argc, char **argv, int colr); int parse_args(int argc, char **argv);
void version_arg(); void version_arg();
void help_arg(); void help_arg();
void todo_arg(int priority, int colr); void todo_arg(int priority);
void next_arg(void); void next_arg(void);
int app_arg(int add_line, int year, int month, int day, long date); int app_arg(int add_line, int year, int month, int day, long date);
void date_arg(char *ddate, int add_line); void date_arg(char *ddate, int add_line);

View File

@ -1,4 +1,4 @@
/* $calcurse: calcurse.c,v 1.37 2007/03/04 16:14:31 culot Exp $ */ /* $calcurse: calcurse.c,v 1.38 2007/03/10 15:54:24 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -76,7 +76,7 @@ int first_todo_onscreen = 1;
char *saved_t_mesg; char *saved_t_mesg;
/* Variables for user configuration */ /* Variables for user configuration */
int colr = 1, layout = 1; int layout = 1;
int no_data_file = 1; int no_data_file = 1;
int really_quit = 0; int really_quit = 0;
bool confirm_quit; bool confirm_quit;
@ -147,7 +147,7 @@ int main(int argc, char **argv)
* Begin by parsing and handling command line arguments. * Begin by parsing and handling command line arguments.
* The data path is also initialized here. * The data path is also initialized here.
*/ */
non_interactive = parse_args(argc, argv, colr); non_interactive = parse_args(argc, argv);
if (non_interactive) if (non_interactive)
return EXIT_SUCCESS; return EXIT_SUCCESS;
@ -201,14 +201,14 @@ int main(int argc, char **argv)
*/ */
no_data_file = check_data_files(); no_data_file = check_data_files();
load_conf(background); load_conf(background);
nb_tod = load_todo(colr); nb_tod = load_todo();
load_app(); load_app();
notify_catch_children(); notify_catch_children();
if (notify_bar()) if (notify_bar())
notify_start_main_thread(); notify_start_main_thread();
get_screen_config(); get_screen_config();
reinit_wins(); reinit_wins();
startup_screen(skip_system_dialogs, no_data_file, colr); startup_screen(skip_system_dialogs, no_data_file);
store_day(year, month, day, day_changed); store_day(year, month, day, day_changed);
update_windows(CALENDAR); update_windows(CALENDAR);
@ -273,8 +273,8 @@ int main(int argc, char **argv)
case 'g': /* Goto function */ case 'g': /* Goto function */
erase_window_part(swin, 0, 0, nc_bar, nl_bar); erase_window_part(swin, 0, 0, nc_bar, nl_bar);
get_date(); get_date();
goto_day(colr, day, month, year, goto_day(day, month, year, &sel_day, &sel_month,
&sel_day, &sel_month, &sel_year); &sel_year);
do_storage = true; do_storage = true;
day_changed = true; day_changed = true;
break; break;
@ -312,7 +312,7 @@ int main(int argc, char **argv)
break; break;
case 'L': case 'L':
case 'l': case 'l':
layout = layout_config(layout, colr); layout = layout_config(layout);
break; break;
case 'G': case 'G':
case 'g': case 'g':
@ -336,7 +336,7 @@ int main(int argc, char **argv)
break; break;
case CTRL('T'): /* Add a todo, whatever panel selected */ case CTRL('T'): /* Add a todo, whatever panel selected */
nb_tod = todo_new_item(nb_tod, colr); nb_tod = todo_new_item(nb_tod);
if (hilt_tod == 0 && nb_tod == 1) if (hilt_tod == 0 && nb_tod == 1)
hilt_tod++; hilt_tod++;
break; break;
@ -347,7 +347,7 @@ int main(int argc, char **argv)
add_item(); add_item();
do_storage = true; do_storage = true;
} else if (which_pan == TODO) { } else if (which_pan == TODO) {
nb_tod = todo_new_item(nb_tod, colr); nb_tod = todo_new_item(nb_tod);
if (hilt_tod == 0 && nb_tod == 1) if (hilt_tod == 0 && nb_tod == 1)
hilt_tod++; hilt_tod++;
} }
@ -357,9 +357,9 @@ int main(int argc, char **argv)
case 'e': /* Edit an existing item */ case 'e': /* Edit an existing item */
if (which_pan == APPOINTMENT && hilt_app != 0) if (which_pan == APPOINTMENT && hilt_app != 0)
day_edit_item(sel_year, sel_month, sel_day, day_edit_item(sel_year, sel_month, sel_day,
hilt_app, colr); hilt_app);
else if (which_pan == TODO && hilt_tod != 0) else if (which_pan == TODO && hilt_tod != 0)
todo_edit_item(hilt_tod, colr); todo_edit_item(hilt_tod);
do_storage = true; do_storage = true;
break; break;
@ -373,7 +373,7 @@ int main(int argc, char **argv)
case 'r': case 'r':
if (which_pan == APPOINTMENT && hilt_app != 0) if (which_pan == APPOINTMENT && hilt_app != 0)
recur_repeat_item(sel_year, sel_month, recur_repeat_item(sel_year, sel_month,
sel_day, hilt_app, colr); sel_day, hilt_app);
do_storage = true; do_storage = true;
break; break;
@ -398,16 +398,15 @@ int main(int argc, char **argv)
break; break;
case '?': /* Online help system */ case '?': /* Online help system */
status_bar(which_pan, colr, nc_bar, nl_bar); status_bar(which_pan, nc_bar, nl_bar);
help_screen(which_pan, colr); help_screen(which_pan);
break; break;
case 'S': case 'S':
case 's': /* Save function */ case 's': /* Save function */
save_cal(auto_save, confirm_quit, save_cal(auto_save, confirm_quit, confirm_delete,
confirm_delete, skip_system_dialogs, skip_system_dialogs, skip_progress_bar,
skip_progress_bar, week_begins_on_monday, week_begins_on_monday, layout);
colr, layout);
break; break;
case (261): /* right arrow */ case (261): /* right arrow */
@ -533,11 +532,9 @@ int main(int argc, char **argv)
case ('Q'): /* Quit calcurse :-( */ case ('Q'): /* Quit calcurse :-( */
case ('q'): case ('q'):
if (auto_save) if (auto_save)
save_cal(auto_save,confirm_quit, save_cal(auto_save,confirm_quit, confirm_delete,
confirm_delete, skip_system_dialogs, skip_system_dialogs, skip_progress_bar,
skip_progress_bar, week_begins_on_monday, layout);
week_begins_on_monday,
colr, layout);
if (confirm_quit) { if (confirm_quit) {
status_mesg(_(quit_message), choices); status_mesg(_(quit_message), choices);
ch = wgetch(swin); ch = wgetch(swin);
@ -659,7 +656,7 @@ update_windows(int surrounded_window)
update_cal_panel(cwin, nl_cal, nc_cal, sel_month, update_cal_panel(cwin, nl_cal, nc_cal, sel_month,
sel_year, sel_day, day, month, year, sel_year, sel_day, day, month, year,
week_begins_on_monday); week_begins_on_monday);
status_bar(surrounded_window, colr, nc_bar, nl_bar); status_bar(surrounded_window, nc_bar, nl_bar);
if (notify_bar()) if (notify_bar())
notify_update_bar(); notify_update_bar();
wmove(swin, 0, 0); wmove(swin, 0, 0);
@ -892,7 +889,7 @@ config_notify_bar(void)
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
strncpy(buf, nbar->datefmt, strlen(nbar->datefmt) + 1); strncpy(buf, nbar->datefmt, strlen(nbar->datefmt) + 1);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
if (updatestring(swin, colr, &buf, 0, 1) == 0) { if (updatestring(swin, &buf, 0, 1) == 0) {
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
strncpy(nbar->datefmt, buf, strlen(buf) + 1); strncpy(nbar->datefmt, buf, strlen(buf) + 1);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
@ -904,7 +901,7 @@ config_notify_bar(void)
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
strncpy(buf, nbar->timefmt, strlen(nbar->timefmt) + 1); strncpy(buf, nbar->timefmt, strlen(nbar->timefmt) + 1);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
if (updatestring(swin, colr, &buf, 0, 1) == 0) { if (updatestring(swin, &buf, 0, 1) == 0) {
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
strncpy(nbar->timefmt, buf, strlen(buf) + 1); strncpy(nbar->timefmt, buf, strlen(buf) + 1);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
@ -916,7 +913,7 @@ config_notify_bar(void)
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
printf(buf, "%d", nbar->cntdwn); printf(buf, "%d", nbar->cntdwn);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
if (updatestring(swin, colr, &buf, 0, 1) == 0 && if (updatestring(swin, &buf, 0, 1) == 0 &&
is_all_digit(buf) && is_all_digit(buf) &&
atoi(buf) >= 0 && atoi(buf) <= DAYINSEC) { atoi(buf) >= 0 && atoi(buf) <= DAYINSEC) {
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
@ -930,7 +927,7 @@ config_notify_bar(void)
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
strncpy(buf, nbar->cmd, strlen(nbar->cmd) + 1); strncpy(buf, nbar->cmd, strlen(nbar->cmd) + 1);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
if (updatestring(swin, colr, &buf, 0, 1) == 0) { if (updatestring(swin, &buf, 0, 1) == 0) {
pthread_mutex_lock(&nbar->mutex); pthread_mutex_lock(&nbar->mutex);
strncpy(nbar->cmd, buf, strlen(buf) + 1); strncpy(nbar->cmd, buf, strlen(buf) + 1);
pthread_mutex_unlock(&nbar->mutex); pthread_mutex_unlock(&nbar->mutex);
@ -1219,7 +1216,7 @@ void add_item(void)
/* Get the starting time */ /* Get the starting time */
while (check_time(item_time) != 1) { while (check_time(item_time) != 1) {
status_mesg(mesg_1, ""); status_mesg(mesg_1, "");
if (getstring(swin, colr, item_time, LTIME, 0, 1) != if (getstring(swin, item_time, LTIME, 0, 1) !=
GETSTRING_ESC) { GETSTRING_ESC) {
if (strlen(item_time) == 0){ if (strlen(item_time) == 0){
is_appointment = 0; is_appointment = 0;
@ -1241,7 +1238,7 @@ void add_item(void)
item_time[0] = '\0'; item_time[0] = '\0';
while (check_time(item_time) == 0) { while (check_time(item_time) == 0) {
status_mesg(mesg_2, ""); status_mesg(mesg_2, "");
if (getstring(swin, colr, item_time, LTIME, 0, 1) != if (getstring(swin, item_time, LTIME, 0, 1) !=
GETSTRING_VALID) GETSTRING_VALID)
return; //nothing entered, cancel adding of event return; //nothing entered, cancel adding of event
else if (check_time(item_time) == 0) { else if (check_time(item_time) == 0) {
@ -1269,7 +1266,7 @@ void add_item(void)
Id = 1; Id = 1;
status_mesg(mesg_3, ""); status_mesg(mesg_3, "");
if (getstring(swin, colr, item_mesg, MAX_LENGTH, 0, 1) == if (getstring(swin, item_mesg, MAX_LENGTH, 0, 1) ==
GETSTRING_VALID) { GETSTRING_VALID) {
if (is_appointment) { if (is_appointment) {
apoint_start = date2sec(sel_year, sel_month, sel_day, apoint_start = date2sec(sel_year, sel_month, sel_day,
@ -1349,7 +1346,7 @@ void update_app_panel(int year, int month, int day)
title_xpos = nc_app - (strlen(_(monthnames[sel_month - 1])) + 11); title_xpos = nc_app - (strlen(_(monthnames[sel_month - 1])) + 11);
if (sel_day < 10) title_xpos++; if (sel_day < 10) title_xpos++;
date = date2sec(year, month, day, 0, 0); date = date2sec(year, month, day, 0, 0);
day_write_pad(date, app_width, app_length, hilt_app, colr); day_write_pad(date, app_width, app_length, hilt_app);
/* Print current date in the top right window corner. */ /* Print current date in the top right window corner. */
erase_window_part(awin, 1, title_lines, nc_app - 2, nl_app - 2); erase_window_part(awin, 1, title_lines, nc_app - 2, nl_app - 2);

View File

@ -1,4 +1,4 @@
/* $calcurse: calendar.c,v 1.6 2007/01/16 07:50:59 culot Exp $ */ /* $calcurse: calendar.c,v 1.7 2007/03/10 15:54:59 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -182,8 +182,8 @@ long ymd_to_scalar(unsigned annee, unsigned mois, unsigned jour)
* sel_day, sel_month and sel_year represent the day given back. * sel_day, sel_month and sel_year represent the day given back.
*/ */
void void
goto_day(int colr, int day, int month, int year, goto_day(int day, int month, int year, int *sel_day, int *sel_month,
int *sel_day, int *sel_month, int *sel_year) int *sel_year)
{ {
#define LDAY 11 #define LDAY 11
char selected_day[LDAY] = ""; char selected_day[LDAY] = "";
@ -195,8 +195,7 @@ goto_day(int colr, int day, int month, int year,
while (wrong_day) { while (wrong_day) {
status_mesg(request_date, ""); status_mesg(request_date, "");
if (getstring(swin, colr, selected_day, LDAY, 0, 1) == if (getstring(swin, selected_day, LDAY, 0, 1) == GETSTRING_ESC)
GETSTRING_ESC)
return; return;
else { else {
if (strlen(selected_day) == 0) { if (strlen(selected_day) == 0) {

View File

@ -1,8 +1,8 @@
/* $calcurse: calendar.h,v 1.1 2006/07/31 21:00:02 culot Exp $ */ /* $calcurse: calendar.h,v 1.2 2007/03/10 15:54:59 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2006 Frederic Culot * Copyright (c) 2004-2007 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,13 +29,11 @@
#include <stdbool.h> #include <stdbool.h>
void update_cal_panel(WINDOW *cwin, int nl_cal, void update_cal_panel(WINDOW *cwin, int nl_cal, int nc_cal, int sel_month,
int nc_cal, int sel_month, int sel_year, int sel_day, int sel_year, int sel_day, int day, int month, int year, bool monday_first);
int day, int month, int year,
bool monday_first);
int isBissextile(unsigned); int isBissextile(unsigned);
long ymd_to_scalar(unsigned, unsigned, unsigned); long ymd_to_scalar(unsigned, unsigned, unsigned);
void goto_day(int colr, int day, int month, int year, void goto_day(int day, int month, int year, int *sel_day, int *sel_month,
int *sel_day, int *sel_month, int *sel_year); int *sel_year);
#endif /* CALCURSE_CALENDAR_H */ #endif /* CALCURSE_CALENDAR_H */

View File

@ -1,4 +1,4 @@
/* $calcurse: day.c,v 1.19 2007/02/25 19:32:53 culot Exp $ */ /* $calcurse: day.c,v 1.20 2007/03/10 15:55:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -258,7 +258,8 @@ struct day_item_s *day_add_apoint(int type, char *mesg, long start, long dur,
* structure (pointed by day_saved_item), to be later displayed in a * structure (pointed by day_saved_item), to be later displayed in a
* popup window if requested. * popup window if requested.
*/ */
void day_write_pad(long date, int width, int length, int incolor, int colr) void
day_write_pad(long date, int width, int length, int incolor)
{ {
struct day_item_s *p; struct day_item_s *p;
int line, item_number, max_pos, recur; int line, item_number, max_pos, recur;
@ -396,7 +397,8 @@ void day_popup_item(void)
} }
/* Edit an already existing item. */ /* Edit an already existing item. */
void day_edit_item(int year, int month, int day, int item_num, int colr) void
day_edit_item(int year, int month, int day, int item_num)
{ {
#define STRT '1' #define STRT '1'
#define END '2' #define END '2'
@ -479,7 +481,7 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
switch (ch) { switch (ch) {
case STRT: case STRT:
while (!valid_date) { while (!valid_date) {
timestr = day_edit_time(p->start, colr); timestr = day_edit_time(p->start);
sscanf(timestr, "%u:%u", &hr, &mn); sscanf(timestr, "%u:%u", &hr, &mn);
free(timestr); free(timestr);
newtime = update_time_in_date(p->start, hr, mn); newtime = update_time_in_date(p->start, hr, mn);
@ -496,7 +498,7 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
case END: case END:
while (!valid_date) { while (!valid_date) {
timestr = day_edit_time( timestr = day_edit_time(
p->start + p->appt_dur, colr); p->start + p->appt_dur);
sscanf(timestr, "%u:%u", &hr, &mn); sscanf(timestr, "%u:%u", &hr, &mn);
free(timestr); free(timestr);
newtime = update_time_in_date( newtime = update_time_in_date(
@ -512,7 +514,7 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
break; break;
case DESC: case DESC:
status_mesg(mesg_desc, ""); status_mesg(mesg_desc, "");
updatestring(swin, colr, &p->mesg, 0, 1); updatestring(swin, &p->mesg, 0, 1);
break; break;
case REPT: case REPT:
while ( (ch != 'D') && (ch != 'W') && (ch != 'M') while ( (ch != 'D') && (ch != 'W') && (ch != 'M')
@ -520,7 +522,7 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
status_mesg(mesg_type_1, mesg_type_2); status_mesg(mesg_type_1, mesg_type_2);
typestr = (char *) malloc(sizeof(char)); typestr = (char *) malloc(sizeof(char));
*typestr = recur_def2char(rpt->type); *typestr = recur_def2char(rpt->type);
cancel = updatestring(swin, colr, &typestr, 0, 1); cancel = updatestring(swin, &typestr, 0, 1);
ch = toupper(*typestr); ch = toupper(*typestr);
free(typestr); free(typestr);
if (cancel) if (cancel)
@ -530,7 +532,7 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
status_mesg(mesg_freq_1, ""); status_mesg(mesg_freq_1, "");
freqstr = (char *) malloc(MAX_LENGTH); freqstr = (char *) malloc(MAX_LENGTH);
snprintf(freqstr, MAX_LENGTH, "%d", rpt->freq); snprintf(freqstr, MAX_LENGTH, "%d", rpt->freq);
cancel = updatestring(swin, colr, &freqstr, 0, 1); cancel = updatestring(swin, &freqstr, 0, 1);
newfreq = atoi(freqstr); newfreq = atoi(freqstr);
free(freqstr); free(freqstr);
if (cancel) if (cancel)
@ -545,7 +547,7 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
while (!date_entered) { while (!date_entered) {
status_mesg(mesg_until_1, ""); status_mesg(mesg_until_1, "");
timestr = date_sec2date_str(rpt->until); timestr = date_sec2date_str(rpt->until);
cancel = updatestring(swin, colr, &timestr, 0, 1); cancel = updatestring(swin, &timestr, 0, 1);
if (cancel) { if (cancel) {
free(timestr); free(timestr);
return; return;
@ -608,7 +610,8 @@ void day_edit_item(int year, int month, int day, int item_num, int colr)
} }
/* Request the user to enter a new time. */ /* Request the user to enter a new time. */
char *day_edit_time(long time, int colr) { char *
day_edit_time(long time) {
char *timestr; char *timestr;
char *msg_time = _("Enter the new time ([hh:mm] or [h:mm]) : "); char *msg_time = _("Enter the new time ([hh:mm] or [h:mm]) : ");
char *enter_str = _("Press [Enter] to continue"); char *enter_str = _("Press [Enter] to continue");
@ -618,7 +621,7 @@ char *day_edit_time(long time, int colr) {
while (1) { while (1) {
status_mesg(msg_time, ""); status_mesg(msg_time, "");
timestr = date_sec2hour_str(time); timestr = date_sec2hour_str(time);
updatestring(swin, colr, &timestr, 0, 1); updatestring(swin, &timestr, 0, 1);
if (check_time(timestr) != 1 || strlen(timestr) == 0) { if (check_time(timestr) != 1 || strlen(timestr) == 0) {
status_mesg(fmt_msg, enter_str); status_mesg(fmt_msg, enter_str);
wgetch(swin); wgetch(swin);

View File

@ -1,4 +1,4 @@
/* $calcurse: day.h,v 1.9 2007/02/24 17:38:16 culot Exp $ */ /* $calcurse: day.h,v 1.10 2007/03/10 15:55:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -64,13 +64,13 @@ int day_store_recur_apoints(long date);
int day_store_apoints(long date); int day_store_apoints(long date);
struct day_item_s *day_add_event(int type, char *mesg, long day, int id); struct day_item_s *day_add_event(int type, char *mesg, long day, int id);
struct day_item_s *day_add_apoint(int type, char *mesg, long start, long dur, struct day_item_s *day_add_apoint(int type, char *mesg, long start, long dur,
char state, int real_pos); char state, int real_pos);
void day_write_pad(long date, int width, int length, int incolor, int colr); void day_write_pad(long date, int width, int length, int incolor);
apoint_llist_node_t *day_item_s2apoint_s(struct day_item_s *p); apoint_llist_node_t *day_item_s2apoint_s(struct day_item_s *p);
void day_popup_item(void); void day_popup_item(void);
int day_check_if_item(int year, int month, int day); int day_check_if_item(int year, int month, int day);
void day_edit_item(int year, int month, int day, int item_num, int colr); void day_edit_item(int year, int month, int day, int item_num);
char *day_edit_time(long time, int colr); char *day_edit_time(long time);
int day_erase_item(long date, int item_number, int force_erase); int day_erase_item(long date, int item_number, int force_erase);
struct day_item_s *day_get_item(int item_number); struct day_item_s *day_get_item(int item_number);
int day_item_nb(long date, int day_num, int type); int day_item_nb(long date, int day_num, int type);

View File

@ -1,4 +1,4 @@
/* $calcurse: help.c,v 1.13 2007/01/16 11:11:47 culot Exp $ */ /* $calcurse: help.c,v 1.14 2007/03/10 15:55:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -43,7 +43,8 @@
* Write the desired help text inside the help pad, and return the number * Write the desired help text inside the help pad, and return the number
* of lines that were written. * of lines that were written.
* */ * */
int write_help_pad(WINDOW *win, char *title, char *text, int pad_width) int
write_help_pad(WINDOW *win, char *title, char *text, int pad_width)
{ {
int nl_title = 0; int nl_title = 0;
int nl_text = 0; int nl_text = 0;
@ -58,7 +59,8 @@ int write_help_pad(WINDOW *win, char *title, char *text, int pad_width)
return nl_text + nl_title; return nl_text + nl_title;
} }
int get_help_lines(char *text) int
get_help_lines(char *text)
{ {
int i; int i;
int nl = 0; int nl = 0;
@ -70,7 +72,8 @@ int get_help_lines(char *text)
} }
/* Draws the help screen */ /* Draws the help screen */
void help_screen(int which_pan, int colr) void
help_screen(int which_pan)
{ {
WINDOW *help_win = NULL; WINDOW *help_win = NULL;
WINDOW *help_pad = NULL; WINDOW *help_pad = NULL;

View File

@ -1,8 +1,8 @@
/* $calcurse: help.h,v 1.1 2006/07/31 21:00:03 culot Exp $ */ /* $calcurse: help.h,v 1.2 2007/03/10 15:55:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2006 Frederic Culot * Copyright (c) 2004-2007 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -36,6 +36,6 @@ typedef struct {
int write_help_pad(WINDOW *win, char *title, char *text, int pad_width); int write_help_pad(WINDOW *win, char *title, char *text, int pad_width);
int get_help_lines(char *text); int get_help_lines(char *text);
void help_screen(int which_pan, int colr); void help_screen(int which_pan);
#endif /* CALCURSE_HELP_H */ #endif /* CALCURSE_HELP_H */

View File

@ -1,8 +1,8 @@
/* $calcurse: io.h,v 1.1 2006/07/31 21:00:03 culot Exp $ */ /* $calcurse: io.h,v 1.2 2007/03/10 15:56:56 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2006 Frederic Culot * Copyright (c) 2004-2007 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,14 +29,13 @@
void io_init(char *cfile); void io_init(char *cfile);
void extract_data(char *dst_data, const char *org, int len); void extract_data(char *dst_data, const char *org, int len);
void save_cal(bool auto_save, bool confirm_quit, void save_cal(bool auto_save, bool confirm_quit, bool confirm_delete,
bool confirm_delete, bool skip_system_dialogs, bool skip_system_dialogs, bool skip_progress_bar,
bool skip_progress_bar, bool week_begins_on_monday, bool week_begins_on_monday, int layout);
int colr, int layout); void load_app(void);
void load_app(); int load_todo(void);
int load_todo(int colr); int check_data_files(void);
int check_data_files(); void startup_screen(bool skip_dialogs, int no_data_file);
void startup_screen(bool skip_dialogs, int no_data_file, int colr);
void progress_bar(bool save, int progress); void progress_bar(bool save, int progress);
#endif /* CALCURSE_IO_H */ #endif /* CALCURSE_IO_H */

View File

@ -1,4 +1,4 @@
/* $calcurse: recur.c,v 1.21 2007/02/25 19:31:08 culot Exp $ */ /* $calcurse: recur.c,v 1.22 2007/03/10 15:55:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -520,8 +520,10 @@ void recur_apoint_erase(long start, unsigned num, unsigned delete_whole)
* o repetition end date * o repetition end date
* and then delete the selected item to recreate it as a recurrent one * and then delete the selected item to recreate it as a recurrent one
*/ */
void recur_repeat_item(int sel_year, int sel_month, int sel_day, void
int item_nb, int colr) { recur_repeat_item(int sel_year, int sel_month, int sel_day,
int item_nb)
{
struct tm *lt; struct tm *lt;
time_t t; time_t t;
int ch = 0; int ch = 0;
@ -572,8 +574,8 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day,
while (freq == 0) { while (freq == 0) {
status_mesg(mesg_freq_1, ""); status_mesg(mesg_freq_1, "");
if (getstring(swin, colr, user_input, MAX_LENGTH, 0, 1) == if (getstring(swin, user_input, MAX_LENGTH, 0, 1) ==
GETSTRING_VALID) { GETSTRING_VALID) {
freq = atoi(user_input); freq = atoi(user_input);
if (freq == 0) { if (freq == 0) {
status_mesg(mesg_wrong_freq, wrong_type_2); status_mesg(mesg_wrong_freq, wrong_type_2);
@ -586,8 +588,7 @@ void recur_repeat_item(int sel_year, int sel_month, int sel_day,
while (!date_entered) { while (!date_entered) {
status_mesg(mesg_until_1, ""); status_mesg(mesg_until_1, "");
if (getstring(swin, colr, user_input, 11, 0, 1) == if (getstring(swin, user_input, 11, 0, 1) == GETSTRING_VALID) {
GETSTRING_VALID) {
if (strlen(user_input) == 1 && if (strlen(user_input) == 1 &&
strncmp(user_input, "0", 1) == 0 ) { strncmp(user_input, "0", 1) == 0 ) {
until = 0; until = 0;

View File

@ -1,4 +1,4 @@
/* $calcurse: recur.h,v 1.9 2007/02/24 17:35:49 culot Exp $ */ /* $calcurse: recur.h,v 1.10 2007/03/10 15:55:25 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -96,7 +96,7 @@ unsigned recur_item_inday(long item_start, struct days_s *item_exc,
void recur_event_erase(long start, unsigned num, unsigned delete_whole); void recur_event_erase(long start, unsigned num, unsigned delete_whole);
void recur_apoint_erase(long start, unsigned num, unsigned delete_whole); void recur_apoint_erase(long start, unsigned num, unsigned delete_whole);
void recur_repeat_item(int sel_year, int sel_month, int sel_day, void recur_repeat_item(int sel_year, int sel_month, int sel_day,
int item_nb, int colr); int item_nb);
struct days_s *recur_exc_scan(FILE *data_file); struct days_s *recur_exc_scan(FILE *data_file);
struct notify_app_s *recur_apoint_check_next(struct notify_app_s *app, struct notify_app_s *recur_apoint_check_next(struct notify_app_s *app,
long start, long day); long start, long day);

View File

@ -1,4 +1,4 @@
/* $calcurse: todo.c,v 1.9 2007/01/16 07:52:29 culot Exp $ */ /* $calcurse: todo.c,v 1.10 2007/03/10 15:54:59 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -36,7 +36,8 @@
struct todo_s *todolist; struct todo_s *todolist;
/* Request user to enter a new todo item. */ /* Request user to enter a new todo item. */
int todo_new_item(int total, int colr) int
todo_new_item(int total)
{ {
int ch = 0; int ch = 0;
char *mesg = _("Enter the new ToDo item : "); char *mesg = _("Enter the new ToDo item : ");
@ -45,7 +46,7 @@ int todo_new_item(int total, int colr)
char todo_input[MAX_LENGTH] = ""; char todo_input[MAX_LENGTH] = "";
status_mesg(mesg, ""); status_mesg(mesg, "");
if (getstring(swin, colr, todo_input, MAX_LENGTH, 0, 1) == if (getstring(swin, todo_input, MAX_LENGTH, 0, 1) ==
GETSTRING_VALID) { GETSTRING_VALID) {
while ( (ch < '1') || (ch > '9') ) { while ( (ch < '1') || (ch > '9') ) {
status_mesg(mesg_id, ""); status_mesg(mesg_id, "");
@ -59,7 +60,8 @@ int todo_new_item(int total, int colr)
} }
/* Add an item in the todo linked list. */ /* Add an item in the todo linked list. */
struct todo_s *todo_add(char *mesg, int id) struct todo_s *
todo_add(char *mesg, int id)
{ {
struct todo_s *o, **i; struct todo_s *o, **i;
o = (struct todo_s *) malloc(sizeof(struct todo_s)); o = (struct todo_s *) malloc(sizeof(struct todo_s));
@ -79,7 +81,8 @@ struct todo_s *todo_add(char *mesg, int id)
} }
/* Delete an item from the todo linked list. */ /* Delete an item from the todo linked list. */
void todo_delete_bynum(unsigned num) void
todo_delete_bynum(unsigned num)
{ {
unsigned n; unsigned n;
struct todo_s *i, **iptr; struct todo_s *i, **iptr;
@ -102,7 +105,8 @@ void todo_delete_bynum(unsigned num)
} }
/* Returns a structure containing the selected item. */ /* Returns a structure containing the selected item. */
struct todo_s *todo_get_item(int item_number) struct todo_s *
todo_get_item(int item_number)
{ {
struct todo_s *o; struct todo_s *o;
int i; int i;
@ -118,7 +122,8 @@ struct todo_s *todo_get_item(int item_number)
* Returns the position into the linked list corresponding to the * Returns the position into the linked list corresponding to the
* given todo_s item. * given todo_s item.
*/ */
int todo_get_position(struct todo_s *i) int
todo_get_position(struct todo_s *i)
{ {
struct todo_s *o; struct todo_s *o;
int n = 1, found = 0; int n = 1, found = 0;
@ -140,7 +145,8 @@ int todo_get_position(struct todo_s *i)
} }
/* Change an item priority by pressing '+' or '-' inside TODO panel. */ /* Change an item priority by pressing '+' or '-' inside TODO panel. */
int todo_chg_priority(int action, int item_num) int
todo_chg_priority(int action, int item_num)
{ {
struct todo_s *backup; struct todo_s *backup;
char backup_mesg[MAX_LENGTH]; char backup_mesg[MAX_LENGTH];
@ -169,12 +175,13 @@ int todo_chg_priority(int action, int item_num)
} }
/* Edit the description of an already existing todo item. */ /* Edit the description of an already existing todo item. */
void todo_edit_item(int item_num, int colr) void
todo_edit_item(int item_num)
{ {
struct todo_s *i; struct todo_s *i;
char *mesg = _("Enter the new ToDo description :"); char *mesg = _("Enter the new ToDo description :");
status_mesg(mesg, ""); status_mesg(mesg, "");
i = todo_get_item(item_num); i = todo_get_item(item_num);
updatestring(swin, colr, &i->mesg, 0, 1); updatestring(swin, &i->mesg, 0, 1);
} }

View File

@ -1,8 +1,8 @@
/* $calcurse: todo.h,v 1.4 2006/11/02 13:43:56 culot Exp $ */ /* $calcurse: todo.h,v 1.5 2007/03/10 15:54:59 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
* Copyright (c) 2004-2006 Frederic Culot * Copyright (c) 2004-2007 Frederic Culot
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -35,12 +35,12 @@ struct todo_s {
extern struct todo_s *todolist; extern struct todo_s *todolist;
int todo_new_item(int total, int colr); int todo_new_item(int total);
struct todo_s *todo_add(char *mesg, int id); struct todo_s *todo_add(char *mesg, int id);
void todo_delete_bynum(unsigned num); void todo_delete_bynum(unsigned num);
struct todo_s *todo_get_item(int item_number); struct todo_s *todo_get_item(int item_number);
int todo_get_position(struct todo_s *i); int todo_get_position(struct todo_s *i);
int todo_chg_priority(int action, int item_num); int todo_chg_priority(int action, int item_num);
void todo_edit_item(int item_num, int colr); void todo_edit_item(int item_num);
#endif /* CALCURSE_TODO_H */ #endif /* CALCURSE_TODO_H */