more work on updating online help pages

This commit is contained in:
Frederic Culot 2008-12-03 19:31:03 +00:00
parent 86d1a3b2db
commit cf5617e337
4 changed files with 239 additions and 178 deletions

View File

@ -1,3 +1,15 @@
2008-12-03 Frederic Culot <frederic@culot.org>
* src/help.c (help_screen): help texts size overflow fixed
2008-12-02 Frederic Culot <frederic@culot.org>
* src/help.c (help_screen): help pages updated
2008-11-30 Frederic Culot <frederic@culot.org>
* src/io.c (is_blank): new function
2008-11-29 Frederic Culot <frederic@culot.org> 2008-11-29 Frederic Culot <frederic@culot.org>
* src/help.c (help_write_pad): updated to display key bindings * src/help.c (help_write_pad): updated to display key bindings

View File

@ -1,4 +1,4 @@
/* $calcurse: help.c,v 1.33 2008/11/30 20:48:10 culot Exp $ */ /* $calcurse: help.c,v 1.34 2008/12/03 19:31:03 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -85,19 +85,45 @@ get_help_lines (char *text)
static int static int
help_write_pad (window_t *win, char *title, char *text, keys_e action) help_write_pad (window_t *win, char *title, char *text, keys_e action)
{ {
int nl_title, nl_text; int colnum, rownum;
const int nl_bindings = 2; char *bindings_title = "key bindings: %s";
char *bindings;
nl_text = get_help_lines (text); colnum = 0;
nl_title = get_help_lines (title); rownum = 0;
erase_window_part (win->p, 0, 0, BUFSIZ, win->w); erase_window_part (win->p, rownum, colnum, BUFSIZ, win->w);
custom_apply_attr (win->p, ATTR_HIGHEST); custom_apply_attr (win->p, ATTR_HIGHEST);
mvwprintw (win->p, 0, 0, "%s", title); mvwprintw (win->p, rownum, colnum, "%s", title);
mvwprintw (win->p, nl_title, 0, "key bindings: %s", switch (action)
keys_action_allkeys (action)); {
case KEY_END_OF_WEEK:
case KEY_START_OF_WEEK:
case KEY_MOVE_UP:
case KEY_MOVE_DOWN:
case KEY_MOVE_RIGHT:
case KEY_MOVE_LEFT:
case KEY_GENERIC_HELP:
case KEY_GENERIC_REDRAW:
case KEY_GENERIC_ADD_APPT:
case KEY_GENERIC_ADD_TODO:
case KEY_GENERIC_NEXT_DAY:
case KEY_GENERIC_PREV_DAY:
case KEY_GENERIC_NEXT_WEEK:
case KEY_GENERIC_PREV_WEEK:
case KEY_GENERIC_GOTO_TODAY:
case KEY_GENERIC_CREDITS:
break;
default:
bindings = keys_action_allkeys (action);
colnum = win->w - strlen (bindings_title) - strlen (bindings);
mvwprintw (win->p, rownum, colnum, bindings_title, bindings);
}
colnum = 0;
rownum += get_help_lines (title);
custom_remove_attr (win->p, ATTR_HIGHEST); custom_remove_attr (win->p, ATTR_HIGHEST);
mvwprintw (win->p, nl_title + nl_bindings, 0, "%s", text); mvwprintw (win->p, rownum, colnum, "%s", text);
return nl_text + nl_title + nl_bindings; rownum += get_help_lines (text);
return rownum;
} }
/* /*
@ -269,52 +295,60 @@ wanted_page (int ch)
void void
help_screen (void) help_screen (void)
{ {
enum {
MOVE_UP,
MOVE_DOWN,
MOVE_LEFT,
MOVE_RIGHT,
DIRECTIONS
};
scrollwin_t hwin; scrollwin_t hwin;
int need_resize; int need_resize;
keys_e ch = KEY_GENERIC_HELP; keys_e ch = KEY_GENERIC_HELP;
int page, oldpage; int page, oldpage;
help_page_t hscr[HELPSCREENS]; help_page_t hscr[HELPSCREENS];
char keystr[DIRECTIONS][BUFSIZ];
hscr[HELP_MAIN].title = hscr[HELP_MAIN].title =
_(" Welcome to Calcurse. This is the main help screen.\n"); _(" Welcome to Calcurse. This is the main help screen.\n");
snprintf (hscr[HELP_MAIN].text, BUFSIZ, snprintf (hscr[HELP_MAIN].text, HELPTEXTSIZ,
_(" Moving around: Press '%s' or '%s' to scroll text upward or\n" _("Moving around: Press '%s' or '%s' to scroll text upward or downward\n"
" downward inside help screens, if necessary.\n\n" " inside help screens, if necessary.\n\n"
" Exit help: When finished, press '%s' to exit help and go back\n" " Exit help: When finished, press '%s' to exit help and go back to\n"
" to the main Calcurse screen.\n\n" " the main Calcurse screen.\n\n"
" Help topic: At the bottom of this screen you can see a panel\n" " Help topic: At the bottom of this screen you can see a panel with\n"
" with different fields, represented by a letter and\n" " different fields, represented by a letter and a short\n"
" a short title. This panel contains all the available\n" " title. This panel contains all the available actions\n"
" actions you can perform when using Calcurse.\n" " you can perform when using Calcurse.\n"
" By pressing one of the letters appearing in this\n" " By pressing one of the letters appearing in this\n"
" panel, you will be shown a short description of the\n" " panel, you will be shown a short description of the\n"
" corresponding action.\n\n" " corresponding action. At the top right side of the\n"
" Credits: Press '%s' for credits."), " description screen are indicated the user-defined key\n"
" bindings that lead to the action.\n\n"
" Credits: Press '%s' for credits."),
keys_action_firstkey (KEY_GENERIC_SCROLL_UP), keys_action_firstkey (KEY_GENERIC_SCROLL_UP),
keys_action_firstkey (KEY_GENERIC_SCROLL_DOWN), keys_action_firstkey (KEY_GENERIC_SCROLL_DOWN),
keys_action_firstkey (KEY_GENERIC_QUIT), keys_action_firstkey (KEY_GENERIC_QUIT),
keys_action_firstkey (KEY_GENERIC_CREDITS)); keys_action_firstkey (KEY_GENERIC_CREDITS));
hscr[HELP_SAVE].title = _("Save:\n"); hscr[HELP_SAVE].title = _("Save\n");
snprintf (hscr[HELP_SAVE].text, BUFSIZ, snprintf (hscr[HELP_SAVE].text, HELPTEXTSIZ,
_("Pressing '%s' saves the Calcurse data.\n\n" _("Save calcurse data.\n"
"The data is splitted into four different files which contain :" "Data are splitted into four different files which contain :"
"\n\n" "\n\n"
" / ~/.calcurse/conf -> the user configuration\n" " / ~/.calcurse/conf -> user configuration\n"
" | (layout, color, general options)\n" " | (layout, color, general options)\n"
" | ~/.calcurse/apts -> the data related to the appointments\n" " | ~/.calcurse/apts -> data related to the appointments\n"
" | ~/.calcurse/todo -> the data related to the todo list\n" " | ~/.calcurse/todo -> data related to the todo list\n"
" \\ ~/.calcurse/keys -> user-defined keybindings\n" " \\ ~/.calcurse/keys -> user-defined key bindings\n"
"\nIn the config menu, you can choose to save the Calcurse data\n" "\nIn the config menu, you can choose to save the Calcurse data\n"
"automatically before quitting."), "automatically before quitting."));
keys_action_firstkey (KEY_GENERIC_SAVE));
hscr[HELP_IMPORT].title = _("Import:\n"); hscr[HELP_IMPORT].title = _("Import\n");
snprintf (hscr[HELP_IMPORT].text, BUFSIZ, snprintf (hscr[HELP_IMPORT].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to import data from an icalendar file.\n" _("Import data from an icalendar file.\n"
"You are asked to enter the file name from which to load ical items.\n\n" "You will be asked to enter the file name from which to load ical\n"
"At the end of the import process, and if the general option\n" "items. At the end of the import process, and if the general option\n"
"'skip_system_dialogs' is not set to 'yes', a report indicating how\n" "'skip_system_dialogs' is not set to 'yes', a report indicating how\n"
"many items were imported is shown.\n" "many items were imported is shown.\n"
"This report contains the total number of lines read, the number of\n" "This report contains the total number of lines read, the number of\n"
@ -326,59 +360,71 @@ help_screen (void)
"occured.\n" "occured.\n"
"In this report is shown one item per line, with the line in the input\n" "In this report is shown one item per line, with the line in the input\n"
"stream at which this item begins, together with the description of why\n" "stream at which this item begins, together with the description of why\n"
"the item could not be imported.\n"), "the item could not be imported.\n"));
keys_action_firstkey (KEY_GENERIC_IMPORT));
hscr[HELP_EXPORT].title = _("Export:\n"); hscr[HELP_EXPORT].title = _("Export\n");
snprintf (hscr[HELP_EXPORT].text, BUFSIZ, snprintf (hscr[HELP_EXPORT].text, HELPTEXTSIZ,
_("Pressing '%s' leads to the export submenu, from which you can choose\n" _("Export calcurse data (appointments, events and todos).\n"
"between two different export formats: 'ical' and 'pcal'.\n" "This leads to the export submenu, from which you can choose between\n"
"Choosing one of those formats lets you export the Calcurse data to\n" "two different export formats: 'ical' and 'pcal'. Choosing one of\n"
"icalendar or pcal format.\n\n" "those formats lets you export calcurse data to icalendar or pcal\n"
"format.\n\n"
"You first need to specify the file to which the data will be exported.\n" "You first need to specify the file to which the data will be exported.\n"
"By default, this file is:\n\n" "By default, this file is:\n\n"
" ~/calcurse.ics\n\n" " ~/calcurse.ics\n\n"
"for an ical export, and:\n\n" "for an ical export, and:\n\n"
" ~/calcurse.txt\n\n" " ~/calcurse.txt\n\n"
"for a pcal export.\n" "for a pcal export.\n\n"
"All of the calcurse data are exported, in the following order:\n" "Calcurse data are exported in the following order:\n"
"events, appointments, todos.\n"), " events, appointments, todos.\n"));
keys_action_firstkey (KEY_GENERIC_EXPORT));
hscr[HELP_DISPLACEMENT].title = _("Displacement keys:\n"); strncpy (keystr[MOVE_UP], keys_action_allkeys (KEY_MOVE_UP), BUFSIZ);
snprintf (hscr[HELP_DISPLACEMENT].text, BUFSIZ, strncpy (keystr[MOVE_DOWN], keys_action_allkeys (KEY_MOVE_DOWN), BUFSIZ);
_("You can use either 'H','J','K','L' or the arrow keys '<','v','^','>'\n" strncpy (keystr[MOVE_LEFT], keys_action_allkeys (KEY_MOVE_LEFT), BUFSIZ);
"to move into the calendar.\n\n" strncpy (keystr[MOVE_RIGHT], keys_action_allkeys (KEY_MOVE_RIGHT), BUFSIZ);
"The following scheme explains how :\n\n" hscr[HELP_DISPLACEMENT].title = _("Displacement keys\n");
" move to previous week\n" snprintf (hscr[HELP_DISPLACEMENT].text, HELPTEXTSIZ,
" K ^ \n" _("Move around inside calcurse screens.\n"
" move to previous day H < > L move to next day\n" "The following scheme summarizes how to get around:\n\n"
" J v \n" " move up\n"
" move to next week\n" " move to previous week\n"
"\nMoreover, while inside the calendar panel, the '0' (zero) key moves\n" "\n"
"to the first day of the week, and the '$' key selects the last day of\n" " %s\n"
"the week.\n" " move left ^ \n"
"\nWhen the Appointment or ToDo panel is selected, the up and down keys\n" " move to previous day |\n"
"(respectively K or up arrow, and J or down arrow) allows you to select\n" " %s\n"
"an item from those lists.")); " <-- + -->\n"
" %s\n"
" | move right\n"
" v move to next day\n"
" %s\n"
"\n"
" move to next week\n"
" move down\n"
"\nMoreover, while inside the calendar panel, the '%s' key moves\n"
"to the first day of the week, and the '%s' key selects the last day of\n"
"the week.\n"),
keystr[MOVE_UP], keystr[MOVE_LEFT],
keystr[MOVE_RIGHT], keystr[MOVE_DOWN],
keys_action_firstkey (KEY_START_OF_WEEK),
keys_action_firstkey (KEY_END_OF_WEEK));
hscr[HELP_VIEW].title = _("View:\n"); hscr[HELP_VIEW].title = _("View\n");
snprintf (hscr[HELP_VIEW].text, BUFSIZ, snprintf (hscr[HELP_VIEW].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to view the item you select in either the ToDo\n" _("View the item you select in either the Todo or Appointment panel.\n"
"or Appointment panel.\n"
"\nThis is usefull when an event description is longer than the " "\nThis is usefull when an event description is longer than the "
"available\n space to display it. " "available\nspace to display it. "
"If that is the case, the description will be\n" "If that is the case, the description will be\n"
"shortened and its end replaced by '...'. To be able to read the entire\n" "shortened and its end replaced by '...'. To be able to read the entire\n"
"description, just press 'V' and a popup window will appear, containing\n" "description, just press '%s' and a popup window will appear, containing\n"
"the whole event.\n" "the whole event.\n"
"\nPress any key to close the popup window and go back to the main\n" "\nPress any key to close the popup window and go back to the main\n"
"Calcurse screen."), "Calcurse screen."),
keys_action_firstkey (KEY_VIEW_ITEM)); keys_action_firstkey (KEY_VIEW_ITEM));
hscr[HELP_TAB].title = _("Tab:\n"); hscr[HELP_TAB].title = _("Tab\n");
snprintf (hscr[HELP_TAB].text, BUFSIZ, snprintf (hscr[HELP_TAB].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to switch between panels.\n" _("Switch between panels.\n"
"The panel currently in use has its border colorized.\n" "The panel currently in use has its border colorized.\n"
"\nSome actions are possible only if the right panel is selected.\n" "\nSome actions are possible only if the right panel is selected.\n"
"For example, if you want to add a task in the TODO list, you need first" "For example, if you want to add a task in the TODO list, you need first"
@ -387,26 +433,24 @@ help_screen (void)
"\nNotice that at the bottom of the screen the list of possible actions\n" "\nNotice that at the bottom of the screen the list of possible actions\n"
"change while pressing '%s', so you always know what action can be\n" "change while pressing '%s', so you always know what action can be\n"
"performed on the selected panel."), "performed on the selected panel."),
keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW),
keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW), keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW),
keys_action_firstkey (KEY_ADD_ITEM), keys_action_firstkey (KEY_ADD_ITEM),
keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW)); keys_action_firstkey (KEY_GENERIC_CHANGE_VIEW));
hscr[HELP_GOTO].title = _("Goto:\n"); hscr[HELP_GOTO].title = _("Goto\n");
snprintf (hscr[HELP_GOTO].text, BUFSIZ, snprintf (hscr[HELP_GOTO].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to jump to a specific day in the calendar.\n" _("Jump to a specific day in the calendar.\n"
"\nUsing this command, you do not need to travel to that day using\n" "\nUsing this command, you do not need to travel to that day using\n"
"the displacement keys inside the calendar panel.\n" "the displacement keys inside the calendar panel.\n"
"If you hit [ENTER] without specifying any date, Calcurse checks the\n" "If you hit [ENTER] without specifying any date, Calcurse checks the\n"
"system current date and you will be taken to that date.\n" "system current date and you will be taken to that date.\n"
"\nNotice that pressing '%s', whatever panel is\n" "\nNotice that pressing '%s', whatever panel is\n"
"selected, will select current day in the calendar."), "selected, will select current day in the calendar."),
keys_action_firstkey (KEY_GENERIC_GOTO),
keys_action_firstkey (KEY_GENERIC_GOTO_TODAY)); keys_action_firstkey (KEY_GENERIC_GOTO_TODAY));
hscr[HELP_DELETE].title = _("Delete:\n"); hscr[HELP_DELETE].title = _("Delete\n");
snprintf (hscr[HELP_DELETE].text, BUFSIZ, snprintf (hscr[HELP_DELETE].text, HELPTEXTSIZ,
_("Pressing '%s' deletes an element in the ToDo or Appointment list.\n" _("Delete an element in the ToDo or Appointment list.\n"
"\nDepending on which panel is selected when you press the delete key,\n" "\nDepending on which panel is selected when you press the delete key,\n"
"the hilighted item of either the ToDo or Appointment list will be \n" "the hilighted item of either the ToDo or Appointment list will be \n"
"removed from this list.\n" "removed from this list.\n"
@ -416,19 +460,18 @@ help_screen (void)
"\nIf the general option 'confirm_delete' is set to 'YES', then you will" "\nIf the general option 'confirm_delete' is set to 'YES', then you will"
"\nbe asked for confirmation before deleting the selected event.\n" "\nbe asked for confirmation before deleting the selected event.\n"
"Do not forget to save the calendar data to retrieve the modifications\n" "Do not forget to save the calendar data to retrieve the modifications\n"
"next time you launch Calcurse."), "next time you launch Calcurse."));
keys_action_firstkey (KEY_DEL_ITEM));
hscr[HELP_ADD].title = _("Add:\n"); hscr[HELP_ADD].title = _("Add\n");
snprintf (hscr[HELP_ADD].text, BUFSIZ, snprintf (hscr[HELP_ADD].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to add an item in either the ToDo or Appointment" _("Add an item in either the ToDo or Appointment list, depending on which\n"
"\nlist, depending on which panel is selected when you press '%s'.\n" "panel is selected when you press '%s'.\n"
"\nTo enter a new item in the TODO list, you will need first to enter the" "\nTo enter a new item in the TODO list, you will need first to enter the"
"\ndescription of this new item. Then you will be asked to specify the " "\ndescription of this new item. Then you will be asked to specify the "
"todo\npriority. This priority is represented by a number going from 9 " "todo\npriority. This priority is represented by a number going from 9 "
"for the\nlowest priority, to 1 for the highest one. It is still " "for the\nlowest priority, to 1 for the highest one. It is still "
"possible to\nchange the item priority afterwards, by using the '+/-' " "possible to\nchange the item priority afterwards, by using the '%s' and "
"keys inside the\ntodo panel.\n" "'%s' keys\ninside the todo panel.\n"
"\nIf the APPOINTMENT panel is selected while pressing '%s', you will be\n" "\nIf the APPOINTMENT panel is selected while pressing '%s', you will be\n"
"able to enter either a new appointment or a new all-day long event.\n" "able to enter either a new appointment or a new all-day long event.\n"
"To enter a new event, press [ENTER] instead of the item start time, " "To enter a new event, press [ENTER] instead of the item start time, "
@ -451,13 +494,14 @@ help_screen (void)
" o do not forget to save the calendar data to retrieve the new\n" " o do not forget to save the calendar data to retrieve the new\n"
" event next time you launch Calcurse."), " event next time you launch Calcurse."),
keys_action_firstkey (KEY_ADD_ITEM), keys_action_firstkey (KEY_ADD_ITEM),
keys_action_firstkey (KEY_ADD_ITEM), keys_action_firstkey (KEY_RAISE_PRIORITY),
keys_action_firstkey (KEY_LOWER_PRIORITY),
keys_action_firstkey (KEY_ADD_ITEM), keys_action_firstkey (KEY_ADD_ITEM),
keys_action_firstkey (KEY_ADD_ITEM)); keys_action_firstkey (KEY_ADD_ITEM));
hscr[HELP_EDIT].title = _("Edit Item:\n"); hscr[HELP_EDIT].title = _("Edit Item\n");
snprintf (hscr[HELP_EDIT].text, BUFSIZ, snprintf (hscr[HELP_EDIT].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to edit the item which is currently selected.\n" _("Edit the item which is currently selected.\n"
"Depending on the item type (appointment, event, or todo), and if it is\n" "Depending on the item type (appointment, event, or todo), and if it is\n"
"repeated or not, you will be asked to choose one of the item properties" "repeated or not, you will be asked to choose one of the item properties"
"\nto modify. An item property is one of the following: the start time, " "\nto modify. An item property is one of the following: the start time, "
@ -470,17 +514,15 @@ help_screen (void)
" (repetition type, frequence, and ending date). Moreover, the\n" " (repetition type, frequence, and ending date). Moreover, the\n"
" previous data concerning the deleted occurences will be lost.\n" " previous data concerning the deleted occurences will be lost.\n"
" o do not forget to save the calendar data to retrieve the\n" " o do not forget to save the calendar data to retrieve the\n"
" modified properties next time you launch Calcurse."), " modified properties next time you launch Calcurse."));
keys_action_firstkey (KEY_EDIT_ITEM));
hscr[HELP_ENOTE].title = _("EditNote:\n"); hscr[HELP_ENOTE].title = _("EditNote\n");
snprintf (hscr[HELP_ENOTE].text, BUFSIZ, snprintf (hscr[HELP_ENOTE].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to attach a note to any type of item, or to\n" _("Attach a note to any type of item, or edit an already existing note.\n"
"edit an already existing note.\n"
"This feature is useful if you do not have enough space to store all\n" "This feature is useful if you do not have enough space to store all\n"
"of your item description, or if you would like to add sub-tasks to an\n" "of your item description, or if you would like to add sub-tasks to an\n"
"already existing todo item for example.\n" "already existing todo item for example.\n"
"Before pressing the 'N' key, you first need to highlight the item you\n" "Before pressing the '%s' key, you first need to highlight the item you\n"
"want the note to be attached to. Then you will be driven to an\n" "want the note to be attached to. Then you will be driven to an\n"
"external editor to edit your note. This editor is chosen the following\n" "external editor to edit your note. This editor is chosen the following\n"
"way:\n" "way:\n"
@ -495,12 +537,12 @@ help_screen (void)
"\nof the highlighted item, meaning there is a note attached to it."), "\nof the highlighted item, meaning there is a note attached to it."),
keys_action_firstkey (KEY_EDIT_NOTE)); keys_action_firstkey (KEY_EDIT_NOTE));
hscr[HELP_VNOTE].title = _("ViewNote:\n"); hscr[HELP_VNOTE].title = _("ViewNote\n");
snprintf (hscr[HELP_VNOTE].text, BUFSIZ, snprintf (hscr[HELP_VNOTE].text, HELPTEXTSIZ,
_("Pressing the '%s' key allows you to view a note which was previously\n" _("View a note which was previously attached to an item (an item which\n"
"attached to an item (an item which owns a note has a '>' sign in front\n" "owns a note has a '>' sign in front of it).\n"
"of it). This command only permits to view the note, not to\n" "This command only permits to view the note, not to edit it (to do so,\n"
"edit it (to do so, use the 'EditNote' command, using the '%s' key).\n" "use the 'EditNote' command, by pressing the '%s' key).\n"
"Once you highlighted an item with a note attached to it, and the '%s' key" "Once you highlighted an item with a note attached to it, and the '%s' key"
"\nwas pressed, you will be driven to an external pager to view that " "\nwas pressed, you will be driven to an external pager to view that "
"note.\n" "note.\n"
@ -509,20 +551,18 @@ help_screen (void)
" the default viewer to be called.\n" " the default viewer to be called.\n"
" o if the above environment variable is not set, then\n" " o if the above environment variable is not set, then\n"
" '/usr/bin/less' will be used.\n" " '/usr/bin/less' will be used.\n"
"As for the '%s' key, quit the pager and you will be driven back to\n" "As for editing a note, quit the pager and you will be driven back to\n"
"Calcurse."), "Calcurse."),
keys_action_firstkey (KEY_VIEW_NOTE),
keys_action_firstkey (KEY_EDIT_NOTE), keys_action_firstkey (KEY_EDIT_NOTE),
keys_action_firstkey (KEY_VIEW_NOTE), keys_action_firstkey (KEY_VIEW_NOTE));
keys_action_firstkey (KEY_EDIT_NOTE));
hscr[HELP_PRIORITY].title = _("Priority:\n"); hscr[HELP_PRIORITY].title = _("Priority\n");
snprintf (hscr[HELP_PRIORITY].text, BUFSIZ, snprintf (hscr[HELP_PRIORITY].text, HELPTEXTSIZ,
_("Pressing '%s' or '%s' allows you to change the priority of the currently\n" _("Change the priority of the currently selected item in the ToDo list.\n"
"selected item in the ToDo list. Priorities are represented by the " "Priorities are represented by the number appearing in front of the\n"
"number\nappearing in front of the todo description. This number goes " "todo description. This number goes from 9 for the lowest priority to\n"
"from 9 for\nthe lowest priority to 1 for the highest priority. " "1 for the highest priority.\n"
"Todo having higher\npriorities are placed first (at the top) inside the " "Todo having higher priorities are placed first (at the top) inside the\n"
"todo panel.\n\n" "todo panel.\n\n"
"If you want to raise the priority of a todo item, you need to press " "If you want to raise the priority of a todo item, you need to press "
"'%s'.\n" "'%s'.\n"
@ -531,18 +571,16 @@ help_screen (void)
"panel may change,\ndepending on the priority of the items above it.\n\n" "panel may change,\ndepending on the priority of the items above it.\n\n"
"At the opposite, to lower a todo priority, press '%s'. The todo position" "At the opposite, to lower a todo priority, press '%s'. The todo position"
"\nmay also change depending on the priority of the items below."), "\nmay also change depending on the priority of the items below."),
keys_action_firstkey (KEY_RAISE_PRIORITY),
keys_action_firstkey (KEY_LOWER_PRIORITY),
keys_action_firstkey (KEY_RAISE_PRIORITY), keys_action_firstkey (KEY_RAISE_PRIORITY),
keys_action_firstkey (KEY_LOWER_PRIORITY)); keys_action_firstkey (KEY_LOWER_PRIORITY));
hscr[HELP_REPEAT].title = _("Repeat:\n"); hscr[HELP_REPEAT].title = _("Repeat\n");
snprintf (hscr[HELP_REPEAT].text, BUFSIZ, snprintf (hscr[HELP_REPEAT].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to repeat an event or an appointment. You must\n" _("Repeat an event or an appointment.\n"
"first select the item to be repeated by moving inside the appointment\n" "You must first select the item to be repeated by moving inside the\n"
"panel. " "appointment panel. Then pressing '%s' will lead you to a set of three\n"
"Then pressing '%s' will lead you to a set of three questions, with\n" "questions, with which you will be able to specify the repetition\n"
"which you will be able to specify the repetition characteristics:\n\n" "characteristics:\n\n"
" o type: you can choose between a daily, weekly, monthly or\n" " o type: you can choose between a daily, weekly, monthly or\n"
" yearly repetition by pressing 'D', 'W', 'M' or 'Y'\n" " yearly repetition by pressing 'D', 'W', 'M' or 'Y'\n"
" respectively.\n\n" " respectively.\n\n"
@ -561,70 +599,72 @@ help_screen (void)
" o the 'Repeat' and 'Delete' command can be mixed to create\n" " o the 'Repeat' and 'Delete' command can be mixed to create\n"
" complicated configurations, as it is possible to delete only\n" " complicated configurations, as it is possible to delete only\n"
" one occurence of a repeated item."), " one occurence of a repeated item."),
keys_action_firstkey (KEY_REPEAT_ITEM),
keys_action_firstkey (KEY_REPEAT_ITEM)); keys_action_firstkey (KEY_REPEAT_ITEM));
hscr[HELP_FLAG].title = _("Flag Item:\n"); hscr[HELP_FLAG].title = _("Flag Item\n");
snprintf (hscr[HELP_FLAG].text, BUFSIZ, snprintf (hscr[HELP_FLAG].text, HELPTEXTSIZ,
_("Pressing '%s' toggles an appointment's 'important' flag.\n\n" _("Toggle an appointment's 'important' flag.\n"
"If an item is flagged as important, an exclamation mark appears in front" "If an item is flagged as important, an exclamation mark appears in front"
"\nof it, and you will be warned if time gets closed to the appointment\n" "\nof it, and you will be warned if time gets closed to the appointment\n"
"start time.\n" "start time.\n"
"To customize the way one gets notified, the configuration submenu lets\n" "To customize the way one gets notified, the configuration submenu lets\n"
"you choose the command launched to warn user of an upcoming appointment," "you choose the command launched to warn user of an upcoming appointment,"
"\nand how long before it he gets notified."), "\nand how long before it he gets notified."));
keys_action_firstkey (KEY_FLAG_ITEM));
hscr[HELP_CONFIG].title = _("Config:\n"); hscr[HELP_CONFIG].title = _("Config\n");
snprintf (hscr[HELP_CONFIG].text, BUFSIZ, snprintf (hscr[HELP_CONFIG].text, HELPTEXTSIZ,
_("Pressing '%s' leads to the configuration submenu, from which you can\n" _("Open the configuration submenu.\n"
"select between color, layout, notification and general options, and\n" "From this submenu, you can select between color, layout, notification\n"
"you can also configure your keybindings.\n" "and general options, and you can also configure your keybindings.\n"
"\nThe color submenu lets you choose the color theme.\n" "\nThe color submenu lets you choose the color theme.\n"
"\nThe layout submenu lets you choose the Calcurse screen layout, in other" "The layout submenu lets you choose the Calcurse screen layout, in other"
"\nwords where to place the three different panels on the screen.\n" "\nwords where to place the three different panels on the screen.\n"
"\nThe general options submenu brings a screen with the different options" "The general options submenu brings a screen with the different options"
"\nwhich modifies the way Calcurse interacts with the user.\n" "\nwhich modifies the way Calcurse interacts with the user.\n"
"\nThe notify submenu allows you to change the notify-bar settings.\n" "The notify submenu allows you to change the notify-bar settings.\n"
"\nThe keys submenu lets you define your own keybindins.\n" "The keys submenu lets you define your own key bindings.\n"
"\nDo not forget to save the calendar data to retrieve your configuration" "\nDo not forget to save the calendar data to retrieve your configuration"
"\nnext time you launch Calcurse."), "\nnext time you launch Calcurse."));
keys_action_firstkey (KEY_GENERIC_CONFIG_MENU));
hscr[HELP_GENERAL].title = _("General keybindings:\n"); hscr[HELP_GENERAL].title = _("Generic keybindings\n");
snprintf (hscr[HELP_GENERAL].text, BUFSIZ, snprintf (hscr[HELP_GENERAL].text, HELPTEXTSIZ,
_("Some of the keybindings apply whatever panel is selected. They are\n" _("Some of the keybindings apply whatever panel is selected. They are\n"
"called general keybinding and involve the <CONTROL> key, which is\n" "called generic keybinding.\n"
"represented by the '^' sign in the status bar panel. For example,\n" "Here is the list of all the generic key bindings, together with their\n"
"'^A' means you need to press <CONTROL> and 'A' simultaneously to\n" "corresponding action:\n\n"
"activate the command. Here is the list of all the general keybindings,\n" " '%s' : Redraw function -> redraws calcurse panels, this is useful if\n"
"together with their corresponding action:\n\n"
" '^R' : Redraw function -> redraws calcurse panels, this is useful if\n"
" you resize your terminal screen or when\n" " you resize your terminal screen or when\n"
" garbage appears inside the display\n" " garbage appears inside the display\n"
" '^A' : Add Appointment -> add an appointment or an event\n" " '%s' : Add Appointment -> add an appointment or an event\n"
" '^T' : Add ToDo -> add a todo\n" " '%s' : Add ToDo -> add a todo\n"
" '^H' : -1 Day -> move to previous day\n" " '%s' : -1 Day -> move to previous day\n"
" '^L' : +1 Day -> move to next day\n" " '%s' : +1 Day -> move to next day\n"
" '^K' : -1 Week -> move to previous week\n" " '%s' : -1 Week -> move to previous week\n"
" '^J' : +1 Week -> move to next week\n" " '%s' : +1 Week -> move to next week\n"
" '^G' : Goto today -> move to current day")); " '%s' : Goto today -> move to current day"),
keys_action_firstkey (KEY_GENERIC_REDRAW),
keys_action_firstkey (KEY_GENERIC_ADD_APPT),
keys_action_firstkey (KEY_GENERIC_ADD_TODO),
keys_action_firstkey (KEY_GENERIC_PREV_DAY),
keys_action_firstkey (KEY_GENERIC_NEXT_DAY),
keys_action_firstkey (KEY_GENERIC_PREV_WEEK),
keys_action_firstkey (KEY_GENERIC_NEXT_WEEK),
keys_action_firstkey (KEY_GENERIC_GOTO_TODAY));
hscr[HELP_OTHER].title = _("OtherCmd:\n"); hscr[HELP_OTHER].title = _("OtherCmd\n");
snprintf (hscr[HELP_OTHER].text, BUFSIZ, snprintf (hscr[HELP_OTHER].text, HELPTEXTSIZ,
_("Pressing '%s' allows you to switch between status bar help pages.\n" _("Switch between status bar help pages.\n"
"Because the terminal screen is too narrow to display all of the\n" "Because the terminal screen is too narrow to display all of the\n"
"available commands, you need to press '%s' to see the next set of\n" "available commands, you need to press '%s' to see the next set of\n"
"commands together with their keybindings.\n" "commands together with their keybindings.\n"
"Once the last status bar page is reached, pressing '%s' another time\n" "Once the last status bar page is reached, pressing '%s' another time\n"
"leads you back to the first page."), "leads you back to the first page."),
keys_action_firstkey (KEY_GENERIC_OTHER_CMD),
keys_action_firstkey (KEY_GENERIC_OTHER_CMD), keys_action_firstkey (KEY_GENERIC_OTHER_CMD),
keys_action_firstkey (KEY_GENERIC_OTHER_CMD)); keys_action_firstkey (KEY_GENERIC_OTHER_CMD));
hscr[HELP_CREDITS].title = _("Calcurse - text-based organizer"); hscr[HELP_CREDITS].title = _("Calcurse - text-based organizer");
snprintf (hscr[HELP_CREDITS].text, BUFSIZ, snprintf (hscr[HELP_CREDITS].text, HELPTEXTSIZ,
_("Copyright (c) 2004-2008 Frederic Culot\n" _("\nCopyright (c) 2004-2008 Frederic Culot\n"
"\n" "\n"
"This program is free software; you can redistribute it and/or modify\n" "This program is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n" "it under the terms of the GNU General Public License as published by\n"

View File

@ -1,4 +1,4 @@
/* $calcurse: help.h,v 1.7 2008/11/28 08:46:29 culot Exp $ */ /* $calcurse: help.h,v 1.8 2008/12/03 19:31:03 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -29,12 +29,12 @@
#include "wins.h" #include "wins.h"
typedef struct #define HELPTEXTSIZ 4096
{
typedef struct {
char *title; char *title;
char text[BUFSIZ]; char text[HELPTEXTSIZ];
} } help_page_t;
help_page_t;
void help_screen (void); void help_screen (void);

View File

@ -1,4 +1,4 @@
/* $calcurse: io.c,v 1.43 2008/11/25 20:48:58 culot Exp $ */ /* $calcurse: io.c,v 1.44 2008/12/03 19:31:03 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -31,7 +31,6 @@
#include <math.h> #include <math.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <ctype.h>
#include "i18n.h" #include "i18n.h"
#include "utils.h" #include "utils.h"
@ -1219,6 +1218,16 @@ load_keys_ht_compare (struct ht_keybindings_s *data1,
return 1; return 1;
} }
/*
* isblank(3) is protected by the __BSD_VISIBLE macro and this fails to be
* visible in some specific cases. Thus replace it by the following is_blank()
* function.
*/
static int is_blank (int c)
{
return c == ' ' || c == '\t';
}
/* /*
* Load user-definable keys from file. * Load user-definable keys from file.
* A hash table is used to speed up loading process in avoiding string * A hash table is used to speed up loading process in avoiding string
@ -1253,7 +1262,7 @@ io_load_keys (void)
struct ht_keybindings_s *ht_elm, ht_entry; struct ht_keybindings_s *ht_elm, ht_entry;
const int AWAITED = 1; const int AWAITED = 1;
for (p = buf; isblank ((int)*p); p++) for (p = buf; is_blank ((int)*p); p++)
; ;
if (p != buf) if (p != buf)
memmove (buf, p, strlen (p)); memmove (buf, p, strlen (p));