aboutsummaryrefslogtreecommitdiffstats
path: root/src/calcurse.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* Refactor startup screen branchLukas Fleischer2012-04-121-2/+5
| | | | | | | Removes the pointless first parameter to io_startup_screen() and saves one wins_update() call if system dialogs are disabled. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Miscellaneous small code cleanupsLukas Fleischer2012-04-061-8/+6
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Mark localized string literals constantLukas Fleischer2012-04-051-1/+1
| | | | | | | Translated strings returned by gettext() are statically allocated and shouldn't be modified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix semantics of "general."{systemdialogs,progressbar}Lukas Fleischer2012-03-291-1/+1
| | | | | | | | | These were renamed from "skip_"* to *. However, we only changed syntax and didn't invert their semantic meaning. Fix this by negating the semantics of those variables. Also, negate these in the configuration file automatically when running `calcurse-upgrade`. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Break out configuration main menuLukas Fleischer2012-03-021-49/+2
| | | | | | | This was the only big block of code left in our main loop. Move it to a separate function, making the main loop a bit clearer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Extract config file handlers into a separate fileLukas Fleischer2011-12-091-1/+1
| | | | | | | | We used custom_load_conf() to load the configuration file and io_save_conf() to save configuration. Move these functions, including all helpers, to a central location. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use a global configuration variableLukas Fleischer2011-11-141-16/+15
| | | | | | | This is one of the few valid use cases for a global variable. No need to make it pseudo-local and pass it from one function to another. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calcurse.c: Support count prefixes for motionsLukas Fleischer2011-10-061-19/+33
| | | | | | | | | | | | | Add a global count buffer to our main loop and pass it to keys_getch() as well as to all motion commands. This enables some fancy shortcuts: * Type "2l" to jump to the day after tomorrow. * Type "4k" (or "28l") to move forward four weeks. * Type "2$" to go to the end of next week. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add count buffer to keys_getch()Lukas Fleischer2011-10-061-1/+1
| | | | | | | | Key commands can be prefixed with a natural number - keys_getch() will store this number in the buffer pointed to by the second parameter. Set this parameter to NULL to disable count prefixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add count parameter to *_{in,de}crease()Lukas Fleischer2011-10-061-8/+8
| | | | | | | | | This allows for moving more than one item up/down. This currently isn't used anywhere but will be bound to a key with one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calendar.c: Add a count parameter to calendar_move()Lukas Fleischer2011-10-061-6/+6
| | | | | | | | | Allows for moving more than one step forward/backward. This is not used anywhere yet but a key binding will likely be added in one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid unnecessary window updatesLukas Fleischer2011-10-061-28/+65
| | | | | | | | Add a window bitmask to wins_update() and only update windows that might actually require an update in our main loop. This improves response times of the user interface a bit. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Refactor out storage updatesLukas Fleischer2011-10-061-45/+48
| | | | | | | Instead of using a hacky flag, simply move the storage update code to a separate function and call it when needed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove temporary highlight pointersLukas Fleischer2011-10-061-27/+4
| | | | | | | | | Add an additional check to apoint_update_panel() and todo_update_panel() and only highlight currently selected items if the corresponding panel is active. This allows us to remove all the highlight pointer juggling that we used whenever the panel selection changed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add configuration option to run the GC on exitLukas Fleischer2011-10-051-0/+2
| | | | | | | | If "auto_gc" is enabled, the garbage collector for note files will be run on every exit. As this is an experimental feature and may cause data loss, this is disabled by default. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Declare foreground and background variables globalLukas Fleischer2011-07-211-2/+1
| | | | | | Removes the need to pass the terminal's default background color round. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not unnecessarily refresh in config menuLukas Fleischer2011-07-141-0/+2
| | | | | | | We don't need to refresh windows every time an unassigned key is pressed. Add a condition to skip the refresh part if that is the case. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add key binding for pipe-item commandLukas Fleischer2011-07-071-0/+7
| | | | | | | This removes the need of reading the whole data file and find matching entries if we want to parse appointments in external programs. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid redundant redraws on resizeLukas Fleischer2011-06-281-3/+9
| | | | | | | | | | Use a global flag to record whether the terminal was resized instead of redrawing everything each time a KEY_RESIZE is read. Add some additional checks to help_write_pad() as invalid actions may be passed now due to using signals instead of virtual key presses. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for todo items.Lukas Fleischer2011-04-191-0/+1
| | | | | | | Use the new generic list implementation instead of "next" pointers in todo items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for events.Lukas Fleischer2011-04-191-0/+3
| | | | | | | Use the new generic list implementation instead of those insane "next" pointers in events. Includes some cleanups. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-272/+272
| | | | | | | Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update website links to match the new URL.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update mail addresses to match the new mailing lists.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove CVS "$Id" headers.Lukas Fleischer2011-03-031-2/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fixed file permissions.Lukas Fleischer2011-03-031-0/+0
|
* Work on sidebar width user-customization.Frederic Culot2010-03-201-1/+5
|
* All headers gathered into a single one. Typedefs suppressed.Frederic Culot2010-03-201-20/+5
|
* Work on implementing the weekly calendar view.Frederic Culot2009-08-241-1/+11
|
* Stop daemon when calcurse enters interactive mode.Frederic Culot2009-07-261-1/+3
|
* New way of handling signals.Frederic Culot2009-07-191-8/+6
|
* Avoid a fatal error when launching calcurse in interactive mode if user ↵Frederic Culot2009-07-121-3/+5
| | | | directory does not exist (thanks Antoine for reporting it).