asl.pas 22 KB

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