Advertisement
wwww

fb2k WSH Panel: Song Title

Dec 23rd, 2012
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var DT_SINGLELINE = 0x00000020;
  2. var DT_NOPREFIX = 0x00000800;
  3. var DT_END_ELLIPSIS = 0x00008000;
  4.  
  5. var DT_TOP = 0x00000000;
  6. var DT_LEFT = 0x00000000;
  7. var DT_BOTTOM = 0x00000008;
  8. var DT_RIGHT = 0x00000002;
  9. var DT_CENTER = 0x00000001;
  10. var DT_VCENTER = 0x00000004;
  11. var DT_WORDBREAK = 0x00000010;
  12. var DT_CALCRECT = 0x00000400;
  13. var DT_NOPREFIX = 0x00000800;
  14. var DT_END_ELLIPSIS = 0x00008000;
  15. var DT_WORD_ELLIPSIS = 0x00040000;
  16.  
  17.  
  18. var title_font = gdi.Font("Open Sans SemiBold", 24);
  19. var artist_font = gdi.Font("Open Sans", 14);
  20. var back = window.GetColorCUI(3)
  21. var title_colour = 0xFFA44F55
  22. var artist_colour = 0xFFC68F91
  23. var album_colour = 0xFFA44F55
  24. var separator_colour = 0xFFA8797B
  25. var title_height = false;
  26. var artist_height = false;
  27.  
  28. function RGB(r, g, b) {
  29.     return (0xff000000 | (r << 16) | (g << 8) | (b))
  30. }
  31.  
  32. function on_size() {
  33.     ww = window.Width;
  34.     wh = window.Height;
  35. }
  36.  
  37. function on_paint(gr) {
  38.     if (!title_height) {
  39.         var title_height = gr.CalcTextHeight("The quick brown fox jumps over the lazy dog.", title_font)
  40.         var artist_height = gr.CalcTextHeight("The quick brown fox jumps over the lazy dog.", artist_font)
  41.     }
  42.     gr.FillSolidRect(0, 0, ww, wh, back);
  43.     gr.GdiDrawText(fb.TitleFormat("%title%").Eval(),  title_font,  title_colour,     5, 0,                          ww, wh-artist_height-artist_height, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS);
  44.     gr.GdiDrawText(fb.TitleFormat("[%artist%]").Eval(), artist_font, artist_colour,    5, wh-artist_height-artist_height, ww, artist_height, DT_CALCRECT | DT_NOPREFIX | DT_END_ELLIPSIS);
  45.     gr.GdiDrawText(fb.TitleFormat("[%album%]").Eval(),  artist_font, album_colour,     5, wh-artist_height,               ww, artist_height, DT_CALCRECT | DT_NOPREFIX | DT_END_ELLIPSIS);
  46. }
  47.  
  48. function on_mouse_lbtn_down(x, y) {
  49. }
  50.  
  51. function on_mouse_lbtn_up(x, y) {
  52. }
  53.  
  54. function on_mouse_lbtn_dblclk(x, y) {
  55.     if(fb.IsPlaying && (x>0 && x<ww)) {
  56.         fb.RunMainMenuCommand("View/Columns playlist/Activate now playing");
  57.         fb.RunMainMenuCommand("View/ELPlaylist/Show now playing");
  58.     }
  59. }
  60.  
  61. //=================================================// Callbacks
  62. function on_playback_new_track(info) {
  63.     fb.RunMainMenuCommand("View/Columns playlist/Activate now playing");
  64.     fb.RunMainMenuCommand("View/ELPlaylist/Show now playing");
  65.     window.Repaint();
  66. }
  67.  
  68. function on_playback_stop(reason) {
  69.     if(reason==0) {
  70.         // on user Stop
  71.         window.Repaint();
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement