home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 1 / Amiga Tools.iso / egs-tools / egs_dev-disk / egsdemos / moreexamples / overview.doc < prev    next >
Encoding:
Text File  |  1994-06-06  |  7.1 KB  |  189 lines

  1.  
  2. Dear Developer,
  3.  
  4. Welcome to the world of programming for the EGS retargetable,
  5. device-independent operating system. When you write a program for
  6. EGS, it can be run on any computer from an Amiga 500, to a
  7. SPECTRUM system, the high end 110/24 system, or other hardware in
  8. the marketplace which supports EGS.
  9.  
  10. EGS was created and is owned by VIONA Development in Germany.
  11. Questions regarding development will be answered by them. I am
  12. including this directory in the developer's disk for two reasons.
  13. One, I want to share with you what I've learned through writing
  14. EGS-Paint, and help explain how to do things which aren't apparent
  15. at first glance. Due to the overwhelming response, and the need
  16. for developers to have access to this information now, we decided
  17. to put in our own demo code, along with the demo code from Viona.
  18. Updates can be obtained from VIONA development.
  19.  
  20. Programming under EGS is fun and exciting because you can develop
  21. on an AGA system or something, than watch the code run on other
  22. hardware platforms. It is very similar to Intuition, and in fact,
  23. most commands look and work the same, and simply have an E_ or EI_
  24. or something attached to the beginning of the command. Here is a
  25. brief overview.
  26.  
  27. Windows.
  28.  
  29. EGS windows are very similar to Amiga windows in that there is an
  30. EI_Window structure, and an EI_NewWinodw structure. You will find,
  31. however, that it is usually not necessary to even bother with a
  32. NewWindow structure, as gadget functions will create them for you.
  33. EGS has SIMPLE_REFRESH, SMART_REFRESH, etc. windows and everything
  34. should seem familiar to you.
  35.  
  36. Menus.
  37.  
  38. EGS Menus are EXTREMELY EASY! See the demo code.
  39.  
  40. Gadgets.
  41.  
  42. Ah, there's the rub... Gadgets are very powerfull, and can get
  43. sort of confusing at times. The included code is designed to show
  44. you how to deal with sizing correctly, and in fact, if you use the
  45. UserWindow module I wrote, you never have to worry about how to
  46. open, close, or deal with resize events again. Of course, if you
  47. want, you can do all of that yourself, or modify the included
  48. code. This module is in the Public Domain. All I ask is if you
  49. pass it on to someone else, give them the original version, so
  50. they can see whats going on.
  51.  
  52.  
  53. Gadgets can be resizable (recomended) if you wish. There are two
  54. ways for the system to create its gadgets. First: if you don't
  55. have a window open for the gadgets yet, the system will look at
  56. your font, figure out the minimum space your gadgets will need,
  57. open a window for you of this size, and place your gadgets.
  58. Second: If you allready have a window open, the system will
  59. stretch the gadgets based on your setup to fit the window you've
  60. supplied. The system does not appreciate getting a window that the
  61. gadgets can's fit into, even at their minimum sizes. In fact, this
  62. will probably crash your system. Usually one allows EGS to create
  63. the window as per above, then allows the user to resize it bigger.
  64. (EGS will set the MinSize of the window to this Minimum size the
  65. gadgets can fit into, so you never need to worry about it). (If
  66. you want to start it out bigger than the minimum, you can run the
  67. function ProcessGadBoxes which calculates the minimum size and
  68. adds it to the NewWindow structure, then run the whole process
  69. again with a new window opened bigger, but with the NewWindow
  70. structure passed in from ProcessGadBoxes. This is a bit advanced,
  71. and usually not necessary but I thought I'd throw it in. I use it
  72. when I change the number of views inside a DrawWindow in
  73. EGS-Paint.)
  74.  
  75. Here are some straight forward rules about resizeable gadgets that
  76. should clear thing up.
  77.  
  78. 1.
  79. To have a resizeable window with gadgets, you must have a HorizBox
  80. or a VertiBox somewhere. These define how gadgets are to be
  81. stretched. For instance, if you were to create three gadgets and
  82. place them inside a vertibox, they will appear in a column and
  83. only stretch vertically. If the same three gadgets were created
  84. inside a Horiz Box, they would be place left to right, and would
  85. only stretch horizontally. Seems simple enough so far. Just
  86. remember this rule, its a good basic starting place.
  87.  
  88. 2.
  89. The way this all works, is that the system looks at the available
  90. space inside the window where the gadgets are to be placed. It
  91. then adds things to it from top to bottom in hierarchy until
  92. everything is placed. Here's the catch. Horiz and Verti Boxes can
  93. also stretch.
  94.  
  95.  For instance:
  96.    Lets create a window with a gadget list like this.
  97.  
  98.    VERTIBOX
  99.      gadget 1
  100.      gadget 2
  101.      gadget 3
  102.  
  103.  This is easy. We get the following window, regargdless of size.
  104.  
  105.    +_________________________________________--
  106.    |              Gadget 1                    |
  107.    |__________________________________________|
  108.    |              Gadget 2                    |
  109.    |__________________________________________|
  110.    |              Gadget 3                    |
  111.    |__________________________________________|
  112.  
  113.  
  114.    Note the gadgets will stretch out to fit the window. (The text
  115.    does not get any bigger or smaller).
  116.    (SEE Example1_SOURCE and PROGRAM).
  117.  
  118.  Now try this one.
  119.  
  120.    HORIZBOX
  121.      VERTIBOX
  122.        gadget 1
  123.        gadget 2
  124.      VERTIBOX
  125.        gadget 3
  126.        gadget 4
  127.  
  128. Now the system must share the horizontal space of the window with
  129. two Vertical Boxes. It will divide the window in half and give the
  130. first VertiBox the left side, and the second the right. (You can
  131. change the priority of boxes and gadgets, thus changing this rule,
  132. like letting one gadget take over whil the other gadget stays at
  133. its minimum size given the current font. I'll talk on this
  134. later...) We end up with this.
  135.  
  136.    +_________________________________________--
  137.    |     Gadget 1     |       Gadget 3        |
  138.    |__________________________________________|
  139.    |     Gadget 2     |       Gadget 4        |
  140.    |__________________________________________|
  141.  
  142.    Make sense?
  143.    (SEE Example2_SOURCE and PROGRAM).
  144.  
  145.  Next...
  146.  
  147.    VERTIBOX
  148.      gadget 1
  149.      HORIZBOX
  150.        gadget 2
  151.        gadget 3
  152.        VERTIBOX
  153.          gadget 4
  154.          gadget 5
  155.  
  156.  
  157.  Here we go...
  158.  
  159.    +_________________________________________--
  160.    |                                          |
  161.    |                                          |
  162.    |               Gadget 1                   |
  163.    |__________________________________________|
  164.    |           |             |   Gadget 4     |
  165.    | Gadget 2  |   Gadget 3  |________________|
  166.    |           |             |   Gadget 5     |
  167.    |___________|_____________|________________|
  168.  
  169.    (SEE Example3_SOURCE and PROGRAM).
  170.  
  171. Note that gadget 1 is able to stretch horizontally, even though it
  172. is inside a VertiBox. This is beacause there is also a Horiz Box
  173. inside the VertiBox and it needs the space.
  174.  
  175. Note also that gadgets 2 and 3 are as tall as the combination of
  176. the height of gadgets 4 and 5. They too are allowed to stretch
  177. vertically even though they are inside a horiz box, beacuse
  178. gadgets 4 and 5 need the space.
  179.  
  180. Finally note that gadget 1 is as tall as the combination of the
  181. hieght of gadgets 4 and 5. This is because the VertiBox is sharing
  182. window height between two items: gadget 1, and the horiz box which
  183. contains 3,4 and 5. See how this can get a little confusing? You
  184. get used to it however, and EGS always follows the same rules.
  185. This is a very powerfull gadget system!
  186.  
  187.  
  188. change : 30 Dec 1993 (mvk)
  189.