Short: 5 emods. Progress window, scrolling, lists, exec lists, screens Uploader: chris@planb.TheGAP.com (Chris Perver) Author: chris@planb.TheGAP.com (Chris Perver) Type: dev/e Replaces: dev/e/Chris_emods.lha Here is the first of my slightly useful AmigaE modules. -------------------------------------------------------------------------------- myscrollraster() 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. I use it for EvenMore. myscrollraster(rp, x, y, x2, y2, deltax, deltay) EXAMPLE myscrollraster(rp, 5, 5, 50, 50, -10, 20) 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 Don't think it can 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. -------------------------------------------------------------------------------- The next two functions are useful for preference files, etc. I use them for EvenMore :). insertinlist() will take a string of numbers, seperated by slashes, and insert each value into the list. Will stop inserting values when it comes to the end of the list. insertinlist(list, str) EXAMPLE insertinlist(list, '5/40/6/3') INPUT list - A list (Not exec list), list := [0,0,0,0] mergelist2str() does the opposite of insertinlist(). mergelist2str() will take a list, and return the string of the values in that list, seperated by slashes. string := mergelist2str(list) EXAMPLE str := mergelist2str(list) INPUT list - A list (Not exec list), list := [0,0,0,0] OUTPUT string - A string of values seperated by slashes, '0/54/334/23' -------------------------------------------------------------------------------- The functions in execlists.m are useful for manuplating exec lists. addName(list, str) - Add a list node to a list freeNode(list, num) - Free node number form a list freeNameNodes(list) - Free all nodes in the list num := findNodeNumber(list, str) - Find the position of the node in the list str := findNodeName(list, num) - Find the name of node in the list movelistnode(list1, pos1, list2, pos2) - Move a node from one list/position to another EXAMPLE movelistnode(list, 3, list 4) movelistnode(list, 3, anotherlist, 6) INPUT list1 - An exec list pos1 - The number of the node to move list2 - An exec list. Can be the same list as list1 pos2 - The position to put the new node in list2 num := countnodes(list) - Returns number of nodes in a list -------------------------------------------------------------------------------- findpubscreen() in the screens.m module will return TRUE if a public screen named exists. findpubscreen(str) EXAMPLE bool := findpubscreen('Workbench') INPUT str - Name of a public screen OUTPUT bool - True if a public screen is open that matches the name str. -------------------------------------------------------------------------------- The progresswin module will allow you to display a window with a progress bar in it. I use this module for EvenMore, when loading files. 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 When you want to open the progress window, just type the following... openprogresswin(pw, screenname, winptr, str) screenname - Name of public screen to open on. Can be NIL. winptr - The pointer to your window to centre the progress window on. IF NIL, the progress window will centre on the screen. str - A string to display above the progress gadget To update the progress gadget, just type the following... drawprogressgad(pw, percentage) percentage - Percentage for progress gadget to be filled To close the progress window, just type the following... closeprogresswin(pw) The progress window will use the screen font of the screen it opens on for the text. A few values are hard-coded, but you could easily change that if you want. The window will be 6 times the screen font height high, and 250 pixels wide. The text will appear 1/3rd of the way down the window, and the progress gadget will appear in the middle of the window. If you want to use the window more than once without closing it, for example, for copying a batch of files, just call the drawprogresstext() function. The text will be redrawn. drawprogresstext(pw, 'Progressing :)') Exceptions Exception info Description "PUBS" screenname Unable to lock pubscreen "DRI" Unable to get screen drawinfo "VIS" Unable to get visualinfo "FONT" Unable to open screen font "WIN" Unable to open window "SCRL" Unable to lock pubscreen list ================================================================================ You are free to use these PROCs for whatever you wish.