Advertisement
AquaJD

GUIEv2_Desktop

Feb 9th, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 40.63 KB | None | 0 0
  1. -- Colors
  2. tColors = {
  3.   ["main"] = { bg = colors.white, fg = colors.black },
  4.   ["taskbar"] = { bg = colors.blue, fg = colors.white },
  5.   ["button"] = { fg = colors.white, bar = colors.gray, drag = colors.yellow, close = colors.red, edit = colors.green },
  6.   ["error"] = { bg = colors.red, fg = colors.white },
  7.   ["icon"] = { bg = colors.blue, fg = colors.lightGray },
  8.   ["start"] = { bg = colors.lightBlue, fg = colors.white }
  9. }
  10.  
  11. -- Buttons/Boxes
  12. tButtons = {
  13.     ["icon1"] = { x = 4, y = 3, w = 4, h = 3, fg = "Tst1", bDrag = true, bBar = true, bClose = true, bEdit = true, bHidden = false, bg = colors.blue, link = "/test1" },
  14.     ["icon2"] = { x = 9, y = 3, w = 4, h = 3, fg = "Tst2", bDrag = true, bBar = true, bClose = true, bEdit = true, bHidden = false, bg = colors.blue, link = "/test2" },
  15.     ["icon3"] = { x = 14, y = 3, w = 4, h = 3, fg = "Tst3", bDrag = true, bBar = true, bClose = true, bEdit = true, bHidden = false, bg = tColors["icon"].bg, link = "/test3" },
  16.     ["iconedit"] = { x = 20, y = 3, w = 29, h = 14, fg = "Icon Editor", bDrag = true, bBar = true, bClose = true, bEdit = false, bg = colors.blue },
  17.     ["iconedit_links"] = { x = 22, y = 5, w = 25, h = 3, fg = "Modify Links", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray, },
  18.     ["iconedit_labels"] = { x = 22, y = 9, w = 25, h = 3, fg = "Modify Labels", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray, },
  19.     ["iconedit_hidden"] = { x = 22, y = 13, w = 25, h = 3, fg = "Hide Icons", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray, },
  20.     ["iconedit_h1"] = { x = 22, y = 5, w = 25, h = 3, fg = "Icon 1", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  21.     ["iconedit_h2"] = { x = 22, y = 9, w = 25, h = 3, fg = "Icon 2", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  22.     ["iconedit_h3"] = { x = 22, y = 13, w = 25, h = 3, fg = "Icon 3", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  23.     ["iconedit_l1"] = { x = 22, y = 5, w = 25, h = 3, fg = "Link 1", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  24.     ["iconedit_l2"] = { x = 22, y = 9, w = 25, h = 3, fg = "Link 2", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  25.     ["iconedit_l3"] = { x = 22, y = 13, w = 25, h = 3, fg = "Link 3", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  26.     ["iconedit_ll1"] = { x = 22, y = 5, w = 25, h = 3, fg = "Label 1", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  27.     ["iconedit_ll2"] = { x = 22, y = 9, w = 25, h = 3, fg = "Label 2", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  28.     ["iconedit_ll3"] = { x = 22, y = 13, w = 25, h = 3, fg = "Label 3", bDrag = false, bBar = false, bClose = false, bEdit = false, bg = colors.lightGray },
  29.     ["notification"] = { x = 20, y = 3, w = 29, h = 13, fg = "Notifications", bDrag = true, bBar = true, bClose = true, bEdit = false, bg = colors.blue, bAttention = false },
  30.   ["notification_msg"] = { x = 2, y = 12, w = 29, h = 5, fg = "Message", bDrag = true, bBar = true, bClose = true, bEdit = false, bg = colors.blue }
  31. }
  32.  
  33. tNotifications = {
  34.   [1] = { x = 22, y = 5, h = 1, w = 25, fg = colors.gray, bg = colors.lightBlue, text = "", sAction = "" },
  35.   [2] = { x = 22, y = 6, h = 1, w = 25, fg = colors.lightBlue, bg = colors.gray, text = "", sAction = "" },
  36.   [3] = { x = 22, y = 7, h = 1, w = 25, fg = colors.gray, bg = colors.lightBlue, text = "", sAction = "" },
  37.   [4] = { x = 22, y = 8, h = 1, w = 25, fg = colors.lightBlue, bg = colors.gray, text = "", sAction = "" },
  38.   [5] = { x = 22, y = 9, h = 1, w = 25, fg = colors.gray, bg = colors.lightBlue, text = "", sAction = "" },
  39.   [6] = { x = 22, y = 10, h = 1, w = 25, fg = colors.lightBlue, bg = colors.gray, text = "", sAction = "" },
  40.   [7] = { x = 22, y = 11, h = 1, w = 25, fg = colors.gray, bg = colors.lightBlue, text = "", sAction = "" },
  41.   [8] = { x = 22, y = 12, h = 1, w = 25, fg = colors.lightBlue, bg = colors.gray, text = "", sAction = "" },
  42.   [9] = { x = 22, y = 13, h = 1, w = 25, fg = colors.gray, bg = colors.lightBlue, text = "", sAction = "" },
  43.   [10] = { x = 22, y = 14, h = 1, w = 25, fg = colors.lightBlue, bg = colors.gray, text = "", sAction = "" },
  44. }
  45.  
  46. rednet.open("top")
  47.  
  48. -- Icons
  49. tIcons = {}
  50.  
  51. -- Paths
  52. path_users = "/guie2/.users/"
  53.  
  54. -- Event catcher is running
  55. bRunning = true
  56. -- Icon editor; running or not?
  57. bIconEditor = false
  58. sIconEditorMenu = 0
  59. -- Start menu; showing or not?
  60. bStartMenu = false
  61. -- Notifications menu
  62. bNotification = false
  63. bNotification_msg = false
  64. sMessageText = ""
  65. sMessageFrom = -1
  66.  
  67. term_width, term_height = term.getSize()
  68.  
  69. bDragging = false
  70. sDragTime = 0
  71. bStartingToDrag = false
  72.  
  73. -- Computer Time Timer
  74. sTime = os.startTimer(1)
  75.  
  76. -- Background update checking
  77. sUpdate = os.startTimer(10)
  78.  
  79. -- Draw a box! function
  80. function drawBox(tButton,extra,bIcon,bBackButton,bNotificationButton,bMsg,sFrom,sText)
  81.   term.setBackgroundColor(tButton.bg)
  82.   if not bNotificationButton then
  83.     term.setTextColor(tColors["button"].fg)
  84.   else
  85.     term.setTextColor(tButton.fg)
  86.   end
  87.   term.setCursorPos(tButton.x,tButton.y)
  88.   for i=1,tButton.h do
  89.     for i=1,tButton.w do
  90.       write(" ")
  91.     end
  92.     term.setCursorPos(tButton.x,tButton.y+i)
  93.   end
  94.   if bNotificationButton then
  95.     term.setCursorPos(tButton.x,tButton.y)
  96.     if #tButton.text > 22 then
  97.       print(string.sub(tButton.text,1,22))
  98.     else
  99.       print(tButton.text)
  100.     end
  101.     term.setCursorPos(tButton.x + tButton.w - 1, tButton.y)
  102.     term.setTextColor(tColors["button"].close)
  103.     print(string.char(7))
  104.     term.setCursorPos(tButton.x + tButton.w - 2, tButton.y)
  105.     term.setTextColor(tColors["button"].edit)
  106.     print(string.char(7))
  107.   end
  108.   if tButton.bBar then
  109.     term.setCursorPos(tButton.x,tButton.y)
  110.     term.setBackgroundColor(tColors["button"].bar)
  111.     for i=1,tButton.w do
  112.         write(" ")
  113.     end
  114.     if tButton.bDrag then
  115.         term.setCursorPos(tButton.x,tButton.y)
  116.       term.setTextColor(tColors["button"].drag)
  117.       print(string.char(7))
  118.     end
  119.     if tButton.bClose then
  120.       term.setCursorPos(tButton.x+tButton.w-1,tButton.y)
  121.       term.setTextColor(tColors["button"].close)
  122.       print(string.char(7))
  123.     end
  124.     if tButton.bEdit then
  125.         term.setCursorPos(tButton.x+tButton.w-2,tButton.y)
  126.       term.setTextColor(tColors["button"].edit)
  127.       print(string.char(7))
  128.     end
  129.     if bBackButton then
  130.         term.setCursorPos(tButton.x+tButton.w-2,tButton.y)
  131.         term.setTextColor(tColors["button"].edit)
  132.         print(string.char(17))
  133.     end
  134.     if bIcon then
  135.         term.setCursorPos(tButton.x,tButton.y+tButton.h-1)
  136.         term.setTextColor(tColors["icon"].fg)
  137.         term.setBackgroundColor(tColors["icon"].bg)
  138.         print(tButton.fg)
  139.     else
  140.         term.setCursorPos(tButton.x+1,tButton.y)
  141.         term.setTextColor(tColors["button"].fg)
  142.         print(tButton.fg)
  143.     end
  144.   else
  145.     if not bNotificationButton then
  146.       if tButton.h == 3 or tButton.h == 5 or tButton.h == 7 or tButton.h == 9 then
  147.         term.setCursorPos(tButton.x+(tButton.w/2)-(#tButton.fg/2),tButton.y+(tButton.h/2))
  148.         print(tButton.fg)
  149.       else
  150.         term.setCursorPos(tButton.x+(tButton.w/2)-(#tButton.fg/2),tButton.y+(tButton.h/2)-1)
  151.         print(tButton.fg)
  152.       end
  153.     end
  154.   end
  155.   term.setCursorPos(tButton.x+(tButton.w/2)-(#extra/2),tButton.y+(tButton.h/2)+1)
  156.   term.setTextColor(colors.gray)
  157.   print(extra)
  158.   if bMsg then
  159.     term.setCursorPos(tButtons["notification_msg"].x+1,tButtons["notification_msg"].y+2)
  160.     term.setBackgroundColor(tButtons["notification_msg"].bg)
  161.     term.setTextColor(tColors["button"].fg)
  162.     write("From: ")
  163.     term.setTextColor(colors.lightGray)
  164.     write(sFrom)
  165.     term.setTextColor(tColors["button"].fg)
  166.     term.setCursorPos(tButtons["notification_msg"].x+1,tButtons["notification_msg"].y+3)
  167.     write("Message: ")
  168.     term.setTextColor(colors.lightGray)
  169.     if #sText >= 18 then
  170.       write(string.sub(sText,1,18))
  171.       if #sText >= 36 then
  172.         if (string.sub(sText,19,19)) == " " then
  173.           term.setCursorPos(tButtons["notification_msg"].x+10,tButtons["notification_msg"].y+4)
  174.           print(string.sub(sText,20,36))
  175.         else
  176.           term.setCursorPos(tButtons["notification_msg"].x+10,tButtons["notification_msg"].y+4)
  177.           print(string.sub(sText,19,36))
  178.         end
  179.         if (string.sub(sText,37,37)) == " " then
  180.           term.setCursorPos(tButtons["notification_msg"].x+10,tButtons["notification_msg"].y+5)
  181.           print(string.sub(sText,38,#sText))
  182.         else
  183.           term.setCursorPos(tButtons["notification_msg"].x+10,tButtons["notification_msg"].y+5)
  184.           print(string.sub(sText,37,#sText))
  185.         end
  186.       else
  187.         if (string.sub(sText,19,19)) == " " then
  188.           term.setCursorPos(tButtons["notification_msg"].x+10,tButtons["notification_msg"].y+4)
  189.           print(string.sub(sText,20,#sText))
  190.         else
  191.           term.setCursorPos(tButtons["notification_msg"].x+10,tButtons["notification_msg"].y+4)
  192.           print(string.sub(sText,19,#sText))
  193.         end
  194.       end
  195.     else
  196.       write(sText)
  197.     end
  198.   end
  199. end
  200.  
  201. function addNotification(name,extra,func)
  202.   local bChosen = -1
  203.   for i=1,#tNotifications do
  204.     if tNotifications[i].text == "" then
  205.       bChosen = i
  206.       break
  207.     end
  208.   end
  209.   if bChosen == -1 then
  210.     bChosen = 10
  211.     tNotifications[1].text = tNotifications[2].text
  212.     tNotifications[1].sAction = tNotifications[2].sAction
  213.     tNotifications[2].text = tNotifications[3].text
  214.     tNotifications[2].sAction = tNotifications[3].sAction
  215.     tNotifications[3].text = tNotifications[4].text
  216.     tNotifications[3].sAction = tNotifications[4].sAction
  217.     tNotifications[4].text = tNotifications[5].text
  218.     tNotifications[4].sAction = tNotifications[5].sAction
  219.     tNotifications[5].text = tNotifications[6].text
  220.     tNotifications[5].sAction = tNotifications[6].sAction
  221.     tNotifications[6].text = tNotifications[7].text
  222.     tNotifications[6].sAction = tNotifications[7].sAction
  223.     tNotifications[7].text = tNotifications[8].text
  224.     tNotifications[7].sAction = tNotifications[8].sAction
  225.     tNotifications[8].text = tNotifications[9].text
  226.     tNotifications[8].sAction = tNotifications[9].sAction
  227.     tNotifications[9].text = tNotifications[10].text
  228.     tNotifications[9].sAction = tNotifications[10].sAction
  229.   end
  230.   tNotifications[bChosen].text = name
  231.   tNotifications[bChosen].sAction = func
  232. end
  233.  
  234. -- Draw everything! function
  235. function drawBackground()
  236.   term.setBackgroundColor(tColors["main"].bg)
  237.   term.clear()
  238.   term.setCursorPos(1,1)
  239.   term.setBackgroundColor(tColors["taskbar"].bg)
  240.   term.clearLine()
  241.   term.setCursorPos(1,1)
  242.   term.setTextColor(tColors["taskbar"].fg)
  243.   print("GUI Example V2")
  244.   term.setCursorPos(1,term_height)
  245.   term.clearLine()
  246.   term.setBackgroundColor(tColors["start"].bg)
  247.   term.setTextColor(tColors["start"].fg)
  248.   write(" Start ")
  249.   if not tButtons["icon1"].bHidden then
  250.     drawBox(tButtons["icon1"],"",true,false,false,false,"","")
  251.   end
  252.   if not tButtons["icon2"].bHidden then
  253.     drawBox(tButtons["icon2"],"",true,false,false,false,"","")
  254.   end
  255.   if not tButtons["icon3"].bHidden then
  256.     drawBox(tButtons["icon3"],"",true,false,false,false,"","")
  257.   end
  258.   if bIconEditor then
  259.     drawIconEditor()
  260.   end
  261.   if bStartMenu then
  262.     drawStartMenu()
  263.   end
  264.   if bNotification then
  265.     drawNotificationMenu()
  266.   end
  267.   if bNotification_msg then
  268.     drawBox(tButtons["notification_msg"],"",false,false,false,true,sMessageFrom,sMessageText)
  269.   end
  270. end
  271.  
  272. function drawTime()
  273.     term.setCursorPos((term_width - #textutils.formatTime(os.time(),false)) + 1,term_height)
  274.     term.setBackgroundColor(tColors["taskbar"].bg)
  275.     term.setTextColor(tColors["taskbar"].fg)
  276.     write(textutils.formatTime(os.time(),false))
  277. end
  278.  
  279. function updateNotificationMenu()
  280.   local nTaken = 0
  281.   local nOpen = 0
  282.   for i=1,#tNotifications do
  283.     if i >= 2 then
  284.       if tNotifications[i-1].text == "" then
  285.         tNotifications[i-1].text = tNotifications[i].text
  286.         tNotifications[i-1].sAction = tNotifications[i].sAction
  287.         if tNotifications[i+1] then
  288.           tNotifications[i].text = tNotifications[i+1].text
  289.           tNotifications[i].sAction = tNotifications[i+1].sAction
  290.           if tNotifications[i+2] then
  291.             tNotifications[i+1].text = tNotifications[i+2].text
  292.             tNotifications[i+1].sAction = tNotifications[i+2].sAction
  293.             if tNotifications[i+3] then
  294.               tNotifications[i+2].text = tNotifications[i+3].text
  295.               tNotifications[i+2].sAction = tNotifications[i+3].sAction
  296.               if tNotifications[i+4] then
  297.                 tNotifications[i+3].text = tNotifications[i+4].text
  298.                 tNotifications[i+3].sAction = tNotifications[i+4].sAction
  299.                 if tNotifications[i+5] then
  300.                   tNotifications[i+4].text = tNotifications[i+5].text
  301.                   tNotifications[i+4].sAction = tNotifications[i+5].sAction
  302.                   if tNotifications[i+6] then
  303.                     tNotifications[i+5].text = tNotifications[i+6].text
  304.                     tNotifications[i+5].sAction = tNotifications[i+6].sAction
  305.                     if tNotifications[i+7] then
  306.                       tNotifications[i+6].text = tNotifications[i+7].text
  307.                       tNotifications[i+6].sAction = tNotifications[i+7].sAction
  308.                       if tNotifications[i+8] then
  309.                         tNotifications[i+7].text = tNotifications[i+8].text
  310.                         tNotifications[i+7].sAction = tNotifications[i+8].sAction
  311.                         if tNotifications[i+9] then
  312.                           tNotifications[i+8].text = tNotifications[i+9].text
  313.                           tNotifications[i+8].sAction = tNotifications[i+9].sAction
  314.                         else
  315.                           tNotifications[i+8].text = ""
  316.                           tNotifications[i+8].sAction = ""
  317.                         end
  318.                       else
  319.                         tNotifications[i+7].text = ""
  320.                         tNotifications[i+7].sAction = ""
  321.                       end
  322.                     else
  323.                       tNotifications[i+6].text = ""
  324.                       tNotifications[i+6].sAction = ""
  325.                     end
  326.                   else
  327.                     tNotifications[i+5].text = ""
  328.                     tNotifications[i+5].sAction = ""
  329.                   end
  330.                 else
  331.                   tNotifications[i+4].text = ""
  332.                   tNotifications[i+4].sAction = ""
  333.                 end
  334.               else
  335.                 tNotifications[i+3].text = ""
  336.                 tNotifications[i+3].sAction = ""
  337.               end
  338.             else
  339.               tNotifications[i+2].text = ""
  340.               tNotifications[i+2].sAction = ""
  341.             end
  342.           else
  343.             tNotifications[i+1].text = ""
  344.             tNotifications[i+1].sAction = ""
  345.           end
  346.         else
  347.           tNotifications[i].text = ""
  348.           tNotifications[i].sAction = ""
  349.         end
  350.       end
  351.     end
  352.   end
  353. end
  354.  
  355. function drawNotificationMenu()
  356.     drawBox(tButtons["notification"],"",false,false,false)
  357.   for i=1,#tNotifications do
  358.     drawBox(tNotifications[i],"",false,false,true)
  359.   end
  360. end
  361.  
  362. function drawIconEditor()
  363.     drawBox(tButtons["iconedit"],"",false,true,false)
  364.     if sIconEditorMenu == 2 then
  365.         drawBox(tButtons["iconedit_l1"],tButtons["icon1"].link,false,false,false)
  366.         drawBox(tButtons["iconedit_l2"],tButtons["icon2"].link,false,false,false)
  367.         drawBox(tButtons["iconedit_l3"],tButtons["icon3"].link,false,false,false)
  368.     elseif sIconEditorMenu == 1 then
  369.         drawBox(tButtons["iconedit"],"",false,false,false)
  370.         drawBox(tButtons["iconedit_links"],"",false,false,false)
  371.         drawBox(tButtons["iconedit_labels"],"",false,false,false)
  372.         drawBox(tButtons["iconedit_hidden"],"",false,false,false)
  373.     elseif sIconEditorMenu == 3 then
  374.         drawBox(tButtons["iconedit_ll1"],tButtons["icon1"].fg,false,false,false)
  375.         drawBox(tButtons["iconedit_ll2"],tButtons["icon2"].fg,false,false,false)
  376.         drawBox(tButtons["iconedit_ll3"],tButtons["icon3"].fg,false,false,false)
  377.     elseif sIconEditorMenu == 4 then
  378.         local icon1_h = "Not Hidden"
  379.         local icon2_h = "Not Hidden"
  380.         local icon3_h = "Not Hidden"
  381.         if tButtons["icon1"].bHidden then
  382.             icon1_h = "Hidden"
  383.         end
  384.         if tButtons["icon2"].bHidden then
  385.             icon2_h = "Hidden"
  386.         end
  387.         if tButtons["icon3"].bHidden then
  388.             icon3_h = "Hidden"
  389.         end
  390.         drawBox(tButtons["iconedit_h1"],icon1_h,false,false,false)
  391.         drawBox(tButtons["iconedit_h2"],icon2_h,false,false,false)
  392.         drawBox(tButtons["iconedit_h3"],icon3_h,false,false,false)
  393.     end
  394. end
  395.  
  396. function drawStartMenu()
  397.     term.setTextColor(tColors["start"].fg)
  398.     term.setBackgroundColor(tColors["start"].bg)
  399.     term.setCursorPos(1,term_height-7)
  400.     print("                  ")
  401.     term.setCursorPos(1,term_height-6)
  402.     print("   CraftOS        ")
  403.     term.setCursorPos(1,term_height-5)
  404.     print("   Notifications  ")
  405.     term.setCursorPos(1,term_height-4)
  406.     print("   Control Panel  ")
  407.     term.setCursorPos(1,term_height-3)
  408.     print("   Icon Editor    ")
  409.     term.setCursorPos(1,term_height-2)
  410.     print("   Log out        ")
  411.     term.setCursorPos(1,term_height-1)
  412.     print("                  ")
  413.     term.setCursorPos(2,term_height-6)
  414.     term.setTextColor(tColors["taskbar"].bg)
  415.     print(string.char(7))
  416.     term.setCursorPos(2,term_height-5)
  417.     if tButtons["notification"].bAttention then
  418.         term.setTextColor(colors.red)
  419.         print(string.char(7))
  420.     else
  421.         term.setTextColor(tColors["taskbar"].bg)
  422.         print(string.char(7))
  423.     end
  424.     term.setCursorPos(2,term_height-4)
  425.     term.setTextColor(tColors["taskbar"].bg)
  426.     print(string.char(7))
  427.     term.setCursorPos(2,term_height-3)
  428.     term.setTextColor(tColors["taskbar"].bg)
  429.     print(string.char(7))
  430.     term.setCursorPos(2,term_height-2)
  431.     term.setTextColor(tColors["taskbar"].bg)
  432.     print(string.char(7))
  433. end
  434.  
  435. drawBackground()
  436. while bRunning do
  437.     local event, button, X, Y = os.pullEvent()
  438.     if event == "mouse_click" then
  439.         currentX1, currentY1 = X, Y
  440.         currentX2, currentY2 = currentX1, currentY1
  441.         currentX3, currentY3 = currentX1, currentY1
  442.         currentXIE, currentYIE = currentX1, currentY1
  443.         currentXN, currentYN = currentX1, currentY1
  444.     currentXNM, currentYNM = currentX1, currentY1
  445.         if button == 1 then
  446.             if bIconEditor then
  447.                 if X == tButtons["iconedit"].x and Y == tButtons["iconedit"].y then
  448.                     bStartingToDrag = true
  449.                 end
  450.                 -- Click 'RED' on Icon Editor
  451.                 if X == (tButtons["iconedit"].x + tButtons["iconedit"].w - 1) and Y == tButtons["iconedit"].y then
  452.                     bIconEditor = false
  453.                     sIconEditorMenu = 0
  454.                     drawBackground()
  455.                     drawTime()
  456.                 end
  457.                 if sIconEditorMenu > 1 then
  458.                     if X == (tButtons["iconedit"].x + tButtons["iconedit"].w - 2) and Y == tButtons["iconedit"].y then
  459.                         sIconEditorMenu = 1
  460.                         drawBackground()
  461.                         drawTime()
  462.                     end
  463.                 end
  464.                 if sIconEditorMenu == 2 then
  465.                     -- Click textbox on Link 1
  466.                     if X >= tButtons["iconedit_l1"].x and X <= (tButtons["iconedit_l1"].x + tButtons["iconedit_l1"].w - 1) and Y >= tButtons["iconedit_l1"].y and Y <= (tButtons["iconedit_l1"].y + tButtons["iconedit_l1"].h - 1) then
  467.                         term.setTextColor(colors.black)
  468.                         term.setBackgroundColor(colors.gray)
  469.                         term.setCursorPos(tButtons["iconedit_l1"].x+1,tButtons["iconedit_l1"].y+tButtons["iconedit_l1"].h-1)
  470.                         print("                       ")
  471.                         term.setCursorPos(tButtons["iconedit_l1"].x+1,tButtons["iconedit_l1"].y+tButtons["iconedit_l1"].h-1)
  472.                         local linkInput = read()
  473.                         if fs.exists(linkInput) then
  474.                             tButtons["icon1"].link = linkInput
  475.                         end
  476.                         drawBackground()
  477.                         drawTime()
  478.                     -- Click textbox on Link 2
  479.                     elseif X >= tButtons["iconedit_l2"].x and X <= (tButtons["iconedit_l2"].x + tButtons["iconedit_l2"].w - 1) and Y >= tButtons["iconedit_l2"].y and Y <= (tButtons["iconedit_l2"].y + tButtons["iconedit_l2"].h - 1) then
  480.                         term.setTextColor(colors.black)
  481.                         term.setBackgroundColor(colors.gray)
  482.                         term.setCursorPos(tButtons["iconedit_l2"].x+1,tButtons["iconedit_l2"].y+tButtons["iconedit_l2"].h-1)
  483.                         print("                       ")
  484.                         term.setCursorPos(tButtons["iconedit_l2"].x+1,tButtons["iconedit_l2"].y+tButtons["iconedit_l2"].h-1)
  485.                         local linkInput = read()
  486.                         if fs.exists(linkInput) then
  487.                             tButtons["icon2"].link = linkInput
  488.                         end
  489.                         drawBackground()
  490.                         drawTime()
  491.                     -- Click textbox on Link 3
  492.                     elseif X >= tButtons["iconedit_l3"].x and X <= (tButtons["iconedit_l3"].x + tButtons["iconedit_l3"].w - 1) and Y >= tButtons["iconedit_l3"].y and Y <= (tButtons["iconedit_l3"].y + tButtons["iconedit_l3"].h - 1) then
  493.                         term.setTextColor(colors.black)
  494.                         term.setBackgroundColor(colors.gray)
  495.                         term.setCursorPos(tButtons["iconedit_l3"].x+1,tButtons["iconedit_l3"].y+tButtons["iconedit_l3"].h-1)
  496.                         print("                       ")
  497.                         term.setCursorPos(tButtons["iconedit_l3"].x+1,tButtons["iconedit_l3"].y+tButtons["iconedit_l3"].h-1)
  498.                         local linkInput = read()
  499.                         if fs.exists(linkInput) then
  500.                             tButtons["icon3"].link = linkInput
  501.                         end
  502.                         drawBackground()
  503.                         drawTime()
  504.                     end
  505.                 elseif sIconEditorMenu == 1 then
  506.                     -- Click the 'Links' button
  507.                     if X >= tButtons["iconedit_links"].x and X <= (tButtons["iconedit_links"].x + tButtons["iconedit_links"].w - 1) and Y >= tButtons["iconedit_links"].y and Y <= (tButtons["iconedit_links"].y + tButtons["iconedit_links"].h - 1) then
  508.                         sIconEditorMenu = 2
  509.                         drawBackground()
  510.                         drawTime()
  511.                     -- Click the 'Labels' button
  512.                     elseif X >= tButtons["iconedit_labels"].x and X <= (tButtons["iconedit_labels"].x + tButtons["iconedit_labels"].w - 1) and Y >= tButtons["iconedit_labels"].y and Y <= (tButtons["iconedit_labels"].y + tButtons["iconedit_labels"].h - 1) then
  513.                         sIconEditorMenu = 3
  514.                         drawBackground()
  515.                         drawTime()
  516.                     -- Click the 'Hidden' button
  517.                     elseif X >= tButtons["iconedit_hidden"].x and X <= (tButtons["iconedit_hidden"].x + tButtons["iconedit_hidden"].w - 1) and Y >= tButtons["iconedit_hidden"].y and Y <= (tButtons["iconedit_hidden"].y + tButtons["iconedit_hidden"].h - 1) then
  518.                         sIconEditorMenu = 4
  519.                         drawBackground()
  520.                         drawTime()
  521.                     end
  522.                 elseif sIconEditorMenu == 3 then
  523.                     -- Click textbox on Link 1
  524.                     if X >= tButtons["iconedit_ll1"].x and X <= (tButtons["iconedit_ll1"].x + tButtons["iconedit_ll1"].w - 1) and Y >= tButtons["iconedit_ll1"].y and Y <= (tButtons["iconedit_ll1"].y + tButtons["iconedit_ll1"].h - 1) then
  525.                         term.setTextColor(colors.black)
  526.                         term.setBackgroundColor(colors.gray)
  527.                         term.setCursorPos(tButtons["iconedit_ll1"].x+1,tButtons["iconedit_ll1"].y+tButtons["iconedit_ll1"].h-1)
  528.                         print("                       ")
  529.                         term.setCursorPos(tButtons["iconedit_ll1"].x+1,tButtons["iconedit_ll1"].y+tButtons["iconedit_ll1"].h-1)
  530.                         local fgInput = read()
  531.                         tButtons["icon1"].fg = string.sub(fgInput,1,4)
  532.                         drawBackground()
  533.                         drawTime()
  534.                     -- Click textbox on Link 2
  535.                     elseif X >= tButtons["iconedit_ll2"].x and X <= (tButtons["iconedit_ll2"].x + tButtons["iconedit_ll2"].w - 1) and Y >= tButtons["iconedit_ll2"].y and Y <= (tButtons["iconedit_ll2"].y + tButtons["iconedit_ll2"].h - 1) then
  536.                         term.setTextColor(colors.black)
  537.                         term.setBackgroundColor(colors.gray)
  538.                         term.setCursorPos(tButtons["iconedit_ll2"].x+1,tButtons["iconedit_ll2"].y+tButtons["iconedit_ll2"].h-1)
  539.                         print("                       ")
  540.                         term.setCursorPos(tButtons["iconedit_ll2"].x+1,tButtons["iconedit_ll2"].y+tButtons["iconedit_ll2"].h-1)
  541.                         local fgInput = read()
  542.                         tButtons["icon2"].fg = string.sub(fgInput,1,4)
  543.                         drawBackground()
  544.                         drawTime()
  545.                     -- Click textbox on Link 3
  546.                     elseif X >= tButtons["iconedit_ll3"].x and X <= (tButtons["iconedit_ll3"].x + tButtons["iconedit_ll3"].w - 1) and Y >= tButtons["iconedit_ll3"].y and Y <= (tButtons["iconedit_ll3"].y + tButtons["iconedit_ll3"].h - 1) then
  547.                         term.setTextColor(colors.black)
  548.                         term.setBackgroundColor(colors.gray)
  549.                         term.setCursorPos(tButtons["iconedit_ll3"].x+1,tButtons["iconedit_ll3"].y+tButtons["iconedit_ll3"].h-1)
  550.                         print("                       ")
  551.                         term.setCursorPos(tButtons["iconedit_ll3"].x+1,tButtons["iconedit_ll3"].y+tButtons["iconedit_ll3"].h-1)
  552.                         local fgInput = read()
  553.                         tButtons["icon3"].fg = string.sub(fgInput,1,4)
  554.                         drawBackground()
  555.                         drawTime()
  556.                     end
  557.                 elseif sIconEditorMenu == 4 then
  558.                     -- Click Icon 1 Box
  559.                     if X >= tButtons["iconedit_h1"].x and X <= (tButtons["iconedit_h1"].x + tButtons["iconedit_h1"].w - 1) and Y >= tButtons["iconedit_h1"].y and Y <= (tButtons["iconedit_h1"].y + tButtons["iconedit_h1"].h - 1) then
  560.                         tButtons["icon1"].bHidden = not tButtons["icon1"].bHidden
  561.                         drawBackground()
  562.                         drawTime()
  563.                     elseif X >= tButtons["iconedit_h2"].x and X <= (tButtons["iconedit_h2"].x + tButtons["iconedit_h2"].w - 1) and Y >= tButtons["iconedit_h2"].y and Y <= (tButtons["iconedit_h2"].y + tButtons["iconedit_h2"].h - 1) then
  564.                         tButtons["icon2"].bHidden = not tButtons["icon2"].bHidden
  565.                         drawBackground()
  566.                         drawTime()
  567.                     elseif X >= tButtons["iconedit_h3"].x and X <= (tButtons["iconedit_h3"].x + tButtons["iconedit_h3"].w - 1) and Y >= tButtons["iconedit_h3"].y and Y <= (tButtons["iconedit_h3"].y + tButtons["iconedit_h3"].h - 1) then
  568.                         tButtons["icon3"].bHidden = not tButtons["icon3"].bHidden
  569.                         drawBackground()
  570.                         drawTime()
  571.                     end
  572.                 end
  573.             end
  574.             if bStartMenu then
  575.                 if X >= 1 and X <= 18 and Y == (term_height - 2) then
  576.                     bRunning = false
  577.                     shell.run("guie")
  578.                 elseif X >= 1 and X <= 18 and Y == (term_height - 3) then
  579.                     if not bIconEditor then
  580.                         bNotification = false
  581.                         bIconEditor = true
  582.                         sIconEditorMenu = 1
  583.                         bStartMenu = false
  584.                     end
  585.                     drawBackground()
  586.                     drawTime()
  587.                 elseif X >= 1 and X <= 18 and Y == (term_height - 4) then
  588.                     bStartMenu = false
  589.                     drawBackground()
  590.                     drawTime()
  591.                 elseif X >= 1 and X <= 18 and Y == (term_height - 5) then
  592.                     if not bNotification then
  593.                         bStartMenu = false
  594.                         bIconEditor = false
  595.                         bNotification = true
  596.                     end
  597.                     drawBackground()
  598.                     drawTime()
  599.                 elseif X >= 1 and X <= 18 and Y == (term_height - 6) then
  600.                     bRunning = false
  601.                     term.setBackgroundColor(colors.black)
  602.                     term.setTextColor(colors.yellow)
  603.                     term.clear()
  604.                     term.setCursorPos(1,1)
  605.                     print(os.version())
  606.                     term.setTextColor(colors.white)
  607.                 else
  608.                     bStartMenu = false
  609.                     drawBackground()
  610.                     drawTime()
  611.                 end
  612.             end
  613.       if bNotification_msg then
  614.         if X == (tButtons["notification_msg"].x + tButtons["notification_msg"].w - 1) and Y == tButtons["notification_msg"].y then
  615.                     bNotification_msg = false
  616.                     drawBackground()
  617.                     drawTime()
  618.         end
  619.       end
  620.             if bNotification then
  621.                 -- Click 'RED' on Notifications
  622.                 if X == (tButtons["notification"].x + tButtons["notification"].w - 1) and Y == tButtons["notification"].y then
  623.                     bNotification = false
  624.                     drawBackground()
  625.                     drawTime()
  626.         elseif X == (tNotifications[1].x + tNotifications[1].w - 1) and Y == tNotifications[1].y then
  627.           tNotifications[1].text = ""
  628.           tNotifications[1].sAction = ""
  629.           updateNotificationMenu()
  630.           drawNotificationMenu()
  631.           drawTime()
  632.         elseif X == (tNotifications[2].x + tNotifications[2].w - 1) and Y == tNotifications[2].y then
  633.           tNotifications[2].text = ""
  634.           tNotifications[2].sAction = ""
  635.           updateNotificationMenu()
  636.           drawNotificationMenu()
  637.           drawTime()
  638.         elseif X == (tNotifications[3].x + tNotifications[3].w - 1) and Y == tNotifications[3].y then
  639.           tNotifications[3].text = ""
  640.           tNotifications[3].sAction = ""
  641.           updateNotificationMenu()
  642.           drawNotificationMenu()
  643.           drawTime()
  644.         elseif X == (tNotifications[4].x + tNotifications[4].w - 1) and Y == tNotifications[4].y then
  645.           tNotifications[4].text = ""
  646.           tNotifications[4].sAction = ""
  647.           updateNotificationMenu()
  648.           drawNotificationMenu()
  649.           drawTime()
  650.         elseif X == (tNotifications[5].x + tNotifications[5].w - 1) and Y == tNotifications[5].y then
  651.           tNotifications[5].text = ""
  652.           tNotifications[5].sAction = ""
  653.           updateNotificationMenu()
  654.           drawNotificationMenu()
  655.           drawTime()
  656.         elseif X == (tNotifications[6].x + tNotifications[6].w - 1) and Y == tNotifications[6].y then
  657.           tNotifications[6].text = ""
  658.           tNotifications[6].sAction = ""
  659.           updateNotificationMenu()
  660.           drawNotificationMenu()
  661.           drawTime()
  662.         elseif X == (tNotifications[7].x + tNotifications[7].w - 1) and Y == tNotifications[7].y then
  663.           tNotifications[7].text = ""
  664.           tNotifications[7].sAction = ""
  665.           updateNotificationMenu()
  666.           drawNotificationMenu()
  667.           drawTime()
  668.         elseif X == (tNotifications[8].x + tNotifications[8].w - 1) and Y == tNotifications[8].y then
  669.           tNotifications[8].text = ""
  670.           tNotifications[8].sAction = ""
  671.           updateNotificationMenu()
  672.           drawNotificationMenu()
  673.           drawTime()
  674.         elseif X == (tNotifications[9].x + tNotifications[9].w - 1) and Y == tNotifications[9].y then
  675.           tNotifications[9].text = ""
  676.           tNotifications[9].sAction = ""
  677.           updateNotificationMenu()
  678.           drawNotificationMenu()
  679.           drawTime()
  680.         elseif X == (tNotifications[10].x + tNotifications[10].w - 1) and Y == tNotifications[10].y then
  681.           tNotifications[10].text = ""
  682.           tNotifications[10].sAction = ""
  683.           updateNotificationMenu()
  684.           drawNotificationMenu()
  685.           drawTime()
  686.         elseif X == (tNotifications[1].x + tNotifications[1].w - 2) and Y == tNotifications[1].y then
  687.           tNotifications[1].sAction()
  688.           drawBackground()
  689.                 drawTime()
  690.         elseif X == (tNotifications[2].x + tNotifications[2].w - 2) and Y == tNotifications[2].y then
  691.           tNotifications[2].sAction()
  692.           drawBackground()
  693.                 drawTime()
  694.         elseif X == (tNotifications[3].x + tNotifications[3].w - 2) and Y == tNotifications[3].y then
  695.           tNotifications[3].sAction()
  696.           drawBackground()
  697.                 drawTime()
  698.         elseif X == (tNotifications[4].x + tNotifications[4].w - 2) and Y == tNotifications[4].y then
  699.           tNotifications[4].sAction()
  700.           drawBackground()
  701.           drawTime()
  702.         elseif X == (tNotifications[5].x + tNotifications[5].w - 2) and Y == tNotifications[5].y then
  703.           tNotifications[5].sAction()
  704.           drawBackground()
  705.           drawTime()
  706.         elseif X == (tNotifications[6].x + tNotifications[6].w - 2) and Y == tNotifications[6].y then
  707.           tNotifications[6].sAction()
  708.           drawBackground()
  709.           drawTime()
  710.         elseif X == (tNotifications[7].x + tNotifications[7].w - 2) and Y == tNotifications[7].y then
  711.           tNotifications[7].sAction()
  712.           drawBackground()
  713.           drawTime()
  714.         elseif X == (tNotifications[8].x + tNotifications[8].w - 2) and Y == tNotifications[8].y then
  715.           tNotifications[8].sAction()
  716.           drawBackground()
  717.           drawTime()
  718.         elseif X == (tNotifications[9].x + tNotifications[9].w - 2) and Y == tNotifications[9].y then
  719.           tNotifications[9].sAction()
  720.           drawBackground()
  721.           drawTime()
  722.         elseif X == (tNotifications[10].x + tNotifications[10].w - 2) and Y == tNotifications[10].y then
  723.           tNotifications[10].sAction()
  724.           drawBackground()
  725.           drawTime()
  726.         end
  727.             end
  728.             if X >= 1 and X <= 7 and Y == term_height then
  729.                 bStartMenu = true
  730.                 drawBackground()
  731.                 drawTime()
  732.             end
  733.             if not tButtons["icon1"].bHidden and X >= tButtons["icon1"].x and X <= (tButtons["icon1"].x + tButtons["icon1"].w - 1) and Y >= (tButtons["icon1"].y + 1) and Y <= (tButtons["icon1"].y + tButtons["icon1"].h - 1) then
  734.                 if not bStartingToDrag then
  735.                     shell.run(tButtons["icon1"].link)
  736.                     drawBackground()
  737.                     drawTime()
  738.                 end
  739.             elseif not tButtons["icon2"].bHidden and X >= tButtons["icon2"].x and X <= (tButtons["icon2"].x + tButtons["icon2"].w - 1) and Y >= (tButtons["icon2"].y + 1) and Y <= (tButtons["icon2"].y + tButtons["icon2"].h - 1) then
  740.                 if not bStartingToDrag then
  741.                     shell.run(tButtons["icon2"].link)
  742.                     drawBackground()
  743.                     drawTime()
  744.                 end
  745.             elseif not tButtons["icon3"].bHidden and X >= tButtons["icon3"].x and X <= (tButtons["icon3"].x + tButtons["icon3"].w - 1) and Y >= (tButtons["icon3"].y + 1) and Y <= (tButtons["icon3"].y + tButtons["icon3"].h - 1) then
  746.                 if not bStartingToDrag then
  747.                     shell.run(tButtons["icon3"].link)
  748.                     drawBackground()
  749.                     drawTime()
  750.                 end
  751.             elseif not tButtons["icon1"].bHidden and X == (tButtons["icon1"].x + tButtons["icon1"].w - 2) and Y == tButtons["icon1"].y then
  752.                 if not bIconEditor then
  753.                     bNotification = false
  754.                     sIconEditorMenu = 1
  755.                     bIconEditor = true
  756.                 end
  757.                 drawBackground()
  758.                 drawTime()
  759.             elseif not tButtons["icon2"].bHidden and X == (tButtons["icon2"].x + tButtons["icon2"].w - 2) and Y == tButtons["icon2"].y then
  760.                 if not bIconEditor then
  761.                     bNotification = false
  762.                     sIconEditorMenu = 1
  763.                     bIconEditor = true
  764.                 end
  765.                 drawBackground()
  766.                 drawTime()
  767.             elseif not tButtons["icon3"].bHidden and X == (tButtons["icon3"].x + tButtons["icon3"].w - 2) and Y == tButtons["icon3"].y then
  768.                 if not bIconEditor then
  769.                     bNotification = false
  770.                     sIconEditorMenu = 1
  771.                     bIconEditor = true
  772.                 end
  773.                 drawBackground()
  774.                 drawTime()
  775.             elseif not tButtons["icon1"].bHidden and X == (tButtons["icon1"].x + tButtons["icon1"].w - 1) and Y == tButtons["icon1"].y then
  776.                 tButtons["icon1"].bHidden = true
  777.                 drawBackground()
  778.                 drawTime()
  779.             elseif not tButtons["icon2"].bHidden and X == (tButtons["icon2"].x + tButtons["icon2"].w - 1) and Y == tButtons["icon2"].y then
  780.                 tButtons["icon2"].bHidden = true
  781.                 drawBackground()
  782.                 drawTime()
  783.             elseif not tButtons["icon3"].bHidden and X == (tButtons["icon3"].x + tButtons["icon3"].w - 1) and Y == tButtons["icon3"].y then
  784.                 tButtons["icon3"].bHidden = true
  785.                 drawBackground()
  786.                 drawTime()
  787.             end
  788.         end
  789.     elseif event == "timer" then
  790.         if button == sDragTime then
  791.             bDragging = false
  792.             bStartingToDrag = false
  793.         elseif button == sTime then
  794.             sTime = os.startTimer(1)
  795.             drawTime()
  796.     elseif button == sUpdate then
  797.       sUpdate = os.startTimer(10)
  798.       drawBackground()
  799.         end
  800.     elseif event == "mouse_drag" then
  801.         if button == 1 then
  802.             if tButtons["icon1"].bDrag and currentX1 == tButtons["icon1"].x and currentY1 == tButtons["icon1"].y then
  803.                 bDragging = true
  804.                 if bDragging == true then
  805.                     sDragTime = os.startTimer(1)
  806.                     if X >= 1 and X <= (term_width - tButtons["icon2"].w + 1) and Y >= 2 and Y <= (term_height - tButtons["icon2"].h) then
  807.                         tButtons["icon1"].x = X
  808.                         tButtons["icon1"].y = Y
  809.                         currentX1 = tButtons["icon1"].x
  810.                         currentY1 = tButtons["icon1"].y
  811.                         drawBackground()
  812.                         drawTime()
  813.                     end
  814.                 end
  815.             elseif tButtons["icon2"].bDrag and currentX2 == tButtons["icon2"].x and currentY2 == tButtons["icon2"].y then
  816.                 bDragging = true
  817.                 if bDragging == true then
  818.                     sDragTime = os.startTimer(1)
  819.                     if X >= 1 and X <= (term_width - tButtons["icon2"].w + 1) and Y >= 2 and Y <= (term_height - tButtons["icon2"].h) then
  820.                         tButtons["icon2"].x = X
  821.                         tButtons["icon2"].y = Y
  822.                         currentX2 = tButtons["icon2"].x
  823.                         currentY2 = tButtons["icon2"].y
  824.                         drawBackground()
  825.                         drawTime()
  826.                     end
  827.                 end
  828.             elseif tButtons["icon3"].bDrag and currentX3 == tButtons["icon3"].x and currentY3 == tButtons["icon3"].y then
  829.                 bDragging = true
  830.                 if bDragging == true then
  831.                     sDragTime = os.startTimer(1)
  832.                     if X >= 1 and X <= (term_width - tButtons["icon2"].w + 1) and Y >= 2 and Y <= (term_height - tButtons["icon2"].h) then
  833.                         tButtons["icon3"].x = X
  834.                         tButtons["icon3"].y = Y
  835.                         currentX3 = tButtons["icon3"].x
  836.                         currentY3 = tButtons["icon3"].y
  837.                         drawBackground()
  838.                         drawTime()
  839.                     end
  840.                 end
  841.             elseif bIconEditor and tButtons["iconedit"].bDrag and currentXIE == tButtons["iconedit"].x and currentYIE == tButtons["iconedit"].y then
  842.                 bDragging = true
  843.                 if bDragging == true then
  844.                     sDragTime = os.startTimer(1)
  845.                     if X >= 1 and X <= (term_width - (tButtons["iconedit"].w - 1)) and Y >= 2 and Y <= (term_height - tButtons["iconedit"].h) then
  846.                         local tempX, tempY = X, Y
  847.                         tButtons["iconedit"].x = tempX
  848.                         tButtons["iconedit"].y = tempY
  849.                         tButtons["iconedit_labels"].x = tempX + 2
  850.                         tButtons["iconedit_labels"].y = tempY + 6
  851.                         tButtons["iconedit_links"].x = tempX + 2
  852.                         tButtons["iconedit_links"].y = tempY + 2
  853.                         tButtons["iconedit_l1"].x = tempX + 2
  854.                         tButtons["iconedit_l1"].y = tempY + 2
  855.                         tButtons["iconedit_l2"].x = tempX + 2
  856.                         tButtons["iconedit_l2"].y = tempY + 6
  857.                         tButtons["iconedit_l3"].x = tempX + 2
  858.                         tButtons["iconedit_l3"].y = tempY + 10
  859.                         tButtons["iconedit_h1"].x = tempX + 2
  860.                         tButtons["iconedit_h1"].y = tempY + 2
  861.                         tButtons["iconedit_h2"].x = tempX + 2
  862.                         tButtons["iconedit_h2"].y = tempY + 6
  863.                         tButtons["iconedit_h3"].x = tempX + 2
  864.                         tButtons["iconedit_h3"].y = tempY + 10
  865.                         tButtons["iconedit_ll1"].x = tempX + 2
  866.                         tButtons["iconedit_ll1"].y = tempY + 2
  867.                         tButtons["iconedit_ll2"].x = tempX + 2
  868.                         tButtons["iconedit_ll2"].y = tempY + 6
  869.                         tButtons["iconedit_ll3"].x = tempX + 2
  870.                         tButtons["iconedit_ll3"].y = tempY + 10
  871.                         tButtons["iconedit_hidden"].x = tempX + 2
  872.                         tButtons["iconedit_hidden"].y = tempY + 10
  873.                         currentXIE = tButtons["iconedit"].x
  874.                         currentYIE = tButtons["iconedit"].y
  875.                         drawBackground()
  876.                         drawTime()
  877.                     end
  878.                 end
  879.             elseif bNotification and tButtons["notification"].bDrag and currentXN == tButtons["notification"].x and currentYN == tButtons["notification"].y then
  880.                 bDragging = true
  881.                 if bDragging == true then
  882.                     sDragTime = os.startTimer(1)
  883.                     if X >= 1 and X <= (term_width - (tButtons["notification"].w -  1)) and Y >= 2 and Y <= (term_height - tButtons["notification"].h) then
  884.                         local tempX, tempY = X, Y
  885.                         tButtons["notification"].x = tempX
  886.                         tButtons["notification"].y = tempY
  887.             tNotifications[1].x = tempX + 2
  888.                         tNotifications[1].y = tempY + 2
  889.             tNotifications[2].x = tempX + 2
  890.                         tNotifications[2].y = tempY + 3
  891.             tNotifications[3].x = tempX + 2
  892.                         tNotifications[3].y = tempY + 4
  893.             tNotifications[4].x = tempX + 2
  894.                         tNotifications[4].y = tempY + 5
  895.             tNotifications[5].x = tempX + 2
  896.                         tNotifications[5].y = tempY + 6
  897.             tNotifications[6].x = tempX + 2
  898.                         tNotifications[6].y = tempY + 7
  899.             tNotifications[7].x = tempX + 2
  900.                         tNotifications[7].y = tempY + 8
  901.             tNotifications[8].x = tempX + 2
  902.                         tNotifications[8].y = tempY + 9
  903.             tNotifications[9].x = tempX + 2
  904.                         tNotifications[9].y = tempY + 10
  905.             tNotifications[10].x = tempX + 2
  906.                         tNotifications[10].y = tempY + 11
  907.                         currentXN = tButtons["notification"].x
  908.                         currentYN = tButtons["notification"].y
  909.                         drawBackground()
  910.                         drawTime()
  911.                     end
  912.                 end
  913.       elseif bNotification_msg and tButtons["notification_msg"].bDrag and currentXNM == tButtons["notification_msg"].x and currentYNM == tButtons["notification_msg"].y then
  914.         bDragging = true
  915.         if bDragging == true then
  916.           sDragTime = os.startTimer(1)
  917.           if X >= 1 and X <= (term_width - (tButtons["notification_msg"].w -  1)) and Y >= 2 and Y <= (term_height - tButtons["notification_msg"].h) then
  918.             local tempX, tempY = X, Y
  919.             tButtons["notification_msg"].x = tempX
  920.             tButtons["notification_msg"].y = tempY
  921.             currentXNM = tButtons["notification_msg"].x
  922.             currentYNM = tButtons["notification_msg"].y
  923.             drawBackground()
  924.                         drawTime()
  925.           end
  926.         end
  927.       end
  928.     end
  929.   elseif event == "rednet_message" then
  930.     local msg = X
  931.     local id = button
  932.     addNotification("Message from ID: "..id,
  933.                     msg,
  934.                     function()
  935.                       bNotification_msg = true
  936.                       sMessageFrom = id
  937.                       sMessageText = msg
  938.                       if #msg >= 18 then
  939.                         tButtons["notification_msg"].h = 6
  940.                         if #msg >= 36 then
  941.                           tButtons["notification_msg"].h = 7
  942.                         end
  943.                       end
  944.                     end)
  945.   end
  946. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement