comparison audacious/mainwin.c @ 2091:3b6bd01ba05c trunk

[svn] - update mainwin.c to new API
author nenolod
date Mon, 11 Dec 2006 04:48:05 -0800
parents 25308f10b50f
children f18a5b617c34
comparison
equal deleted inserted replaced
2090:b89947411061 2091:3b6bd01ba05c
705 gtk_accel_map_save(bmp_paths[BMP_PATH_ACCEL_FILE]); 705 gtk_accel_map_save(bmp_paths[BMP_PATH_ACCEL_FILE]);
706 706
707 ctrlsocket_cleanup(); 707 ctrlsocket_cleanup();
708 708
709 playlist_stop_get_info_thread(); 709 playlist_stop_get_info_thread();
710 playlist_clear(); 710 playlist_clear(playlist_get_active());
711 711
712 plugin_system_cleanup(); 712 plugin_system_cleanup();
713 713
714 gtk_main_quit(); 714 gtk_main_quit();
715 715
828 828
829 if ((text = input_get_info_text()) != NULL) { 829 if ((text = input_get_info_text()) != NULL) {
830 textbox_set_text(mainwin_info, text); 830 textbox_set_text(mainwin_info, text);
831 g_free(text); 831 g_free(text);
832 } 832 }
833 else if ((text = playlist_get_info_text()) != NULL) { 833 else if ((text = playlist_get_info_text(playlist_get_active())) != NULL) {
834 textbox_set_text(mainwin_info, text); 834 textbox_set_text(mainwin_info, text);
835 g_free(text); 835 g_free(text);
836 } 836 }
837 } 837 }
838 838
1075 gint frequency, 1075 gint frequency,
1076 gint n_channels) 1076 gint n_channels)
1077 { 1077 {
1078 gchar text[512]; 1078 gchar text[512];
1079 gchar *title; 1079 gchar *title;
1080 Playlist *playlist = playlist_get_active();
1080 1081
1081 playback_set_sample_params(bitrate, frequency, n_channels); 1082 playback_set_sample_params(bitrate, frequency, n_channels);
1082 1083
1083 if (bitrate != -1) { 1084 if (bitrate != -1) {
1084 bitrate /= 1000; 1085 bitrate /= 1000;
1116 widget_show(WIDGET(mainwin_sec_num)); 1117 widget_show(WIDGET(mainwin_sec_num));
1117 1118
1118 if (!bmp_playback_get_paused() && mainwin_playstatus != NULL) 1119 if (!bmp_playback_get_paused() && mainwin_playstatus != NULL)
1119 playstatus_set_status(mainwin_playstatus, STATUS_PLAY); 1120 playstatus_set_status(mainwin_playstatus, STATUS_PLAY);
1120 1121
1121 if (playlist_get_current_length() != -1) { 1122 if (playlist_get_current_length(playlist) != -1) {
1122 if (cfg.player_shaded) 1123 if (cfg.player_shaded)
1123 widget_show(WIDGET(mainwin_sposition)); 1124 widget_show(WIDGET(mainwin_sposition));
1124 widget_show(WIDGET(mainwin_position)); 1125 widget_show(WIDGET(mainwin_position));
1125 } 1126 }
1126 else { 1127 else {
1157 widget_show(WIDGET(mainwin_freq_text)); 1158 widget_show(WIDGET(mainwin_freq_text));
1158 widget_show(WIDGET(mainwin_monostereo)); 1159 widget_show(WIDGET(mainwin_monostereo));
1159 widget_hide(WIDGET(mainwin_othertext)); 1160 widget_hide(WIDGET(mainwin_othertext));
1160 } 1161 }
1161 1162
1162 title = playlist_get_info_text(); 1163 title = playlist_get_info_text(playlist);
1163 mainwin_set_song_title(title); 1164 mainwin_set_song_title(title);
1164 g_free(title); 1165 g_free(title);
1165 } 1166 }
1166 1167
1167 void 1168 void
1350 1351
1351 void 1352 void
1352 mainwin_scrolled(GtkWidget *widget, GdkEventScroll *event, 1353 mainwin_scrolled(GtkWidget *widget, GdkEventScroll *event,
1353 gpointer callback_data) 1354 gpointer callback_data)
1354 { 1355 {
1356 Playlist *playlist = playlist_get_active();
1357
1355 switch (event->direction) { 1358 switch (event->direction) {
1356 case GDK_SCROLL_UP: 1359 case GDK_SCROLL_UP:
1357 mainwin_set_volume_diff(cfg.mouse_change); 1360 mainwin_set_volume_diff(cfg.mouse_change);
1358 break; 1361 break;
1359 case GDK_SCROLL_DOWN: 1362 case GDK_SCROLL_DOWN:
1360 mainwin_set_volume_diff(-cfg.mouse_change); 1363 mainwin_set_volume_diff(-cfg.mouse_change);
1361 break; 1364 break;
1362 case GDK_SCROLL_LEFT: 1365 case GDK_SCROLL_LEFT:
1363 if (playlist_get_current_length() != -1) 1366 if (playlist_get_current_length(playlist) != -1)
1364 bmp_playback_seek(CLAMP(bmp_playback_get_time() - 1000, 1367 bmp_playback_seek(CLAMP(bmp_playback_get_time() - 1000,
1365 0, playlist_get_current_length()) / 1000); 1368 0, playlist_get_current_length(playlist)) / 1000);
1366 break; 1369 break;
1367 case GDK_SCROLL_RIGHT: 1370 case GDK_SCROLL_RIGHT:
1368 if (playlist_get_current_length() != -1) 1371 if (playlist_get_current_length(playlist) != -1)
1369 bmp_playback_seek(CLAMP(bmp_playback_get_time() + 1000, 1372 bmp_playback_seek(CLAMP(bmp_playback_get_time() + 1000,
1370 0, playlist_get_current_length()) / 1000); 1373 0, playlist_get_current_length(playlist)) / 1000);
1371 break; 1374 break;
1372 } 1375 }
1373 } 1376 }
1374 1377
1375 static gboolean 1378 static gboolean
1409 if (dock_is_moving(GTK_WINDOW(mainwin))) 1412 if (dock_is_moving(GTK_WINDOW(mainwin)))
1410 dock_move_release(GTK_WINDOW(mainwin)); 1413 dock_move_release(GTK_WINDOW(mainwin));
1411 } 1414 }
1412 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && 1415 else if (event->button == 1 && event->type == GDK_2BUTTON_PRESS &&
1413 widget_contains(WIDGET(mainwin_info), event->x, event->y)) { 1416 widget_contains(WIDGET(mainwin_info), event->x, event->y)) {
1414 playlist_fileinfo_current(); 1417 playlist_fileinfo_current(playlist_get_active());
1415 } 1418 }
1416 else { 1419 else {
1417 handle_press_cb(mainwin_wlist, widget, event); 1420 handle_press_cb(mainwin_wlist, widget, event);
1418 draw_main_window(FALSE); 1421 draw_main_window(FALSE);
1419 } 1422 }
1525 static gboolean 1528 static gboolean
1526 mainwin_keypress(GtkWidget * grab_widget, 1529 mainwin_keypress(GtkWidget * grab_widget,
1527 GdkEventKey * event, 1530 GdkEventKey * event,
1528 gpointer data) 1531 gpointer data)
1529 { 1532 {
1533 Playlist *playlist = playlist_get_active();
1530 1534
1531 switch (event->keyval) { 1535 switch (event->keyval) {
1532 1536
1533 case GDK_Up: 1537 case GDK_Up:
1534 case GDK_KP_Up: 1538 case GDK_KP_Up:
1541 mainwin_set_volume_diff(-2); 1545 mainwin_set_volume_diff(-2);
1542 break; 1546 break;
1543 case GDK_Left: 1547 case GDK_Left:
1544 case GDK_KP_Left: 1548 case GDK_KP_Left:
1545 case GDK_KP_7: 1549 case GDK_KP_7:
1546 if (playlist_get_current_length() != -1) 1550 if (playlist_get_current_length(playlist) != -1)
1547 bmp_playback_seek(CLAMP 1551 bmp_playback_seek(CLAMP
1548 (bmp_playback_get_time() - 5000, 0, 1552 (bmp_playback_get_time() - 5000, 0,
1549 playlist_get_current_length()) / 1000); 1553 playlist_get_current_length(playlist)) / 1000);
1550 break; 1554 break;
1551 case GDK_Right: 1555 case GDK_Right:
1552 case GDK_KP_Right: 1556 case GDK_KP_Right:
1553 case GDK_KP_9: 1557 case GDK_KP_9:
1554 if (playlist_get_current_length() != -1) 1558 if (playlist_get_current_length(playlist) != -1)
1555 bmp_playback_seek(CLAMP 1559 bmp_playback_seek(CLAMP
1556 (bmp_playback_get_time() + 5000, 0, 1560 (bmp_playback_get_time() + 5000, 0,
1557 playlist_get_current_length()) / 1000); 1561 playlist_get_current_length(playlist)) / 1000);
1558 break; 1562 break;
1559 case GDK_KP_4: 1563 case GDK_KP_4:
1560 playlist_prev(); 1564 playlist_prev(playlist);
1561 break; 1565 break;
1562 case GDK_KP_6: 1566 case GDK_KP_6:
1563 playlist_next(); 1567 playlist_next(playlist);
1564 break; 1568 break;
1565 case GDK_KP_Insert: 1569 case GDK_KP_Insert:
1566 mainwin_jump_to_file(); 1570 mainwin_jump_to_file();
1567 break; 1571 break;
1568 case GDK_KP_5: 1572 case GDK_KP_5:
1582 mainwin_jump_to_time_cb(GtkWidget * widget, 1586 mainwin_jump_to_time_cb(GtkWidget * widget,
1583 GtkWidget * entry) 1587 GtkWidget * entry)
1584 { 1588 {
1585 guint min = 0, sec = 0, params; 1589 guint min = 0, sec = 0, params;
1586 gint time; 1590 gint time;
1591 Playlist *playlist = playlist_get_active();
1587 1592
1588 params = sscanf(gtk_entry_get_text(GTK_ENTRY(entry)), "%u:%u", 1593 params = sscanf(gtk_entry_get_text(GTK_ENTRY(entry)), "%u:%u",
1589 &min, &sec); 1594 &min, &sec);
1590 if (params == 2) 1595 if (params == 2)
1591 time = (min * 60) + sec; 1596 time = (min * 60) + sec;
1592 else if (params == 1) 1597 else if (params == 1)
1593 time = min; 1598 time = min;
1594 else 1599 else
1595 return; 1600 return;
1596 1601
1597 if (playlist_get_current_length() > -1 && 1602 if (playlist_get_current_length(playlist) > -1 &&
1598 time <= (playlist_get_current_length() / 1000)) { 1603 time <= (playlist_get_current_length(playlist) / 1000))
1604 {
1599 bmp_playback_seek(time); 1605 bmp_playback_seek(time);
1600 gtk_widget_destroy(mainwin_jtt); 1606 gtk_widget_destroy(mainwin_jtt);
1601 } 1607 }
1602 } 1608 }
1603 1609
1699 change_song(guint pos) 1705 change_song(guint pos)
1700 { 1706 {
1701 if (bmp_playback_get_playing()) 1707 if (bmp_playback_get_playing())
1702 bmp_playback_stop(); 1708 bmp_playback_stop();
1703 1709
1704 playlist_set_position(pos); 1710 playlist_set_position(playlist_get_active(), pos);
1705 bmp_playback_initiate(); 1711 bmp_playback_initiate();
1706 } 1712 }
1707 1713
1708 static void 1714 static void
1709 mainwin_jump_to_file_jump(GtkTreeView * treeview) 1715 mainwin_jump_to_file_jump(GtkTreeView * treeview)
1740 1746
1741 static void 1747 static void
1742 mainwin_jump_to_file_set_queue_button_label(GtkButton * button, 1748 mainwin_jump_to_file_set_queue_button_label(GtkButton * button,
1743 guint pos) 1749 guint pos)
1744 { 1750 {
1745 if (playlist_is_position_queued(pos)) 1751 if (playlist_is_position_queued(playlist_get_active(), pos))
1746 gtk_button_set_label(button, _("Un_queue")); 1752 gtk_button_set_label(button, _("Un_queue"));
1747 else 1753 else
1748 gtk_button_set_label(button, _("_Queue")); 1754 gtk_button_set_label(button, _("_Queue"));
1749 } 1755 }
1750 1756
1767 return; 1773 return;
1768 1774
1769 gtk_tree_model_get(model, &iter, 0, &pos_str, -1); 1775 gtk_tree_model_get(model, &iter, 0, &pos_str, -1);
1770 pos = g_ascii_strtoull(pos_str, NULL, 10) - 1; 1776 pos = g_ascii_strtoull(pos_str, NULL, 10) - 1;
1771 1777
1772 playlist_queue_position(pos); 1778 playlist_queue_position(playlist_get_active(), pos);
1773 1779
1774 mainwin_jump_to_file_set_queue_button_label(button, pos); 1780 mainwin_jump_to_file_set_queue_button_label(button, pos);
1775 } 1781 }
1776 1782
1777 static void 1783 static void
2214 GtkSelectionData * selection_data, 2220 GtkSelectionData * selection_data,
2215 guint info, 2221 guint info,
2216 guint time, 2222 guint time,
2217 gpointer user_data) 2223 gpointer user_data)
2218 { 2224 {
2225 Playlist *playlist = playlist_get_active();
2226
2219 g_return_if_fail(selection_data != NULL); 2227 g_return_if_fail(selection_data != NULL);
2220 g_return_if_fail(selection_data->data != NULL); 2228 g_return_if_fail(selection_data->data != NULL);
2221 2229
2222 if (str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///")) 2230 if (str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///"))
2223 { 2231 {
2231 g_free(decoded); 2239 g_free(decoded);
2232 2240
2233 return; 2241 return;
2234 } 2242 }
2235 2243
2236 playlist_clear(); 2244 playlist_clear(playlist);
2237 playlist_add_url((gchar *) selection_data->data); 2245 playlist_add_url(playlist, (gchar *) selection_data->data);
2238 bmp_playback_initiate(); 2246 bmp_playback_initiate();
2239 } 2247 }
2240 2248
2241 static void 2249 static void
2242 on_add_url_add_clicked(GtkWidget * widget, 2250 on_add_url_add_clicked(GtkWidget * widget,
2243 GtkWidget * entry) 2251 GtkWidget * entry)
2244 { 2252 {
2245 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); 2253 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
2246 if (text && *text) 2254 if (text && *text)
2247 playlist_add_url(text); 2255 playlist_add_url(playlist_get_active(), text);
2248 } 2256 }
2249 2257
2250 static void 2258 static void
2251 on_add_url_ok_clicked(GtkWidget * widget, 2259 on_add_url_ok_clicked(GtkWidget * widget,
2252 GtkWidget * entry) 2260 GtkWidget * entry)
2253 { 2261 {
2262 Playlist *playlist = playlist_get_active();
2263
2254 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry)); 2264 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
2255 if (text && *text) 2265 if (text && *text)
2256 { 2266 {
2257 playlist_clear(); 2267 playlist_clear(playlist);
2258 playlist_add_url(text); 2268 playlist_add_url(playlist, text);
2259 bmp_playback_initiate(); 2269 bmp_playback_initiate();
2260 } 2270 }
2261 } 2271 }
2262 2272
2263 void 2273 void
2318 2328
2319 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); 2329 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000));
2320 2330
2321 if ( now_dur <= TRISTATE_THRESHOLD ) 2331 if ( now_dur <= TRISTATE_THRESHOLD )
2322 { 2332 {
2323 /* interpret as 'skip to previous song' */ 2333 /* interpret as 'skip to previous song' */
2324 playlist_prev(); 2334 playlist_prev(playlist_get_active());
2325 } 2335 }
2326 else 2336 else
2327 { 2337 {
2328 /* interpret as 'seek' */ 2338 /* interpret as 'seek' */
2329 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); 2339 mainwin_position_release_cb( hslider_get_position(mainwin_position) );
2330 } 2340 }
2331 2341
2332 seek_state = MAINWIN_SEEK_NIL; 2342 seek_state = MAINWIN_SEEK_NIL;
2333 } 2343 }
2334 2344
2355 2365
2356 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000)); 2366 now_dur = labs((delta_time.tv_sec * 1000) + (glong) (delta_time.tv_usec / 1000));
2357 2367
2358 if ( now_dur <= TRISTATE_THRESHOLD ) 2368 if ( now_dur <= TRISTATE_THRESHOLD )
2359 { 2369 {
2360 /* interpret as 'skip to previous song' */ 2370 /* interpret as 'skip to previous song' */
2361 playlist_next(); 2371 playlist_next(playlist_get_active());
2362 } 2372 }
2363 else 2373 else
2364 { 2374 {
2365 /* interpret as 'seek' */ 2375 /* interpret as 'seek' */
2366 mainwin_position_release_cb( hslider_get_position(mainwin_position) ); 2376 mainwin_position_release_cb( hslider_get_position(mainwin_position) );
2367 } 2377 }
2368 2378
2369 seek_state = MAINWIN_SEEK_NIL; 2379 seek_state = MAINWIN_SEEK_NIL;
2370 } 2380 }
2371 2381
2377 if (bmp_playback_get_paused()) { 2387 if (bmp_playback_get_paused()) {
2378 bmp_playback_pause(); 2388 bmp_playback_pause();
2379 return; 2389 return;
2380 } 2390 }
2381 2391
2382 if (playlist_get_length()) 2392 if (playlist_get_length(playlist_get_active()))
2383 bmp_playback_initiate(); 2393 bmp_playback_initiate();
2384 else 2394 else
2385 mainwin_eject_pushed(); 2395 mainwin_eject_pushed();
2386 } 2396 }
2387 2397
2435 void 2445 void
2436 mainwin_spos_motion_cb(gint pos) 2446 mainwin_spos_motion_cb(gint pos)
2437 { 2447 {
2438 gint time; 2448 gint time;
2439 gchar *time_msg; 2449 gchar *time_msg;
2450 Playlist *playlist = playlist_get_active();
2440 2451
2441 pos--; 2452 pos--;
2442 2453
2443 time = ((playlist_get_current_length() / 1000) * pos) / 12; 2454 time = ((playlist_get_current_length(playlist) / 1000) * pos) / 12;
2444 2455
2445 if (cfg.timer_mode == TIMER_REMAINING) { 2456 if (cfg.timer_mode == TIMER_REMAINING) {
2446 time = (playlist_get_current_length() / 1000) - time; 2457 time = (playlist_get_current_length(playlist) / 1000) - time;
2447 time_msg = g_strdup_printf("-%2.2d", time / 60); 2458 time_msg = g_strdup_printf("-%2.2d", time / 60);
2448 textbox_set_text(mainwin_stime_min, time_msg); 2459 textbox_set_text(mainwin_stime_min, time_msg);
2449 g_free(time_msg); 2460 g_free(time_msg);
2450 } 2461 }
2451 else { 2462 else {
2460 } 2471 }
2461 2472
2462 void 2473 void
2463 mainwin_spos_release_cb(gint pos) 2474 mainwin_spos_release_cb(gint pos)
2464 { 2475 {
2465 bmp_playback_seek(((playlist_get_current_length() / 1000) * 2476 bmp_playback_seek(((playlist_get_current_length(playlist_get_active()) / 1000) *
2466 (pos - 1)) / 12); 2477 (pos - 1)) / 12);
2467 } 2478 }
2468 2479
2469 void 2480 void
2470 mainwin_position_motion_cb(gint pos) 2481 mainwin_position_motion_cb(gint pos)
2471 { 2482 {
2472 gint length, time; 2483 gint length, time;
2473 gchar *seek_msg; 2484 gchar *seek_msg;
2474 2485
2475 length = playlist_get_current_length() / 1000; 2486 length = playlist_get_current_length(playlist_get_active()) / 1000;
2476 time = (length * pos) / 219; 2487 time = (length * pos) / 219;
2477 seek_msg = g_strdup_printf(_("SEEK TO: %d:%-2.2d/%d:%-2.2d (%d%%)"), 2488 seek_msg = g_strdup_printf(_("SEEK TO: %d:%-2.2d/%d:%-2.2d (%d%%)"),
2478 time / 60, time % 60, 2489 time / 60, time % 60,
2479 length / 60, length % 60, 2490 length / 60, length % 60,
2480 (length != 0) ? (time * 100) / length : 0); 2491 (length != 0) ? (time * 100) / length : 0);
2485 void 2496 void
2486 mainwin_position_release_cb(gint pos) 2497 mainwin_position_release_cb(gint pos)
2487 { 2498 {
2488 gint length, time; 2499 gint length, time;
2489 2500
2490 length = playlist_get_current_length() / 1000; 2501 length = playlist_get_current_length(playlist_get_active()) / 1000;
2491 time = (length * pos) / 219; 2502 time = (length * pos) / 219;
2492 bmp_playback_seek(time); 2503 bmp_playback_seek(time);
2493 mainwin_release_info_text(); 2504 mainwin_release_info_text();
2494 } 2505 }
2495 2506
2740 { 2751 {
2741 GtkCheckMenuItem *check; 2752 GtkCheckMenuItem *check;
2742 2753
2743 switch (action) { 2754 switch (action) {
2744 case MAINWIN_SONGNAME_FILEINFO: 2755 case MAINWIN_SONGNAME_FILEINFO:
2745 playlist_fileinfo_current(); 2756 playlist_fileinfo_current(playlist_get_active());
2746 break; 2757 break;
2747 case MAINWIN_SONGNAME_JTF: 2758 case MAINWIN_SONGNAME_JTF:
2748 mainwin_jump_to_file(); 2759 mainwin_jump_to_file();
2749 break; 2760 break;
2750 case MAINWIN_SONGNAME_JTT: 2761 case MAINWIN_SONGNAME_JTT:
2954 void 2965 void
2955 mainwin_general_menu_callback(gpointer data, 2966 mainwin_general_menu_callback(gpointer data,
2956 guint action, 2967 guint action,
2957 GtkWidget * item) 2968 GtkWidget * item)
2958 { 2969 {
2970 Playlist *playlist = playlist_get_active();
2971
2959 switch (action) { 2972 switch (action) {
2960 case MAINWIN_GENERAL_PREFS: 2973 case MAINWIN_GENERAL_PREFS:
2961 show_prefs_window(); 2974 show_prefs_window();
2962 break; 2975 break;
2963 case MAINWIN_GENERAL_ABOUT: 2976 case MAINWIN_GENERAL_ABOUT:
2974 break; 2987 break;
2975 case MAINWIN_GENERAL_PLAYLOCATION: 2988 case MAINWIN_GENERAL_PLAYLOCATION:
2976 mainwin_show_add_url_window(); 2989 mainwin_show_add_url_window();
2977 break; 2990 break;
2978 case MAINWIN_GENERAL_FILEINFO: 2991 case MAINWIN_GENERAL_FILEINFO:
2979 playlist_fileinfo_current(); 2992 playlist_fileinfo_current(playlist);
2980 break; 2993 break;
2981 case MAINWIN_GENERAL_FOCUSPLWIN: 2994 case MAINWIN_GENERAL_FOCUSPLWIN:
2982 gtk_window_present(GTK_WINDOW(playlistwin)); 2995 gtk_window_present(GTK_WINDOW(playlistwin));
2983 break; 2996 break;
2984 case MAINWIN_GENERAL_SHOWMWIN: 2997 case MAINWIN_GENERAL_SHOWMWIN:
2995 equalizerwin_real_show(); 3008 equalizerwin_real_show();
2996 else 3009 else
2997 equalizerwin_real_hide(); 3010 equalizerwin_real_hide();
2998 break; 3011 break;
2999 case MAINWIN_GENERAL_PREV: 3012 case MAINWIN_GENERAL_PREV:
3000 playlist_prev(); 3013 playlist_prev(playlist);
3001 break; 3014 break;
3002 case MAINWIN_GENERAL_PLAY: 3015 case MAINWIN_GENERAL_PLAY:
3003 mainwin_play_pushed(); 3016 mainwin_play_pushed();
3004 break; 3017 break;
3005 case MAINWIN_GENERAL_PAUSE: 3018 case MAINWIN_GENERAL_PAUSE:
3007 break; 3020 break;
3008 case MAINWIN_GENERAL_STOP: 3021 case MAINWIN_GENERAL_STOP:
3009 mainwin_stop_pushed(); 3022 mainwin_stop_pushed();
3010 break; 3023 break;
3011 case MAINWIN_GENERAL_NEXT: 3024 case MAINWIN_GENERAL_NEXT:
3012 playlist_next(); 3025 playlist_next(playlist);
3013 break; 3026 break;
3014 case MAINWIN_GENERAL_BACK5SEC: 3027 case MAINWIN_GENERAL_BACK5SEC:
3015 if (bmp_playback_get_playing() 3028 if (bmp_playback_get_playing()
3016 && playlist_get_current_length() != -1) 3029 && playlist_get_current_length(playlist) != -1)
3017 bmp_playback_seek_relative(-5); 3030 bmp_playback_seek_relative(-5);
3018 break; 3031 break;
3019 case MAINWIN_GENERAL_FWD5SEC: 3032 case MAINWIN_GENERAL_FWD5SEC:
3020 if (bmp_playback_get_playing() 3033 if (bmp_playback_get_playing()
3021 && playlist_get_current_length() != -1) 3034 && playlist_get_current_length(playlist) != -1)
3022 bmp_playback_seek_relative(5); 3035 bmp_playback_seek_relative(5);
3023 break; 3036 break;
3024 case MAINWIN_GENERAL_START: 3037 case MAINWIN_GENERAL_START:
3025 playlist_set_position(0); 3038 playlist_set_position(playlist, 0);
3026 break; 3039 break;
3027 case MAINWIN_GENERAL_JTT: 3040 case MAINWIN_GENERAL_JTT:
3028 mainwin_jump_to_time(); 3041 mainwin_jump_to_time();
3029 break; 3042 break;
3030 case MAINWIN_GENERAL_JTF: 3043 case MAINWIN_GENERAL_JTF:
3032 break; 3045 break;
3033 case MAINWIN_GENERAL_EXIT: 3046 case MAINWIN_GENERAL_EXIT:
3034 mainwin_quit_cb(); 3047 mainwin_quit_cb();
3035 break; 3048 break;
3036 case MAINWIN_GENERAL_SETAB: 3049 case MAINWIN_GENERAL_SETAB:
3037 if (playlist_get_current_length() != -1) { 3050 if (playlist_get_current_length(playlist) != -1) {
3038 if (ab_position_a == -1) { 3051 if (ab_position_a == -1) {
3039 ab_position_a = bmp_playback_get_time(); 3052 ab_position_a = bmp_playback_get_time();
3040 ab_position_b = -1; 3053 ab_position_b = -1;
3041 mainwin_lock_info_text("LOOP-POINT A POSITION SET."); 3054 mainwin_lock_info_text("LOOP-POINT A POSITION SET.");
3042 } else if (ab_position_b == -1) { 3055 } else if (ab_position_b == -1) {
3050 mainwin_lock_info_text("LOOP-POINT A POSITION RESET."); 3063 mainwin_lock_info_text("LOOP-POINT A POSITION RESET.");
3051 } 3064 }
3052 } 3065 }
3053 break; 3066 break;
3054 case MAINWIN_GENERAL_CLEARAB: 3067 case MAINWIN_GENERAL_CLEARAB:
3055 if (playlist_get_current_length() != -1) { 3068 if (playlist_get_current_length(playlist) != -1) {
3056 ab_position_a = ab_position_b = -1; 3069 ab_position_a = ab_position_b = -1;
3057 mainwin_release_info_text(); 3070 mainwin_release_info_text();
3058 } 3071 }
3059 break; 3072 break;
3060 } 3073 }
3110 "/Always On Top"); 3123 "/Always On Top");
3111 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), 3124 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget),
3112 mainwin_menurow->mr_always_selected); 3125 mainwin_menurow->mr_always_selected);
3113 break; 3126 break;
3114 case MENUROW_FILEINFOBOX: 3127 case MENUROW_FILEINFOBOX:
3115 playlist_fileinfo_current(); 3128 playlist_fileinfo_current(playlist_get_active());
3116 break; 3129 break;
3117 case MENUROW_DOUBLESIZE: 3130 case MENUROW_DOUBLESIZE:
3118 widget = 3131 widget =
3119 gtk_item_factory_get_widget(mainwin_view_menu, "/DoubleSize"); 3132 gtk_item_factory_get_widget(mainwin_view_menu, "/DoubleSize");
3120 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), 3133 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget),
3186 return; 3199 return;
3187 } 3200 }
3188 3201
3189 for (node = list; node; node = g_list_next(node)) { 3202 for (node = list; node; node = g_list_next(node)) {
3190 filename = g_build_filename(path, node->data, NULL); 3203 filename = g_build_filename(path, node->data, NULL);
3191 playlist_add(filename); 3204 playlist_add(playlist_get_active(), filename);
3192 g_free(filename); 3205 g_free(filename);
3193 g_free(node->data); 3206 g_free(node->data);
3194 } 3207 }
3195 3208
3196 g_free(path); 3209 g_free(path);
3203 { 3216 {
3204 GList *list, *node; 3217 GList *list, *node;
3205 gchar *filename; 3218 gchar *filename;
3206 gchar *path; 3219 gchar *path;
3207 ConfigDb *db; 3220 ConfigDb *db;
3221 Playlist *playlist = playlist_get_active();
3208 3222
3209 db = bmp_cfg_db_open(); 3223 db = bmp_cfg_db_open();
3210 bmp_cfg_db_get_string(db, "CDDA", "directory", &path); 3224 bmp_cfg_db_get_string(db, "CDDA", "directory", &path);
3211 bmp_cfg_db_close(db); 3225 bmp_cfg_db_close(db);
3212 3226
3213 if (!(list = input_scan_dir(path))) { 3227 if (!(list = input_scan_dir(path))) {
3214 run_no_audiocd_dialog(); 3228 run_no_audiocd_dialog();
3215 return; 3229 return;
3216 } 3230 }
3217 3231
3218 playlist_clear(); 3232 playlist_clear(playlist);
3219 3233
3220 for (node = list; node; node = g_list_next(node)) { 3234 for (node = list; node; node = g_list_next(node)) {
3221 filename = g_build_filename(path, node->data, NULL); 3235 filename = g_build_filename(path, node->data, NULL);
3222 playlist_add(filename); 3236 playlist_add(playlist, filename);
3223 g_free(filename); 3237 g_free(filename);
3224 g_free(node->data); 3238 g_free(node->data);
3225 } 3239 }
3226 3240
3227 g_free(path); 3241 g_free(path);
3228 g_list_free(list); 3242 g_list_free(list);
3229 3243
3230 playlist_set_position(0); 3244 playlist_set_position(playlist, 0);
3231 bmp_playback_initiate(); 3245 bmp_playback_initiate();
3232 } 3246 }
3233 3247
3234 void 3248 void
3235 read_volume(gint when) 3249 read_volume(gint when)
3370 3384
3371 static void 3385 static void
3372 set_timer_mode_menu_cb(TimerMode mode) 3386 set_timer_mode_menu_cb(TimerMode mode)
3373 { 3387 {
3374 cfg.timer_mode = mode; 3388 cfg.timer_mode = mode;
3389 }
3390
3391 static void
3392 mainwin_playlist_prev(void)
3393 {
3394 playlist_prev(playlist_get_active());
3395 }
3396
3397 static void
3398 mainwin_playlist_next(void)
3399 {
3400 playlist_next(playlist_get_active());
3375 } 3401 }
3376 3402
3377 void 3403 void
3378 mainwin_setup_menus(void) 3404 mainwin_setup_menus(void)
3379 { 3405 {
3481 16, 114, 0, 114, 16, mainwin_eject_pushed, 3507 16, 114, 0, 114, 16, mainwin_eject_pushed,
3482 SKIN_CBUTTONS); 3508 SKIN_CBUTTONS);
3483 3509
3484 mainwin_srew = 3510 mainwin_srew =
3485 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 169, 4, 8, 3511 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 169, 4, 8,
3486 7, playlist_prev); 3512 7, mainwin_playlist_prev);
3487 mainwin_splay = 3513 mainwin_splay =
3488 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 177, 4, 10, 3514 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 177, 4, 10,
3489 7, mainwin_play_pushed); 3515 7, mainwin_play_pushed);
3490 mainwin_spause = 3516 mainwin_spause =
3491 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 187, 4, 10, 3517 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 187, 4, 10,
3493 mainwin_sstop = 3519 mainwin_sstop =
3494 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 197, 4, 9, 3520 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 197, 4, 9,
3495 7, mainwin_stop_pushed); 3521 7, mainwin_stop_pushed);
3496 mainwin_sfwd = 3522 mainwin_sfwd =
3497 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 206, 4, 8, 3523 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 206, 4, 8,
3498 7, playlist_next); 3524 7, mainwin_playlist_next);
3499 mainwin_seject = 3525 mainwin_seject =
3500 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 216, 4, 9, 3526 create_sbutton(&mainwin_wlist, mainwin_bg, mainwin_gc, 216, 4, 9,
3501 7, mainwin_eject_pushed); 3527 7, mainwin_eject_pushed);
3502 3528
3503 mainwin_shuffle = 3529 mainwin_shuffle =
3771 gchar stime_prefix; 3797 gchar stime_prefix;
3772 3798
3773 if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b) 3799 if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b)
3774 bmp_playback_seek(ab_position_a/1000); 3800 bmp_playback_seek(ab_position_a/1000);
3775 3801
3776 length = playlist_get_current_length(); 3802 length = playlist_get_current_length(playlist_get_active());
3777 if (bmp_playback_get_playing()) 3803 if (bmp_playback_get_playing())
3778 playlistwin_set_time(time, length, cfg.timer_mode); 3804 playlistwin_set_time(time, length, cfg.timer_mode);
3779 else 3805 else
3780 playlistwin_hide_timer(); 3806 playlistwin_hide_timer();
3781 input_update_vis(time); 3807 input_update_vis(time);