Advertisement
Br3tt

WSH Advanced Playback Order Button 1.0.0

Jun 1st, 2012
2,251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==PREPROCESSOR==
  2. // @name "WSH Advanced Playback Order Button"
  3. // @version "1.0.0"
  4. // @author "Br3tt aka Falstaff >> http://br3tt.deviantart.com"
  5. // ==/PREPROCESSOR==
  6.  
  7. // Use with MenuManager()
  8. MF_STRING = 0x00000000;
  9. MF_SEPARATOR = 0x00000800;
  10. MF_GRAYED = 0x00000001;
  11. MF_DISABLED = 0x00000002;
  12. MF_POPUP = 0x00000010;
  13.  
  14. // Used in window.SetCursor()
  15. IDC_ARROW = 32512;
  16. IDC_HAND = 32649;
  17.  
  18. // Used in window.GetColorCUI()
  19. ColorTypeCUI = {
  20.     text: 0,
  21.     selection_text: 1,
  22.     inactive_selection_text: 2,
  23.     background: 3,
  24.     selection_background: 4,
  25.     inactive_selection_background: 5,
  26.     active_item_frame: 6
  27. };
  28.  
  29. // Used in window.GetColorDUI()
  30. ColorTypeDUI = {
  31.     text: 0,
  32.     background: 1,
  33.     highlight: 2,
  34.     selection: 3
  35. };
  36.  
  37. function StringFormat() {
  38.     var h_align = 0,
  39.     v_align = 0,
  40.     trimming = 0,
  41.     flags = 0;
  42.     switch (arguments.length) {
  43.         case 3:
  44.         trimming = arguments[2];
  45.         case 2:
  46.         v_align = arguments[1];
  47.         case 1:
  48.         h_align = arguments[0];
  49.         break;
  50.         default:
  51.         return 0;
  52.     };
  53.     return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
  54. };
  55. StringAlignment = {
  56.     Near: 0,
  57.     Centre: 1,
  58.     Far: 2
  59. };
  60. var lt_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Near);
  61. var ct_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Near);
  62. var rt_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Near);
  63. var lc_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Centre);
  64. var cc_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Centre);
  65. var rc_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Centre);
  66. var lb_stringformat = StringFormat(StringAlignment.Near, StringAlignment.Far);
  67. var cb_stringformat = StringFormat(StringAlignment.Centre, StringAlignment.Far);
  68. var rb_stringformat = StringFormat(StringAlignment.Far, StringAlignment.Far);
  69.  
  70. function RGB(r, g, b) {
  71.     return (0xff000000 | (r << 16) | (g << 8) | (b));
  72. };
  73. function RGBA(r, g, b, a) {
  74.     return ((a << 24) | (r << 16) | (g << 8) | (b));
  75. };
  76.  
  77. //=================================================// Button object
  78. ButtonStates = {normal: 0, hover: 1, down: 2};
  79. button = function (normal, hover, down) {
  80.     this.img = Array(normal, hover, down);
  81.     this.w = this.img[0].Width;
  82.     this.h = this.img[0].Height;
  83.     this.state = ButtonStates.normal;
  84.     this.update = function (normal, hover, down) {
  85.         this.img = Array(normal, hover, down);
  86.     };
  87.     this.draw = function (gr, x, y, alpha) {
  88.         this.x = x;
  89.         this.y = y;
  90.         this.img[this.state] && gr.DrawImage(this.img[this.state], this.x, this.y, this.w, this.h, 0, 0, this.w, this.h, 0, alpha);
  91.     };
  92.     this.display_context_menu = function (x, y, id) {};
  93.     this.repaint = function () {
  94.         window.RepaintRect(this.x, this.y, this.w, this.h);
  95.     };
  96.     this.checkstate = function (event, x, y) {
  97.         this.ishover = (x > this.x && x < this.x + this.w - 1 && y > this.y && y < this.y + this.h - 1);
  98.         this.old = this.state;
  99.         switch (event) {
  100.          case "down":
  101.             switch(this.state) {
  102.              case ButtonStates.normal:
  103.              case ButtonStates.hover:
  104.                 this.state = this.ishover ? ButtonStates.down : ButtonStates.normal;
  105.                 break;
  106.             };
  107.             break;
  108.          case "up":
  109.             this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
  110.             break;
  111.          case "right":
  112.              if(this.ishover) this.display_context_menu(x, y, id);
  113.              break;
  114.          case "move":
  115.             switch(this.state) {
  116.              case ButtonStates.normal:
  117.              case ButtonStates.hover:
  118.                 this.state = this.ishover ? ButtonStates.hover : ButtonStates.normal;
  119.                 break;
  120.             };
  121.             break;
  122.          case "leave":
  123.             this.state = this.isdown ? ButtonStates.down : ButtonStates.normal;
  124.             break;
  125.         };
  126.         if(this.state!=this.old) this.repaint();
  127.         return this.state;
  128.     };
  129. };
  130.  
  131. // images
  132. var bt_pbo_off;
  133. var bt_pbo_hov;
  134. var bt_pbo_on;
  135. var pbo_sac;
  136. var pbo_sac_ov;
  137. var pbo_sac_on;
  138. var pbo_normal;
  139. var pbo_normal_ov;
  140. var pbo_normal_on;
  141. var pbo_repeat_playlist;
  142. var pbo_repeat_playlist_ov;
  143. var pbo_repeat_playlist_on;
  144. var pbo_repeat;
  145. var pbo_repeat_ov;
  146. var pbo_repeat_on;
  147. var pbo_random;
  148. var pbo_random_ov;
  149. var pbo_random_on;
  150. var pbo_shuffle;
  151. var pbo_shuffle_ov;
  152. var pbo_shuffle_on;
  153. var pbo_shuffle_album;
  154. var pbo_shuffle_album_ov;
  155. var pbo_shuffle_album_on;
  156. var pbo_shuffle_folder;
  157. var pbo_shuffle_folder_ov;
  158. var pbo_shuffle_folder_on;
  159.  
  160. // Globals
  161. var g_instancetype = window.InstanceType;
  162. var ww = 0, wh = 0;
  163. var g_textcolor = 0, g_textcolor_hl = 0;
  164. var g_backcolor = 0;
  165. var g_syscolor = 0;
  166. var COLOR_BTNFACE = 15;
  167. var hand = false;
  168. var bt_pad_x = window.GetProperty("PBO button left padding", 2);
  169. var bt_pad_y = window.GetProperty("PBO button top padding", 2);
  170. var buttons = Array();
  171.  
  172. function get_colors() {
  173.     if (g_instancetype == 0) { // CUI
  174.         g_textcolor = window.GetColorCUI(ColorTypeCUI.text);
  175.         g_textcolor_hl = window.GetColorCUI(ColorTypeCUI.text);
  176.         g_textcolor_sel = window.GetColorCUI(ColorTypeCUI.selection_text);
  177.         g_backcolor = window.GetColorCUI(ColorTypeCUI.background);
  178.     } else if (g_instancetype == 1) { // DUI
  179.         g_textcolor = window.GetColorDUI(ColorTypeDUI.text);
  180.         g_textcolor_hl = window.GetColorDUI(ColorTypeDUI.highlight);
  181.         g_textcolor_sel = window.GetColorDUI(ColorTypeDUI.selection);
  182.         g_backcolor = window.GetColorDUI(ColorTypeDUI.background);
  183.     } else {
  184.         // None
  185.     };
  186.     g_syscolor = utils.GetSysColor(COLOR_BTNFACE);
  187. }
  188. get_colors();
  189.  
  190. // START
  191. function on_size() {
  192.     ww = window.Width;
  193.     wh = window.Height;
  194.    
  195.     if(!ww || !wh) return true;
  196.    
  197.     init_icons();
  198.     check_buttons();
  199. }
  200.  
  201. function on_paint(gr) {
  202.    
  203.     // Fill default system bg color
  204.     gr.FillSolidRect(0, 0, ww, wh, g_syscolor);
  205.    
  206.     // Draw PBO button
  207.     // ===============
  208.     for(var i=0; i<buttons.length; i++) {
  209.         switch(i) {
  210.             case 0: // PBO
  211.                 buttons[i].draw(gr, bt_pad_x, bt_pad_y, 255);
  212.                 break;
  213.             case 1: // PBO list
  214.                 buttons[i].draw(gr, bt_pad_x+26, bt_pad_y, 255);
  215.                 break;
  216.         }
  217.     }
  218. }
  219.  
  220. function on_mouse_lbtn_down(x, y, mask) {
  221.     // buttons
  222.     for(var i=0; i<buttons.length; i++) {
  223.         buttons[i].checkstate("down", x, y);
  224.     };
  225.     window.Repaint();
  226. };
  227.  
  228. function on_mouse_lbtn_up(x, y, mask) {
  229.     // buttons
  230.     for(var i=0; i<buttons.length; i++) {
  231.         switch(i) {
  232.             case 0:
  233.                 if(buttons[i].checkstate("up", x, y)==ButtonStates.hover) {
  234.                     if(!fb.StopAfterCurrent) {
  235.                         fb.PlaybackOrder = (fb.PlaybackOrder>5)?0:fb.PlaybackOrder+1;
  236.                         if(fb.PlaybackOrder==0) {
  237.                             fb.RunMainMenuCommand("Playback/Stop After Current");
  238.                         }
  239.                     } else {
  240.                         // removing Stop After Current
  241.                         fb.RunMainMenuCommand("Playback/Stop After Current");
  242.                     }
  243.                     buttons[i].state = ButtonStates.hover;
  244.                 };
  245.                 break;
  246.             case 1:
  247.                 if(buttons[i].checkstate("up", x, y)==ButtonStates.hover) {
  248.                     show_pbo_context_menu(bt_pad_x+30, bt_pad_y+15);
  249.                     buttons[i].state = ButtonStates.hover;
  250.                 };
  251.                 break;
  252.         };
  253.     };  
  254.     window.Repaint();
  255. };
  256.  
  257. function on_mouse_move(x, y) {
  258.     hand = false;
  259.     // buttons
  260.     for(var i=0; i<buttons.length; i++) {
  261.         if(buttons[i].checkstate("move", x, y)==ButtonStates.hover) hand = true;
  262.     };
  263.     // Mouse Cursor
  264.     window.SetCursor(hand? IDC_HAND : IDC_ARROW);
  265. }
  266.  
  267. function on_mouse_leave() {
  268.     // buttons
  269.     for(var i=0; i<buttons.length; i++) {
  270.         buttons[i].checkstate("leave", 0, 0);
  271.     };
  272.     window.Repaint();
  273. }
  274.  
  275. function on_colors_changed() {
  276.     get_colors();
  277.     window.Repaint();
  278. }
  279.  
  280. //=================================================// Events
  281.  
  282. function on_playlist_stop_after_current_changed(state) {
  283.     check_buttons();
  284.     window.Repaint();
  285. }
  286.  
  287. function on_playback_order_changed(new_order_index) {
  288.     check_buttons();
  289.     window.Repaint();
  290. }
  291.  
  292. //=================================================// Init Icons and Images (no_cover ...)
  293. function init_icons() {
  294.     var gb;
  295.     var gui_font;
  296.     var off_color = g_textcolor;
  297.     var hov_color = g_textcolor_sel;
  298.     var on_colour = g_textcolor_hl;
  299.  
  300.     // --- pbo list bt ---
  301.  
  302.     bt_pbolist_off = gdi.CreateImage(12, 21);
  303.     gb = bt_pbolist_off.GetGraphics();
  304.     gb.SetSmoothingMode(2);
  305.     gb.FillGradRect(-4, 0, 15, 18, 90, 0, g_textcolor&0x25ffffff, 1.0);
  306.     gb.DrawRoundRect(-4, 0, 15, 18, 3, 3, 1.0, g_textcolor&0x35ffffff);
  307.     gb.SetSmoothingMode(0);
  308.     gb.FillSolidRect(-1, 0, 1, 19, g_textcolor&0x20ffffff);
  309.     //
  310.     gb.FillSolidRect(3, 09, 5, 1, off_color);
  311.     gb.FillSolidRect(4, 10, 3, 1, off_color);
  312.     gb.FillSolidRect(5, 11, 1, 1, off_color);
  313.     bt_pbolist_off.ReleaseGraphics(gb);
  314.  
  315.     bt_pbolist_hov = gdi.CreateImage(12, 21);
  316.     gb = bt_pbolist_hov.GetGraphics();
  317.     gb.SetSmoothingMode(2);
  318.     gb.FillGradRect(-4, 0, 15, 18, 90, 0, g_textcolor&0x25ffffff, 1.0);
  319.     gb.DrawRoundRect(-4, 0, 15, 18, 3, 3, 1.0, g_textcolor&0x35ffffff);
  320.     gb.SetSmoothingMode(0);
  321.     gb.FillSolidRect(-1, 0, 1, 19, g_textcolor&0x20ffffff);
  322.     //
  323.     gb.FillSolidRect(3, 09, 5, 1, hov_color);
  324.     gb.FillSolidRect(4, 10, 3, 1, hov_color);
  325.     gb.FillSolidRect(5, 11, 1, 1, hov_color);
  326.     bt_pbolist_hov.ReleaseGraphics(gb);
  327.  
  328.     bt_pbolist_on = gdi.CreateImage(12, 21);
  329.     gb = bt_pbolist_on.GetGraphics();
  330.     gb.SetSmoothingMode(2);
  331.     gb.FillGradRect(-4, 0, 15, 18, 90, 0, g_textcolor&0x25ffffff, 0.0);
  332.     gb.DrawRoundRect(-4, 0, 15, 18, 3, 3, 1.0, g_textcolor&0x35ffffff);
  333.     gb.SetSmoothingMode(0);
  334.     gb.FillSolidRect(-1, 0, 1, 19, g_textcolor&0x20ffffff);
  335.     //
  336.     gb.FillSolidRect(3, 10, 5, 1, on_colour);
  337.     gb.FillSolidRect(4, 11, 3, 1, on_colour);
  338.     gb.FillSolidRect(5, 12, 1, 1, on_colour);
  339.     bt_pbolist_on.ReleaseGraphics(gb);
  340.  
  341.     // --- pbo bg ---
  342.  
  343.     bt_pbo_off = gdi.CreateImage(26, 21);
  344.     gb = bt_pbo_off.GetGraphics();
  345.     gb.SetSmoothingMode(2);
  346.     gb.FillGradRect(1, 0, 28, 18, 90, 0, g_textcolor&0x25ffffff, 1.0);
  347.     gb.DrawRoundRect(1, 0, 28, 18, 3, 3, 1.0, g_textcolor&0x35ffffff);
  348.     gb.SetSmoothingMode(0);
  349.     gb.FillSolidRect(25, 1, 1, 17, g_textcolor&0x20ffffff);
  350.     bt_pbo_off.ReleaseGraphics(gb);
  351.  
  352.     bt_pbo_hov = gdi.CreateImage(26, 21);
  353.     gb = bt_pbo_hov.GetGraphics();
  354.     gb.SetSmoothingMode(2);
  355.     gb.FillGradRect(1, 0, 28, 18, 90, 0, g_textcolor&0x25ffffff, 1.0);
  356.     gb.DrawRoundRect(1, 0, 28, 18, 3, 3, 1.0, g_textcolor&0x35ffffff);
  357.     gb.SetSmoothingMode(0);
  358.     gb.FillSolidRect(25, 1, 1, 17, g_textcolor&0x20ffffff);
  359.     bt_pbo_hov.ReleaseGraphics(gb);
  360.  
  361.     bt_pbo_on = gdi.CreateImage(26, 21);
  362.     gb = bt_pbo_on.GetGraphics();
  363.     gb.SetSmoothingMode(2);
  364.     gb.FillGradRect(1, 0, 28, 18, 90, 0, g_textcolor&0x25ffffff, 0.0);
  365.     gb.DrawRoundRect(1, 0, 28, 18, 3, 3, 1.0, g_textcolor&0x35ffffff);
  366.     gb.SetSmoothingMode(0);
  367.     gb.FillSolidRect(25, 1, 1, 17, g_textcolor&0x20ffffff);
  368.     bt_pbo_on.ReleaseGraphics(gb);
  369.  
  370.     // --- pbo img ---
  371.    
  372.     pbo_sac = gdi.CreateImage(26, 21);
  373.     gb = pbo_sac.GetGraphics();
  374.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  375.     gb.FillSolidRect(6, 9, 9, 1, off_color);
  376.     gb.FillSolidRect(12, 7, 1, 5, off_color);
  377.     gb.FillSolidRect(13, 8, 1, 3, off_color);
  378.     gb.FillSolidRect(16, 7, 5, 5, off_color);
  379.     pbo_sac.ReleaseGraphics(gb);
  380.  
  381.     pbo_sac_ov = gdi.CreateImage(26, 21);
  382.     gb = pbo_sac_ov.GetGraphics();
  383.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  384.     gb.FillSolidRect(6, 9, 9, 1, hov_color);
  385.     gb.FillSolidRect(12, 7, 1, 5, hov_color);
  386.     gb.FillSolidRect(13, 8, 1, 3, hov_color);
  387.     gb.FillSolidRect(16, 7, 5, 5, hov_color);
  388.     pbo_sac_ov.ReleaseGraphics(gb);
  389.  
  390.     pbo_sac_on = gdi.CreateImage(26, 21);
  391.     gb = pbo_sac_on.GetGraphics();
  392.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  393.     gb.FillSolidRect(6, 10, 9, 1, on_colour);
  394.     gb.FillSolidRect(12, 8, 1, 5, on_colour);
  395.     gb.FillSolidRect(13, 9, 1, 3, on_colour);
  396.     gb.FillSolidRect(16, 8, 5, 5, on_colour);
  397.     pbo_sac_on.ReleaseGraphics(gb);
  398.  
  399.  
  400.     pbo_normal = gdi.CreateImage(26, 21);
  401.     gb = pbo_normal.GetGraphics();
  402.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  403.     gb.FillSolidRect(6, 9, 15, 1, off_color);
  404.     gb.FillSolidRect(18, 7, 1, 5, off_color);
  405.     gb.FillSolidRect(19, 8, 1, 3, off_color);
  406.     pbo_normal.ReleaseGraphics(gb);
  407.  
  408.     pbo_normal_ov = gdi.CreateImage(26, 21);
  409.     gb = pbo_normal_ov.GetGraphics();
  410.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  411.     gb.FillSolidRect(6, 9, 15, 1, hov_color);
  412.     gb.FillSolidRect(18, 7, 1, 5, hov_color);
  413.     gb.FillSolidRect(19, 8, 1, 3, hov_color);
  414.     pbo_normal_ov.ReleaseGraphics(gb);
  415.  
  416.     pbo_normal_on = gdi.CreateImage(26, 21);
  417.     gb = pbo_normal_on.GetGraphics();
  418.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  419.     gb.FillSolidRect(6, 10, 15, 1, on_colour);
  420.     gb.FillSolidRect(18, 8, 1, 5, on_colour);
  421.     gb.FillSolidRect(19, 9, 1, 3, on_colour);
  422.     pbo_normal_on.ReleaseGraphics(gb);
  423.  
  424.  
  425.     pbo_repeat_playlist = gdi.CreateImage(26, 21);
  426.     gb = pbo_repeat_playlist.GetGraphics();
  427.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  428.     gb.FillSolidRect(6, 10, 3, 1, off_color);
  429.     gb.FillSolidRect(15, 6, 6, 1, off_color);
  430.     gb.FillSolidRect(6, 13, 15, 1, off_color);
  431.     gb.FillSolidRect(5, 11, 1, 2, off_color);
  432.     gb.FillSolidRect(21, 7, 1, 6, off_color);
  433.     gb.FillSolidRect(17, 4, 1, 5, off_color);
  434.     gb.FillSolidRect(16, 5, 1, 3, off_color);
  435.     gb.FillSolidRect(10, 6, 4, 1, off_color);
  436.     gb.FillSolidRect(10, 8, 4, 1, off_color);
  437.     gb.FillSolidRect(10, 10, 4, 1, off_color);
  438.     pbo_repeat_playlist.ReleaseGraphics(gb);
  439.    
  440.     pbo_repeat_playlist_ov = gdi.CreateImage(26, 21);
  441.     gb = pbo_repeat_playlist_ov.GetGraphics();
  442.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  443.     gb.FillSolidRect(6, 10, 3, 1, hov_color);
  444.     gb.FillSolidRect(15, 6, 6, 1, hov_color);
  445.     gb.FillSolidRect(6, 13, 15, 1, hov_color);
  446.     gb.FillSolidRect(5, 11, 1, 2, hov_color);
  447.     gb.FillSolidRect(21, 7, 1, 6, hov_color);
  448.     gb.FillSolidRect(17, 4, 1, 5, hov_color);
  449.     gb.FillSolidRect(16, 5, 1, 3, hov_color);
  450.     gb.FillSolidRect(10, 6, 4, 1, hov_color);
  451.     gb.FillSolidRect(10, 8, 4, 1, hov_color);
  452.     gb.FillSolidRect(10, 10, 4, 1, hov_color);
  453.     pbo_repeat_playlist_ov.ReleaseGraphics(gb);
  454.    
  455.     pbo_repeat_playlist_on = gdi.CreateImage(26, 21);
  456.     gb = pbo_repeat_playlist_on.GetGraphics();
  457.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  458.     gb.FillSolidRect(6, 11, 3, 1, on_colour);
  459.     gb.FillSolidRect(15, 7, 6, 1, on_colour);
  460.     gb.FillSolidRect(6, 14, 15, 1, on_colour);
  461.     gb.FillSolidRect(5, 12, 1, 2, on_colour);
  462.     gb.FillSolidRect(21, 8, 1, 6, on_colour);
  463.     gb.FillSolidRect(17, 5, 1, 5, on_colour);
  464.     gb.FillSolidRect(16, 6, 1, 3, on_colour);
  465.     gb.FillSolidRect(10, 7, 4, 1, on_colour);
  466.     gb.FillSolidRect(10, 9, 4, 1, on_colour);
  467.     gb.FillSolidRect(10, 11, 4, 1, on_colour);
  468.     pbo_repeat_playlist_on.ReleaseGraphics(gb);
  469.  
  470.  
  471.     pbo_repeat = gdi.CreateImage(26, 21);
  472.     gb = pbo_repeat.GetGraphics();
  473.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  474.     gb.FillSolidRect(6, 6, 6, 1, off_color);
  475.     gb.FillSolidRect(13, 6, 8, 1, off_color);
  476.     gb.FillSolidRect(6, 13, 15, 1, off_color);
  477.     gb.FillSolidRect(5, 7, 1, 6, off_color);
  478.     gb.FillSolidRect(21, 7, 1, 6, off_color);
  479.     gb.FillSolidRect(15, 4, 1, 5, off_color);
  480.     gb.FillSolidRect(14, 5, 1, 3, off_color);
  481.     gb.FillSolidRect(11, 5, 1, 3, off_color);
  482.     pbo_repeat.ReleaseGraphics(gb);
  483.    
  484.     pbo_repeat_ov = gdi.CreateImage(26, 21);
  485.     gb = pbo_repeat_ov.GetGraphics();
  486.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  487.     gb.FillSolidRect(6, 6, 6, 1, hov_color);
  488.     gb.FillSolidRect(13, 6, 8, 1, hov_color);
  489.     gb.FillSolidRect(6, 13, 15, 1, hov_color);
  490.     gb.FillSolidRect(5, 7, 1, 6, hov_color);
  491.     gb.FillSolidRect(21, 7, 1, 6, hov_color);
  492.     gb.FillSolidRect(15, 4, 1, 5, hov_color);
  493.     gb.FillSolidRect(14, 5, 1, 3, hov_color);
  494.     gb.FillSolidRect(11, 5, 1, 3, hov_color);
  495.     pbo_repeat_ov.ReleaseGraphics(gb);
  496.    
  497.     pbo_repeat_on = gdi.CreateImage(26, 21);
  498.     gb = pbo_repeat_on.GetGraphics();
  499.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  500.     gb.FillSolidRect(6, 7, 6, 1, on_colour);
  501.     gb.FillSolidRect(13, 7, 8, 1, on_colour);
  502.     gb.FillSolidRect(6, 14, 15, 1, on_colour);
  503.     gb.FillSolidRect(5, 8, 1, 6, on_colour);
  504.     gb.FillSolidRect(21, 8, 1, 6, on_colour);
  505.     gb.FillSolidRect(15, 5, 1, 5, on_colour);
  506.     gb.FillSolidRect(14, 6, 1, 3, on_colour);
  507.     gb.FillSolidRect(11, 6, 1, 3, on_colour);
  508.     pbo_repeat_on.ReleaseGraphics(gb);
  509.  
  510.  
  511.     pbo_random = gdi.CreateImage(26, 21);
  512.     gb = pbo_random.GetGraphics();
  513.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  514.     gui_font = gdi.Font("tahoma", 8, 0);
  515.     gb.SetTextRenderingHint(3);
  516.     gb.DrawString("RND", gui_font, off_color, 0, 3, 27, 13, cc_stringformat);
  517.     pbo_random.ReleaseGraphics(gb);
  518.    
  519.     pbo_random_ov = gdi.CreateImage(26, 21);
  520.     gb = pbo_random_ov.GetGraphics();
  521.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  522.     gui_font = gdi.Font("tahoma", 8, 0);
  523.     gb.SetTextRenderingHint(3);
  524.     gb.DrawString("RND", gui_font, hov_color, 0, 3, 27, 13, cc_stringformat);
  525.     pbo_random_ov.ReleaseGraphics(gb);
  526.    
  527.     pbo_random_on = gdi.CreateImage(26, 21);
  528.     gb = pbo_random_on.GetGraphics();
  529.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  530.     gui_font = gdi.Font("tahoma", 8, 0);
  531.     gb.SetTextRenderingHint(3);
  532.     gb.DrawString("RND", gui_font, on_colour, 0, 4, 27, 13, cc_stringformat);
  533.     pbo_random_on.ReleaseGraphics(gb);
  534.  
  535.  
  536.     pbo_shuffle = gdi.CreateImage(26, 21);
  537.     gb = pbo_shuffle.GetGraphics();
  538.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  539.     gb.FillSolidRect(6, 6, 6, 1, off_color);
  540.     gb.FillSolidRect(15, 6, 7, 1, off_color);
  541.     gb.FillSolidRect(6, 12, 6, 1, off_color);
  542.     gb.FillSolidRect(15, 12, 7, 1, off_color);
  543.     gb.FillSolidRect(19, 4, 1, 5, off_color);
  544.     gb.FillSolidRect(19, 10, 1, 5, off_color);
  545.     gb.FillSolidRect(20, 5, 1, 3, off_color);
  546.     gb.FillSolidRect(20, 11, 1, 3, off_color);
  547.     gb.FillSolidRect(12, 7, 1, 1, off_color);
  548.     gb.FillSolidRect(12, 11, 1, 1, off_color);
  549.     gb.FillSolidRect(14, 7, 1, 1, off_color);
  550.     gb.FillSolidRect(14, 11, 1, 1, off_color);
  551.     gb.FillSolidRect(13, 8, 1, 3, off_color);
  552.     pbo_shuffle.ReleaseGraphics(gb);
  553.    
  554.     pbo_shuffle_ov = gdi.CreateImage(26, 21);
  555.     gb = pbo_shuffle_ov.GetGraphics();
  556.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  557.     gb.FillSolidRect(6, 6, 6, 1, hov_color);
  558.     gb.FillSolidRect(15, 6, 7, 1, hov_color);
  559.     gb.FillSolidRect(6, 12, 6, 1, hov_color);
  560.     gb.FillSolidRect(15, 12, 7, 1, hov_color);
  561.     gb.FillSolidRect(19, 4, 1, 5, hov_color);
  562.     gb.FillSolidRect(19, 10, 1, 5, hov_color);
  563.     gb.FillSolidRect(20, 5, 1, 3, hov_color);
  564.     gb.FillSolidRect(20, 11, 1, 3, hov_color);
  565.     gb.FillSolidRect(12, 7, 1, 1, hov_color);
  566.     gb.FillSolidRect(12, 11, 1, 1, hov_color);
  567.     gb.FillSolidRect(14, 7, 1, 1, hov_color);
  568.     gb.FillSolidRect(14, 11, 1, 1, hov_color);
  569.     gb.FillSolidRect(13, 8, 1, 3, hov_color);
  570.     pbo_shuffle_ov.ReleaseGraphics(gb);
  571.    
  572.     pbo_shuffle_on = gdi.CreateImage(26, 21);
  573.     gb = pbo_shuffle_on.GetGraphics();
  574.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  575.     gb.FillSolidRect(6, 7, 6, 1, on_colour);
  576.     gb.FillSolidRect(15, 7, 7, 1, on_colour);
  577.     gb.FillSolidRect(6, 13, 6, 1, on_colour);
  578.     gb.FillSolidRect(15, 13, 7, 1, on_colour);
  579.     gb.FillSolidRect(19, 5, 1, 5, on_colour);
  580.     gb.FillSolidRect(19, 11, 1, 5, on_colour);
  581.     gb.FillSolidRect(20, 6, 1, 3, on_colour);
  582.     gb.FillSolidRect(20, 12, 1, 3, on_colour);
  583.     gb.FillSolidRect(12, 8, 1, 1, on_colour);
  584.     gb.FillSolidRect(12, 12, 1, 1, on_colour);
  585.     gb.FillSolidRect(14, 8, 1, 1, on_colour);
  586.     gb.FillSolidRect(14, 12, 1, 1, on_colour);
  587.     gb.FillSolidRect(13, 9, 1, 3, on_colour);
  588.     pbo_shuffle_on.ReleaseGraphics(gb);
  589.  
  590.  
  591.     pbo_shuffle_album = gdi.CreateImage(26, 21);
  592.     gb = pbo_shuffle_album.GetGraphics();
  593.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  594.     gb.FillSolidRect(12, 6, 2, 1, off_color);
  595.     gb.FillSolidRect(17, 6, 5, 1, off_color);
  596.     gb.FillSolidRect(12, 12, 2, 1, off_color);
  597.     gb.FillSolidRect(17, 12, 5, 1, off_color);
  598.     gb.FillSolidRect(19, 4, 1, 5, off_color);
  599.     gb.FillSolidRect(19, 10, 1, 5, off_color);
  600.     gb.FillSolidRect(20, 5, 1, 3, off_color);
  601.     gb.FillSolidRect(20, 11, 1, 3, off_color);
  602.     gb.FillSolidRect(14, 7, 1, 1, off_color);
  603.     gb.FillSolidRect(14, 11, 1, 1, off_color);
  604.     gb.FillSolidRect(16, 7, 1, 1, off_color);
  605.     gb.FillSolidRect(16, 11, 1, 1, off_color);
  606.     gb.FillSolidRect(15, 8, 1, 3, off_color);
  607.     gb.FillSolidRect(5, 6, 1, 1, off_color);
  608.     gb.FillSolidRect(5, 8, 1, 1, off_color);
  609.     gb.FillSolidRect(5, 10, 1, 1, off_color);
  610.     gb.FillSolidRect(5, 12, 1, 1, off_color);
  611.     gb.FillSolidRect(7, 6, 4, 1, off_color);
  612.     gb.FillSolidRect(7, 8, 4, 1, off_color);
  613.     gb.FillSolidRect(7, 10, 4, 1, off_color);
  614.     gb.FillSolidRect(7, 12, 4, 1, off_color);
  615.     pbo_shuffle_album.ReleaseGraphics(gb);
  616.    
  617.     pbo_shuffle_album_ov = gdi.CreateImage(26, 21);
  618.     gb = pbo_shuffle_album_ov.GetGraphics();
  619.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  620.     gb.FillSolidRect(12, 6, 2, 1, hov_color);
  621.     gb.FillSolidRect(17, 6, 5, 1, hov_color);
  622.     gb.FillSolidRect(12, 12, 2, 1, hov_color);
  623.     gb.FillSolidRect(17, 12, 5, 1, hov_color);
  624.     gb.FillSolidRect(19, 4, 1, 5, hov_color);
  625.     gb.FillSolidRect(19, 10, 1, 5, hov_color);
  626.     gb.FillSolidRect(20, 5, 1, 3, hov_color);
  627.     gb.FillSolidRect(20, 11, 1, 3, hov_color);
  628.     gb.FillSolidRect(14, 7, 1, 1, hov_color);
  629.     gb.FillSolidRect(14, 11, 1, 1, hov_color);
  630.     gb.FillSolidRect(16, 7, 1, 1, hov_color);
  631.     gb.FillSolidRect(16, 11, 1, 1, hov_color);
  632.     gb.FillSolidRect(15, 8, 1, 3, hov_color);
  633.     gb.FillSolidRect(5, 6, 1, 1, hov_color);
  634.     gb.FillSolidRect(5, 8, 1, 1, hov_color);
  635.     gb.FillSolidRect(5, 10, 1, 1, hov_color);
  636.     gb.FillSolidRect(5, 12, 1, 1, hov_color);
  637.     gb.FillSolidRect(7, 6, 4, 1, hov_color);
  638.     gb.FillSolidRect(7, 8, 4, 1, hov_color);
  639.     gb.FillSolidRect(7, 10, 4, 1, hov_color);
  640.     gb.FillSolidRect(7, 12, 4, 1, hov_color);
  641.     pbo_shuffle_album_ov.ReleaseGraphics(gb);
  642.    
  643.     pbo_shuffle_album_on = gdi.CreateImage(26, 21);
  644.     gb = pbo_shuffle_album_on.GetGraphics();
  645.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  646.     gb.FillSolidRect(12, 7, 2, 1, on_colour);
  647.     gb.FillSolidRect(17, 7, 5, 1, on_colour);
  648.     gb.FillSolidRect(12, 13, 2, 1, on_colour);
  649.     gb.FillSolidRect(17, 13, 5, 1, on_colour);
  650.     gb.FillSolidRect(19, 5, 1, 5, on_colour);
  651.     gb.FillSolidRect(19, 11, 1, 5, on_colour);
  652.     gb.FillSolidRect(20, 6, 1, 3, on_colour);
  653.     gb.FillSolidRect(20, 12, 1, 3, on_colour);
  654.     gb.FillSolidRect(14, 8, 1, 1, on_colour);
  655.     gb.FillSolidRect(14, 12, 1, 1, on_colour);
  656.     gb.FillSolidRect(16, 8, 1, 1, on_colour);
  657.     gb.FillSolidRect(16, 12, 1, 1, on_colour);
  658.     gb.FillSolidRect(15, 9, 1, 3, on_colour);
  659.     gb.FillSolidRect(5, 7, 1, 1, on_colour);
  660.     gb.FillSolidRect(5, 9, 1, 1, on_colour);
  661.     gb.FillSolidRect(5, 11, 1, 1, on_colour);
  662.     gb.FillSolidRect(5, 13, 1, 1, on_colour);
  663.     gb.FillSolidRect(7, 7, 4, 1, on_colour);
  664.     gb.FillSolidRect(7, 9, 4, 1, on_colour);
  665.     gb.FillSolidRect(7, 11, 4, 1, on_colour);
  666.     gb.FillSolidRect(7, 13, 4, 1, on_colour);
  667.     pbo_shuffle_album_on.ReleaseGraphics(gb);
  668.  
  669.  
  670.     pbo_shuffle_folder = gdi.CreateImage(26, 21);
  671.     gb = pbo_shuffle_folder.GetGraphics();
  672.     gb.DrawImage(bt_pbo_off, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  673.     gb.FillSolidRect(12, 6, 2, 1, off_color);
  674.     gb.FillSolidRect(17, 6, 5, 1, off_color);
  675.     gb.FillSolidRect(12, 12, 2, 1, off_color);
  676.     gb.FillSolidRect(17, 12, 5, 1, off_color);
  677.     gb.FillSolidRect(19, 4, 1, 5, off_color);
  678.     gb.FillSolidRect(19, 10, 1, 5, off_color);
  679.     gb.FillSolidRect(20, 5, 1, 3, off_color);
  680.     gb.FillSolidRect(20, 11, 1, 3, off_color);
  681.     gb.FillSolidRect(14, 7, 1, 1, off_color);
  682.     gb.FillSolidRect(14, 11, 1, 1, off_color);
  683.     gb.FillSolidRect(16, 7, 1, 1, off_color);
  684.     gb.FillSolidRect(16, 11, 1, 1, off_color);
  685.     gb.FillSolidRect(15, 8, 1, 3, off_color);
  686.     gb.FillSolidRect(6, 5, 2, 1, off_color);
  687.     gb.FillSolidRect(6, 10, 2, 1, off_color);
  688.     gb.FillSolidRect(6, 6, 5, 3, off_color);
  689.     gb.FillSolidRect(6, 11, 5, 3, off_color);    
  690.     pbo_shuffle_folder.ReleaseGraphics(gb);
  691.    
  692.     pbo_shuffle_folder_ov = gdi.CreateImage(26, 21);
  693.     gb = pbo_shuffle_folder_ov.GetGraphics();
  694.     gb.DrawImage(bt_pbo_hov, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  695.     gb.FillSolidRect(12, 6, 2, 1, hov_color);
  696.     gb.FillSolidRect(17, 6, 5, 1, hov_color);
  697.     gb.FillSolidRect(12, 12, 2, 1, hov_color);
  698.     gb.FillSolidRect(17, 12, 5, 1, hov_color);
  699.     gb.FillSolidRect(19, 4, 1, 5, hov_color);
  700.     gb.FillSolidRect(19, 10, 1, 5, hov_color);
  701.     gb.FillSolidRect(20, 5, 1, 3, hov_color);
  702.     gb.FillSolidRect(20, 11, 1, 3, hov_color);
  703.     gb.FillSolidRect(14, 7, 1, 1, hov_color);
  704.     gb.FillSolidRect(14, 11, 1, 1, hov_color);
  705.     gb.FillSolidRect(16, 7, 1, 1, hov_color);
  706.     gb.FillSolidRect(16, 11, 1, 1, hov_color);
  707.     gb.FillSolidRect(15, 8, 1, 3, hov_color);
  708.     gb.FillSolidRect(6, 5, 2, 1, hov_color);
  709.     gb.FillSolidRect(6, 10, 2, 1, hov_color);
  710.     gb.FillSolidRect(6, 6, 5, 3, hov_color);
  711.     gb.FillSolidRect(6, 11, 5, 3, hov_color);
  712.     pbo_shuffle_folder_ov.ReleaseGraphics(gb);
  713.    
  714.     pbo_shuffle_folder_on = gdi.CreateImage(26, 21);
  715.     gb = pbo_shuffle_folder_on.GetGraphics();
  716.     gb.DrawImage(bt_pbo_on, 0, 0, 27, 21, 0, 0, 27, 21, 0, 255);
  717.     gb.FillSolidRect(12, 7, 2, 1, on_colour);
  718.     gb.FillSolidRect(17, 7, 5, 1, on_colour);
  719.     gb.FillSolidRect(12, 13, 2, 1, on_colour);
  720.     gb.FillSolidRect(17, 13, 5, 1, on_colour);
  721.     gb.FillSolidRect(19, 5, 1, 5, on_colour);
  722.     gb.FillSolidRect(19, 11, 1, 5, on_colour);
  723.     gb.FillSolidRect(20, 6, 1, 3, on_colour);
  724.     gb.FillSolidRect(20, 12, 1, 3, on_colour);
  725.     gb.FillSolidRect(14, 8, 1, 1, on_colour);
  726.     gb.FillSolidRect(14, 12, 1, 1, on_colour);
  727.     gb.FillSolidRect(16, 8, 1, 1, on_colour);
  728.     gb.FillSolidRect(16, 12, 1, 1, on_colour);
  729.     gb.FillSolidRect(15, 9, 1, 3, on_colour);
  730.     gb.FillSolidRect(6, 6, 2, 1, on_colour);
  731.     gb.FillSolidRect(6, 11, 2, 1, on_colour);
  732.     gb.FillSolidRect(6, 7, 5, 3, on_colour);
  733.     gb.FillSolidRect(6, 12, 5, 3, on_colour);
  734.     pbo_shuffle_folder_on.ReleaseGraphics(gb);
  735.  
  736.     buttons.splice(0, buttons.length);
  737.    
  738.     for(i=0;i<2;i++) {
  739.         switch(i) {
  740.          case 0:
  741.             buttons.push(new button(bt_pbo_off, bt_pbo_hov, bt_pbo_on));
  742.             break;
  743.          case 1:
  744.             buttons.push(new button(bt_pbolist_off, bt_pbolist_hov, bt_pbolist_on));
  745.             break;
  746.         };
  747.     };
  748.    
  749. };
  750.  
  751. function check_buttons() {
  752.     // Update Playback Order Button
  753.     if(fb.StopAfterCurrent) {
  754.         buttons[0].update(pbo_sac, pbo_sac_ov, pbo_sac_on);
  755.     } else {
  756.         switch(fb.PlaybackOrder) {
  757.             case 0:
  758.                 buttons[0].update(pbo_normal, pbo_normal_ov, pbo_normal_on);
  759.                 break;
  760.             case 1:
  761.                 buttons[0].update(pbo_repeat_playlist, pbo_repeat_playlist_ov, pbo_repeat_playlist_on);
  762.                 break;
  763.             case 2:
  764.                 buttons[0].update(pbo_repeat, pbo_repeat_ov, pbo_repeat_on);
  765.                 break;
  766.             case 3:
  767.                 buttons[0].update(pbo_random, pbo_random_ov, pbo_random_on);
  768.                 break;
  769.             case 4:
  770.                 buttons[0].update(pbo_shuffle, pbo_shuffle_ov, pbo_shuffle_on);
  771.                 break;
  772.             case 5:
  773.                 buttons[0].update(pbo_shuffle_album, pbo_shuffle_album_ov, pbo_shuffle_album_on);
  774.                 break;
  775.             case 6:
  776.                 buttons[0].update(pbo_shuffle_folder, pbo_shuffle_folder_ov, pbo_shuffle_folder_on);
  777.                 break;
  778.         };
  779.     };
  780.  
  781. };
  782.  
  783. //=======================================================================/ Menu(s)
  784.  
  785. function show_pbo_context_menu(x, y) {
  786.     var MF_SEPARATOR = 0x00000800;
  787.     var MF_STRING = 0x00000000;
  788.     var idx;
  789.     var _menu = window.CreatePopupMenu();
  790.     var pbo = fb.PlaybackOrder;
  791.     _menu.AppendMenuItem(MF_STRING, 1, "Default");
  792.     _menu.AppendMenuItem(MF_STRING, 2, "Repeat Playlist");
  793.     _menu.AppendMenuItem(MF_STRING, 3, "Repeat Track");
  794.     _menu.AppendMenuItem(MF_STRING, 4, "Random");
  795.     _menu.AppendMenuItem(MF_STRING, 5, "Shuffle Tracks");
  796.     _menu.AppendMenuItem(MF_STRING, 6, "Shuffle Albums");
  797.     _menu.AppendMenuItem(MF_STRING, 7, "Shuffle Folders");
  798.     _menu.AppendMenuItem(MF_SEPARATOR, 0, "");
  799.     _menu.AppendMenuItem(MF_STRING, 8, "Stop After Current");
  800.     _menu.CheckMenuRadioItem(1, 7, pbo+1);
  801.     _menu.CheckMenuItem(8, fb.StopAfterCurrent?1:0);
  802.     idx = _menu.TrackPopupMenu(x, y);
  803.     switch(idx) {
  804.         case 1:
  805.         case 2:
  806.         case 3:
  807.         case 4:
  808.         case 5:
  809.         case 6:
  810.         case 7:
  811.             pbo = idx-1;
  812.             fb.PlaybackOrder=pbo;
  813.             break;
  814.         case 8:
  815.             fb.RunMainMenuCommand("Playback/Stop After Current");
  816.             check_buttons();
  817.             break;
  818.     }
  819.     _menu.Dispose();
  820.     return true;
  821. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement