textbox.c, mixer_display.c:
- Replaced manual line drawing code `for (...) mvwaddch(...)` by the
functions `mvwhline/mvwvline` provided by standard curses
card_select.c, proc_files.c:
- Moved duplicate code in the create() functions to menu_widget_create()
in menu_widget.c
card_select.c:
- Removed redundant calls to sprintf()
device_name.c:
- Combined multiple calls to form_opts_off()
- Recognize ASCII DEL (127) as backspace
widget.c:
- Uncommented code for setting a dummy key handler (all existing
widgets do provide a key handling function)
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is a preparation for the configuration file parser.
The `int attr_*` variables have been moved into a separate struct.
Members of that struct are alphabetically ordered, so an attribute can
later be accessed by its name.
Added `int get_color_pair(short fg, short bg)` for returning or
creating a color pair number.
Added call to `use_default_colors()` for enabling access to the
terminal's default color (-1).
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Mouse support has been added for mixer_widget.c, card_select.c and
proc_files.c.
In the mixer widget the mouse is handled as follows:
- After an element has been printed in mixer_display.c, a call to
clickable_set() will store the coordinates of the drawn area plus the
command enum that should be executed on click. An optional argument
holds an index which points to the selected mixer control.
- on_mouse_click() searches for a matching rectangle, focuses the mixer
control and returns the command enum.
In the menu widgets, the menu_driver() function handles mouse input.
Signed-off-by: Benjamin Abendroth <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
When we get a notification that an element has been removed, we have to
recreate our internal control representation to avoid accessing freed
memory. (And the checking for SND_CTL_EVENT_MASK_REMOVE should actually
be done correctly while we're at it.)
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Instead of mapping the raw volume values linearly to the screen, use
a mapping where the bar height is proportional to the audible volume,
i.e., where the amplitude is the cube of the bar height.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Ensure that control volume values are in their allowed range; otherwise,
the displayed values could be outside the range 0..100 and mess up the
layout.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
The attempt to divide by max-min fails if a control has only one valid
value. In this case, adjust the maximum so that the computation can
succeed; the control will look like 0%.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Fix the volume bar color selection logic so that the current attribute
is used for inactive controls.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Rename the attr variable because it contains not only the character's
attributes but also the character itself.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
For multichannel mixer controls, add the channel name to each screen
control.
Also make some other small changes.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>