asl.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2003 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. Found a bug in tFileRequester, rt_ArgList had pWBArg as arg
  15. should be pWBArgList. Fixed
  16. 27 Oct 1998.
  17. Added autoopening of asl.library.
  18. 28 Oct 1998.
  19. Added MessageBox for error report.
  20. 31 Jul 2000.
  21. Added functions and procedures with array of const.
  22. For use with fpc 1.0.7 They are in systemvartags.
  23. 11 Nov 2002.
  24. Added the defines use_amiga_smartlink and
  25. use_auto_openlib.
  26. 13 Jan 2003.
  27. Update for AmigaOS 3.9.
  28. Added some const.
  29. Added record tAslSemaphore.
  30. Added procedures AbortAslRequest and ActivateAslRequest.
  31. Changed start code for library.
  32. 25 Jan 2003.
  33. Changed integer > smallint.
  34. cardinal > longword.
  35. 09 Feb 2003.
  36. [email protected]
  37. }
  38. {$I useamigasmartlink.inc}
  39. {$ifdef use_amiga_smartlink}
  40. {$smartlink on}
  41. {$endif use_amiga_smartlink}
  42. UNIT asl;
  43. INTERFACE
  44. uses exec, utility, workbench, graphics;
  45. {************************************************************************}
  46. CONST
  47. ASLNAME : PChar = 'asl.library';
  48. ASL_TB = TAG_USER+$80000;
  49. {************************************************************************}
  50. { Types of requesters known to ASL, used as arguments to AllocAslRequest() }
  51. ASL_FileRequest = 0;
  52. ASL_FontRequest = 1;
  53. ASL_ScreenModeRequest = 2;
  54. {****************************************************************************
  55. *
  56. * ASL File Requester data structures and constants
  57. *
  58. * This structure must only be allocated by asl.library amd is READ-ONLY!
  59. * Control of the various fields is provided via tags when the requester
  60. * is created with AllocAslRequest() and when it is displayed via
  61. * AslRequest()
  62. }
  63. Type
  64. pFileRequester = ^tFileRequester;
  65. tFileRequester = record
  66. rf_Reserved0 : Array[0..3] Of Byte;
  67. rf_File : STRPTR; { Filename pointer }
  68. rf_Dir : STRPTR; { Directory name pointer }
  69. rf_Reserved1 : Array[0..9] Of Byte;
  70. rf_LeftEdge : smallint;
  71. rf_TopEdge : smallint; { Preferred window pos }
  72. rf_Width : smallint;
  73. rf_Height : smallint; { Preferred window size }
  74. rf_Reserved2 : Array[0..1] Of Byte;
  75. rf_NumArgs : LongInt; { A-la WB Args, FOR multiselects }
  76. rf_ArgList : pWBArgList;
  77. rf_UserData : Pointer; { Applihandle (you may write!!) }
  78. rf_Reserved3 : Array[0..7] Of Byte;
  79. rf_Pat : STRPTR; { Pattern match pointer }
  80. END; { note - more reserved fields follow }
  81. { File requester tag values, used by AllocAslRequest() and AslRequest() }
  82. const
  83. { Window control }
  84. ASLFR_Window = ASL_TB+2 ; { Parent window }
  85. ASLFR_Screen = ASL_TB+40; { Screen to open on if no window }
  86. ASLFR_PubScreenName = ASL_TB+41; { Name of public screen }
  87. ASLFR_PrivateIDCMP = ASL_TB+42; { Allocate private IDCMP? }
  88. ASLFR_IntuiMsgFunc = ASL_TB+70; { Function to handle IntuiMessages }
  89. ASLFR_SleepWindow = ASL_TB+43; { Block input in ASLFR_Window? }
  90. ASLFR_UserData = ASL_TB+52; { What to put in fr_UserData }
  91. ASLFR_PopToFront = ASL_TB+131; { Make the requester window visible }
  92. ASLFR_Activate = ASL_TB+132; { Activate the requester window when }
  93. { Text display }
  94. ASLFR_TextAttr = ASL_TB+51; { Text font to use for gadget text }
  95. ASLFR_Locale = ASL_TB+50; { Locale ASL should use for text }
  96. ASLFR_TitleText = ASL_TB+1 ; { Title of requester }
  97. ASLFR_PositiveText = ASL_TB+18; { Positive gadget text }
  98. ASLFR_NegativeText = ASL_TB+19; { Negative gadget text }
  99. { Initial settings }
  100. ASLFR_InitialLeftEdge= ASL_TB+3 ; { Initial requester coordinates }
  101. ASLFR_InitialTopEdge = ASL_TB+4 ;
  102. ASLFR_InitialWidth = ASL_TB+5 ; { Initial requester dimensions }
  103. ASLFR_InitialHeight = ASL_TB+6 ;
  104. ASLFR_InitialFile = ASL_TB+8 ; { Initial contents of File gadget }
  105. ASLFR_InitialDrawer = ASL_TB+9 ; { Initial contents of Drawer gadg. }
  106. ASLFR_InitialPattern = ASL_TB+10; { Initial contents of Pattern gadg.}
  107. ASLFR_InitialShowVolumes = ASL_TB+130; { Initially, show the volume list (V44) }
  108. { Options }
  109. ASLFR_Flags1 = ASL_TB+20; { Option flags }
  110. ASLFR_Flags2 = ASL_TB+22; { Additional option flags }
  111. ASLFR_DoSaveMode = ASL_TB+44; { Being used for saving? }
  112. ASLFR_DoMultiSelect = ASL_TB+45; { Do multi-select? }
  113. ASLFR_DoPatterns = ASL_TB+46; { Display a Pattern gadget? }
  114. { Filtering }
  115. ASLFR_DrawersOnly = ASL_TB+47; { Don't display files? }
  116. ASLFR_FilterFunc = ASL_TB+49; { Function to filter files }
  117. ASLFR_RejectIcons = ASL_TB+60; { Display .info files? }
  118. ASLFR_RejectPattern = ASL_TB+61; { Don't display files matching pat }
  119. ASLFR_AcceptPattern = ASL_TB+62; { Accept only files matching pat }
  120. ASLFR_FilterDrawers = ASL_TB+63; { Also filter drawers with patterns}
  121. ASLFR_HookFunc = ASL_TB+7 ; { Combined callback function }
  122. { Sorting }
  123. ASLFR_SetSortBy = ASL_TB+124; { Sort criteria (name, date, size) }
  124. ASLFR_GetSortBy = ASL_TB+125;
  125. ASLFR_SetSortDrawers = ASL_TB+126; { Placement of drawers in the list }
  126. ASLFR_GetSortDrawers = ASL_TB+127;
  127. ASLFR_SetSortOrder = ASL_TB+128; { Order (ascending or descending) }
  128. ASLFR_GetSortOrder = ASL_TB+129;
  129. { Flag bits for the ASLFR_Flags1 tag }
  130. FRB_FILTERFUNC = 7;
  131. FRB_INTUIFUNC = 6;
  132. FRB_DOSAVEMODE = 5;
  133. FRB_PRIVATEIDCMP = 4;
  134. FRB_DOMULTISELECT = 3;
  135. FRB_DOPATTERNS = 0;
  136. FRF_FILTERFUNC = 128;
  137. FRF_INTUIFUNC = 64;
  138. FRF_DOSAVEMODE = 32;
  139. FRF_PRIVATEIDCMP = 16;
  140. FRF_DOMULTISELECT = 8;
  141. FRF_DOPATTERNS = 1;
  142. { Flag bits for the ASLFR_Flags2 tag }
  143. FRB_DRAWERSONLY = 0;
  144. FRB_FILTERDRAWERS = 1;
  145. FRB_REJECTICONS = 2;
  146. FRF_DRAWERSONLY = 1;
  147. FRF_FILTERDRAWERS = 2;
  148. FRF_REJECTICONS = 4;
  149. { Sort criteria for the ASLFR_SetSortBy/ASLFR_GetSortBy tags }
  150. ASLFRSORTBY_Name = 0;
  151. ASLFRSORTBY_Date = 1;
  152. ASLFRSORTBY_Size = 2;
  153. { Drawer placement for the ASLFR_SetSortDrawers/ASLFR_GetSortDrawers tags }
  154. ASLFRSORTDRAWERS_First = 0;
  155. ASLFRSORTDRAWERS_Mix = 1;
  156. ASLFRSORTDRAWERS_Last = 2;
  157. { Sort order for the ASLFR_SetSortOrder/ASLFR_GetSortOrder tags }
  158. ASLFRSORTORDER_Ascend = 0;
  159. ASLFRSORTORDER_Descend = 1;
  160. {****************************************************************************
  161. *
  162. * ASL Font Requester data structures and constants
  163. *
  164. * This structure must only be allocated by asl.library amd is READ-ONLY!
  165. * Control of the various fields is provided via tags when the requester
  166. * is created with AllocAslRequest() and when it is displayed via
  167. * AslRequest()
  168. }
  169. Type
  170. pFontRequester = ^tFontRequester;
  171. tFontRequester = record
  172. fo_Reserved0 : Array[0..7] Of Byte;
  173. fo_Attr : tTextAttr; { Returned TextAttr }
  174. fo_FrontPen : Byte; { Returned front pen }
  175. fo_BackPen : Byte; { Returned back pen }
  176. fo_DrawMode : Byte; { Returned drawing mode }
  177. fo_Reserved1 : Byte;
  178. fo_UserData : Pointer; { You can store your own data here }
  179. fo_LeftEdge : smallint; { Coordinates Of requester on Exit }
  180. fo_TopEdge : smallint;
  181. fo_Width : smallint;
  182. fo_Height : smallint;
  183. fo_TAttr : tTTextAttr; { Returned TTextAttr }
  184. end;
  185. { Font requester tag values, used by AllocAslRequest() AND AslRequest() }
  186. const
  187. { Window control }
  188. ASLFO_Window = ASL_TB+2 ; { Parent window }
  189. ASLFO_Screen = ASL_TB+40; { Screen to open on if no window }
  190. ASLFO_PubScreenName = ASL_TB+41; { Name of public screen }
  191. ASLFO_PrivateIDCMP = ASL_TB+42; { Allocate private IDCMP? }
  192. ASLFO_IntuiMsgFunc = ASL_TB+70; { Function to handle IntuiMessages }
  193. ASLFO_SleepWindow = ASL_TB+43; { Block input in ASLFO_Window? }
  194. ASLFO_UserData = ASL_TB+52; { What to put in fo_UserData }
  195. ASLFO_PopToFront = ASL_TB+131; { Make the requester window visible
  196. * when it opens (V44)
  197. }
  198. ASLFO_Activate = ASL_TB+132; { Activate the requester window when
  199. * it opens (V45).
  200. }
  201. { Text display }
  202. ASLFO_TextAttr = ASL_TB+51; { Text font to use for gadget text }
  203. ASLFO_Locale = ASL_TB+50; { Locale ASL should use for text }
  204. ASLFO_TitleText = ASL_TB+1 ; { Title of requester }
  205. ASLFO_PositiveText = ASL_TB+18; { Positive gadget text }
  206. ASLFO_NegativeText = ASL_TB+19; { Negative gadget text }
  207. { Initial settings }
  208. ASLFO_InitialLeftEdge= ASL_TB+3 ; { Initial requester coordinates }
  209. ASLFO_InitialTopEdge = ASL_TB+4 ;
  210. ASLFO_InitialWidth = ASL_TB+5 ; { Initial requester dimensions }
  211. ASLFO_InitialHeight = ASL_TB+6 ;
  212. ASLFO_InitialName = ASL_TB+10; { Initial contents of Name gadget }
  213. ASLFO_InitialSize = ASL_TB+11; { Initial contents of Size gadget }
  214. ASLFO_InitialStyle = ASL_TB+12; { Initial font style }
  215. ASLFO_InitialFlags = ASL_TB+13; { Initial font flags for TextAttr }
  216. ASLFO_InitialFrontPen= ASL_TB+14; { Initial front pen }
  217. ASLFO_InitialBackPen = ASL_TB+15; { Initial back pen }
  218. ASLFO_InitialDrawMode= ASL_TB+59; { Initial draw mode }
  219. { Options }
  220. ASLFO_Flags = ASL_TB+20; { Option flags }
  221. ASLFO_DoFrontPen = ASL_TB+44; { Display Front color selector? }
  222. ASLFO_DoBackPen = ASL_TB+45; { Display Back color selector? }
  223. ASLFO_DoStyle = ASL_TB+46; { Display Style checkboxes? }
  224. ASLFO_DoDrawMode = ASL_TB+47; { Display DrawMode cycle gadget? }
  225. ASLFO_SampleText = ASL_TB+133; { Text to display in font sample area (V45) }
  226. { Filtering }
  227. ASLFO_FixedWidthOnly = ASL_TB+48; { Only allow fixed-width fonts? }
  228. ASLFO_MinHeight = ASL_TB+16; { Minimum font height to display }
  229. ASLFO_MaxHeight = ASL_TB+17; { Maximum font height to display }
  230. ASLFO_FilterFunc = ASL_TB+49; { Function to filter fonts }
  231. ASLFO_HookFunc = ASL_TB+7 ; { Combined callback function }
  232. ASLFO_MaxFrontPen = ASL_TB+66; { Max # of colors in front palette }
  233. ASLFO_MaxBackPen = ASL_TB+67; { Max # of colors in back palette }
  234. { Custom additions }
  235. ASLFO_ModeList = ASL_TB+21; { Substitute list for drawmodes }
  236. ASLFO_FrontPens = ASL_TB+64; { Color table for front pen palette}
  237. ASLFO_BackPens = ASL_TB+65; { Color table for back pen palette }
  238. { Flag bits for ASLFO_Flags tag }
  239. FOB_DOFRONTPEN = 0;
  240. FOB_DOBACKPEN = 1;
  241. FOB_DOSTYLE = 2;
  242. FOB_DODRAWMODE = 3;
  243. FOB_FIXEDWIDTHONLY= 4;
  244. FOB_PRIVATEIDCMP = 5;
  245. FOB_INTUIFUNC = 6;
  246. FOB_FILTERFUNC = 7;
  247. FOF_DOFRONTPEN = 1;
  248. FOF_DOBACKPEN = 2;
  249. FOF_DOSTYLE = 4;
  250. FOF_DODRAWMODE = 8;
  251. FOF_FIXEDWIDTHONLY = 16;
  252. FOF_PRIVATEIDCMP = 32;
  253. FOF_INTUIFUNC = 64;
  254. FOF_FILTERFUNC = 128;
  255. {****************************************************************************
  256. *
  257. * ASL Screen Mode Requester data structures and constants
  258. *
  259. * This structure must only be allocated by asl.library and is READ-ONLY!
  260. * Control of the various fields is provided via tags when the requester
  261. * is created with AllocAslRequest() and when it is displayed via
  262. * AslRequest()
  263. }
  264. Type
  265. pScreenModeRequester = ^tScreenModeRequester;
  266. tScreenModeRequester = record
  267. sm_DisplayID : ULONG; { Display mode ID }
  268. sm_DisplayWidth : ULONG; { Width Of display IN pixels }
  269. sm_DisplayHeight : ULONG; { Height Of display IN pixels }
  270. sm_DisplayDepth : word; { Number OF bit-planes OF display }
  271. sm_OverscanType : word; { TYPE OF overscan OF display }
  272. sm_AutoScroll : Boolean; { Display should auto-scroll? }
  273. sm_BitMapWidth : ULONG; { Used TO create your own BitMap }
  274. sm_BitMapHeight : ULONG;
  275. sm_LeftEdge : smallint; { Coordinates OF requester on Exit }
  276. sm_TopEdge : smallint;
  277. sm_Width : smallint;
  278. sm_Height : smallint;
  279. sm_InfoOpened : Boolean; { Info window opened on exit? }
  280. sm_InfoLeftEdge : smallint; { Last coordinates OF Info window }
  281. sm_InfoTopEdge : smallint;
  282. sm_InfoWidth : smallint;
  283. sm_InfoHeight : smallint;
  284. sm_UserData : Pointer; { You can store your own data here }
  285. END;
  286. { An Exec list of custom modes can be added to the list of available modes.
  287. * The DimensionInfo structure must be completely initialized, including the
  288. * Header. See <graphics/displayinfo.h>. Custom mode ID's must be in the range
  289. * $FFFF0000..$FFFFFFFF. Regular properties which apply to your custom modes
  290. * can be added in the dn_PropertyFlags field. Custom properties are not
  291. * allowed.
  292. }
  293. pDisplayMode = ^tDisplayMode;
  294. tDisplayMode = record
  295. dm_Node : tNode; { see ln_Name }
  296. dm_DimensionInfo : tDimensionInfo; { mode description }
  297. dm_PropertyFlags : ULONG; { applicable properties }
  298. end;
  299. { ScreenMode requester tag values, used by AllocAslRequest() and AslRequest() }
  300. const
  301. { Window control }
  302. ASLSM_Window = ASL_TB+2 ; { Parent window }
  303. ASLSM_Screen = ASL_TB+40; { Screen to open on if no window }
  304. ASLSM_PubScreenName = ASL_TB+41; { Name of public screen }
  305. ASLSM_PrivateIDCMP = ASL_TB+42; { Allocate private IDCMP? }
  306. ASLSM_IntuiMsgFunc = ASL_TB+70; { Function to handle IntuiMessages }
  307. ASLSM_SleepWindow = ASL_TB+43; { Block input in ASLSM_Window? }
  308. ASLSM_UserData = ASL_TB+52; { What to put in sm_UserData }
  309. ASLSM_PopToFront = ASL_TB+131; { Make the requester window visible
  310. * when it opens (V44)
  311. }
  312. ASLSM_Activate = ASL_TB+132; { Activate the requester window when
  313. * it opens (V45).
  314. }
  315. { Text display }
  316. ASLSM_TextAttr = ASL_TB+51; { Text font to use for gadget text }
  317. ASLSM_Locale = ASL_TB+50; { Locale ASL should use for text }
  318. ASLSM_TitleText = ASL_TB+1 ; { Title of requester }
  319. ASLSM_PositiveText = ASL_TB+18; { Positive gadget text }
  320. ASLSM_NegativeText = ASL_TB+19; { Negative gadget text }
  321. { Initial settings }
  322. ASLSM_InitialLeftEdge = ASL_TB+3 ; { Initial requester coordinates }
  323. ASLSM_InitialTopEdge = ASL_TB+4 ;
  324. ASLSM_InitialWidth = ASL_TB+5 ; { Initial requester dimensions }
  325. ASLSM_InitialHeight = ASL_TB+6 ;
  326. ASLSM_InitialDisplayID = ASL_TB+100; { Initial display mode id }
  327. ASLSM_InitialDisplayWidth = ASL_TB+101; { Initial display width }
  328. ASLSM_InitialDisplayHeight = ASL_TB+102; { Initial display height }
  329. ASLSM_InitialDisplayDepth = ASL_TB+103; { Initial display depth }
  330. ASLSM_InitialOverscanType = ASL_TB+104; { Initial type of overscan }
  331. ASLSM_InitialAutoScroll = ASL_TB+105; { Initial autoscroll setting }
  332. ASLSM_InitialInfoOpened = ASL_TB+106; { Info wndw initially opened? }
  333. ASLSM_InitialInfoLeftEdge = ASL_TB+107; { Initial Info window coords. }
  334. ASLSM_InitialInfoTopEdge = ASL_TB+108;
  335. { Options }
  336. ASLSM_DoWidth = ASL_TB+109; { Display Width gadget? }
  337. ASLSM_DoHeight = ASL_TB+110; { Display Height gadget? }
  338. ASLSM_DoDepth = ASL_TB+111; { Display Depth gadget? }
  339. ASLSM_DoOverscanType = ASL_TB+112; { Display Overscan Type gadget? }
  340. ASLSM_DoAutoScroll = ASL_TB+113; { Display AutoScroll gadget? }
  341. { Filtering }
  342. ASLSM_PropertyFlags = ASL_TB+114; { Must have these Property flags }
  343. ASLSM_PropertyMask = ASL_TB+115; { Only these should be looked at }
  344. ASLSM_MinWidth = ASL_TB+116; { Minimum display width to allow }
  345. ASLSM_MaxWidth = ASL_TB+117; { Maximum display width to allow }
  346. ASLSM_MinHeight = ASL_TB+118; { Minimum display height to allow }
  347. ASLSM_MaxHeight = ASL_TB+119; { Maximum display height to allow }
  348. ASLSM_MinDepth = ASL_TB+120; { Minimum display depth }
  349. ASLSM_MaxDepth = ASL_TB+121; { Maximum display depth }
  350. ASLSM_FilterFunc = ASL_TB+122; { Function to filter mode id's }
  351. { Custom additions }
  352. ASLSM_CustomSMList = ASL_TB+123; { Exec list of struct DisplayMode }
  353. {***************************************************************************}
  354. ASL_LAST_TAG = ASL_TB+133;
  355. {***************************************************************************}
  356. { This defines the rendezvous data for setting and querying asl.library's
  357. * defaults for the window size and the file requester sort order. The name
  358. * of the semaphore is given below; it exists only with asl.library V45 and
  359. * IPrefs V45 and beyond.
  360. }
  361. ASL_SEMAPHORE_NAME : Pchar = 'asl.library';
  362. type
  363. PAslSemaphore = ^tAslSemaphore;
  364. tAslSemaphore = record
  365. as_Semaphore : tSignalSemaphore;
  366. as_Version : UWORD; { Must be >= 45 }
  367. as_Size : ULONG; { Size of this data structure. }
  368. as_SortBy : UBYTE; { File requester defaults; name, date or size }
  369. as_SortDrawers : UBYTE; { File requester defaults; first, mix or last }
  370. as_SortOrder : UBYTE; { File requester defaults; ascending or descending }
  371. as_SizePosition : UBYTE; { See below }
  372. as_RelativeLeft : WORD; { Window position offset }
  373. as_RelativeTop : WORD;
  374. as_RelativeWidth : UBYTE; { Window size factor; this is
  375. * a percentage of the parent
  376. * window/screen width.
  377. }
  378. as_RelativeHeight : UBYTE;
  379. end;
  380. const
  381. { Default position of the ASL window. }
  382. ASLPOS_DefaultPosition = 0; { Position is calculated according to the builtin rules. }
  383. ASLPOS_CenterWindow = 1; { Centred within the bounds of the parent window. }
  384. ASLPOS_CenterScreen = 2; { Centred within the bounds of the parent screen. }
  385. ASLPOS_WindowPosition = 3; { Relative to the top left corner of the parent window,
  386. * using the offset values provided in the
  387. * as_RelativeLeft/as_RelativeTop members.
  388. }
  389. ASLPOS_ScreenPosition = 4; { Relative to the top left corner of the parent screen,
  390. * using the offset values provided in the
  391. * as_RelativeLeft/as_RelativeTop members.
  392. }
  393. ASLPOS_CenterMouse = 5; { Directly below the mouse pointer. }
  394. ASLPOS_MASK = $0F;
  395. { Default size of the ASL window. }
  396. ASLSIZE_DefaultSize = (0 shl 4); { Size is calculated according to the builtin rules. }
  397. ASLSIZE_RelativeSize = (1 shl 4); { Size is relative to the size of the parent
  398. * window or screen, using the values provided in
  399. * the as_RelativeWidth/as_RelativeHeight members.
  400. * The as_RelativeWidth/as_RelativeHeight values are
  401. * taken as percentage, i.e. a value of "50" stands for
  402. * 50% of the width/height of the parent window/screen.
  403. }
  404. ASLSIZE_MASK = $30;
  405. { Other options. }
  406. ASLOPTION_ASLOverrides = (1 shl 6); { ASL determines placement and size of requester
  407. * windows; application's choice is ignored.
  408. }
  409. {****************************************************************************
  410. *
  411. * Obsolete ASL definitions, here for source code compatibility only.
  412. * Please do NOT use in new code.
  413. *
  414. * define ASL_V38_NAMES_ONLY to remove these older names
  415. }
  416. {$define ASL_V38_NAMES_ONLY}
  417. {$ifndef ASL_V38_NAMES_ONLY}
  418. Const
  419. ASL_Dummy = (TAG_USER + $80000);
  420. ASL_Hail = ASL_Dummy+1 ;
  421. ASL_Window = ASL_Dummy+2 ;
  422. ASL_LeftEdge = ASL_Dummy+3 ;
  423. ASL_TopEdge = ASL_Dummy+4 ;
  424. ASL_Width = ASL_Dummy+5 ;
  425. ASL_Height = ASL_Dummy+6 ;
  426. ASL_HookFunc = ASL_Dummy+7 ;
  427. ASL_File = ASL_Dummy+8 ;
  428. ASL_Dir = ASL_Dummy+9 ;
  429. ASL_FontName = ASL_Dummy+10;
  430. ASL_FontHeight = ASL_Dummy+11;
  431. ASL_FontStyles = ASL_Dummy+12;
  432. ASL_FontFlags = ASL_Dummy+13;
  433. ASL_FrontPen = ASL_Dummy+14;
  434. ASL_BackPen = ASL_Dummy+15;
  435. ASL_MinHeight = ASL_Dummy+16;
  436. ASL_MaxHeight = ASL_Dummy+17;
  437. ASL_OKText = ASL_Dummy+18;
  438. ASL_CancelText = ASL_Dummy+19;
  439. ASL_FuncFlags = ASL_Dummy+20;
  440. ASL_ModeList = ASL_Dummy+21;
  441. ASL_ExtFlags1 = ASL_Dummy+22;
  442. ASL_Pattern = ASL_FontName;
  443. { remember what I said up there? Do not use these anymore! }
  444. FILB_DOWILDFUNC = 7;
  445. FILB_DOMSGFUNC = 6;
  446. FILB_SAVE = 5;
  447. FILB_NEWIDCMP = 4;
  448. FILB_MULTISELECT = 3;
  449. FILB_PATGAD = 0;
  450. FILF_DOWILDFUNC = 128;
  451. FILF_DOMSGFUNC = 64;
  452. FILF_SAVE = 32;
  453. FILF_NEWIDCMP = 16;
  454. FILF_MULTISELECT = 8;
  455. FILF_PATGAD = 1;
  456. FIL1B_NOFILES = 0;
  457. FIL1B_MATCHDIRS = 1;
  458. FIL1F_NOFILES = 1;
  459. FIL1F_MATCHDIRS = 2;
  460. FONB_FRONTCOLOR = 0;
  461. FONB_BACKCOLOR = 1;
  462. FONB_STYLES = 2;
  463. FONB_DRAWMODE = 3;
  464. FONB_FIXEDWIDTH = 4;
  465. FONB_NEWIDCMP = 5;
  466. FONB_DOMSGFUNC = 6;
  467. FONB_DOWILDFUNC = 7;
  468. FONF_FRONTCOLOR = 1;
  469. FONF_BACKCOLOR = 2;
  470. FONF_STYLES = 4;
  471. FONF_DRAWMODE = 8;
  472. FONF_FIXEDWIDTH = 16;
  473. FONF_NEWIDCMP = 32;
  474. FONF_DOMSGFUNC = 64;
  475. FONF_DOWILDFUNC = 128;
  476. {$endif ASL_V38_NAMES_ONLY}
  477. VAR AslBase : pLibrary;
  478. FUNCTION AllocAslRequest(reqType : ULONG; tagList : pTagItem) : POINTER;
  479. FUNCTION AllocFileRequest : pFileRequester;
  480. FUNCTION AslRequest(requester : POINTER; tagList : pTagItem) : BOOLEAN;
  481. PROCEDURE FreeAslRequest(requester : POINTER);
  482. PROCEDURE FreeFileRequest(fileReq : pFileRequester);
  483. FUNCTION RequestFile(fileReq : pFileRequester) : BOOLEAN;
  484. PROCEDURE AbortAslRequest(requester : POINTER);
  485. PROCEDURE ActivateAslRequest(requester : POINTER);
  486. {Here we read how to compile this unit}
  487. {You can remove this include and use a define instead}
  488. {$I useautoopenlib.inc}
  489. {$ifdef use_init_openlib}
  490. procedure InitASLLibrary;
  491. {$endif use_init_openlib}
  492. {This is a variable that knows how the unit is compiled}
  493. var
  494. ASLIsCompiledHow : longint;
  495. IMPLEMENTATION
  496. {$ifndef dont_use_openlib}
  497. uses msgbox;
  498. {$endif dont_use_openlib}
  499. FUNCTION AllocAslRequest(reqType : ULONG; tagList : pTagItem) : POINTER;
  500. BEGIN
  501. ASM
  502. MOVE.L A6,-(A7)
  503. MOVE.L reqType,D0
  504. MOVEA.L tagList,A0
  505. MOVEA.L AslBase,A6
  506. JSR -048(A6)
  507. MOVEA.L (A7)+,A6
  508. MOVE.L D0,@RESULT
  509. END;
  510. END;
  511. FUNCTION AllocFileRequest : pFileRequester;
  512. BEGIN
  513. ASM
  514. MOVE.L A6,-(A7)
  515. MOVEA.L AslBase,A6
  516. JSR -030(A6)
  517. MOVEA.L (A7)+,A6
  518. MOVE.L D0,@RESULT
  519. END;
  520. END;
  521. FUNCTION AslRequest(requester : POINTER; tagList : pTagItem) : BOOLEAN;
  522. BEGIN
  523. ASM
  524. MOVE.L A6,-(A7)
  525. MOVEA.L requester,A0
  526. MOVEA.L tagList,A1
  527. MOVEA.L AslBase,A6
  528. JSR -060(A6)
  529. MOVEA.L (A7)+,A6
  530. TST.W D0
  531. BEQ.B @end
  532. MOVEQ #1,D0
  533. @end: MOVE.B D0,@RESULT
  534. END;
  535. END;
  536. PROCEDURE FreeAslRequest(requester : POINTER);
  537. BEGIN
  538. ASM
  539. MOVE.L A6,-(A7)
  540. MOVEA.L requester,A0
  541. MOVEA.L AslBase,A6
  542. JSR -054(A6)
  543. MOVEA.L (A7)+,A6
  544. END;
  545. END;
  546. PROCEDURE FreeFileRequest(fileReq : pFileRequester);
  547. BEGIN
  548. ASM
  549. MOVE.L A6,-(A7)
  550. MOVEA.L fileReq,A0
  551. MOVEA.L AslBase,A6
  552. JSR -036(A6)
  553. MOVEA.L (A7)+,A6
  554. END;
  555. END;
  556. FUNCTION RequestFile(fileReq : pFileRequester) : BOOLEAN;
  557. BEGIN
  558. ASM
  559. MOVE.L A6,-(A7)
  560. MOVEA.L fileReq,A0
  561. MOVEA.L AslBase,A6
  562. JSR -042(A6)
  563. MOVEA.L (A7)+,A6
  564. TST.W D0
  565. BEQ.B @end
  566. MOVEQ #1,D0
  567. @end: MOVE.B D0,@RESULT
  568. END;
  569. END;
  570. PROCEDURE AbortAslRequest(requester : POINTER);
  571. BEGIN
  572. ASM
  573. MOVE.L A6,-(A7)
  574. MOVEA.L requester,A0
  575. MOVEA.L AslBase,A6
  576. JSR -078(A6)
  577. MOVEA.L (A7)+,A6
  578. END;
  579. END;
  580. PROCEDURE ActivateAslRequest(requester : POINTER);
  581. BEGIN
  582. ASM
  583. MOVE.L A6,-(A7)
  584. MOVEA.L requester,A0
  585. MOVEA.L AslBase,A6
  586. JSR -084(A6)
  587. MOVEA.L (A7)+,A6
  588. END;
  589. END;
  590. const
  591. { Change VERSION and LIBVERSION to proper values }
  592. VERSION : string[2] = '0';
  593. LIBVERSION : longword = 0;
  594. {$ifdef use_init_openlib}
  595. {$Info Compiling initopening of asl.library}
  596. {$Info don't forget to use InitASLLibrary in the beginning of your program}
  597. var
  598. asl_exit : Pointer;
  599. procedure CloseaslLibrary;
  600. begin
  601. ExitProc := asl_exit;
  602. if AslBase <> nil then begin
  603. CloseLibrary(AslBase);
  604. AslBase := nil;
  605. end;
  606. end;
  607. procedure InitASLLibrary;
  608. begin
  609. AslBase := nil;
  610. AslBase := OpenLibrary(ASLNAME,LIBVERSION);
  611. if AslBase <> nil then begin
  612. asl_exit := ExitProc;
  613. ExitProc := @CloseaslLibrary;
  614. end else begin
  615. MessageBox('FPC Pascal Error',
  616. 'Can''t open asl.library version ' + VERSION + #10 +
  617. 'Deallocating resources and closing down',
  618. 'Oops');
  619. halt(20);
  620. end;
  621. end;
  622. begin
  623. ASLIsCompiledHow := 2;
  624. {$endif use_init_openlib}
  625. {$ifdef use_auto_openlib}
  626. {$Info Compiling autoopening of asl.library}
  627. var
  628. asl_exit : Pointer;
  629. procedure CloseaslLibrary;
  630. begin
  631. ExitProc := asl_exit;
  632. if AslBase <> nil then begin
  633. CloseLibrary(AslBase);
  634. AslBase := nil;
  635. end;
  636. end;
  637. begin
  638. AslBase := nil;
  639. AslBase := OpenLibrary(ASLNAME,LIBVERSION);
  640. if AslBase <> nil then begin
  641. asl_exit := ExitProc;
  642. ExitProc := @CloseaslLibrary;
  643. ASLIsCompiledHow := 1;
  644. end else begin
  645. MessageBox('FPC Pascal Error',
  646. 'Can''t open asl.library version ' + VERSION + #10 +
  647. 'Deallocating resources and closing down',
  648. 'Oops');
  649. halt(20);
  650. end;
  651. {$endif use_auto_openlib}
  652. {$ifdef dont_use_openlib}
  653. begin
  654. ASLIsCompiledHow := 3;
  655. {$Warning No autoopening of asl.library compiled}
  656. {$Warning Make sure you open asl.library yourself}
  657. {$endif dont_use_openlib}
  658. END. (* UNIT ASL *)