aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | io.c: Several minor simplificationsLukas Fleischer2012-11-251-43/+31
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | args.c: Several minor simplificationsLukas Fleischer2012-11-251-27/+13
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Replace switch block in layout calculationLukas Fleischer2012-11-251-77/+24
| | | | | | | | | | | | Remove the huge layout switch block and use simple calculations instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add compact panels supportLukas Fleischer2012-11-257-15/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a configuration option that allows for switching to compact panel mode. In this mode, all window labels are hidden, so that there's more space for actual information. This patch doesn't add a configuration menu entry and doesn't add any documentation. Implements FR#7. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Avoid core dump if window is too smallLukas Fleischer2012-11-251-0/+3
| | | | | | | | | | | | | | Avoid setting the maximum number of items to a negative number (which eventually results in a core dump). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to set a default panelLukas Fleischer2012-11-254-10/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-253-8/+1
| | | | | | | | | | | | | | We only call this once. Remove the wrapper and directly call the wrapped function instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | calcurse.pot: Update message catalogLukas Fleischer2012-11-231-197/+183
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | io_load_*(): Add line numbers to error messagesLukas Fleischer2012-11-231-12/+26
| | | | | | | | | | | | | | | | Currently, error messages for (syntax) errors do not contain any line number information. Add the file name and line number to allow users for easily locating any errors in the corresponding data files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2012-11-2312-160/+244
|\| | | | | | | | | | | Conflicts: src/day.c src/recur.c
| * Release screen mutex if thread diesLukas Fleischer2012-11-234-32/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We did not setup a thread cleanup procedure which resulted in calcurse freezing if a thread tried to draw on the screen after another thread was canceled while locking the screen. Note that this kind of cleanup handlers should be added to other mutexes as well. This patch just removes the most common case of triggering a deadlock. Also note that we cannot move pthread_cleanup_push() and pthread_cleanup_pop() into the locking/unlocking functions since both pthread_cleanup_push() and pthread_cleanup_pop() may be implemented as macros that must be used in pairs within the same lexical scope. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Lock screen when drawing on the calendar/notification panelLukas Fleischer2012-11-234-3/+61
| | | | | | | | | | | | | | | | | | | | | | | | Lock the screen if either the calendar panel or the notification bar is updated to avoid race conditions. Addresses BUG#6. Note that we currently always use a screen-level lock, even if only one window is affected. This is to be changed in the future. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Do not display a mark when files are auto-savedLukas Fleischer2012-11-232-23/+2
| | | | | | | | | | | | | | | | | | | | This is kind of useless since users are not able to react to an auto-save notification. It also causes all kinds of problems if the status bar is in a non-standard mode (message, prompt, ...) and is prone to race conditions if the status bar is updated by another thread at the same time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
| * Replace localtime() with localtime_r()Lukas Fleischer2012-11-2210-126/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the result of localtime() is stored in a statically allocated structure, data was overwritten when a context switch occurred during (or shortly after) the execution of localtime(), potentially resulting in critical data corruption. BUG#7 and BUG#8 are likely related. This patch converts all usages of localtime() with localtime_r(), which is thread-safe. Reported-by: Baptiste Jonglez <baptiste@jonglez.org> Reported-by: Erik Saule <esaule@bmi.osu.edu> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use status_ask_choice() for the export dialogLukas Fleischer2012-11-183-39/+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-182-19/+9
| | | | | | | | | | | | | | 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>
* | Add support for entering times in 24 hour formatWilliam Pettersson2012-11-182-10/+12
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Simplify autogen.shLukas Fleischer2012-11-181-150/+5
| | | | | | | | | | | | | | | | | | | | | | | | Replace the whole autogen.sh magic by four simple lines that execute the commands that are actually needed. This enables verbose error output and allows advanced users to figure out what went wrong in case of errors. We expect users building calcurse from Git to be smart enough to fix "command not found" errors by themselves. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Use integers rather than floats everywhereLukas Fleischer2012-07-104-25/+21
| | | | | | | | | | | | | | | | | | | | | | We don't need floating point precision if results are casted back to integer. Instead, rearrange operations and do the integer division after the multiplication. Version numbers are terminating decimals anyway and can be stored using two integers without losing any information. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add new default key binding for generic-pasteLukas Fleischer2012-07-071-1/+1
| | | | | | | | | | | | Use "p" as an additional (vim-style) default binding for generic-paste. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove the erase flag and legacy deletion codeLukas Fleischer2012-07-075-82/+27
| | | | | | | | | | | | | | | | This is no longer needed. Note removal, as well as exception handling, have been moved to separate functions and the cut feature has been merged into the deletion function. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge cut/deleteLukas Fleischer2012-07-076-158/+83
| | | | | | | | | | | | | | 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>
* | Refactor exception handlingLukas Fleischer2012-07-074-54/+72
| | | | | | | | | | | | | | | | | | Remove the exception handling code from recur_*_erase() and move it to separate functions recur_*_add_exc(). Create a wrapper function day_item_add_exc() that can be used to add an exception to generic items. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor note removalLukas Fleischer2012-07-076-32/+31
| | | | | | | | | | | | | | | | Remove the note removal code from *_delete()/*_erase() and create a new wrapper function called day_item_erase_note() that is be used to drop the note being associated to an item. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add support for copy/paste registersLukas Fleischer2012-07-077-38/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-065-13/+29
| | | | | | | | | | | | This finally adds full copy-paste support. Implements FR#15. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add interact_day_item_copy()Lukas Fleischer2012-07-062-0/+13
| | | | | | | | | | | | | | This can be used to copy an item, so that it can be pasted somewhere else later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not bind "c" to "generic-config-menu" by defaultLukas Fleischer2012-07-061-1/+1
| | | | | | | | | | | | | | | | The "c" key will be used for the generic-copy command in the future. The configuration menu isn't needed a lot, so binding it to "C" only seems legit. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Duplicate items when pastingLukas Fleischer2012-07-061-2/+3
| | | | | | | | | | | | This allows pasting items more than once. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add day_item_fork()Lukas Fleischer2012-07-062-0/+26
| | | | | | | | | | | | | | Add a new function that can be used to copy one day item into another, cloning the actual item that is linked. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Refactor *_dup()Lukas Fleischer2012-07-064-36/+62
| | | | | | | | | | | | | | | | * Actually duplicate an item instead of copying data only. * Properly clone an item without a note. * Mark *_dup() public. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Revise todo_delete_note_bynum()Lukas Fleischer2012-07-043-9/+3
| | | | | | | | | | | | | | Pass an item instead of passing a list item index (analogous to commit 02c90ba53a658686bad5cb5f88c555d9eef06399). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove unused function day_item_nb()Lukas Fleischer2012-07-042-20/+0
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Summarize all contributions to translationsStéphane Aulery2012-07-042-12/+23
| | | | | | | | | | Signed-off-by: Stéphane Aulery <lkppo@free.fr> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add a test case to reproduce BUG#2Lukas Fleischer2012-06-303-1/+20
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Allow passing both "-D" and "-c"Lukas Fleischer2012-06-304-55/+50
| | | | | | | | | | | | | | | | | | | | This is particularly useful if one wants to use configuration and key bindings from a specific directory, while using an appointment file from somewhere else. "-c" has precedence over "-D". Also update the usage message, man page and documentation. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Implement a cache for the monthly viewLukas Fleischer2012-06-304-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-303-12/+7
| | | | | | | | | | | | | | | | 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>
* | Remove legacy cut/paste codeLukas Fleischer2012-06-303-50/+0
| | | | | | | | | | | | | | Note that this doesn't remove *_dup() since these might still be needed later. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Revise cut/pastingLukas Fleischer2012-06-307-98/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of calling type-specific duplication handlers and inserting clones of the original items when pasting, save the generic day item and remove the actual item from the linked list, so that it can be inserted anywhere else later. The cut/paste buffer is moved to the interaction unit, item-specific cut operations are changed to remove the item from the linked list only instead of copying and freeing it. An item is only freed if another item is cut before the current cut/paste buffer is pasted. All paste operations are changed and reinsert the actual item instead of creating a clone. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make *_free() publicLukas Fleischer2012-06-305-5/+10
| | | | | | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Move apoint_{cut,paste}() to interaction unitLukas Fleischer2012-06-304-55/+55
| | | | | | | | | | | | | | | | 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>
* | Remove "appt_pos" member from day itemsLukas Fleischer2012-06-302-8/+5
| | | | | | | | | | | | This is no longer used and removing it saves a few bytes per item. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add an item parameter to various todo_*() functionsLukas Fleischer2012-06-303-19/+12
| | | | | | | | | | | | | | | | 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-303-19/+12
| | | | | | | | | | | | | | | | 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>