asl.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2005 Karoly Balogh for Genesi S.a.r.l.
  4. asl.library interface unit for MorphOS/PowerPC
  5. Based on work of Nils Sjoholm member of the Amiga RTL
  6. development team.
  7. MorphOS port was done on a free Pegasos II/G4 machine
  8. provided by Genesi S.a.r.l. <www.genesi.lu>
  9. See the file COPYING.FPC, included in this distribution,
  10. for details about the copyright.
  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. {$PACKRECORDS 2}
  16. unit asl;
  17. interface
  18. uses exec, utility, {workbench,} graphics;
  19. {************************************************************************}
  20. const
  21. ASLNAME : PChar = 'asl.library';
  22. ASL_TB = TAG_USER+$80000;
  23. {************************************************************************}
  24. { Types of requesters known to ASL, used as arguments to AllocAslRequest() }
  25. ASL_FileRequest = 0;
  26. ASL_FontRequest = 1;
  27. ASL_ScreenModeRequest = 2;
  28. {****************************************************************************
  29. *
  30. * ASL File Requester data structures and constants
  31. *
  32. * This structure must only be allocated by asl.library amd is READ-ONLY!
  33. * Control of the various fields is provided via tags when the requester
  34. * is created with AllocAslRequest() and when it is displayed via
  35. * AslRequest()
  36. }
  37. type
  38. pFileRequester = ^tFileRequester;
  39. tFileRequester = record
  40. rf_Reserved0 : Array[0..3] Of Byte;
  41. rf_File : PChar; { Filename pointer }
  42. rf_Dir : PChar; { Directory name pointer }
  43. rf_Reserved1 : Array[0..9] Of Byte;
  44. rf_LeftEdge : smallint;
  45. rf_TopEdge : smallint; { Preferred window pos }
  46. rf_Width : smallint;
  47. rf_Height : smallint; { Preferred window size }
  48. rf_Reserved2 : Array[0..1] Of Byte;
  49. rf_NumArgs : LongInt; { A-la WB Args, FOR multiselects }
  50. {$WARNING FIX ME!!! Needs workbench unit}
  51. { rf_ArgList : pWBArgList;}
  52. rf_ArgList : Pointer;
  53. rf_UserData : Pointer; { Applihandle (you may write!!) }
  54. rf_Reserved3 : Array[0..7] Of Byte;
  55. rf_Pat : PChar; { Pattern match pointer }
  56. END; { note - more reserved fields follow }
  57. { File requester tag values, used by AllocAslRequest() and AslRequest() }
  58. const
  59. { Window control }
  60. ASLFR_Window = ASL_TB+2 ; { Parent window }
  61. ASLFR_Screen = ASL_TB+40; { Screen to open on if no window }
  62. ASLFR_PubScreenName = ASL_TB+41; { Name of public screen }
  63. ASLFR_PrivateIDCMP = ASL_TB+42; { Allocate private IDCMP? }
  64. ASLFR_IntuiMsgFunc = ASL_TB+70; { Function to handle IntuiMessages }
  65. ASLFR_SleepWindow = ASL_TB+43; { Block input in ASLFR_Window? }
  66. ASLFR_UserData = ASL_TB+52; { What to put in fr_UserData }
  67. ASLFR_PopToFront = ASL_TB+131; { Make the requester window visible }
  68. ASLFR_Activate = ASL_TB+132; { Activate the requester window when }
  69. { Text display }
  70. ASLFR_TextAttr = ASL_TB+51; { Text font to use for gadget text }
  71. ASLFR_Locale = ASL_TB+50; { Locale ASL should use for text }
  72. ASLFR_TitleText = ASL_TB+1 ; { Title of requester }
  73. ASLFR_PositiveText = ASL_TB+18; { Positive gadget text }
  74. ASLFR_NegativeText = ASL_TB+19; { Negative gadget text }
  75. { Initial settings }
  76. ASLFR_InitialLeftEdge= ASL_TB+3 ; { Initial requester coordinates }
  77. ASLFR_InitialTopEdge = ASL_TB+4 ;
  78. ASLFR_InitialWidth = ASL_TB+5 ; { Initial requester dimensions }
  79. ASLFR_InitialHeight = ASL_TB+6 ;
  80. ASLFR_InitialFile = ASL_TB+8 ; { Initial contents of File gadget }
  81. ASLFR_InitialDrawer = ASL_TB+9 ; { Initial contents of Drawer gadg. }
  82. ASLFR_InitialPattern = ASL_TB+10; { Initial contents of Pattern gadg.}
  83. ASLFR_InitialShowVolumes = ASL_TB+130; { Initially, show the volume list (V44) }
  84. { Options }
  85. ASLFR_Flags1 = ASL_TB+20; { Option flags }
  86. ASLFR_Flags2 = ASL_TB+22; { Additional option flags }
  87. ASLFR_DoSaveMode = ASL_TB+44; { Being used for saving? }
  88. ASLFR_DoMultiSelect = ASL_TB+45; { Do multi-select? }
  89. ASLFR_DoPatterns = ASL_TB+46; { Display a Pattern gadget? }
  90. { Filtering }
  91. ASLFR_DrawersOnly = ASL_TB+47; { Don't display files? }
  92. ASLFR_FilterFunc = ASL_TB+49; { Function to filter files }
  93. ASLFR_RejectIcons = ASL_TB+60; { Display .info files? }
  94. ASLFR_RejectPattern = ASL_TB+61; { Don't display files matching pat }
  95. ASLFR_AcceptPattern = ASL_TB+62; { Accept only files matching pat }
  96. ASLFR_FilterDrawers = ASL_TB+63; { Also filter drawers with patterns}
  97. ASLFR_HookFunc = ASL_TB+7 ; { Combined callback function }
  98. { Sorting }
  99. ASLFR_SetSortBy = ASL_TB+124; { Sort criteria (name, date, size) }
  100. ASLFR_GetSortBy = ASL_TB+125;
  101. ASLFR_SetSortDrawers = ASL_TB+126; { Placement of drawers in the list }
  102. ASLFR_GetSortDrawers = ASL_TB+127;
  103. ASLFR_SetSortOrder = ASL_TB+128; { Order (ascending or descending) }
  104. ASLFR_GetSortOrder = ASL_TB+129;
  105. { Flag bits for the ASLFR_Flags1 tag }
  106. FRB_FILTERFUNC = 7;
  107. FRB_INTUIFUNC = 6;
  108. FRB_DOSAVEMODE = 5;
  109. FRB_PRIVATEIDCMP = 4;
  110. FRB_DOMULTISELECT = 3;
  111. FRB_DOPATTERNS = 0;
  112. FRF_FILTERFUNC = 128;
  113. FRF_INTUIFUNC = 64;
  114. FRF_DOSAVEMODE = 32;
  115. FRF_PRIVATEIDCMP = 16;
  116. FRF_DOMULTISELECT = 8;
  117. FRF_DOPATTERNS = 1;
  118. { Flag bits for the ASLFR_Flags2 tag }
  119. FRB_DRAWERSONLY = 0;
  120. FRB_FILTERDRAWERS = 1;
  121. FRB_REJECTICONS = 2;
  122. FRF_DRAWERSONLY = 1;
  123. FRF_FILTERDRAWERS = 2;
  124. FRF_REJECTICONS = 4;
  125. { Sort criteria for the ASLFR_SetSortBy/ASLFR_GetSortBy tags }
  126. ASLFRSORTBY_Name = 0;
  127. ASLFRSORTBY_Date = 1;
  128. ASLFRSORTBY_Size = 2;
  129. { Drawer placement for the ASLFR_SetSortDrawers/ASLFR_GetSortDrawers tags }
  130. ASLFRSORTDRAWERS_First = 0;
  131. ASLFRSORTDRAWERS_Mix = 1;
  132. ASLFRSORTDRAWERS_Last = 2;
  133. { Sort order for the ASLFR_SetSortOrder/ASLFR_GetSortOrder tags }
  134. ASLFRSORTORDER_Ascend = 0;
  135. ASLFRSORTORDER_Descend = 1;
  136. {****************************************************************************
  137. *
  138. * ASL Font Requester data structures and constants
  139. *
  140. * This structure must only be allocated by asl.library amd is READ-ONLY!
  141. * Control of the various fields is provided via tags when the requester
  142. * is created with AllocAslRequest() and when it is displayed via
  143. * AslRequest()
  144. }
  145. type
  146. pFontRequester = ^tFontRequester;
  147. tFontRequester = record
  148. fo_Reserved0 : Array[0..7] Of Byte;
  149. fo_Attr : tTextAttr; { Returned TextAttr }
  150. fo_FrontPen : Byte; { Returned front pen }
  151. fo_BackPen : Byte; { Returned back pen }
  152. fo_DrawMode : Byte; { Returned drawing mode }
  153. fo_Reserved1 : Byte;
  154. fo_UserData : Pointer; { You can store your own data here }
  155. fo_LeftEdge : smallint; { Coordinates Of requester on Exit }
  156. fo_TopEdge : smallint;
  157. fo_Width : smallint;
  158. fo_Height : smallint;
  159. fo_TAttr : tTTextAttr; { Returned TTextAttr }
  160. end;
  161. { Font requester tag values, used by AllocAslRequest() AND AslRequest() }
  162. const
  163. { Window control }
  164. ASLFO_Window = ASL_TB+2 ; { Parent window }
  165. ASLFO_Screen = ASL_TB+40; { Screen to open on if no window }
  166. ASLFO_PubScreenName = ASL_TB+41; { Name of public screen }
  167. ASLFO_PrivateIDCMP = ASL_TB+42; { Allocate private IDCMP? }
  168. ASLFO_IntuiMsgFunc = ASL_TB+70; { Function to handle IntuiMessages }
  169. ASLFO_SleepWindow = ASL_TB+43; { Block input in ASLFO_Window? }
  170. ASLFO_UserData = ASL_TB+52; { What to put in fo_UserData }
  171. ASLFO_PopToFront = ASL_TB+131; { Make the requester window visible
  172. * when it opens (V44)
  173. }
  174. ASLFO_Activate = ASL_TB+132; { Activate the requester window when
  175. * it opens (V45).
  176. }
  177. { Text display }
  178. ASLFO_TextAttr = ASL_TB+51; { Text font to use for gadget text }
  179. ASLFO_Locale = ASL_TB+50; { Locale ASL should use for text }
  180. ASLFO_TitleText = ASL_TB+1 ; { Title of requester }
  181. ASLFO_PositiveText = ASL_TB+18; { Positive gadget text }
  182. ASLFO_NegativeText = ASL_TB+19; { Negative gadget text }
  183. { Initial settings }
  184. ASLFO_InitialLeftEdge= ASL_TB+3 ; { Initial requester coordinates }
  185. ASLFO_InitialTopEdge = ASL_TB+4 ;
  186. ASLFO_InitialWidth = ASL_TB+5 ; { Initial requester dimensions }
  187. ASLFO_InitialHeight = ASL_TB+6 ;
  188. ASLFO_InitialName = ASL_TB+10; { Initial contents of Name gadget }
  189. ASLFO_InitialSize = ASL_TB+11; { Initial contents of Size gadget }
  190. ASLFO_InitialStyle = ASL_TB+12; { Initial font style }
  191. ASLFO_InitialFlags = ASL_TB+13; { Initial font flags for TextAttr }
  192. ASLFO_InitialFrontPen= ASL_TB+14; { Initial front pen }
  193. ASLFO_InitialBackPen = ASL_TB+15; { Initial back pen }
  194. ASLFO_InitialDrawMode= ASL_TB+59; { Initial draw mode }
  195. { Options }
  196. ASLFO_Flags = ASL_TB+20; { Option flags }
  197. ASLFO_DoFrontPen = ASL_TB+44; { Display Front color selector? }
  198. ASLFO_DoBackPen = ASL_TB+45; { Display Back color selector? }
  199. ASLFO_DoStyle = ASL_TB+46; { Display Style checkboxes? }
  200. ASLFO_DoDrawMode = ASL_TB+47; { Display DrawMode cycle gadget? }
  201. ASLFO_SampleText = ASL_TB+133; { Text to display in font sample area (V45) }
  202. { Filtering }
  203. ASLFO_FixedWidthOnly = ASL_TB+48; { Only allow fixed-width fonts? }
  204. ASLFO_MinHeight = ASL_TB+16; { Minimum font height to display }
  205. ASLFO_MaxHeight = ASL_TB+17; { Maximum font height to display }
  206. ASLFO_FilterFunc = ASL_TB+49; { Function to filter fonts }
  207. ASLFO_HookFunc = ASL_TB+7 ; { Combined callback function }
  208. ASLFO_MaxFrontPen = ASL_TB+66; { Max # of colors in front palette }
  209. ASLFO_MaxBackPen = ASL_TB+67; { Max # of colors in back palette }
  210. { Custom additions }
  211. ASLFO_ModeList = ASL_TB+21; { Substitute list for drawmodes }
  212. ASLFO_FrontPens = ASL_TB+64; { Color table for front pen palette}
  213. ASLFO_BackPens = ASL_TB+65; { Color table for back pen palette }
  214. { Flag bits for ASLFO_Flags tag }
  215. FOB_DOFRONTPEN = 0;
  216. FOB_DOBACKPEN = 1;
  217. FOB_DOSTYLE = 2;
  218. FOB_DODRAWMODE = 3;
  219. FOB_FIXEDWIDTHONLY= 4;
  220. FOB_PRIVATEIDCMP = 5;
  221. FOB_INTUIFUNC = 6;
  222. FOB_FILTERFUNC = 7;
  223. FOF_DOFRONTPEN = 1;
  224. FOF_DOBACKPEN = 2;
  225. FOF_DOSTYLE = 4;
  226. FOF_DODRAWMODE = 8;
  227. FOF_FIXEDWIDTHONLY = 16;
  228. FOF_PRIVATEIDCMP = 32;
  229. FOF_INTUIFUNC = 64;
  230. FOF_FILTERFUNC = 128;
  231. {****************************************************************************
  232. *
  233. * ASL Screen Mode Requester data structures and constants
  234. *
  235. * This structure must only be allocated by asl.library and is READ-ONLY!
  236. * Control of the various fields is provided via tags when the requester
  237. * is created with AllocAslRequest() and when it is displayed via
  238. * AslRequest()
  239. }
  240. Type
  241. pScreenModeRequester = ^tScreenModeRequester;
  242. tScreenModeRequester = record
  243. sm_DisplayID : Cardinal; { Display mode ID }
  244. sm_DisplayWidth : Cardinal; { Width Of display IN pixels }
  245. sm_DisplayHeight : Cardinal; { Height Of display IN pixels }
  246. sm_DisplayDepth : word; { Number OF bit-planes OF display }
  247. sm_OverscanType : word; { TYPE OF overscan OF display }
  248. sm_AutoScroll : Boolean; { Display should auto-scroll? }
  249. sm_BitMapWidth : Cardinal; { Used TO create your own BitMap }
  250. sm_BitMapHeight : Cardinal;
  251. sm_LeftEdge : smallint; { Coordinates OF requester on Exit }
  252. sm_TopEdge : smallint;
  253. sm_Width : smallint;
  254. sm_Height : smallint;
  255. sm_InfoOpened : Boolean; { Info window opened on exit? }
  256. sm_InfoLeftEdge : smallint; { Last coordinates OF Info window }
  257. sm_InfoTopEdge : smallint;
  258. sm_InfoWidth : smallint;
  259. sm_InfoHeight : smallint;
  260. sm_UserData : Pointer; { You can store your own data here }
  261. END;
  262. { An Exec list of custom modes can be added to the list of available modes.
  263. * The DimensionInfo structure must be completely initialized, including the
  264. * Header. See <graphics/displayinfo.h>. Custom mode ID's must be in the range
  265. * $FFFF0000..$FFFFFFFF. Regular properties which apply to your custom modes
  266. * can be added in the dn_PropertyFlags field. Custom properties are not
  267. * allowed.
  268. }
  269. pDisplayMode = ^tDisplayMode;
  270. tDisplayMode = record
  271. dm_Node : tNode; { see ln_Name }
  272. dm_DimensionInfo : tDimensionInfo; { mode description }
  273. dm_PropertyFlags : Cardinal; { applicable properties }
  274. end;
  275. { ScreenMode requester tag values, used by AllocAslRequest() and AslRequest() }
  276. const
  277. { Window control }
  278. ASLSM_Window = ASL_TB+2 ; { Parent window }
  279. ASLSM_Screen = ASL_TB+40; { Screen to open on if no window }
  280. ASLSM_PubScreenName = ASL_TB+41; { Name of public screen }
  281. ASLSM_PrivateIDCMP = ASL_TB+42; { Allocate private IDCMP? }
  282. ASLSM_IntuiMsgFunc = ASL_TB+70; { Function to handle IntuiMessages }
  283. ASLSM_SleepWindow = ASL_TB+43; { Block input in ASLSM_Window? }
  284. ASLSM_UserData = ASL_TB+52; { What to put in sm_UserData }
  285. ASLSM_PopToFront = ASL_TB+131; { Make the requester window visible
  286. * when it opens (V44)
  287. }
  288. ASLSM_Activate = ASL_TB+132; { Activate the requester window when
  289. * it opens (V45).
  290. }
  291. { Text display }
  292. ASLSM_TextAttr = ASL_TB+51; { Text font to use for gadget text }
  293. ASLSM_Locale = ASL_TB+50; { Locale ASL should use for text }
  294. ASLSM_TitleText = ASL_TB+1 ; { Title of requester }
  295. ASLSM_PositiveText = ASL_TB+18; { Positive gadget text }
  296. ASLSM_NegativeText = ASL_TB+19; { Negative gadget text }
  297. { Initial settings }
  298. ASLSM_InitialLeftEdge = ASL_TB+3 ; { Initial requester coordinates }
  299. ASLSM_InitialTopEdge = ASL_TB+4 ;
  300. ASLSM_InitialWidth = ASL_TB+5 ; { Initial requester dimensions }
  301. ASLSM_InitialHeight = ASL_TB+6 ;
  302. ASLSM_InitialDisplayID = ASL_TB+100; { Initial display mode id }
  303. ASLSM_InitialDisplayWidth = ASL_TB+101; { Initial display width }
  304. ASLSM_InitialDisplayHeight = ASL_TB+102; { Initial display height }
  305. ASLSM_InitialDisplayDepth = ASL_TB+103; { Initial display depth }
  306. ASLSM_InitialOverscanType = ASL_TB+104; { Initial type of overscan }
  307. ASLSM_InitialAutoScroll = ASL_TB+105; { Initial autoscroll setting }
  308. ASLSM_InitialInfoOpened = ASL_TB+106; { Info wndw initially opened? }
  309. ASLSM_InitialInfoLeftEdge = ASL_TB+107; { Initial Info window coords. }
  310. ASLSM_InitialInfoTopEdge = ASL_TB+108;
  311. { Options }
  312. ASLSM_DoWidth = ASL_TB+109; { Display Width gadget? }
  313. ASLSM_DoHeight = ASL_TB+110; { Display Height gadget? }
  314. ASLSM_DoDepth = ASL_TB+111; { Display Depth gadget? }
  315. ASLSM_DoOverscanType = ASL_TB+112; { Display Overscan Type gadget? }
  316. ASLSM_DoAutoScroll = ASL_TB+113; { Display AutoScroll gadget? }
  317. { Filtering }
  318. ASLSM_PropertyFlags = ASL_TB+114; { Must have these Property flags }
  319. ASLSM_PropertyMask = ASL_TB+115; { Only these should be looked at }
  320. ASLSM_MinWidth = ASL_TB+116; { Minimum display width to allow }
  321. ASLSM_MaxWidth = ASL_TB+117; { Maximum display width to allow }
  322. ASLSM_MinHeight = ASL_TB+118; { Minimum display height to allow }
  323. ASLSM_MaxHeight = ASL_TB+119; { Maximum display height to allow }
  324. ASLSM_MinDepth = ASL_TB+120; { Minimum display depth }
  325. ASLSM_MaxDepth = ASL_TB+121; { Maximum display depth }
  326. ASLSM_FilterFunc = ASL_TB+122; { Function to filter mode id's }
  327. { Custom additions }
  328. ASLSM_CustomSMList = ASL_TB+123; { Exec list of struct DisplayMode }
  329. {***************************************************************************}
  330. ASL_LAST_TAG = ASL_TB+133;
  331. {***************************************************************************}
  332. { This defines the rendezvous data for setting and querying asl.library's
  333. * defaults for the window size and the file requester sort order. The name
  334. * of the semaphore is given below; it exists only with asl.library V45 and
  335. * IPrefs V45 and beyond.
  336. }
  337. ASL_SEMAPHORE_NAME : Pchar = 'asl.library';
  338. type
  339. PAslSemaphore = ^tAslSemaphore;
  340. tAslSemaphore = record
  341. as_Semaphore : tSignalSemaphore;
  342. as_Version : Word; { Must be >= 45 }
  343. as_Size : Cardinal; { Size of this data structure. }
  344. as_SortBy : Byte; { File requester defaults; name, date or size }
  345. as_SortDrawers : Byte; { File requester defaults; first, mix or last }
  346. as_SortOrder : Byte; { File requester defaults; ascending or descending }
  347. as_SizePosition : Byte; { See below }
  348. as_RelativeLeft : WORD; { Window position offset }
  349. as_RelativeTop : WORD;
  350. as_RelativeWidth : Byte; { Window size factor; this is
  351. * a percentage of the parent
  352. * window/screen width.
  353. }
  354. as_RelativeHeight : Byte;
  355. end;
  356. const
  357. { Default position of the ASL window. }
  358. ASLPOS_DefaultPosition = 0; { Position is calculated according to the builtin rules. }
  359. ASLPOS_CenterWindow = 1; { Centred within the bounds of the parent window. }
  360. ASLPOS_CenterScreen = 2; { Centred within the bounds of the parent screen. }
  361. ASLPOS_WindowPosition = 3; { Relative to the top left corner of the parent window,
  362. * using the offset values provided in the
  363. * as_RelativeLeft/as_RelativeTop members.
  364. }
  365. ASLPOS_ScreenPosition = 4; { Relative to the top left corner of the parent screen,
  366. * using the offset values provided in the
  367. * as_RelativeLeft/as_RelativeTop members.
  368. }
  369. ASLPOS_CenterMouse = 5; { Directly below the mouse pointer. }
  370. ASLPOS_MASK = $0F;
  371. { Default size of the ASL window. }
  372. ASLSIZE_DefaultSize = (0 shl 4); { Size is calculated according to the builtin rules. }
  373. ASLSIZE_RelativeSize = (1 shl 4); { Size is relative to the size of the parent
  374. * window or screen, using the values provided in
  375. * the as_RelativeWidth/as_RelativeHeight members.
  376. * The as_RelativeWidth/as_RelativeHeight values are
  377. * taken as percentage, i.e. a value of "50" stands for
  378. * 50% of the width/height of the parent window/screen.
  379. }
  380. ASLSIZE_MASK = $30;
  381. { Other options. }
  382. ASLOPTION_ASLOverrides = (1 shl 6); { ASL determines placement and size of requester
  383. * windows; application's choice is ignored.
  384. }
  385. {****************************************************************************
  386. *
  387. * Obsolete ASL definitions, here for source code compatibility only.
  388. * Please do NOT use in new code.
  389. *
  390. * define ASL_V38_NAMES_ONLY to remove these older names
  391. }
  392. {$define ASL_V38_NAMES_ONLY}
  393. {$ifndef ASL_V38_NAMES_ONLY}
  394. const
  395. ASL_Dummy = (TAG_USER + $80000);
  396. ASL_Hail = ASL_Dummy+1 ;
  397. ASL_Window = ASL_Dummy+2 ;
  398. ASL_LeftEdge = ASL_Dummy+3 ;
  399. ASL_TopEdge = ASL_Dummy+4 ;
  400. ASL_Width = ASL_Dummy+5 ;
  401. ASL_Height = ASL_Dummy+6 ;
  402. ASL_HookFunc = ASL_Dummy+7 ;
  403. ASL_File = ASL_Dummy+8 ;
  404. ASL_Dir = ASL_Dummy+9 ;
  405. ASL_FontName = ASL_Dummy+10;
  406. ASL_FontHeight = ASL_Dummy+11;
  407. ASL_FontStyles = ASL_Dummy+12;
  408. ASL_FontFlags = ASL_Dummy+13;
  409. ASL_FrontPen = ASL_Dummy+14;
  410. ASL_BackPen = ASL_Dummy+15;
  411. ASL_MinHeight = ASL_Dummy+16;
  412. ASL_MaxHeight = ASL_Dummy+17;
  413. ASL_OKText = ASL_Dummy+18;
  414. ASL_CancelText = ASL_Dummy+19;
  415. ASL_FuncFlags = ASL_Dummy+20;
  416. ASL_ModeList = ASL_Dummy+21;
  417. ASL_ExtFlags1 = ASL_Dummy+22;
  418. ASL_Pattern = ASL_FontName;
  419. { remember what I said up there? Do not use these anymore! }
  420. FILB_DOWILDFUNC = 7;
  421. FILB_DOMSGFUNC = 6;
  422. FILB_SAVE = 5;
  423. FILB_NEWIDCMP = 4;
  424. FILB_MULTISELECT = 3;
  425. FILB_PATGAD = 0;
  426. FILF_DOWILDFUNC = 128;
  427. FILF_DOMSGFUNC = 64;
  428. FILF_SAVE = 32;
  429. FILF_NEWIDCMP = 16;
  430. FILF_MULTISELECT = 8;
  431. FILF_PATGAD = 1;
  432. FIL1B_NOFILES = 0;
  433. FIL1B_MATCHDIRS = 1;
  434. FIL1F_NOFILES = 1;
  435. FIL1F_MATCHDIRS = 2;
  436. FONB_FRONTCOLOR = 0;
  437. FONB_BACKCOLOR = 1;
  438. FONB_STYLES = 2;
  439. FONB_DRAWMODE = 3;
  440. FONB_FIXEDWIDTH = 4;
  441. FONB_NEWIDCMP = 5;
  442. FONB_DOMSGFUNC = 6;
  443. FONB_DOWILDFUNC = 7;
  444. FONF_FRONTCOLOR = 1;
  445. FONF_BACKCOLOR = 2;
  446. FONF_STYLES = 4;
  447. FONF_DRAWMODE = 8;
  448. FONF_FIXEDWIDTH = 16;
  449. FONF_NEWIDCMP = 32;
  450. FONF_DOMSGFUNC = 64;
  451. FONF_DOWILDFUNC = 128;
  452. {$endif ASL_V38_NAMES_ONLY}
  453. var
  454. AslBase : pLibrary;
  455. function AllocFileRequest : pFileRequester;
  456. SysCall AslBase 030;
  457. procedure FreeFileRequest(fileReq : pFileRequester location 'a0');
  458. SysCall AslBase 036;
  459. function RequestFile(fileReq : pFileRequester location 'a0'): Boolean;
  460. SysCall AslBase 042;
  461. function AllocAslRequest(reqType: Cardinal location 'd0';
  462. tagList: pTagItem location 'a0'): Pointer;
  463. SysCall AslBase 048;
  464. procedure FreeAslRequest(requester: Pointer location 'a0');
  465. SysCall AslBase 054;
  466. function AslRequest(requester: Pointer location 'a0';
  467. tagList : pTagItem location 'a1'): Boolean;
  468. SysCall AslBase 060;
  469. procedure AbortAslRequest(requester: Pointer location 'a0');
  470. SysCall AslBase 078;
  471. procedure ActivateAslRequest(requester : Pointer location 'a0');
  472. SysCall AslBase 084;
  473. function AllocAslRequestTags(reqType: Cardinal;
  474. tagList: array of DWord): Pointer; Inline;
  475. function AslRequestTags(requester: Pointer;
  476. tagList : array of DWord): Boolean; Inline;
  477. function InitAslLibrary : boolean;
  478. implementation
  479. function AllocAslRequestTags(reqType: Cardinal;
  480. tagList: array of DWord): Pointer; Inline;
  481. begin
  482. AllocAslRequestTags:=AllocAslRequest(reqType,@tagList);
  483. end;
  484. function AslRequestTags(requester: Pointer;
  485. tagList : array of DWord): Boolean; Inline;
  486. begin
  487. AslRequestTags:=AslRequest(requester,@tagList);
  488. end;
  489. const
  490. { Change VERSION and LIBVERSION to proper values }
  491. VERSION : string[2] = '0';
  492. LIBVERSION : longword = 0;
  493. var
  494. asl_exit: Pointer;
  495. procedure CloseAslLibrary;
  496. begin
  497. ExitProc := asl_exit;
  498. if AslBase <> nil then begin
  499. CloseLibrary(PLibrary(AslBase));
  500. AslBase := nil;
  501. end;
  502. end;
  503. function InitAslLibrary : boolean;
  504. begin
  505. AslBase := nil;
  506. AslBase := OpenLibrary(ASLNAME,LIBVERSION);
  507. if AslBase <> nil then begin
  508. asl_exit := ExitProc;
  509. ExitProc := @CloseAslLibrary;
  510. InitAslLibrary:=True;
  511. end else begin
  512. InitAslLibrary:=False;
  513. end;
  514. end;
  515. end. (* UNIT ASL *)