Advertisement
Guest User

PackedSys2.0

a guest
Apr 29th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 73.32 KB | None | 0 0
  1. {
  2.   Main = {
  3.     [ "frst_run.cc" ] = "term.setBackgroundColor(colors.gray)\
  4. term.clear()\
  5. function TextWel()\
  6. term.setTextColor(colors.black)\
  7. term.setBackgroundColor(colors.gray)\
  8. term.setCursorPos(16,6)\
  9. sleep(0.34)\
  10. print(\"We\")\
  11. sleep(0.34)\
  12. term.setCursorPos(18,6)\
  13. print(\"lco\")\
  14. sleep(0.34)\
  15. term.setCursorPos(21,6)\
  16. print(\"me\")\
  17. sleep(0.34)\
  18. term.setCursorPos(23,6)\
  19. print(\" to \")\
  20. sleep(0.34)\
  21. term.setCursorPos(27,6)\
  22. print(\"Lion\")\
  23. sleep(0.34)\
  24. term.setCursorPos(31,6)\
  25. print(\" O\")\
  26. sleep(0.34)\
  27. term.setCursorPos(33,6)\
  28. print(\"S \")\
  29. sleep(0.34)\
  30. term.setCursorPos(35,6)\
  31. print(\"X\")\
  32. term.setCursorPos(27,6)\
  33. term.setTextColor(colors.orange)\
  34. term.write(\"Lion OS X\")\
  35. end\
  36. function drawTab()\
  37. paintutils.drawLine(11,8,41,8,colors.lightGray)\
  38. paintutils.drawLine(11,9,41,9,colors.lightGray)\
  39. paintutils.drawLine(11,10,41,10,colors.lightGray)\
  40. term.setCursorPos(12,9)\
  41. term.setTextColor(colors.white)\
  42. term.write(\"Username: \")\
  43. username = read()\
  44. name = fs.open(\"System/Config/clog.cfg\",\"w\")\
  45. name.writeLine(username)\
  46. name.close()\
  47. paintutils.drawLine(12,9,36,9,colors.lightGray)\
  48. term.setCursorPos(12,9)\
  49. term.write(\"Password: \")\
  50. password = read()\
  51. paintutils.drawLine(12,9,36,9,colors.lightGray)\
  52. term.setCursorPos(11,9)\
  53. term.write(\"@Password: \")\
  54. password2 = read()\
  55. govno = true\
  56. function testPASSLOG()\
  57. --\
  58. if password2 == password then\
  59. op = fs.open(\"System/Config/user.cfg\",\"w\")\
  60. op.writeLine(\"OLD\")\
  61. op.close()\
  62. kek = fs.open(\"System/Config/pas.cfg\",\"w\")\
  63. kek.writeLine(password)\
  64. kek.close()\
  65. govno = false\
  66. elseif password2 ~= password then\
  67. paintutils.drawLine(12,9,36,9,colors.lightGray)\
  68. term.setTextColor(colors.red)\
  69. term.setCursorPos(12,10)\
  70. term.write(\"@Pass ~= Pass!\")\
  71. term.setCursorPos(11,9)\
  72. term.setTextColor(colors.white)\
  73. term.write(\"@Password: \")\
  74. password2 = read()\
  75. testPASSLOG()\
  76. end\
  77. --\
  78. end\
  79. end\
  80. TextWel()\
  81. drawTab()\
  82. while govno do\
  83. testPASSLOG()\
  84. end\
  85. \
  86. \
  87. \
  88. \
  89. \
  90. \
  91. \
  92. \
  93. \
  94. \
  95. \
  96. \
  97. \
  98. \
  99. \
  100. \
  101. \
  102. ",
  103.     OSEL = "os.loadAPI(\"GUI\")\
  104. ---StartOs\
  105. term.clear()\
  106. os.pullEvent = os.pullEventRaw\
  107. poop = fs.open(\"System/Config/user.cfg\",\"r\")\
  108. pop = poop.readLine()\
  109. if pop == \"NEW\" then\
  110. term.clear()\
  111. shell.run(\"System/Main/frst_run.cc\")\
  112. end\
  113. ----\
  114. log = fs.open(\"System/Config/clog.cfg\",\"r\")\
  115. logr = log.readLine()\
  116. log.close()\
  117. pas = fs.open(\"System/Config/pas.cfg\",\"r\")\
  118. pasr = pas.readLine()\
  119. pas.close()\
  120. ---login--\
  121. function login()\
  122. term.clear()\
  123. local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
  124. paintutils.drawImage(load,1,1)\
  125. term.setTextColor(colors.black)\
  126. paintutils.drawFilledBox(15,5,37,8,colors.lightGray)\
  127. paintutils.drawFilledBox(16,6,36,7,colors.white)\
  128. term.setCursorPos(16,6)\
  129. local wileX = true\
  130. function passwordIn()\
  131. paintutils.drawLine(16,7,33,7,colors.white)\
  132. term.setCursorPos(16,6)\
  133. term.write(\"                     \")\
  134. term.setCursorPos(16,6)\
  135. term.write(\" Password:\")\
  136. local password = read(\"*\")\
  137. if password == pasr then\
  138. wileX = false\
  139. welcome()\
  140. else\
  141. term.setTextColor(colors.red)\
  142. paintutils.drawLine(16,7,33,7,colors.white)\
  143. term.setCursorPos(16,7)\
  144. term.write(\" Wrong password!\")\
  145. term.setCursorPos(23,6)\
  146. term.setTextColor(colors.black)\
  147. passwordIn()\
  148. end\
  149. ------\
  150. end\
  151. --\
  152. --\
  153. --\
  154. function inLog()\
  155. term.setTextColor(colors.black)\
  156. paintutils.drawLine(16,6,33,6,colors.white)\
  157. term.setCursorPos(16,6)\
  158. term.write(\" Login:\")\
  159. if read() == logr then\
  160. passwordIn()\
  161. else\
  162. paintutils.drawLine(16,7,33,7,colors.white)\
  163. term.setCursorPos(16,7)\
  164. term.setTextColor(colors.red)\
  165. term.write(\" Wrong login!\")\
  166. term.setTextColor(colors.black)\
  167. end\
  168. end\
  169. ----\
  170. --\
  171. --\
  172. function ENTER()\
  173. inLog()\
  174. end\
  175. while wileX do\
  176. ENTER()\
  177. end\
  178. end\
  179. ---\
  180. ---welcome--\
  181. function welcome()\
  182. term.clear()\
  183. local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
  184. paintutils.drawImage(load,1,1)\
  185. term.setTextColor(colors.red)\
  186. local i = 0\
  187. paintutils.drawPixel(23,9,colors.orange)\
  188. term.setCursorPos(23,9)\
  189. term.write(\"Welcome \")\
  190. term.setCursorPos(24,9)\
  191. term.setBackgroundColor(colors.gray)\
  192. term.write(\"e\")\
  193. term.setCursorPos(25,9)\
  194. term.setBackgroundColor(colors.cyan)\
  195. term.write(\"l\")\
  196. term.setCursorPos(28,9)\
  197. term.setBackgroundColor(colors.gray)\
  198. term.write(\"m\")\
  199. term.setCursorPos(29,9)\
  200. term.setBackgroundColor(colors.cyan)\
  201. term.write(\"e\")\
  202. sleep(0.2)\
  203. paintutils.drawPixel(20,11,colors.blue)\
  204. sleep(0.5)\
  205. paintutils.drawLine(21,11,26,11,colors.blue)\
  206. sleep(0.3)\
  207. paintutils.drawLine(27,11,30,11,colors.blue)\
  208. sleep(0.4)\
  209. paintutils.drawLine(30,11,32,11,colors.blue)\
  210. sleep(1)\
  211. ---\
  212. end\
  213. ---\
  214. function loadSys()\
  215. local load = paintutils.loadImage(\"System/Pictures/Icons/stus.plc\")\
  216. paintutils.drawImage(load,1,1)\
  217. paintutils.drawLine(20,11,32,11,colors.white)\
  218. term.setCursorPos(22,9)\
  219. term.setTextColor(colors.orange)\
  220. term.setBackgroundColor(colors.cyan)\
  221. term.write(\"Lion OS X\")\
  222. term.setTextColor(colors.black)\
  223. term.setCursorPos(40,19)\
  224. term.write(\"ZfelfProg CC\")\
  225. term.setCursorPos(1,19)\
  226. term.write(\"AlexZfelf CC\")\
  227. sleep(1)\
  228. paintutils.drawPixel(20,11,colors.blue)\
  229. sleep(1.2)\
  230. paintutils.drawLine(21,11,24,11,colors.blue)\
  231. sleep(1,3)\
  232. paintutils.drawLine(25,11,30,11,colors.blue)\
  233. sleep(1)\
  234. paintutils.drawLine(30,11,32,11,colors.blue)\
  235. sleep(1)\
  236. login()\
  237. end\
  238. ---\
  239. loadSys()\
  240. \
  241. -------\
  242. ---\
  243. ---background---color---as\
  244. \
  245. ---\
  246. -------\
  247. term.setBackgroundColor(colors.lightBlue)\
  248. term.clear()\
  249. term.setCursorPos(1,1)\
  250. -----\
  251. SelectBc = {\
  252. [1] = colors.lightBlue\
  253. }\
  254. ------osgui-----\
  255. function gui()\
  256. term.clear()\
  257. term.setBackgroundColor(SelectBc[1])\
  258. term.setCursorPos(1,1)\
  259. --------upbar----\
  260. function upbar()\
  261. paintutils.drawLine(1,1,44,1,colors.lightGray)\
  262. end\
  263. upbar()\
  264. ----iconW---\
  265. paintutils.drawPixel(1,1,colors.lightGray)\
  266. paintutils.drawPixel(2,1,colors.lightGray)\
  267. term.setCursorPos(1,1)\
  268. term.setTextColor(colors.white)\
  269. term.setBackgroundColor(colors.cyan)\
  270. term.write(\"OS\")\
  271. -----clock----\
  272. paintutils.drawLine(45,1,51,1,colors.blue)\
  273. end\
  274. ------timeclock----\
  275. function time()\
  276. local time = os.time()\
  277. local ftime = textutils.formatTime(time,false)\
  278. term.setTextColor(colors.white)\
  279. term.setBackgroundColor(colors.blue)\
  280. term.setCursorPos(44,1)\
  281. term.write(ftime)\
  282. end\
  283. function desktop()\
  284. folder = paintutils.loadImage(\"System/Pictures/Icons/folder.pic\")\
  285. program = paintutils.loadImage(\"System/Pictures/Icons/program.pic\")\
  286. file = paintutils.loadImage(\"System/Pictures/Icons/file.pic\")\
  287. paint = paintutils.loadImage(\"System/Pictures/Icons/paint.exe\")\
  288. paintutils.drawImage(folder,3,3)  \
  289. paintutils.drawImage(paint,11,3)\
  290. end\
  291. function fileName()\
  292. naziF = 0\
  293. if naziF == 0 then\
  294. term.setCursorPos(3,8)\
  295. term.setTextColor(colors.black)\
  296. term.setBackgroundColor(SelectBc[1])\
  297. term.write(\"System\")\
  298. term.setCursorPos(11,8)\
  299. term.write(\" Paint\")\
  300. end\
  301. if naziF == 1 then\
  302. term.setCursorPos(3,8)\
  303. term.setTextColor(colors.black)\
  304. term.setBackgroundColor(SelectBc[1])\
  305. term.write(\"System\")\
  306. term.setCursorPos(11,8)\
  307. term.setTextColor(colors.black)\
  308. term.setBackgroundColor(colors.red)\
  309. term.write(\"Pa\")\
  310. term.setBackgroundColor(colors.white)\
  311. term.write(\"int\")\
  312. end\
  313. end\
  314. function select()\
  315. sel = paintutils.loadImage(\"select.pic\")\
  316. end\
  317. menuHide = 0\
  318. folderHide = 0\
  319. function osmenu()\
  320. menu = paintutils.loadImage(\"System/Pictures/Icons/osMenu.cpic\")\
  321. event,button,x,y = os.pullEvent()\
  322. if event == \"mouse_click\" then\
  323.  if menuHide == 0 and folderHide == 0 and button == 1 and x == 1 and y == 1 or menuHide == 0 and button == 1 and x == 2 and  y == 1 then\
  324.    paintutils.drawImage(menu,2,2)\
  325.    term.setCursorPos(1,1)\
  326.    term.setBackgroundColor(colors.blue)\
  327.    term.write(\"OS\")\
  328.    sleep(0.140)\
  329.    ------button---options----\
  330.    term.setCursorPos(3,8)\
  331.    term.setTextColor(colors.black)\
  332.    term.setBackgroundColor(colors.white)\
  333.    term.write(\"Options\")\
  334.    paintutils.drawPixel(10,8,colors.lightGray)\
  335.    term.setCursorPos(10,8)\
  336.    term.write(\">\")\
  337.    ------button---shutdown---\
  338.    term.setCursorPos(3,9)\
  339.    term.setBackgroundColor(colors.white)\
  340.    term.write(\"Reboot\")\
  341.    paintutils.drawPixel(10,9,colors.lightGray)\
  342.    term.setCursorPos(10,9)\
  343.    term.write(\">\")\
  344.    ------button---folder----\
  345.    term.setCursorPos(3,7)\
  346.    term.setBackgroundColor(colors.white)\
  347.    term.write(\"My CC\")\
  348.    paintutils.drawPixel(10,7,colors.lightGray)\
  349.    term.setCursorPos(10,7)\
  350.    term.write(\">\")\
  351.    ------button---exit-------\
  352.    term.setCursorPos(3,6)\
  353.    term.setBackgroundColor(colors.white)\
  354.    term.write(\"Shell\")\
  355.    paintutils.drawPixel(10,6,colors.lightGray)\
  356.    term.setCursorPos(10,6)\
  357.    term.write(\">\")\
  358.    ------button---closebar---\
  359.    term.setCursorPos(3,2)\
  360.    term.setBackgroundColor(colors.white)\
  361.    term.write(\"Hide\")\
  362.    paintutils.drawPixel(10,2,colors.yellow)\
  363.    term.setCursorPos(10,2)\
  364.    term.write(\">\")\
  365.    term.setCursorPos(2,3)\
  366.    term.setTextColor(colors.lightGray)\
  367.    term.setBackgroundColor(colors.white)\
  368.    term.write(\"---------\")\
  369.    ------button---\
  370.    menuHide = 1\
  371.  end\
  372. end\
  373. end\
  374. winhide = 0\
  375. function mSettings()\
  376. if menuHide == 1 then\
  377.  if button == 1 and x == 10 and y == 8 then\
  378.  menuHide = 0\
  379.  folderHide = 0\
  380.  paintutils.drawPixel(10,8,colors.blue)\
  381.  term.setTextColor(colors.white)\
  382.  term.setCursorPos(10,8)\
  383.  term.write(\">\")\
  384.  sleep(0.143)\
  385.  term.setBackgroundColor(SelectBc[1])\
  386.  gui()\
  387.  desktop()\
  388.  time()\
  389.  fileName()\
  390.  function winOP()\
  391.  window = paintutils.loadImage(\"System/Pictures/Win/win.plw\")\
  392.  paintutils.drawImage(window,7,3)\
  393.  -------textin---win--\
  394.  term.setCursorPos(8,5)\
  395.  term.setBackgroundColor(colors.white)\
  396.  term.setTextColor(colors.black)\
  397.  term.write(\" Background color: \")\
  398.  paintutils.drawPixel(27,5,colors.green)\
  399.  paintutils.drawPixel(28,5,colors.lightBlue)\
  400.  paintutils.drawPixel(29,5,colors.red)\
  401.  paintutils.drawPixel(30,5,colors.pink)\
  402.  term.setCursorPos(8,7)\
  403.  term.setBackgroundColor(colors.white)\
  404.  term.write(\" Selected: \")\
  405.  paintutils.drawPixel(19,7,SelectBc[1])\
  406.  term.setCursorPos(8,9)\
  407.  term.setBackgroundColor(colors.white)\
  408.  term.write(\" Save & Exit\")\
  409.  term.setCursorPos(21,9)\
  410.  term.write(\">\")\
  411.  end\
  412.  winOP()\
  413.  menuHide = 0\
  414.  \
  415.  \
  416.  \
  417.  \
  418.  -----endtetx----\
  419.  winhide = 1\
  420. elseif folderHide == 1 then\
  421.  \
  422.  end\
  423. end\
  424. end\
  425. \
  426. function txwin()\
  427. if menuHide == 0 and folderHide == 0 and event == \"mouse_click\" then\
  428. if winhide == 1 then\
  429. if button == 1 and x == 7 and y == 3 then\
  430. menuHide = 0\
  431. winhide = 0\
  432. time()\
  433. term.setBackgroundColor(SelectBc[1])\
  434. gui()\
  435. desktop()\
  436. fileName()\
  437. osmenu()\
  438. end\
  439. end\
  440. end\
  441. end\
  442. function shutdown()\
  443. if menuHide == 1 then\
  444.  if button == 1 and x == 10 and y == 9 then\
  445.   paintutils.drawPixel(10,9,colors.red)\
  446.   term.setTextColor(colors.white)\
  447.   term.setCursorPos(10,9)\
  448.   term.write(\">\")\
  449.   sleep(0.144)\
  450.     os.reboot()\
  451.   end\
  452. end\
  453. function func()\
  454. if menuHide == 1 then\
  455.  if button == 1 and x == 10 and y == 7 then\
  456.  paintutils.drawPixel(10,7,colors.blue)\
  457.  term.setTextColor(colors.white)\
  458.  term.setCursorPos(10,7)\
  459.  term.write(\">\")\
  460.  end\
  461. \
  462. end\
  463. \
  464. end\
  465. \
  466. end\
  467. function OSDRAW()\
  468. mSettings()\
  469. osmenu()\
  470. txwin()\
  471. pickcolor()\
  472. shutdown()\
  473. func()\
  474. \
  475. end\
  476. OSWHILE = true\
  477. function exit()\
  478. if menuHide == 1 and button == 1 and x == 10 and y == 6 then\
  479. paintutils.drawPixel(10,6,colors.blue)\
  480. term.setCursorPos(10,6)\
  481. term.setTextColor(colors.white)\
  482. term.write(\">\")\
  483. sleep(0.143)\
  484. term.clear()\
  485. term.setBackgroundColor(colors.black)\
  486. term.setCursorPos(1,1)\
  487. term.setTextColor(colors.yellow)\
  488. term.clear()\
  489. term.write(\"LionSh 1.7\")\
  490. term.setCursorPos(1,2)\
  491. sleep(0.104)\
  492. OSWHILE = false\
  493. end\
  494. end\
  495. ----\
  496. function closebar()\
  497. if menuHide == 1 then\
  498. if folderHide == 0 and menuHide == 1 and button == 1 and x == 10 and y == 2 then\
  499. paintutils.drawPixel(10,2,colors.blue)\
  500. term.setCursorPos(10,2)\
  501. term.setTextColor(colors.white)\
  502. term.write(\">\")\
  503. sleep(0.144)\
  504. term.setCursorPos(1,1)\
  505. term.setBackgroundColor(colors.cyan)\
  506. term.write(\"OS\")\
  507. term.setBackgroundColor(SelectBc[1])\
  508. menuHide = 0\
  509. gui()\
  510. desktop()\
  511. fileName()\
  512. time()\
  513. osmenu()\
  514. elseif folderHide == 1 and button == 1 and x == 10 and y == 2 then\
  515. filD = paintutils.loadImage(\"System/Pictures/FolderIn/menuHide.pic\")\
  516. paintutils.drawImage(filD,2,2)\
  517. menuHide = 0\
  518. term.setCursorPos(6,3)\
  519. term.setBackgroundColor(colors.lightGray)\
  520. term.setTextColor(colors.black)\
  521. term.write(\"<>\")\
  522. term.setBackgroundColor(colors.gray)\
  523. term.setCursorPos(2,2)\
  524. term.setTextColor(colors.yellow)\
  525. term.write(\"0\")\
  526. term.setCursorPos(3,2)\
  527. term.setTextColor(colors.green)\
  528. term.write(\"0\")\
  529. elseif winhide == 1 and button == 1 and x == 10 and y == 2 then\
  530. menuHide = 0\
  531. term.setBackgroundColor(SelectBc[1])\
  532. gui()\
  533. desktop()\
  534. fileName()\
  535. time()\
  536. osmenu()\
  537. paintutils.drawImage(window,7,3)\
  538. winOP()\
  539. end\
  540. end\
  541. end\
  542. \
  543. \
  544. \
  545. ----func---color----pick\
  546. function pickcolor()\
  547. local file = fs.open(\"color\",\"w\")\
  548. if winhide == 1 then\
  549.  if button == 1 and x == 27 and y == 5 then\
  550.  SelectBc[1] = colors.green\
  551.  paintutils.drawPixel(19,7,SelectBc[1])\
  552.  file.write(\"colors.green\")\
  553.  elseif x == 28 and y == 5 then\
  554.  SelectBc[1] = colors.lightBlue\
  555.  paintutils.drawPixel(19,7,SelectBc[1])\
  556.  file.write(\"colors.lightBlue\")\
  557.  elseif x == 29 and y == 5 then\
  558.  SelectBc[1] = colors.red\
  559.  naziF = 1\
  560.  paintutils.drawPixel(19,7,SelectBc[1])\
  561.  nazi = paintutils.loadImage(\"System/wallpapers/grammarnazi.fuck\")\
  562.  paintutils.drawImage(nazi,1,2)\
  563.  fileName()\
  564.  desktop()\
  565.  file.write(\"colors.red\")\
  566.  elseif x == 30 and y == 5 then\
  567.  SelectBc[1] = colors.pink\
  568.  paintutils.drawPixel(19,7,SelectBc[1])\
  569.  file.write(\"colors.pink\")\
  570.  elseif x == 21 and y == 9 then\
  571.  file.close()\
  572.  term.setBackgroundColor(SelectBc[1])\
  573.  gui()\
  574.  fileName()\
  575.  desktop()\
  576.  time()\
  577.  end\
  578. end\
  579. end\
  580. ----\
  581. --\
  582. contextdraw = 0\
  583. function context_draw()\
  584. contextr = paintutils.loadImage(\"System/Pictures/Menus/Context.pic\")\
  585. paintutils.drawImage(contextr,x,y)\
  586. term.setCursorPos(x+1,y)\
  587. term.setBackgroundColor(colors.white)\
  588. term.setTextColor(colors.black)\
  589. term.write(\"Open\")\
  590. term.setCursorPos(x+7,y)\
  591. term.setBackgroundColor(colors.yellow)\
  592. term.write(\">\")\
  593. term.setCursorPos(x,y+1)\
  594. term.setTextColor(colors.lightGray)\
  595. term.setBackgroundColor(colors.white)\
  596. term.write(\"--------\")\
  597. term.setCursorPos(x+1,y+6)\
  598. term.setTextColor(colors.black)\
  599. term.write(\"Info\")\
  600. term.setCursorPos(x+7,y+6)\
  601. term.setBackgroundColor(colors.yellow)\
  602. term.write(\">\")\
  603. contextdraw = 1\
  604. end\
  605. ---context-----touch---\
  606. function context_touch()\
  607. if contextdraw == 1 and folderHide == 0 and y ~= 1 then\
  608.  if button == 1 and folderHide == 0 then\
  609.  contextdraw = 0\
  610.  term.setBackgroundColor(SelectBc[1])\
  611.  gui()\
  612.  desktop()\
  613.  fileName()\
  614.  time()\
  615.  menuHide = 0\
  616.  end\
  617. end\
  618. end\
  619. ----\
  620. function context_drawLeft()\
  621. contextl = paintutils.loadImage(\"System/Pictures/Menus/ContexLeft.pic\")\
  622. paintutils.drawImage(contextl,43,y)\
  623. end\
  624. --\
  625. function context_call()\
  626. local math = 45\
  627. local xx = x\
  628. if y ~= 1 and x ~= 45 or x ~= 46 or x ~= 47 or x ~= 48 or x ~= 49 or x ~= 50 or x ~= 51 then\
  629. if button == 2 and contextdraw == 0 then\
  630. context_draw()\
  631. contextdraw = 1\
  632. end\
  633. elseif xx > math then\
  634. context_drawLeft()\
  635. contextdraw = 1\
  636. end\
  637. end\
  638. ----\
  639. --\
  640. function folderin_draw()\
  641. folderin = paintutils.loadImage(\"System/Pictures/FolderIn/oldf.plw\")\
  642. paintutils.drawImage(folderin,1,2)\
  643. end\
  644. --\
  645. ----\
  646. function paint_app()\
  647. if button == 1 then\
  648. if x == 11 and y == 3 or x == 12 and y == 3 or x == 13 and y == 3 or x == 14 and y == 3 or x == 15 and y == 3 or x == 16 and y == 3 or x == 11 and y == 4 or x == 12 and y == 4 or x == 14 and y == 4 or x == 14 and y == 4 or x == 15 and y == 4 or x == 16 and y == 4 or x == 11 and y == 5 or x == 12 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 16 and y == 5 or x == 11 and y == 6 or x == 12 and y == 6 or x == 16 and y == 6 or x == 16 and y == 6 or x == 16 then\
  649. selC = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
  650. paintutils.drawImage(selC,10,3)\
  651. paintutils.drawImage(paint,11,3)\
  652. term.setBackgroundColor(colors.blue)\
  653. term.setTextColor(colors.white)\
  654. term.setCursorPos(11,8)\
  655. term.write(\" Paint\")\
  656. sleep(0.155)\
  657. shell.run(\"System/Programms/paint.cc\")\
  658. end\
  659. end\
  660. end\
  661. -----\
  662. function folder_system()\
  663. if menuHide == 0 and folderHide == 0 and button == 1 and event == \"mouse_click\" then\
  664.  if x == 3 and y == 3 or x == 4 and y == 3 or x == 5 and y == 3 or x == 3 and y == 4 or x == 4 and y == 4 or x == 5 and y == 4 or x == 6 and y == 4 or x == 7 and y == 4 or x == 8 and y == 4 or x == 3 and y == 5 or x == 4 and y == 5 or x == 5 and y == 5 or x == 6 and y == 5 or x == 7 and y == 5 or x == 8 and y == 5 or x == 3 and y == 6 or x == 6 and y == 6 or x == 7 and y == 6 or x == 8 and y == 6 then\
  665.  local select = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
  666.  folderHide = 1\
  667.  paintutils.drawImage(select,2,3)\
  668.  paintutils.drawImage(folder,3,3)\
  669.  term.setBackgroundColor(colors.blue)\
  670.  term.setTextColor(colors.white)\
  671.  term.setCursorPos(3,8)\
  672.  term.write(\"System\")\
  673.  sleep(0.154)\
  674.  folderin_draw()\
  675.  term.setCursorPos(21,3)\
  676.  term.setBackgroundColor(colors.gray)\
  677.  term.write(\"System/\")\
  678.  term.setCursorPos(6,3)\
  679.  term.setTextColor(colors.gray)\
  680.  term.setBackgroundColor(colors.lightGray)\
  681.  term.write(\"<>\")\
  682.  term.setCursorPos(1,2)\
  683.  term.setBackgroundColor(colors.gray)\
  684.  term.setTextColor(colors.red)\
  685.  term.write(\"0\")\
  686.  term.setCursorPos(2,2)\
  687.  term.setTextColor(colors.yellow)\
  688.  term.write(\"0\")\
  689.  term.setCursorPos(3,2)\
  690.  term.setTextColor(colors.green)\
  691.  term.write(\"0\")\
  692.  -----folders----infolder--\
  693.  paintutils.drawImage(folder,10,6)\
  694.  paintutils.drawImage(folder,18,6)\
  695.  paintutils.drawImage(folder,26,6)\
  696.  term.setCursorPos(10,11)\
  697.  term.setTextColor(colors.black)\
  698.  term.setBackgroundColor(colors.white)\
  699.  term.write(\" Main\")\
  700.  term.setCursorPos(18,11)\
  701.  term.write(\"  OS\")\
  702.  term.setCursorPos(26,11)\
  703.  term.write(\"Pictures\")\
  704.  \
  705.  \
  706.  --------------------------\
  707.  end\
  708. \
  709. \
  710. end\
  711. \
  712. \
  713. \
  714. end\
  715. --\
  716. --\
  717. function IconBackSys()\
  718. if folderHide == 1 and button == 1 then\
  719.  if menuHide == 0 and x == 6 and y == 3 then\
  720.  folderHide = 0\
  721.  menuHide = 0\
  722.  paintutils.drawPixel(6,3,colors.blue)\
  723.  term.setCursorPos(6,3)\
  724.  term.setTextColor(colors.white)\
  725.  term.setBackgroundColor(colors.blue)\
  726.  term.write(\"<\")\
  727.  sleep(0.165)\
  728.  term.setBackgroundColor(SelectBc[1])\
  729.  gui()\
  730.  fileName()\
  731.  desktop()\
  732.  time()\
  733.  osmenu()\
  734.  end\
  735. end\
  736. end\
  737. --\
  738. --\
  739. function fold_sys_close()\
  740. if folderHide == 1 and button == 1 then\
  741.  if x == 1 and y == 2 then\
  742.  folderHide = 0\
  743.  menuHide = 0\
  744.  term.setBackgroundColor(SelectBc[1])\
  745.  gui()\
  746.  fileName()\
  747.  desktop()\
  748.  time()\
  749.  osmenu()\
  750.  folderHide = 0\
  751.  end\
  752. end\
  753. end\
  754. --\
  755. --\
  756. function osCol()\
  757. if menuHide == 0 then\
  758. term.setTextColor(colors.white)\
  759. term.setCursorPos(1,1)\
  760. term.setBackgroundColor(colors.cyan)\
  761. term.write(\"OS\")\
  762. end\
  763. end\
  764. --\
  765. --------------disk-----------\
  766. function diske()\
  767. local winDisk = 0\
  768. local event,side = os.pullEvent()\
  769. if event == \"disk\" then\
  770. pidor = paintutils.loadImage(\"System/Pictures/Disk/Enter\")\
  771. paintutils.drawImage(pidor,20,3)\
  772. winDisk = 1\
  773.  \
  774. ---temoak\
  775. ----new---\
  776. ----pidor--kupec\
  777. ---Civilization----dla----pidorov\
  778. end\
  779. end\
  780. function diskWinClose()\
  781. if winDisk == 1 and button == 1 and x == 20 and y == 3 then\
  782. winDisk = 0\
  783. term.setBackgroundColor(SelectBc[1])\
  784. gui()\
  785. desktop()\
  786. fileName()\
  787. time()\
  788. osmenu()\
  789. end\
  790. end\
  791. -----------------------------\
  792. function clscr()\
  793. gui()\
  794. fileName()\
  795. desktop()\
  796. time()\
  797. term.setCursorPos(1,1)\
  798. end\
  799. clscr()\
  800. function whileRun()\
  801. OSDRAW()\
  802. closebar()\
  803. exit()\
  804. folder_system()\
  805. fold_sys_close()\
  806. IconBackSys()\
  807. osCol()\
  808. paint_app()\
  809. context_call()\
  810. context_touch()\
  811. diske()\
  812. diskWinClose()\
  813. end\
  814. function timeRun()\
  815. while 1 do\
  816. time()\
  817. sleep(1)\
  818. paintutils.drawLine(44,1,51,1,colors.blue)\
  819. end\
  820. end\
  821. while OSWHILE do\
  822. whileRun()\
  823. end",
  824.     OSEL_US = "os.loadAPI(\"GUI\")\
  825. ---StartOs\
  826. term.clear()\
  827. os.pullEvent = os.pullEventRaw\
  828. ----\
  829. log = fs.open(\"System/Config/clog.cfg\",\"r\")\
  830. logr = log.readLine()\
  831. log.close()\
  832. pas = fs.open(\"System/Config/pas.cfg\",\"r\")\
  833. pasr = pas.readLine()\
  834. pas.close()\
  835. ---login--\
  836. function login()\
  837. term.clear()\
  838. local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
  839. paintutils.drawImage(load,1,1)\
  840. term.setTextColor(colors.black)\
  841. paintutils.drawFilledBox(15,5,37,8,colors.lightGray)\
  842. paintutils.drawFilledBox(16,6,36,7,colors.white)\
  843. term.setCursorPos(16,6)\
  844. local wileX = true\
  845. function passwordIn()\
  846. paintutils.drawLine(16,7,33,7,colors.white)\
  847. term.setCursorPos(16,6)\
  848. term.write(\"                     \")\
  849. term.setCursorPos(16,6)\
  850. term.write(\" Password:\")\
  851. local password = read(\"*\")\
  852. if password == pasr then\
  853. wileX = false\
  854. welcome()\
  855. else\
  856. term.setTextColor(colors.red)\
  857. paintutils.drawLine(16,7,33,7,colors.white)\
  858. term.setCursorPos(16,7)\
  859. term.write(\" Wrong password!\")\
  860. term.setCursorPos(23,6)\
  861. term.setTextColor(colors.black)\
  862. passwordIn()\
  863. end\
  864. ------\
  865. end\
  866. --\
  867. --\
  868. --\
  869. function inLog()\
  870. term.setTextColor(colors.black)\
  871. paintutils.drawLine(16,6,33,6,colors.white)\
  872. term.setCursorPos(16,6)\
  873. term.write(\" Login:\")\
  874. if read() == logr then\
  875. passwordIn()\
  876. else\
  877. paintutils.drawLine(16,7,33,7,colors.white)\
  878. term.setCursorPos(16,7)\
  879. term.setTextColor(colors.red)\
  880. term.write(\" Wrong login!\")\
  881. term.setTextColor(colors.black)\
  882. end\
  883. end\
  884. ----\
  885. --\
  886. --\
  887. function ENTER()\
  888. inLog()\
  889. end\
  890. while wileX do\
  891. ENTER()\
  892. end\
  893. end\
  894. ---\
  895. ---welcome--\
  896. function welcome()\
  897. term.clear()\
  898. local load = paintutils.loadImage(\"System/Pictures/Icons/welcus.plc\")\
  899. paintutils.drawImage(load,1,1)\
  900. term.setTextColor(colors.red)\
  901. local i = 0\
  902. paintutils.drawPixel(23,9,colors.orange)\
  903. term.setCursorPos(23,9)\
  904. term.write(\"Welcome \")\
  905. term.setCursorPos(24,9)\
  906. term.setBackgroundColor(colors.gray)\
  907. term.write(\"e\")\
  908. term.setCursorPos(25,9)\
  909. term.setBackgroundColor(colors.cyan)\
  910. term.write(\"l\")\
  911. term.setCursorPos(28,9)\
  912. term.setBackgroundColor(colors.gray)\
  913. term.write(\"m\")\
  914. term.setCursorPos(29,9)\
  915. term.setBackgroundColor(colors.cyan)\
  916. term.write(\"e\")\
  917. sleep(0.2)\
  918. paintutils.drawPixel(20,11,colors.blue)\
  919. sleep(0.5)\
  920. paintutils.drawLine(21,11,26,11,colors.blue)\
  921. sleep(0.3)\
  922. paintutils.drawLine(27,11,30,11,colors.blue)\
  923. sleep(0.4)\
  924. paintutils.drawLine(30,11,32,11,colors.blue)\
  925. sleep(1)\
  926. ---\
  927. end\
  928. ---\
  929. function loadSys()\
  930. local load = paintutils.loadImage(\"System/Pictures/Icons/stus.plc\")\
  931. paintutils.drawImage(load,1,1)\
  932. paintutils.drawLine(20,11,32,11,colors.white)\
  933. term.setCursorPos(22,9)\
  934. term.setTextColor(colors.orange)\
  935. term.setBackgroundColor(colors.cyan)\
  936. term.write(\"Lion OS X\")\
  937. term.setTextColor(colors.black)\
  938. term.setCursorPos(40,19)\
  939. term.write(\"ZfelfProg CC\")\
  940. term.setCursorPos(1,19)\
  941. term.write(\"AlexZfelf CC\")\
  942. sleep(1)\
  943. paintutils.drawPixel(20,11,colors.blue)\
  944. sleep(1.2)\
  945. paintutils.drawLine(21,11,24,11,colors.blue)\
  946. sleep(1,3)\
  947. paintutils.drawLine(25,11,30,11,colors.blue)\
  948. sleep(1)\
  949. paintutils.drawLine(30,11,32,11,colors.blue)\
  950. sleep(1)\
  951. login()\
  952. end\
  953. ---\
  954. loadSys()\
  955. \
  956. -------\
  957. ---\
  958. ---background---color---as\
  959. \
  960. ---\
  961. -------\
  962. term.setBackgroundColor(colors.lightBlue)\
  963. term.clear()\
  964. term.setCursorPos(1,1)\
  965. -----\
  966. file = fs.open(\"color\",\"r\")\
  967. linec = file.readLine(textutils.serialise())\
  968. linecc = colors.lightBlue\
  969. if linec == \"colors.lightBlue\" or \"colors.green\" or \"colors.green\" then\
  970.  if linec ~= nil then\
  971.  linecc = linec\
  972.  elseif linec == nil then\
  973.  linecc = colors.lightBlue\
  974.  end\
  975. end\
  976. SelectBc = {\
  977. [1] = colors.lightBlue\
  978. }\
  979. file.close()\
  980. ------osgui-----\
  981. function gui()\
  982. term.clear()\
  983. term.setBackgroundColor(SelectBc[1])\
  984. term.setCursorPos(1,1)\
  985. --------upbar----\
  986. function upbar()\
  987. paintutils.drawLine(1,1,44,1,colors.lightGray)\
  988. end\
  989. upbar()\
  990. ----iconW---\
  991. paintutils.drawPixel(1,1,colors.lightGray)\
  992. paintutils.drawPixel(2,1,colors.lightGray)\
  993. term.setCursorPos(1,1)\
  994. term.setTextColor(colors.white)\
  995. term.setBackgroundColor(colors.cyan)\
  996. term.write(\"OS\")\
  997. -----clock----\
  998. paintutils.drawLine(45,1,51,1,colors.blue)\
  999. end\
  1000. ------timeclock----\
  1001. function time()\
  1002. local time = os.time()\
  1003. local ftime = textutils.formatTime(time,false)\
  1004. term.setTextColor(colors.white)\
  1005. term.setBackgroundColor(colors.blue)\
  1006. term.setCursorPos(44,1)\
  1007. term.write(ftime)\
  1008. end\
  1009. function desktop()\
  1010. folder = paintutils.loadImage(\"System/Pictures/Icons/folder.pic\")\
  1011. program = paintutils.loadImage(\"System/Pictures/Icons/program.pic\")\
  1012. file = paintutils.loadImage(\"System/Pictures/Icons/file.pic\")\
  1013. paint = paintutils.loadImage(\"System/Pictures/Icons/paint.exe\")\
  1014. paintutils.drawImage(folder,3,3)  \
  1015. paintutils.drawImage(paint,11,3)\
  1016. end\
  1017. function fileName()\
  1018. naziF = 0\
  1019. if naziF == 0 then\
  1020. term.setCursorPos(3,8)\
  1021. term.setTextColor(colors.black)\
  1022. term.setBackgroundColor(SelectBc[1])\
  1023. term.write(\"System\")\
  1024. term.setCursorPos(11,8)\
  1025. term.write(\" Paint\")\
  1026. end\
  1027. if naziF == 1 then\
  1028. term.setCursorPos(3,8)\
  1029. term.setTextColor(colors.black)\
  1030. term.setBackgroundColor(SelectBc[1])\
  1031. term.write(\"System\")\
  1032. term.setCursorPos(11,8)\
  1033. term.setTextColor(colors.black)\
  1034. term.setBackgroundColor(colors.red)\
  1035. term.write(\"Pa\")\
  1036. term.setBackgroundColor(colors.white)\
  1037. term.write(\"int\")\
  1038. end\
  1039. end\
  1040. function select()\
  1041. sel = paintutils.loadImage(\"select.pic\")\
  1042. end\
  1043. menuHide = 0\
  1044. folderHide = 0\
  1045. function osmenu()\
  1046. menu = paintutils.loadImage(\"System/Pictures/Icons/osMenu.cpic\")\
  1047. event,button,x,y = os.pullEvent()\
  1048. if event == \"mouse_click\" then\
  1049.  if menuHide == 0 and folderHide == 0 and button == 1 and x == 1 and y == 1 or menuHide == 0 and button == 1 and x == 2 and  y == 1 then\
  1050.    paintutils.drawImage(menu,2,2)\
  1051.    term.setCursorPos(1,1)\
  1052.    term.setBackgroundColor(colors.blue)\
  1053.    term.write(\"OS\")\
  1054.    sleep(0.140)\
  1055.    ------button---options----\
  1056.    term.setCursorPos(3,8)\
  1057.    term.setTextColor(colors.black)\
  1058.    term.setBackgroundColor(colors.white)\
  1059.    term.write(\"Options\")\
  1060.    paintutils.drawPixel(10,8,colors.lightGray)\
  1061.    term.setCursorPos(10,8)\
  1062.    term.write(\">\")\
  1063.    ------button---shutdown---\
  1064.    term.setCursorPos(3,9)\
  1065.    term.setBackgroundColor(colors.white)\
  1066.    term.write(\"Reboot\")\
  1067.    paintutils.drawPixel(10,9,colors.lightGray)\
  1068.    term.setCursorPos(10,9)\
  1069.    term.write(\">\")\
  1070.    ------button---folder----\
  1071.    term.setCursorPos(3,7)\
  1072.    term.setBackgroundColor(colors.white)\
  1073.    term.write(\"My CC\")\
  1074.    paintutils.drawPixel(10,7,colors.lightGray)\
  1075.    term.setCursorPos(10,7)\
  1076.    term.write(\">\")\
  1077.    ------button---exit-------\
  1078.    term.setCursorPos(3,6)\
  1079.    term.setBackgroundColor(colors.white)\
  1080.    term.write(\"Shutdown\")\
  1081.    paintutils.drawPixel(10,6,colors.lightGray)\
  1082.    term.setCursorPos(10,6)\
  1083.    term.write(\">\")\
  1084.    ------button---closebar---\
  1085.    term.setCursorPos(3,2)\
  1086.    term.setBackgroundColor(colors.white)\
  1087.    term.write(\"Hide\")\
  1088.    paintutils.drawPixel(10,2,colors.yellow)\
  1089.    term.setCursorPos(10,2)\
  1090.    term.write(\">\")\
  1091.    term.setCursorPos(2,3)\
  1092.    term.setTextColor(colors.lightGray)\
  1093.    term.setBackgroundColor(colors.white)\
  1094.    term.write(\"---------\")\
  1095.    ------button---\
  1096.    menuHide = 1\
  1097.  end\
  1098. end\
  1099. end\
  1100. winhide = 0\
  1101. function mSettings()\
  1102. if menuHide == 1 then\
  1103.  if button == 1 and x == 10 and y == 8 then\
  1104.  menuHide = 0\
  1105.  folderHide = 0\
  1106.  paintutils.drawPixel(10,8,colors.blue)\
  1107.  term.setTextColor(colors.white)\
  1108.  term.setCursorPos(10,8)\
  1109.  term.write(\">\")\
  1110.  sleep(0.143)\
  1111.  term.setBackgroundColor(SelectBc[1])\
  1112.  gui()\
  1113.  desktop()\
  1114.  time()\
  1115.  fileName()\
  1116.  function winOP()\
  1117.  window = paintutils.loadImage(\"System/Pictures/Win/win.plw\")\
  1118.  paintutils.drawImage(window,7,3)\
  1119.  -------textin---win--\
  1120.  term.setCursorPos(8,5)\
  1121.  term.setBackgroundColor(colors.white)\
  1122.  term.setTextColor(colors.black)\
  1123.  term.write(\" Background color: \")\
  1124.  paintutils.drawPixel(27,5,colors.green)\
  1125.  paintutils.drawPixel(28,5,colors.lightBlue)\
  1126.  paintutils.drawPixel(29,5,colors.red)\
  1127.  paintutils.drawPixel(30,5,colors.pink)\
  1128.  term.setCursorPos(8,7)\
  1129.  term.setBackgroundColor(colors.white)\
  1130.  term.write(\" Selected: \")\
  1131.  paintutils.drawPixel(19,7,SelectBc[1])\
  1132.  term.setCursorPos(8,9)\
  1133.  term.setBackgroundColor(colors.white)\
  1134.  term.write(\" Save & Exit\")\
  1135.  term.setCursorPos(21,9)\
  1136.  term.write(\">\")\
  1137.  end\
  1138.  winOP()\
  1139.  menuHide = 0\
  1140.  \
  1141.  \
  1142.  \
  1143.  \
  1144.  -----endtetx----\
  1145.  winhide = 1\
  1146. elseif folderHide == 1 then\
  1147.  \
  1148.  end\
  1149. end\
  1150. end\
  1151. \
  1152. function txwin()\
  1153. if menuHide == 0 and folderHide == 0 and event == \"mouse_click\" then\
  1154. if winhide == 1 then\
  1155. if button == 1 and x == 7 and y == 3 then\
  1156. menuHide = 0\
  1157. winhide = 0\
  1158. time()\
  1159. term.setBackgroundColor(SelectBc[1])\
  1160. gui()\
  1161. desktop()\
  1162. fileName()\
  1163. osmenu()\
  1164. end\
  1165. end\
  1166. end\
  1167. end\
  1168. function shutdown()\
  1169. if menuHide == 1 then\
  1170.  if button == 1 and x == 10 and y == 9 then\
  1171.   paintutils.drawPixel(10,9,colors.red)\
  1172.   term.setTextColor(colors.white)\
  1173.   term.setCursorPos(10,9)\
  1174.   term.write(\">\")\
  1175.   sleep(0.144)\
  1176.     os.reboot()\
  1177.   end\
  1178. end\
  1179. function func()\
  1180. if menuHide == 1 then\
  1181.  if button == 1 and x == 10 and y == 7 then\
  1182.  paintutils.drawPixel(10,7,colors.blue)\
  1183.  term.setTextColor(colors.white)\
  1184.  term.setCursorPos(10,7)\
  1185.  term.write(\">\")\
  1186.  end\
  1187. \
  1188. end\
  1189. \
  1190. end\
  1191. \
  1192. end\
  1193. function OSDRAW()\
  1194. mSettings()\
  1195. osmenu()\
  1196. txwin()\
  1197. pickcolor()\
  1198. shutdown()\
  1199. func()\
  1200. \
  1201. end\
  1202. OSWHILE = true\
  1203. function exit()\
  1204. if menuHide == 1 and button == 1 and x == 10 and y == 6 then\
  1205. paintutils.drawPixel(10,6,colors.blue)\
  1206. term.setCursorPos(10,6)\
  1207. term.setTextColor(colors.white)\
  1208. term.write(\">\")\
  1209. sleep(0.143)\
  1210. os.shutdown()\
  1211. end\
  1212. end\
  1213. ----\
  1214. function closebar()\
  1215. if menuHide == 1 then\
  1216. if folderHide == 0 and menuHide == 1 and button == 1 and x == 10 and y == 2 then\
  1217. paintutils.drawPixel(10,2,colors.blue)\
  1218. term.setCursorPos(10,2)\
  1219. term.setTextColor(colors.white)\
  1220. term.write(\">\")\
  1221. sleep(0.144)\
  1222. term.setCursorPos(1,1)\
  1223. term.setBackgroundColor(colors.cyan)\
  1224. term.write(\"OS\")\
  1225. term.setBackgroundColor(SelectBc[1])\
  1226. menuHide = 0\
  1227. gui()\
  1228. desktop()\
  1229. fileName()\
  1230. time()\
  1231. osmenu()\
  1232. elseif folderHide == 1 and button == 1 and x == 10 and y == 2 then\
  1233. filD = paintutils.loadImage(\"System/Pictures/FolderIn/menuHide.pic\")\
  1234. paintutils.drawImage(filD,2,2)\
  1235. menuHide = 0\
  1236. term.setCursorPos(6,3)\
  1237. term.setBackgroundColor(colors.lightGray)\
  1238. term.setTextColor(colors.black)\
  1239. term.write(\"<>\")\
  1240. term.setBackgroundColor(colors.gray)\
  1241. term.setCursorPos(2,2)\
  1242. term.setTextColor(colors.yellow)\
  1243. term.write(\"0\")\
  1244. term.setCursorPos(3,2)\
  1245. term.setTextColor(colors.green)\
  1246. term.write(\"0\")\
  1247. elseif winhide == 1 and button == 1 and x == 10 and y == 2 then\
  1248. menuHide = 0\
  1249. term.setBackgroundColor(SelectBc[1])\
  1250. gui()\
  1251. desktop()\
  1252. fileName()\
  1253. time()\
  1254. osmenu()\
  1255. paintutils.drawImage(window,7,3)\
  1256. winOP()\
  1257. end\
  1258. end\
  1259. end\
  1260. \
  1261. \
  1262. \
  1263. ----func---color----pick\
  1264. function pickcolor()\
  1265. local file = fs.open(\"color\",\"w\")\
  1266. if winhide == 1 then\
  1267.  if button == 1 and x == 27 and y == 5 then\
  1268.  SelectBc[1] = colors.green\
  1269.  paintutils.drawPixel(19,7,SelectBc[1])\
  1270.  file.write(\"colors.green\")\
  1271.  elseif x == 28 and y == 5 then\
  1272.  SelectBc[1] = colors.lightBlue\
  1273.  paintutils.drawPixel(19,7,SelectBc[1])\
  1274.  file.write(\"colors.lightBlue\")\
  1275.  elseif x == 29 and y == 5 then\
  1276.  SelectBc[1] = colors.red\
  1277.  naziF = 1\
  1278.  paintutils.drawPixel(19,7,SelectBc[1])\
  1279.  nazi = paintutils.loadImage(\"System/wallpapers/grammarnazi.fuck\")\
  1280.  paintutils.drawImage(nazi,1,2)\
  1281.  fileName()\
  1282.  desktop()\
  1283.  file.write(\"colors.red\")\
  1284.  elseif x == 30 and y == 5 then\
  1285.  SelectBc[1] = colors.pink\
  1286.  paintutils.drawPixel(19,7,SelectBc[1])\
  1287.  file.write(\"colors.pink\")\
  1288.  elseif x == 21 and y == 9 then\
  1289.  file.close()\
  1290.  term.setBackgroundColor(SelectBc[1])\
  1291.  gui()\
  1292.  fileName()\
  1293.  desktop()\
  1294.  time()\
  1295.  end\
  1296. end\
  1297. end\
  1298. ----\
  1299. --\
  1300. contextdraw = 0\
  1301. function context_draw()\
  1302. contextr = paintutils.loadImage(\"System/Pictures/Menus/Context.pic\")\
  1303. paintutils.drawImage(contextr,x,y)\
  1304. term.setCursorPos(x+1,y)\
  1305. term.setBackgroundColor(colors.white)\
  1306. term.setTextColor(colors.black)\
  1307. term.write(\"Open\")\
  1308. term.setCursorPos(x+7,y)\
  1309. term.setBackgroundColor(colors.yellow)\
  1310. term.write(\">\")\
  1311. term.setCursorPos(x,y+1)\
  1312. term.setTextColor(colors.lightGray)\
  1313. term.setBackgroundColor(colors.white)\
  1314. term.write(\"--------\")\
  1315. term.setCursorPos(x+1,y+6)\
  1316. term.setTextColor(colors.black)\
  1317. term.write(\"Info\")\
  1318. term.setCursorPos(x+7,y+6)\
  1319. term.setBackgroundColor(colors.yellow)\
  1320. term.write(\">\")\
  1321. contextdraw = 1\
  1322. end\
  1323. ---context-----touch---\
  1324. function context_touch()\
  1325. if contextdraw == 1 and folderHide == 0 and y ~= 1 then\
  1326.  if button == 1 and folderHide == 0 then\
  1327.  contextdraw = 0\
  1328.  term.setBackgroundColor(SelectBc[1])\
  1329.  gui()\
  1330.  desktop()\
  1331.  fileName()\
  1332.  time()\
  1333.  menuHide = 0\
  1334.  end\
  1335. end\
  1336. end\
  1337. ----\
  1338. function context_drawLeft()\
  1339. contextl = paintutils.loadImage(\"System/Pictures/Menus/ContexLeft.pic\")\
  1340. paintutils.drawImage(contextl,43,y)\
  1341. end\
  1342. --\
  1343. function context_call()\
  1344. local math = 45\
  1345. local xx = x\
  1346. if y ~= 1 and x ~= 45 or x ~= 46 or x ~= 47 or x ~= 48 or x ~= 49 or x ~= 50 or x ~= 51 then\
  1347. if button == 2 and contextdraw == 0 then\
  1348. context_draw()\
  1349. contextdraw = 1\
  1350. end\
  1351. elseif xx > math then\
  1352. context_drawLeft()\
  1353. contextdraw = 1\
  1354. end\
  1355. end\
  1356. ----\
  1357. --\
  1358. function folderin_draw()\
  1359. folderin = paintutils.loadImage(\"System/Pictures/FolderIn/oldf.plw\")\
  1360. paintutils.drawImage(folderin,1,2)\
  1361. end\
  1362. --\
  1363. ----\
  1364. function paint_app()\
  1365. if button == 1 then\
  1366. if x == 11 and y == 3 or x == 12 and y == 3 or x == 13 and y == 3 or x == 14 and y == 3 or x == 15 and y == 3 or x == 16 and y == 3 or x == 11 and y == 4 or x == 12 and y == 4 or x == 14 and y == 4 or x == 14 and y == 4 or x == 15 and y == 4 or x == 16 and y == 4 or x == 11 and y == 5 or x == 12 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 15 and y == 5 or x == 16 and y == 5 or x == 11 and y == 6 or x == 12 and y == 6 or x == 16 and y == 6 or x == 16 and y == 6 or x == 16 then\
  1367. selC = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
  1368. paintutils.drawImage(selC,10,3)\
  1369. paintutils.drawImage(paint,11,3)\
  1370. term.setBackgroundColor(colors.blue)\
  1371. term.setTextColor(colors.white)\
  1372. term.setCursorPos(11,8)\
  1373. term.write(\" Paint\")\
  1374. sleep(0.155)\
  1375. shell.run(\"System/Programms/paint.cc\")\
  1376. end\
  1377. end\
  1378. end\
  1379. -----\
  1380. function folder_system()\
  1381. if menuHide == 0 and folderHide == 0 and button == 1 and event == \"mouse_click\" then\
  1382.  if x == 3 and y == 3 or x == 4 and y == 3 or x == 5 and y == 3 or x == 3 and y == 4 or x == 4 and y == 4 or x == 5 and y == 4 or x == 6 and y == 4 or x == 7 and y == 4 or x == 8 and y == 4 or x == 3 and y == 5 or x == 4 and y == 5 or x == 5 and y == 5 or x == 6 and y == 5 or x == 7 and y == 5 or x == 8 and y == 5 or x == 3 and y == 6 or x == 6 and y == 6 or x == 7 and y == 6 or x == 8 and y == 6 then\
  1383.  local select = paintutils.loadImage(\"System/Pictures/Icons/select.pic\")\
  1384.  folderHide = 1\
  1385.  paintutils.drawImage(select,2,3)\
  1386.  paintutils.drawImage(folder,3,3)\
  1387.  term.setBackgroundColor(colors.blue)\
  1388.  term.setTextColor(colors.white)\
  1389.  term.setCursorPos(3,8)\
  1390.  term.write(\"System\")\
  1391.  sleep(0.154)\
  1392.  folderin_draw()\
  1393.  term.setCursorPos(21,3)\
  1394.  term.setBackgroundColor(colors.gray)\
  1395.  term.write(\"System/\")\
  1396.  term.setCursorPos(6,3)\
  1397.  term.setTextColor(colors.gray)\
  1398.  term.setBackgroundColor(colors.lightGray)\
  1399.  term.write(\"<>\")\
  1400.  term.setCursorPos(1,2)\
  1401.  term.setBackgroundColor(colors.gray)\
  1402.  term.setTextColor(colors.red)\
  1403.  term.write(\"0\")\
  1404.  term.setCursorPos(2,2)\
  1405.  term.setTextColor(colors.yellow)\
  1406.  term.write(\"0\")\
  1407.  term.setCursorPos(3,2)\
  1408.  term.setTextColor(colors.green)\
  1409.  term.write(\"0\")\
  1410.  -----folders----infolder--\
  1411.  paintutils.drawImage(folder,10,6)\
  1412.  paintutils.drawImage(folder,18,6)\
  1413.  paintutils.drawImage(folder,26,6)\
  1414.  term.setCursorPos(10,11)\
  1415.  term.setTextColor(colors.black)\
  1416.  term.setBackgroundColor(colors.white)\
  1417.  term.write(\" Main\")\
  1418.  term.setCursorPos(18,11)\
  1419.  term.write(\"  OS\")\
  1420.  term.setCursorPos(26,11)\
  1421.  term.write(\"Pictures\")\
  1422.  \
  1423.  \
  1424.  --------------------------\
  1425.  end\
  1426. \
  1427. \
  1428. end\
  1429. \
  1430. \
  1431. \
  1432. end\
  1433. --\
  1434. --\
  1435. function IconBackSys()\
  1436. if folderHide == 1 and button == 1 then\
  1437.  if menuHide == 0 and x == 6 and y == 3 then\
  1438.  folderHide = 0\
  1439.  menuHide = 0\
  1440.  paintutils.drawPixel(6,3,colors.blue)\
  1441.  term.setCursorPos(6,3)\
  1442.  term.setTextColor(colors.white)\
  1443.  term.setBackgroundColor(colors.blue)\
  1444.  term.write(\"<\")\
  1445.  sleep(0.165)\
  1446.  term.setBackgroundColor(SelectBc[1])\
  1447.  gui()\
  1448.  fileName()\
  1449.  desktop()\
  1450.  time()\
  1451.  osmenu()\
  1452.  end\
  1453. end\
  1454. end\
  1455. --\
  1456. --\
  1457. function fold_sys_close()\
  1458. if folderHide == 1 and button == 1 then\
  1459.  if x == 1 and y == 2 then\
  1460.  folderHide = 0\
  1461.  menuHide = 0\
  1462.  term.setBackgroundColor(SelectBc[1])\
  1463.  gui()\
  1464.  fileName()\
  1465.  desktop()\
  1466.  time()\
  1467.  osmenu()\
  1468.  folderHide = 0\
  1469.  end\
  1470. end\
  1471. end\
  1472. --\
  1473. --\
  1474. function osCol()\
  1475. if menuHide == 0 then\
  1476. term.setTextColor(colors.white)\
  1477. term.setCursorPos(1,1)\
  1478. term.setBackgroundColor(colors.cyan)\
  1479. term.write(\"OS\")\
  1480. end\
  1481. end\
  1482. --\
  1483. --------------disk-----------\
  1484. function diske()\
  1485. local winDisk = 0\
  1486. local event,side = os.pullEvent()\
  1487. if event == \"disk\" then\
  1488. pidor = paintutils.loadImage(\"System/Pictures/Disk/Enter\")\
  1489. paintutils.drawImage(pidor,20,3)\
  1490. winDisk = 1\
  1491.  \
  1492. ---temoak\
  1493. ----new---\
  1494. ----pidor--kupec\
  1495. ---Civilization----dla----pidorov\
  1496. end\
  1497. end\
  1498. function diskWinClose()\
  1499. if winDisk == 1 and button == 1 and x == 20 and y == 3 then\
  1500. winDisk = 0\
  1501. term.setBackgroundColor(SelectBc[1])\
  1502. gui()\
  1503. desktop()\
  1504. fileName()\
  1505. time()\
  1506. osmenu()\
  1507. end\
  1508. end\
  1509. -----------------------------\
  1510. function clscr()\
  1511. gui()\
  1512. fileName()\
  1513. desktop()\
  1514. time()\
  1515. term.setCursorPos(1,1)\
  1516. end\
  1517. clscr()\
  1518. function whileRun()\
  1519. OSDRAW()\
  1520. closebar()\
  1521. exit()\
  1522. folder_system()\
  1523. fold_sys_close()\
  1524. IconBackSys()\
  1525. osCol()\
  1526. paint_app()\
  1527. context_call()\
  1528. context_touch()\
  1529. diske()\
  1530. diskWinClose()\
  1531. end\
  1532. function timeRun()\
  1533. while 1 do\
  1534. time()\
  1535. sleep(1)\
  1536. paintutils.drawLine(44,1,51,1,colors.blue)\
  1537. end\
  1538. end\
  1539. while OSWHILE do\
  1540. whileRun()\
  1541. end",
  1542.   },
  1543.   Programms = {
  1544.     [ "Paint.cc" ] = "os.pullEvent = os.pullEventRaw\
  1545. local xSize,ySize = term.getSize()\
  1546. local colorPIX = colors.white\
  1547. local Eraser = {\
  1548. [1] = colors.white\
  1549. }\
  1550. ------\
  1551. local Pixels = {}\
  1552. for j=1,(ySize-1) do\
  1553. Pixels[j] = {}\
  1554.   for i=1,xSize do\
  1555.     Pixels[j][i] = colors.white\
  1556.   end\
  1557. end\
  1558. \
  1559. \
  1560. \
  1561. local function gui2()\
  1562. for j=1,#Pixels do\
  1563.    for i=1,#Pixels[j] do\
  1564.        if Pixels[j][i] ~= nil then\
  1565.        paintutils.drawPixel(i,j+1,colorPIX)\
  1566. end\
  1567.    end\
  1568.        end\
  1569.            end\
  1570. \
  1571. \
  1572. \
  1573. \
  1574. ------\
  1575. local SelectColor = {\
  1576. [1]=colors.black\
  1577. }\
  1578. term.clear()\
  1579. term.setCursorPos(xSize,1)\
  1580. term.setTextColor(colors.lightGray)\
  1581. print(\"X\")\
  1582. gui()\
  1583. local whileX = 1\
  1584. ------\
  1585. local t = 0\
  1586. local u = 0\
  1587. while t < xSize do\
  1588. t = t + 1\
  1589. u = u + 1\
  1590. paintutils.drawPixel(2,1,colors.black)\
  1591. paintutils.drawPixel(3,1,colors.red)\
  1592. paintutils.drawPixel(4,1,colors.green)\
  1593. paintutils.drawPixel(5,1,colors.blue)\
  1594. paintutils.drawPixel(6,1,colors.yellow)\
  1595. paintutils.drawPixel(7,1,colors.orange)\
  1596. paintutils.drawPixel(8,1,colors.magenta)\
  1597. paintutils.drawPixel(9,1,colors.lightBlue)\
  1598. paintutils.drawPixel(10,1,colors.lime)\
  1599. paintutils.drawPixel(11,1,colors.pink)\
  1600. paintutils.drawPixel(12,1,colors.gray)\
  1601. paintutils.drawPixel(13,1,colors.lightGray)\
  1602. paintutils.drawPixel(14,1,colors.cyan)\
  1603. paintutils.drawPixel(15,1,colors.purple)\
  1604. paintutils.drawPixel(16,1,colors.brown)\
  1605. paintutils.drawPixel(17,1,colors.white)\
  1606. paintutils.drawPixel(u,1,colors.gray)\
  1607. term.setCursorPos(30,1)\
  1608. term.setTextColor(colors.green)\
  1609. term.write(\"Made by ALZF\")\
  1610. term.setTextColor(colors.white)\
  1611. term.setCursorPos(1,1)\
  1612. term.write(\"[\")\
  1613. term.setCursorPos(21,1)\
  1614. term.setTextColor(colors.red)\
  1615. term.write(\"E\")\
  1616. term.setCursorPos(22,1)\
  1617. term.write(\"C\")\
  1618. term.setCursorPos(23,1)\
  1619. term.write(\"F\")\
  1620. term.setCursorPos(xSize,1)\
  1621. term.write(\"X\")\
  1622. term.setTextColor(colors.white)\
  1623. term.setCursorPos(24,1)\
  1624. term.write(\"#\")\
  1625. term.setCursorPos(26,1)\
  1626. term.write(\"[\")\
  1627. term.setCursorPos(28,1)\
  1628. term.write(\"]\")\
  1629. term.setCursorPos(18,1)\
  1630. term.write(\"]\")\
  1631. term.setCursorPos(20,1)\
  1632. term.write(\"#\")\
  1633. end\
  1634. while whileX == 1 do\
  1635. local event,button,x,y = os.pullEvent()\
  1636. if event == \"mouse_click\" or event == \"mouse_drag\" then\
  1637. if button == 1 and y > 1 then\
  1638. paintutils.drawPixel(x,y,SelectColor[1])\
  1639. elseif button == 1 and x == 3 and y == 1 then\
  1640. SelectColor[1] = colors.red\
  1641. colorPIX = colors.red\
  1642. elseif button == 1 and x == 2 and y == 1 then\
  1643. SelectColor[1] = colors.black\
  1644. colorPIX = colors.black\
  1645. elseif button == 1 and x == 4 and y == 1 then\
  1646. SelectColor[1] = colors.green\
  1647. colorPIX = colors.green\
  1648. elseif button == 1 and x == 5 and y == 1 then\
  1649. SelectColor[1] = colors.blue\
  1650. colorPIX = colors.blue\
  1651. elseif button == 1 and x == 6 and y == 1 then\
  1652. SelectColor[1] = colors.yellow\
  1653. colorPIX = colors.yellow\
  1654. elseif button == 1 and x == 7 and y == 1 then\
  1655. SelectColor[1] = colors.orange\
  1656. colorPIX = colors.orange\
  1657. elseif button == 1 and x == 8 and y == 1 then\
  1658. SelectColor[1] = colors.magenta\
  1659. colorPIX = colors.magenta\
  1660. elseif button == 1 and x == 9 and y == 1 then\
  1661. SelectColor[1] = colors.lightBlue\
  1662. colorPIX = colors.lightBlue\
  1663. elseif button == 1 and x == 10 and y == 1 then\
  1664. SelectColor[1] = colors.lime\
  1665. colorPIX = colors.lime\
  1666. elseif button == 1 and x == 11 and y == 1 then\
  1667. SelectColor[1] = colors.pink\
  1668. colorPIX = colors.pink\
  1669. elseif button == 1 and x == 12 and y == 1 then\
  1670. SelectColor[1] = colors.gray\
  1671. colorPIX = colors.gray\
  1672. elseif button == 1 and x == 13 and y == 1 then\
  1673. SelectColor[1] = colors.lightGray\
  1674. colorPIX = colors.lightGray\
  1675. elseif button == 1 and x == 14 and y == 1 then\
  1676. SelectColor[1] = colors.cyan\
  1677. colorPIX = colors.cyan\
  1678. elseif button == 1 and x == 15 and y == 1 then\
  1679. SelectColor[1] = colors.purple\
  1680. colorPIX = colors.purple\
  1681. elseif button == 1 and x == 16 and y == 1 then\
  1682. SelectColor[1] = colors.brown\
  1683. colorPIX = colors.brown\
  1684. elseif button == 1 and x == 17 and y == 1 then\
  1685. SelectColor[1] = colors.white\
  1686. colorPIX = colors.white\
  1687. elseif button == 1 and x == 21 and y == 1 then\
  1688. SelectColor[1] = Eraser[1]\
  1689. elseif button == 1 and x == 23 and y == 1 then\
  1690. Eraser[1] = colorPIX\
  1691. gui2()\
  1692. elseif button == 1 and x == 22 and y == 1 then\
  1693. colorPIX = colors.white\
  1694. gui2()\
  1695. elseif button == 1 and x == xSize and y == 1 then\
  1696. term.clear()\
  1697. whileX = 0\
  1698. ----\
  1699. gui2()\
  1700. if whileX == 0 then\
  1701. term.clear()\
  1702. term.setBackgroundColor(SelectBc[1])\
  1703. clscr()\
  1704. paintutils.drawLine(3,1,44,1,colors.lightGray)\
  1705. time()\
  1706. menuHide = 0\
  1707. end\
  1708. end\
  1709. end\
  1710. paintutils.drawPixel(27,1,SelectColor[1])\
  1711. if whileX == 0 then\
  1712. paintutils.drawPixel(27,1,colors.lightGray)\
  1713. menuHide = 0\
  1714. end\
  1715. end",
  1716.   },
  1717.   Pictures = {
  1718.     Icons = {
  1719.       [ "folderFile.pic" ] = "440\
  1720. 444444\
  1721. 444444\
  1722. 444444",
  1723.       [ "stus2.plc" ] = "777777777777777777777777777777777777777777777777777\
  1724. 777777777777777777777777777ff7777777777777777777777\
  1725. 77777777777777777777777777ff77777777777777777777777\
  1726. 7777777777777777777777777ff777777777777777777777777\
  1727. 777777777777777777777777777777777777777777777777777\
  1728. 777777777777777777777ffffffffff77777777777777777777\
  1729. 77777777777777777777fffffffffffff777777777777777777\
  1730. 7777777777777777777fffffffffffffff77777777777777777\
  1731. 777777777777777777ffffffffffffff7777777777777777777\
  1732. 77777777777777777fffffffffffff777777777777777777777\
  1733. 77777777777777777ffffffffffff7777777777777777777777\
  1734. 77777777777777777ffffffffffff7777777777777777777777\
  1735. 77777777777777777fffffffffffff777777777777777777777\
  1736. 777777777777777777ffffffffffffff7777777777777777777\
  1737. 7777777777777777777fffffffffffffff77777777777777777\
  1738. 77777777777777777777fffffffffffff777777777777777777\
  1739. 777777777777777777777ffffffffff77777777777777777777\
  1740. 777777777777777777777777777777777777777777777777777",
  1741.       [ "welcus.plc" ] = "999999999999999999999999999999999999999999999999999\
  1742. 999999999900009999999999999999999999999999999000009\
  1743. 999000000000000999999999999999999999999990000000000\
  1744. 999000001100001199111119999001199447999447000000000\
  1745. 999900001170000079117117011001170044794470000000000\
  1746. 999990001170001179117117011101170000447700000000000\
  1747. 999999001179991179117117911111170000447000000099900\
  1748. 999999991111791179117117911711170944794479999999999\
  1749. 999999991111791179111117911771179447999447999999999\
  1750. 999999999777799779997777977797779999999999999999999\
  1751. 999999999995559999909999999999999999999999999999999\
  1752. 999555999995559999999999999999999999999999999555999\
  1753. 999555999999c99999999dd99999999999ddddd999999555999\
  1754. 9999c99ddddddddddddddddddd9999999ddddddddddd99c9999\
  1755. ddddddddddddddddddddddddddddddddddddddddddddddddddd\
  1756. ddddddddddddddddddddddddddddddddddddddddddddddddddd\
  1757. ddddddddddddddddddddddddddddddddddddddddddddddddddd\
  1758. ddddddddddddddddddddddddddddddddddddddddddddddddddd\
  1759. ddddddddddddddddddddddddddddddddddddddddddddddddddd",
  1760.       Windows = {
  1761.         [ "win25x10.pic" ] = "e1d7777777777777777777777\
  1762. 0000000000000000000000000\
  1763. 0000000000000000000000000\
  1764. 0000000000000000000000000\
  1765. 0000000000000000000000000\
  1766. 0000000000000000000000000\
  1767. 0000000000000000000000000\
  1768. 0000000000000000000000000\
  1769. 0000000000000000000000000\
  1770. 0000000000000000000000000",
  1771.         [ "win15x5.pic" ] = "e1d777777777777\
  1772. 000000000000000\
  1773. 000000000000000\
  1774. 000000000000000\
  1775. 000000000000000\
  1776. 000000000000000",
  1777.       },
  1778.       OS = {
  1779.         Desktop = {
  1780.           [ "win.pic" ] = "\
  1781. \
  1782.                00000000 00000000\
  1783.             00000000000 00000000000\
  1784.           0000000000000 0000000000000\
  1785.           0000000000000 0000000000000\
  1786.           0000000000000 0000000000000\
  1787.           0000000000000 0000000000000\
  1788. \
  1789.           0000000000000 0000000000000\
  1790.           0000000000000 0000000000000\
  1791.           0000000000000 0000000000000\
  1792.           0000000000000 0000000000000\
  1793.             00000000000 00000000000\
  1794.                00000000 00000000",
  1795.         },
  1796.       },
  1797.       [ "program.pic" ] = "fffff\
  1798. fffff\
  1799. fffff\
  1800. fffff",
  1801.       [ "file.pic" ] = "000000\
  1802. 000000\
  1803. 000000\
  1804. 000000",
  1805.       [ "osMenu.cpic" ] = "000000000\
  1806. 0000000007\
  1807. 0000000007\
  1808. 0000000007\
  1809. 0000000007\
  1810. 0000000007\
  1811. 0000000007\
  1812. 0000000007\
  1813. 777777777",
  1814.       [ "select.pic" ] = "bbbbbbbb\
  1815. bbbbbbbb\
  1816. bbbbbbbb\
  1817. bbbbbbbb\
  1818. bbbbbbbb\
  1819. bbbbbbbb",
  1820.       [ "paint.exe" ] = "c1b4cf\
  1821. f5eecc\
  1822. fbe4bc\
  1823. fb5c1c",
  1824.       [ "folder.pic" ] = "441\
  1825. 444444\
  1826. 444444\
  1827. 444444",
  1828.       [ "stus.plc" ] = "999999999999999999999999999999999999999999999999999\
  1829. 999999999999999999999999999999999999999999999999999\
  1830. 999999999999999999999999999999999999999999999999999\
  1831. 999999999999999999999999999999999999999999999999999\
  1832. 999999999999999999999999999999999999999999999999999\
  1833. 999999999999999999999999999999999999999999999999999\
  1834. 999999999999999999999999999999999999999999999999999\
  1835. 999999999999999999999999999999999999999999999999999\
  1836. 999999999999999999999999999999999999999999999999999 --centre/2\
  1837. 999999999999999999999999999999999999999999999999999\
  1838. 999999999999999999900000000000009999999999999999999\
  1839. 999999999999999999999999999999999999999999999999999\
  1840. 999999999999999999999999999999999999999999999999999\
  1841. 999999999999999999999999999999999999999999999999999\
  1842. 999999999999999999999999999999999999999999999999999\
  1843. 999999999999999999999999999999999999999999999999999\
  1844. 999999999999999999999999999999999999999999999999999\
  1845. 999999999999999999999999999999999999999999999999999\
  1846. 999999999999999999999999999999999999999999999999999",
  1847.     },
  1848.     Win = {
  1849.       [ "win.plw" ] = "e1d7777777777777777777777777777777\
  1850. 0000000000000000000000000000000000\
  1851. 8000000000000000000000000000000000\
  1852. 0000000000000000000000000000000000\
  1853. 8000000000000000000000000000000000\
  1854. 0000000000000000000000000000000000\
  1855. 8000000000000000000000000000000000\
  1856. 0000000000000000000000000000000000\
  1857. 8000000000000000000000000000000000\
  1858. 0000000000000000000000000000000000\
  1859. 0000000000000000000000000000000000",
  1860.     },
  1861.     Disk = {
  1862.       Enter = "e4d7777777777\
  1863. 0000000000000\
  1864. 0000000000000\
  1865. 0000000000000\
  1866. 0000000000000\
  1867. 0000000000000",
  1868.     },
  1869.     Menus = {
  1870.       [ "Context.pic" ] = "00000000\
  1871. 000000007\
  1872. 000000007\
  1873. 000000007\
  1874. 000000007\
  1875. 000000007\
  1876. 000000007\
  1877. 77777777",
  1878.       [ "ContexLeft.pic" ] = " 00000000\
  1879. 700000000\
  1880. 700000000\
  1881. 700000000\
  1882. 700000000\
  1883. 700000000\
  1884. 700000000\
  1885. 77777777",
  1886.     },
  1887.     FolderIn = {
  1888.       [ "oldf.plw" ] = "e1d777777777777777777777777777777777777777777777777\
  1889. 777778877777777777777777777777777777800000000000007\
  1890. 777777777777777777777777777777777777777777777777777\
  1891. 333333330000000000000000000000000000000000000000000\
  1892. 333333330000000000000000000000000000000000000000000\
  1893. 333333330000000000000000000000000000000000000000000\
  1894. 333333330000000000000000000000000000000000000000000\
  1895. 333333330000000000000000000000000000000000000000000\
  1896. 333333330000000000000000000000000000000000000000000\
  1897. 333333330000000000000000000000000000000000000000000\
  1898. 333333330000000000000000000000000000000000000000000\
  1899. 333333330000000000000000000000000000000000000000000\
  1900. 333333330000000000000000000000000000000000000000000\
  1901. 333333330000000000000000000000000000000000000000000\
  1902. 333333330000000000000000000000000000000000000000000\
  1903. 333333330000000000000000000000000000000000000000000\
  1904. 333333330000000000000000000000000000000000000000000\
  1905. 777777777777777777777777777777777777777777777777777\
  1906. \
  1907. ",
  1908.       [ "menuHide.pic" ] = "777777777\
  1909. 7777887777\
  1910. 7777777777\
  1911. 3333333000\
  1912. 3333333044\
  1913. 3333333044\
  1914. 3333333044\
  1915. 3333333044\
  1916. 3333333000",
  1917.     },
  1918.   },
  1919.   wallpapers = {
  1920.     [ "grammarnazi.fuck" ] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
  1921. eeeeeeeeeeeeeeeeeeeee000000000eeeeeeeeeeeeeeeeeeeee\
  1922. eeeeeeeeeeeeeeeeee000000ff0000000eeeeeeeeeeeeeeeeee\
  1923. eeeeeeeeeeeeeeeee000000fff00000000eeeeeeeeeeeeeeeee\
  1924. eeeeeeeeeeeeeeee000000fff0000000000eeeeeeeeeeeeeeee\
  1925. eeeeeeeeeeeeeee000000fff0000ff000000eeeeeeeeeeeeeee\
  1926. eeeeeeeeeeeeee000000fff0000ffff000000eeeeeeeeeeeeee\
  1927. eeeeeeeeeeeee000000fff0000ffffff000000eeeeeeeeeeeee\
  1928. eeeeeeeeeeeee00000fff0000fff0ffff00000eeeeeeeeeeeee\
  1929. eeeeeeeeeeeee00000fff000fff000fff00000eeeeeeeeeeeee\
  1930. eeeeeeeeeeeee000000fff00ff000fff000000eeeeeeeeeeeee\
  1931. eeeeeeeeeeeeee000000fff00000fff000000eeeeeeeeeeeeee\
  1932. eeeeeeeeeeeeeee000000fff000fff000000eeeeeeeeeeeeeee\
  1933. eeeeeeeeeeeeeeee000000fff0fff000000eeeeeeeeeeeeeeee\
  1934. eeeeeeeeeeeeeeeee000000fffff000000eeeeeeeeeeeeeeeee\
  1935. eeeeeeeeeeeeeeeeee000000fff000000eeeeeeeeeeeeeeeeee\
  1936. eeeeeeeeeeeeeeeeeeeee000000000eeeeeeeeeeeeeeeeeeeee\
  1937. eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
  1938. eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
  1939.   },
  1940.   Os = {
  1941.     Main = {
  1942.       Os = {
  1943.         [ "mindows.osq" ] = "term.setBackgroundColor(colors.lightBlue)\
  1944. term.clear()\
  1945. term.setCursorPos(1,1)\
  1946. -----wallpaper\
  1947. local imgwin = paintutils.loadImage(\"System/Pictures/Icons/OS/Desktop/win.pic\")\
  1948. paintutils.drawImage(imgwin,2,1)\
  1949. ------osgui-----\
  1950. function gui()\
  1951. --------downtoolbar----\
  1952. paintutils.drawLine(1,18,51,18,colors.gray)\
  1953. ----iconW---\
  1954. paintutils.drawPixel(1,18,colors.lightGray)\
  1955. -----clock----\
  1956. paintutils.drawLine(45,18,51,18,colors.blue)\
  1957. end\
  1958. ------timeclock----\
  1959. function time()\
  1960. local time = os.time()\
  1961. local ftime = textutils.formatTime(time,false)\
  1962. term.setCursorPos(45,18)\
  1963. term.write(ftime)\
  1964. end\
  1965. function desktop()\
  1966. local folder = paintutils.loadImage(\"System/Pictures/Icons/folder.pic\")\
  1967. local program = paintutils.loadImage(\"System/Pictures/Icons/program.pic\")\
  1968. local file = paintutils.loadImage(\"System/Pictures/Icons/file.pic\")\
  1969. paintutils.drawImage(folder,3,3)  \
  1970. paintutils.drawImage(program,10,3)\
  1971. term.setCursorPos(11,4)\
  1972. term.setTextColor(colors.yellow)\
  1973. term.write(\">_\")\
  1974. end\
  1975. function fileName()\
  1976. term.setCursorPos(3,8)\
  1977. term.setTextColor(colors.black)\
  1978. term.setBackgroundColor(colors.lightBlue)\
  1979. end\
  1980. function select()\
  1981. local sel = paintutils.loadImage(\"select.pic\")\
  1982. end\
  1983. \
  1984. gui()\
  1985. fileName()\
  1986. desktop()\
  1987. time()",
  1988.       },
  1989.     },
  1990.   },
  1991.   Apis = {
  1992.     GUI = {
  1993.       gui = "-------------------------------------------------------------------------------------------\
  1994. ---Custon drawing API\
  1995. -------------------------------------------------------------------------------------------\
  1996. local function drawPixelInternal( target, xPos, yPos )\
  1997. \009target.setCursorPos(xPos, yPos)\
  1998. \009target.write(\" \")\
  1999. end\
  2000. \
  2001. local function drawPixel(target, xPos, yPos, nColour )\
  2002. \009if nColour then\
  2003. \009\009target.setBackgroundColor( nColour )\
  2004. \009end\
  2005. \009drawPixelInternal( target, xPos, yPos )\
  2006. end\
  2007. \
  2008. local function drawLine(target, startX, startY, endX, endY, nColour )\
  2009. \009if nColour then\
  2010. \009\009target.setBackgroundColor( nColour )\
  2011. \009end\
  2012. \009\
  2013. \009startX = math.floor(startX)\
  2014. \009startY = math.floor(startY)\
  2015. \009endX = math.floor(endX)\
  2016. \009endY = math.floor(endY)\
  2017. \009\
  2018. \009if startX == endX and startY == endY then\
  2019. \009\009drawPixelInternal( target, startX, startY )\
  2020. \009\009return\
  2021. \009end\
  2022. \009\
  2023. \009local minX = math.min( startX, endX )\
  2024. \009if minX == startX then\
  2025. \009\009minY = startY\
  2026. \009\009maxX = endX\
  2027. \009\009maxY = endY\
  2028. \009else\
  2029. \009\009minY = endY\
  2030. \009\009maxX = startX\
  2031. \009\009maxY = startY\
  2032. \009end\
  2033. \009\009\
  2034. \009local xDiff = maxX - minX\
  2035. \009local yDiff = maxY - minY\
  2036. \009\009\009\
  2037. \009if xDiff > math.abs(yDiff) then\
  2038. \009\009local y = minY\
  2039. \009\009local dy = yDiff / xDiff\
  2040. \009\009for x=minX,maxX do\
  2041. \009\009\009drawPixelInternal( target, x, math.floor( y + 0.5 ) )\
  2042. \009\009\009y = y + dy\
  2043. \009\009end\
  2044. \009else\
  2045. \009\009local x = minX\
  2046. \009\009local dx = xDiff / yDiff\
  2047. \009\009if maxY >= minY then\
  2048. \009\009\009for y=minY,maxY do\
  2049. \009\009\009\009drawPixelInternal( target, math.floor( x + 0.5 ), y )\
  2050. \009\009\009\009x = x + dx\
  2051. \009\009\009end\
  2052. \009\009else\
  2053. \009\009\009for y=minY,maxY,-1 do\
  2054. \009\009\009\009drawPixelInternal( target, math.floor( x + 0.5 ), y )\
  2055. \009\009\009\009x = x - dx\
  2056. \009\009\009end\
  2057. \009\009end\
  2058. \009end\
  2059. end\
  2060. \
  2061. local function drawRect(target, x1, y1, x2, y2, nColour)\
  2062. \009for i = 0, y2 - 1 do\
  2063. \009\009drawLine(target, x1, y1 + i, x1 + x2 - 1, y1 + i, nColour)\
  2064. \009end\
  2065. end\
  2066. -------------------------------------------------------------------------------------------\
  2067. ---End of custom drawing API\
  2068. -------------------------------------------------------------------------------------------\
  2069. local peripheralPool = {}\
  2070. local SELECTED_OBJECT = nil\
  2071. local backupPullEvent = nil\
  2072. -------------------------------------------------------------------------------------------\
  2073. ---PUBLIC GUI API\
  2074. -------------------------------------------------------------------------------------------\
  2075. function SET_SELECTED_OBJECT(OBJ)\
  2076. \009SELECTED_OBJECT = OBJ\
  2077. end\
  2078. \
  2079. function CLEAR_SCREEN(color, target)\
  2080. \009if not target then target = term.native() end\
  2081. \009target.setBackgroundColor(color)\
  2082. \009target.clear()\
  2083. end\
  2084. \
  2085. function NO_EXIT()\
  2086. \009os.pullEvent(\"GUI_USER_EXIT\")\
  2087. \009cleanup(MainPanel)\
  2088. end\
  2089. \
  2090. function EXIT()\
  2091. \009os.queueEvent(\"GUI_USER_EXIT\")\
  2092. end\
  2093. \
  2094. local function cleanup(object)\
  2095. \009for _, child in pairs(object._CHILDREN) do\
  2096. \009\009cleanup(child)\
  2097. \009\009child = nil\
  2098. \009end\
  2099. end\
  2100. \
  2101. local function getPeripheralName(p)\
  2102. \009return peripheralPool[p]\
  2103. end\
  2104. \
  2105. function connectPeripheral(name)\
  2106. \009local p = peripheral.wrap(name)\
  2107. \009peripheralPool[p] = name\
  2108. \009return p\
  2109. end\
  2110. \
  2111. local function getTextLayoutPos(layout, text, x, y, width, height, px, py)\
  2112. \009if layout == \"topleft\" then\
  2113. \009\009return x, y\
  2114. \009elseif layout == \"top\" then\
  2115. \009\009local cx = x + math.floor( ( width - string.len(text) ) / 2)\
  2116. \009\009return cx, y\
  2117. \009elseif layout == \"topright\" then\
  2118. \009\009local cx = x + ( width - string.len(text) ) + 1\
  2119. \009\009return cx, y\
  2120. \009elseif layout == \"center\" then\
  2121. \009\009local cy = y + math.floor(height / 2)\
  2122. \009\009local cx = x + math.floor( ( width - string.len(text) ) / 2)\
  2123. \009\009return cx, cy\009\
  2124. \009elseif layout == \"left\" then\
  2125. \009\009local cy = y + math.floor(height / 2)\
  2126. \009\009return x, cy\009\
  2127. \009elseif layout == \"right\" then\
  2128. \009\009local cx = x +( width - string.len(text) ) + 1\
  2129. \009\009local cy = y + math.floor(height / 2) \
  2130. \009\009return cx, cy\
  2131. \009elseif layout == \"bottomleft\" then\
  2132. \009\009local cy = y + math.floor(height / 2) + 1\
  2133. \009\009return x, cy\
  2134. \009elseif layout == \"bottom\" then\
  2135. \009\009local cx = x + math.floor( ( width - string.len(text) ) / 2)\
  2136. \009\009local cy = y + math.floor(height / 2) + 1\
  2137. \009\009return cx, cy\
  2138. \009elseif layout == \"bottomright\" then\
  2139. \009\009local cx = x +( width - string.len(text) ) + 1\
  2140. \009\009local cy = y + math.floor(height / 2) + 1\
  2141. \009\009return cx, cy\
  2142. \009end\
  2143. end\
  2144. \
  2145. local function inBounds(x, y, x1, y1, w, h)\
  2146. \009if ( ( x >= x1 and x <= ( x1 + w) ) and (y >= y1 and y <= ( y1 + h ) ) ) then\
  2147. \009\009return true\
  2148. \009end\
  2149. \009return false\
  2150. end\
  2151. \
  2152. --Defaults for all objects\
  2153. local function getDefaults()\
  2154. \009local mt = {\
  2155. \009\009target = term.native(),\
  2156. \009\009x = 1,\
  2157. \009\009y = 1,\
  2158. \009\009dynX = 1,\
  2159. \009\009dynY = 1,\
  2160. \009\009width = 1,\
  2161. \009\009height = 1,\
  2162. \009\009enabled = true,\
  2163. \009\009visible = true,\
  2164. \009\009text = \"\",\
  2165. \009\009func = nil,\
  2166. \009\009text_pos = \"center\",\
  2167. \009\009color_text = colors.white,\
  2168. \009\009color_bg = colors.blue,\
  2169. \009\009color_used = colors.red,\
  2170. \009\009_PARENT = nil,\
  2171. \009\009_CHILDREN = {},\
  2172. \009\009\
  2173. \009\009addPARENT = function(s, object)\
  2174. \009\009\009s._PARENT = object\
  2175. \009\009end,\
  2176. \009\009\
  2177. \009\009addCHILD = function(s, object) end,\
  2178. \009\009\
  2179. \009\009enable = function(s)\
  2180. \009\009\009s.enabled = true\
  2181. \009\009end,\
  2182. \009\009\
  2183. \009\009disable = function(s)\
  2184. \009\009\009s.enabled = false\
  2185. \009\009end,\
  2186. \009\009\
  2187. \009\009show = function(s)\
  2188. \009\009\009s.visible = true\
  2189. \009\009end,\
  2190. \009\009\
  2191. \009\009showNDraw = function(s)\
  2192. \009\009\009s:show()\
  2193. \009\009\009s:draw()\
  2194. \009\009end,\
  2195. \009\009\
  2196. \009\009showNDrawNEnable = function(s)\
  2197. \009\009\009s:showNDraw()\
  2198. \009\009\009s:enable()\
  2199. \009\009end,\
  2200. \009\009\
  2201. \009\009hide = function(s)\
  2202. \009\009\009s.visible = false\
  2203. \009\009end,\
  2204. \009\009\
  2205. \009\009hideNDisable = function(s)\
  2206. \009\009\009s:hide()\
  2207. \009\009\009s:disable()\
  2208. \009\009end,\
  2209. \009\009\
  2210. \009\009showNEnable = function(s)\
  2211. \009\009\009s:showNDraw()\
  2212. \009\009\009s:enable()\
  2213. \009\009end,\
  2214. \009\009\
  2215. \009\009setText = function(s, t)\
  2216. \009\009\009s.text = t\
  2217. \009\009\009s:draw()\
  2218. \009\009end,\
  2219. \009\009\
  2220. \009\009move = function(s, x, y)\
  2221. \009\009\009s.x = x\
  2222. \009\009\009s.y = y\
  2223. \009\009\009s:_dynRefresh()\
  2224. \009\009end,\
  2225. \009\009\
  2226. \009\009resize = function(s, w, h)\
  2227. \009\009\009s.width = w\
  2228. \009\009\009s.height = h\
  2229. \009\009end,\
  2230. \009\009\
  2231. \009\009_dynRefresh = function(s)\
  2232. \009\009\009px, py = 1, 1\
  2233. \009\009\009if s._PARENT then\
  2234. \009\009\009\009px, py = s._PARENT.dynX, s._PARENT.dynY\
  2235. \009\009\009end\
  2236. \009\009\009s.dynX = s.x + px - 1\
  2237. \009\009\009s.dynY = s.y + py - 1\
  2238. \009\009end,\
  2239. \009\009\
  2240. \009\009clickCheck = function(s) return false end,\
  2241. \009\009draw = function(s) end,\
  2242. \009\009eventReact = function(s, e) end,\
  2243. \009\009\
  2244. \009\009used = function(s)\
  2245. \009\009\009if s.func then s:func() end\
  2246. \009\009end\
  2247. \009\009\
  2248. \009}\
  2249. \009return {__index = mt}\
  2250. end\
  2251. \
  2252. --Panel constructor\
  2253. function NewPanel(x, y, visible, enabled)\
  2254. \009local panel = {\
  2255. \009\009addCHILD = function(s, ...)\
  2256. \009\009\009local args = {...}\
  2257. \009\009\009for _, object in pairs(args) do\
  2258. \009\009\009\009table.insert(s._CHILDREN, object)\
  2259. \009\009\009\009object:addPARENT(s)\
  2260. \009\009\009end\
  2261. \009\009end,\
  2262. \009\009\
  2263. \009\009draw = function(s)\
  2264. \009\009\009if not s.visible then return end\
  2265. \009\009\009s:_dynRefresh()\
  2266. \009\009\009for _, child in pairs(s._CHILDREN) do\
  2267. \009\009\009\009child:draw()\
  2268. \009\009\009end\
  2269. \009\009end\
  2270. \009}\
  2271. \009panel = setmetatable(panel, getDefaults())\
  2272. \009\
  2273. \009panel.x = x\
  2274. \009panel.y = y\
  2275. \009panel.visible = visible\
  2276. \009panel.enabled = enabled\
  2277. \009\
  2278. \009return panel\
  2279. end\
  2280. \
  2281. --Button constructor\
  2282. function NewButton(target, x, y, width, height, text, func, color_bg, color_text, color_used)\
  2283. \009local button = {\
  2284. \009\009draw = function(s, color)\
  2285. \009\009\009if not s.visible then return end\
  2286. \009\009\009if not color then color = s.color_bg end\
  2287. \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
  2288. \009\009\009\
  2289. \009\009\009s:_dynRefresh()\
  2290. \009\009\009\
  2291. \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, s.height, color)\
  2292. \009\009\009\
  2293. \009\009\009local cx, cy = getTextLayoutPos(s.text_pos, s.text, s.dynX, s.dynY, s.width, s.height)\
  2294. \009\009\009s.target.setTextColor(s.color_text)\
  2295. \009\009\009s.target.setCursorPos(cx, cy)\
  2296. \009\009\009s.target.write(s.text)\009\
  2297. \009\009\009\009\
  2298. \009\009\009s.target.setCursorPos(cursorX, cursorY)\
  2299. \009\009end,\
  2300. \009\009\
  2301. \009\009clickCheck = function(s, t)\
  2302. \009\009\009if not s.enabled then return end\
  2303. \009\009\009\
  2304. \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
  2305. \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
  2306. \009\009\009\009return \
  2307. \009\009\009end\
  2308. \
  2309. \009\009\009s:_dynRefresh()\
  2310. \009\009\009\
  2311. \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
  2312. \009\009\009\009s:used()\
  2313. \009\009\009\009return true\
  2314. \009\009\009end\
  2315. \009\009\009return false\
  2316. \009\009end,\
  2317. \009}\
  2318. \009button = setmetatable(button, getDefaults())\
  2319. \009\
  2320. \009button.target = target\
  2321. \009button.x = x\
  2322. \009button.y = y\
  2323. \009button.width = width\
  2324. \009button.height = height\
  2325. \009button.text = text\
  2326. \009button.func = func\
  2327. \009button.color_text = color_text\
  2328. \009button.color_bg = color_bg\
  2329. \009button.color_used = color_used\
  2330. \009\
  2331. \009return button\
  2332. end\
  2333. \
  2334. --CheckBox constructor\
  2335. function NewCheckBox(target, x, y, width, height, text, func, color_bg, color_text, color_used)\
  2336. \009local chbox = {\
  2337. \009\009check = false, \
  2338. \009\009\
  2339. \009\009draw = function(s, color)\
  2340. \009\009\009if not s.visible then return end\
  2341. \009\009\009if not color then color = s.color_bg end\
  2342. \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
  2343. \009\009\009\
  2344. \009\009\009s:_dynRefresh()\
  2345. \009\009\009\
  2346. \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, s.height, color)\
  2347. \009\009\009\
  2348. \009\009\009local cx, cy = getTextLayoutPos(s.text_pos, \"[ ]-\" .. s.text, s.dynX, s.dynY, s.width, s.height)\
  2349. \009\009\009s.target.setTextColor(s.color_text)\
  2350. \009\009\009s.target.setCursorPos(cx, cy)\
  2351. \009\009\009s.target.write(\"[\"..( (s.check == true) and \"X\" or \" \") .. \"]-\"..s.text)\009\
  2352. \009\009\009\009\
  2353. \009\009\009s.target.setCursorPos(cursorX, cursorY)\
  2354. \009\009end,\
  2355. \009\009\
  2356. \009\009clickCheck = function(s, t)\
  2357. \009\009\009if not s.enabled then return end\
  2358. \009\009\009\
  2359. \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
  2360. \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
  2361. \009\009\009\009return \
  2362. \009\009\009end\
  2363. \
  2364. \009\009\009s:_dynRefresh()\
  2365. \009\009\009\
  2366. \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
  2367. \009\009\009\009s:used()\
  2368. \009\009\009\009return true\
  2369. \009\009\009end\
  2370. \009\009\009return false\
  2371. \009\009end,\
  2372. \009\009\
  2373. \009\009used = function(s)\
  2374. \009\009\009s.check = not s.check\
  2375. \009\009\009if s.func then s:func() end\
  2376. \009\009\009s:draw()\
  2377. \009\009end,\
  2378. \009}\
  2379. \009chbox = setmetatable(chbox, getDefaults())\
  2380. \009\
  2381. \009chbox.target = target\
  2382. \009chbox.x = x\
  2383. \009chbox.y = y\
  2384. \009chbox.width = width\
  2385. \009chbox.height = height\
  2386. \009chbox.text = text\
  2387. \009chbox.func = func\
  2388. \009chbox.color_text = color_text\
  2389. \009chbox.color_bg = color_bg\
  2390. \009chbox.color_used = color_used\
  2391. \009\
  2392. \009return chbox\
  2393. end\
  2394. \
  2395. --Progress Bar constructor\
  2396. function NewProgressBar(target, x, y, width, height, color_bg, color_used)\
  2397. \009local pbar = {\
  2398. \009\009step = 0.01,\
  2399. \009\009progress = 0.0,\
  2400. \009\009\
  2401. \009\009setProgress = function(s, np)\
  2402. \009\009\009s.progress = (np > 1) and 1 or np\
  2403. \009\009\009s:draw()\
  2404. \009\009end,\
  2405. \009\009\
  2406. \009\009clear = function(s)\
  2407. \009\009\009s.progress = 0\
  2408. \009\009\009s:draw()\
  2409. \009\009end,\
  2410. \009\009\
  2411. \009\009stepIt = function(s)\
  2412. \009\009\009s.progress = s.progress + s.step\
  2413. \009\009\009if s.progress > 1 then s.progress = 1 end\
  2414. \009\009\009s:draw()\
  2415. \009\009end,\
  2416. \009\009\
  2417. \009\009draw = function(s)\
  2418. \009\009\009if not s.visible then return end\
  2419. \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
  2420. \009\009\009s:_dynRefresh()\
  2421. \009\009\009\
  2422. \009\009\009local pos = s.width * s.progress\
  2423. \009\009\009if pos < s.width then\
  2424. \009\009\009\009drawRect(s.target, s.dynX + pos, s.dynY, s.width - pos, s.height, s.color_bg)\
  2425. \009\009\009end\
  2426. \009\009\009if pos > 0 and pos ~= s.width then\
  2427. \009\009\009\009drawRect(s.target, s.dynX, s.dynY, pos+1, s.height, s.color_used)\
  2428. \009\009\009end\
  2429. \009\009\009\
  2430. \009\009\009s.text = tostring( math.floor(s.progress * 100) )..\"%\"\
  2431. \009\009\009\
  2432. \009\009\009local cx, cy = getTextLayoutPos(s.text_pos, s.text, s.dynX, s.dynY, s.width, s.height)\
  2433. \009\009\009s.target.setTextColor(s.color_text)\
  2434. \009\009\009s.target.setCursorPos(cx, cy)\
  2435. \009\009\009\
  2436. \009\009\009if cx > s.dynX + pos then\
  2437. \009\009\009\009s.target.setBackgroundColor(s.color_bg)\
  2438. \009\009\009\009s.target.write(s.text)\009\
  2439. \009\009\009else\
  2440. \009\009\009\009s.target.write(string.sub(s.text, 1, math.floor(s.dynX + pos - cx + 1) ) )\
  2441. \009\009\009\009s.target.setBackgroundColor(s.color_bg)\
  2442. \009\009\009\009s.target.write(string.sub(s.text, math.floor(s.dynX + pos - cx + 2), #s.text))\
  2443. \009\009\009end\
  2444. \009\009\009\
  2445. \009\009\009s.target.setCursorPos(cursorX, cursorY)\
  2446. \009\009end,\
  2447. \009}\
  2448. \009pbar = setmetatable(pbar, getDefaults())\
  2449. \009pbar.target = target\
  2450. \009pbar.x = x\
  2451. \009pbar.y = y\
  2452. \009pbar.width = width\
  2453. \009pbar.height = height\
  2454. \009pbar.color_bg = color_bg\
  2455. \009pbar.color_used = color_used\
  2456. \009\
  2457. \009return pbar\
  2458. end\
  2459. \
  2460. function NewTextLine(target, x, y, width, text, func, color_bg, color_text)\
  2461. \009local textline = {\
  2462. \009\009secure = false,\
  2463. \009\009_textpos = 1,\
  2464. \009\009_cursorpos = 1,\
  2465. \009\009\
  2466. \009\009draw = function(s)\
  2467. \009\009\009if not s.visible then return end\
  2468. \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
  2469. \009\009\009\
  2470. \009\009\009s:_dynRefresh()\
  2471. \009\009\009\
  2472. \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, 1, s.color_bg)\
  2473. \
  2474. \009\009\009s.target.setTextColor(s.color_text)\
  2475. \009\009\009s.target.setCursorPos(s.dynX, s.dynY)\
  2476. \009\009\009local temp = string.sub(s.text, s._textpos, s._textpos + s.width)\
  2477. \009\009\009if s.secure then\
  2478. \009\009\009\009for i = 1, #temp do\
  2479. \009\009\009\009\009s.target.write(\"*\")\
  2480. \009\009\009\009end\
  2481. \009\009\009else\
  2482. \009\009\009\009s.target.write(temp)\
  2483. \009\009\009end\
  2484. \009\009\009\009\
  2485. \009\009\009s.target.setCursorPos(cursorX, cursorY)\
  2486. \009\009end,\
  2487. \009\009\
  2488. \009\009clickCheck = function(s, t)\
  2489. \009\009\009if not s.enabled then return end\
  2490. \009\009\009\
  2491. \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
  2492. \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
  2493. \009\009\009\009return \
  2494. \009\009\009end\
  2495. \
  2496. \009\009\009s:_dynRefresh()\
  2497. \009\009\009\
  2498. \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
  2499. \009\009\009\009SELECTED_OBJECT = s\
  2500. \009\009\009\009return true\
  2501. \009\009\009end\
  2502. \009\009\009return false\
  2503. \009\009end,\
  2504. \009\009\
  2505. \009\009eventReact = function(s, e)\
  2506. \009\009\009if not s.enabled then return end\
  2507. \009\009\009if e[1] == \"key\" then\
  2508. \009\009\009\009if e[2] == 28 then\
  2509. \009\009\009\009\009SELECTED_OBJECT = nil\
  2510. \009\009\009\009\009s:used()\
  2511. \009\009\009\009elseif e[2] == 14 then\
  2512. \009\009\009\009\009s.text = string.sub(s.text, 1, #s.text - 1)\
  2513. \009\009\009\009\009s._cursorpos = s._cursorpos - 1\
  2514. \009\009\009\009\009\
  2515. \009\009\009\009\009if s._cursorpos <= s._textpos then\
  2516. \009\009\009\009\009\009s._textpos = s._textpos - 4\
  2517. \009\009\009\009\009end\
  2518. \009\009\009\009\009if s._textpos < 1 then\
  2519. \009\009\009\009\009\009s._textpos = 1\
  2520. \009\009\009\009\009end\
  2521. \009\009\009\009\009if s._cursorpos < 1 then\
  2522. \009\009\009\009\009\009s._cursorpos = 1\
  2523. \009\009\009\009\009end\
  2524. \009\009\009\009\009\
  2525. \009\009\009\009\009s:draw()\
  2526. \009\009\009\009elseif e[2] == 203 then\
  2527. \009\009\009\009--left\
  2528. \009\009\009\009elseif e[2] == 205 then\
  2529. \009\009\009\009--right\
  2530. \009\009\009\009end\
  2531. \009\009\009elseif e[1] == \"char\" then\
  2532. \009\009\009\009s.text = s.text .. e[2] --testing\
  2533. \009\009\009\009\
  2534. \009\009\009\009s._cursorpos = s._cursorpos + 1\
  2535. \009\009\009\009\
  2536. \009\009\009\009if s._cursorpos > s._textpos + s.width - 1 then\
  2537. \009\009\009\009\009s._textpos = s._textpos + 1\
  2538. \009\009\009\009end\
  2539. \009\009\009\009\
  2540. \009\009\009\009s:draw()\
  2541. \009\009\009end\
  2542. \009\009end,\
  2543. \009}\
  2544. \009textline = setmetatable(textline, getDefaults())\
  2545. \009textline.target = target\
  2546. \009textline.x = x\
  2547. \009textline.y = y\
  2548. \009textline.width = width\
  2549. \009textline.text = text\
  2550. \009textline.func = func\
  2551. \009textline.color_bg = color_bg\
  2552. \009textline.color_text = color_text\
  2553. \009return textline\
  2554. end\
  2555. \
  2556. --TextArea constructor\
  2557. function NewTextArea(target, x, y, width, height, text, color_bg, color_text)\
  2558. \009local textarea = {\
  2559. \009\009draw = function(s)\
  2560. \009\009\009if not s.visible then return end\
  2561. \009\009\009local cursorX, cursorY = s.target.t()\
  2562. \009\009\009\
  2563. \009\009\009s:_dynRefresh()\
  2564. \009\009\009\
  2565. \009\009\009drawRect(s.target, s.dynX, s.dynY, s.width, s.height, s.color_bg)\
  2566. \009\009\009\
  2567. \009\009\009local k = 0\
  2568. \009\009\009for i = 1, string.len(s.text), s.width do\
  2569. \009\009\009\009s.target.setCursorPos(s.dynX, s.dynY + k)\
  2570. \009\009\009\009k = k + 1\
  2571. \009\009\009\009s.target.setTextColor(s.color_text)\
  2572. \009\009\009\009s.target.write(string.sub(s.text, i, i + s.width - 1))\
  2573. \009\009\009end\
  2574. \009\009\009\009\
  2575. \009\009\009s.target.setCursorPos(cursorX, cursorY)\
  2576. \009\009end,\
  2577. \009\009\
  2578. \009\009clickCheck = function(s, t)\
  2579. \009\009\009if not s.enabled then return end\
  2580. \009\009\009\
  2581. \009\009\009if t[1] == \"monitor_touch\" and t[2] ~= getPeripheralName(s.target) \
  2582. \009\009\009\009or s.target ~= term.native() and t[1] == \"mouse_click\" then\
  2583. \009\009\009\009return \
  2584. \009\009\009end\
  2585. \
  2586. \009\009\009s:_dynRefresh()\
  2587. \009\009\009\
  2588. \009\009\009if inBounds(t[3], t[4], s.dynX, s.dynY, s.width - 1, s.height - 1) then\
  2589. \009\009\009\009SELECTED_OBJECT = s\
  2590. \009\009\009\009return true\
  2591. \009\009\009end\
  2592. \009\009\009return false\
  2593. \009\009end,\
  2594. \009\009\
  2595. \009\009eventReact = function(s, e)\
  2596. \009\009\009if not s.enabled then return end\
  2597. \009\009\009if e[1] == \"key\" then\
  2598. \009\009\009\009if e[2] == 28 then\
  2599. \009\009\009\009\009--testing\
  2600. \009\009\009\009elseif e[2] == 14 then\
  2601. \009\009\009\009\009s.text = string.sub(s.text, 1, #s.text - 1)\
  2602. \009\009\009\009\009s:draw()\
  2603. \009\009\009\009end\
  2604. \009\009\009elseif e[1] == \"char\" then\
  2605. \009\009\009\009s.text = s.text .. e[2] --testing\
  2606. \009\009\009\009s:draw()\
  2607. \009\009\009end\
  2608. \009\009end,\
  2609. \009}\
  2610. \009textarea = setmetatable(textarea, getDefaults())\
  2611. \009textarea.target = target\
  2612. \009textarea.x = x\
  2613. \009textarea.y = y\
  2614. \009textarea.width = width\
  2615. \009textarea.height = height\
  2616. \009textarea.text = text\
  2617. \009textarea.color_bg = color_bg\
  2618. \009textarea.color_text = color_text\
  2619. \009return textarea\
  2620. end\
  2621. \
  2622. --Label constructor\
  2623. function NewLabel(target, x, y, text, color_bg, color_text)\
  2624. \009local label = {\
  2625. \009\009draw = function(s)\
  2626. \009\009\009if not s.visible then return end\
  2627. \009\009\009local cursorX, cursorY = s.target.getCursorPos()\
  2628. \009\009\009\
  2629. \009\009\009s:_dynRefresh()\
  2630. \009\
  2631. \009\009\009drawLine(s.target, s.dynX, s.dynY, s.dynX + string.len(s.text) - 1, s.dynY , s.color_bg)\
  2632. \009\009\009s.target.setTextColor(s.color_text)\
  2633. \009\009\009s.target.setCursorPos(s.dynX, s.dynY)\
  2634. \009\009\009s.target.write(s.text)\
  2635. \009\009\009\
  2636. \009\009\009s.target.setCursorPos(cursorX, cursorY)\
  2637. \009\009end,\
  2638. \009}\
  2639. \009label = setmetatable(label, getDefaults())\
  2640. \009label.target = target\
  2641. \009label.x = x\
  2642. \009label.y = y\
  2643. \009label.text = text\
  2644. \009label.color_bg = color_bg\
  2645. \009label.color_text = color_text\
  2646. \009return label\
  2647. end\
  2648. \
  2649. --click/touch handler\
  2650. local function exec(event, object)\
  2651. \009if not object.enabled then return end\
  2652. \009for _, child in pairs(object._CHILDREN) do\
  2653. \009\009exec(event, child)\
  2654. \009\009if child:clickCheck(event) then\
  2655. \009\009\009return true\
  2656. \009\009end\
  2657. \009end\
  2658. end\
  2659. \
  2660. MainPanel = NewPanel()\
  2661. \
  2662. --Event handler. Call this if overwrite os.pullEvent()\
  2663. function eventHandler(e)\
  2664. \009if e[1] == \"mouse_click\" or e[1] == \"monitor_touch\" then\
  2665. \009\009--Check if selected object or its children clicked\
  2666. \009\009if SELECTED_OBJECT then\
  2667. \009\009\009exec(e, SELECTED_OBJECT)\
  2668. \009\009end\
  2669. \009\009SELECTED_OBJECT = nil\
  2670. \009\009exec(e, MainPanel)\
  2671. \009elseif e[1] == \"key\" or e[1] == \"char\"then\
  2672. \009\009if SELECTED_OBJECT then\
  2673. \009\009\009SELECTED_OBJECT:eventReact(e)\
  2674. \009\009end\
  2675. \009end\
  2676. end\
  2677. \
  2678. backupPullEvent = os.pullEvent\
  2679. \
  2680. function os.pullEvent()\
  2681. \009local e = { os.pullEventRaw() }\
  2682. \009eventHandler(e)\
  2683. \009return e[1], e[2], e[3], e[4], e[5]\
  2684. end",
  2685.     },
  2686.     time = "time()",
  2687.   },
  2688.   FileSystem = {
  2689.     folders = {},
  2690.   },
  2691.   Config = {
  2692.     [ "clog.cfg" ] = "AlexZfelf",
  2693.     [ "pas.cfg" ] = "MICROZ",
  2694.     [ "user.cfg" ] = "NEW",
  2695.     [ "log.cfg" ] = "KURWA@",
  2696.   },
  2697. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement