summaryrefslogtreecommitdiff
path: root/src/wins.c
AgeCommit message (Collapse)Author
2017-01-12Update copyright rangesLukas Fleischer
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-09-27Fix key binding paginationLukas Fleischer
Do not create an empty key bindings page if the number of bindings is a multiple of the number of slots per page. Also, add comments to explain the computation. Reported-by: Kevin Wang <kevin.wang2004@hotmail.com> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-30Update copyright rangesLukas Fleischer
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2016-01-18Add a "hide completed" view to the todo panelLukas Fleischer
Add a second view to the todo panel that hides all completed items. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2015-02-07Update copyright rangesLukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-17Rework key binding context switchingLukas Fleischer
Store key binding contexts using another data structure to optimize space usage and execution time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-17Split out code to set bindingsLukas Fleischer
Split wins_status_bar() into wins_set_bindings(), wins_update_bindings() and wins_status_bar(). This allows for using wins_set_bindings() to set custom key bindings to be displayed. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-17wins.c: Drop NB_*_CMDSLukas Fleischer
Store the current number of commands in a static variable and drop the NB_*_CMDS variables which we outdated anyway. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16Refactor wins_launch_external()Lukas Fleischer
Allow for passing an arbitrary number of arguments. This also allows us to remove wins_launch_external2() and use wins_launch_external() at all call sites instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16Allow for merging data files when reloadingLukas Fleischer
This allows for merging the (unsaved) items with the items from the data files when invoking the reload operation. To this end, an external merge tool (defaults to vimdiff) is used. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-16Add a key binding to reload appointments and todosLukas Fleischer
This allows for reloading the appointment and todo item files without having to restart calcurse. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-19Avoid blank space after the last list box itemLukas Fleischer
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-19Resize panels properlyLukas Fleischer
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-18Add support for caption rows in list boxesLukas Fleischer
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-18Remove unused functions border_{,no}color()Lukas Fleischer
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18ui-day: Large-scale refactoringLukas Fleischer
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-18ui-calendar: Use scroll window implementationLukas Fleischer
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-18ui-todo: Large-scale refactoringLukas Fleischer
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-18Add support for drawing highlighted decorationLukas Fleischer
This allows for drawing selected scroll windows and list boxes with a highlighted border. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-05-18Reduce flicker when resizing in option menusLukas Fleischer
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-18Rework scroll window implementationLukas Fleischer
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-13Pass date parameter to ui_day_update_panel()Lukas Fleischer
This allows for drawing appointment panels for days other than the current day. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-07-17Add command promptLukas Fleischer
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-05-14Fix a couple of translatable stringsLukas Fleischer
* Remove space before punctuation. * Use "TODO" instead of "ToDo". * Strip some formats to make sure lines are <=80 characters wide. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-05-04Use a macro to determine the size of arraysLukas Fleischer
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-04-14Use tabs instead of spaces for indentationLukas Fleischer
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-02-17Fix braces in if-else statementsLukas Fleischer
From the Linux kernel coding guidelines: Do not unnecessarily use braces where a single statement will do. [...] This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-14calendar.c: Rename to "ui-calendar.c"Lukas Fleischer
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-14todo.c: Split out UI-related functionsLukas Fleischer
* 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-14apoint.c: Split out UI-related functionsLukas Fleischer
* 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-04Update copyright rangesLukas Fleischer
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>
2012-12-16Add hidden key handler windowLukas Fleischer
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-06wins_show(): Fix size of the slave window arrayLukas Fleischer
The slave window array was just big enough to hold a single element, whereas two elements are written/accessed. Fix this off-by-one error in the array declaration. Note that this messed up the panel layout when using clang as a compiler. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-29Merge branch 'maint'Lukas Fleischer
2012-11-28Ignore signals during command executionLukas Fleischer
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-25Replace switch block in layout calculationLukas Fleischer
Remove the huge layout switch block and use simple calculations instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-11-25Add compact panels supportLukas Fleischer
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-25Remove wins_slctd_init()Lukas Fleischer
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-23Merge branch 'maint'Lukas Fleischer
Conflicts: src/day.c src/recur.c
2012-11-23Release screen mutex if thread diesLukas Fleischer
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-23Lock screen when drawing on the calendar/notification panelLukas Fleischer
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-07-10Use integers rather than floats everywhereLukas Fleischer
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>
2012-07-07Merge cut/deleteLukas Fleischer
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>
2012-07-06Add a key binding for generic-copyLukas Fleischer
This finally adds full copy-paste support. Implements FR#15. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-13Add key bindings to go to the previous/next month/yearLukas Fleischer
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-13Rename displacement enumeration elementsLukas Fleischer
* 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-05-21Switch to Linux kernel coding styleLukas Fleischer
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-16src/wins.c: Run editor and pager in a shellLukas Fleischer
This allows for specifying an editor or a pager with additional command line parameters, such as "vim -e". Instead of interpreting "vim -e" as an executable file, we leave it to the shell to tokenize and parse the editor command now. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-05-08Declare several parameters/variables constantLukas Fleischer
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>
2012-05-02Various code cleanupBaptiste Jonglez
Remove obsolete bits of code that weren't thrown away by b5c1981; simplify some others areas of the code. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>