Here is my slightly useful AmigaE modules. There are probably loads of bugs in
them. :). You do not need permission to use them in your programs, but if you do
use them, I wouldn't mind an email :).
--------------------------------------------------------------------------------
mygfxtools.m
mydrawbox()
-----------
NAME: mydrawbox()
SYNOPSIS: mydrawbox(rp, dri, x, y, x2, y2, type, recessed, light, lightpen, darkpen)
DESCRIPTION: Draw a varitey of bevel boxes in a rastport
INPUT: rp - rastport
dri - screen drawinfo
x - left coord
y - top coord
x2 - right coord
y2 - bottom coord
type - type of box to draw, a number ranging from 1 to 6...
1 = Box
2 = Bevel
3 = Smooth bevel
4 = Embossed
5 = Ridge
6 = Wide ridge
7 - Smooth ridge
recessed - if TRUE the box will be drawn recessed
light - if TRUE the light and dark pen will be used instead of the black
and white pens.
lightpen - pen number of light colour
darkpen - pen number of dark colour
myscrollraster()
----------------
NAME: myscrollraster()
SYNOPSIS: myscrollraster(rp, x, y, x2, y2, deltax, deltay)
DESCRIPTION: Works exactly like ScrollRaster(). myscrollraster() uses
BlitCopy(), and doesn't clear the new area of raster, which is
useful for when you want to have clean looking scrolling.
INPUT: rp - rastport
x - left coord
y - top coord
x2 - right coord
y2 - bottom coord
deltax - how many pixels to scroll horizontally
deltay - how many pixels to scroll vertically
BUGS: Can't handle scrolls larger than the area to scroll. But because
this function doesn't clear the new area of raster, there wouldn't
be any visual difference anyway.
--------------------------------------------------------------------------------
list.m
insertinlist()
--------------
NAME: insertinlist()
SYNOPSIS: insertinlist(list, str)
DESCRIPTION: Will take a string of integers seperated by slashes, and insert them
into an ARRAY.
INPUT: list - an array
str - a string of integers seperated by slashes
mergelist2str()
---------------
NAME: mergelist2str()
SYNOPSIS: mergelist2str(str, list, hex = FALSE)
DESCRIPTION: Will take an array of integers and put them into a string
seperated by slashes.
INPUT: str - a string of integers seperated by slashes
list - an array of integers
hex - if TRUE, put a $ before each integer
--------------------------------------------------------------------------------
execlists.m
addName()
---------
NAME: addName()
SYNOPSIS: addName(list, str, prednode)
DESCRIPTION: Add a node to an execlist
INPUT: list - pointer to an execlist
str - string to insert in the list
prednode - node to insert string into list after
freeNode()
----------
NAME: freeNode()
SYNOPSIS: freeNode(list, num)
DESCRIPTION: Remove a node from an execlist
INPUT: list - pointer to an execlist
num - number of node to remove
freeNameNodes()
---------------
NAME: freeNameNodes()
SYNOPSIS: freeNameNodes(list)
DESCRIPTION: Remove all nodes from an execlist
INPUT: list - pointer to an execlist
findNodeNumber()
----------------
NAME: findNodeNumber()
SYNOPSIS: num := findNodeNumber(list, str)
DESCRIPTION: Find the number of a node in an execlist
INPUT: list - pointer to an execlist
str - string to compare nodes with
RESULTS: num - number of node in the execlist which matched str
findNodeName()
--------------
NAME: findNodeName()
SYNOPSIS: str := findNodeName(list, num)
DESCRIPTION: Get the string of a node in an execlist
INPUT: list - pointer to an execlist
num - number of node to get string from
RESULTS: str - string of a node in an execlist
movelistnode()
--------------
NAME: movelistnode()
SYNOPSIS: movelistnode(list, num, list2, num2)
DESCRIPTION: Move a node to a new position in a list
INPUT: list - pointer to an execlist
num - number of node to move
list2 - pointer to an execlist
num2 - new position of node in execlist
countnodes()
NAME: countnodes()
SYNOPSIS: num := countnodes(list)
DESCRIPTION: Find the number of nodes in an execlist
INPUT: list - pointer to an execlist
RESULTS: num - number of nodes in an execlist
--------------------------------------------------------------------------------
myscreens.m
findpubscreen()
---------------
NAME: findpubscreen()
SYNOPSIS: success := findpubscreen(str)
DESCRIPTION: Find if a screen exists with the name str
INPUT: str - name of screen to find
RESULTS: success - TRUE if we found a screen with the name str
getscreenlist()
---------------
NAME: getscreenlist()
SYNOPSIS: list := getscreenlist(list)
DESCRIPTION: Get an execlist of the public screens open
INPUT: list - an execlist
RESULTS: list - an execlist
--------------------------------------------------------------------------------
progresswin.m
First, put this module into your source.
MODULE '*progresswin'
Then you need to make a DEF.
DEF pw:PTR TO progresswin
At the start of your program, put..
NEW pw
And at the end of your program, put..
END pw
openprogresswin()
-----------------
NAME: openprogresswin()
SYNOPSIS: pw.openprogresswin(scrname, win, str)
DESCRIPTION: Open a progress window
INPUT: scrname - name of screen to open window on
win - window pointer to centre window on
str - progress window text
closeprogresswin()
-----------------
NAME: closeprogresswin()
SYNOPSIS: pw.closeprogresswin()
DESCRIPTION: Close the progress window
progresswinopen()
-----------------
NAME: progresswinopen()
SYNOPSIS: bool := pw.progresswinopen()
DESCRIPTION: Check if the progress window is open
RESULTS: bool - TRUE if the progress window is currently
open
drawprogressgad()
-----------------
NAME: drawprogressgad()
SYNOPSIS: pw.drawprogressgad(percent)
DESCRIPTION: Update the progress gadget to percent
INPUT: percent - percent to fill progress gadget by
drawprogresstext()
------------------
NAME: drawprogresstext()
SYNOPSIS: pw.drawprogresstext(str)
DESCRIPTION: Change the text in the progress window
INPUT: str - text to print in the progress window
Exceptions
----------
Exception Exception info Description
"PUBS" Screen name Unable to lock pubscreen
"WIN" Unable to open window
--------------------------------------------------------------------------------
icongad.m
First, put this module into your source.
MODULE '*icongad'
Then you need to make a DEF.
DEF mygads:PTR TO icongads
At the start of your program, put..
NEW mygads
And at the end of your program, put..
END mygads
initicongad()
-------------
NAME: initicongad()
SYNOPSIS: mygads.initicongad(list)
DESCRIPTION: Load the icons and create the gadgets.
INPUT: list - a list of strings of the paths of icons
NOTE: If for some reason we fail to get an icon, the default
icon WBTOOL is used instead
sizex(), sizey()
----------------
NAME: sizex(), sizey()
SYNOPSIS: int := mygads.sizex(num)
int := mygads.sizey(num)
DESCRIPTION: Get the size of a gadget
INPUT: num - the position the icon came in the list, starting 0,1...
RESULTS: int - the size of gadget num
addicongad()
------------
NAME: addicongad()
SYNOPSIS: mygads.addicongad(num, gadgetid, x, y, win)
DESCRIPTION: Attach a gadget to the window
INPUT: num - the position the icon came in the list
gadgetid - the unique gadgetid to give this gadget
x - x position of gadget in the window
y - y position of gadget in the window
win - pointer of window to attach gadget to
NOTE: A gadget can only be attached once to a window. It must be
removed before it can be attached again
removeicongad()
---------------
NAME: removeicongad()
SYNOPSIS: mygads.removeicongad(num, win)
DESCRIPTION: Remove a gadget from the window
INPUT: num - the position the icon came in the list
win - pointer of window the gadget is attached to
endicongad()
------------
NAME: endicongad()
SYNOPSIS: mygads.endicongad()
DESCRIPTION: Free all the icons got by initicongad()
Exceptions
----------
The module will raise several exceptions if it fails.
Exception Exception info Description
"LIB" Library name Unable to open library
--------------------------------------------------------------------------------
appitem.m
First, put this module into your source.
MODULE '*appitem'
Then you need to make a DEF.
DEF ai:PTR TO appitem
At the start of your program, put..
NEW ai
And at the end of your program, put..
END ai
initappitem()
-------------
NAME: initappitem()
SYNOPSIS: ai.initappitem()
DESCRIPTION: Open the required libraries for this module
endappitem()
------------
NAME: endappitem()
SYNOPSIS: ai.endappitem()
DESCRIPTION: Close the required libraries for this module
addappicon()
------------
NAME: addappicon()
SYNOPSIS: ai.addappicon(path, text, x, y)
DESCRIPTION: Add an appicon to the default pubscreen
INPUT: path - path of icon to use
text - text to place under appicon
x - x position on the screen
y - y position on the screen
removeappicon()
---------------
NAME: removeappicon()
SYNOPSIS: ai.removeappicon()
DESCRIPTION: Remove the appicon from the screen
addappmenu()
------------
NAME: addappmenu()
SYNOPSIS: ai.addappmenu(text)
DESCRIPTION: Add an appmenuitem to the Workbench Tools menu
INPUT: text - text to use for the appmenuitem
removeappmenu()
---------------
NAME: removeappmenu()
SYNOPSIS: ai.removeappmenu()
DESCRIPTION: Remove the appmenuitem from the Workbench Tools menu
openappwindow()
---------------
NAME: openappwindow()
SYNOPSIS: ai.openappwindow(win)
DESCRIPTION: Make win into an appwindow
INPUT: win - pointer to window to make into an appwindow
closeappwindow()
----------------
NAME: closeappwindow()
SYNOPSIS: ai.closeappwindow()
DESCRIPTION: Remove appwindow
iconsigbit()
------------
NAME: iconsigbit()
SYNOPSIS: sigbit, port := ai.iconsigbit()
DESCRIPTION: Get the appiconitem port sigbit
RESULTS: sigbit - signal bit of the appicon port
port - pointer to the port of the appicon
menusigbit()
------------
NAME: menusigbit()
SYNOPSIS: sigbit, port := ai.menusigbit()
DESCRIPTION: Get the appmenuitem port sigbit
RESULTS: sigbit - signal bit of the appmenu port
port - pointer to the port of the appmenu
winsigbit()
-----------
NAME: winsigbit()
SYNOPSIS: sigbit, port := ai.winsigbit()
DESCRIPTION: Get the appwinitem port sigbit
RESULTS: sigbit - signal bit of the appwindow port
port - pointer to the port of the appwindow
Exceptions
----------
The module will raise several exceptions if it fails.
Exception Exception info Description
"APIC" Unable to create appicon
"APMN" Unable to create appmenuitem
"APWN" Unable to create appwindow
"LIB" Library name Unable to open library
"PORT" Unable to create a message port
|