test: added "run_hscroll" program
A program for debugging the hscroll.c library.
A program for debugging the hscroll.c library.
screen_browser: initialize local variable
configure.ac: added option --enable-test
This will enable the test suite.
This will enable the test suite.
configure.ac: use standard autoconf variable names
Use the variable name implicitly created by AC_ARG_ENABLE.
Use the variable name implicitly created by AC_ARG_ENABLE.
po: updated Korean translation
charset: added "replace" functions
These functions are a shortcut for a common use case: convert an
allocated string in-place.
These functions are a shortcut for a common use case: convert an
allocated string in-place.
screen_browser: free temporary string
In browser_lw_callback(), free the converted directory base name.
In browser_lw_callback(), free the converted directory base name.
hscroll: use g_strconcat() instead of g_strlcpy() + g_strlcat()
hscroll: pass const strings to strscroll()
hscroll: don't include ctype.h
mpdclient: don't assign c->status twice in mpdclient_cmd_clear()
Forgot to delete this line when I switched to mpdclient_recv_status().
Forgot to delete this line when I switched to mpdclient_recv_status().
mpdclient: removed mpdclient_cmd_swap()
Not used anymore.
Not used anymore.
screen_queue: move ranges with one single "move" command
Instead of swapping every single song in the selected range, send one
single "move" command which moves the neighbor song to the other end
of the range.
Instead of swapping every single song in the selected range, send one
single "move" command which moves the neighbor song to the other end
of the range.
mpdclient: added function mpdclient_cmd_move()
playlist: added function playlist_move()
playlist: don't update the song positions in playlist_swap()
In ncmpc, nobody reads the song's "position" attribute (except for the
"plchanges" handler). We don't need it, and we don't need to update
it after a swap.
In ncmpc, nobody reads the song's "position" attribute (except for the
"plchanges" handler). We don't need it, and we don't need to update
it after a swap.
mpdclient: renamed mpdclient_cmd_move() to mpdclient_cmd_swap()
That function does not move, it swaps two songs.
That function does not move, it swaps two songs.
mpdclient: moved code to mpdclient_recv_status()
Merge some duplicate code.
Merge some duplicate code.
mpdclient: optimize crop with delete_range
MPD 0.16 supports "delete" with a range.
MPD 0.16 supports "delete" with a range.
mpdclient: don't update the status in mpdclient_cmd_crop()
This is kind of redundant, because it doesn't solve the theoretical
race condition, and doesn't improve too much to justify the latency.
This is kind of redundant, because it doesn't solve the theoretical
race condition, and doesn't improve too much to justify the latency.
mpdclient: update mpdclient.playlist in mpdclient_cmd_clear()
Reduce UI latency.
Reduce UI latency.
mpdclient: removed mpdclient_cmd_play()
Call mpdclient_run_play_id() directly.
Call mpdclient_run_play_id() directly.
screen_queue: set cursor before button handlers
This allows us to use screen_queue_selected_song().
This allows us to use screen_queue_selected_song().
screen_queue: update list_window length after mouse delete
Fix an assertion failure.
Fix an assertion failure.
check the return value of mpdclient_get_connection()
When leaving idle mode, the idle callback (which is invoked indirectly
by mpdclient_get_connection()) may close the connection. Checking
mpdclient_is_connected() before mpdclient_get_connection() is
pointless for that reason.
When leaving idle mode, the idle callback (which is invoked indirectly
by mpdclient_get_connection()) may close the connection. Checking
mpdclient_is_connected() before mpdclient_get_connection() is
pointless for that reason.
screen_file: return void from handle_X() functions
Nobody evaluates the return values.
Nobody evaluates the return values.
screen_browser: convert path only for the message
We don't need the locale path if we don't print a message.
We don't need the locale path if we don't print a message.
screen_outputs: reset list_window length in clear_outputs_list()
Fix an assertion failure on disconnect.
Fix an assertion failure on disconnect.
screen_artist: check connection!=NULL in load_song_list()
screen_file: always set new list_window length
screen_file_reload() did not update the list_window length if it was
not connected. This led to an assertion failure.
screen_file_reload() did not update the list_window length if it was
not connected. This led to an assertion failure.
gidle: mpd_glib_enter() returns success
mpd_glib_enter() is unreliable, because it does nothing when called
during the callback, which in turn was invoked by mpd_glib_leave().
Sometimes, mpdclient.idle is wrong because of that. This patch sets
mpdclient.idle to the return value of mpd_glib_enter().
mpd_glib_enter() is unreliable, because it does nothing when called
during the callback, which in turn was invoked by mpd_glib_leave().
Sometimes, mpdclient.idle is wrong because of that. This patch sets
mpdclient.idle to the return value of mpd_glib_enter().
gidle: added internal "destroyed" flag
If mpd_glib_leave() invokes the callback, and the callback destroys
the mpd_glib_source object, mpd_glib_leave() is unable to reset the
"leaving" flag. This patch adds the flag "destroyed" which lets
mpd_glib_leave() do the g_free() when it's ready.
If mpd_glib_leave() invokes the callback, and the callback destroys
the mpd_glib_source object, mpd_glib_leave() is unable to reset the
"leaving" flag. This patch adds the flag "destroyed" which lets
mpd_glib_leave() do the g_free() when it's ready.
screen_help: translate section names
The _() call was missing.
The _() call was missing.
po: updated Russian translation
Conversion to UTF-8.
Conversion to UTF-8.
list_window: removed second column support
Not used anymore, because both screen_browser and screen_queue have a
row paint callback now.
Not used anymore, because both screen_browser and screen_queue have a
row paint callback now.
screen_queue: use paint_song_row()
Reuse code from screen_browser.c. Side effect: this patch disables
horizontal scrolling. The "hscroll" library will return after an
overhaul.
Reuse code from screen_browser.c. Side effect: this patch disables
horizontal scrolling. The "hscroll" library will return after an
overhaul.
screen_help: simplify the list_window callback
Return unmodified strings. Since that callback isn't used for
painting, we don't need to consider the layout here.
Return unmodified strings. Since that callback isn't used for
painting, we don't need to consider the layout here.
screen_help: added paint callback
screen_help: use help_paint()
Don't call list_window_paint() manually.
Don't call list_window_paint() manually.
screen_help: removed the help_text_row_t typedef
Use the struct name.
Use the struct name.
charset: make utf8_with() "pure"
This allows gcc to optimize further.
This allows gcc to optimize further.
screen_queue: check current song only if PLAYER idle event is set
screen_outputs: paint "enabled" checkbox
Instead of painting names in highlighted color, show the "enabled"
state with a checkbox.
Instead of painting names in highlighted color, show the "enabled"
state with a checkbox.
screen_browser: moved paint_song() to song_paint.c
renamed screen_play.c to screen_queue.c
screen_browser: display song duration
screen_browser: don't return directory name with square brackets
Since the browser_lw_callback() isn't used for rendering anymore (only
for searching), we can remove the page breaks.
Since the browser_lw_callback() isn't used for rendering anymore (only
for searching), we can remove the page breaks.
screen_browser: added custom list painting function
Side effect: playlists and directories are rendered with different
colors (configuration "browser-directory" and "browser-playlist").
Side effect: playlists and directories are rendered with different
colors (configuration "browser-directory" and "browser-playlist").
list_window: added callback function for row painting
With the function list_window_paint2(), callers can customize how a
row is painted. The usual callback function is not used anymore.
With the function list_window_paint2(), callers can customize how a
row is painted. The usual callback function is not used anymore.
list_window: moved painting utilities to paint.h
Minor optimization: pass the full row width to whline(). This way,
ncurses performs clipping for us, and we don't have to call
utf8_width().
Minor optimization: pass the full row width to whline(). This way,
ncurses performs clipping for us, and we don't have to call
utf8_width().
screen_browser: added wrapper function screen_browser_paint()
Don't export browser_lw_callback().
Don't export browser_lw_callback().
list_window: simplified narrow cursor drawing
Clear the space after the text before drawing the second column. The
continue drawing the second column.
Clear the space after the text before drawing the second column. The
continue drawing the second column.
list_window: simplify show_cursor formula
And call list_window_get_range() only if show_cursor is true.
And call list_window_get_range() only if show_cursor is true.
list_window: removed selected_start, selected_end
Calculate those two variables on demand. This simplifies a lot of
code, and saves some memory and CPU cycles.
Calculate those two variables on demand. This simplifies a lot of
code, and saves some memory and CPU cycles.
mpdclient: fall back to simple "deleteid" if range is 1
options: removed deprecated password code
libmpdclient2 parses the password from the host name.
libmpdclient2 parses the password from the host name.
list_window: eliminate redundant code in list_window_fetch_cursor()
Use list_window_move_cursor() to eliminate redundant code.
Use list_window_move_cursor() to eliminate redundant code.
list_window: removed redundant range_base checks
No need to check range_base in list_window_check_selected().
No need to check range_base in list_window_check_selected().
list_window: moved checks to list_window_validate_index()
list_window: removed scrolling from list_window_check_selected()
This broke CMD_LIST_FIRST.
This broke CMD_LIST_FIRST.
screen_artist.c: use libmpdclient to obtain artist/album list
Moved the mpdclient_get_artists/albums() code from mpdclient.c to
screen_artist.c.
Moved the mpdclient_get_artists/albums() code from mpdclient.c to
screen_artist.c.
screen_artist: don't pass mpdclient object to free_lists()
It's unused.
It's unused.
mpdclient: merged duplicate code into recv_tag_values()
list_window: fix list_window_check_origin() indentation
list_window: fully disable highlighting code on --enable-mini
list_window: moved code to jump_match()
Simplify the list_window_jump() function.
Simplify the list_window_jump() function.
list_window: don't allow list_window_jump(NULL)
Added an assertion, removed two runtime checks. Same for
list_window_find() and list_window_rfind().
Added an assertion, removed two runtime checks. Same for
list_window_find() and list_window_rfind().
list_window: moved auto-scrolling code to list_window_check_origin()
Moved code from list_window_paint(). Call it in list_window_resize(),
list_window_set_length(), list_window_set_cursor(),
list_window_move_cursor(). Now that all the modifying code has been
removed from list_window_paint(), we can pass a const object to that
function.
Moved code from list_window_paint(). Call it in list_window_resize(),
list_window_set_length(), list_window_set_cursor(),
list_window_move_cursor(). Now that all the modifying code has been
removed from list_window_paint(), we can pass a const object to that
function.
list_window: added function list_window_resize()
Call this function instead of manually setting the "cols" and "rows"
attributes.
Call this function instead of manually setting the "cols" and "rows"
attributes.
list_window: use list_window_move_cursor() in find functions
Don't repeat the range selection code.
Don't repeat the range selection code.
gidle: free all objects in mpd_glib_free()
The mpd_parser object was not freed, and neither was the
mpd_glib_source object.
The mpd_parser object was not freed, and neither was the
mpd_glib_source object.
strfsong: support multiple values for a tag
Concatenate them with ", " in between.
Concatenate them with ", " in between.
screen_song: corrected list_window length
list_window: don't invoke callback out-of-range
For screen rows after the end of the list, don't invoke the callback.
We know the length of the list, and we know that the callback will
return NULL anyway.
Optimization: after the end of the list, call wclrtobot() to clear all
of the remaining visible (empty) lines.
For screen rows after the end of the list, don't invoke the callback.
We know the length of the list, and we know that the callback will
return NULL anyway.
Optimization: after the end of the list, call wclrtobot() to clear all
of the remaining visible (empty) lines.
list_window: added attribute "length"
Don't pass the number of list items to each and every function.
Instead, call list_window_set_length() each time the list contents
change.
Don't pass the number of list items to each and every function.
Instead, call list_window_set_length() each time the list contents
change.
screen_search: moved help text into a global variable
gidle: work around nested leave/enter problem
Add the flag "leaving" which disables the mpd_glib_enter() function
while mpd_glib_leave() is running.
Add the flag "leaving" which disables the mpd_glib_enter() function
while mpd_glib_leave() is running.
mpdclient: set all idle events on disconnect
After a disconnect, all subsystems have to consider the "new data"
(i.e. nothing).
After a disconnect, all subsystems have to consider the "new data"
(i.e. nothing).
list_window: disable support for second column on --enable-mini
screen_keydef: call list_window_reset() after entering a command
screen_{play,keydef,text}: use list_window_set_cursor()
Don't write list_window.selected directly.
Don't write list_window.selected directly.
list_window: moved code to list_window_fetch_cursor()
Merged code from screen_play.c and list_window_scroll_up(),
list_window_scroll_down().
Merged code from screen_play.c and list_window_scroll_up(),
list_window_scroll_down().
list_window: splitted function list_window_set_selected()
list_window_set_selected() becomes list_window_move_cursor().
list_window_set_cursor() is the new public function, which sets the
cursor and disables range selection.
list_window_set_selected() becomes list_window_move_cursor().
list_window_set_cursor() is the new public function, which sets the
cursor and disables range selection.
screen_text: start searching at window origin, not bottom
Don't add "text->lw->rows" to the window origin. This won't find text
displayed on the screen. This patch affects the lyrics screen.
Don't add "text->lw->rows" to the window origin. This won't find text
displayed on the screen. This patch affects the lyrics screen.
screen_play: repaint after the "select-playing" command
When the cursor moves, we have to repaint the list.
When the cursor moves, we have to repaint the list.
list_window: fix narrow cursor drawing
When there's a second column (e.g. in the playlist screen), the space
between the two columns isn't cleared properly, because the cursor
position was changed by the second column renderer.
Side effect of this patch: space drawing is a little bit optimized,
because it won't clear the second column (in wide-cursor mode) only to
draw the second column text on top of it.
When there's a second column (e.g. in the playlist screen), the space
between the two columns isn't cleared properly, because the cursor
position was changed by the second column renderer.
Side effect of this patch: space drawing is a little bit optimized,
because it won't clear the second column (in wide-cursor mode) only to
draw the second column text on top of it.
list_window: optimize second column drawing
Paint the space with waddch() instead of waddstr(). Removed the
second cursor movement, it's redundant.
Paint the space with waddch() instead of waddstr(). Removed the
second cursor movement, it's redundant.
list_window: moved code to list_window_paint_row()
list_window: simplified the selection painting code
Combine all the checks in the two boolean variables "show_cursor" and
"selected".
Combine all the checks in the two boolean variables "show_cursor" and
"selected".
list_window: removed the list_window_t typedef
Use the plain struct name "list_window".
Use the plain struct name "list_window".
list_window: don't allow list_window_free(NULL)
Also don't clear the list_window object.
Also don't clear the list_window object.
lyrics: replaced asserts with error handler
Handle missing artist and/or title for lyrics by defining an empty list of
plugins that fails almost immediately. Note that args in lyrics_load may now
start with NULL as the first array element. make_argv() in plugin.c made the
assumption that at least one argument is passed. If the first argument is
NULL a bogus pointer is returned by make_argv(). By converting do {} while
into while {}, we allow the first argument to be NULL.
Handle missing artist and/or title for lyrics by defining an empty list of
plugins that fails almost immediately. Note that args in lyrics_load may now
start with NULL as the first array element. make_argv() in plugin.c made the
assumption that at least one argument is passed. If the first argument is
NULL a bogus pointer is returned by make_argv(). By converting do {} while
into while {}, we allow the first argument to be NULL.
po: updated French translation
options: convert timedisplay_type into a bool variable
Save some CPU and memory by using bool instead of a string. This
patch also removes the compile-time option
--with-default-timedisplay_type.
Save some CPU and memory by using bool instead of a string. This
patch also removes the compile-time option
--with-default-timedisplay_type.
options: disable the status bar clock by default
main: don't call mpdclient_update() for clock update
When the "update timer" is running because the clock is enabled, don't
call mpdclient_update() in each tick. For the clock, it's enough to
update MPD only when an idle event occurs. While MPD is playing, we
still need MPD updates, beacuse we need the new "elapsed" time.
When the "update timer" is running because the clock is enabled, don't
call mpdclient_update() in each tick. For the clock, it's enough to
update MPD only when an idle event occurs. While MPD is playing, we
still need MPD updates, beacuse we need the new "elapsed" time.
screen: force repaint progress window in screen_paint()
charset: removed duplicate return
leoslyrics plugin: handle parser exceptions
Should fix bug #2286. Added exception handling for both calls of the SAX
XML parser. Also removed trailing newlines from the result to keep us from
scrolling down further than the last line.
Should fix bug #2286. Added exception handling for both calls of the SAX
XML parser. Also removed trailing newlines from the result to keep us from
scrolling down further than the last line.
mpdclient: use the "idle" command to reduce CPU and network usage
This patch makes mpdclient and the rest of ncmpc use the new
mpd_glib_source class. When mpdclient_get_connection() is called, it
sends the "noidle" command to MPD. Upon mpdclient_put_connection()
(which is called before returning control back to GLib), mpdclient.c
re-enters "idle" mode. The "idle" event handler lives in main.c, and
replaces timer_mpd_update().
Currently, the update timer is still used when MPD is playing, to keep
the progress bar and the time up to date. This is subject to change
soon.
Servers which do not support "idle" are detected automatically.
This patch makes mpdclient and the rest of ncmpc use the new
mpd_glib_source class. When mpdclient_get_connection() is called, it
sends the "noidle" command to MPD. Upon mpdclient_put_connection()
(which is called before returning control back to GLib), mpdclient.c
re-enters "idle" mode. The "idle" event handler lives in main.c, and
replaces timer_mpd_update().
Currently, the update timer is still used when MPD is playing, to keep
the progress bar and the time up to date. This is subject to change
soon.
Servers which do not support "idle" are detected automatically.