aboutsummaryrefslogtreecommitdiffstats
path: root/src/calendar.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement a cache for the monthly viewLukas Fleischer2012-06-301-1/+24
| | | | | | | | | | | | | | | | | 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>
* Add key bindings to go to the previous/next month/yearLukas Fleischer2012-06-131-0/+12
| | | | | | | | | | 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-8/+8
| | | | | | | | | | * 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>
* Make appearance.calendarview more explicit in config fileBaptiste Jonglez2012-05-311-6/+0
| | | | | | | | | | Instead of using 0 or 1 as a value for `appearance.calendarview`, introduce the more explicit "monthly" and "weekly". Also update `scripts/calcurse-upgrade.sh` to reflect the change. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use mvwaddstr() instead of mvwprintw()Baptiste Jonglez2012-05-311-6/+4
| | | | | | | | | | | | | When we only want to display a string at a specific place of the screen, there's no need to use the more complex mvwprintw(), use mvwaddstr() instead. This should be slightly more efficient, and, above all, it prevents weird things to happen if our string contains a '%', being interpreted as an unwanted format string. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix incorrect i18n usage for some stringsBaptiste Jonglez2012-05-251-2/+2
| | | | | | | | | | | Some strings are initialized without wrapping them in _(); instead, _() is applied on the variable when it is used. This is incorrect, since these strings don't get added to the catalog. Fix that by applying _() only once, when the string is declared. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Switch to Linux kernel coding styleLukas Fleischer2012-05-211-445/+376
| | | | | | | | | | | | | | 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>
* Declare several parameters/variables constantLukas Fleischer2012-05-081-3/+3
| | | | | | | | | | | | Add the "const" keyword to parameters and variables that are never modified. Most of these were spotted by "-Wwrite-strings". We cast the second parameter to execvp() explicitly as it expects a "char *const[]" where it should expect a "const char *const[]" (according to the documentation, this is due to compatibility reasons). This should be changed once we come up with a better solution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Mark localized string literals constantLukas Fleischer2012-04-051-2/+2
| | | | | | | Translated strings returned by gettext() are statically allocated and shouldn't be modified. 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>
* Remove all usages of bzero() and bcopy()Lukas Fleischer2012-02-191-1/+1
| | | | | | | | | The bzero() and bcopy() functions are deprecated and were removed from the POSIX standard in IEEE Std. 1003.1-2008. Remove all usages of bzero()/bcopy() and replace them by appropriate memset()/memmove() calls. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* src/calendar.c: Fix range check in calendar_move()Lukas Fleischer2012-01-211-12/+14
| | | | | | | | | | | | | | | We added count prefix support to motion commands in commit 59e006e56d9f893506af56a4ca114fe53b537e49 but obviously forgot to check whether the range checks in calendar_move() still work correctly. Refactor out range checks and replace them by a single check that is performed *after* the new date is computed, but before we assign the new value to the actual selected date. This ensures we won't have to bother about these again when changing/adding functionality in/to calendar_move(), while keeping performance (date_change() is pretty cheap and range violations are corner cases anyway). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2011-11-111-1/+4
|\ | | | | | | | | | | Conflicts: src/calcurse.h src/io.c
| * Cleanup joinable threads on terminationLukas Fleischer2011-10-041-1/+4
| | | | | | | | | | | | | | Always invoke pthread_join() when we blow up a thread via pthread_cancel() (avoid zombie threads). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove parentheses from return statementsLukas Fleischer2011-11-021-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make use of the NULL macroLukas Fleischer2011-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use this constant everywhere when referring to a null pointer instead of casting 0 to various types of pointers. Created using following semantic patch: @@ type type; @@ - (type *)0 + NULL Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not cast unused return values to voidLukas Fleischer2011-11-021-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small style fix that removes all remaining "(void)" casts. Using these isn't encouraged in GNU coding guidelines and doesn't serve a certain purpose, except for satisfying a few static code analysis tools. We already nuked some of these in previous patches, but this semantic patch should fix what's left: @@ identifier func; @@ - (void)func ( + func ( ...); Long lines were re-formatted manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | src/calendar.c: Add a count parameter to calendar_move()Lukas Fleischer2011-10-061-6/+8
|/ | | | | | | | | 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>
* 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>
* Remove dead assignments spotted by clang-analyzer.Lukas Fleischer2011-04-031-3/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use upper case for macro names.Lukas Fleischer2011-03-151-6/+6
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-68/+68
| | | | | | | 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
|
* Make parse_date accept several short forms.Lukas Fleischer2011-01-111-6/+3
| | | | | | | | | Short forms are only accepted in interactive mode (e.g. when using the "Go to" function, editing a recurrent item's end date, and so on). Samples: "1/1/30" for "01/01/2030", "26" for the 26th of the currently selected month/year or "3/1" for Mar 01 (or Jan 03, depending on the date format) of the currently selected year.
* isBissextile() removed and replaced by isleap macro.Frederic Culot2010-10-231-10/+4
| | | | Patch submitted by Lukas Fleischer, thanks.
* Cosmetics in the calendar weekly view.Frederic Culot2010-03-291-2/+2
|
* Adapt the weekly calendar view to the side bar width.Frederic Culot2010-03-291-12/+17
|
* More work on sidebar customization.Frederic Culot2010-03-211-4/+5
|
* Work on sidebar width user-customization.Frederic Culot2010-03-201-12/+19
|
* All headers gathered into a single one. Typedefs suppressed.Frederic Culot2010-03-201-28/+30
|
* Patch to correct the wrong calculation of recurrent items' dates after aFrederic Culot2010-03-081-3/+2
| | | | turn of year (submitted by Lukas Fleischer, thanks!).
* Compiler problem fixed (thanks Petr for reporting it).Frederic Culot2010-03-011-1/+3
|
* Code to save the calendar default view in the configuration file.Frederic Culot2009-10-281-1/+13
|
* Changes in the calendar weekly view.Frederic Culot2009-10-161-8/+26
|
* More work on the weekly calendar view.Frederic Culot2009-10-081-1/+19
|
* Display week number inside weekly calendar view.Frederic Culot2009-08-251-34/+127
|
* Work on implementing the weekly calendar view.Frederic Culot2009-08-241-53/+145
|
* stdbool header removed, unsigned type used insteadFrederic Culot2009-07-121-7/+7
|
* Switch to BSD license.Frederic Culot2009-07-051-14/+26
|
* Day names and selected date colour now follow user's theme.Frederic Culot2009-06-201-10/+10
|
* do not crash when canceling the thread if it was not launched beforeFrederic Culot2009-01-241-5/+4
|
* Added wrappers around libc's memory management functions, to easily debug ↵Frederic Culot2008-12-281-12/+9
| | | | memory usage
* small bugfixes and code cleanupFrederic Culot2008-12-141-2/+2
|
* Checks added while loading key bindings configuration.Frederic Culot2008-12-071-2/+2
|
* More work on implementing user-definable keybindingsFrederic Culot2008-11-161-3/+4
|
* pcal export addedFrederic Culot2008-08-101-2/+40
|
* new keybindings addedFrederic Culot2008-08-031-10/+35
|