Changeset 9bd7b3750efafe34f0df0d6c7965f69837b9177d
- Timestamp:
- 10/01/08 19:20:43 (11 months ago)
- git-parent:
- Files:
-
- modules/gui/ncurses.c (modified) (52 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/gui/ncurses.c
rc90ad6f r9bd7b37 2 2 * ncurses.c : NCurses interface for vlc 3 3 ***************************************************************************** 4 * Copyright (C)2001-2007 the VideoLAN team4 * Copyright © 2001-2007 the VideoLAN team 5 5 * $Id$ 6 6 * … … 26 26 *****************************************************************************/ 27 27 28 /* 29 * Note that when we use wide characters (and link with libncursesw), 30 * we assume that an UTF8 locale is used (or compatible, such as ASCII). 31 * Other characters encodings are not supported. 32 */ 33 28 34 /***************************************************************************** 29 35 * Preamble 30 36 *****************************************************************************/ 31 37 #include <vlc/vlc.h> 32 33 #include <errno.h> /* ENOMEM */34 #include <time.h>35 38 36 39 #ifdef HAVE_NCURSESW … … 99 102 static void ReadDir ( intf_thread_t * ); 100 103 104 static void start_color_and_pairs ( intf_thread_t * ); 105 101 106 /***************************************************************************** 102 107 * Module descriptor … … 136 141 enum 137 142 { 143 C_DEFAULT = 0, 144 C_TITLE, 145 C_PLAYLIST_1, 146 C_PLAYLIST_2, 147 C_PLAYLIST_3, 148 C_BOX, 149 C_STATUS, 150 C_INFO, 151 C_ERROR, 152 C_WARNING, 153 C_DEBUG, 154 C_CATEGORY, 155 C_FOLDER 156 }; 157 enum 158 { 138 159 VIEW_CATEGORY, 139 160 VIEW_ONELEVEL … … 152 173 { 153 174 input_thread_t *p_input; 175 176 vlc_bool_t b_color; 177 vlc_bool_t b_color_started; 154 178 155 179 float f_slider; … … 179 203 180 204 char *psz_open_chain; 205 #ifndef HAVE_NCURSESW 181 206 char psz_partial_keys[7]; 207 #endif 182 208 183 209 char *psz_current_dir; … … 194 220 }; 195 221 196 static void DrawBox( WINDOW *win, int y, int x, int h, int w, const char *title );222 static void DrawBox( WINDOW *win, int y, int x, int h, int w, const char *title, vlc_bool_t b_color ); 197 223 static void DrawLine( WINDOW *win, int y, int x, int w ); 198 224 static void DrawEmptyLine( WINDOW *win, int y, int x, int w ); … … 222 248 p_sys->i_box_bidx = 0; 223 249 p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 250 p_sys->b_color = p_this->p_libvlc->b_color; 251 p_sys->b_color_started = VLC_FALSE; 252 253 #ifndef HAVE_NCURSESW 224 254 memset( p_sys->psz_partial_keys, 0, sizeof( p_sys->psz_partial_keys ) ); 255 #endif 225 256 226 257 /* Initialize the curses library */ 227 258 p_sys->w = initscr(); 259 260 if( p_sys->b_color ) 261 start_color_and_pairs( p_intf ); 262 228 263 keypad( p_sys->w, TRUE ); 229 264 /* Don't do NL -> CR/NL */ … … 233 268 /* Don't echo */ 234 269 noecho(); 235 236 curs_set(0); 237 timeout(0); 270 /* Invisible cursor */ 271 curs_set( 0 ); 272 /* Non blocking wgetch() */ 273 wtimeout( p_sys->w, 0 ); 238 274 239 275 clear(); … … 387 423 FindIndex( p_intf ); 388 424 } 389 390 while( ( i_key = getch() ) != -1 )425 426 while( ( i_key = wgetch( p_sys->w ) ) != -1 ) 391 427 { 392 428 /* … … 418 454 419 455 /* following functions are local */ 456 static void start_color_and_pairs( intf_thread_t *p_intf ) 457 { 458 assert( p_intf->p_sys->b_color && !p_intf->p_sys->b_color_started ); 459 460 if( !has_colors() ) 461 { 462 p_intf->p_sys->b_color = VLC_FALSE; 463 msg_Warn( p_intf, "Terminal doesn't support colors" ); 464 return; 465 } 466 467 start_color(); 468 469 /* Available colors: BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE */ 470 471 /* untested, in all my terminals, !can_change_color() --funman */ 472 if( can_change_color() ) 473 init_color( COLOR_YELLOW, 960, 500, 0 ); /* YELLOW -> ORANGE */ 474 475 /* title */ 476 init_pair( C_TITLE, COLOR_YELLOW, COLOR_BLACK ); 477 478 /* jamaican playlist */ 479 init_pair( C_PLAYLIST_1, COLOR_GREEN, COLOR_BLACK ); 480 init_pair( C_PLAYLIST_2, COLOR_YELLOW, COLOR_BLACK ); 481 init_pair( C_PLAYLIST_3, COLOR_RED, COLOR_BLACK ); 482 483 /* used in DrawBox() */ 484 init_pair( C_BOX, COLOR_CYAN, COLOR_BLACK ); 485 /* Source, State, Position, Volume, Chapters, etc...*/ 486 init_pair( C_STATUS, COLOR_BLUE, COLOR_BLACK ); 487 488 /* VLC messages, keep the order from highest priority to lowest */ 489 490 /* infos */ 491 init_pair( C_INFO, COLOR_BLACK, COLOR_WHITE ); 492 /* errors */ 493 init_pair( C_ERROR, COLOR_RED, COLOR_BLACK ); 494 /* warnings */ 495 init_pair( C_WARNING, COLOR_YELLOW, COLOR_BLACK ); 496 /* debug */ 497 init_pair( C_DEBUG, COLOR_WHITE, COLOR_BLACK ); 498 499 /* Category title (help, info, metadata) */ 500 init_pair( C_CATEGORY, COLOR_MAGENTA, COLOR_BLACK ); 501 502 /* Folder (BOX_BROWSE) */ 503 init_pair( C_FOLDER, COLOR_RED, COLOR_BLACK ); 504 505 p_intf->p_sys->b_color_started = VLC_TRUE; 506 } 507 508 #ifndef HAVE_NCURSESW 420 509 static char *KeyToUTF8( int i_key, char *psz_part ) 421 510 { … … 431 520 psz_part[len] = (char)i_key; 432 521 433 #ifdef HAVE_NCURSESW434 psz_utf8 = strdup( psz_part );435 #else436 522 psz_utf8 = FromLocaleDup( psz_part ); 437 523 … … 454 540 return NULL; 455 541 } 456 #endif457 542 458 543 memset( psz_part, 0, 6 ); 459 544 return psz_utf8; 460 545 } 546 #endif 461 547 462 548 static inline int RemoveLastUTF8Entity( char *psz, int len ) … … 557 643 case 'D': 558 644 case KEY_BACKSPACE: 645 case 0x7f: 559 646 case KEY_DC: 560 647 { … … 579 666 580 667 case KEY_ENTER: 581 case 0x0d: 668 case '\r': 669 case '\n': 582 670 if( !p_sys->pp_plist[p_sys->i_box_plidx] ) 583 671 { … … 664 752 665 753 case KEY_ENTER: 666 case 0x0d: 754 case '\r': 755 case '\n': 667 756 case ' ': 668 757 if( p_sys->pp_dir_entries[p_sys->i_box_bidx]->b_file || i_key == ' ' ) … … 787 876 else if( p_sys->i_box_type == BOX_SEARCH && p_sys->psz_search_chain ) 788 877 { 789 int i_chain_len; 790 i_chain_len = strlen( p_sys->psz_search_chain ); 878 int i_chain_len = strlen( p_sys->psz_search_chain ); 791 879 switch( i_key ) 792 880 { 881 case KEY_CLEAR: 793 882 case 0x0c: /* ^l */ 794 883 clear(); 795 884 return 1; 796 885 case KEY_ENTER: 797 case 0x0d: 886 case '\r': 887 case '\n': 798 888 if( i_chain_len > 0 ) 799 889 { … … 806 896 p_sys->i_box_type = BOX_PLAYLIST; 807 897 return 1; 808 case 0x1b: /* Esc. */ 898 case 0x1b: /* ESC */ 899 /* Alt+key combinations return 2 keys in the terminal keyboard: 900 * ESC, and the 2nd key. 901 * If some other key is available immediately (where immediately 902 * means after wgetch() 1 second delay ), that means that the 903 * ESC key was not pressed. 904 * 905 * man 3X curs_getch says: 906 * 907 * Use of the escape key by a programmer for a single 908 * character function is discouraged, as it will cause a delay 909 * of up to one second while the keypad code looks for a 910 * following function-key sequence. 911 * 912 */ 913 if( wgetch( p_sys->w ) != ERR ) 914 return 0; 809 915 p_sys->i_box_plidx = p_sys->i_before_search; 810 916 p_sys->i_box_type = BOX_PLAYLIST; 811 917 return 1; 812 918 case KEY_BACKSPACE: 919 case 0x7f: 813 920 RemoveLastUTF8Entity( p_sys->psz_search_chain, i_chain_len ); 814 921 break; 815 922 default: 816 923 { 924 #ifdef HAVE_NCURSESW 925 if( i_chain_len + 1 < SEARCH_CHAIN_SIZE ) 926 { 927 p_sys->psz_search_chain[i_chain_len] = (char) i_key; 928 p_sys->psz_search_chain[i_chain_len + 1] = '\0'; 929 } 930 #else 817 931 char *psz_utf8 = KeyToUTF8( i_key, p_sys->psz_partial_keys ); 818 932 … … 826 940 free( psz_utf8 ); 827 941 } 942 #endif 828 943 break; 829 944 } … … 843 958 switch( i_key ) 844 959 { 845 case 0x0c: /* ^l */ 960 case KEY_CLEAR: 961 case 0x0c: /* ^l */ 846 962 clear(); 847 963 return 1; 848 964 case KEY_ENTER: 849 case 0x0d: 965 case '\r': 966 case '\n': 850 967 if( i_chain_len > 0 ) 851 968 { … … 870 987 p_sys->i_box_type = BOX_PLAYLIST; 871 988 return 1; 872 case 0x1b: /* Esc. */ 989 case 0x1b: /* ESC */ 990 if( wgetch( p_sys->w ) != ERR ) 991 return 0; 873 992 p_sys->i_box_type = BOX_PLAYLIST; 874 993 return 1; 875 994 case KEY_BACKSPACE: 995 case 0x7f: 876 996 RemoveLastUTF8Entity( p_sys->psz_open_chain, i_chain_len ); 877 997 break; 878 998 default: 879 999 { 1000 #ifdef HAVE_NCURSESW 1001 if( i_chain_len + 1 < OPEN_CHAIN_SIZE ) 1002 { 1003 p_sys->psz_open_chain[i_chain_len] = (char) i_key; 1004 p_sys->psz_open_chain[i_chain_len + 1] = '\0'; 1005 } 1006 #else 880 1007 char *psz_utf8 = KeyToUTF8( i_key, p_sys->psz_partial_keys ); 881 1008 … … 889 1016 free( psz_utf8 ); 890 1017 } 1018 #endif 891 1019 break; 892 1020 } … … 899 1027 switch( i_key ) 900 1028 { 1029 case 0x1b: /* ESC */ 1030 if( wgetch( p_sys->w ) != ERR ) 1031 return 0; 901 1032 case 'q': 902 1033 case 'Q': 903 case 0x1b: /* Esc */1034 case KEY_EXIT: 904 1035 vlc_object_kill( p_intf->p_libvlc ); 905 1036 return 0; … … 938 1069 p_sys->i_box_type = BOX_BROWSE; 939 1070 return 1; 1071 case 'c': 1072 p_sys->b_color = !p_sys->b_color; 1073 if( p_sys->b_color && !p_sys->b_color_started ) 1074 start_color_and_pairs( p_intf ); 1075 return 1; 940 1076 case 'h': 941 1077 case 'H': … … 1076 1212 * ^l should clear and redraw the screen 1077 1213 */ 1078 case 0x0c: 1214 case KEY_CLEAR: 1215 case 0x0c: /* ^l */ 1079 1216 clear(); 1080 1217 return 1; … … 1193 1330 if( i_char_len == (size_t)-1 ) 1194 1331 /* an invalid character was encountered */ 1195 abort();1332 return; 1196 1333 else 1197 1334 { … … 1329 1466 /* Title */ 1330 1467 attrset( A_REVERSE ); 1331 int i_len = strlen( "VLC media player [ h for help ]");1468 int i_len = strlen( "VLC media player "PACKAGE_VERSION ); 1332 1469 int mid = ( COLS - i_len ) / 2; 1333 1470 if( mid < 0 ) … … 1336 1473 char psz_title[i_size]; 1337 1474 memset( psz_title, ' ', mid ); 1338 snprintf( &psz_title[mid], i_size, "VLC media player [ h for help ]" ); 1475 if( p_sys->b_color ) 1476 wcolor_set( p_sys->w, C_TITLE, NULL ); 1477 snprintf( &psz_title[mid], i_size, "VLC media player "PACKAGE_VERSION ); 1339 1478 mvnprintw( y, 0, COLS, "%s", psz_title ); 1340 1479 attroff( A_REVERSE ); 1341 1480 y += 2; 1342 1481 1482 if( p_sys->b_color ) 1483 wcolor_set( p_sys->w, C_STATUS, NULL ); 1484 1343 1485 /* Infos */ 1344 1345 char psz_state[25]; 1346 /* strlen( "[Repeat] [Random] [Loop]" ) == 24, + '\0' */ 1347 psz_state[0] = '\0'; 1348 if( var_GetBool( p_playlist, "repeat" ) ) 1349 strcat( psz_state, "[Repeat] " ); 1350 if( var_GetBool( p_playlist, "random" ) ) 1351 strcat( psz_state, "[Random] " ); 1352 if( var_GetBool( p_playlist, "loop" ) ) 1353 strcat( psz_state, "[Loop]" ); 1486 char *psz_state; 1487 if( asprintf( &psz_state, "%s%s%s", 1488 var_GetBool( p_playlist, "repeat" ) ? _( "[Repeat] " ) : "", 1489 var_GetBool( p_playlist, "random" ) ? _( "[Random] " ) : "", 1490 var_GetBool( p_playlist, "loop" ) ? _( "[Loop]" ) : "" ) == -1 ) 1491 psz_state = NULL; 1354 1492 1355 1493 if( p_input && !p_input->b_dead ) … … 1362 1500 /* Source */ 1363 1501 char *psz_uri = input_item_GetURI( input_GetItem( p_input ) ); 1364 mvnprintw( y++, 0, COLS, " Source : %s", psz_uri );1502 mvnprintw( y++, 0, COLS, _(" Source : %s"), psz_uri ); 1365 1503 free( psz_uri ); 1366 1504 … … 1369 1507 if( val.i_int == PLAYING_S ) 1370 1508 { 1371 mvnprintw( y++, 0, COLS, " State : Playing %s", psz_state );1509 mvnprintw( y++, 0, COLS, _(" State : Playing %s"), psz_state ); 1372 1510 } 1373 1511 else if( val.i_int == OPENING_S ) 1374 1512 { 1375 mvnprintw( y++, 0, COLS, " State : Opening/Connecting %s", psz_state );1513 mvnprintw( y++, 0, COLS, _(" State : Opening/Connecting %s"), psz_state ); 1376 1514 } 1377 1515 else if( val.i_int == BUFFERING_S ) 1378 1516 { 1379 mvnprintw( y++, 0, COLS, " State : Buffering %s", psz_state );1517 mvnprintw( y++, 0, COLS, _(" State : Buffering %s"), psz_state ); 1380 1518 } 1381 1519 else if( val.i_int == PAUSE_S ) 1382 1520 { 1383 mvnprintw( y++, 0, COLS, " State : Paused %s", psz_state );1521 mvnprintw( y++, 0, COLS, _(" State : Paused %s"), psz_state ); 1384 1522 } 1385 1523 … … 1395 1533 msecstotimestr( buf2, val.i_time / 1000 ); 1396 1534 1397 mvnprintw( y++, 0, COLS, " Position : %s/%s (%.2f%%)", buf1, buf2, p_sys->f_slider );1535 mvnprintw( y++, 0, COLS, _(" Position : %s/%s (%.2f%%)"), buf1, buf2, p_sys->f_slider ); 1398 1536 1399 1537 /* Volume */ 1400 1538 aout_VolumeGet( p_intf, &i_volume ); 1401 mvnprintw( y++, 0, COLS, " Volume : %i%%", i_volume*200/AOUT_VOLUME_MAX );1539 mvnprintw( y++, 0, COLS, _(" Volume : %i%%"), i_volume*200/AOUT_VOLUME_MAX ); 1402 1540 1403 1541 /* Title */ … … 1407 1545 if( val_list.p_list->i_count > 0 ) 1408 1546 { 1409 mvnprintw( y++, 0, COLS, " Title : %d/%d", val.i_int, val_list.p_list->i_count );1547 mvnprintw( y++, 0, COLS, _(" Title : %d/%d"), val.i_int, val_list.p_list->i_count ); 1410 1548 } 1411 1549 var_Change( p_input, "title", VLC_VAR_FREELIST, &val_list, NULL ); … … 1418 1556 if( val_list.p_list->i_count > 0 ) 1419 1557 { 1420 mvnprintw( y++, 0, COLS, " Chapter : %d/%d", val.i_int, val_list.p_list->i_count );1558 mvnprintw( y++, 0, COLS, _(" Chapter : %d/%d"), val.i_int, val_list.p_list->i_count ); 1421 1559 } 1422 1560 var_Change( p_input, "chapter", VLC_VAR_FREELIST, &val_list, NULL ); … … 1430 1568 else 1431 1569 { 1432 mvnprintw( y++, 0, COLS, "Source: <no current item> %s", psz_state );1570 mvnprintw( y++, 0, COLS, _(" Source: <no current item> %s"), psz_state ); 1433 1571 DrawEmptyLine( p_sys->w, y++, 0, COLS ); 1572 mvnprintw( y++, 0, COLS, _(" [ h for help ]") ); 1434 1573 DrawEmptyLine( p_sys->w, y++, 0, COLS ); 1435 DrawEmptyLine( p_sys->w, y++, 0, COLS ); 1436 } 1437 1438 DrawBox( p_sys->w, y, 0, 3, COLS, "" ); 1574 } 1575 free( psz_state ); 1576 if( p_sys->b_color ) 1577 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1578 1579 DrawBox( p_sys->w, y, 0, 3, COLS, "", p_sys->b_color ); 1439 1580 DrawEmptyLine( p_sys->w, y+1, 1, COLS-2); 1440 1581 DrawLine( p_sys->w, y+1, 1, (int)(p_intf->p_sys->f_slider/100.0 * (COLS -2)) ); … … 1451 1592 /* Help box */ 1452 1593 int l = 0; 1453 DrawBox( p_sys->w, y++, 0, h, COLS, " Help " ); 1454 1455 MainBoxWrite( p_intf, l++, 1, "[Display]" ); 1456 MainBoxWrite( p_intf, l++, 1, " h,H Show/Hide help box" ); 1457 MainBoxWrite( p_intf, l++, 1, " i Show/Hide info box" ); 1458 MainBoxWrite( p_intf, l++, 1, " m Show/Hide metadata box" ); 1459 MainBoxWrite( p_intf, l++, 1, " L Show/Hide messages box" ); 1460 MainBoxWrite( p_intf, l++, 1, " P Show/Hide playlist box" ); 1461 MainBoxWrite( p_intf, l++, 1, " B Show/Hide filebrowser" ); 1594 DrawBox( p_sys->w, y++, 0, h, COLS, _(" Help "), p_sys->b_color ); 1595 1596 if( p_sys->b_color ) 1597 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1598 MainBoxWrite( p_intf, l++, 1, _("[Display]") ); 1599 if( p_sys->b_color ) 1600 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1601 MainBoxWrite( p_intf, l++, 1, _(" h,H Show/Hide help box") ); 1602 MainBoxWrite( p_intf, l++, 1, _(" i Show/Hide info box") ); 1603 MainBoxWrite( p_intf, l++, 1, _(" m Show/Hide metadata box") ); 1604 MainBoxWrite( p_intf, l++, 1, _(" L Show/Hide messages box") ); 1605 MainBoxWrite( p_intf, l++, 1, _(" P Show/Hide playlist box") ); 1606 MainBoxWrite( p_intf, l++, 1, _(" B Show/Hide filebrowser") ); 1607 MainBoxWrite( p_intf, l++, 1, _(" c Switch color on/off") ); 1608 MainBoxWrite( p_intf, l++, 1, _(" Esc Close Add/Search entry") ); 1462 1609 MainBoxWrite( p_intf, l++, 1, "" ); 1463 1610 1464 MainBoxWrite( p_intf, l++, 1, "[Global]" ); 1465 MainBoxWrite( p_intf, l++, 1, " q, Q Quit" ); 1466 MainBoxWrite( p_intf, l++, 1, " s Stop" ); 1467 MainBoxWrite( p_intf, l++, 1, " <space> Pause/Play" ); 1468 MainBoxWrite( p_intf, l++, 1, " f Toggle Fullscreen" ); 1469 MainBoxWrite( p_intf, l++, 1, " n, p Next/Previous playlist item" ); 1470 MainBoxWrite( p_intf, l++, 1, " [, ] Next/Previous title" ); 1471 MainBoxWrite( p_intf, l++, 1, " <, > Next/Previous chapter" ); 1472 MainBoxWrite( p_intf, l++, 1, " <right> Seek +1%%" ); 1473 MainBoxWrite( p_intf, l++, 1, " <left> Seek -1%%" ); 1474 MainBoxWrite( p_intf, l++, 1, " a Volume Up" ); 1475 MainBoxWrite( p_intf, l++, 1, " z Volume Down" ); 1611 if( p_sys->b_color ) 1612 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1613 MainBoxWrite( p_intf, l++, 1, _("[Global]") ); 1614 if( p_sys->b_color ) 1615 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1616 MainBoxWrite( p_intf, l++, 1, _(" q, Q, Esc Quit") ); 1617 MainBoxWrite( p_intf, l++, 1, _(" s Stop") ); 1618 MainBoxWrite( p_intf, l++, 1, _(" <space> Pause/Play") ); 1619 MainBoxWrite( p_intf, l++, 1, _(" f Toggle Fullscreen") ); 1620 MainBoxWrite( p_intf, l++, 1, _(" n, p Next/Previous playlist item") ); 1621 MainBoxWrite( p_intf, l++, 1, _(" [, ] Next/Previous title") ); 1622 MainBoxWrite( p_intf, l++, 1, _(" <, > Next/Previous chapter") ); 1623 MainBoxWrite( p_intf, l++, 1, _(" <right> Seek +1%%") ); 1624 MainBoxWrite( p_intf, l++, 1, _(" <left> Seek -1%%") ); 1625 MainBoxWrite( p_intf, l++, 1, _(" a Volume Up") ); 1626 MainBoxWrite( p_intf, l++, 1, _(" z Volume Down") ); 1476 1627 MainBoxWrite( p_intf, l++, 1, "" ); 1477 1628 1478 MainBoxWrite( p_intf, l++, 1, "[Playlist]" ); 1479 MainBoxWrite( p_intf, l++, 1, " r Toggle Random playing" ); 1480 MainBoxWrite( p_intf, l++, 1, " l Toggle Loop Playlist" ); 1481 MainBoxWrite( p_intf, l++, 1, " R Toggle Repeat item" ); 1482 MainBoxWrite( p_intf, l++, 1, " o Order Playlist by title" ); 1483 MainBoxWrite( p_intf, l++, 1, " O Reverse order Playlist by title" ); 1484 MainBoxWrite( p_intf, l++, 1, " g Go to the current playing item" ); 1485 MainBoxWrite( p_intf, l++, 1, " / Look for an item" ); 1486 MainBoxWrite( p_intf, l++, 1, " A Add an entry" ); 1487 MainBoxWrite( p_intf, l++, 1, " D, <del> Delete an entry" ); 1488 MainBoxWrite( p_intf, l++, 1, " <backspace> Delete an entry" ); 1629 if( p_sys->b_color ) 1630 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1631 MainBoxWrite( p_intf, l++, 1, _("[Playlist]") ); 1632 if( p_sys->b_color ) 1633 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1634 MainBoxWrite( p_intf, l++, 1, _(" r Toggle Random playing") ); 1635 MainBoxWrite( p_intf, l++, 1, _(" l Toggle Loop Playlist") ); 1636 MainBoxWrite( p_intf, l++, 1, _(" R Toggle Repeat item") ); 1637 MainBoxWrite( p_intf, l++, 1, _(" o Order Playlist by title") ); 1638 MainBoxWrite( p_intf, l++, 1, _(" O Reverse order Playlist by title") ); 1639 MainBoxWrite( p_intf, l++, 1, _(" g Go to the current playing item") ); 1640 MainBoxWrite( p_intf, l++, 1, _(" / Look for an item") ); 1641 MainBoxWrite( p_intf, l++, 1, _(" A Add an entry") ); 1642 MainBoxWrite( p_intf, l++, 1, _(" D, <del> Delete an entry") ); 1643 MainBoxWrite( p_intf, l++, 1, _(" <backspace> Delete an entry") ); 1644 MainBoxWrite( p_intf, l++, 1, _(" e Eject (if stopped)") ); 1489 1645 MainBoxWrite( p_intf, l++, 1, "" ); 1490 1646 1491 MainBoxWrite( p_intf, l++, 1, "[Filebrowser]" ); 1492 MainBoxWrite( p_intf, l++, 1, " <enter> Add the selected file to the playlist" ); 1493 MainBoxWrite( p_intf, l++, 1, " <space> Add the selected directory to the playlist" ); 1494 MainBoxWrite( p_intf, l++, 1, " . Show/Hide hidden files" ); 1647 if( p_sys->b_color ) 1648 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1649 MainBoxWrite( p_intf, l++, 1, _("[Filebrowser]") ); 1650 if( p_sys->b_color ) 1651 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1652 MainBoxWrite( p_intf, l++, 1, _(" <enter> Add the selected file to the playlist") ); 1653 MainBoxWrite( p_intf, l++, 1, _(" <space> Add the selected directory to the playlist") ); 1654 MainBoxWrite( p_intf, l++, 1, _(" . Show/Hide hidden files") ); 1495 1655 MainBoxWrite( p_intf, l++, 1, "" ); 1496 1656 1497 MainBoxWrite( p_intf, l++, 1, "[Boxes]" ); 1498 MainBoxWrite( p_intf, l++, 1, " <up>,<down> Navigate through the box line by line" ); 1499 MainBoxWrite( p_intf, l++, 1, " <pgup>,<pgdown> Navigate through the box page by page" ); 1657 if( p_sys->b_color ) 1658 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1659 MainBoxWrite( p_intf, l++, 1, _("[Boxes]") ); 1660 if( p_sys->b_color ) 1661 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1662 MainBoxWrite( p_intf, l++, 1, _(" <up>,<down> Navigate through the box line by line") ); 1663 MainBoxWrite( p_intf, l++, 1, _(" <pgup>,<pgdown> Navigate through the box page by page") ); 1500 1664 MainBoxWrite( p_intf, l++, 1, "" ); 1501 1665 1502 MainBoxWrite( p_intf, l++, 1, "[Player]" ); 1503 MainBoxWrite( p_intf, l++, 1, " <up>,<down> Seek +/-5%%" ); 1666 if( p_sys->b_color ) 1667 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1668 MainBoxWrite( p_intf, l++, 1, _("[Player]") ); 1669 if( p_sys->b_color ) 1670 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1671 MainBoxWrite( p_intf, l++, 1, _(" <up>,<down> Seek +/-5%%") ); 1504 1672 MainBoxWrite( p_intf, l++, 1, "" ); 1505 1673 1506 MainBoxWrite( p_intf, l++, 1, "[Miscellaneous]" ); 1507 MainBoxWrite( p_intf, l++, 1, " Ctrl-l Refresh the screen" ); 1674 if( p_sys->b_color ) 1675 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1676 MainBoxWrite( p_intf, l++, 1, _("[Miscellaneous]") ); 1677 if( p_sys->b_color ) 1678 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1679 MainBoxWrite( p_intf, l++, 1, _(" Ctrl-l Refresh the screen") ); 1508 1680 1509 1681 p_sys->i_box_lines_total = l; … … 1526 1698 /* Info box */ 1527 1699 int l = 0; 1528 DrawBox( p_sys->w, y++, 0, h, COLS, " Information ");1700 DrawBox( p_sys->w, y++, 0, h, COLS, _(" Information "), p_sys->b_color ); 1529 1701 1530 1702 if( p_input ) … … 1536 1708 info_category_t *p_category = input_GetItem(p_input)->pp_categories[i]; 1537 1709 if( y >= y_end ) break; 1538 MainBoxWrite( p_intf, l++, 1, " [%s]", p_category->psz_name ); 1710 if( p_sys->b_color ) 1711 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1712 MainBoxWrite( p_intf, l++, 1, _(" [%s]"), p_category->psz_name ); 1713 if( p_sys->b_color ) 1714 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1539 1715 for( j = 0; j < p_category->i_infos; j++ ) 1540 1716 { 1541 1717 info_t *p_info = p_category->pp_infos[j]; 1542 1718 if( y >= y_end ) break; 1543 MainBoxWrite( p_intf, l++, 1, " %s: %s", p_info->psz_name, p_info->psz_value );1719 MainBoxWrite( p_intf, l++, 1, _(" %s: %s"), p_info->psz_name, p_info->psz_value ); 1544 1720 } 1545 1721 } … … 1548 1724 else 1549 1725 { 1550 MainBoxWrite( p_intf, l++, 1, "No item currently playing");1726 MainBoxWrite( p_intf, l++, 1, _("No item currently playing") ); 1551 1727 } 1552 1728 p_sys->i_box_lines_total = l; … … 1577 1753 psz_title[i_len + 1] = ' '; 1578 1754 psz_title[i_len + 2] = '\0'; 1579 DrawBox( p_sys->w, y++, 0, h, COLS, psz_title );1755 DrawBox( p_sys->w, y++, 0, h, COLS, psz_title, p_sys->b_color ); 1580 1756 1581 1757 if( p_input ) … … 1630 1806 psz_meta_title = ""; break; 1631 1807 } 1808 if( p_sys->b_color ) 1809 wcolor_set( p_sys->w, C_CATEGORY, NULL ); 1632 1810 MainBoxWrite( p_intf, l++, 1, " [%s]", psz_meta_title ); 1811 if( p_sys->b_color ) 1812 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1633 1813 MainBoxWrite( p_intf, l++, 1, " %s", psz_meta ); 1634 1814 } … … 1638 1818 else 1639 1819 { 1640 MainBoxWrite( p_intf, l++, 1, "No item currently playing");1820 MainBoxWrite( p_intf, l++, 1, _("No item currently playing") ); 1641 1821 } 1642 1822 p_sys->i_box_lines_total = l; … … 1661 1841 int i_start; 1662 1842 1663 DrawBox( p_sys->w, y++, 0, h, COLS, " Logs ");1843 DrawBox( p_sys->w, y++, 0, h, COLS, _(" Logs "), p_sys->b_color ); 1664 1844 1665 1845 i_start = p_intf->p_sys->p_sub->i_start; … … 1683 1863 break; 1684 1864 } 1865 if( p_sys->b_color ) 1866 wcolor_set( p_sys->w, 1867 p_sys->p_sub->p_msg[i_stop].i_type + C_INFO, 1868 NULL ); 1685 1869 mvnprintw( y + h-2-i_line, 1, COLS - 2, " [%s] %s", 1686 1870 ppsz_type[p_sys->p_sub->p_msg[i_stop].i_type], 1687 1871 p_sys->p_sub->p_msg[i_stop].psz_msg ); 1872 if( p_sys->b_color ) 1873 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1688 1874 } 1689 1875 … … 1698 1884 int i_start, i_stop; 1699 1885 int i_item; 1700 DrawBox( p_sys->w, y++, 0, h, COLS, " Browse ");1886 DrawBox( p_sys->w, y++, 0, h, COLS, _(" Browse "), p_sys->b_color ); 1701 1887 1702 1888 if( p_sys->i_box_bidx >= p_sys->i_dir_entries ) p_sys->i_box_plidx = p_sys->i_dir_entries - 1; … … 1736 1922 attrset( A_REVERSE ); 1737 1923 } 1924 if( p_sys->b_color && !p_sys->pp_dir_entries[i_item]->b_file ) 1925 wcolor_set( p_sys->w, C_FOLDER, NULL ); 1738 1926 mvnprintw( y++, 1, COLS - 2, " %c %s", p_sys->pp_dir_entries[i_item]->b_file == VLC_TRUE ? ' ' : '+', 1739 1927 p_sys->pp_dir_entries[i_item]->psz_path ); 1928 if( p_sys->b_color && !p_sys->pp_dir_entries[i_item]->b_file ) 1929 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1930 1740 1931 if( b_selected ) 1741 1932 { … … 1757 1948 { 1758 1949 case VIEW_ONELEVEL: 1759 psz_title = strdup( " Playlist (All, one level) ");1950 psz_title = strdup( _(" Playlist (All, one level) ") ); 1760 1951 break; 1761 1952 case VIEW_CATEGORY: 1762 psz_title = strdup( " Playlist (By category) ");1953 psz_title = strdup( _(" Playlist (By category) ") ); 1763 1954 break; 1764 1955 default: 1765 psz_title = strdup( " Playlist (Manually added) ");1766 } 1767 1768 DrawBox( p_sys->w, y++, 0, h, COLS, psz_title );1956 psz_title = strdup( _(" Playlist (Manually added) ") ); 1957 } 1958 1959 DrawBox( p_sys->w, y++, 0, h, COLS, psz_title, p_sys->b_color ); 1769 1960 1770 1961 if( p_sys->b_need_update || p_sys->pp_plist == NULL ) … … 1824 2015 attrset( A_REVERSE ); 1825 2016 } 2017 if( p_sys->b_color ) 2018 wcolor_set( p_sys->w, i_item % 3 + C_PLAYLIST_1, NULL ); 1826 2019 mvnprintw( y++, 1, COLS - 2, "%c%s", c, 1827 2020 p_sys->pp_plist[i_item]->psz_display ); 2021 if( p_sys->b_color ) 2022 wcolor_set( p_sys->w, C_DEFAULT, NULL ); 1828 2023 if( b_selected ) 1829 2024 { … … 1846 2041 { 1847 2042 /* Searching next entry */ 1848 mvnprintw( 7, 1, COLS-2, "Find: %s", p_sys->psz_old_search );2043 mvnprintw( 7, 1, COLS-2, _("Find: %s"), p_sys->psz_old_search ); 1849 2044 } 1850 2045 else 1851 2046 { 1852 mvnprintw( 7, 1, COLS-2, "Find: %s", p_sys->psz_search_chain );2047 mvnprintw( 7, 1, COLS-2, _("Find: %s"), p_sys->psz_search_chain ); 1853 2048 } 1854 2049 } … … 1859 2054 { 1860 2055 DrawEmptyLine( p_sys->w, 7, 1, COLS-2 ); 1861 mvnprintw( 7, 1, COLS-2, "Open: %s", p_sys->psz_open_chain );2056 mvnprintw( 7, 1, COLS-2, _("Open: %s"), p_sys->psz_open_chain ); 1862 2057 } 1863 2058 } … … 2261 2456 * 2262 2457 ****************************************************************************/ 2263 static void DrawBox( WINDOW *win, int y, int x, int h, int w, const char *title )2458 static void DrawBox( WINDOW *win, int y, int x, int h, int w, const char *title, vlc_bool_t b_color ) 2264 2459 { 2265 2460 int i; … … 2268 2463 if( w > 3 && h > 2 ) 2269 2464 { 2465 if( b_color ) 2466 wcolor_set( win, C_BOX, NULL ); 2270 2467 if( title == NULL ) title = ""; 2271 2468 i_len = strlen( title ); … … 2288 2485 mvwhline( win, y+h-1, x+1, ACS_HLINE, w - 2 ); 2289 2486 mvwaddch( win, y+h-1, x+w-1, ACS_LRCORNER ); 2487 if( b_color ) 2488 wcolor_set( win, C_DEFAULT, NULL ); 2290 2489 } 2291 2490 }
