gen_dropbox.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #include <lib/std.mi>
  2. #define GUID_DROPBOX "{E2E4AD32-D87B-4B9E-BF58-46A1336DDC8F}"
  3. #define GUID_DROPBOX_ "{E2E4AD32-D87B-4b9e-BF58-46A1336DDC8F}"
  4. #define USE_BIG_HACK
  5. Global Frame dualwnd;
  6. Global Group sui_window;
  7. Global Group dropbox;
  8. Global Timer box_tmr;
  9. Global windowholder dropbox_wdh;
  10. Global Container main;
  11. Global int MIN_WIDTH;
  12. System.onScriptLoaded ()
  13. {
  14. dualwnd = getScriptGroup().findObject("wdh.ml.dualwnd");
  15. sui_window = getScriptGroup().getParentLayout().findObject("sui.content");
  16. dropbox = dualwnd.findObject("wdh.ml.dualwnd.dropbox");
  17. dropbox_wdh = dropbox.findObject("wdh");
  18. main = dropbox.getParentLayout().getContainer();
  19. //showWindow(GUID_DROPBOX, "", false);
  20. MIN_WIDTH = stringToInteger(dualwnd.getXmlParam("minwidth"));
  21. dualwnd.setXmlParam("resizable", "0");
  22. dualwnd.setPosition(0);
  23. box_tmr = new Timer;
  24. box_tmr.setDelay(1);
  25. }
  26. System.onScriptUnloading ()
  27. {
  28. delete box_tmr;
  29. int w = dualwnd.getPosition();
  30. if (w >= MIN_WIDTH)
  31. {
  32. setPrivateInt(getSkinName(), "gen_dropbox_poppler", w);
  33. }
  34. }
  35. #ifdef 0
  36. Global Boolean gettingclosed;
  37. System.onGetCancelComponent (String guid, boolean goingvisible)
  38. {
  39. if (guid != GUID_DROPBOX)
  40. {
  41. return FALSE;
  42. }
  43. if (goingvisible && !gettingclosed)
  44. {
  45. box_tmr.start();
  46. return TRUE;
  47. }
  48. else
  49. {
  50. if (gettingclosed)
  51. {
  52. gettingclosed = false;
  53. }
  54. else
  55. {
  56. /*int w = dualwnd.getPosition();
  57. if (w >= MIN_WIDTH)
  58. {
  59. setPrivateInt(getSkinName(), "gen_dropbox_poppler", w);
  60. }
  61. dualwnd.setXmlParam("resizable", "0");
  62. dualwnd.setPosition(0);*/
  63. }
  64. }
  65. RETURN FALSE;
  66. }
  67. box_tmr.onTimer ()
  68. {
  69. box_tmr.stop();
  70. int w = getPrivateInt(getSkinName(), "gen_dropbox_poppler", 200);
  71. if (w < MIN_WIDTH)
  72. w = MIN_WIDTH;
  73. dualwnd.setXmlParam("resizable", "1");
  74. System.showWindow("{6B0EDF80-C9A5-11D3-9F26-00C04F39FFC6}", "", 0);
  75. //sui_window.sendAction("opentab", "ml", 0,0,0,0);
  76. dualwnd.setPosition(w);
  77. dropbox.hide();
  78. dropbox_wdh.hide();
  79. //dropbox_wdh.setXMLParam("hold", "");
  80. dropbox_wdh.show();
  81. //dropbox_wdh.setXMLParam("hold", "@all@");
  82. dropbox.show();
  83. }
  84. #ifdef USE_BIG_HACK
  85. sui_window.onAction (String action, String param, Int x, int y, int p1, int p2, GuiObject source)
  86. {
  87. if (action == "callback")
  88. {
  89. if (param == "onbeforehidesui")
  90. {
  91. /*//dualwnd.setPosition(0);
  92. //dropbox.findObject("wdh").setXmlParam("relatw", "0");
  93. //dropbox.findObject("wdh").setXmlParam("w", "0");
  94. int i = dualwnd.getLeft() + dualwnd.getWidth();
  95. dualwnd.setShaded(dualwnd.clientToScreenX(dualwnd.getLeft() +dualwnd.getWidth()),dualwnd.clientToScreenX(dualwnd.getLeft() + dualwnd.getWidth()-dualwnd.getPosition()-4));
  96. debugInt(dualwnd.clientToScreenX(dualwnd.getLeft() +dualwnd.getWidth()));*/
  97. dropbox.hide();
  98. gettingclosed = true;
  99. //dualwnd.setPosition(0);
  100. }
  101. else if (param == "onshowsui")
  102. {
  103. //dualwnd.setPosition(200);
  104. }
  105. }
  106. }
  107. main.onBeforeSwitchToLayout (Layout oldlayout, Layout newlayout)
  108. {
  109. if (newLayout.getID() == "shade")
  110. {
  111. dropbox.hide();
  112. gettingclosed = true;
  113. }
  114. }
  115. #endif
  116. #endif