Short:    5 emods. Progress window, scrolling, lists, exec lists, screens
Author:   chris@planb.TheGAP.com (Chris Perver)
Uploader: 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 <num> form a list

  freeNameNodes(list) - Free all nodes in the list

  num := findNodeNumber(list, str) - Find the position of the node <str> in the
                                     list

  str := findNodeName(list, num) - Find the name of node <num> 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 <str> 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.


============================= Archive contents =============================

Original  Packed Ratio    Date     Time    Name
-------- ------- ----- --------- --------  -------------
    5534    1998 63.8% 05-Sep-97 13:40:00  Chris_emods.readme
    6562    2305 64.8% 09-Sep-97 06:34:16  execlists.e
    1330     681 48.7% 09-Sep-97 06:35:26  execlists.m
    1389     613 55.8% 05-Sep-97 13:41:10  lists.e
     578     372 35.6% 05-Sep-97 15:58:24  lists.m
     744     298 59.9% 05-Sep-97 13:39:58  myscrollraster.e
     364     259 28.8% 05-Sep-97 15:58:34  myscrollraster.m
    8328    2681 67.8% 05-Sep-97 13:41:10  progresswin.e
    4306    1579 63.3% 25-Sep-97 01:18:26  progresswin.m
     595     352 40.8% 05-Sep-97 13:41:10  screens.e
     162     137 15.4% 05-Sep-97 15:58:46  screens.m
    5812    2435 58.1% 05-Sep-97 15:59:04  testprogresswin
    1683     709 57.8% 05-Sep-97 13:41:10  testprogresswin.e
-------- ------- ----- --------- --------
   37387   14419 61.4% 27-Sep-97 17:00:40   13 files
