home *** CD-ROM | disk | FTP | other *** search
/ Minami 40 / MINAMI40.ISO / Extra / winamp3_0-full.exe / Wacs / xml / pledit / editor.m < prev    next >
Text File  |  2002-07-30  |  4KB  |  142 lines

  1. #include <lib/std.mi>
  2. //#include "..\..\..\lib\std.mi"
  3.  
  4. Function toggleSearchLine();
  5. Function toggleSelectionList();
  6. Function openSidecar();
  7. Function closeSidecar();
  8. Function sendSelection(String msg);
  9.  
  10. Global Button poppler;
  11. Global int in;
  12. Global int sl;
  13. Global Button searchlineclose;
  14. Global Edit editcontrol;
  15. Global Layout pllayout;
  16.  
  17. GLobal Int sidecar_oldpage, sidecar_wasopen;
  18.  
  19. System.onScriptLoaded() {
  20.   Group g = getScriptGroup();
  21.   pllayout = g.getParentLayout();
  22.   poppler = g.findObject("pledit.poppler");
  23.   searchlineclose = g.findObject("searchline.close");
  24.   GuiObject searchline = g.findObject("pledit.searchline");
  25.   editcontrol = searchline.findObject("historyeditbox.edit");
  26.   if (editcontrol == NULL) editcontrol = searchline;
  27.   in = 0;
  28.   sl = 0;
  29.   String inout = getPrivateString("pledit.poppler", "inout", "out");
  30.   if (inout == "in") poppler.leftClick();
  31.   inout = getPrivateString("pledit.poppler", "searchline", "out");
  32.   if (inout == "in") toggleSearchline();
  33. }
  34.  
  35. openSidecar() {
  36.   Group g = getScriptGroup();
  37.   Group l = g.findObject("pledit.left");
  38.   Group r = g.findObject("pledit.right");
  39.   poppler.setXmlParam("x", "-138");
  40.   l.setXmlParam("w", "-138");
  41.   r.show();
  42.   setPrivateString("pledit.poppler", "inout", "out");
  43.   poppler.setXmlParam("image", "wasabi.button.label.arrow.right");
  44.   in = 0;
  45. }
  46.  
  47. CloseSidecar() {
  48.   Group g = getScriptGroup();
  49.   Group l = g.findObject("pledit.left");
  50.   Group r = g.findObject("pledit.right");
  51.   poppler.setXmlParam("x", "-8");
  52.   l.setXmlParam("w", "-8");
  53.   r.hide();
  54.   setPrivateString("pledit.poppler", "inout", "in");
  55.   poppler.setXmlParam("image", "wasabi.button.label.arrow.left");
  56.   in = 1;
  57. }
  58.  
  59. poppler.onLeftClick() {
  60.   if (in) {
  61.     // pop to out
  62.     openSidecar();
  63.   } else {
  64.     closeSidecar();
  65.   }
  66. }
  67.  
  68. pllayout.onAccelerator(String action) {
  69.   if (action == "jumper") {
  70.     toggleSearchline();
  71.     toggleSelectionList();
  72.   }
  73. }
  74.  
  75. toggleSearchLine() {
  76.   Group g = getScriptGroup();
  77.   GuiObject l = g.findObject("pledit.left");
  78.   GuiObject r = g.findObject("pledit.right");
  79.   GuiObject editor = l.findObject("pledit.editor");
  80.   GuiObject searchline = l.findObject("pledit.searchline");
  81.   if (editor == NULL || searchline == NULL) return;
  82.   TabSheet t = r.findObject("pledit.sidecar");
  83.   if (sl) {
  84.     editor.setXmlParam("h", "-23");  
  85.     searchline.setXmlParam("y", "-23");  
  86.     setPrivateString("pledit.poppler", "searchline", "out");
  87.     searchline.show();
  88.     editcontrol.setFocus();
  89.     if (in) {
  90.       openSidecar();
  91.       sidecar_wasopen = 0;
  92.     } else {
  93.       sidecar_wasopen = 1; 
  94.     }
  95.     if (t.getCurPage() != 1) {
  96.       sidecar_oldpage = t.getCurPage();
  97.       t.setCurPage(1);
  98.     } else {
  99.       sidecar_oldpage = -1;
  100.     }
  101.     sl = 0;
  102.   } else {
  103.     searchline.hide();
  104.     editor.setXmlParam("h", "0");  
  105.     searchline.setXmlParam("y", "0");  
  106.     setPrivateString("pledit.poppler", "searchline", "in");
  107.     searchline.onNotify("in", "", 0, 0);
  108.     int page = t.getCurPage();
  109.     if (!in) {
  110.       if (page == 1) {
  111.         if (sidecar_oldpage != -1) {
  112.           t.setCurPage(sidecar_oldpage);
  113.         }
  114.       }
  115.       if (page == 1 && !sidecar_wasopen) {
  116.           closeSidecar();
  117.       }
  118.     }
  119.     sl = 1;
  120.   }
  121. }
  122.  
  123. sendSelection(String msg) {
  124.   Group g = getScriptGroup();
  125.   GuiObject r = g.findObject("pledit.right");
  126.   GuiObject selwnd = r.findObject("pledit.selection.window");
  127.   if (selwnd != NULL) selwnd.sendAction(msg, "", 0, 0, 0, 0);
  128. }
  129.  
  130. searchlineclose.onLeftClick() {
  131.   toggleSearchline();
  132.   messagebox("You have closed the Quick Selection box. This feature helps you\nfind and select specific items within a playlist. To access this\nfeature again, press the F3 key while the Playlist Editor window\nis active.", "Quick Selection", 0, "pledit_searchline_close");
  133. }
  134.  
  135. editcontrol.onKeyDown(Int vkcode) {
  136.   if (vkcode == VK_DOWN && isKeyDown(VK_CONTROL)) sendSelection("down");
  137.   if (vkcode == VK_UP && isKeyDown(VK_CONTROL)) sendSelection("up");
  138.   if (vkcode == 13 && isKeyDown(VK_CONTROL)) sendSelection("doubleclick");
  139. }
  140.  
  141.  
  142.