summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2007-10-21 13:42:34 +0000
committerFrederic Culot <calcurse@culot.org>2007-10-21 13:42:34 +0000
commit53ead324ad5ef82415279b32ca5cd0a3d1f48866 (patch)
tree7c80c420a06af9819b794a18d6e724ccd7989506
parent15ea0407800d0c6dbf76b213f76816e70815b668 (diff)
downloadcalcurse-53ead324ad5ef82415279b32ca5cd0a3d1f48866.tar.gz
calcurse-53ead324ad5ef82415279b32ca5cd0a3d1f48866.zip
routines updated to handle new window_t and window_e types
-rwxr-xr-xsrc/apoint.c31
-rwxr-xr-xsrc/calcurse.c89
-rwxr-xr-xsrc/calendar.c9
-rwxr-xr-xsrc/day.c30
-rwxr-xr-xsrc/io.c30
-rwxr-xr-xsrc/recur.c15
-rwxr-xr-xsrc/todo.c21
-rwxr-xr-xsrc/utils.c54
8 files changed, 139 insertions, 140 deletions
diff --git a/src/apoint.c b/src/apoint.c
index 22cd684..7a87e6e 100755
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -1,4 +1,4 @@
-/* $calcurse: apoint.c,v 1.17 2007/08/15 15:33:54 culot Exp $ */
+/* $calcurse: apoint.c,v 1.18 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -132,14 +132,14 @@ apoint_add(void)
/* Get the starting time */
while (check_time(item_time) != 1) {
status_mesg(mesg_1, "");
- if (getstring(swin, item_time, LTIME, 0, 1) !=
+ if (getstring(win[STA].p, item_time, LTIME, 0, 1) !=
GETSTRING_ESC) {
if (strlen(item_time) == 0){
is_appointment = 0;
break;
} else if (check_time(item_time) != 1) {
status_mesg(format_message_1, enter_str);
- wgetch(swin);
+ wgetch(win[STA].p);
} else
sscanf(item_time, "%u:%u", &heures, &minutes);
} else
@@ -154,12 +154,12 @@ apoint_add(void)
item_time[0] = '\0';
while (check_time(item_time) == 0) {
status_mesg(mesg_2, "");
- if (getstring(swin, item_time, LTIME, 0, 1) !=
+ if (getstring(win[STA].p, item_time, LTIME, 0, 1) !=
GETSTRING_VALID)
return; //nothing entered, cancel adding of event
else if (check_time(item_time) == 0) {
status_mesg(format_message_2, enter_str);
- wgetch(swin);
+ wgetch(win[STA].p);
} else {
if (check_time(item_time) == 2)
apoint_duration = atoi(item_time);
@@ -186,7 +186,7 @@ apoint_add(void)
Id = 1;
status_mesg(mesg_3, "");
- if (getstring(swin, item_mesg, BUFSIZ, 0, 1) ==
+ if (getstring(win[STA].p, item_mesg, BUFSIZ, 0, 1) ==
GETSTRING_VALID) {
if (is_appointment) {
apoint_start =
@@ -224,7 +224,7 @@ apoint_delete(conf_t *conf, unsigned *nb_events, unsigned *nb_apoints)
if (conf->confirm_delete) {
status_mesg(del_app_str, choices);
- answer = wgetch(swin);
+ answer = wgetch(win[STA].p);
if ( (answer == 'y') && (nb_items != 0) )
go_for_deletion = true;
else {
@@ -417,7 +417,7 @@ void display_item_date(WINDOW *win, int incolor, apoint_llist_node_t *i,
else
mvwprintw(win, y, x, " - %s -> %s", a_st, a_end);
if (incolor == 0)
- custom_remove_attr(awin, ATTR_HIGHEST);
+ custom_remove_attr(win, ATTR_HIGHEST);
}
/*
@@ -590,28 +590,29 @@ apoint_update_panel(window_t *winapp, int which_pan)
day_write_pad(date, app_width, app_length, hilt);
/* Print current date in the top right window corner. */
- erase_window_part(awin, 1, title_lines, winapp->w - 2, winapp->h - 2);
- custom_apply_attr(awin, ATTR_HIGHEST);
- mvwprintw(awin, title_lines, title_xpos, "%s %s %d, %d",
+ erase_window_part(win[APP].p, 1, title_lines, winapp->w - 2,
+ winapp->h - 2);
+ custom_apply_attr(win[APP].p, ATTR_HIGHEST);
+ mvwprintw(win[APP].p, title_lines, title_xpos, "%s %s %d, %d",
calendar_get_pom(date), _(monthnames[slctd_date.mm - 1]),
slctd_date.dd, slctd_date.yyyy);
- custom_remove_attr(awin, ATTR_HIGHEST);
+ custom_remove_attr(win[APP].p, ATTR_HIGHEST);
/* Draw the scrollbar if necessary. */
if ((apad->length >= app_length)||(apad->first_onscreen > 0)) {
float ratio = ((float) app_length) / ((float) apad->length);
int sbar_length = (int) (ratio * app_length);
int highend = (int) (ratio * apad->first_onscreen);
- bool hilt_bar = (which_pan == APPOINTMENT) ? true : false;
+ bool hilt_bar = (which_pan == APP) ? true : false;
int sbar_top = highend + title_lines + 1;
if ((sbar_top + sbar_length) > winapp->h - 1)
sbar_length = winapp->h - 1 - sbar_top;
- draw_scrollbar(awin, sbar_top, winapp->w - 2, sbar_length,
+ draw_scrollbar(win[APP].p, sbar_top, winapp->w - 2, sbar_length,
title_lines + 1, winapp->h - 1, hilt_bar);
}
- wnoutrefresh(awin);
+ wnoutrefresh(win[APP].p);
pnoutrefresh(apad->ptrwin, apad->first_onscreen, 0,
winapp->y + title_lines + 1, winapp->x + bordr,
winapp->y + winapp->h - 2*bordr, winapp->x + winapp->w - 3*bordr);
diff --git a/src/calcurse.c b/src/calcurse.c
index b8ad8b4..12fea0a 100755
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -1,4 +1,4 @@
-/* $calcurse: calcurse.c,v 1.56 2007/10/07 17:13:10 culot Exp $ */
+/* $calcurse: calcurse.c,v 1.57 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -152,7 +152,7 @@ main(int argc, char **argv)
wins_update();
io_startup_screen(conf.skip_system_dialogs, no_data_file);
inday = *day_process_storage(0, day_changed, &inday);
- wins_slctd_set(CALENDAR);
+ wins_slctd_set(CAL);
wins_update();
calendar_start_date_thread();
@@ -160,7 +160,7 @@ main(int argc, char **argv)
for (;;) {
do_update = true;
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
switch (ch) {
@@ -178,11 +178,11 @@ main(int argc, char **argv)
reset_status_page();
/* Save previously highlighted event. */
switch (wins_slctd()) {
- case TODO:
+ case TOD:
sav_hilt_tod = todo_hilt();
todo_hilt_set(0);
break;
- case APPOINTMENT:
+ case APP:
sav_hilt_app = apoint_hilt();
apoint_hilt_set(0);
break;
@@ -193,13 +193,13 @@ main(int argc, char **argv)
/* Select the event to highlight. */
switch (wins_slctd()) {
- case TODO:
+ case TOD:
if ((sav_hilt_tod == 0) && (todo_nb() != 0))
todo_hilt_set(1);
else
todo_hilt_set(sav_hilt_tod);
break;
- case APPOINTMENT:
+ case APP:
if ((sav_hilt_app == 0) &&
((inday.nb_events + inday.nb_apoints) != 0))
apoint_hilt_set(1);
@@ -227,31 +227,29 @@ main(int argc, char **argv)
case 'V':
case 'v': /* View function */
- if ((wins_slctd() == APPOINTMENT) &&
- (apoint_hilt() != 0))
+ if ((wins_slctd() == APP) && (apoint_hilt() != 0))
day_popup_item();
- else if ((wins_slctd() == TODO) && (todo_hilt() != 0))
+ else if ((wins_slctd() == TOD) && (todo_hilt() != 0))
item_in_popup(NULL, NULL, todo_saved_mesg(),
- _("To do :"));
+ _("To do :"));
break;
case 'C':
case 'c': /* Configuration menu */
erase_status_bar();
config_bar();
- while ((ch = wgetch(swin)) != 'q') {
+ while ((ch = wgetch(win[STA].p)) != 'q') {
switch (ch) {
case 'C':
case 'c':
- if (has_colors()) {
- custom_color_config(
- notify_bar());
- } else {
+ if (has_colors())
+ custom_color_config();
+ else {
colorize = false;
erase_status_bar();
- mvwprintw(swin, 0, 0,
- _(no_color_support));
- wgetch(swin);
+ mvwprintw(win[STA].p, 0, 0,
+ _(no_color_support));
+ wgetch(win[STA].p);
}
break;
case 'L':
@@ -267,7 +265,7 @@ main(int argc, char **argv)
notify_config_bar();
break;
}
- wins_reinit();
+ wins_reset();
wins_update();
do_storage = true;
erase_status_bar();
@@ -290,11 +288,11 @@ main(int argc, char **argv)
case 'A':
case 'a': /* Add an item */
switch (wins_slctd()) {
- case APPOINTMENT:
+ case APP:
apoint_add();
do_storage = true;
break;
- case TODO:
+ case TOD:
todo_new_item();
if (todo_hilt() == 0 && todo_nb() == 1)
todo_hilt_increase();
@@ -306,49 +304,45 @@ main(int argc, char **argv)
case 'E':
case 'e': /* Edit an existing item */
- if (wins_slctd() == APPOINTMENT && apoint_hilt() != 0)
+ if (wins_slctd() == APP && apoint_hilt() != 0)
day_edit_item();
- else if (wins_slctd() == TODO && todo_hilt() != 0)
+ else if (wins_slctd() == TOD && todo_hilt() != 0)
todo_edit_item();
do_storage = true;
break;
case 'D':
case 'd': /* Delete an item */
- if (wins_slctd() == APPOINTMENT &&
- apoint_hilt() != 0)
+ if (wins_slctd() == APP && apoint_hilt() != 0)
apoint_delete(&conf, &inday.nb_events,
&inday.nb_apoints);
- else if (wins_slctd() == TODO && todo_hilt() != 0)
+ else if (wins_slctd() == TOD && todo_hilt() != 0)
todo_delete(&conf);
do_storage = true;
break;
case 'R':
case 'r':
- if (wins_slctd() == APPOINTMENT &&
- apoint_hilt() != 0)
+ if (wins_slctd() == APP && apoint_hilt() != 0)
recur_repeat_item();
do_storage = true;
break;
case '!':
- if (wins_slctd() == APPOINTMENT &&
- apoint_hilt() != 0)
+ if (wins_slctd() == APP && apoint_hilt() != 0)
apoint_switch_notify();
do_storage = true;
break;
case '+':
case '-':
- if (wins_slctd() == TODO && todo_hilt() != 0) {
+ if (wins_slctd() == TOD && todo_hilt() != 0) {
todo_chg_priority(ch);
if (todo_hilt_pos() < 0)
todo_set_first(todo_hilt());
- else if (todo_hilt_pos() >=
- wins_prop(TODO, HEIGHT) - 4)
+ else if (todo_hilt_pos() >= win[TOD].h - 4)
todo_set_first(todo_hilt() -
- wins_prop(TODO, HEIGHT) + 5);
+ win[TOD].h + 5);
}
break;
@@ -371,7 +365,7 @@ main(int argc, char **argv)
case ('L'):
case ('l'):
case CTRL('L'):
- if (wins_slctd() == CALENDAR || ch == CTRL('L')) {
+ if (wins_slctd() == CAL || ch == CTRL('L')) {
do_storage = true;
day_changed = true;
calendar_move_right();
@@ -382,7 +376,7 @@ main(int argc, char **argv)
case ('H'):
case ('h'):
case CTRL('H'):
- if (wins_slctd() == CALENDAR || ch == CTRL('H')) {
+ if (wins_slctd() == CAL || ch == CTRL('H')) {
do_storage = true;
day_changed = true;
calendar_move_left();
@@ -393,16 +387,16 @@ main(int argc, char **argv)
case ('K'):
case ('k'):
case CTRL('K'):
- if (wins_slctd() == CALENDAR || ch == CTRL('K')) {
+ if (wins_slctd() == CAL || ch == CTRL('K')) {
do_storage = true;
day_changed = true;
calendar_move_up();
} else {
- if ((wins_slctd() == APPOINTMENT) &&
+ if ((wins_slctd() == APP) &&
(apoint_hilt() > 1)) {
apoint_hilt_decrease();
apoint_scroll_pad_up(inday.nb_events);
- } else if ((wins_slctd() == TODO) &&
+ } else if ((wins_slctd() == TOD) &&
(todo_hilt() > 1)) {
todo_hilt_decrease();
if (todo_hilt_pos() < 0)
@@ -415,23 +409,22 @@ main(int argc, char **argv)
case ('J'):
case ('j'):
case CTRL('J'):
- if (wins_slctd() == CALENDAR || ch == CTRL('J')) {
+ if (wins_slctd() == CAL || ch == CTRL('J')) {
do_storage = true;
day_changed = true;
calendar_move_down();
} else {
- if ((wins_slctd() == APPOINTMENT) &&
+ if ((wins_slctd() == APP) &&
(apoint_hilt() < inday.nb_events +
inday.nb_apoints)) {
apoint_hilt_increase();
apoint_scroll_pad_down(inday.nb_events,
- wins_prop(APPOINTMENT, HEIGHT));
+ win[APP].h);
}
- if ((wins_slctd() == TODO) &&
+ if ((wins_slctd() == TOD) &&
(todo_hilt() < todo_nb())) {
todo_hilt_increase();
- if (todo_hilt_pos() ==
- wins_prop(TODO, HEIGHT) - 4)
+ if (todo_hilt_pos() == win[TOD].h - 4)
todo_first_increase();
}
}
@@ -444,7 +437,7 @@ main(int argc, char **argv)
if (conf.confirm_quit) {
status_mesg(_(quit_message), choices);
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
if ( ch == 'y' )
exit_calcurse(EXIT_SUCCESS);
else {
@@ -467,7 +460,7 @@ main(int argc, char **argv)
if (day_changed) {
sav_hilt_app = 0;
day_changed = !day_changed;
- if ((wins_slctd() == APPOINTMENT) &&
+ if ((wins_slctd() == APP) &&
(inday.nb_events + inday.nb_apoints != 0))
apoint_hilt_set(1);
}
diff --git a/src/calendar.c b/src/calendar.c
index 5523634..b13265b 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,4 +1,4 @@
-/* $calcurse: calendar.c,v 1.11 2007/10/16 19:11:10 culot Exp $ */
+/* $calcurse: calendar.c,v 1.12 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -75,7 +75,7 @@ calendar_date_thread(void *arg)
}
calendar_set_current_date();
- calendar_update_panel(cwin);
+ calendar_update_panel(win[CAL].p);
}
pthread_exit((void*) 0);
@@ -347,7 +347,8 @@ calendar_change_day(void)
while (wrong_day) {
status_mesg(request_date, "");
- if (getstring(swin, selected_day, LDAY, 0, 1) == GETSTRING_ESC)
+ if (getstring(win[STA].p, selected_day, LDAY, 0, 1) ==
+ GETSTRING_ESC)
return;
else {
if (strlen(selected_day) == 0) {
@@ -385,7 +386,7 @@ calendar_change_day(void)
if (wrong_day) {
status_mesg(mesg_line1, mesg_line2);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
}
diff --git a/src/day.c b/src/day.c
index c85661f..95635f9 100755
--- a/src/day.c
+++ b/src/day.c
@@ -1,4 +1,4 @@
-/* $calcurse: day.c,v 1.29 2007/08/15 15:37:10 culot Exp $ */
+/* $calcurse: day.c,v 1.30 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -439,10 +439,10 @@ day_edit_time(long time) {
while (1) {
status_mesg(msg_time, "");
timestr = date_sec2hour_str(time);
- updatestring(swin, &timestr, 0, 1);
+ updatestring(win[STA].p, &timestr, 0, 1);
if (check_time(timestr) != 1 || strlen(timestr) == 0) {
status_mesg(fmt_msg, enter_str);
- wgetch(swin);
+ wgetch(win[STA].p);
} else
return timestr;
}
@@ -505,7 +505,7 @@ day_edit_item(void)
rpt = re->rpt;
status_mesg(msg_event_recur, choice_event_recur);
while (ch != STRT && ch != END && ch != ESCAPE)
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
if (ch == ESCAPE)
return;
else
@@ -521,14 +521,14 @@ day_edit_item(void)
status_mesg(msg_recur, choice_recur);
while (ch != STRT && ch != END && ch != DESC &&
ch != REPT && ch != ESCAPE)
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
if (ch == ESCAPE)
return;
break;
case APPT:
status_mesg(msg_norecur, choice_norecur);
while (ch != STRT && ch != END && ch != DESC && ch != ESCAPE)
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
if (ch == ESCAPE)
return;
break;
@@ -547,7 +547,7 @@ day_edit_item(void)
valid_date = 1;
} else {
status_mesg(error_msg, enter_str);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
break;
@@ -566,7 +566,7 @@ day_edit_item(void)
break;
case DESC:
status_mesg(mesg_desc, "");
- updatestring(swin, &p->mesg, 0, 1);
+ updatestring(win[STA].p, &p->mesg, 0, 1);
break;
case REPT:
while ( (ch != 'D') && (ch != 'W') && (ch != 'M')
@@ -574,7 +574,7 @@ day_edit_item(void)
status_mesg(mesg_type_1, mesg_type_2);
typestr = (char *)malloc(sizeof(char) * 2);
*typestr = recur_def2char(rpt->type);
- cancel = updatestring(swin, &typestr, 0, 1);
+ cancel = updatestring(win[STA].p, &typestr, 0, 1);
ch = toupper(*typestr);
free(typestr);
if (cancel)
@@ -584,7 +584,7 @@ day_edit_item(void)
status_mesg(mesg_freq_1, "");
freqstr = (char *) malloc(BUFSIZ);
snprintf(freqstr, BUFSIZ, "%d", rpt->freq);
- cancel = updatestring(swin, &freqstr, 0, 1);
+ cancel = updatestring(win[STA].p, &freqstr, 0, 1);
newfreq = atoi(freqstr);
free(freqstr);
if (cancel)
@@ -592,14 +592,14 @@ day_edit_item(void)
else {
if (newfreq == 0) {
status_mesg(mesg_wrong_freq, enter_str);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
}
while (!date_entered) {
status_mesg(mesg_until_1, "");
timestr = date_sec2date_str(rpt->until);
- cancel = updatestring(swin, &timestr, 0, 1);
+ cancel = updatestring(win[STA].p, &timestr, 0, 1);
if (cancel) {
free(timestr);
return;
@@ -622,14 +622,14 @@ day_edit_item(void)
if (rpt->until < p->start) {
status_mesg(error_msg,
enter_str);
- wgetch(swin);
+ wgetch(win[STA].p);
date_entered = 0;
} else
date_entered = 1;
} else {
status_mesg(mesg_wrong_date,
mesg_possible_fmts);
- wgetch(swin);
+ wgetch(win[STA].p);
date_entered = 0;
}
}
@@ -691,7 +691,7 @@ int day_erase_item(long date, int item_number, int force_erase) {
} else {
while ( (ch != 'a') && (ch != 'o') && (ch != ESCAPE)) {
status_mesg(erase_warning, erase_choice);
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
}
if (ch == 'a') {
delete_whole = 1;
diff --git a/src/io.c b/src/io.c
index 0fd542a..704b007 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.22 2007/09/16 15:41:53 culot Exp $ */
+/* $calcurse: io.c,v 1.23 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -92,14 +92,14 @@ progress_bar(progress_bar_t type, int progress)
}
/* Draw the progress bar. */
- mvwprintw(swin, 1, ipos, barchar);
- mvwprintw(swin, 1, epos[STEPS - 1], barchar);
- custom_apply_attr(swin, ATTR_HIGHEST);
+ mvwprintw(win[STA].p, 1, ipos, barchar);
+ mvwprintw(win[STA].p, 1, epos[STEPS - 1], barchar);
+ custom_apply_attr(win[STA].p, ATTR_HIGHEST);
for (i = ipos + 1; i < epos[progress]; i++)
- mvwaddch(swin, 1, i, ' ' | A_REVERSE);
- custom_remove_attr(swin, ATTR_HIGHEST);
- wmove(swin, 0, 0);
- wrefresh(swin);
+ mvwaddch(win[STA].p, 1, i, ' ' | A_REVERSE);
+ custom_remove_attr(win[STA].p, ATTR_HIGHEST);
+ wmove(win[STA].p, 0, 0);
+ wrefresh(win[STA].p);
usleep(SLEEPTIME);
}
@@ -135,11 +135,11 @@ io_get_export_stream(void)
while (stream == NULL) {
status_mesg(question, "");
- updatestring(swin, &stream_name, 0, 1);
+ updatestring(win[STA].p, &stream_name, 0, 1);
stream = fopen(stream_name, "w");
if (stream == NULL) {
status_mesg(wrong_name, press_enter);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
free(stream_name);
@@ -521,7 +521,7 @@ io_save_cal(conf_t *conf)
/* Print a message telling data were saved */
if (!conf->skip_system_dialogs) {
status_mesg(save_success, enter);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
@@ -685,7 +685,7 @@ io_load_todo(void)
data_file = fopen(path_todo, "r");
if (data_file == NULL) {
status_mesg(mesg_line1, mesg_line2);
- wgetch(swin);
+ wgetch(win[STA].p);
}
for (;;) {
c = getc(data_file);
@@ -767,10 +767,10 @@ io_startup_screen(bool skip_dialogs, int no_data_file)
if (no_data_file != 0) {
status_mesg(welcome_mesg, enter);
- wgetch(swin);
+ wgetch(win[STA].p);
} else if (!skip_dialogs) {
status_mesg(data_mesg, enter);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
@@ -820,6 +820,6 @@ io_export_data(export_mode_t mode, conf_t *conf)
if (!conf->skip_system_dialogs && mode == IO_EXPORT_INTERACTIVE) {
status_mesg(success, enter);
- wgetch(swin);
+ wgetch(win[STA].p);
}
}
diff --git a/src/recur.c b/src/recur.c
index d53eb3c..47db9f2 100755
--- a/src/recur.c
+++ b/src/recur.c
@@ -1,4 +1,4 @@
-/* $calcurse: recur.c,v 1.29 2007/08/15 15:37:31 culot Exp $ */
+/* $calcurse: recur.c,v 1.30 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -608,14 +608,14 @@ recur_repeat_item(void)
p = day_get_item(item_nb);
if (p->type != APPT && p->type != EVNT) {
status_mesg(wrong_type_1, wrong_type_2);
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
return;
}
while ( (ch != 'D') && (ch != 'W') && (ch != 'M')
&& (ch != 'Y') && (ch != ESCAPE) ) {
status_mesg(mesg_type_1, mesg_type_2);
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
ch = toupper(ch);
}
if (ch == ESCAPE) {
@@ -627,12 +627,12 @@ recur_repeat_item(void)
while (freq == 0) {
status_mesg(mesg_freq_1, "");
- if (getstring(swin, user_input, BUFSIZ, 0, 1) ==
+ if (getstring(win[STA].p, user_input, BUFSIZ, 0, 1) ==
GETSTRING_VALID) {
freq = atoi(user_input);
if (freq == 0) {
status_mesg(mesg_wrong_freq, wrong_type_2);
- wgetch(swin);
+ wgetch(win[STA].p);
}
user_input[0] = '\0';
} else
@@ -641,7 +641,8 @@ recur_repeat_item(void)
while (!date_entered) {
status_mesg(mesg_until_1, "");
- if (getstring(swin, user_input, 11, 0, 1) == GETSTRING_VALID) {
+ if (getstring(win[STA].p, user_input, 11, 0, 1) ==
+ GETSTRING_VALID) {
if (strlen(user_input) == 1 &&
strncmp(user_input, "0", 1) == 0 ) {
until = 0;
@@ -660,7 +661,7 @@ recur_repeat_item(void)
if (until < p->start) {
status_mesg(mesg_older,
wrong_type_2);
- wgetch(swin);
+ wgetch(win[STA].p);
date_entered = 0;
} else {
date_entered = 1;
diff --git a/src/todo.c b/src/todo.c
index 2287c4b..d56819a 100755
--- a/src/todo.c
+++ b/src/todo.c
@@ -1,4 +1,4 @@
-/* $calcurse: todo.c,v 1.14 2007/08/15 15:35:25 culot Exp $ */
+/* $calcurse: todo.c,v 1.15 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -124,11 +124,11 @@ todo_new_item(void)
char todo_input[BUFSIZ] = "";
status_mesg(mesg, "");
- if (getstring(swin, todo_input, BUFSIZ, 0, 1) ==
+ if (getstring(win[STA].p, todo_input, BUFSIZ, 0, 1) ==
GETSTRING_VALID) {
while ( (ch < '1') || (ch > '9') ) {
status_mesg(mesg_id, "");
- ch = wgetch(swin);
+ ch = wgetch(win[STA].p);
}
todo_add(todo_input, ch - '0');
todos++;
@@ -191,7 +191,7 @@ todo_delete(conf_t *conf)
if (conf->confirm_delete) {
status_mesg(del_todo_str, choices);
- answer = wgetch(swin);
+ answer = wgetch(win[STA].p);
if ( (answer == 'y') && (todos > 0) ) {
go_for_todo_del = true;
} else {
@@ -290,7 +290,7 @@ todo_edit_item(void)
status_mesg(mesg, "");
i = todo_get_item(hilt);
- updatestring(swin, &i->mesg, 0, 1);
+ updatestring(win[STA].p, &i->mesg, 0, 1);
}
/* Updates the ToDo panel. */
@@ -309,7 +309,8 @@ todo_update_panel(window_t *wintod, int which_pan)
char mesg[BUFSIZ] = "";
/* Print todo item in the panel. */
- erase_window_part(twin, 1, title_lines, wintod->w - 2, wintod->h - 2);
+ erase_window_part(win[TOD].p, 1, title_lines, wintod->w - 2,
+ wintod->h - 2);
for (i = todolist; i != 0; i = i->next) {
num_todo++;
t_realpos = num_todo - first;
@@ -319,7 +320,7 @@ todo_update_panel(window_t *wintod, int which_pan)
if (t_realpos >= 0 && t_realpos < max_items) {
snprintf(mesg, BUFSIZ, "%d. ", i->id);
strncat(mesg, i->mesg, strlen(i->mesg));
- display_item(twin, incolor, mesg, 0,
+ display_item(win[TOD].p, incolor, mesg, 0,
len, y_offset, x_offset);
y_offset = y_offset + todo_lines;
}
@@ -330,14 +331,14 @@ todo_update_panel(window_t *wintod, int which_pan)
float ratio = ((float) max_items) / ((float) todos);
int sbar_length = (int) (ratio * (max_items + 1));
int highend = (int) (ratio * first);
- bool hilt_bar = (which_pan == TODO) ? true : false;
+ bool hilt_bar = (which_pan == TOD) ? true : false;
int sbar_top = highend + title_lines;
if ((sbar_top + sbar_length) > wintod->h - 1)
sbar_length = wintod->h - 1 - sbar_top;
- draw_scrollbar(twin, sbar_top, wintod->w - 2,
+ draw_scrollbar(win[TOD].p, sbar_top, wintod->w - 2,
sbar_length, title_lines, wintod->h - 1, hilt_bar);
}
- wnoutrefresh(twin);
+ wnoutrefresh(win[TOD].p);
}
diff --git a/src/utils.c b/src/utils.c
index 0ad08f2..a571fae 100755
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,4 +1,4 @@
-/* $calcurse: utils.c,v 1.36 2007/09/16 15:40:53 culot Exp $ */
+/* $calcurse: utils.c,v 1.37 2007/10/21 13:42:34 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -94,25 +94,24 @@ aerror(const char *file, int line, const char *assertion)
void
status_mesg(char *mesg_line1, char *mesg_line2)
{
- erase_window_part(swin, 0, 0, col, 2);
- custom_apply_attr(swin, ATTR_HIGHEST);
- mvwprintw(swin, 0, 0, mesg_line1);
- mvwprintw(swin, 1, 0, mesg_line2);
- custom_remove_attr(swin, ATTR_HIGHEST);
+ erase_window_part(win[STA].p, 0, 0, col, 2);
+ custom_apply_attr(win[STA].p, ATTR_HIGHEST);
+ mvwprintw(win[STA].p, 0, 0, mesg_line1);
+ mvwprintw(win[STA].p, 1, 0, mesg_line2);
+ custom_remove_attr(win[STA].p, ATTR_HIGHEST);
}
/* Erase status bar. */
void
erase_status_bar(void)
{
- erase_window_part(swin, 0, 0, col, STATUSHEIGHT);
+ erase_window_part(win[STA].p, 0, 0, col, STATUSHEIGHT);
}
-/*
- * Erase part of a window
- */
-void erase_window_part(WINDOW *win, int first_col, int first_row,
- int last_col, int last_row)
+/* Erase part of a window. */
+void
+erase_window_part(WINDOW *win, int first_col, int first_row, int last_col,
+ int last_row)
{
int c, r;
@@ -148,7 +147,7 @@ WINDOW * popup(int pop_row, int pop_col,
/* prints in middle of a panel */
void
-print_in_middle(WINDOW * win, int starty, int startx, int width, char *string)
+print_in_middle(WINDOW *win, int starty, int startx, int width, char *string)
{
int length, x, y;
float temp;
@@ -436,20 +435,23 @@ status_bar(void)
/* Drawing the keybinding with attribute and label without. */
erase_status_bar();
which_pan = wins_slctd();
- start = pos[which_pan] + 2*CMDS_PER_LINE*(status_page - 1);
- end = MIN(start + 2*CMDS_PER_LINE, pos[which_pan + 1]);
+ start = pos[which_pan] + 2 * CMDS_PER_LINE * (status_page - 1);
+ end = MIN(start + 2 * CMDS_PER_LINE, pos[which_pan + 1]);
for (i = start; i < end; i += 2) {
- custom_apply_attr(swin, ATTR_HIGHEST);
- mvwprintw(swin, 0, j*cmd_length, binding[i]->key);
+ custom_apply_attr(win[STA].p, ATTR_HIGHEST);
+ mvwprintw(win[STA].p, 0, j * cmd_length, binding[i]->key);
if (i + 1 != end)
- mvwprintw(swin, 1, j*cmd_length, binding[i+1]->key);
- custom_remove_attr(swin, ATTR_HIGHEST);
- mvwprintw(swin,0,j*cmd_length+KEY_LENGTH,binding[i]->label);
+ mvwprintw(win[STA].p, 1, j * cmd_length,
+ binding[i+1]->key);
+ custom_remove_attr(win[STA].p, ATTR_HIGHEST);
+ mvwprintw(win[STA].p, 0 , j * cmd_length + KEY_LENGTH,
+ binding[i]->label);
if (i + 1 != end)
- mvwprintw(swin,1,j*cmd_length+KEY_LENGTH,binding[i+1]->label);
+ mvwprintw(win[STA].p, 1, j * cmd_length + KEY_LENGTH,
+ binding[i+1]->label);
j++;
}
- wnoutrefresh(swin);
+ wnoutrefresh(win[STA].p);
}
long
@@ -732,7 +734,7 @@ void item_in_popup(char *saved_a_start, char *saved_a_end, char *msg,
saved_a_start, saved_a_end);
}
mvwprintw(pad, 0, margin_left, "%s", msg);
- wmove(swin, 0, 0);
+ wmove(win[STA].p, 0, 0);
pnoutrefresh(pad, 0, 0, margin_top + 2, margin_left, padl, winw);
doupdate();
wgetch(popup_win);
@@ -780,13 +782,13 @@ void other_status_page(int panel)
char *error = _("FATAL ERROR in other_status_page: unknown panel\n");
switch (panel) {
- case CALENDAR:
+ case CAL:
nb_item = NB_CAL_CMDS;
break;
- case APPOINTMENT:
+ case APP:
nb_item = NB_APP_CMDS;
break;
- case TODO:
+ case TOD:
nb_item = NB_TOD_CMDS;
break;
default: