asl.pas 23 KB

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