Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /eXene/trunk/README-0.5
ViewVC logotype

Annotation of /eXene/trunk/README-0.5

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2098 - (view) (download)

1 : monnier 2 [December 25, 1995]
2 :    
3 :     This is a snapshot of the the current state of eXene. Its main
4 :     claim to fame is that it compiles under version 107; it is a
5 :     working version, and isn't documented. It does have some major
6 :     improvements over Version 0.4 (released with SML/NJ 0.93), some
7 :     of which are briefly discussed below (you should also look at
8 :     the CHANGES file).
9 :    
10 :    
11 :     -------------------------------------------------------------------
12 :     AUTHENTICATION
13 :    
14 :     EXene now has hooks for authentication, which at least work with
15 :     the xdm protocol that many X terminals use. Look at the files
16 :     xauth-sig.sml and xauth.sml in graph-util.
17 :    
18 :    
19 :     -------------------------------------------------------------------
20 :     WIDGETS
21 :    
22 :     The eXene widget set is undergoing major changes. Although the
23 :     new set will be largely upward compatible with the old (version 0.4)
24 :     in terms of function and use, the new set will have new widgets,
25 :     old widgets will have new features, the widgets will have a
26 :     Motif-like 3D look, and the widgets will use X resources to allow
27 :     customization, especially of such visual aspects as color and font.
28 :    
29 :     USING RESOURCES:
30 :    
31 :     The use of resources allows us to make the creation of widgets
32 :     more uniform. By convention, the creation function for a widget will
33 :     have the form
34 :    
35 :     val gadget : (Widget.root * Widget.view * Widget.arg list)
36 :     [ -> {optional additional arguments ] -> gadget
37 :    
38 :     The root argument, as before, corresponds to a screen in X terminology.
39 :     The view argument provides a "view" of the widget as parameterized
40 :     by X resources. At present, a view is the pair
41 :    
42 :     type view = Styles.style_view * Styles.style
43 :    
44 :     The style can be viewed as a database of string values keyed by regular
45 :     expressions, following the conventions of standard X resource files.
46 :     Thus, a typical entry might be
47 :    
48 :     plotos*TextEntry.background: red
49 :    
50 :     The style_view corresponds to a collection of names and aliases the
51 :     widget will use for itself when it looks up resources in the style.
52 :     If widgetB is to be a child of widgetA, a programmer will typically
53 :     make a style_view for widgetB by extending the style_view of widgetA
54 :     (using Styles.extendView and Styles.extendName) with some specific
55 :     name for widgetB. In addition, if widgetB belongs to some logical
56 :     class, names for the logical class can be added to widgetB's
57 :     style_view as aliases.
58 :    
59 :     For example, suppose we have a pair widget (we don't) that takes two
60 :     child widgets and displays them next to each other.
61 :    
62 :     val pair : (Widget.root * Widget.view * Widget.arg list) ->
63 :     (Widget.widget * Widget.widget) -> pair
64 :    
65 :     and suppose we have a style and have constructed a style_view for
66 :     the pair widget:
67 :    
68 :     val style : style
69 :     val pairName : style_view
70 :    
71 :     We want to create two text buttons that will be put into the pair widget.
72 :     We will name one button "leftButton" and the other "rightButton". In
73 :     addition, for our application, the left button will belong to a special
74 :     class of alarm buttons. We would then do the following:
75 :    
76 :     structure Styles = S
77 :     structure Button = B
78 :    
79 :     val rightButtonName = S.extendView (pairName, "rightButton")
80 :     val leftButtonName =
81 :     S.prependAlias (S.extendView (pairName, "leftButton"), "Alarm")
82 :    
83 :     val leftButton = B.widgetOf (B.textBtn (root, (leftButtonName,style), []))
84 :     val rightButton = B.widgetOf (B.textBtn (root, (rightButtonName,style), []))
85 :     val pair = pair (root, (pairName,style), []) (leftButton, rightButton)
86 :    
87 :     Concerning the style, usually a single style is created for an application
88 :     and is passed unchanged to all the widgets. At present, a style can
89 :     be created from a list of strings using Widget.styleFromStrings. In the
90 :     near future, we will provide functions for creating styles using
91 :     user and application default resource files, the X resource database and
92 :     command line arguments.
93 :    
94 :     As noted above, the first argument used to create a widget is the triple
95 :    
96 :     (Widget.root * Widget.view * Widget.arg list)
97 :    
98 :     We've discussed the first two components. The argument list allows the
99 :     programmer to have specific control over the resources of a widget. Normally,
100 :     a widget uses the style in the view to find its resources. The end user
101 :     determines the style by altering her X resource database. However,
102 :     for a given application, certain parameters of a widget might be critical
103 :     enough that the user should not be able to affect them. In these cases,
104 :     the programmer can specify these parameters using the argument list. The
105 :     attributes specified in the argument list override the style provided
106 :     in the view.
107 :    
108 :     At present, an arg is a name-value pair
109 :    
110 :     type arg = Attrs.attr_name * Attrs.attr_value
111 :    
112 :     Obviously, attr_name corresponds to the name of the resource and
113 :     attr_value corresponds to its value. (The Attrs structure provides
114 :     internal representation of the names and values used in styles.
115 :     In addition, it provides a collection of common attr_names.) Thus, if a
116 :     programmer insists that a button have a red background, she can use
117 :    
118 :     structure Attrs = A
119 :    
120 :     val bttn = B.textBtn (root,view,[(A.attr_background, A.AV_Str "red")])
121 :    
122 :     For further information on the creation of styles and style_views,
123 :     see the styles directory.
124 :    
125 :     NEW STARTUP:
126 :    
127 :     To simplify the startup of an eXene application, there is a new
128 :     module RunEXene that provides a function that takes a function of
129 :     type Widget.root -> unit, looks for the shell environment variable
130 :     EXENE_DISPLAY to specify the display, starts CML, creates a root,
131 :     and then calls the function provided.
132 :    
133 :     As is still the case, if EXENE_DISPLAY specifies a remote display, it
134 :     must use the numerical address:
135 :    
136 :     EXENE_DISPLAY=135.3.113.34:0.0
137 :    
138 :     not
139 :    
140 :     EXENE_DISPLAY=wren:0.0
141 :    
142 :     EXAMPLE:
143 :    
144 :     Below is a sketch of a typical eXene application called "draw":
145 :    
146 :     structure S = Styles
147 :    
148 :     val defaults = [
149 :     "draw*background: gray80",
150 :     "draw*foreground: black",
151 :     "draw*selectColor: yellow",
152 :     "draw*Button.background: gray70",
153 :     "draw*font: -Adobe-Helvetica-Bold-R-Normal--*-120-*"
154 :     ]
155 :    
156 :     fun main root = let
157 :     val style = Widget.styleFromStrings (root, defaults)
158 :     val name = S.mkView {name = S.styleName ["draw"], aliases = []}
159 :     (* make widget name hierarchy *)
160 :     (* create widgets button up *)
161 :     val layout = ... (* top-level widget *)
162 :    
163 :     val shellArgs = [
164 :     (Attrs.attr_title,Attrs.AV_Str "draw")),
165 :     (Attrs.attr_iconName,Attrs.AV_Str "draw")
166 :     ]
167 :    
168 :     val shell = Shell.shell (root,(name,style),shellArgs) layout
169 :     in
170 :     Shell.init shell
171 :     end
172 :    
173 :     fun doit () = RunEXene.run main
174 :    
175 :     CAVEATS:
176 :    
177 :     This version of the eXene widgets represents the widgets as they are
178 :     right now. There are many bugs; many of the widgets have not been
179 :     converted to a 3D look or to use resources; there will probably be
180 :     additional changes in the design.
181 :    
182 :     The use of resources is neither complete nor uniform. There will probably
183 :     be some convention by which a widget will automatically add some class
184 :     name to its style_view. Widgets that create internal subwidgets (e.g.,
185 :     scrollPorts) do not as yet provide them with new style_views.
186 :    
187 :     The idea of the argument list used at widget creation is right, but its
188 :     form is not. A flat name-value list does not allow a programmer to
189 :     control the resources of specific internal widgets. The name component
190 :     of an argument needs to reflect the hierarchy. This suggests replacing
191 :     the type of name with a list of names, a list of strings or perhaps
192 :     strings following the conventions of resource databases, i.e.,
193 :     "plotos*TextEntry.background"
194 :    
195 :     There is no new documentation reflecting the new interfaces and features.
196 :     At this point, even comments are minimal. If a widget supports resources,
197 :     these can be deduced from a list of attribute names and default values
198 :     found in the source file.
199 :    

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0