home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Pascal / HISOFTPASCAL2,0-2.DMS / in.adf / Extras / ReqTools.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1992-05-20  |  8.1 KB  |  452 lines

  1. unit ReqTools;
  2.  
  3. INTERFACE
  4. uses Exec, AmigaDOS, Graphics, Intuition, Utility;
  5.  
  6.  
  7. type
  8.     prtReqInfo = ^trtReqInfo;
  9.     trtReqInfo = record
  10.         ReqPos: long;
  11.         LeftOffset: word;
  12.         TopOffset: word;
  13.         Width: long;
  14.         ReqTitle: pbyte;
  15.         Flags: long;
  16.         DefaultFont: pTextFont;
  17.         WaitPointer: long;
  18.         end;
  19.  
  20.     prtHandlerInfo = ^trtHandlerInfo;
  21.     trtHandlerInfo = record
  22.         private1: long;
  23.         WaitMask: long;
  24.         DoNotWait: long;
  25.         end;
  26.  
  27.     prtFileList = ^trtFileList;
  28.     trtFileList = record
  29.         Next: prtFileList;
  30.         StrLen: long;
  31.         Name: pbyte;
  32.         end;
  33.  
  34.     prtFileRequester = ^trtFileRequester;
  35.     trtFileRequester = record
  36.         ReqPos: long;
  37.         LeftOffset: word;
  38.         TopOffset: word;
  39.         Flags: long;
  40.         Hook: pHook;
  41.         Dir: pbyte;
  42.         MatchPat: pbyte;
  43.         DefaultFont: pTextFont;
  44.         WaitPointer: long;
  45.         end;
  46.  
  47.     prtFontRequester = ^trtFontRequester;
  48.     trtFontRequester = record
  49.         ReqPos: long;
  50.         LeftOffset: word;
  51.         TopOffset: word;
  52.         Flags: long;
  53.         Hook: pHook;
  54.         Attr: tTextAttr;
  55.         DefaultFont: pTextFont;
  56.         WaitPointer: long;
  57.         end;
  58.  
  59.     pReqToolsBase = ^tReqToolsBase;
  60.     tReqToolsBase = record
  61.         LibNode: tLibrary;
  62.         Flags: byte;
  63.         pad: array [0..2] of byte;
  64.         SegList: BPTR;
  65.         IntuitionBase: pIntuitionBase;
  66.         GfxBase: pGfxBase;
  67.         DOSBase: pDosLibrary;
  68.         GadToolsBase: pLibrary;
  69.         UtilityBase: pLibrary;
  70.         end;
  71.  
  72.  
  73.  
  74. var
  75.     ReqToolsBase: pReqToolsBase;
  76.  
  77.  
  78. const
  79.     RTFI_OkText = $8000002A;
  80.     RTFO_Height = $80000029;
  81.     FREQB_DOWILDFUNC = $B;
  82.     FREQF_CHANGEPALETTE = $80;
  83.     REQPOS_POINTER = 0;
  84.     FREQB_FIXEDWIDTH = 5;
  85.     RTEZ_Flags = $80000016;
  86.     RTFO_FontHeight = $80000040;
  87.     RTFO_SampleHeight = $8000003C;
  88.     FREQB_SELECTDIRS = $C;
  89.     FREQF_DOWILDFUNC = $800;
  90.     RTFO_OkText = $8000002A;
  91.     FREQF_FIXEDWIDTH = $20;
  92.     RT_IDCMPFlags = $80000002;
  93.     RTPA_Color = $80000046;
  94.     EZREQB_NORETURNKEY = 0;
  95.     FREQF_SELECTDIRS = $1000;
  96.     RTGL_Width = $80000020;
  97.     EZREQF_NORETURNKEY = 1;
  98.     REQHOOK_WILDFILE = 0;
  99.     REQTOOLSNAME = 'reqtools.library';
  100.     EZREQB_CENTERTEXT = 2;
  101.     RT_TagBase = $80000000;
  102.     FREQB_SCALE = 9;
  103.     EZREQF_CENTERTEXT = 4;
  104.     RTEZ_ReqTitle = $80000014;
  105.     RTGS_Width = $80000020;
  106.     RTGL_ShowDefault = $80000021;
  107.     FREQF_SCALE = $200;
  108.     RT_PubScrName = $80000006;
  109.     RTRH_EndRequest = $8000003C;
  110.     FREQB_COLORFONTS = 6;
  111.     REQPOS_TOPLEFTSCR = 4;
  112.     FREQF_COLORFONTS = $40;
  113.     RTFO_FontStyle = $80000041;
  114.     REQHOOK_WILDFONT = 1;
  115.     REQPOS_TOPLEFTWIN = 3;
  116.     REQPOS_CENTERSCR = 2;
  117.     RTGS_AllowEmpty = $80000050;
  118.     RTFI_RemoveEntry = $80000035;
  119.     REQ_CANCEL = 0;
  120.     FREQB_LEAVEPALETTE = 8;
  121.     REQPOS_CENTERWIN = 1;
  122.     FREQF_LEAVEPALETTE = $100;
  123.     RT_ReqHandler = $80000008;
  124.     FREQB_NOBUFFER = 2;
  125.     RT_ReqPos = $80000003;
  126.     FREQF_NOBUFFER = 4;
  127.     FREQB_STYLE = $A;
  128.     RTEZ_DefaultResponse = $80000017;
  129.     RT_LeftOffset = $80000004;
  130.     FREQB_SAVE = 1;
  131.     FREQF_STYLE = $400;
  132.     RT_Screen = $80000007;
  133.     FREQF_SAVE = 2;
  134.     RT_DefaultFont = $80000009;
  135.     REQTOOLSVERSION = $25;
  136.     RT_TopOffset = $80000005;
  137.     RT_FILEREQ = 0;
  138.     EZREQB_LAMIGAQUAL = 1;
  139.     REQ_OK = 1;
  140.     EZREQF_LAMIGAQUAL = 2;
  141.     RTFI_MatchPat = $80000033;
  142.     CALL_HANDLER = $80000000;
  143.     FREQB_NOFILES = 3;
  144.     RT_Window = $80000001;
  145.     RTFI_Dir = $80000032;
  146.     RT_REQINFO = 1;
  147.     FREQF_NOFILES = 8;
  148.     RTFI_AddEntry = $80000034;
  149.     FREQB_PATGAD = 4;
  150.     RTFI_Flags = $80000028;
  151.     RT_WaitPointer = $8000000A;
  152.     RTFO_MinHeight = $8000003D;
  153.     RTFO_FontName = $8000003F;
  154.     FREQF_PATGAD = $10;
  155.     RTFO_MaxHeight = $8000003E;
  156.     RTGL_Min = $8000001E;
  157.     FREQB_MULTISELECT = 0;
  158.     RTFO_Flags = $80000028;
  159.     RTGL_Max = $8000001F;
  160.     RTFI_Height = $80000029;
  161.     RT_FONTREQ = 2;
  162.     RTFO_FontFlags = $80000042;
  163.     FREQF_MULTISELECT = 1;
  164.     FREQB_CHANGEPALETTE = 7;
  165.  
  166.  
  167. function rtAllocRequestA
  168.         (type_: long;
  169.         taglist: pTagItem): pointer;
  170.  
  171. procedure rtFreeRequest (req: pointer);
  172. procedure rtFreeReqBuffer (req: pointer);
  173. function rtChangeReqAttrA
  174.         (req: pointer;
  175.         taglist: pTagItem): longint;
  176.  
  177. function rtFileRequestA
  178.         (filereq: prtFileRequester;
  179.         file_: STRPTR;
  180.         title: STRPTR;
  181.         taglist: pTagItem): pointer;
  182.  
  183. procedure rtFreeFileList (filelist: prtFileList);
  184. function rtEZRequestA
  185.         (bodyfmt: STRPTR;
  186.         gadfmt: STRPTR;
  187.         reqinfo: prtReqInfo;
  188.         argarray: pointer;
  189.         taglist: pTagItem): long;
  190.  
  191. function rtGetStringA
  192.         (buffer: pbyte;
  193.         maxchars: long;
  194.         title: STRPTR;
  195.         reqinfo: prtReqInfo;
  196.         taglist: pTagItem): long;
  197.  
  198. function rtGetLongA
  199.         (longptr: plong;
  200.         title: STRPTR;
  201.         reqinfo: prtReqInfo;
  202.         taglist: pTagItem): long;
  203.  
  204. function rtFontRequestA
  205.         (fontreq: prtFontRequester;
  206.         title: STRPTR;
  207.         taglist: pTagItem): boolean;
  208.  
  209. function rtPaletteRequestA
  210.         (title: STRPTR;
  211.         reqinfo: prtReqInfo;
  212.         taglist: pTagItem): longint;
  213.  
  214. function rtReqHandlerA
  215.         (handlerinfo: prtHandlerInfo;
  216.         sigs: long;
  217.         taglist: pTagItem): long;
  218.  
  219. procedure rtSetWaitPointer (window: pWindow);
  220. function rtGetVScreenSize
  221.         (screen: pScreen;
  222.         widthptr: plong;
  223.         heightptr: plong): long;
  224.  
  225. procedure rtSetReqPosition
  226.         (reqpos: long;
  227.         newwindow: pNewWindow;
  228.         screen: pScreen;
  229.         window: pWindow);
  230.  
  231. procedure rtSpread
  232.         (posarray: plong;
  233.         sizearray: plong;
  234.         length: long;
  235.         min: long;
  236.         max: long;
  237.         num: long);
  238.  
  239. procedure rtScreenToFrontSafely (screen: pScreen);
  240.  
  241.  
  242. IMPLEMENTATION
  243. function rtAllocRequestA; xassembler;
  244. asm
  245.     move.l    a6,-(sp)
  246.     lea        8(sp),a6
  247.     move.l    (a6)+,a0
  248.     move.l    (a6)+,d0
  249.     move.l    ReqToolsBase,a6
  250.     jsr        -$1E(a6)
  251.     move.l    d0,$10(sp)
  252.     move.l    (sp)+,a6
  253. end;
  254.  
  255. procedure rtFreeRequest; xassembler;
  256. asm
  257.     move.l    a6,-(sp)
  258.     move.l    8(sp),a1
  259.     move.l    ReqToolsBase,a6
  260.     jsr        -$24(a6)
  261.     move.l    (sp)+,a6
  262. end;
  263.  
  264. procedure rtFreeReqBuffer; xassembler;
  265. asm
  266.     move.l    a6,-(sp)
  267.     move.l    8(sp),a1
  268.     move.l    ReqToolsBase,a6
  269.     jsr        -$2A(a6)
  270.     move.l    (sp)+,a6
  271. end;
  272.  
  273. function rtChangeReqAttrA; xassembler;
  274. asm
  275.     move.l    a6,-(sp)
  276.     movem.l    8(sp),a0-a1
  277.     move.l    ReqToolsBase,a6
  278.     jsr        -$30(a6)
  279.     move.l    d0,$10(sp)
  280.     move.l    (sp)+,a6
  281. end;
  282.  
  283. function rtFileRequestA; xassembler;
  284. asm
  285.     movem.l    a2-a3/a6,-(sp)
  286.     lea        $10(sp),a6
  287.     move.l    (a6)+,a0
  288.     move.l    (a6)+,a3
  289.     move.l    (a6)+,a2
  290.     move.l    (a6)+,a1
  291.     move.l    ReqToolsBase,a6
  292.     jsr        -$36(a6)
  293.     move.l    d0,$20(sp)
  294.     movem.l    (sp)+,a2-a3/a6
  295. end;
  296.  
  297. procedure rtFreeFileList; xassembler;
  298. asm
  299.     move.l    a6,-(sp)
  300.     move.l    8(sp),a0
  301.     move.l    ReqToolsBase,a6
  302.     jsr        -$3C(a6)
  303.     move.l    (sp)+,a6
  304. end;
  305.  
  306. function rtEZRequestA; xassembler;
  307. asm
  308.     movem.l    a2-a4/a6,-(sp)
  309.     lea        $14(sp),a6
  310.     move.l    (a6)+,a0
  311.     move.l    (a6)+,a4
  312.     move.l    (a6)+,a3
  313.     move.l    (a6)+,a2
  314.     move.l    (a6)+,a1
  315.     move.l    ReqToolsBase,a6
  316.     jsr        -$42(a6)
  317.     move.l    d0,$28(sp)
  318.     movem.l    (sp)+,a2-a4/a6
  319. end;
  320.  
  321. function rtGetStringA; xassembler;
  322. asm
  323.     movem.l    a2-a3/a6,-(sp)
  324.     lea        $10(sp),a6
  325.     move.l    (a6)+,a0
  326.     move.l    (a6)+,a3
  327.     move.l    (a6)+,a2
  328.     move.l    (a6)+,d0
  329.     move.l    (a6)+,a1
  330.     move.l    ReqToolsBase,a6
  331.     jsr        -$48(a6)
  332.     move.l    d0,$24(sp)
  333.     movem.l    (sp)+,a2-a3/a6
  334. end;
  335.  
  336. function rtGetLongA; xassembler;
  337. asm
  338.     movem.l    a2-a3/a6,-(sp)
  339.     lea        $10(sp),a6
  340.     move.l    (a6)+,a0
  341.     move.l    (a6)+,a3
  342.     move.l    (a6)+,a2
  343.     move.l    (a6)+,a1
  344.     move.l    ReqToolsBase,a6
  345.     jsr        -$4E(a6)
  346.     move.l    d0,$20(sp)
  347.     movem.l    (sp)+,a2-a3/a6
  348. end;
  349.  
  350. function rtFontRequestA; xassembler;
  351. asm
  352.     movem.l    a3/a6,-(sp)
  353.     lea        $C(sp),a6
  354.     move.l    (a6)+,a0
  355.     move.l    (a6)+,a3
  356.     move.l    (a6)+,a1
  357.     move.l    ReqToolsBase,a6
  358.     jsr        -$60(a6)
  359.     tst.l    d0
  360.     sne        d0
  361.     neg.b    d0
  362.     move.b    d0,$18(sp)
  363.     movem.l    (sp)+,a3/a6
  364. end;
  365.  
  366. function rtPaletteRequestA; xassembler;
  367. asm
  368.     movem.l    a2-a3/a6,-(sp)
  369.     lea        $10(sp),a6
  370.     move.l    (a6)+,a0
  371.     move.l    (a6)+,a3
  372.     move.l    (a6)+,a2
  373.     move.l    ReqToolsBase,a6
  374.     jsr        -$66(a6)
  375.     move.l    d0,$1C(sp)
  376.     movem.l    (sp)+,a2-a3/a6
  377. end;
  378.  
  379. function rtReqHandlerA; xassembler;
  380. asm
  381.     move.l    a6,-(sp)
  382.     lea        8(sp),a6
  383.     move.l    (a6)+,a0
  384.     move.l    (a6)+,d0
  385.     move.l    (a6)+,a1
  386.     move.l    ReqToolsBase,a6
  387.     jsr        -$6C(a6)
  388.     move.l    d0,$14(sp)
  389.     move.l    (sp)+,a6
  390. end;
  391.  
  392. procedure rtSetWaitPointer; xassembler;
  393. asm
  394.     move.l    a6,-(sp)
  395.     move.l    8(sp),a0
  396.     move.l    ReqToolsBase,a6
  397.     jsr        -$72(a6)
  398.     move.l    (sp)+,a6
  399. end;
  400.  
  401. function rtGetVScreenSize; xassembler;
  402. asm
  403.     movem.l    a2/a6,-(sp)
  404.     lea        $C(sp),a6
  405.     move.l    (a6)+,a2
  406.     move.l    (a6)+,a1
  407.     move.l    (a6)+,a0
  408.     move.l    ReqToolsBase,a6
  409.     jsr        -$78(a6)
  410.     move.l    d0,$18(sp)
  411.     movem.l    (sp)+,a2/a6
  412. end;
  413.  
  414. procedure rtSetReqPosition; xassembler;
  415. asm
  416.     movem.l    a2/a6,-(sp)
  417.     lea        $C(sp),a6
  418.     move.l    (a6)+,a2
  419.     move.l    (a6)+,a1
  420.     move.l    (a6)+,a0
  421.     move.l    (a6)+,d0
  422.     move.l    ReqToolsBase,a6
  423.     jsr        -$7E(a6)
  424.     movem.l    (sp)+,a2/a6
  425. end;
  426.  
  427. procedure rtSpread; xassembler;
  428. asm
  429.     movem.l    d3/a6,-(sp)
  430.     lea        $C(sp),a6
  431.     move.l    (a6)+,d3
  432.     move.l    (a6)+,d2
  433.     move.l    (a6)+,d1
  434.     move.l    (a6)+,d0
  435.     move.l    (a6)+,a1
  436.     move.l    (a6)+,a0
  437.     move.l    ReqToolsBase,a6
  438.     jsr        -$84(a6)
  439.     movem.l    (sp)+,d3/a6
  440. end;
  441.  
  442. procedure rtScreenToFrontSafely; xassembler;
  443. asm
  444.     move.l    a6,-(sp)
  445.     move.l    8(sp),a0
  446.     move.l    ReqToolsBase,a6
  447.     jsr        -$8A(a6)
  448.     move.l    (sp)+,a6
  449. end;
  450.  
  451. end.
  452.