home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 50 / af050.adf / AMOSInterface.AMOS / AMOSInterface.amosSourceCode
AMOS Source Code  |  1993-07-05  |  21KB  |  683 lines

  1. Rem A library for WB2 style window and requesters
  2. Rem  
  3. Rem with a bit of imagination, you can do anything!  
  4. Rem
  5. Rem And all with humble AMOS.
  6. Rem
  7.  
  8. Rem Before, you could tell a serious AMOS program a mile away  
  9. Rem because of the disgusting interface AMOS provided. 
  10. Rem Now you can even conform to Commodore's interface guidelines!
  11. Rem And best off all, no one can tell your program is written in AMOS! 
  12.  
  13. Proc INITIALISE : Rem ** Opens a screen and defines colours etc. 
  14.  
  15. Rem  ** This line draws a demo requester message 
  16. Proc REAL3DMESSAGE[170,71,305,80,True,20,25,"An example message","You can create all sorts of   ","messages and requesters that  ","look just like the real       ","thing, and no nasty DOS calls!","","","","Ok",""]
  17.  
  18. Rem --- Main Loop, controls button checking and stuff ---
  19. Repeat 
  20.    If Mouse Key=1 and Mouse Zone=1 : Rem ** Wait for the OK box to be clicked on  
  21.       Proc CLICKBOX[(305-40)/2+170,80+71-17,40,13,True,"Ok",0,False] : Rem ** Draw it embossed  
  22.       Repeat : Until Mouse Key=0 : Rem   ** Wait for the user to release the mouse button 
  23.       Rem                                ** Draw over the window in grey so it goes away 
  24.       Ink 2
  25.       Bar 170,71 To 170+305,71+80
  26.  
  27.       Proc EXAMPLEWINDOW : Rem           ** Draw the screenmode requester 
  28.       Repeat : Until Mouse Key=1 : Rem   ** Wait for user to click mouse button 
  29.       End : Rem                          ** Then, end.   
  30.    End If 
  31. Until False
  32.  
  33.  
  34. Rem --- This is an example of the kind of thing you can produce
  35. Procedure EXAMPLEWINDOW
  36.    VISIBLE$="320 x   256"
  37.    MYNIMUM$="320 x   256"
  38.    MEXIMUM$="16368 x 16384"
  39.    MEXCOLS$="4096         "
  40.  
  41.    X=19
  42.    Y=34
  43.  
  44.    Proc REAL3DWINDOW[X,Y,603,194,False,"Look familiar?","Save","Cancel",80,10]
  45.    Proc HEAVYICON[X+12,Y+29,276,75,False,0,False]
  46.    Proc HEAVYICON[X+14+276,Y+29,15,75,False,0,False]
  47.  
  48.    Ink 0
  49.    Bar X+16+278,Y+31 To X+24+278,Y+31+71
  50.  
  51.    Ink 0
  52.    Text 125,Y+22,"Display Mode"
  53.    Text 410,Y+22,"Mode properties"
  54.    Text X+329,Y+40,"Visible Size  :   "+VISIBLE$
  55.    Text X+329,Y+49,"Minimum Size  :   "+MYNIMUM$
  56.    Text X+329,Y+58,"Maximum Size  : "+MEXIMUM$
  57.    Text X+329,Y+67,"Maximum Colors: "+MEXCOLS$
  58.    Text X+329,Y+85,"50Hz, 15.60kHz"
  59.  
  60.    Text X+16,Y+37,"PAL:High Res"
  61.    Text X+16,Y+46,"PAL:High Res Laced"
  62.    Text X+16,Y+55,"PAL:Low Res"
  63.    Text X+16,Y+64,"PAL:Low Res Laced"
  64.    Text X+16,Y+73,"PAL:Super-High Res"
  65.    Text X+16,Y+82,"PAL:Super-High Res Laced"
  66.  
  67.    Text X+56,Y+118,"Width:"
  68.    Text X+56-8,Y+133,"Height:"
  69.    Text X+56-8,Y+152,"Colors:"
  70.    Text X+16,Y+168,"AutoScroll:"
  71.  
  72.    Proc ENTERBOX[X+110,Y+108,65,13,0,False]
  73.    Proc ENTERBOX[X+110,Y+124,65,13,0,False]
  74.  
  75.    Proc TICKBOX[X+182,Y+110,True,0,False]
  76.    Proc TICKBOX[X+182,Y+126,True,0,False]
  77.    Proc TICKBOX[X+110,Y+160,True,0,False]
  78.  
  79.    Text X+212,Y+118,"Default"
  80.    Text X+212,Y+134,"Default"
  81.  
  82.    Proc SLIDER[X+130,Y+144,170,0,0,False]
  83.    Proc HEAVYICON[X+318,Y+29,273,141,True,0,False]
  84.  
  85.    Proc HEAVYCLICKBOX[(603-80)/2+19,194+34-19,80,13,False,"Use",0,False]
  86. End Proc
  87.  
  88.  
  89. Rem --- The library definitions start from here ---------------
  90. Procedure REAL3DMESSAGE[X,Y,WIDTH,HIGHT,INSIDEPATTERN,XPOS,YPOS,TITLE$,LINE1$,LINE2$,LINE3$,LINE4$,LINE5$,LINE6$,LINE7$,BUTTON1$,BUTTON2$]
  91.    Rem ** X             = The x possition of the window 
  92.    Rem ** Y             = The y possition of the window 
  93.    Rem ** WIDTH         = The width of the window 
  94.    Rem ** HIGHT         = The height of the window
  95.    Rem ** INSIDEPATTERN = Whether there is a dithered pattern inside the window 
  96.    Rem It requires you to specify True, or False
  97.  
  98.    Rem ** XPOS          = The x possition of the text (if any) inside the window
  99.    Rem ** YPOS          = The y possition of the text (if any) inside the window
  100.    Rem ** TITLE$        = The title of the window 
  101.    Rem ** LINE1$        = Line 1 of the message (can just be "" for no message) 
  102.    Rem ** LINE2$        = Line 2 of the message (can just be "" for no message)   
  103.    Rem ** LINE3$        = Line 3 of the message (can just be "" for no message)   
  104.    Rem ** LINE4$        = Line 4 of the message (can just be "" for no message)   
  105.    Rem ** LINE5$        = Line 5 of the message (can just be "" for no message) 
  106.    Rem ** LINE6$        = Line 6 of the message (can just be "" for no message)     
  107.    Rem ** LINE7$        = Line 7 of the message (can just be "" for no message)   
  108.    Rem ** BUTTON1$      = The first of the buttons (can just be "" for no button) 
  109.    Rem ** BUTTON2$      = The last of the buttons (if this is just "" then the first button will be centered) 
  110.  
  111.    Reserve Zone 3
  112.  
  113.    Gr Writing 0
  114.  
  115.    TXTYPOS=Y+YPOS
  116.    
  117.    Get Block 1,X,Y,WIDTH+1,HIGHT+1
  118.    Ink 2 : Bar X,Y To X+WIDTH,Y+HIGHT
  119.    
  120.    Ink 1
  121.    
  122.    Draw X,Y+HIGHT To X,Y
  123.    Draw X,Y To X+WIDTH,Y
  124.    
  125.    Ink 0
  126.    Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  127.    Draw X+WIDTH,Y+HIGHT To X+1,Y+HIGHT
  128.    
  129.    Ink 0
  130.    Draw X+3,Y+HIGHT-1 To X+3,Y+10
  131.    Draw X+3,Y+10 To X+WIDTH-4,Y+10
  132.    
  133.    Ink 1
  134.    Draw X+WIDTH-3,Y+10 To X+WIDTH-3,HIGHT+Y-1
  135.    Draw X+WIDTH-3,HIGHT+Y-1 To X+4,Y+HIGHT-1
  136.    
  137.    Ink 3
  138.    Bar X+1,Y+1 To X+WIDTH-1,Y+9
  139.  
  140.    Bar X+1,Y+1 To X+2,Y+HIGHT-1
  141.    Bar X+WIDTH-2,Y+1 To X+WIDTH-1,Y+HIGHT-1
  142.  
  143.    If INSIDEPATTERN=True
  144.       Ink 2
  145.       Set Pattern 2
  146.       Paint X+5,Y+15
  147.  
  148.       Ink 0
  149.       Draw X+8,Y+HIGHT-19 To X+8,Y+13
  150.       Draw X+8,Y+13 To X+WIDTH-8,Y+13
  151.       
  152.       Ink 1
  153.       Draw X+WIDTH-8,Y+13 To X+WIDTH-8,Y+HIGHT-19
  154.       Draw X+WIDTH-8,Y+HIGHT-19 To X+8,Y+HIGHT-19
  155.       
  156.       Set Pattern 0
  157.       
  158.       Ink 2
  159.       Bar X+9,Y+14 To X+WIDTH-9,Y+HIGHT-20
  160.    End If 
  161.  
  162.    If LINE1$<>""
  163.       Ink 0
  164.       
  165.       Text(WIDTH-Len(LINE1$)*8)/2+X,TXTYPOS,LINE1$
  166.       TXTYPOS=TXTYPOS+9
  167.       Text(WIDTH-Len(LINE2$)*8)/2+X,TXTYPOS,LINE2$
  168.       TXTYPOS=TXTYPOS+9
  169.       Text(WIDTH-Len(LINE3$)*8)/2+X,TXTYPOS,LINE3$
  170.       TXTYPOS=TXTYPOS+9
  171.       Text(WIDTH-Len(LINE4$)*8)/2+X,TXTYPOS,LINE4$
  172.       TXTYPOS=TXTYPOS+9
  173.       Text(WIDTH-Len(LINE5$)*8)/2+X,TXTYPOS,LINE5$
  174.       TXTYPOS=TXTYPOS+9
  175.       Text(WIDTH-Len(LINE6$)*8)/2+X,TXTYPOS,LINE6$
  176.       TXTYPOS=TXTYPOS+9
  177.       Text(WIDTH-Len(LINE7$)*8)/2+X,TXTYPOS,LINE7$
  178.    End If 
  179.    
  180.    If BUTTON2$=""
  181.       Proc CLICKBOX[(WIDTH-40)/2+X,HIGHT+Y-17,40,13,False,BUTTON1$,1,True]
  182.    End If 
  183.    
  184.    If BUTTON2$<>""
  185.       Proc CLICKBOX[X+8,Y+HIGHT-17,40,13,False,BUTTON1$,1,True]
  186.       Proc CLICKBOX[WIDTH+X-78,Y+HIGHT-17,70,13,False,BUTTON2$,2,True]
  187.    End If 
  188.    Ink 0
  189.    Text X+4,Y+7,TITLE$
  190. End Proc
  191.  
  192.  
  193. Procedure SLIDER[X,Y,WIDTH,XBAR,ZHONENUMBER,SETUPZONE]
  194.    Rem ** X           = x possition of the slider box   
  195.    Rem ** Y           = y possition of the slider box 
  196.    Rem ** WIDTH       = width of the slider box 
  197.    Rem ** XBAR        = the x possition of the bar inside the slider border 
  198.    Rem ** ZHONENUMBER = the number of the zone to be defined (if a zone is going to be set up)
  199.    Rem ** SETUPZONE   = if a zone is going to be set up the this should be True, if not False 
  200.  
  201.    Proc HEAVYICON[X,Y,WIDTH,10,False,ZHONENUMBER,SETUPZONE]
  202.    Ink 0
  203.    Bar X+4+XBAR,Y+2 To X+3+XBAR+30,Y+8
  204. End Proc
  205.  
  206.  
  207. Procedure ENTERBOX[X,Y,WIDTH,HIGHT,ZHONENUMBER,SETUPZONE]
  208.    Rem ** X           = x possition of the box
  209.    Rem ** Y           = y possition of the box
  210.    Rem ** WIDTH       = width of the box
  211.    Rem ** HIGHT       = height of the box 
  212.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  213.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  214.  
  215.    Ink 1
  216.    Draw X,Y To X,Y+HIGHT
  217.    Draw X+1,Y To X+1,Y+HIGHT-1
  218.    Draw X+2,Y To X+WIDTH-1,Y
  219.    Draw X+WIDTH-2,Y To X+WIDTH-2,Y+HIGHT-1
  220.    Draw X+WIDTH-3,Y+2 To X+WIDTH-3,Y+HIGHT-1
  221.    Draw X+WIDTH-3,Y+HIGHT-1 To X+3,Y+HIGHT-1
  222.    
  223.    Ink 0
  224.    Draw X+2,Y+1 To X+WIDTH-3,Y+1
  225.    Draw X+2,Y+1 To X+2,Y+HIGHT-1
  226.    Draw X+3,Y+1 To X+3,Y+HIGHT-2
  227.    Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  228.    Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  229.    Draw X+1,Y+HIGHT To X+WIDTH-2,Y+HIGHT
  230.  
  231.    If SETUPZONE=True
  232.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  233.    End If 
  234. End Proc
  235.  
  236.  
  237. Procedure CYCLEBOX[X,Y,WIDTH,HIGHT,POSSITION,EMBOSSED,SETUPZONE,ZHONENUMBER,CYCLE1$,CYCLE2$,CYCLE3$,CYCLE4$]
  238.    Rem ** X           = x possition of the box    
  239.    Rem ** Y           = y possition of the box    
  240.    Rem ** WIDTH       = width of the box    
  241.    Rem ** HIGHT       = height of the box   
  242.    Rem ** POSSITION   = What stage the cyclebox is at 1,2,3 or 4 (what text is being displayed)   
  243.    Rem ** EMBOSSED    = Wheter the cyclebox is embossed or not (True, or False)   
  244.    Rem ** SETUPZONE   = whether a zone is set up (True, or False)   
  245.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  246.    Rem ** CYCLE1$     = the text that is first displayed
  247.    Rem ** CYCLE2$     = the text that is displayed after 2 clicks   
  248.    Rem ** CYCLE3$     = the text that is displayed after 3 clicks 
  249.    Rem ** CYCLE4$     = the text that is displayed after 4 clicks   
  250.  
  251.  
  252.    If EMBOSSED=False
  253.       Ink 2
  254.       Bar X+3,Y+1 To X+WIDTH-3,Y+HIGHT-1
  255.       Ink 1
  256.       Draw X,Y To X,Y+HIGHT
  257.       Draw X+1,Y+1 To X+1,Y+HIGHT-1
  258.       Draw X,Y To X+WIDTH-1,Y
  259.  
  260.       Ink 0
  261.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  262.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  263.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  264.  
  265.       Box X+6,Y+2 To X+15,Y+11
  266.       Draw X+7,Y+2 To X+7,Y+10
  267.       Draw X+14,Y+2 To X+14,Y+10
  268.  
  269.       Ink 0
  270.       Plot X+13,Y+7
  271.       Plot X+16,Y+7
  272.       Plot X+13,Y+6
  273.       Plot X+16,Y+6
  274.       Plot X+12,Y+6
  275.       Plot X+17,Y+6
  276.    Else 
  277.       Ink 2
  278.       Bar X+3,Y+1 To X+WIDTH-3,Y+HIGHT-1
  279.  
  280.       Ink 0
  281.       Draw X,Y To X,Y+HIGHT
  282.       Draw X+1,Y+1 To X+1,Y+HIGHT-1
  283.       Draw X,Y To X+WIDTH-1,Y
  284.  
  285.       Ink 1
  286.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  287.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  288.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  289.  
  290.       Box X+6,Y+2 To X+15,Y+11
  291.       Draw X+7,Y+2 To X+7,Y+10
  292.       Draw X+14,Y+2 To X+14,Y+10
  293.  
  294.       Ink 1
  295.       Plot X+13,Y+7
  296.       Plot X+16,Y+7
  297.       Plot X+13,Y+6
  298.       Plot X+16,Y+6
  299.       Plot X+12,Y+6
  300.       Plot X+17,Y+6
  301.    End If 
  302.  
  303.    If SETUPZONE=True
  304.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  305.    End If 
  306.  
  307.    Ink 2
  308.    Plot X+6,Y+2
  309.    Plot X+15,Y+2
  310.    Plot X+15,Y+11
  311.    Plot X+6,Y+11
  312.    Plot X+14,Y+9
  313.    Plot X+15,Y+9
  314.  
  315.    Ink 0
  316.    Draw X+20,Y+2 To X+20,Y+12
  317.    Ink 1
  318.    Draw X+21,Y+2 To X+21,Y+12
  319.  
  320.    Ink 0
  321.    If POSSITION=1 Then Text(WIDTH-Len(CYCLE1$)*8)/2+X,Y+9,CYCLE1$
  322.    If POSSITION=2 Then Text(WIDTH-Len(CYCLE2$)*8)/2+X,Y+9,CYCLE2$
  323.    If POSSITION=3 Then Text(WIDTH-Len(CYCLE3$)*8)/2+X,Y+9,CYCLE3$
  324.    If POSSITION=4 Then Text(WIDTH-Len(CYCLE4$)*8)/2+X,Y+9,CYCLE4$
  325. End Proc
  326.  
  327.  
  328. Procedure TICKBOX[X,Y,TICK,ZHONENUMBER,SETUPZONE]
  329.    Rem ** X           = x possition of the box
  330.    Rem ** Y           = y possition of the box
  331.    Rem ** TICK        = whether the box displays a tick or not (True, or False) 
  332.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  333.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  334.  
  335.    Ink 1
  336.    Draw X,Y To X+23,Y
  337.    Draw X,Y To X,Y+10
  338.    Draw X+1,Y To X+1,Y+9
  339.    
  340.    Ink 0
  341.    Draw X+24,Y To X+24,Y+10
  342.    Draw X+23,Y+1 To X+23,Y+10
  343.    Draw X+1,Y+10 To X+22,Y+10
  344.  
  345.    If TICK=True
  346.       Ink 0
  347.       Plot X+6,Y+5
  348.       Plot X+7,Y+5
  349.       Plot X+8,Y+5
  350.       Plot X+7,Y+6
  351.       Plot X+8,Y+6
  352.       Plot X+9,Y+6
  353.       Plot X+8,Y+7
  354.       Plot X+9,Y+7
  355.       Plot X+10,Y+7
  356.       Plot X+11,Y+7
  357.       Plot X+12,Y+7
  358.       Plot X+9,Y+8
  359.       Plot X+10,Y+8
  360.       Plot X+11,Y+8
  361.       Plot X+12,Y+6
  362.       Plot X+13,Y+6
  363.       Plot X+13,Y+5
  364.       Plot X+14,Y+5
  365.       Plot X+14,Y+4
  366.       Plot X+15,Y+4
  367.       Plot X+15,Y+3
  368.       Plot X+16,Y+3
  369.       Plot X+16,Y+2
  370.       Plot X+17,Y+2
  371.       Plot X+18,Y+2
  372.    Else 
  373.       Ink 2
  374.       Bar X+2,Y+1 To X+21,Y+8
  375.    End If 
  376.  
  377.    If SETUPZONE=True
  378.       Set Zone ZHONENUMBER,X,Y To X+24,Y+10
  379.    End If 
  380. End Proc
  381.  
  382.  
  383. Procedure HEAVYICON[X,Y,WIDTH,HIGHT,EMBOSSED,ZHONENUMBER,SETUPZONE]
  384.    Rem ** X           = x possition of the box
  385.    Rem ** Y           = y possition of the box
  386.    Rem ** WIDTH       = width of the box    
  387.    Rem ** HIGHT       = height of the box   
  388.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  389.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any) 
  390.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  391.  
  392.    If EMBOSSED=False
  393.       Ink 1
  394.       Draw X,Y To X+WIDTH,Y
  395.       Draw X,Y To X,Y+HIGHT
  396.       Draw X+1,Y To X+1,Y+HIGHT-1
  397.    
  398.       Ink 0
  399.       Draw X+WIDTH+1,Y To X+WIDTH+1,Y+HIGHT
  400.       Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  401.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  402.    Else 
  403.       Ink 0
  404.       Draw X,Y To X+WIDTH,Y
  405.       Draw X,Y To X,Y+HIGHT
  406.       Draw X+1,Y To X+1,Y+HIGHT-1
  407.    
  408.       Ink 1
  409.       Draw X+WIDTH+1,Y To X+WIDTH+1,Y+HIGHT
  410.       Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  411.       Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT
  412.    End If 
  413.  
  414.    If SETUPZONE=True
  415.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  416.    End If 
  417. End Proc
  418.  
  419.  
  420. Procedure REAL3DWINDOW[X,Y,WIDTH,HIGHT,GADGET,TITLE$,BUTTON1$,BUTTON2$,WIDTHOFBUTTONS,BUTDISTEDGE]
  421.    Rem ** X              = x possition of the window  
  422.    Rem ** Y              = y possition of the window  
  423.    Rem ** WIDTH          = width of the window      
  424.    Rem ** HIGHT          = height of the window   
  425.    Rem ** GADGET         = whether the window has a close gadget or not (True, or False)  
  426.    Rem ** TITLE$         = the title of the window  
  427.    Rem ** BUTTON1$       = the first of the buttons (can just be "" for no button)  
  428.    Rem ** BUTTON2$       = the last of the buttons (if this is just "" then the first button will be centered)  
  429.    Rem ** WIDTHOFBUTTONS = the width of the Ok and Cancel buttons 
  430.    Rem ** BUTDISTEDGE    = the distance from the edge of the window that the buttons are drawn  
  431.  
  432.    Ink 2
  433.    Bar X+3,Y+11 To X+WIDTH-3,Y+HIGHT-2
  434.  
  435.    Ink 1
  436.    Draw X,Y+HIGHT To X,Y
  437.    Draw X,Y To X+WIDTH,Y
  438.    
  439.    Ink 0
  440.    Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT
  441.    Draw X+WIDTH,Y+HIGHT To X+1,Y+HIGHT
  442.    
  443.    Ink 0
  444.    Draw X+3,Y+HIGHT-1 To X+3,Y+10
  445.    Draw X+3,Y+10 To X+WIDTH-4,Y+10
  446.    
  447.    Ink 1
  448.    Draw X+WIDTH-3,Y+10 To X+WIDTH-3,HIGHT+Y-1
  449.    Draw X+WIDTH-3,HIGHT+Y-1 To X+4,Y+HIGHT-1
  450.    
  451.    Ink 3
  452.    Bar X+1,Y+1 To X+WIDTH-1,Y+9
  453.  
  454.    Bar X+1,Y+1 To X+2,Y+HIGHT-1
  455.    Bar X+WIDTH-2,Y+1 To X+WIDTH-1,Y+HIGHT-1
  456.  
  457.    If BUTTON1$<>""
  458.       If BUTTON2$=""
  459.          Proc HEAVYCLICKBOX[(WIDTH-WIDTHOFBUTTONS)/2+X,HIGHT+Y-17,WIDTHOFBUTTONS,13,False,BUTTON1$,0,False]
  460.       End If 
  461.    End If 
  462.  
  463.    If BUTTON2$<>""
  464.       Proc HEAVYCLICKBOX[X+BUTDISTEDGE,Y+HIGHT-19,WIDTHOFBUTTONS,13,False,BUTTON1$,0,False]
  465.       Proc HEAVYCLICKBOX[X+WIDTH-WIDTHOFBUTTONS-BUTDISTEDGE,Y+HIGHT-19,WIDTHOFBUTTONS,13,False,BUTTON2$,0,False]
  466.    End If 
  467.  
  468.    If GADGET=True
  469.       Paper 3
  470.       Ink 0
  471.       Text X+28,Y+7,TITLE$
  472.    Else 
  473.       Paper 3
  474.       Ink 0
  475.       Text X+4,Y+7,TITLE$
  476.    End If 
  477.  
  478.    If GADGET=True
  479.       Proc GADGET[X,Y,False]
  480.    End If 
  481. End Proc
  482.  
  483.  
  484. Procedure GADGET[X,Y,EMBOSSED]
  485.    Rem ** X        = x possition of the gadget  
  486.    Rem ** Y        = y possition of the gadget
  487.    Rem ** EMBOSSED = whether the gadget is embossed or not (True, or False) 
  488.  
  489.    If EMBOSSED=False
  490.       Proc BEVEL[X,Y,18,10,1,False,3]
  491.       Ink 1
  492.       Draw X+19,Y+1 To X+19,Y+9
  493.       Ink 0
  494.       Box X+7,Y+3 To X+11,Y+7
  495.       Ink 1
  496.       Paint X+8,Y+4
  497.    End If 
  498.    If EMBOSSED=True
  499.       Proc BEVEL[X,Y,18,10,1,True,2]
  500.       Ink 0
  501.       Box X+7,Y+3 To X+11,Y+7
  502.       Ink 2
  503.       Paint X+8,Y+4
  504.    End If 
  505. End Proc
  506.  
  507.  
  508. Procedure HEAVYCLICKBOX[X,Y,WIDTH,HIGHT,EMBOSSED,MESSAGE$,ZHONENUMBER,SETUPZONE]
  509.    Rem ** X           = x possition of the box  
  510.    Rem ** Y           = y possition of the box  
  511.    Rem ** WIDTH       = width of the box  
  512.    Rem ** HIGHT       = height of the box 
  513.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  514.    Rem ** MESSAGE$    = what text is centered inside the box (if any) 
  515.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any)   
  516.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  517.  
  518.    Set Pattern 0
  519.    If EMBOSSED=False
  520.       Ink 1
  521.       Draw X,Y To X,Y+HIGHT
  522.       Draw X,Y To X+WIDTH-1,Y
  523.       Draw X+1,Y To X+1,Y+HIGHT-1
  524.  
  525.       Ink 0
  526.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  527.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  528.       Draw X+WIDTH-1,Y+HIGHT To X+1,Y+HIGHT
  529.    Else 
  530.       Ink 0
  531.       Draw X,Y To X,Y+HIGHT
  532.       Draw X,Y To X+WIDTH-1,Y
  533.       Draw X+1,Y To X+1,Y+HIGHT-1
  534.  
  535.       Ink 1
  536.       Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  537.       Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT
  538.       Draw X+WIDTH-1,Y+HIGHT To X+1,Y+HIGHT
  539.    End If 
  540.    If SETUPZONE=True
  541.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  542.    End If 
  543.  
  544.    Ink 0
  545.    Text(WIDTH-Len(MESSAGE$)*8)/2+X,(Y+HIGHT/2)+3,MESSAGE$
  546. End Proc
  547.  
  548.  
  549. Procedure BEVEL[X,Y,WIDTH,HIGHT,ISITFILLED,EMBOSSED,_FILLCOLOUR]
  550.    Rem ** X           = x possition of the box  
  551.    Rem ** Y           = y possition of the box  
  552.    Rem ** WIDTH       = width of the box  
  553.    Rem ** HIGHT       = height of the box 
  554.    Rem ** ISITFILLED  = whether the box is filled or not (True, or False) 
  555.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  556.    Rem ** _FILLCOLOUR = the colour the box is filled with 
  557.  
  558. If EMBOSSED=False
  559.    Ink 1
  560.    Draw X,Y+HIGHT To X,Y
  561.    Draw X,Y To X+WIDTH,Y
  562.  
  563.    Ink 0
  564.    Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  565.    Draw X+WIDTH,Y+HIGHT To X,Y+HIGHT
  566. Else 
  567.    Ink 0
  568.    Draw X,Y+HIGHT To X,Y
  569.    Draw X,Y To X+WIDTH,Y
  570.  
  571.    Ink 1
  572.    Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT
  573.    Draw X+WIDTH,Y+HIGHT To X,Y+HIGHT
  574. End If 
  575.  
  576. If ISITFILLED=1
  577.    Ink _FILLCOLOUR
  578.    Bar X+1,Y+1 To X+WIDTH-1,Y+HIGHT-1
  579. Else 
  580.  
  581. End If 
  582. End Proc
  583.  
  584.  
  585. Procedure CLICKBOX[X,Y,WIDTH,HIGHT,EMBOSSED,MESSAGE$,ZHONENUMBER,SETUPZONE]
  586.    Rem ** X           = x possition of the box  
  587.    Rem ** Y           = y possition of the box  
  588.    Rem ** WIDTH       = width of the box  
  589.    Rem ** HIGHT       = height of the box 
  590.    Rem ** EMBOSSED    = whether the box is embossed or not (True, or False) 
  591.    Rem ** MESSAGE$    = what text is centered inside the box (if any) 
  592.    Rem ** ZHONENUMBER = the number of the zone to be defined (if any)   
  593.    Rem ** SETUPZONE   = whether a zone is set up (True, or False) 
  594.  
  595.    Set Pattern 0
  596.    Proc BEVEL[X,Y,WIDTH,HIGHT,1,EMBOSSED,2]
  597.  
  598.    If SETUPZONE=True
  599.       Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT
  600.    End If 
  601.  
  602.    Ink 0
  603.    Text(WIDTH-Len(MESSAGE$)*8)/2+X,(Y+HIGHT/2)+3,MESSAGE$
  604. End Proc
  605.  
  606.  
  607. Procedure INITIALISE
  608.    Default Palette $0,$FFF,$AAA,$68B
  609.    Screen Open 1,640,256,4,Hires
  610.    Curs Off : Flash Off : Gr Writing 0
  611.  
  612.    Limit Mouse 128,42 To 447,297
  613.  
  614.    Cls 2
  615.    Proc SCREANTITLE["An example screen"]
  616. End Proc
  617.  
  618.  
  619. Procedure SCREANTITLE[SCREANTITLE$]
  620.    Rem ** SCREANTITLE$ = title of the scren 
  621.  
  622.    Gr Writing 0
  623.    Proc BEVEL[0,0,639,10,1,False,1]
  624.    Ink 0
  625.    Text 4,7,SCREANTITLE$
  626. End Proc
  627.  
  628.  
  629. Procedure FINDMOUSELIMIT[X_WINDOW,Y_WINDOW,WIDTH,HIGHT,X_MOUSE,Y_MOUSE]
  630.    Rem ** X_WINDOW = x possition of the window  
  631.    Rem ** Y_WINDOW = y possition of the window  
  632.    Rem ** WIDTH    = width of the window
  633.    Rem ** HIGHT    = height of the window 
  634.    Rem ** X_MOUSE  = x possition of the mouse 
  635.    Rem ** Y_MOUSE  = y possition of the mouse 
  636.  
  637.    Limit Mouse X Hard(0+X_MOUSE-X_WINDOW),Y Hard(0+Y_MOUSE-Y_WINDOW) To X Hard(639-WIDTH-X_WINDOW+X_MOUSE+1),Y Hard(255-HIGHT-Y_WINDOW+Y_MOUSE+1)
  638. End Proc
  639.  
  640.  
  641. Procedure DRAGTHEWINDOW[X,Y,WIDTH,HIGHT,ZHONENUMBER]
  642.    Rem ** X           = x possition of the box  
  643.    Rem ** Y           = y possition of the box  
  644.    Rem ** WIDTH       = width of the box  
  645.    Rem ** HIGHT       = height of the box 
  646.    Rem ** ZHONENUMBER = the number of the zone that is on the title bar 
  647.  
  648.    Get Block 2,X,Y,WIDTH-1,HIGHT : Rem Grabs the window 
  649.  
  650.    _ORIGINALX=X Screen(X Mouse) : Rem This is where the mouse first was when clicked (x coord) 
  651.    _ORIGINALY=Y Screen(Y Mouse) : Rem This is where the mouse first was when clicked (y coord) 
  652.  
  653.    Gr Writing 2 : Rem This line means all drawn objects will be in the opposite colour to whats under them (for the drag box)  
  654.  
  655.    Proc FINDMOUSELIMIT[X,Y,WIDTH,HIGHT,_ORIGINALX,_ORIGINALY] : Rem Finds the mouse limit of the box (so it can go off screen) 
  656.  
  657.    Repeat 
  658.       DRAGX=X+X Screen(X Mouse)-_ORIGINALX : Rem DRAGX is the new x coord for the drag box  
  659.       DRAGY=Y+Y Screen(Y Mouse)-_ORIGINALY : Rem DRAGY is the new y coord for the drag box
  660.  
  661.       Wait Vbl : Rem Wait for monitor sync (stops flicker, almost!) 
  662.       Box DRAGX,DRAGY To DRAGX+WIDTH-1,DRAGY+HIGHT-1 : Rem Draw the drag box  
  663.       Wait Vbl 
  664.       Box DRAGX,DRAGY To DRAGX+WIDTH-1,DRAGY+HIGHT-1 : Rem Undraw the drag box
  665.  
  666.    Until Mouse Key=0 : Rem Repeat until the user releases the mousebutton 
  667.  
  668.    Gr Writing 0 : Rem Turn inverse colour off
  669.    Put Block 1,X,Y : Rem put back what was under the window 
  670.  
  671.    Get Block 1,DRAGX,DRAGY,WIDTH,HIGHT
  672.    Put Block 2,DRAGX,DRAGY : Rem Put the window back after drag 
  673.  
  674.    X=DRAGX : Rem Make X the same as DRAGX 
  675.    Y=DRAGY : Rem Make y the same as DRAGY 
  676.  
  677.    Limit Mouse 128,42 To 447,297 : Rem turn off the mouse limiting
  678.    Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+11 : Rem This sets up the zone at its new possition 
  679. End Proc
  680. Rem --- End of library 
  681.  
  682. Rem Not all the functions have been used in this example,
  683. Rem I have left them for you to discover for yourself...