181 Commits

Author SHA1 Message Date
Lukas Fleischer
f7f49da17c Initialize linked list for recurrent items
When switching to the generic linked list implementation for recurring
events in 9fab248 (Use generic lists for recurring apointments and
events., 2011-04-16), no initialization routine for the list of
recurring events was added. Fix this and properly initialize the list on
startup.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16 15:52:33 +02:00
Lukas Fleischer
cac973fee3 Load todo items on startup
Reload (and show) items into the list box after reading data files.

Reported-by: BARE Willy sprl <barewillysprl@euphonynet.be>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-09 00:33:01 +02:00
Lukas Fleischer
0529b864b0 Fix segmentation fault
This adds some more accurate checks to avoid a segmentation fault that
occurred when accessing a nonexistent item.

Fixes GitHub issue #7.

Reported-by: Bromind <martin.vassor@hotmail.fr>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-06-25 12:35:43 +02:00
Lukas Fleischer
0b46ad4faa Avoid blank space after the last list box item
Automatically scroll down the list box when resizing creates some blank
space below the list of items.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-19 21:43:27 +02:00
Lukas Fleischer
990897b2f0 Resize panels properly
Rewrite the panel resize code and remove the code that reinitializes the
caption and the selected item when the window is resized.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-19 10:54:50 +02:00
Lukas Fleischer
7e76d617ab Use an enum for the type field of day_item
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:24:04 +02:00
Lukas Fleischer
2a62351d25 Reintroduce heading and separator in appointments
This re-introduces the heading (showing the POM and the current date) as
well as the separating line between events and appointments.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:10:56 +02:00
Lukas Fleischer
2a15531bb9 Add support for caption rows in list boxes
This adds support for rows that cannot be selected. Such rows can be
used for section headings and the like.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:07:27 +02:00
Lukas Fleischer
35314dfdeb ui-day: Large-scale refactoring
Use the generic list box implementation for the appointments panel. This
results in some major changes to how the items are printed.

Note that this temporarily removes the heading showing the POM and the
date as well as the separating line between events and appointments.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:06:43 +02:00
Lukas Fleischer
f513fa4627 Store appointments for the current day in a vector
This allows for more efficient access to items at specific positions.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:03:16 +02:00
Lukas Fleischer
45af8c5880 Add a vector implementation
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:03:15 +02:00
Lukas Fleischer
cf1565648b ui-calendar: Use scroll window implementation
Make use of the generic scroll window implementation for the calendar
view. Note that this is useful despite the panel not needing a scroll
bar, since the scroll window functions can be used to draw the panel
border and take care of relative positions.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:03:13 +02:00
Lukas Fleischer
655218b7df ui-todo: Large-scale refactoring
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>
2014-05-18 11:03:10 +02:00
Lukas Fleischer
4210fdd38a Add support for drawing highlighted decoration
This allows for drawing selected scroll windows and list boxes with a
highlighted border.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:03:03 +02:00
Lukas Fleischer
05ba450c3b Reduce flicker when resizing in option menus
Do not update the main windows when resizing the terminal in the general
options menu or in the notification options menu.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:02:56 +02:00
Lukas Fleischer
27b39a56ef Add a generic list box implementation
This adds a very generic list box implementation. List boxes with items
of different heights are supported. Two callback functions to determine
the height of every single item and to draw a specific item are used.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:02:42 +02:00
Lukas Fleischer
7184da0fa3 Rework scroll window implementation
This complete rewrite of the scroll window implementation decouples
scroll windows from every other window abstraction layer we use. Note
that this leads to some code duplication. The long-term purpose of this
rewrite, however, is to eventually make every panel use scroll windows.
This makes for a huge cleanup of the UI code.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18 11:02:32 +02:00
Lukas Fleischer
ca83e65696 Pass date parameter to ui_day_update_panel()
This allows for drawing appointment panels for days other than the
current day.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-13 15:10:47 +02:00
Lukas Fleischer
bd4f4a136f Display translated help pages
Use an algorithm similar to gettext's locale resolution to find an
appropriate translation to display. Fall back to the English version.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-08-27 19:33:28 +02:00
Lukas Fleischer
f36484f404 Split online help code into a separate function
Reintroduce help.c and move the online help code into a new function
display_help().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-18 11:29:10 +02:00
Lukas Fleischer
beac8bdd9b Rename io_file_exist{,s}()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17 14:03:54 +02:00
Lukas Fleischer
20709b7a7e Drop legacy online help system
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>
2013-07-17 14:03:53 +02:00
Lukas Fleischer
c4dae80dd2 Add command prompt
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>
2013-07-17 14:03:53 +02:00
William Pettersson
fb61744f33 Add -l/--limit option
Adds the -l/--limit command line option. Limits the number of appointments
and/or ToDo items displayed.

Signed-off-by: William Pettersson <william.pettersson@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-16 11:44:55 +02:00
Lukas Fleischer
ce93fa8adb Use a macro to determine the size of arrays
Use following macro instead of "sizeof(x) / sizeof(x[0])" everywhere:

    #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-04 20:32:26 +02:00
Lukas Fleischer
694d28eb78 Use tabs instead of spaces for indentation
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>
2013-04-14 00:19:01 +02:00
Lukas Fleischer
43bdd12254 parse_{date,time}(): Split out date/time validation
Split date/time validation into separate functions check_date() and
check_time(). These will be used to validate date/time information when
reading items from the appointments file.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-27 11:36:28 +01:00
Lukas Fleischer
8de7399360 Mark todo_get_position() public
This is needed in "ui-todo.c" now.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 11:10:38 +01:00
Lukas Fleischer
806673dd9b calendar.c: Rename to "ui-calendar.c"
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>
2013-02-14 11:08:03 +01:00
Lukas Fleischer
971df8d215 todo.c: Split out UI-related functions
* Move UI-related functions to "ui-todo.c".
* Rename UI-related functions to ui_todo_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 11:08:03 +01:00
Lukas Fleischer
601709b173 apoint.c: Split out UI-related functions
* Move UI-related functions to "ui-day.c".
* Rename UI-related functions to ui_day_*().

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14 10:43:40 +01:00
Lukas Fleischer
c7f3888607 Rename appointment/event-related UI functions
* 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>
2013-02-14 10:34:00 +01:00
Lukas Fleischer
267bf0fc1c Split out UI functions for todo items
* 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>
2013-02-14 10:28:31 +01:00
Lukas Fleischer
b30ccc6319 Merge branch 'maint' 2013-02-04 20:11:58 +01:00
Lukas Fleischer
a7944d335e Update copyright ranges
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>
2013-02-04 20:10:14 +01:00
Lukas Fleischer
9a6df45c4b day_process_storage(): Remove redundant parameter
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-01 18:42:45 +01:00
Lukas Fleischer
de73d96188 Use strncasecmp() for case-insensitive comparison
Instead of converting everything to upper case and then using strncmp(),
use strncasecmp() which does case-insensitive comparison out of the box.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-01-30 15:42:08 +01:00
Lukas Fleischer
ef961f4927 Remove unused function mystrtol()
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-01-30 15:39:58 +01:00
Lukas Fleischer
e492ac6f95 Add hidden key handler window
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>
2012-12-16 02:27:36 +01:00
Lukas Fleischer
a91fd72641 Merge branch 'maint' 2012-11-29 11:34:00 +01:00
Lukas Fleischer
8ae75f3ca7 Ignore signals during command execution
Disable signal handlers in wins_prepare_external() and reactivate them
in wins_unprepare_external().

Before, it was possible that resizing the window during editor/pager
mode resulted in the calcurse main screen appearing on top.

Addresses BUG#9.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-28 21:49:02 +01:00
Lukas Fleischer
9a6b875b1d io_check_*()/io_file_exist(): Fix signatures
This was broken in commit 87fb8cfec0d8e8fc901746095458bd316314b6ee. Fix
function signatures and update all invocations accordingly.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-26 01:49:04 +01:00
Lukas Fleischer
4d0c095947 Add compact panels support
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>
2012-11-25 18:33:29 +01:00
Lukas Fleischer
660eef88e4 Add configuration option to set a default panel
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>
2012-11-25 18:13:37 +01:00
Lukas Fleischer
69b5293c87 Remove wins_slctd_init()
We only call this once. Remove the wrapper and directly call the wrapped
function instead.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25 18:07:40 +01:00
Lukas Fleischer
1f0f05ecc1 Merge branch 'maint'
Conflicts:
	src/day.c
	src/recur.c
2012-11-23 19:03:57 +01:00
Lukas Fleischer
0ea23c24bf Release screen mutex if thread dies
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>
2012-11-23 11:12:08 +01:00
Lukas Fleischer
a80f8dcf2c Lock screen when drawing on the calendar/notification panel
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>
2012-11-23 11:12:08 +01:00
Lukas Fleischer
e16ac0a8a8 Do not display a mark when files are auto-saved
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>
2012-11-23 11:12:04 +01:00
Lukas Fleischer
7733d52f32 Use status_ask_choice() for the export dialog
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>
2012-11-18 22:57:09 +01:00