home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / stdwin / Doc / WHATSNEW < prev   
Encoding:
Text File  |  1991-06-07  |  10.4 KB  |  285 lines  |  [TEXT/????]

  1. What's New in STDWIN 0.9.6
  2. ==========================
  3.  
  4. This release is a temporary measure, needed primarily to support the
  5. upcoming release 0.9.2 of the Python programming language.  It is
  6. still lacking complete and up-to-date documentation.
  7.  
  8. For those who are familiar with STDWIN 0.9.5, here is a summary of the
  9. main changes in version 0.9.6 (of course, a number of bugs were also
  10. fixed).
  11.  
  12.  
  13. Overview of the changes
  14. -----------------------
  15.  
  16. - Initialization is now separated in argument processing and actual
  17.   initialization.
  18. - Scroll bars can be turned off with an option at window creation time.
  19. - More inquiry functions, e.g., document size, window position.
  20. - Filled and XOR mode drawing of circles and elliptical arcs.
  21. - Polygon drawing (filled, outline and XOR).
  22. - Color drawing.
  23. - Modifier keys (control, shift, meta etc.) are passed in mouse events.
  24. - Closing a window is now indicated by a separate event, WE_CLOSE.
  25. - New event type WE_KEY reports non-ASCII keys and keys with modifiers.
  26.  
  27. The new calls are documented the following sections.
  28.  
  29.  
  30. New Initialization Calls
  31. ------------------------
  32.  
  33. Some window systems (like X11) have a standard set of command line
  34. options that support overriding defaults by the end user.  The new
  35. function wargs() parses the command line options and saves them for
  36. later use by winit() and wopen().
  37.  
  38. void wargs(int *p_argc, char ***p_argv);
  39.  
  40. This function should be called before winit(), as early as possible
  41. during the execution of main(), passing it the addresses of main's
  42. arguments argc and argv.  It may modify argc and argv to reflect the
  43. extraction of recognized options.
  44.  
  45. The application's argument parser does not have to worry about
  46. conflicting options, as long as it uses the getopt() interface to
  47. parse its own options.  On the Mac, this function initializes argc and
  48. argv from the program arguments passed by the Finder; if the
  49. application is called from the Finder's Print menu entry, the first
  50. argument will be the string "-p".
  51.  
  52. If the application decides not to call winit() after it has called
  53. wargs(), it need not call wdone() before exiting.  If wargs() has not
  54. been called when winit() is called, system-defined defaults are
  55. assumed.  On X11, resources can still be specified for such
  56. applications; the program name is assumed to be "stdwin" and its class
  57. "Stdwin", unless the RESOURCE_NAME environment variable is set.
  58.  
  59. void winitargs(int *p_argc, char ***p_argv);
  60.  
  61. This is equivalent to a call to wargs(p_argc, p_argv) followed by a
  62. call to winit().
  63.  
  64.  
  65. Scroll Bars Made Optional
  66. -------------------------
  67.  
  68. It is now possible to specify whether a window should have scroll
  69. bars.  This must be specified before the window is created and cannot
  70. be changed once it is created.  By default, windows will have a
  71. vertical scroll bar but no horizontal scroll bar.
  72.  
  73. void wsetdefscrollbars(int need_hbar, int need_vbar);
  74.  
  75. Specifies which scroll bars will be present on subsequently created
  76. windows.  If need_hbar is nonzero, new windows will be created with
  77. horizontal scroll bars; if need_vbar is nonzero, new windows will be
  78. created with vertical scroll bars.
  79.  
  80. void wgetdefscrollbars(int *need_hbar_return, *need_vbar_return);
  81.  
  82. Returns the current status of the scroll bar creation flags set by
  83. wsetdefscrollbars() through its arguments.
  84.  
  85. Note that even if they are present, scroll bars are only activated
  86. when the document size in their direction is set to a value larger
  87. than the window size.
  88.  
  89.  
  90. More Inquiry Functions
  91. ----------------------
  92.  
  93. void wgetdefwinsize(int *width_return, int *height_return);
  94.  
  95. Return the default initial size for new windows, as set by
  96. wsetdefwinsize().  Zero or negative values mean that a
  97. system-dependent default method is used to find an initial size for
  98. the window, e.g., interactive sizing.
  99.  
  100. void wgetdefwinpos(int *h_return, int *v_return);
  101.  
  102. Return the default initial position for new windows, as set by
  103. wsetdefwinpos().  Zero or negative values mean that a system-dependent
  104. default method is used to find an initial position for the window,
  105. e.g., interactive placement.
  106.  
  107. void wgetwinpos(WINDOW *win, int *h_return, int *v_return);
  108.  
  109. Return the current window position on the screen.  Together with
  110. wgetwinsize() this can be used to save a window's geometry and
  111. recreate it in the same state at a later time.
  112.  
  113.  
  114. Color Drawing
  115. -------------
  116.  
  117. It is now possible to draw images in multiple colors, if the display
  118. hardware allows this.  The model uses the notion of current foreground
  119. and background colors.  Because different color hardware operates very
  120. differently, the number of different colors and the way they are
  121. selected is left unspecified by STDWIN.
  122.  
  123. A type COLOR is defined, which is some kind of (long) integer
  124. representing a color value; suitable values can be extracted by name
  125. from an external color database.  Applications that know on which
  126. hardware they run may cheat, as the values of type COLOR will be
  127. indexes into the color table or directly encode RGB value, but this
  128. obviously restricts the application's portability.
  129.  
  130. Applications can only assume the presence of colors named white and
  131. black; on monochrome displays, these are all there is.  Otherwise,
  132. some standard colors are supposed to be available everywhere: gray25
  133. (dark grey), gray50 (middle gray), gray75 (light gray), red, green,
  134. blue, yellow, magenta, cyan.  There are also some pseudo color names
  135. that may be assigned defaults by the end user: foreground, background,
  136. primary, secondary, selection, hilight.  Some monochrome
  137. implementations (especially the Mac) attempt to simulate a few gray
  138. levels with fill patterns, but only as foreground color.  On X11,
  139. color names are looked up in the server's color database; the notation
  140. #RGB, #RRGGBB (etc.) is also recognized.
  141.  
  142. Each window has default foreground and background colors, which are in
  143. effect immediately after wbegindrawing() and initially in draw
  144. procedures.  These default colors are specified by calling
  145. wsetfgcolor() and wsetbgcolor() outside drawing mode before creating a
  146. window.  These colors may also be used to draw a window's
  147. ornamentation such as scroll bars and menus; before a draw procedure
  148. is called, the update area is cleared to the window's default
  149. background color.
  150.  
  151. Two drawing functions are unsafe when color is used: winvert() and
  152. wxorline().  For all affected pixels, these are guaranteed to
  153. correctly swap the current foreground and background colors, but other
  154. colors are swapped with arbitrary colors, giving an undefined effect.
  155. Inverting the pixels once more (with the same foreground and
  156. background colors in effect!) will return them to their original
  157. colors, however.
  158.  
  159. Swapping the foreground and background colors has the effect of
  160. drawing in inverse video; HOWEVER, this is not supported by the
  161. termcap (alphanumeric) version of STDWIN, which bluntly ignores all
  162. color requests.
  163.  
  164. typedef ... COLOR;
  165.  
  166. This type represents a color value.  It is one of C's integral types,
  167. so it is possible (and useful!) to declare variables of type COLOR.
  168.  
  169. COLOR wfetchcolor(char *colorname);
  170.  
  171. Look the color name up in the external database of color definitions
  172. and return a color value for it, if possible.  If the color is not
  173. found in the database or no more color values are available (this
  174. happens easily on systems with small color tables), the color value
  175. for the default foreground is returned.
  176.  
  177. void wsetfgcolor(COLOR color);
  178.  
  179. Set the current foreground color.  In drawing mode, set the foreground
  180. color used for drawing; outside drawing mode, set the default
  181. foreground color for windows created subsequently.
  182.  
  183. void wsetbgcolor(COLOR color);
  184.  
  185. Set the current background color.  Similar to wsetfgcolor().
  186.  
  187. COLOR wgetfgcolor();
  188.  
  189. Return the current foreground color, as set by wsetfgcolor() or from a
  190. system-defined default.
  191.  
  192. COLOR wgetbgcolor().
  193.  
  194. Return the current background color.  Similar to wgetfgcolor().
  195.  
  196.  
  197. Filled and Xor'ed Circles and Arcs
  198. ----------------------------------
  199.  
  200. void wfillcircle(int h, int v, int radius);
  201.  
  202. Fills a circle with given center and radius.
  203.  
  204. void wxorcircle(int h, int v, int radius);
  205.  
  206. Inverts a circle with given center and radius.
  207.  
  208. void wfillelarc(int h, int v, int hrad, int vrad, int angle1, int angle2);
  209.  
  210. Fills a segment of an elliptical arc defined by the parameters as for
  211. wdrawelarc.
  212.  
  213. void wxorelarc(int h, int v, int hrad, int vrad, int angle1, int  angle2);
  214.  
  215. Inverts an elliptical arc defined by the parameters as for wdrawelarc.
  216.  
  217.  
  218. Polygons
  219. --------
  220.  
  221. There is a way to draw arbitrary polygon shapes.
  222.  
  223. typedef struct { short h, v; } POINT;
  224.  
  225. This type is used to pass an array of points to the polygon routines.  
  226. Coordinates are specified as shorts so certain STDWIN versions 
  227. (especially the X11 version) can pass arrays of coordinates to routines 
  228. of the underlying window system without copying them.
  229.  
  230. void wdrawpoly(int n, POINT points[]);
  231.  
  232. Draws n-1 line segments given by n points: from points[0] to points[1], 
  233. from points[1] to points[2], etc., and finally from points[n-2] to 
  234. points[n-1].
  235.  
  236. void wfillpoly(int n, POINT points[]);
  237.  
  238. Fills polygon defined by n points.  If points[n-1] does not equal 
  239. points[0], an additional line segment closing the polygon shape from 
  240. points[n-1] to points[0] is implied.  The polygon may intersect itself.
  241.  
  242. void wxorpoly(int n, POINT points[]);
  243.  
  244. Inverts a filled polygon.  The polygon is defined as for wfillpoly().
  245.  
  246.  
  247. Modifier Keys in Mouse Events
  248. -----------------------------
  249.  
  250. The u.where.mask member of the EVENT structure now has a different
  251. meaning.  It reports the modifier keys that were pressed at the time
  252. the event was generated.  The following constants define bit masks for
  253. various modifier keys:
  254.  
  255. #define WM_SHIFT    (1 << 0)
  256. #define WM_LOCK        (1 << 1)
  257. #define WM_CONTROL    (1 << 2)
  258. #define WM_META        (1 << 3)
  259. #define WM_OPTION    (1 << 4)
  260. #define WM_NUM        (1 << 5)
  261.  
  262. On the Mac, WM_META corresponds to the Command modifier.  In X11,
  263. WM_META is really "Modifier 3", commonly bound to the Meta or Alt key;
  264. WM_OPTION and WM_NUM are not normally reported in X11 so their use is
  265. not portable.
  266.  
  267.  
  268. The WE_CLOSE Event
  269. ------------------
  270.  
  271. To simplify event decoding somewhat, a user's close request is now
  272. reported as an event (WE_CLOSE) rather than a subcode (WC_CLOSE) of
  273. the WE_COMMAND event.  All WE_COMMAND subcodes now report special
  274. keys.
  275.  
  276.  
  277. The WE_KEY Event
  278. ----------------
  279.  
  280. If a key is pressed together with the Meta key that is not a menu
  281. shortcut, it is reported as a WE_KEY event.  This event uses the union
  282. member u.key which has members code and mask.  The member u.key.code
  283. specifies the ASCII code of the key; u.key.mask specifies the
  284. modifiers that were pressed with the key.
  285.