Changeset 3890f30a863e18a1a8ca7114c2285ddcdf0349f9
- Timestamp:
- 18/11/07 21:47:58
(1 year ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1195418878 +0000
- git-parent:
[a89d3bb46ca0b352eba3790ca2a856802722be9b]
- git-author:
- Rafaël Carré <funman@videolan.org> 1195418878 +0000
- Message:
ncurses: various bugfixes
- Workaround KEY_END not working with $TERM=xterm on FreeBSD
- Don't abort when printing strings with unprintable characters ( for example when the user presses ctrl+something in FIND or OPEN boxes )
- Show a '*' in front of the current node
- Add files in the correct node
This is how nodes do work in ncurses: When you select an item with 'Enter',
- if it's a leaf, then start playing it, and set the current node to the toplevel parent of that leaf (example: local playlist, or media library)
- if it's an empty node, then stop the playlist, and set the current node to be that one, so you can add items to it
- if it's a node with children, set the current node to that one, and start playing the next children of that one
The "current node" means that the playlist will never reach items which aren't direct or indirect children of that node, and so it will stop after the last one has been reached
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rff6ab8f |
r3890f30 |
|
| 541 | 541 | p_sys->i_box_plidx = 0; |
|---|
| 542 | 542 | break; |
|---|
| | 543 | #ifdef __FreeBSD__ |
|---|
| | 544 | /* workaround for FreeBSD + xterm: |
|---|
| | 545 | * see http://www.nabble.com/curses-vs.-xterm-key-mismatch-t3574377.html */ |
|---|
| | 546 | case KEY_SELECT: |
|---|
| | 547 | #endif |
|---|
| 543 | 548 | case KEY_END: |
|---|
| 544 | 549 | p_sys->i_box_plidx = p_sys->p_playlist->items.i_size - 1; |
|---|
| … | … | |
| 601 | 606 | VLC_TRUE, p_parent, p_item ); |
|---|
| 602 | 607 | } |
|---|
| | 608 | else if( p_sys->pp_plist[p_sys->i_box_plidx]->p_item->i_children |
|---|
| | 609 | == 0 ) |
|---|
| | 610 | { /* We only want to set the current node */ |
|---|
| | 611 | vlc_object_lock( p_sys->p_playlist ); |
|---|
| | 612 | |
|---|
| | 613 | p_sys->p_playlist->request.p_node = |
|---|
| | 614 | p_sys->pp_plist[p_sys->i_box_plidx]->p_item; |
|---|
| | 615 | p_sys->p_playlist->request.i_skip = 0; |
|---|
| | 616 | p_sys->p_playlist->request.p_item = |
|---|
| | 617 | p_sys->p_playlist->status.p_item; |
|---|
| | 618 | p_sys->p_playlist->request.b_request = VLC_TRUE; |
|---|
| | 619 | p_sys->p_playlist->request.i_status = PLAYLIST_STOPPED; |
|---|
| | 620 | |
|---|
| | 621 | vlc_object_unlock( p_sys->p_playlist ); |
|---|
| | 622 | } |
|---|
| 603 | 623 | else |
|---|
| 604 | | { /* FIXME doesn't work if the node is empty */ |
|---|
| | 624 | { |
|---|
| 605 | 625 | playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY, |
|---|
| 606 | 626 | VLC_TRUE, |
|---|
| … | … | |
| 636 | 656 | p_sys->i_box_bidx = 0; |
|---|
| 637 | 657 | break; |
|---|
| | 658 | #ifdef __FreeBSD__ |
|---|
| | 659 | case KEY_SELECT: |
|---|
| | 660 | #endif |
|---|
| 638 | 661 | case KEY_END: |
|---|
| 639 | 662 | p_sys->i_box_bidx = p_sys->i_dir_entries - 1; |
|---|
| … | … | |
| 670 | 693 | playlist_item_t *p_parent = p_sys->p_playlist->status.p_node; |
|---|
| 671 | 694 | if( !p_parent ) |
|---|
| 672 | | p_parent = p_sys->p_playlist->p_root_onelevel; |
|---|
| 673 | | |
|---|
| 674 | | while( p_parent->p_parent ) |
|---|
| | 695 | p_parent = p_sys->p_playlist->p_local_onelevel; |
|---|
| | 696 | |
|---|
| | 697 | while( p_parent->p_parent && p_parent->p_parent->p_parent ) |
|---|
| 675 | 698 | p_parent = p_parent->p_parent; |
|---|
| 676 | 699 | |
|---|
| 677 | 700 | playlist_Add( p_sys->p_playlist, psz_uri, NULL, |
|---|
| 678 | 701 | PLAYLIST_APPEND, PLAYLIST_END, |
|---|
| 679 | | p_parent == p_sys->p_playlist->p_root_onelevel |
|---|
| | 702 | p_parent->p_input == |
|---|
| | 703 | p_sys->p_playlist->p_local_onelevel->p_input |
|---|
| 680 | 704 | , VLC_FALSE ); |
|---|
| 681 | 705 | p_sys->i_box_type = BOX_PLAYLIST; |
|---|
| … | … | |
| 714 | 738 | p_sys->i_box_start = 0; |
|---|
| 715 | 739 | return 1; |
|---|
| | 740 | #ifdef __FreeBSD__ |
|---|
| | 741 | case KEY_SELECT: |
|---|
| | 742 | #endif |
|---|
| 716 | 743 | case KEY_END: |
|---|
| 717 | 744 | p_sys->i_box_start = p_sys->i_box_lines_total - 1; |
|---|
| … | … | |
| 749 | 776 | ManageSlider( p_intf ); |
|---|
| 750 | 777 | return 1; |
|---|
| | 778 | #ifdef __FreeBSD__ |
|---|
| | 779 | case KEY_SELECT: |
|---|
| | 780 | #endif |
|---|
| 751 | 781 | case KEY_END: |
|---|
| 752 | 782 | p_sys->f_slider = 99.9; |
|---|
| … | … | |
| 835 | 865 | { |
|---|
| 836 | 866 | playlist_item_t *p_parent = p_sys->p_playlist->status.p_node; |
|---|
| | 867 | |
|---|
| 837 | 868 | if( !p_parent ) |
|---|
| 838 | | p_parent = p_sys->p_playlist->p_root_onelevel; |
|---|
| 839 | | |
|---|
| 840 | | while( p_parent->p_parent ) |
|---|
| | 869 | p_parent = p_sys->p_playlist->p_local_onelevel; |
|---|
| | 870 | |
|---|
| | 871 | while( p_parent->p_parent && p_parent->p_parent->p_parent ) |
|---|
| 841 | 872 | p_parent = p_parent->p_parent; |
|---|
| 842 | 873 | |
|---|
| 843 | 874 | playlist_Add( p_playlist, p_sys->psz_open_chain, NULL, |
|---|
| 844 | 875 | PLAYLIST_APPEND|PLAYLIST_GO, PLAYLIST_END, |
|---|
| 845 | | p_parent == p_sys->p_playlist->p_root_onelevel |
|---|
| | 876 | p_parent->p_input == |
|---|
| | 877 | p_sys->p_playlist->p_local_onelevel->p_input |
|---|
| 846 | 878 | , VLC_FALSE ); |
|---|
| 847 | 879 | p_sys->b_box_plidx_follow = VLC_TRUE; |
|---|
| … | … | |
| 1193 | 1225 | i_width = wcswidth( psz_wide, i_char_len ); |
|---|
| 1194 | 1226 | if( i_width == (size_t)-1 ) |
|---|
| | 1227 | { |
|---|
| 1195 | 1228 | /* a non printable character was encountered */ |
|---|
| 1196 | | abort(); |
|---|
| | 1229 | unsigned int i; |
|---|
| | 1230 | int i_cwidth; |
|---|
| | 1231 | i_width = 0; |
|---|
| | 1232 | for( i = 0 ; i < i_char_len ; i++ ) |
|---|
| | 1233 | { |
|---|
| | 1234 | i_cwidth = wcwidth( psz_wide[i] ); |
|---|
| | 1235 | if( i_cwidth != -1 ) |
|---|
| | 1236 | i_width += i_cwidth; |
|---|
| | 1237 | } |
|---|
| | 1238 | } |
|---|
| 1197 | 1239 | } |
|---|
| 1198 | 1240 | if( i_width > (size_t)w ) |
|---|
| … | … | |
| 1791 | 1833 | { |
|---|
| 1792 | 1834 | vlc_bool_t b_selected = ( p_sys->i_box_plidx == i_item ); |
|---|
| 1793 | | int c = ( PlaylistIsPlaying( p_intf, |
|---|
| 1794 | | p_sys->pp_plist[i_item]->p_item ) ) ? '>' : ' '; |
|---|
| | 1835 | int c = ' '; |
|---|
| | 1836 | if( p_sys->pp_plist[i_item]->p_item->p_input == |
|---|
| | 1837 | p_sys->p_playlist->status.p_node->p_input ) |
|---|
| | 1838 | c = '*'; |
|---|
| | 1839 | else if( PlaylistIsPlaying( p_intf, |
|---|
| | 1840 | p_sys->pp_plist[i_item]->p_item ) ) |
|---|
| | 1841 | c = '>'; |
|---|
| 1795 | 1842 | |
|---|
| 1796 | 1843 | if( y >= y_end ) break; |
|---|