home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk463.lzh / FileIO / FileIO.lzh / asm / CustomList.asm next >
Assembly Source File  |  1991-02-08  |  19KB  |  654 lines

  1. ;Set your editor's TAB width to 3
  2.  
  3.  ;====Uncomment these directives for MANX asm only!! Advice: Buy a good asm.
  4.  ; far   code ;so that we can use register a4, and no limit on program size.
  5.  ; far   data
  6.  
  7.     ADDSYM
  8.     SMALLOBJ ;CAPE PC directive. Comment out if not using CAPE
  9.     OBJFILE    "rad:CustomList.o"
  10.  
  11. ; This program opens and utilizes the requester.library in order to use
  12. ; the new SPECIAL_REQ flag. This flag allows us to display a list of
  13. ; strings in a requester with all the features of the FileIO requester.
  14. ; Because version 0 of the library did not support this feature, but version
  15. ; 1.? now does, we must open the library with version #1. Old applications
  16. ; that do not know about SPECIAL_REQ will still work with this version of
  17. ; the library. It is backward compatible as far as the disk IO features are
  18. ; concerned. This program also demos how to use the StartHandler custom
  19. ; vector to add gadgets to the requester, the GadgetHandler custom vector to
  20. ; handle those gadgets, and how to alter the wakeup mask so that the
  21. ; StartHandler is called for these events (i.e. in case you want to be able
  22. ; to also handle a msg at another port in addition to window IDCMP msgs).
  23. ; You can also use these custom handlers in this manner when doing normal
  24. ; filename selection with the requester.
  25.  
  26. ; If running this program from the CLI and you specify any argument on the
  27. ; command (i.e.  1> TestFileIO blort ), then the window will open on a hires
  28. ; screen. You can then see what the requester looks like in hires.
  29.  
  30. ;  For Manx,   ln -o TestFileIO  ManxStartUp.o  main.o  cl32.lib
  31. ;
  32. ;  For Others, Blink StartUp.o main.o amiga.lib NODEBUG to TestFileIO
  33.  
  34.     INCLUDE    "rad:FileIO.i"
  35.  
  36.     ;======Amiga Library routines======
  37.     XREF    _LVOCloseLibrary,_LVOCloseScreen,_LVOCloseWindow,_LVOSetMenuStrip
  38.     XREF    _LVOOpenWindow,_LVOOpenScreen,_LVOOpenLibrary
  39.     XREF    _LVOGetMsg,_LVOReplyMsg,_LVOWait,_LVOMove,_LVOText
  40.     XREF    _LVOSetAPen,_LVOSetBPen,_LVOSetDrMd
  41.  
  42.     ;======From the startup code======
  43.     XREF    _SysBase,_DOSBase
  44.  
  45. LIB_VERSION    equ    33
  46.  
  47.     SECTION    FileIOTestCode,CODE
  48.  
  49.     XDEF    _main
  50. _main:
  51.         movem.l    d2-d7/a2-a6,-(sp)
  52.         movea.l    _SysBase,a6
  53. ;======Open The Intuition Library=======
  54.         moveq        #LIB_VERSION,d0
  55.         lea        IntuitionName,a1
  56.         jsr        _LVOOpenLibrary(a6)
  57.         lea        _IntuitionBase,a4
  58.         move.l    d0,(a4)+
  59.         beq        C7
  60. ;======Open The Graphics Library========
  61.         moveq        #LIB_VERSION,d0
  62.         lea        GfxName,a1
  63.         jsr        _LVOOpenLibrary(a6)
  64.         move.l    d0,(a4)+
  65.         beq        C6
  66. ;*******Open the "Brand New, Improved, Exciting" Requester library*********
  67.         moveq        #1,d0                ;version #1 please
  68.         lea        RequesterName,a1
  69.         jsr        _LVOOpenLibrary(a6)
  70.         move.l    d0,(a4)+
  71.         beq        C5
  72. ;=====If started from WBench, then don't open a CUSTOM screen
  73.         movea.l    _IntuitionBase,a6
  74.         move.l    52(sp),d0
  75.         beq.s        .9
  76. ;=====If opened from CLI with any argument, then open CUSTOM screen
  77.         subq.l    #2,48(sp)
  78.         bcs.s        .9
  79.         lea        newScreen,a0
  80.         jsr        _LVOOpenScreen(a6)
  81.         lea        newWindow,a0
  82.     ;---Window's Screen = ScreenPtr
  83.         move.l    d0,30(a0)
  84.         beq.s        .9A            ;If an error, forget the screen!
  85.     ;---Window's Type = CUSTOMSCREEN
  86.         move.w    #15,46(a0)
  87. ;=========Open the FileIO window==========
  88. .9        lea        newWindow,a0
  89. .9A    jsr        _LVOOpenWindow(a6)
  90.         move.l    d0,(a4)+
  91.         beq        C2
  92.         movea.l    d0,a3
  93.     ;---Get Window's RastPort
  94.         move.l    50(a3),(a4)
  95.         lea        ProjectMenu,a1
  96.         movea.l    a3,a0
  97.         jsr        _LVOSetMenuStrip(a6)
  98. ;---Get a FileIO structure
  99. E1        movea.l    _RequesterBase,a6
  100.         jsr        _LVOGetFileIO(a6)
  101.         movea.l    d0,a4
  102.         move.l    d0,d1
  103.         beq        IOe        ;If NULL, then error, so exit this test program.
  104. ;---Set Colors and DrawMode
  105.         moveq        #1,d0
  106.         move.b    d0,FILEIO_DRAWMODE(a4)
  107.         movea.l    RastPort,a2
  108.         movea.l    a2,a1
  109.         movea.l    _GfxBase,a6
  110.         jsr        _LVOSetDrMd(a6)
  111.         moveq        #2,d0
  112.         move.b    d0,FILEIO_PENA(a4)
  113.         movea.l    a2,a1
  114.         jsr        _LVOSetAPen(a6)
  115.         moveq        #0,d0
  116.         move.b    d0,FILEIO_PENB(a4)
  117.         movea.l    a2,a1
  118.         jsr        _LVOSetBPen(a6)
  119. ;====VERY IMPORTANT: Indicate that we want a SPECIAL_REQ==========
  120.         bset.b    #7,(a4)  ;set the SPECIAL_REQ bit of Flags
  121. ;====Set up the XY co-ordinates of where the requester will open====
  122.         moveq        #6,d0
  123.         move.w    d0,FILEIO_X(a4)    ;x position
  124.         moveq        #11,d0
  125.         move.w    d0,FILEIO_Y(a4)    ;y position
  126. ;===========SET UP OUR LIST OF STRINGS==========
  127. ;NOTE: Since our list is initially empty, we don't have to call NewEntryList
  128. ;first, but we will anyway to develop good habits.
  129.         movea.l    _RequesterBase,a6
  130.         movea.l    a4,a1
  131.         jsr        _LVONewEntryList(a6)
  132.         lea        StringAddr,a2
  133.         moveq        #10-1,d7            ;make a list of 10 strings
  134. nxtEN    move.l    d7,d1
  135.         addq.w    #1,d1                ;ID = loopcount+1 (i.e. 1 to 10)
  136.         movea.l    a4,a1
  137.         movea.l    (a2)+,a0
  138.         jsr        _LVOAddEntry(a6)
  139.         dbra        d7,nxtEN
  140. ;---Set up our routine, Information(), as the custom FileIO gadget routine
  141. ;   We don't have to set up these 2 fields, we could leave them 0 in which
  142. ;   case the custom gadget is ignored.
  143.         lea        About,a0
  144.         move.l    a0,FILEIO_TEXT(a4)
  145.         lea        Information,a0
  146.         move.l    a0,FILEIO_ROUTINE(a4)
  147. ;---Add our Custom vectors (i.e. for StartHandler and GadgetHandler)
  148.         lea        HandlerBlock,a0
  149.         move.l    a0,FILEIO_CUSTOM(a4)
  150.         bset.b    #CUSTOM_HANDLERS-8,(a4)
  151. ;====Create a mask of the Window's UserPort's mp_Sigbit=====
  152. E3        movea.l    86(a3),a0
  153.         move.b    15(a0),d0
  154.         moveq        #0,d7
  155.         Bset.l    d0,d7
  156. ;=====Get the message that arrived at our UserPort====
  157. E4        movea.l    86(a3),a0
  158.         movea.l    _SysBase,a6
  159.         jsr        _LVOGetMsg(a6)
  160.         move.l    d0,d1
  161.         bne.s        E7
  162. ;===Check if we are ready to exit the program=====
  163. E5        Btst.b    #0,Quit
  164.         beq        E15
  165. ;---Print out "Click Mouse to start demo....
  166.         movea.l    RastPort,a2
  167.         moveq        #5,d0
  168.         moveq        #75,d1
  169.         movea.l    a2,a1                ;our window's RastPort
  170.         move.l    a6,-(sp)            ;save _SysBase
  171.         movea.l    _GfxBase,a6
  172.         jsr        _LVOMove(a6)
  173.         moveq        #36,d0            ;# of bytes to output.
  174.         lea        Click,a0
  175.         movea.l    a2,a1
  176.         jsr        _LVOText(a6)
  177.         movea.l    (sp)+,a6            ;restore _SysBase
  178. ;===Wait for a message sent to our Window (from Intuition)===
  179. E6        move.l    d7,d0
  180.         jsr        _LVOWait(a6)
  181.         bra.s        E4
  182. ;====Copy all the info we want from the IntuiMessage====
  183. E7        movea.l    d0,a1
  184.         lea        20(a1),a0    ;get the address of the first field to copy.
  185.         move.l    (a0)+,d6        ;Class field to d6
  186.         move.w    (a0)+,d5        ;Code field to d5
  187.         move.w    (a0)+,d4        ;Qualifier field to d4
  188.         movea.l    (a0)+,a2        ;IAddress field to a2
  189.         move.w    (a0)+,d3        ;MouseX position to d3
  190.         move.w    (a0)+,d2        ;MouseY position to d2
  191. ;====Now reply to the message so Intuition can dispose of it
  192. E8        ;Address of the message is in a1.
  193.         jsr        _LVOReplyMsg(a6)
  194. ;========switch (class)=========
  195.         Bclr.l    #9,d6        ;CLOSEWINDOW
  196.         bne.s        CW
  197.         Bclr.l    #8,d6        ;MENUPICK
  198.         bne.s        MU
  199.         Bclr.l    #3,d6        ;MOUSEBUTTONS
  200.         beq        E4
  201. ;---Make sure that it's an UP select if MOUSEBUTTONS
  202.         subi.b    #$68,d5
  203.         beq        E4            ;ignore down
  204. ;===The FOLLOWING ROUTINE IS OUR TEST CALL. WHEN THE USER IS DONE (in FileIO lib)
  205. ;===HE WILL SELECT EITHER THE CANCEL OR OK! GADGET. IF CANCEL, TestFileIO
  206. ;===DOES NOTHING. IF OK!, TestFileIO JUSTS PRINTS THE SELECTED STRING.
  207. E2        bsr        TestFileIO
  208.         bra        E4
  209. ;=========case CLOSEWINDOW:============
  210. CW        Bclr.b    #0,Quit
  211.         bra        E4
  212. ;=========case MENUPICK:==============
  213.     ;---Determine which item
  214. MU        lsr.w        #5,d5            ;Shift the item # bits into lowest bits of reg.
  215.         andi.w    #$3F,d5        ;Isolate the Item # from the Menu and subitem #.
  216.         bne        E4
  217.     ;---Set MULTIPLE_FILES
  218.         bchg.b    #MULTIPLE_FILES,1(a4)
  219.         bra        E4
  220. ;======if an error, indicate NO_MEMORY. This is a FileIO routine
  221. ;======and is callable even if GetFileIO() fails
  222. IOe    movea.l    a3,a0
  223.         moveq        #0,d0
  224.         movea.l    _RequesterBase,a6
  225.         jsr        _LVOAutoFileMessage(a6)
  226. ;========NOW BEGINS OUR EXIT ROUTINE=========
  227.  ;ReleaseFileIO will free our list of strings
  228. E15    movea.l    a4,a1                ;If the pointer to FileIO was NULL, then
  229.         movea.l    _RequesterBase,a6    ;ReleaseFileIO just returns, so it's safe to
  230.         jsr        _LVOReleaseFileIO(a6) ;always release any return value of GetFileIO.
  231. ;=====Close the Window and Screen======
  232. C1        movea.l    _IntuitionBase,a6
  233.         movea.l    a3,a0
  234.         jsr        _LVOCloseWindow(a6)
  235. C2        move.l    ScreenPtr,d0
  236.         beq.s        C3            ;check if we specified a screen
  237.         movea.l    d0,a0
  238.         ; _IntuitionBase in a6
  239.         jsr        _LVOCloseScreen(a6)
  240. ;=====Close Whichever Libs are Open (_SysBase in a6 for ALL calls)=====
  241. C3        movea.l    _SysBase,a6
  242.         movea.l    _RequesterBase,a1
  243.         jsr        _LVOCloseLibrary(a6)
  244. C5        movea.l    _GfxBase,a1
  245.         jsr        _LVOCloseLibrary(a6)
  246. C6        movea.l    _IntuitionBase,a1
  247.         jsr        _LVOCloseLibrary(a6)
  248. C7        movem.l    (sp)+,d2-d7/a2-a6
  249.         rts
  250.  
  251. ;*******************************************
  252. ; This just calls the DoFileIO library routine and displays a msg on return.
  253. ; (We must have a FileIO structure).
  254. ; The DoFileIO routine returns -1 if the user selected CANCEL, -2 if the
  255. ; library is in use by another task, or returns non-zero if OK! was selected.
  256. ; At this point, if the user selected OK, our FILEIO_FILENAME buffer will
  257. ; contain the selected string and FILEIO_FILESIZE will be the ID.
  258. ;
  259. ;    TestFileIO(FileIO, window)
  260. ;                    a4            a3
  261.  
  262. typename:
  263. ;--This shows what would happen (automatically) if the lib was in use on a
  264. ;  call to DoFileIO(), or the requester couldn't open.
  265.  
  266. .error:
  267.         lea        errmsg,a0
  268. prt    move.l    a0,d0
  269.         movea.l    a3,a0
  270.         jsr        _LVOAutoMessage(a6)
  271.         moveq        #0,d0
  272.         rts
  273. .can    lea        cancel,a0
  274.         bra.s        prt
  275. .inuse:
  276.         lea        inuse,a0
  277.         bra.s        prt
  278.  
  279.    XDEF TestFileIO
  280. TestFileIO:
  281.         movea.l    _RequesterBase,a6
  282.     ;---DoFileIO(FileIO, window)
  283.         movea.l    a3,a1
  284.         movea.l    a4,a0
  285.         jsr        _LVODoFileIO(a6)
  286.         move.l    d0,d1
  287.         beq.s        .error
  288. ;Must have been an error if returned 0. If we were using DoFileIOWindow(),
  289. ;the window might not have opened. Or the requester might not have opened.
  290. ;We could check the FileIO's ERRNO field to see what the specific error was.
  291.         addq.l    #1,d1
  292.         beq.s        .can        ;If -1, user must have selected CANCEL
  293.         addq.l    #1,d1
  294.         beq.s    .inuse    ;If -2, the library was in use
  295.  ;---AutoMessage(string, window)  Display our chosen string.
  296.         ;Filename buffer address in d0
  297.         movea.l    a3,a0
  298.         jsr        _LVOAutoMessage(a6)
  299.  ;---If ID = -1 then user must have typed a string not in the list
  300.         move.l    FILEIO_FILESIZE(a4),d0  ;this is the ID of the chosen field
  301.         bpl.s        out1
  302.         movea.l    a3,a0
  303.         lea        NotIn,a1
  304.         move.l    a1,d0
  305.         jsr        _LVOAutoMessage(a6)
  306.     ;---Did our custom routine end the requester?
  307. out1    moveq        #ERR_APPGADG,d0
  308.         sub.b        FILEIO_ERRNO(a4),d0
  309.         bne.s        out2
  310.         movea.l    a3,a0
  311.         lea        AppCan,a1
  312.         move.l    a1,d0
  313.         jsr        _LVOAutoMessage(a6)
  314.     ;---If MULTIPLE_FILES, display all selected entries
  315. out2    btst.b   #MULTIPLE_FILES,1(a4)
  316.         beq.s    out3
  317.         clr.l    -(sp)      ;zero our PTR to a FileEntry
  318. morFL    movea.l  sp,a0
  319.         movea.l  a4,a1
  320.         jsr      _LVORetrieveEntry(a6)
  321.         move.l   d0,d1
  322.         beq.s    last
  323.         movea.l  d0,a0
  324.         move.l   8(a0),d0   ;get the Entry structure
  325.         addq.l   #5,d0      ;get the EntryString address
  326.         movea.l  a3,a0
  327.         jsr      _LVOAutoMessage(a6)
  328.         bra.s    morFL
  329. last    addq.l   #4,sp
  330. out3    moveq        #1,d0
  331.         rts
  332.  
  333. ;=====================================================================
  334. ;Our routine for the custom FileIO gadget. Lib passes our FileIO in a2
  335. ;and Window in a3. This returns the BOOL value from AutoPrompt3 so that
  336. ;if the user selects YES (TRUE) the requester ends. Note that it is permiss-
  337. ;ible to change the FILEIO_TEXT and FILEIO_ROUTINE fields in which case these
  338. ;will become effective upon return from here.
  339.  
  340.     XDEF    Information
  341. Information:
  342.         movem.l    a2/a3,-(sp)
  343.         movea.l    a3,a0
  344.         lea        Msg1,a1
  345.         lea        Msg2,a2
  346.         lea        Msg3,a3
  347.         movea.l    _RequesterBase,a6
  348.         jsr        _LVOAutoPrompt3(a6)
  349.         movem.l    (sp)+,a2/a3
  350.         rts
  351.  
  352. ;========================================================================
  353. ; This is our StartHandler. The library calls this once after the requester
  354. ; is up and been displayed. We are passed the requester's window in a3, the
  355. ; FileIO in a2, the Requester in a5, and the WakeupMask in d0. At this point,
  356. ; we could modify RequesterBase's WakeupMask field so that we can be woken up
  357. ; when some other event besides window IDCMP happens. (i.e. If we wanted to
  358. ; handle messages received at some port while the requester is open, we would
  359. ; set the port's mp_SigBit in WakeupMask the first time into this function.
  360. ; How do we know that this is the first time into this function? WakeupMask=0.
  361. ; Now, whenever a msg is received at that port, this function will be called.
  362. ; The port's mp_SigBit of WakeupMask should be set. We can then get, handle,
  363. ; and reply the msg from here.)
  364. ;
  365. ; This routine should return a 0 to redraw the display, a 1 to not redraw the
  366. ; display, or a -1 to end the requester. Note that if we end the requester,
  367. ; we should probably set the FILEIO_ERRNO field to some value that will tip
  368. ; us off that this routine ended the requester.
  369.  
  370. start_msg:
  371.     ;---Is this the first time in this function? If so, add a few of our own
  372.     ;     gadgets to the req. We could also modify WakeupMask if we had some
  373.     ;     other ports to wait on.
  374.         move.l    d0,d1
  375.         bne.s        _2nd
  376.         lea        BoolGadg,a0
  377.         ;req in a5, window in a3
  378.         movea.l    _RequesterBase,a6
  379.         jsr        _LVOAddFileGadgs(a6)
  380.     ;---If we had some port called Blort, we might do this here
  381.     ;    movea.l    BlortPortAddr,a0    ;get our port address
  382.     ;    move.b    15(a0),d0            ;get it's wakeup bit # (assuming PA_SIGNAL)
  383.     ;    movea.l    _RequesterBase,a6
  384.     ;  move.l    ReqWakeupMask(a6),d1
  385.     ;    bset.l    d0,d1                    ;set that bit of WakeupMask
  386.     ;    move.l    d1,ReqWakeupMask(a6)
  387. notme    moveq        #0,d0
  388.         rts
  389. ;=====================================================
  390.     ;---Note: If we had modified WakeUpMask as above, we would do this
  391. _2nd:
  392.     ;    movea.l    BlortPortAddr,a0
  393.     ;    move.b    15(a0),d1
  394.     ;    btst.l    d1,d0
  395.     ;    beq.s        notme            ;Who woke us up besides the Window or Blort port??
  396. moreMsgs:
  397.     ;    movea.l    BlortPortAddr,a0
  398.     ;    movea.l    _SysBase,a6
  399.     ;    jsr        _LVOGetMsg(a6)
  400.     ;    move.l    d0,myMsg
  401.     ;    beq.s        notme
  402.     ;now do something with the msg
  403.     ;    movea.l    myMsg,a1
  404.     ;    movea.l    _SysBase,a6
  405.     ;    jsr        _LVOReplyMsg(a6)
  406.         bra        notme
  407.  
  408. ;========================================================================
  409. ; This is our GadgetHandler. The library calls this whenever the user selects
  410. ; those gadgets we added in StartHandler. We are passed the following:
  411. ;
  412. ;gadgAddr in a4
  413. ;gadgID in d0
  414. ;MouseX in d6
  415. ;MouseY in d7
  416. ;secs   in d2
  417. ;micros in d5
  418. ;FileIO in a2
  419. ;Window in a3
  420. ;Requester in a5
  421. ;Note that we should not use gadgIDs above 32673 as these are
  422. ;reserved by the requester.
  423.  
  424.         XREF    _LVORefreshGadgets
  425.  
  426. do_gadg:
  427.         tst.w        d0
  428.         bne.s        gadg2
  429.     ;---Our BOOL Gadget (just "flip" the text between ON/OFF)
  430.         lea        ON,a0
  431.         bchg.b    #0,GadgFlags
  432.         bne.s        itsOn
  433.         lea        OFF,a0
  434. itsOn    move.l    a0,GadgStr
  435.     ;---We're responsible for refreshing our own gadgets
  436.         move.l    a2,-(sp)
  437.         movea.l    a5,a2
  438.         movea.l    a3,a1
  439.         lea        BoolGadg,a0
  440.         movea.l    _IntuitionBase,a6
  441.         jsr        _LVORefreshGadgets(a6)
  442.         movea.l    (sp)+,a2
  443. gok    moveq        #0,d0        ;don't end the requester
  444.         rts
  445.     ;---Our String Gadget
  446. gadg2:
  447.         ;I can't think of anything to do with the text that the user just typed
  448.         ;in, but maybe you can.
  449.         bra        gok
  450.  
  451.     ;SECTION MainData,DATA  ;Not needed for CAPE PC relative addressing!!
  452.  
  453.    XDEF _IntuitionBase,_GfxBase,ScreenPtr,_RequesterBase
  454.  ;must be in this order
  455. _IntuitionBase    dc.l 0
  456. _GfxBase            dc.l 0
  457. _RequesterBase    dc.l 0
  458. window            dc.l 0
  459. RastPort            dc.l 0
  460.  
  461.     XDEF    newScreen
  462. newScreen:
  463.     dc.w   0,0            ;LeftEdge, TopEdge
  464.     dc.w   640,400        ;Width, Height
  465.     dc.w   2                ;Depth
  466.     dc.b   0,1            ;Detail, Block pens
  467.     dc.w   -32764        ;ViewPort Modes HIRES|LACE (must set/clr HIRES as needed)
  468.     dc.w   15            ;CUSTOMSCREEN
  469.     dc.l   TextAttr    ;Font
  470.     dc.l   ScrTitle
  471.     dc.l   0                ;Gadgets
  472.     dc.l   0                ;CustomBitmap
  473.  
  474.    XDEF   newWindow
  475. newWindow:
  476.             dc.w   30,30,306,145
  477.             dc.b   0,1
  478.  ;IDCMP = MOUSEBUTTONS|CLOSEWINDOW|MENUPICK
  479.             dc.l   $308
  480.  ;WindowFlags = WINDOWDRAG|WINDOWDEPTH|SMART_REFRESH|ACTIVATE|WINDOWSIZE
  481.  ;(no FOLLOWMOUSE allowed as that messes up the requester when using
  482.  ;DoFileIO(). If you need FOLLOWMOUSE, then use DoFileIOWindow() to open
  483.  ;the req in its own window.)
  484.             dc.l   $100F
  485.             dc.l   0
  486.             dc.l   0
  487.             dc.l   WINTITLE
  488. ScreenPtr:
  489.             dc.l   0
  490.             dc.l   0
  491.             dc.w   306,145,600,240
  492.             dc.w   1        ;WBENCHSCREEN
  493.  
  494. ;==========THE PROJECT MENU===========
  495.  
  496. ProjectMenu:
  497.     dc.l 0
  498.     dc.w 0,0
  499.     dc.w 90,0
  500.     dc.w 1
  501.     dc.l ProjectTitle
  502.     dc.l MultiItem
  503.     dc.w 0,0,0,0
  504.  
  505.  ;These are MenuItem structures for the preceding Menu Structure.
  506. MultiItem    dc.l 0
  507.                 dc.w 0,0
  508.                 dc.w 200,10
  509.                 dc.w $5F
  510.                 dc.l 0
  511.                 dc.l MultiText
  512.                 dc.l 0
  513.                 dc.b 'M'
  514.                 dc.b 0
  515.                 dc.l 0
  516.                 dc.w 0
  517. MultiText    dc.b 0,1,1,0
  518.                 dc.w 19,0
  519.                 dc.l TextAttr,MultiString,0
  520.  
  521. TextAttr:        ;Topaz 8 is a ROM font so doesn't need to be opened
  522.     dc.l    FONTNAME
  523.     dc.w    8        ;TOPAZ_EIGHTY
  524.     dc.b    0,0
  525.  
  526. ;For custom vectors StartHandler and GadgetHandler
  527. HandlerBlock:
  528.  ;these are the addresses of my custom handlers for the requester's
  529.  ;REQSET, GADGETUP and GADGETDOWN, DISKINSERTED, RAWKEY, and
  530.  ;MOUSEMOVE respectively. Note that I only installed a StartHandler and
  531.  ;GadgetHandler. The rest are NULL because I don't care about them.
  532.     dc.l    start_msg    ;StartUpHandler
  533.     dc.l    do_gadg        ;GadgetHandler
  534.     dc.l    $0000            ;NewDiskHandler
  535.     dc.l    $0000            ;KeyHandler
  536.     dc.l    $0000            ;MouseMoveHandler
  537.  
  538. ;========== Two gadgets to add to the req (a BOOL and String) ===========
  539.  
  540. ;Bool Gadget
  541. BoolGadg:
  542.         dc.l    StrGadg
  543.         dc.w    70,83,61,11,0
  544.         dc.w    1
  545.         dc.w    $1001                ;REQGADGET|BOOLGADGET
  546.         dc.l    BoolBorder,0,BoolGadgText,0
  547.         dc.l    0
  548.         dc.w    0
  549.         dc.l    0
  550.  
  551. BoolGadgText:
  552.         dc.b   0,1,1,0
  553.         dc.w   8,2
  554.         dc.l   TextAttr
  555. GadgStr:
  556.         dc.l   OFF
  557.         dc.l   0
  558.  
  559. BoolPts:
  560.        dc.w  60,10,60,0,0,0,0,10,61,10,61,1,62,1,62,11,1,11
  561.  
  562. BoolBorder:
  563.         dc.w    0,0
  564.         dc.b    0,1
  565.         dc.b    0
  566.         dc.b    9
  567.         dc.l    BoolPts
  568.         dc.l    0
  569.  
  570. ;String Gadget
  571. StrGadg:
  572.         dc.l    0
  573.         dc.w    70,99,202,10,0,1,$1004
  574.         dc.l    StrBorder,0,StrGadgText,0
  575.         dc.l    StrInfo
  576.         dc.w    1
  577.         dc.l    0
  578.  
  579. StrBorder:
  580.         dc.w    0,0
  581.         dc.b    0,1
  582.         dc.b    0,9
  583.         dc.l    StringPts
  584.         dc.l    0
  585.  
  586. StringPts:
  587.         dc.w    0,-1,199,-1,200,0,200,7,199,8,0,8,-1,7,-1,0,0,-1
  588.  
  589. StrGadgText:
  590.         dc.b   0,1,1,0
  591.         dc.w   -52,0
  592.         dc.l   TextAttr
  593.         dc.l   String
  594.         dc.l   0
  595.  
  596. StrInfo:
  597.         dc.l   StringBuf
  598.         dc.l   0
  599.         dc.w   0,40,0,0,0,0,0,0
  600.         dc.l   0,0,0
  601.  
  602. StringBuf    ds.b    40
  603.  
  604. ;For our list of strings to display
  605. StringAddr:
  606.     dc.l  Ten
  607.     dc.l  Nine
  608.     dc.l  Eight
  609.     dc.l  Seven
  610.     dc.l  Six
  611.     dc.l  Five
  612.     dc.l  Four
  613.     dc.l  Three
  614.     dc.l  Two
  615.     dc.l  One
  616. Ten    dc.b 'Ten',0
  617. Nine    dc.b 'Nine',0
  618. Eight    dc.b 'Eight',0
  619. Seven    dc.b 'Seven',0
  620. Six    dc.b 'Six',0
  621. Five    dc.b 'Five',0
  622. Four    dc.b 'Four',0
  623. Three    dc.b 'Three',0
  624. Two    dc.b 'Two',0
  625. One    dc.b 'And this is One',0
  626.  
  627. Quit    dc.b 1    ;When this is a 0, the user wants to exit.
  628.  
  629. ScrTitle            dc.b 'Example FileIO Program Screen',0
  630. WINTITLE            dc.b 'Example FileIO Program Window',0
  631. Click                dc.b 'Click mouse for demo or CLOSEWINDOW.',0
  632. IntuitionName    dc.b 'intuition.library',0
  633. DOSName            dc.b 'dos.library',0
  634. GfxName            dc.b 'graphics.library',0
  635. RequesterName    dc.b 'requester.library',0
  636. FONTNAME            dc.b 'topaz.font',0
  637. errmsg            dc.b 'Error in opening the requester',0
  638. cancel            dc.b 'The CANCEL gadget was selected',0
  639. inuse                dc.b 'Another task using the requester',0
  640. About                dc.b '   About',0
  641. Msg1                dc.b 'An example of SPECIAL_REQ',0
  642. Msg2                dc.b 'by Jeff Glatt',0
  643. Msg3                dc.b 'dissidents',0
  644. NotIn                dc.b 'This string is not in the list.',0
  645. AppCan            dc.b 'Cancelled by the custom gadget.',0
  646. MultiString        dc.b 'Multi File',0
  647. ProjectTitle    dc.b 'Project',0
  648. ON                    dc.b 'On ',0
  649. OFF                dc.b 'Off',0
  650. String            dc.b 'String',0
  651. GadgFlags        dc.b 0
  652.  
  653.    END
  654.