124 Commits

Author SHA1 Message Date
Lukas Fleischer
318e685ffe Add an item parameter to various day_*() functions
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>
2012-06-30 14:34:35 +02:00
Lukas Fleischer
8a85aaafa5 Rename interaction functions
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>
2012-06-30 14:34:35 +02:00
Lukas Fleischer
0504875219 Simplify apoint_switch_notify()
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>
2012-06-30 14:34:35 +02:00
Lukas Fleischer
cabc22e032 Add key bindings to go to the previous/next month/year
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>
2012-06-13 00:12:32 +02:00
Lukas Fleischer
42c486d30d Rename displacement enumeration elements
* 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>
2012-06-13 00:12:27 +02:00
Lukas Fleischer
cfd8ede2b3 Switch to Linux kernel coding style
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>
2012-05-21 10:13:05 +02:00
Baptiste Jonglez
13d6f8703b Factorize boolean user prompting.
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>
2012-05-14 19:31:13 +02:00
Lukas Fleischer
ec12276079 src/calcurse.c: Start all helper threads in one go
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>
2012-04-12 23:53:09 +02:00
Lukas Fleischer
691f8a6015 Refactor startup screen branch
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>
2012-04-12 23:43:20 +02:00
Lukas Fleischer
1c442e6aef Miscellaneous small code cleanups
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-06 23:23:58 +02:00
Lukas Fleischer
80f7e8ead5 Mark localized string literals constant
Translated strings returned by gettext() are statically allocated and
shouldn't be modified.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-04-05 22:18:46 +02:00
Lukas Fleischer
c85c3cce55 Fix semantics of "general."{systemdialogs,progressbar}
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>
2012-03-29 17:06:56 +02:00
Lukas Fleischer
c9aff6d213 Update copyright ranges
Add 2012 to the copyright range for all source and documentation files.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-03-26 14:38:16 +02:00
Lukas Fleischer
17aa73b73f Break out configuration main menu
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>
2012-03-02 09:43:06 +01:00
Lukas Fleischer
093b28ac39 Extract config file handlers into a separate file
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>
2011-12-09 20:54:20 +01:00
Lukas Fleischer
41c33eeb44 Use a global configuration variable
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>
2011-11-14 11:08:14 +01:00
Lukas Fleischer
59e006e56d src/calcurse.c: Support count prefixes for motions
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>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
98651a549f Add count buffer to keys_getch()
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>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
ba2aa5167b Add count parameter to *_{in,de}crease()
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>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
2d5ce0d95c src/calendar.c: Add a count parameter to calendar_move()
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>
2011-10-06 12:37:06 +02:00
Lukas Fleischer
6bdc36b15a Avoid unnecessary window updates
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>
2011-10-06 12:37:05 +02:00
Lukas Fleischer
5d3ed17bc8 Refactor out storage updates
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>
2011-10-06 12:37:05 +02:00
Lukas Fleischer
70a488a64e Remove temporary highlight pointers
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>
2011-10-06 12:37:05 +02:00
Lukas Fleischer
711d5dea20 Add configuration option to run the GC on exit
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>
2011-10-05 12:25:48 +02:00
Lukas Fleischer
1355bad264 Declare foreground and background variables global
Removes the need to pass the terminal's default background color round.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-07-21 17:56:39 +02:00
Lukas Fleischer
c21137129a Do not unnecessarily refresh in config menu
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>
2011-07-14 18:23:31 +02:00
Lukas Fleischer
309fa84cb7 Add key binding for pipe-item command
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>
2011-07-07 07:05:48 +02:00
Lukas Fleischer
fec37db06b Avoid redundant redraws on resize
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>
2011-06-28 18:22:43 +02:00
Lukas Fleischer
38865b8e48 Update copyright notices in source files, documentation and "COPYING".
* 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>
2011-04-22 07:26:05 +02:00
Lukas Fleischer
bf431d6cd9 Use generic lists for todo items.
Use the new generic list implementation instead of "next" pointers in
todo items.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
6f883c0f3f Use generic lists for events.
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>
2011-04-19 11:42:34 +02:00
Lukas Fleischer
9c9fd5da15 Overall indentation fixes.
Use spaces instead of tabs for source code indentation only, strip
trailing whitespaces from lines.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-14 19:03:53 +01:00
Lukas Fleischer
c22dcaf6be Update website links to match the new URL.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:49 +01:00
Lukas Fleischer
73e9649387 Update mail addresses to match the new mailing lists.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-04 11:07:40 +01:00
Lukas Fleischer
91c9cac898 Remove CVS "$Id" headers.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-03-03 16:19:45 +01:00
Lukas Fleischer
56b9cbcb84 Fixed file permissions. 2011-03-03 12:21:16 +01:00
Frederic Culot
ec36b96848 Work on sidebar width user-customization. 2010-03-20 13:29:47 +00:00
Frederic Culot
a8cb1c92ef All headers gathered into a single one. Typedefs suppressed. 2010-03-20 10:54:41 +00:00
Frederic Culot
2cfafe8a89 Work on implementing the weekly calendar view. 2009-08-24 18:59:16 +00:00
Frederic Culot
279c564d2b Stop daemon when calcurse enters interactive mode. 2009-07-26 20:38:35 +00:00
Frederic Culot
d2c766a137 New way of handling signals. 2009-07-19 16:51:35 +00:00
Frederic Culot
56a29600ad Avoid a fatal error when launching calcurse in interactive mode if user directory does not exist (thanks Antoine for reporting it). 2009-07-12 20:37:40 +00:00
Frederic Culot
5694955002 stdbool header removed, unsigned type used instead 2009-07-12 16:21:57 +00:00
Frederic Culot
27b25548a4 Switch to BSD license. 2009-07-05 20:33:13 +00:00
Frederic Culot
ea107cfd81 Ability to flag todo items as completed. 2009-06-26 21:44:11 +00:00
Frederic Culot
627fd8a8aa Basic lock mechanism implemented to avoid having two calcurse instances running at the same time. 2009-06-21 18:16:21 +00:00
Frederic Culot
87f010ff06 bugfix: load keys even in non-interactive mode to avoid the loss of user-configured key bindings 2009-01-24 18:45:35 +00:00
Frederic Culot
936b6fe373 more code cleanup 2009-01-03 21:32:10 +00:00
Frederic Culot
cac30a7e14 cut/paste feature aded
fixed a 2-years old bug that made repeated items with exceptions to load
uncorrectly in some cases (thanks Jan for reporting it)
2009-01-01 17:50:41 +00:00
Frederic Culot
8fdd1510c6 Automatic periodic saves implemented 2008-12-28 19:41:45 +00:00