summaryrefslogtreecommitdiffstats
path: root/src/calcurse.c
Commit message (Collapse)AuthorAgeFilesLines
* ui-todo: Large-scale refactoringLukas Fleischer2014-05-181-37/+15
| | | | | | | This is a complete overhaul of the TODO list user interface. The new implementation uses the generic list box panel. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Redraw screen if command prompt is canceledLukas Fleischer2013-08-131-1/+2
| | | | | | | | | When pressing escape or entering an empty command, we returned from key_generic_cmd() without updating the screen. Fix this by creating a cleanup section at the bottom of key_generic_cmd() and jump to that section when the command prompt is cancelled. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add write and quit commandsLukas Fleischer2013-07-181-3/+26
| | | | | | | | | | | | | | This adds following vim-style commands to the command mode: * write * w * quit * q * wq Commands can be suffixed with a "!" to force execution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* key_generic_help(): Use display_help()Lukas Fleischer2013-07-181-1/+1
| | | | | | | | Now that we moved the online help code into a separate function, use that to display the introduction help page when pressing the generic help key binding. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Split online help code into a separate functionLukas Fleischer2013-07-181-100/+1
| | | | | | | Reintroduce help.c and move the online help code into a new function display_help(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename io_file_exist{,s}()Lukas Fleischer2013-07-171-3/+3
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add several help topic aliasesLukas Fleischer2013-07-171-8/+92
| | | | | | | Add aliases and choose the right help topic if the user requests help on a key binding or a key binding label. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Allow for getting help on key bindingsLukas Fleischer2013-07-171-0/+8
| | | | | | | | | In addition to getting help on specific topics, users can type things like ":help s" or ":help ^A" to get help on specific key bindings now. Note that we do not add help texts for these keys here -- we will alias key bindings to already existing topics in a follow-up patch. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Drop legacy online help systemLukas Fleischer2013-07-171-2/+1
| | | | | | | | | | Remove the old online help system and change the generic help key to do the same thing as ":help". This also removes some context-sensitive help. We should think about re-adding support for this later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add introduction to the new online help systemLukas Fleischer2013-07-171-0/+3
| | | | | | | | This adds a very basic explanation of the new help command that can be displayed using ":help intro". This introduction is also added as default page so that users can simply type ":help" instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add help commandLukas Fleischer2013-07-171-1/+30
| | | | | | | | | This adds a "help" command to the list of available command mode commands. You can currently type "help", followed by a topic like "add". calcurse will then try to open a file named "add.txt" in the documentation directory and display it in an external pager. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add command promptLukas Fleischer2013-07-171-0/+12
| | | | | | | | | | This adds support for vim-style command mode. The command mode can be entered with pressing ":" (by default, the key binding is configurable). Currently, no command is supported. Support for various commands will be added later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix a couple of translatable stringsLukas Fleischer2013-05-141-2/+2
| | | | | | | | * Remove space before punctuation. * Use "TODO" instead of "ToDo". * Strip some formats to make sure lines are <=80 characters wide. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use tabs instead of spaces for indentationLukas Fleischer2013-04-141-418/+429
| | | | | | | | | | | This completes our switch to the Linux kernel coding style. Note that we still use deeply nested constructs at some places which need to be fixed up later. Converted using the `Lindent` script from the Linux kernel code base, along with some manual fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix braces in if-else statementsLukas Fleischer2013-02-171-4/+6
| | | | | | | | | | From the Linux kernel coding guidelines: Do not unnecessarily use braces where a single statement will do. [...] This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calendar.c: Rename to "ui-calendar.c"Lukas Fleischer2013-02-141-20/+20
| | | | | | | | | This unit belongs to the presentation layer -- rename the file accordingly. Also, rename calendar_*() to ui_calendar_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* todo.c: Split out UI-related functionsLukas Fleischer2013-02-141-33/+33
| | | | | | | * Move UI-related functions to "ui-todo.c". * Rename UI-related functions to ui_todo_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* apoint.c: Split out UI-related functionsLukas Fleischer2013-02-141-25/+25
| | | | | | | * Move UI-related functions to "ui-day.c". * Rename UI-related functions to ui_day_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename appointment/event-related UI functionsLukas Fleischer2013-02-141-8/+8
| | | | | | | | | * Rename "interaction.c" to "ui-day.c" since it no longer contains todo-related UI functions. * Rename appointment/event-related UI functions to ui_day_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Split out UI functions for todo itemsLukas Fleischer2013-02-141-5/+5
| | | | | | | | | * Move todo-related UI functions from "interaction.c" to a new compilation unit "ui-todo.c". * Rename all todo-related UI functions to todo_ui_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2013-02-041-1/+2
|\
| * Update copyright rangesLukas Fleischer2013-02-041-1/+1
| | | | | | | | | | | | | | Add 2013 to the copyright range for all source and documentation files. Reported-by: Frederic Culot <frederic@culot.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Do not prompt for a todo after adding an appointmentLukas Fleischer2013-02-031-0/+1
| | | | | | | | | | | | | | | | | | | | We effectively turned the addition of an appointment into a fall through case by deleting the break statement during refactoring. Revert this deletion to skip the second prompt. Regression introduced in f2dca7de3e8b164a4b3af3d58dde2f6776bfbee6. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | day_process_storage(): Remove redundant parameterLukas Fleischer2013-02-011-3/+3
|/ | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* do_storage(): Unset highlighted item if list is emptyLukas Fleischer2012-12-161-2/+6
| | | | | | | | | Check if the appointment panel contains any items and unset the highlight counter if it doesn't. Not doing this resulted in core dumps if the edit command was invoked after switching to a day without any appointments/events. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add hidden key handler windowLukas Fleischer2012-12-161-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | After BUG#6 had apparently been closed with the screen locks introduced in commit a80f8dcf2c6eb3b54658218bc081ee9694204dd5, some people still had problems with random characters appearing in the notification bar. This was obviously caused by wgetch() refreshing the screen if the status panel was changed. From wgetch(3): If the window is not a pad, and it has been moved or modified since the last call to wrefresh, wrefresh will be called before another character is read. Since the wgetch(3) isn't thread-safe, there were race conditions between the notification bar thread drawing to the notification bar and wgetch() updating the screen. Introduce a (hidden) window that handles all key presses and never gets changed in order to avoid this. Also, call wins_wrefresh() explicitly in status_mesg(), since we can no longer rely on wgetch() updating windows automatically. Fixes reopened BUG#6. Note that this is a hotfix -- FR#26 has been opened to ensure we fix this properly in the next major release. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add configuration option to set a default panelLukas Fleischer2012-11-251-1/+2
| | | | | | | | | | | | | This allows for customizing the panel that is selected by default when calcurse is started. Note that this patch doesn't add any documentation. Also, this configuration option currently cannot be configured using the configuration menu. Implements FR#19. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove wins_slctd_init()Lukas Fleischer2012-11-251-1/+1
| | | | | | | We only call this once. Remove the wrapper and directly call the wrapped function instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use status_ask_choice() for the export dialogLukas Fleischer2012-11-181-15/+14
| | | | | | | | Remove the export bar and use a simple status_ask_choice() dialog instead. This reduces code complexity and replaces another unnecessary menu by the well-tested dialog feature that is used everywhere else. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove unused parameter from key handlersLukas Fleischer2012-11-181-46/+46
| | | | | | | This is no longer needed since different keys use different handlers now. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calcurse.c: Pull out key_move_*()Lukas Fleischer2012-11-181-22/+40
| | | | | | | | | | | Supersedes the "key" parameter from following functions: * key_generic_prev_day() * key_generic_next_day() * key_generic_prev_week() * key_generic_next_week() Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calcurse.c: Break up key_change_priority()Lukas Fleischer2012-11-181-5/+14
| | | | | | | | Split up key_change_priority() into key_raise_priority(), key_lower_priority() which are wrappers around a new convenience function change_priority(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calcurse.c: Pull out key_generic_goto_today()Lukas Fleischer2012-11-181-5/+11
| | | | | | | | Split out key_generic_goto_today() into a separate function. This simplifies the control flow and supersedes the "key" parameter in key_generic_goto(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor todo_chg_priority()Lukas Fleischer2012-11-181-1/+2
| | | | | | | Instead of passing a key, pass the number of steps to increase the priority by. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* calcurse.c: Refactor the main loopLukas Fleischer2012-11-181-353/+425
| | | | | | | | | | | | | | | | | | | | | | Break up the big switch statement into several functions. The functions are declared inline to avoid unnecessary function calls. Also: * Add a "KEY_HANDLER" macro can be used as a short version of a "case" statement, followed by a function call. * Declare several state variables global to avoid having to pass them to each of the new handlers. * Pass the pressed key to each of the handler functions in order not to break handlers that handled more than one key before the handlers were pulled out. These three changes were introduced to keep this patch as atomic as possible and are intended to be removed in following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge cut/deleteLukas Fleischer2012-07-071-9/+1
| | | | | | | Remove the cut function and merge it into the del-item command. This allows for vim-style cutting/pasting. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add support for copy/paste registersLukas Fleischer2012-07-071-5/+5
| | | | | | | | | | | | | | | | | This adds support for vim-style copy/paste registers which allows cutting and copying multiple items without having to overwrite the copy/paste buffer. Registers can be specified using the quote key ('"'). To access a register, type '"x' before a command where "x" is the name of a register. If you want to copy the currently selected item into register 1, type '"1c'. Valid registers are 0-9, a-z, "-" and "_". Note that the latter is the so-called black hole register, which works similar to the black hole register in vim. The register prefix key is currently hardcoded and cannot be configured. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add a key binding for generic-copyLukas Fleischer2012-07-061-0/+8
| | | | | | This finally adds full copy-paste support. Implements FR#15. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Implement a cache for the monthly viewLukas Fleischer2012-06-301-0/+1
| | | | | | | | | | | | | | | | | Add a very simple cache, which is used to store the days that contain an event or an appointment. This makes redrawing and browsing the calendar panel much faster. The cache has a size of 31 integers (which is equivalent to 124 bytes on a 32 bit system and 248 bytes on a 64 bit system) and invalidates itself if the current month has changed. If an item is added/changed/removed, the cache needs to be invalidated manually by calling calendar_monthly_view_cache_set_invalid(). Note that this will always invalidate the whole cache, even if only one item at the last day of the month was removed. This is a trade-off between simplicity and efficiency. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove unneeded parameter/return valueLukas Fleischer2012-06-301-4/+2
| | | | | | | | The item type parameter/return value no longer needs to be passed/returned to interact_day_item_{paste,cut}(), since the type descriptor is saved when cutting an item now. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Move apoint_{cut,paste}() to interaction unitLukas Fleischer2012-06-301-2/+2
| | | | | | | | These functions get the current selection, call day_*_item() and fix the current selection on the appointment panel, so move them where they belong. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add an item parameter to various todo_*() functionsLukas Fleischer2012-06-301-4/+4
| | | | | | | | These functions operate on arbitrary items. Pull out the code that gets the currently selected item, get the current selection when one of the functions is called and pass it as a parameter. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add an item parameter to various day_*() functionsLukas Fleischer2012-06-301-4/+4
| | | | | | | | These functions operate on arbitrary items. Pull out the code that gets the currently selected item, get the current selection when one of the functions is called and pass it as a parameter. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename interaction functionsLukas Fleischer2012-06-301-11/+11
| | | | | | | | Rename all interaction functions for the sake of consistency and add a "interact_" prefix. Also, mark day_erase_item() static since it is not used anywhere else. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Simplify apoint_switch_notify()Lukas Fleischer2012-06-301-1/+1
| | | | | | | | | Pull out code from apoint_switch_notify() -- especially the fallback routine that calls recur_apoint_switch_notify() if the currently selected item is a recurrent item -- and move it to a wrapper function day_item_switch_notify(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add key bindings to go to the previous/next month/yearLukas Fleischer2012-06-131-0/+24
| | | | | | | | | | In addition to generic key bindings for moving one day (week) forward/backward, define similar bindings for moving a month or a year. Of course, count prefixes are allowed here as well. Also add status bar hints and help texts. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rename displacement enumeration elementsLukas Fleischer2012-06-131-10/+10
| | | | | | | | | | * Rename "LEFT" to "DAY_PREV", "RIGHT" to "DAY_NEXT", "UP" to "WEEK_PREV" and "DOWN" to "WEEK_NEXT" to reflect the semantics of these operations. Remove the unneeded "MOVES" element. * Reorder code to improve consistency. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-471/+420
| | | | | | | | | | | | | | Convert our code base to adhere to Linux kernel coding style using Lindent, with the following exceptions: * Use spaces, instead of tabs, for indentation. * Use 2-character indentations (instead of 8 characters). Rationale: We currently have too much levels of indentation. Using 8-character tabs would make huge code parts unreadable. These need to be cleaned up before we can switch to 8 characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Factorize boolean user prompting.Baptiste Jonglez2012-05-141-4/+2
| | | | | | | | | | | Introduce a new `status_ask_bool()` function, and use it where applicable. This greatly reduces code duplication, and will allow handling special events (resize, user escape) much more uniformely. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calcurse.c: Start all helper threads in one goLukas Fleischer2012-04-121-2/+4
| | | | | | | | Makes our initialization code a tad cleaner and seems to reduce flicker when starting calcurse (the notification bar is no longer drawn before other windows are shown). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>