home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / Gfx4PCQ.lha / WindowLib / Utils / WindowLib.i
Encoding:
Text File  |  1997-02-09  |  27.0 KB  |  847 lines

  1. {*****************************************************************
  2.  ** Windowlib                            **
  3.  **                                **
  4.  ** © 1994-97 THOR-Software inc.                **
  5.  ** Version 1.10 / 27 May 1994                    **
  6.  **                                **
  7.  ** Useful graphics support for PCQ                **
  8.  *****************************************************************}
  9.  
  10. {useful message classes. You can receive them by asking windowlib
  11.  with RequestStart}
  12. CONST
  13. { --- IDCMP Classes ------------------------------------------------------ }
  14.     NEWSIZE_f        = $00000002;  {    window got a new size }
  15.     REFRESHWINDOW_f    = $00000004;  { window must be redrawn }
  16.     MOUSEBUTTONS_f    = $00000008;  { a mouse button has been pressed }
  17.     MOUSEMOVE_f        = $00000010;  { the mouse pointer moved }
  18.     GADGETDOWN_f    = $00000020;  { a gadget/field/slider has been pressed }
  19.     GADGETUP_f        = $00000040;  { a gadget/field/slider has been released }
  20.     MENUPICK_f        = $00000100;  { a menu item has been picked }
  21.     CLOSEWINDOW_f    = $00000200;  { the user wants to close the window }
  22.     RAWKEY_f        = $00000400;  { the user pressed a key on the keyboard }
  23.     DISKINSERTED_f    = $00008000;  { a disk has been inserted in one drive }
  24.     DISKREMOVED_f    = $00010000;  { a disk has been removed from one drive }
  25.     ACTIVEWINDOW_f    = $00040000;  { the window got activated }
  26.     INACTIVEWINDOW_f    = $00080000;  { the window got deactivated }
  27.     INTUITICKS_f    = $00400000;  {    a certain time has passed. A tick is a 6th of a second }
  28.  
  29. {the next constants are for the MenuCommand structure and used to setup a
  30.  menu. Each entry has a type as defined below}
  31. { --- Menu Command constants --------------------------------------------- }
  32.     MC_MENU        = 1;        { entry is a menu }
  33.     MC_ITEM        = 2;        { entry is a item of a menu }
  34.     MC_SUBITEM    = 3;        { entry is a subitem of a item }
  35.     MC_LASTMENU    = $81;        { dummy entry to mark end of menu }
  36.     MC_LASTITEM    = $82;        { end of item list of a menu }
  37.     MC_LASTSUBITEM     = $83;        { end of subitem list of a item }
  38. { please note that you MUST insert a MC_LAST... at the end of a item/subitem
  39.   and menu }
  40.  
  41.  
  42. {some flags to be used in the MenuCommand structure}        
  43. { --- Menu Command flags ------------------------------------------------- }
  44.     MC_MENUENABLED    = 1;        {menu is active (menus only) }
  45.     MC_NORMALMENU    = 1;        {same}
  46.                     {item and subitem only flags }
  47.     MC_ITEMENABLED    = $10;        {item is active}
  48.     MC_HIGHCOMP    = $40;        {item is beeing inverted }
  49.     MC_CHECKIT    = $01;        {item is checkable}
  50.     MC_TOGGLE    = $08;        {item is toggleable}
  51.                     {combined flags}
  52.     MC_BAR        = $C0;        {item is a separator bar }
  53.     MC_READONLY    = $D0;        {item is not selectable }
  54.     MC_NORMAL    = $50;        {normal item type}
  55.     MC_OFF        = $40;        {selectable, but disabled}
  56.     MC_CHECKABLE    = $59;        {a checkmark item}
  57.     MC_OFFCHECK    = $49;        {a disabled checkmark}
  58.         
  59. { Each menu command entry consists of four entries:
  60.     i)    the menu command constant defining the type of the entry
  61.         as defined above.
  62.     ii)    the menu command flags
  63.     iii)    a shortcut character, if any (items & subitems only)
  64.     iv)    a dummy which is not yet used
  65.     v)    the name of the entry as NUL-terminated string OR 
  66.         an empty string if flags are MC_BAR
  67.         
  68.     A sample menu command list:
  69.     menubar : ARRAY[1..15] OF MenuCommand=(
  70.     (MC_MENU,MC_NORMALMENU,0,0,"Menu 1"),
  71.      (MC_ITEM,MC_NORMALITEM,'O',0,"Open..."),
  72.      (MC_ITEM,MC_BAR,'\0',0,""),
  73.      (MC_ITEM,MC_OFF,'S',0,"Save..."),
  74.      (MC_LASTITEM,0,'\0',0,""),
  75.     (MC_MENU,MC_NORMALMENU,'\0',0,"Flags"),
  76.      (MC_ITEM,MC_NORMALITEM,'\0',0,"Style"),
  77.       (MC_SUBITEM,MC_CHECKABLE,'P',0,"Plain"),
  78.       (MC_SUBITEM,MC_CHECKABLE,'I',0,"Italic"),
  79.       (MC_SUBITEM,MC_CHECKABLE,'B',0,"Bold"),
  80.       (MC_SUBITEM,MC_CHECKABLE,'U',0,"Underline"),
  81.       (MC_LASTSUBITEM,0,'\0',0,""),
  82.      (MC_ITEM,MC_OFFCHECK,'\0',0,"Save ASCII"),
  83.      (MC_LASTITEM,0,'\0',0,""),
  84.     (MC_LASTMENU,0,'\0',0,""));
  85. }
  86.  
  87. {here some monitor types. I only give a list of popular ones, but all
  88.  monitor ID added to the system are valid here. Read the docs of your
  89.  gfx card here to find out about them.}
  90. { --- Monitor Types ------------------------------------------------------ }
  91.     {OR all types together to get monitor. PAL,NTSC etc. work only
  92.      in 2.0 or higher...}
  93.      
  94.     {Monitor types...}
  95.     MON_NTSC    =    $11000;
  96.     MON_PAL        =    $21000;
  97.     MON_VGA        =    $31004;    {OR with HIRES, or you get SUPERLORES}
  98.     MON_A2024    =    $41000;
  99.     MON_A2024_15    =    $49000;
  100.     MON_SUPER72    =    $81000;
  101.     MON_EURO36    =    $71000;
  102.     MON_EURO72    =    $61004; {OR with HIRES, or you get SUPERLOWRES}
  103.     MON_DBLNTSC    =    $91000;
  104.     MON_DBLPAL    =    $A1000;
  105.     
  106.     
  107.     MON_LORES    =    $0000;
  108.     MON_HIRES    =    $8000;
  109.     MON_SUPER    =    $8020;
  110.     MON_HAM        =    $0800;
  111.     MON_LACE    =    $0004;
  112.     MON_VGALACE    =    $0001; {USE for VGA,EURO72}
  113.     MON_EHB        =    $0080;
  114.       
  115.  
  116. { we define now some types to be used with the windowlib. Some of them
  117.   are just of type Address, i.e. do not care what they mean. The window
  118.   lib cares about them. Just keep them, but to not touch them, O.K. ? }
  119.  
  120. TYPE
  121.     ScreenPtr    =    Address;    { object describing a screen }
  122.     WindowPtr    =    Address;    { object describing a window }
  123.     GadgetPtr    =    Address;    { object describing a gadget/field/slider }    
  124.     IntuiMessagePtr =    Address;    { object describing a message. 
  125.                           This is NOT for beginners. All Request functions
  126.                           read INTEGERS, not this one! Just leave it
  127.                           alone, O.K. ?}
  128.  
  129.     { this structure defines a complete menu, see above for a sample
  130.       menu }
  131.  
  132.     MenuCommand    =    RECORD
  133.         MenuType    :    BYTE;    { type of entry: item/subitem/menu/lastitem/lastsubitem/lastmenu }
  134.         MenuFlags    :    BYTE;    { special flags for appearance }
  135.         ShortCut    :    CHAR;    { shortcut character for items and subitems }
  136.         reserved    :    BYTE;    { do not touch it }
  137.         MenuText    :    String;    { the string }
  138.     END;
  139.     MenuCommandArray = ARRAY[0..0] OF MenuCommand; {define for own purposes}
  140.  
  141. { some interal use only variables. Do not touch! }
  142. VAR
  143.     ConsoleBase,
  144.     DiskFontBase,
  145.     LayersBase,
  146.     GfxBase        :    Address;
  147.         
  148.  
  149.  
  150. { Now we come to the procedures and functions supplied by the windowlib.
  151.   They are all external and will be linked to the final program with the
  152.   binary library. }
  153.  
  154. { --- windowlib functions -------------------------------------------------}
  155.  
  156. PROCEDURE SortCoords(VAR x1,y1,x2,y2 : SHORT);
  157. EXTERNAL;
  158. { sort two pairs of coordinates to be left,top,right,bottom }
  159.  
  160.     
  161. PROCEDURE ExitGraphics;
  162. EXTERNAL;
  163. { close graphic subsystem: You MUST call this before exit! }
  164.  
  165.     
  166. PROCEDURE InitGraphics;
  167. EXTERNAL;
  168. { initialize graphic subsytem: You MUST call this before starting}
  169.  
  170.     
  171. FUNCTION InstallStdClip(w : WindowPtr) : BOOLEAN;
  172. EXTERNAL;
  173. { installes standard cliprect in non-GZZ-windows. You can use this call
  174.   to restore the cliprect back to default values after Clip,SetOffset.
  175.   This call CAN fail, and will return FALSE in this case.
  176.   It turns off the custom clipping done by Clip/SetOffset }
  177.  
  178.  
  179. PROCEDURE DeleteButton(g : GadgetPtr);
  180. EXTERNAL;
  181. { given a gadget, this procedure removes the gadget from the window 
  182.   and deletes it }
  183.  
  184.  
  185. PROCEDURE OffButton(g : GadgetPtr);
  186. EXTERNAL;
  187. { disable a gadget }
  188.  
  189.     
  190. PROCEDURE OnButton(g : GadgetPtr);
  191. EXTERNAL;
  192. { enable a gadget }
  193.  
  194.  
  195. PROCEDURE RefreshButton(g : GadgetPtr);
  196. EXTERNAL;
  197. { redraw a gadget if its gfx has been overdrawn }
  198.  
  199.     
  200. FUNCTION CreateTextButton(w : WindowPtr;x,y,xsize,ysize : SHORT;text : String) : GadgetPtr;
  201. EXTERNAL;
  202. { create a button with a text in it at given coordinates and given size.
  203.   The size may be zero, in this case it's taken from the string, i.e. the
  204.   button will be just big enough to hold it.
  205.   This thingly is called a "bool gadget" in intuition terms, we call it
  206.   "TextButton". You hear a GADGETUP_f request if the user presses this one
  207.   (and you selected to hear these events in first place) }
  208.  
  209.  
  210. FUNCTION CreateTextToggle(w : WindowPtr;x,y,xsize,ysize : SHORT;text : String) : GadgetPtr;
  211. EXTERNAL;
  212. { create a toggle button with a text in it at given coordinates 
  213.   and given size. This is almost like a TextButton, but will remain in 
  214.   pressed / released position. It can be toggled on or off.}
  215.     
  216. PROCEDURE SetToggle(g : GadgetPtr;state : BOOLEAN);
  217. EXTERNAL;
  218. { set state of a toggle gadget (on for TRUE or off for FALSE)};
  219.     
  220. FUNCTION GetToggle(g : GadgetPtr) : BOOLEAN;
  221. EXTERNAL;
  222. { get state of a toggle gadget: TRUE is pressed position};
  223.     
  224. FUNCTION IDFromGadget(g : GadgetPtr) : SHORT;
  225. EXTERNAL;
  226. { calculates the ID of a given gadget. They are numbered from 1 increasing
  227.   in the order of generation }
  228.     
  229.  
  230. FUNCTION GadgetFromID(w : WindowPtr;id : SHORT) : GadgetPtr;
  231. EXTERNAL;
  232. { calculates the gadgethandle from the ID, returns NIL if not found }
  233.     
  234.  
  235. { The next calls handle the windowlib event machine. With RequestStart,
  236.   you inform the lib to notify you about certain events, defined on top
  237.   of this file (the IDCMPs). }
  238.  
  239. PROCEDURE RequestStart(w : WindowPtr;what : INTEGER);
  240. EXTERNAL;
  241. { starts a request of given type (see constants above) at given window.
  242.   The windowlib starts sending these events. You may request more than
  243.   one at once by adding or or-ing the IDCMP values defined on top. }
  244.  
  245.  
  246. PROCEDURE RequestEnd(w : WindowPtr;what : INTEGER);
  247. EXTERNAL;
  248. { ends a request, i.e. windowlib does no longer send events of the given
  249.   type. Like the procedure defined above, more than one event is accepted
  250.   at one time. Just OR or add the values together }
  251.  
  252.  
  253. FUNCTION NextRequest(w : WindowPtr) : INTEGER;
  254. EXTERNAL;
  255. { returns the last event happened or 0 if nothing happens.
  256.   This call DOES not wait, your program will continue to run.
  257.   Please DO NOT USE NextRequest in a do-nothing loop since this
  258.   will slow down your machine considerably. Use WaitRequest 
  259.   instead to wait until something has happened. }
  260.  
  261.  
  262. FUNCTION WaitRequest(w : WindowPtr) : INTEGER;
  263. EXTERNAL;
  264. { returns the last event happend or waits if nothing happend
  265.   until something IS happening. This will send your program to
  266.   sleep! }
  267.  
  268.  
  269.  
  270. FUNCTION LastGadgetID(w : WindowPtr) : INTEGER;
  271. EXTERNAL;
  272. { returns the ID of the last gadget selected }
  273.  
  274.  
  275.  
  276. FUNCTION MouseButton(w : WindowPtr) : BOOLEAN;
  277. EXTERNAL;
  278. { returns the state of the mouse button, may send task to sleep for
  279.   max. one 6th of a second. 
  280.   This call returns ONLY the state of the LEFT mouse button (TRUE for
  281.   pressed) as the right one is reserved for the menu. Please do not
  282.   break the system law by using the right button for something else! }
  283.  
  284.     
  285. FUNCTION ModIDCMP(w : WindowPtr; new : INTEGER) : INTEGER;
  286. EXTERNAL;
  287. { modifies the IDCMP-flags. You should know what you're doing if you
  288.   call this. Return the previous flags.
  289.   This call should not used by beginners! HANDS OFF!
  290.  
  291.   The ordinary user should use the Request like functions defined
  292.   above to do the job, since they are a) easier to use and b)
  293.   friendly to the windowlib system. THIS ONE IS INTERNAL USE ONLY! }
  294.  
  295.   
  296. FUNCTION GetWindowMsg(w : WindowPtr)    : IntuiMessagePtr;
  297. EXTERNAL;
  298. { returns the lastest message arrived at window w. After using it,
  299.   you should reply it with ReplyMsg(msg). 
  300.  
  301.   The same caveats go for this function as for the function on top.
  302.   DO NOT USE! USE Request... instead! }
  303.  
  304.   
  305. FUNCTION WaitUntilWindow(w : WindowPtr) : IntuiMessagePtr;
  306. EXTERNAL;
  307. { send task to sleep untit message arrives, returns the message -
  308.   already removed from window - in contrast to WaitMsg.
  309.  
  310.   This is also an INTERNAL USE ONLY FUNCTION! Use WaitRequest() or
  311.   NextRequest() instead ! }
  312.  
  313.  
  314.   
  315. FUNCTION OpenAWindow(left,top,wdth,hght,flgs: INTEGER; tit : String) : WindowPtr;
  316. EXTERNAL;
  317. { opens a window at given position, given size, flags and title. Returns
  318.   a handle to that window - as needed by all other procedures.
  319.   Flags should be 14 for most resons, see Libraries/Autodocs for more.
  320.   THIS CALL MAY FAIL ! - Check the value: If NIL, there's no window !
  321.   This call is only present for backward compatibility, use
  322.   OpenScreenWindow with Screen set to NIL instead ! }
  323.   
  324. FUNCTION OpenScreenWindow(s : ScreenPtr;left,top,wdth,hght,flgs : INTEGER; tit : String) : WindowPtr;
  325. EXTERNAL;
  326. { works like OpenAWindow, but opens window on given screen. NIL is the
  327.   workbench.
  328.   THIS CALL MAY FAIL ! }
  329.   
  330. PROCEDURE CloseAWindow(w : WindowPtr);
  331. EXTERNAL;
  332. { closes given window. After this call, the windowpointer is no longer
  333.   available.
  334.   Works fine for both OpenAWindow and OpenScreenWindow.
  335.   PLEASE CLOSE ALL WINDOWS you have opened! }
  336.  
  337.   
  338. FUNCTION OpenAScreen(left,top,wdth,hgth,dpth,flgs : INTEGER; tit : String) : ScreenPtr;
  339. EXTERNAL;
  340. { opens a new screen at left,top with given width and height.
  341.     WARNING 1:left will be ignored prior to 2.0
  342.   The screen depth is given in dpth.
  343.       WARNING 2:not all depth will work, use them in a range of 1..6
  344.         for MON_LORES or 1..4 with MON_HIRES.
  345.   2 to the power of dpth gives the number of available pens for this
  346.   screen.
  347.  
  348.   The monitor type to use is determinated by flgs (see definitions above).
  349.       WARNING 3:not all monitors support all types, some types
  350.         (EHB,HAM) need a depth of 6 and NO LORES.
  351.   The default title will be in tit.
  352.   The return value is a handle to the screen.
  353.       WARNING 4:THIS CALL MAY FAIL ! If it returns NIL, there's NO
  354.     SCREEN !}
  355.     
  356. PROCEDURE CloseAScreen(s : ScreenPtr);
  357. EXTERNAL;
  358. { closes a given screen (removes it from display and memory).
  359.   You should close all windows of this screen prior to calling this 
  360.  (else this procedure does it for you...) }
  361.  
  362. PROCEDURE SetColor(s : ScreenPtr;reg,red,green,blue : SHORT);
  363. EXTERNAL;
  364. { sets given color register=pen reg to a new color given
  365.   by red,green,blue. They range from 0 to 15, with 15 beeing the
  366.   maximum. 15,15,15 is white. }
  367.  
  368.     
  369. PROCEDURE GetColor(s : ScreenPtr;reg : SHORT;VAR r,g,b : SHORT);
  370. EXTERNAL;
  371. { read given color register, place the values in r,g,b }
  372.  
  373.  
  374.         
  375. PROCEDURE WaitForIDCMP(w : WindowPtr; what : INTEGER);
  376. EXTERNAL;
  377. { wait until given IDCMP-flag arrives. They don't queue up in this
  378.   release, so watch out. Call this only if you know what IDCMP is. 
  379.  
  380.   ONCE AGAIN! DO NOT USE IT, USE NextRequest/WaitRequest INSTEAD!
  381.   THIS ONE IS INTERNAL USE ONLY! }
  382.  
  383.   
  384. PROCEDURE Mouse(w : WindowPtr;VAR x,y : SHORT);
  385. EXTERNAL;
  386. { returns current mouse position. Because of multitasking, the values
  387.   returned may be incorrect by a small amount if the mouse moved !
  388.   The coordinates are relative to the window you gave. }
  389.  
  390.   
  391. PROCEDURE WaitLeftClick(w : WindowPtr;VAR x,y : SHORT);
  392. EXTERNAL;
  393. { wait until user presses left button and return the position where the
  394.   mouse has been pressed }
  395.  
  396.     
  397. PROCEDURE WaitForClick(w : WindowPtr);
  398. EXTERNAL;
  399. { as above, but does not return mouse position }
  400.     
  401.  
  402. FUNCTION MouseDown(w : WindowPtr; VAR x,y : SHORT) : BOOLEAN;
  403. EXTERNAL;
  404. { returns position of the left mouse button - TRUE for down - 
  405.   and position of the mouse. This call may send your task to sleep 
  406.   for 1/6th second. }
  407.   
  408.  
  409. FUNCTION MouseMove(w : WindowPtr; VAR x,y : SHORT) : BOOLEAN;
  410. EXTERNAL;
  411. { as above, but waits until the mouse gets moved }
  412.  
  413.     
  414. PROCEDURE WaitForClose(w : WindowPtr);
  415. EXTERNAL;
  416. { waits until user presses the close gadget. It's your job to close
  417.   the window with CloseAWindow - that's not done by this procedure }
  418.   
  419.  
  420. { The next calls are for creating gfx in the windows you opened with
  421.   OpenScreenWindow/OpenAWindow. They take the window you want to draw in
  422.   as an argument }
  423.  
  424. PROCEDURE Color(w : WindowPtr; c : BYTE);
  425. EXTERNAL;
  426. { sets foreground drawing color=pen. 
  427.   The number of pens available depends on the screen you openend the window
  428.   on. The contents of the pen is selected with SetColor() defined above.}
  429.     
  430. PROCEDURE BgColor(w : WindowPtr; c : BYTE);
  431. EXTERNAL;
  432. { sets background color, used for text }
  433.     
  434.  
  435. PROCEDURE OlColor(w : WindowPtr; c: BYTE);
  436. EXTERNAL;
  437. { sets outline color, only used if Boundary(w,TRUE) called.
  438.   A boundary will be drawn around objects created by 
  439.   PBox and PEllipse and the Area calls }
  440.     
  441.  
  442. PROCEDURE Boundary(w : WindowPtr; onoff : BOOLEAN);
  443. EXTERNAL;
  444. { if called with onoff=TRUE, all filled shapes are drawn with a
  445.   frame of pen OlColor around them }
  446.  
  447.   
  448. PROCEDURE DrawMode(w : WindowPtr; mode : BYTE);
  449. EXTERNAL;
  450. { selects drawmode. The following modes are valid:
  451.     0        called JAM1. Draw with the foreground pen
  452.             as defined by Color. This is the default.
  453.     1        called JAM2 and like JAM1, except for text.
  454.             The background of the text is transparent for
  455.             JAM1 and drawn by the pen defined with BGPen
  456.             for JAM2
  457.     2        COMPLEMENT. The pixels get inverted by drawing
  458.             over them. Useful if you want an operation to be
  459.             undone easely. Draw it with COMPLETENT and to
  460.             remove it, draw it again with COMPLEMENT.
  461.     4        INVERSEVID. Exchanges the meaning of the 
  462.             foreground and background pen.
  463. All modes can be combined by adding the values given in this list. }
  464.  
  465.     
  466. PROCEDURE SetDrawPattern(w : WindowPtr; pat : SHORT);
  467. EXTERNAL;
  468. { selects pattern for lines.
  469.   Each bit in the variable pat defines one dot in a pattern of 16
  470.   pixel length. Some useful values are
  471.   65535        for solid lines
  472.   21845        for dotted lines (each other pixel set)
  473.   13107        for even bigger dots
  474.   3855        for dashed lines
  475.   255        for even longer dashes.
  476.   4369        for tiny dots (each forth pixel set) }
  477.  
  478.     
  479. PROCEDURE ClearRaster(w : WindowPtr; color : BYTE);
  480. EXTERNAL;
  481. { fill entire window with given color }
  482.  
  483.     
  484. PROCEDURE ClearWindow(w : WindowPtr);
  485. EXTERNAL;
  486. { fill entire window with background color, set by BgColor }
  487.     
  488. PROCEDURE SetWriteMask(w : WindowPtr; mask : BYTE);
  489. EXTERNAL;
  490. { sets bitplane mask. Only the bit planes with the
  491.   corresponding bit set in the mask will be affected by graphic
  492.   operations. Bit 0 is plane 0 and so on.
  493.   255 is the default, meaning all plains will be drawn into. }
  494.     
  495.  
  496. PROCEDURE DrawTo(w : WindowPtr; x,y : SHORT);
  497. EXTERNAL;
  498. { draws a line from last plot/position point to this one.
  499.   The first point is set by Plot or Position }
  500.  
  501.     
  502. PROCEDURE Ellipse(w : WindowPtr; xm,ym,x,y : SHORT);
  503. EXTERNAL;
  504. { draws a ellipse around xm,ym with radii x,y }
  505.  
  506.     
  507. FUNCTION Locate(w : WindowPtr; x,y : SHORT) : BYTE;
  508. EXTERNAL;
  509. { returns color of point at x,y or -1 if the point is
  510.   outside of the window }
  511.  
  512.     
  513. PROCEDURE Scroll(w : WindowPtr; x1,y1,x2,y2,dx,dy : SHORT);
  514. EXTERNAL;
  515. { scroll rectangle x1,y1,x2,y2 given amount dx,dy
  516.   negative values are downwards/rightwards }
  517.  
  518.     
  519. PROCEDURE DrawText(w : WindowPtr;text : String);
  520. EXTERNAL;
  521. { write text at last position/plot point.
  522.   The position is again determined by the last
  523.   Position or Plot call }
  524.  
  525.  
  526. FUNCTION GetTextLength(w : WindowPtr;text : String) : SHORT;
  527. EXTERNAL;
  528. { returns length of text in pixels, using the actual font.
  529.   The font can be set by another call, see below. }
  530.  
  531.  
  532. PROCEDURE Plot(w : WindowPtr; x,y : SHORT);
  533. EXTERNAL;
  534. { draw one point at x,y in foreground color, as set by
  535.   the Color call }
  536.  
  537.     
  538.  
  539. PROCEDURE Position(w : WindowPtr; x,y : SHORT);
  540. EXTERNAL;
  541. { selects next position for DrawTo,Text,...}
  542.  
  543.     
  544. PROCEDURE Line(w : WindowPtr; x1,y1,x2,y2 : SHORT);
  545. EXTERNAL;
  546. { draw a line from x1,y1 to x2,y2, coordinates are
  547.   relative to the window and the color as been set
  548.   by Color }
  549.     
  550.  
  551. PROCEDURE Fill(w : WindowPtr; x,y : SHORT);
  552. EXTERNAL;
  553. { starts flood fill at x,y. THIS CALL MAY FAIL
  554.   if not enough memory for a temporary storage area
  555.   is available ! }
  556.  
  557.   
  558. PROCEDURE PBox(w : WindowPtr; x1,y1,x2,y2 : SHORT);
  559. EXTERNAL;
  560. { draw a filled box from x1,y1,x2,y2 - draw frame around it
  561.   if boudary is TRUE with the pen OlColor() }
  562.  
  563.   
  564. PROCEDURE Box(w : WindowPtr; x1,y1,x2,y2 : SHORT);
  565. EXTERNAL;
  566. { draw a frame from x1,y1 to x2,y2. The name is a bit
  567.   misleading as this box does not get filled }
  568.     
  569.  
  570.  
  571. PROCEDURE SetOffset(w : WindowPtr; x,y : SHORT);
  572. EXTERNAL;
  573. { sets coordinate offset. Normally, the leftmost, topmost point
  574.   will have the coordinates 0,0 - after this call it's -x,-y.
  575.   BY INSTALLING THIS OFFSET, THE POINTS ALREADY DRAWN WON'T MOVE!
  576.  
  577.   You should note that x,y is relative to an already installed
  578.   offset anyway - so SetOffset(w,0,0) does nothing usefull.
  579.   Use SetOffset(w,-x,-y) or InstallStdClip(w) to restore the old
  580.   values. }
  581.   
  582.  
  583. PROCEDURE Clip(w : WindowPtr; x1,y1,x2,y2 : SHORT);
  584. EXTERNAL;
  585. { installes a clipping rectangle in given window - only
  586.   points inside of the rectangle x1,y1,x2,y2 are affected
  587.   by drawing. To remove the ClipRect again, call 
  588.   InstallStdClip(w).
  589.   However, the coordinates of all points are not moved -
  590.   use SetOffset to move point 0,0 to the left edge of
  591.   your clipping rectangle.}
  592.  
  593.  
  594.  
  595. { The next functions are so-called area-functions. You may
  596.   record certain graphic operations by them, and doing them all
  597.   at once with one call, filling the drawn shape with a
  598.   given color. This is most useful for drawing filled polygones:
  599.   Use a sequence of AreaMove/AreaDraw calls to setup the boundary
  600.   points, and call CompleteArea() to draw it. If you called
  601.   Boundary(w,TRUE) before, the boundary will be drawn in an
  602.   additional color, defined by OlColor. The color which is used to
  603.   fill the polygone is setup by Color(). }
  604.  
  605.   
  606. PROCEDURE AddAreaEllipse(w : WindowPtr; xm,ym,x,y : SHORT);
  607. EXTERNAL;
  608. { this is a area function. This means: calling this type of function
  609.   stacks all operation back - the objects are drawn later with a
  610.   call to CompleteArea.
  611.   This call adds a filled ellipse at xm,ym, radii x,y to the object
  612.   stack. }
  613.   
  614. PROCEDURE AddAreaDraw(w : WindowPtr; x,y : SHORT);
  615. EXTERNAL;
  616. { this call adds a point to a filled polygon to the object stack.
  617.   The polygon is completed with an AddAreaPoint or a CompleteArea.
  618.  
  619.   This call does actually not the drawing, call CompleteArea to
  620.   make your object visible after defining all points. }
  621.  
  622.   
  623. PROCEDURE AddAreaMove(w : WindowPtr; x,y : SHORT);
  624. EXTERNAL;
  625. { complete old filled polygon - if any - and start a new one at
  626.   x,y. This is again an area function, so its operation is
  627.   invisible until a call to CompleteArea. }
  628.   
  629. PROCEDURE CompleteArea(w : WindowPtr);
  630. EXTERNAL;
  631. { complete all objects and draw them, start a new invisible
  632.   object definition. You must call this if you want to see
  633.   your defined area-objects. }
  634.  
  635.   
  636. PROCEDURE PEllipse(w : WindowPtr; xm,ym,x,y : SHORT);
  637. EXTERNAL;
  638. { draw a filled ellipse at xm,ym with radii x,y.
  639.   Cause this call uses area-functions, you should not use it
  640.   inside of an area definition or all your objects get lost! }
  641.  
  642.   
  643. PROCEDURE SetAreaSize(w : WindowPtr; size : SHORT);
  644. EXTERNAL;
  645. { sets size of area object stack. Default is 256 points.
  646.   You should call this if you get an area buffer overflow error, i.e.
  647.   the program will abort with a warning message in this case.}
  648.  
  649.  
  650.     
  651. PROCEDURE Dimensions(w : WindowPtr; VAR width,height : SHORT);
  652. EXTERNAL;
  653. { get size of drawable area in pixels from the window.
  654.   This is NOT the size of the window itself, since the boundary
  655.   ocupies some space. Dimensions=Window-Boundary !}
  656.  
  657.     
  658. PROCEDURE SelectPoint(w : WindowPtr; VAR x,y : SHORT);
  659. EXTERNAL;
  660. { let user select a point of the window, with a cross.}
  661.  
  662.  
  663. PROCEDURE DragBox(w : WindowPtr; xanc,yanc : SHORT; VAR x,y : SHORT);
  664. EXTERNAL;
  665. { let the user select the other edge of a rectangle.
  666.   This call assumes the user is already pressing the mouse button,
  667.   use this call together with SelectPoint to define a rectangle:
  668.  
  669.   SelectPoint(w,x1,y1);
  670.   DragBox(w,x2,y2); 
  671.  
  672.   will do this job - after all x1,y1,x2,y2 contain the rectangle }
  673.  
  674.  
  675.  
  676. FUNCTION SetWindowFont(w : WindowPtr;name : String;size : SHORT) : BOOLEAN;
  677. EXTERNAL;
  678. { select the default font of the window.
  679.   This call may fail if the desired font is not available.
  680.  
  681.   Specifying disk fonts is valid here, in this case the call will
  682.   load the desired font from disk. }
  683.  
  684.  
  685.   
  686. PROCEDURE Print(w : WindowPtr;text : String);
  687. EXTERNAL;
  688. { Print a string to the window. Unlike DrawText, all escape
  689.   sequences of the console are interpreted, but Print is much slower! }
  690.  
  691.  
  692.   
  693. PROCEDURE SetStyle(w : WindowPtr;style : SHORT);
  694. EXTERNAL;
  695. { Select the style of the window default font.
  696.     1     is     underlined, 
  697.     2     is     bold, 
  698.     4     is     italic.
  699.  Add the values for style combinations.}
  700.  
  701.     
  702. FUNCTION CreateStringField(w : WindowPtr;x,y,xsize,ysize : SHORT) : GadgetPtr;
  703. EXTERNAL;
  704. { Create a field ready for string entry. This is again
  705.   an intuition "gadget" object. You receive a GADGETUP_f message if
  706.   the user presses RETURN inside. The text he entered can be obtained
  707.   by another call, definded below. }
  708.  
  709.  
  710.     
  711. FUNCTION ActivateField(g : GadgetPtr) : BOOLEAN;
  712. EXTERNAL;
  713. { Activates a string field, returns TRUE on success.
  714.   Activation means that the cursor gets drawn in this field,
  715.   and user input goes to it. }
  716.     
  717.  
  718. FUNCTION BufferFromField(g : GadgetPtr) : String;
  719. EXTERNAL;
  720. { given a string field this call returns the text that has 
  721.   been entered in it. }
  722.     
  723.  
  724. { Again some slider related calls }
  725.  
  726. PROCEDURE SetSlider(g : GadgetPtr;choices,viewable,first : SHORT);
  727. EXTERNAL;
  728. { set slider position, viewable elements and # of choices, and the
  729.   intial position of the slider. 
  730.   If you want the user to select an item of a list consisting of 
  731.   20 elements with 5 beeing shown on the screen, set
  732.     choices     to     20
  733.     viewable    to    5
  734.   and first to whichever element is visible on top of the viewable
  735.   selection. The elements are numbered from 0 to choices-1.
  736.   If you don't want to maintain a list, just want to get a value with
  737.   a slider, set viewable to one. }
  738.  
  739.     
  740. PROCEDURE SetSliderFirst(g : GadgetPtr;first : SHORT);
  741. EXTERNAL;
  742. { set only position of slider. Same as call above, but does
  743.   not change the size of the list }
  744.     
  745.  
  746. FUNCTION CreateSlider(w : WindowPtr;x,y,xsize,ysize : SHORT;vert : BOOLEAN) : GadgetPtr;
  747. EXTERNAL;
  748. { create a slider gadget at position with given size.
  749.   if vert is true, it's moveable vertically, else horizontally.
  750.   The size of the knob of this slider is NOT set by this function,
  751.   you have to do this with a call of SetSlider. This will also set the
  752.   position of the knob. }
  753.  
  754.   
  755. FUNCTION FirstFromSlider(w : GadgetPtr) : SHORT;
  756. EXTERNAL;
  757. { returns current position of the slider, i.e. the number of
  758.   the topmost element of the viewables. This varies from
  759.   0 to choices-viewable, as defined by SetSlider() }
  760.  
  761.  
  762.  
  763.  
  764. PROCEDURE CreateMenu(w : WindowPtr;cmd : Address);
  765. EXTERNAL;
  766. { create a menu, giving the MenuCommand structure.
  767.   See the beginning of this file for how this 
  768.   structure looks like. }
  769.  
  770.  
  771. PROCEDURE DeleteMenu(w : WindowPtr);
  772. EXTERNAL;
  773. { delete the menu. }
  774.  
  775.  
  776.     
  777. PROCEDURE LastMenu(w : WindowPtr;VAR menu,item,subitem : SHORT);
  778. EXTERNAL;
  779. { get number of last menu selected, returns -1 if not.
  780.   menu, item, subitem are the numbers of the menu/item/subitem resp.
  781.   counting from 0 and from left to right, from top to bottom.
  782.   If one entry is -1, no menu/item/subitem has been selected. }
  783.  
  784.     
  785. PROCEDURE OnMenuPoint(w : WindowPtr;menu,item,subitem : SHORT);
  786. EXTERNAL;
  787. { enable given menu point. The numbering is the same as the
  788.   one above. To enable a complete list of subitems of an item,
  789.   set item to the correct item number and set subitem to -1. }
  790.  
  791.     
  792. PROCEDURE OffMenuPoint(w : WindowPtr;menu,item,subitem : SHORT);
  793. EXTERNAL;
  794. { disable given menu point, different direction of OffMenuPoint }
  795.  
  796.     
  797. PROCEDURE CheckMenu(w : WindowPtr;menu,item,subitem : SHORT;check : BOOLEAN);
  798. EXTERNAL;
  799. { set checkmark of a menupoint. Set if check is TRUE, else clear. }
  800.  
  801.     
  802. FUNCTION CheckMarkOfMenu(w : WindowPtr;menu,item,subitem : SHORT) : BOOLEAN;
  803. EXTERNAL;
  804. { returns the state of the checkmark of a given menu }
  805.  
  806.  
  807. PROCEDURE LastKey(w : WindowPtr;text : String;VAR qualifier : SHORT);
  808. EXTERNAL;
  809. { copies the last keyboard entry to text.
  810.   "Text" should be at least 16 characters long. }
  811.  
  812.  
  813.  
  814. PROCEDURE ScreenToBack(s : ScreenPtr);
  815. EXTERNAL;
  816. { move screen to background } 
  817.     
  818.  
  819.  
  820. PROCEDURE ScreenToFront(s : ScreenPtr);
  821. EXTERNAL;
  822. { make screen the topmost }
  823.  
  824.  
  825. PROCEDURE ShowTitle(s : ScreenPtr;showit : BOOLEAN);
  826. EXTERNAL;
  827. { show or remove title bar }
  828.  
  829.     
  830. PROCEDURE WBenchToFront;
  831. EXTERNAL;
  832. {move the workbench screen to front}
  833.  
  834.  
  835. PROCEDURE WBenchToBack;
  836. EXTERNAL;
  837. {move the workbench screen to back}
  838.  
  839.  
  840. PROCEDURE OpenWorkBench;
  841. EXTERNAL;
  842. {open the workbench screen}
  843.  
  844. PROCEDURE CloseWorkBench;
  845. EXTERNAL;
  846. {close the workbench screen}
  847.