comparison audacious/playlist_list.c @ 958:ff0cc786ebeb trunk

[svn] - Assorted playlist fixes ;)
author nhjm449
date Sun, 23 Apr 2006 17:11:06 -0700
parents 5e30566ad776
children 91f6db060a8b
comparison
equal deleted inserted replaced
957:12f57026da8f 958:ff0cc786ebeb
353 gchar *title; 353 gchar *title;
354 gint width, height; 354 gint width, height;
355 gint i, max_first; 355 gint i, max_first;
356 guint padding, padding_dwidth, padding_plength; 356 guint padding, padding_dwidth, padding_plength;
357 guint max_time_len = 0; 357 guint max_time_len = 0;
358 gint queue_tailpadding = 0; 358 gfloat queue_tailpadding = 0;
359 gint tpadding; 359 gint tpadding;
360 gsize tpadding_dwidth = 0; 360 gsize tpadding_dwidth = 0;
361 gint x, y; 361 gint x, y;
362 guint tail_width; 362 guint tail_width;
363 guint tail_len; 363 guint tail_len;
448 gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, 448 gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x,
449 pl->pl_widget.y + 449 pl->pl_widget.y +
450 ((i - pl->pl_first) * pl->pl_fheight), 450 ((i - pl->pl_first) * pl->pl_fheight),
451 width, pl->pl_fheight); 451 width, pl->pl_fheight);
452 } 452 }
453 if (i == playlist_get_position_nolock())
454 gdk_gc_set_foreground(gc,
455 skin_get_color(bmp_active_skin,
456 SKIN_PLEDIT_CURRENT));
457 else
458 gdk_gc_set_foreground(gc,
459 skin_get_color(bmp_active_skin,
460 SKIN_PLEDIT_NORMAL));
461 453
462 /* FIXME: entry->title should NEVER be NULL, and there should 454 /* FIXME: entry->title should NEVER be NULL, and there should
463 NEVER be a need to do a UTF-8 conversion. Playlist title 455 NEVER be a need to do a UTF-8 conversion. Playlist title
464 strings should be kept properly. */ 456 strings should be kept properly. */
465 457
489 strncat(tail, length, sizeof(tail)); 481 strncat(tail, length, sizeof(tail));
490 tail_len = strlen(tail); 482 tail_len = strlen(tail);
491 483
492 max_time_len = MAX(max_time_len, tail_len); 484 max_time_len = MAX(max_time_len, tail_len);
493 485
494 if (pos != -1) 486 if (pos != -1 && tpadding_dwidth <= 0)
487 tail_width = width - (width_approx_digits * (strlen(queuepos) + 2.25));
488 else if (pos != -1)
495 tail_width = width - (width_approx_digits * (tpadding_dwidth + strlen(queuepos) + 4)); 489 tail_width = width - (width_approx_digits * (tpadding_dwidth + strlen(queuepos) + 4));
490 else if (tpadding_dwidth > 0)
491 tail_width = width - (width_approx_digits * (tpadding_dwidth + 2.5));
496 else 492 else
497 tail_width = width - (width_approx_digits * (tpadding_dwidth + 2.5)); 493 tail_width = width;
498 494
499 if (i == playlist_get_position_nolock()) 495 if (i == playlist_get_position_nolock())
500 gdk_gc_set_foreground(gc, 496 gdk_gc_set_foreground(gc,
501 skin_get_color(bmp_active_skin, 497 skin_get_color(bmp_active_skin,
502 SKIN_PLEDIT_CURRENT)); 498 SKIN_PLEDIT_CURRENT));
510 506
511 x = pl->pl_widget.x + width - width_approx_digits * 2; 507 x = pl->pl_widget.x + width - width_approx_digits * 2;
512 y = pl->pl_widget.y + ((i - pl->pl_first) - 508 y = pl->pl_widget.y + ((i - pl->pl_first) -
513 1) * pl->pl_fheight + ascent; 509 1) * pl->pl_fheight + ascent;
514 510
515 if (entry->selected) {
516 gdk_gc_set_foreground(gc,
517 skin_get_color(bmp_active_skin,
518 SKIN_PLEDIT_SELECTEDBG));
519 }
520 else {
521 gdk_gc_set_foreground(gc,
522 skin_get_color(bmp_active_skin,
523 SKIN_PLEDIT_NORMALBG));
524 }
525
526 /* This isn't very cool, but i don't see a way to
527 * calculate row widths with Pango fast enough here */
528
529 gdk_draw_rectangle(obj, gc, TRUE,
530 pl->pl_widget.x + pl->pl_widget.width -
531 (width_approx_digits * 6),
532 y + abs(descent),
533 (width_approx_digits * 6), pl->pl_fheight - 1);
534
535 if (i == playlist_get_position_nolock())
536 gdk_gc_set_foreground(gc,
537 skin_get_color(bmp_active_skin,
538 SKIN_PLEDIT_CURRENT));
539 else
540 gdk_gc_set_foreground(gc,
541 skin_get_color(bmp_active_skin,
542 SKIN_PLEDIT_NORMAL));
543
544 frags = NULL; 511 frags = NULL;
545 frag0 = NULL; 512 frag0 = NULL;
546 513
547 if ((strlen(tail) > 0) && (tail != NULL)) { 514 if ((strlen(tail) > 0) && (tail != NULL)) {
548 frags = g_strsplit(tail, ":", 0); 515 frags = g_strsplit(tail, ":", 0);
568 g_strfreev(frags); 535 g_strfreev(frags);
569 } 536 }
570 537
571 if (pos != -1) { 538 if (pos != -1) {
572 539
573 if (i == playlist_get_position_nolock()) 540 /* DON'T remove the commented code yet please -- Milosz */
574 gdk_gc_set_foreground(gc, 541
575 skin_get_color(bmp_active_skin, 542 if (tpadding_dwidth > 0)
576 SKIN_PLEDIT_CURRENT)); 543 queue_tailpadding = tpadding_dwidth + 1;
577 else 544 else
578 gdk_gc_set_foreground(gc, 545 queue_tailpadding = -0.75;
579 skin_get_color(bmp_active_skin,
580 SKIN_PLEDIT_NORMAL));
581
582 /* DON'T remove the commented code yet please -- Milosz */
583
584 queue_tailpadding = tpadding_dwidth + 1;
585 546
586 gdk_draw_rectangle(obj, gc, FALSE, 547 gdk_draw_rectangle(obj, gc, FALSE,
587 x - 548 x -
588 (((queue_tailpadding + 549 (((queue_tailpadding +
589 strlen(queuepos)) * 550 strlen(queuepos)) *
718 679
719 gdk_draw_line(obj, gc, 680 gdk_draw_line(obj, gc,
720 pl->pl_widget.x + padding, 681 pl->pl_widget.x + padding,
721 pl->pl_widget.y, 682 pl->pl_widget.y,
722 pl->pl_widget.x + padding, 683 pl->pl_widget.x + padding,
723 (pl->pl_widget.y + pl->pl_widget.height)); 684 pl->pl_widget.y + pl->pl_widget.height - 1);
724 } 685 }
725 686
726 if (tpadding_dwidth != 0) 687 if (tpadding_dwidth != 0)
727 { 688 {
728 tpadding = (tpadding_dwidth * width_approx_digits) + (width_approx_digits * 1.5); 689 tpadding = (tpadding_dwidth * width_approx_digits) + (width_approx_digits * 1.5);
732 693
733 gdk_draw_line(obj, gc, 694 gdk_draw_line(obj, gc,
734 pl->pl_widget.x + pl->pl_widget.width - tpadding, 695 pl->pl_widget.x + pl->pl_widget.width - tpadding,
735 pl->pl_widget.y, 696 pl->pl_widget.y,
736 pl->pl_widget.x + pl->pl_widget.width - tpadding, 697 pl->pl_widget.x + pl->pl_widget.width - tpadding,
737 (pl->pl_widget.y + pl->pl_widget.height)); 698 pl->pl_widget.y + pl->pl_widget.height - 1);
738 699
739 } 700 }
740 701
741 gdk_gc_set_clip_origin(gc, 0, 0); 702 gdk_gc_set_clip_origin(gc, 0, 0);
742 gdk_gc_set_clip_rectangle(gc, NULL); 703 gdk_gc_set_clip_rectangle(gc, NULL);
743 704
744 PLAYLIST_UNLOCK(); 705 PLAYLIST_UNLOCK();
745 706
746 g_free(playlist_rect); 707 g_free(playlist_rect);
747 } 708 }
748 709
749 710
750 PlayList_List * 711 PlayList_List *