home *** CD-ROM | disk | FTP | other *** search
/ Carsten's PPE Collection / Carstens_PPE_Collection_2007.zip / S / SDE-ZI11.ZIP / SDE-ZL.PPS < prev    next >
Text File  |  1995-12-30  |  5KB  |  236 lines

  1. *$USEFUNCS
  2.  
  3. * //////// LIGHTBAR PROCEDURE DECLARATiONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  4.  
  5. declare procedure bs_clearline(integer bn)
  6. declare procedure bs_drawline(integer bn)
  7. declare procedure bs_setupbars(integer x, integer  y, integer w, integer num)
  8. declare procedure bs_barup()
  9. declare procedure bs_bardown()
  10. declare function bs_select() integer
  11.  
  12. * /////////////////// PROCEDURE DECLARATiONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  13.  
  14. declare procedure changeopts()
  15. declare procedure maingfx()
  16. declare procedure init()
  17.  
  18. declare function colorstr(string cstr, string c1, string c2, string c3) string
  19. declare function read(integer ra, integer rb,integer hr) string
  20.  
  21. * /////////////////////// LIGHTBAR VARS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  22.  
  23. string bars(10) 
  24. string dec(10) 
  25. integer actbar, barx, bary, barw, barn
  26. boolean bs_enter, exit
  27.  
  28. * ///////////////////////// GLOBAL VARS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  29.  
  30. int sel
  31. string cmd,zippystr,optstr
  32. boolean abort
  33.  
  34. begin
  35.   if (len(lastans()) <= 2) then
  36.     init()
  37.     cmd = "Z "
  38.     If ((left(upper(lastAns()), 1) = "L")) cmd = "L "
  39.     maingfx()
  40.     print "@X0B"
  41.     zippystr = read(17,6,44)
  42.     if (zippystr != "") then
  43.       optstr = ""
  44.       cls
  45.       if (bars(0) = "ALL") join 1
  46.       if (bars(1) = "ON ") optstr = " D"
  47.       if (bars(2) = "ON ") optstr = optstr + " NS"
  48.       kbdstuff cmd + zippystr + " A" + optstr+  chr(13)
  49.     else
  50.     cls
  51.     println colorstr("ZIPPY SCAN/LOCATE DONE BY STEAM/SDE ANSI BY OBI^WAN/SDE. ", "@X05", "@X0D","@X0F")
  52.     println colorstr("ABORTED ...", "@X08", "@X07","@X0F")
  53.     newline
  54.     endif
  55.   else
  56.     kbdstuff lastans()
  57.   endif
  58. end
  59.  
  60. * ///////////////////// PROCEDURES n FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\
  61.  
  62. procedure changeopts()
  63.   exit = FALSE
  64.   while (exit = FALSE) do       
  65.      sel = bs_select() 
  66.      select case (sel)
  67.        case 99 : exit = TRUE
  68.      end select
  69.   endwhile
  70. endproc
  71.  
  72. function colorstr(string cstr, string c1, string c2, string c3) string
  73.   string s1, x
  74.   int i1, l1
  75.   l1 = 0
  76.   s1 = ""
  77.   for i1 = 1 to len(cstr) 
  78.     x = mid(cstr, i1, 1)
  79.     if (x <> " ") then
  80.       select case l1
  81.         case 0
  82.           s1 = s1 + c1
  83.         case 1
  84.           s1 = s1 + c2
  85.         case 2
  86.           s1 = s1 + c3
  87.       end select
  88.       inc l1
  89.       s1 = s1 + x
  90.     else
  91.       s1 = s1 + x
  92.       l1 = 0      
  93.     endif
  94.   next
  95.   colorstr = s1
  96. endfunc
  97.  
  98. function read(integer ra, integer rb,integer hr) string
  99. string sr,cr
  100. integer ro
  101. boolean doner
  102.  
  103.   abort = FALSE
  104.   ansipos ra,rb
  105.   sr = ""
  106.   doner = FALSE
  107.   while (doner = FALSE) do
  108.      cr = inkey()
  109.      ro = asc(cr)
  110.  
  111.      if ((cr != "DOWN") && (cr != "UP") && (cr != "LEFT") && (cr != "RIGHT") && (ro != 9) && (ro != 27)) then
  112.        if (ro = 13) then
  113.          doner = TRUE
  114.        else
  115.          if (ro = 8) then 
  116.              if (len(sr) > 0) then begin       
  117.              sr = mid(sr,1, len(sr)-1)
  118.              print cr + "@X0F·@X0B" + cr
  119.            endif
  120.          else
  121.            if (len(sr) < hr) then
  122.              sr = sr + cr
  123.              if (cr = " ") then
  124.                print "@X0F·@X0B"
  125.              else
  126.                print cr
  127.              endif
  128.            endif
  129.          endif
  130.        endif
  131.      else
  132.        if (ro = 9) then
  133.          changeopts()
  134.          bs_setupbars(75,12,3 ,2)
  135.          print "@X0B"
  136.          ansipos ra+len(sr),rb
  137.        endif     
  138.        if (ro = 27) then
  139.          doner = TRUE
  140.          abort = TRUE      
  141.        endif
  142.      endif
  143.   endwhile
  144.   read = sr
  145. endfunc
  146.  
  147.  
  148. procedure maingfx()
  149.   cls
  150.   startdisp fns
  151.   if (cmd = "Z ") then
  152.     dispfile ppepath() + "zippyscn.pcb", graph
  153.   else
  154.     dispfile ppepath() + "locate.pcb", graph
  155.   endif
  156.   bs_setupbars(75,12,3 ,2)
  157. endproc
  158.  
  159. procedure init()
  160.   bars(0) = "ALL"
  161.   bars(1) = "OFF"
  162.   bars(2) = "OFF"
  163.   bars(3) = "  "
  164.   bars(4) = "CUR"
  165.   bars(5) = "ON "
  166.   bars(6) = "ON "
  167.   bars(7) = "   "
  168.   endproc
  169.  
  170. * ///////////////////// LIGHTBAR STUFF \\\\\\\\\\\\\\\\\\\\\\\\\\\\
  171.  
  172. procedure bs_clearline(integer bn)
  173.  string s
  174.     ansipos barx, bary + bn
  175.     print "@X05" + bars(bn)  + space(barw - len(bars(bn)))
  176. endproc
  177.  
  178. procedure bs_drawline(integer bn)
  179.  string s
  180.     ansipos barx, bary + bn
  181.     print "@X1F" + upper(bars(bn))  + space(barw - len(bars(bn))) + "@X07"
  182. endproc
  183.  
  184. procedure bs_setupbars(integer x, integer y, integer w, integer num)
  185.  integer i
  186.   barx = x
  187.   bary = y
  188.   barw = w
  189.   barn = num + 1
  190.   for  i = 0 to num 
  191.     ansipos x, y+i
  192.     print "@X05" + bars(i)
  193.   next
  194.   actbar = 0
  195. endproc
  196.  
  197. procedure bs_barup()
  198.   bs_clearline(actbar)
  199.   actbar = (actbar + 1) % barn 
  200.   bs_drawline(actbar)
  201. endproc
  202.  
  203. procedure bs_bardown()
  204.   bs_clearline(actbar)
  205.   actbar = (actbar - 1 + barn) % barn 
  206.   bs_drawline(actbar)
  207. endproc
  208.  
  209. function bs_select() integer
  210.  string c,tmp
  211.  byte o
  212.  boolean done
  213.  bs_drawline(actbar)
  214.  bs_enter = TRUE;
  215.  done = FALSE;
  216.   while (done = FALSE) do
  217.       c = inkey()
  218.       o    = asc(c)    
  219.       select case (o)
  220.         case 13 
  221.           tmp = bars(actbar)
  222.           bars(actbar) = bars(actbar + 4)
  223.           bars(actbar + 4) = tmp
  224.           bs_drawline(actbar)
  225.         case 27,9
  226.           done = TRUE
  227.           actbar = 99
  228.         case 68, 122
  229.           bs_barup()
  230.         case 85, 97
  231.           bs_bardown()
  232.       end select  
  233.   endwhile  
  234.   bs_select = actbar
  235. endfunc
  236.