1 { 2 This file is part of the Free Pascal run time library. 3 4 A file in Amiga system run time library. 5 Copyright (c) 1998-2003 by Nils Sjoholm 6 member of the Amiga RTL development team. 7 8 See the file COPYING.FPC, included in this distribution, 9 for details about the copyright. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 15 **********************************************************************} 16 { 17 History: 18 19 Added the defines use_amiga_smartlink and 20 use_auto_openlib. Implemented autoopening 21 of the library. 22 14 Jan 2003. 23 24 Update for AmigaOS 3.9. 25 Changed start code for unit. 26 06 Feb 2003. 27 28 Changed integer > smallint, 29 cardinal > longword. 30 09 Feb 2003. 31 32 nils.sjoholm@mailbox.swipnet.se 33 } 34 {$PACKRECORDS 2} 35 36 UNIT layers; 37 38 INTERFACE 39 USES exec, agraphics, utility; 40 41 const 42 43 LAYERSIMPLE = 1; 44 LAYERSMART = 2; 45 LAYERSUPER = 4; 46 LAYERUPDATING = $10; 47 LAYERBACKDROP = $40; 48 LAYERREFRESH = $80; 49 LAYER_CLIPRECTS_LOST = $100; { during BeginUpdate } 50 { or during layerop } 51 { this happens if out of memory } 52 LMN_REGION = -1; 53 54 type 55 pLayer_Info = ^tLayer_Info; 56 tLayer_Info = record 57 top_layer : pLayer; 58 check_lp : pLayer; { !! Private !! } 59 obs : pClipRect; 60 FreeClipRects : pClipRect; { !! Private !! } 61 PrivateReserve1, { !! Private !! } 62 PrivateReserve2 : Longint; { !! Private !! } 63 Lock : tSignalSemaphore; { !! Private !! } 64 gs_Head : tMinList; { !! Private !! } 65 PrivateReserve3 : smallint; { !! Private !! } 66 PrivateReserve4 : Pointer; { !! Private !! } 67 Flags : WORD; 68 fatten_count : Shortint; { !! Private !! } 69 LockLayersCount : Shortint; { !! Private !! } 70 PrivateReserve5 : smallint; { !! Private !! } 71 BlankHook, { !! Private !! } 72 LayerInfo_extra : Pointer; { !! Private !! } 73 end; 74 75 const 76 NEWLAYERINFO_CALLED = 1; 77 78 { 79 * LAYERS_NOBACKFILL is the value needed to get no backfill hook 80 * LAYERS_BACKFILL is the value needed to get the default backfill hook 81 } 82 LAYERS_NOBACKFILL = 1; 83 LAYERS_BACKFILL = 0; 84 85 LAYERSNAME : PChar = 'layers.library'; 86 87 VAR LayersBase : pLibrary = nil; 88 BeginUpdatenull89FUNCTION BeginUpdate(l : pLayer location 'a0') : LONGINT; syscall LayersBase 078; BehindLayernull90FUNCTION BehindLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1') : LONGINT; syscall LayersBase 054; CreateBehindHookLayernull91FUNCTION CreateBehindHookLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; hook : pHook location 'a3'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 192; CreateBehindLayernull92FUNCTION CreateBehindLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 042; CreateUpfrontHookLayernull93FUNCTION CreateUpfrontHookLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; hook : pHook location 'a3'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 186; CreateUpfrontLayernull94FUNCTION CreateUpfrontLayer(li : pLayer_Info location 'a0'; bm : pBitMap location 'a1'; x0 : LONGINT location 'd0'; y0 : LONGINT location 'd1'; x1 : LONGINT location 'd2'; y1 : LONGINT location 'd3'; flags : LONGINT location 'd4'; bm2 : pBitMap location 'a2') : pLayer; syscall LayersBase 036; DeleteLayernull95FUNCTION DeleteLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1') : LONGINT; syscall LayersBase 090; 96 PROCEDURE DisposeLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 150; 97 PROCEDURE DoHookClipRects(hook : pHook location 'a0'; rport : pRastPort location 'a1'; const rect : pRectangle location 'a2'); syscall LayersBase 216; 98 PROCEDURE EndUpdate(layer : pLayer location 'a0'; flag : ULONG location 'd0'); syscall LayersBase 084; FattenLayerInfonull99FUNCTION FattenLayerInfo(li : pLayer_Info location 'a0') : LONGINT; syscall LayersBase 156; 100 PROCEDURE InitLayers(li : pLayer_Info location 'a0'); syscall LayersBase 030; InstallClipRegionnull101FUNCTION InstallClipRegion(layer : pLayer location 'a0';const region : pRegion location 'a1') : pRegion; syscall LayersBase 174; InstallLayerHooknull102FUNCTION InstallLayerHook(layer : pLayer location 'a0'; hook : pHook location 'a1') : pHook; syscall LayersBase 198; InstallLayerInfoHooknull103FUNCTION InstallLayerInfoHook(li : pLayer_Info location 'a0'; const hook : pHook location 'a1') : pHook; syscall LayersBase 204; 104 PROCEDURE LockLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'); syscall LayersBase 096; 105 PROCEDURE LockLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 120; 106 PROCEDURE LockLayers(li : pLayer_Info location 'a0'); syscall LayersBase 108; MoveLayernull107FUNCTION MoveLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1') : LONGINT; syscall LayersBase 060; MoveLayerInFrontOfnull108FUNCTION MoveLayerInFrontOf(layer_to_move : pLayer location 'a0'; other_layer : pLayer location 'a1') : LONGINT; syscall LayersBase 168; MoveSizeLayernull109FUNCTION MoveSizeLayer(layer : pLayer location 'a0'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'; dw : LONGINT location 'd2'; dh : LONGINT location 'd3') : LONGINT; syscall LayersBase 180; NewLayerInfonull110FUNCTION NewLayerInfo : pLayer_Info; syscall LayersBase 144; 111 PROCEDURE ScrollLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'); syscall LayersBase 072; SizeLayernull112FUNCTION SizeLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1') : LONGINT; syscall LayersBase 066; 113 PROCEDURE SortLayerCR(layer : pLayer location 'a0'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'); syscall LayersBase 210; 114 PROCEDURE SwapBitsRastPortClipRect(rp : pRastPort location 'a0'; cr : pClipRect location 'a1'); syscall LayersBase 126; 115 PROCEDURE ThinLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 162; 116 PROCEDURE UnlockLayer(layer : pLayer location 'a0'); syscall LayersBase 102; 117 PROCEDURE UnlockLayerInfo(li : pLayer_Info location 'a0'); syscall LayersBase 138; 118 PROCEDURE UnlockLayers(li : pLayer_Info location 'a0'); syscall LayersBase 114; UpfrontLayernull119FUNCTION UpfrontLayer(dummy : LONGINT location 'a0'; layer : pLayer location 'a1') : LONGINT; syscall LayersBase 048; WhichLayernull120FUNCTION WhichLayer(li : pLayer_Info location 'a0'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : pLayer; syscall LayersBase 132; 121 122 IMPLEMENTATION 123 124 const 125 { Change VERSION and LIBVERSION to proper values } 126 VERSION : string[2] = '0'; 127 LIBVERSION : longword = 0; 128 129 initialization 130 LayersBase := OpenLibrary(LAYERSNAME,LIBVERSION); 131 finalization 132 if Assigned(LayersBase) then 133 CloseLibrary(LayersBase); 134 END. (* UNIT LAYERS *) 135 136 137 138