source: trunk/doc/expgui_cfg.html @ 577

Last change on this file since 577 was 574, checked in by toby, 11 years ago

# on 2002/04/12 19:49:04, toby did:
remove identification stuff

  • Property rcs:author set to toby
  • Property rcs:date set to 2002/04/12 19:49:04
  • Property rcs:lines set to +6 -5
  • Property rcs:rev set to 1.24
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 28.9 KB
Line 
1<HTML>
2   <TITLE>Customizing EXPGUI and Associated Programs</TITLE>
3
4   <meta name="keywords" content="crystallography, Rietveld, diffraction,
5   GSAS, EXPGUI">
6</HEAD>
7<style>
8A:link {text-decoration:none}
9A:vlink {text-decoration:none}
10</style>
11
12<BODY BGCOLOR="#FFFFFF"
13      topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" 
14      text="#000000" link="#0033ff" vlink="#0033ff" alink="#0033ff">
15
16<?
17   include("/var/www/include/navigation.inc");
18   include("/var/www/include/utility.inc");
19?>
20<blockquote><font face="arial, helvetica, sans-serif">
21
22<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
23<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
24</TH></TR></TABLE><BR CLEAR=ALL>
25
26<CENTER><H1>
27<HR noshade width="75%" size="2" align="center">
28Customizing EXPGUI and Associated Programs
29<HR noshade width="75%" size="2" align="center">
30</H1></CENTER>
31
32The EXPGUI GSAS graphical user interface can be modified in many
33ways quite easily.
34This document describes how the GUI works and how to modify the menus without
35significant reprogramming. A little bit of programming in Tcl/Tk can go a
36long way in adding new features. See the
37<a HREF="#Customizing">Customizing</A> examples, below.
38
39<H3>EXPGUI</H3>
40The main GUI is created by file expgui, which in turn uses the following files
41sequentially:
42<UL>
43<LI><FONT FACE="COURIER">readexp.tcl</FONT>
44<LI><FONT FACE="COURIER">gsascmds.tcl</FONT>
45<LI><FONT FACE="COURIER">gsasmenu.tcl</FONT>
46</UL>
47Two additional files are read if they are found:
48<UL>
49<LI><FONT FACE="COURIER">localconfig</FONT>
50<LI><FONT FACE="COURIER">.gsas_config</FONT>
51</UL>
52<P>The first three files,
53(<FONT FACE="COURIER">readexp.tcl</FONT>, <FONT FACE="COURIER">gsascmds.tcl</FONT>, <FONT FACE="COURIER">gsasmenu.tcl</FONT>)
54must be located in the same directory where the <FONT FACE="COURIER">expgui</FONT> file is found.
55The <FONT FACE="COURIER">localconfig</FONT> file also is read from this directory, if it exists.
56The final file, <FONT FACE="COURIER">.gsas_config</FONT>, is read from the user's login directory (UNIX) or <FONT FACE="COURIER">C:\</FONT> (Windows).
57The <FONT FACE="COURIER">localconfig</FONT> and <FONT FACE="COURIER">.gsas_config</FONT> are intended to
58contain system-wide and user-level default values for parameters
59that are described in this document. Most routines have
60a "Save Options" command that writes some of the current parameters to
61file  <FONT FACE="COURIER">.gsas_config</FONT>. Note that information in <FONT FACE="COURIER">.gsas_config</FONT>
62overrides that in <FONT FACE="COURIER">localconfig</FONT>.
63No error occurs if either of these files are not found.
64
65<P>
66The <FONT FACE="COURIER">readexp.tcl</FONT> and <FONT FACE="COURIER">gsascmds.tcl</FONT> files contain
67tcl procedures that are
68used for more than one application, so it is convenient to place them
69in separate files. They are only of interest to someone trying to debug
70or add new functionality to expgui.
71<P>
72The <FONT FACE="COURIER">gsasmenu.tcl</FONT> file defines the contents of the
73menu bar, the contents of the
74button bar and definitions for each command. The contents of this file
75are designed to be modified and extended by users, either by editing the file,
76or by overriding definitions in the <FONT FACE="COURIER">localconfig</FONT> or
77<FONT FACE="COURIER">.gsas_config</FONT> files.
78
79The important variables defined in the <FONT FACE="COURIER">gsasmenu.tcl</FONT> file are:
80<DL><DL>
81<DT><FONT FACE="COURIER">expgui(menunames)</FONT><DD>
82This list defines the menu bar headings other than File, Options & Help
83<DT><FONT FACE="COURIER">expgui_menulist</FONT><DD>
84Each array element, e.g. expgui_menulist(file) and expgui_menulist(powder),
85defines commands to be added to a menu heading. Each command will appear
86as an array element in expgui_cmdlist.
87<DT><FONT FACE="COURIER">expgui_cmdlist</FONT><DD>
88Each array element, e.g. expgui_cmdlist(Save) or expgui_cmdlist(expnam)
89contains two items. The first defines a tcl procedure to be executed
90when the command is invoked, or "-" if no command will be invoked and
91the second contains help information describing what the command does.
92Note that when menu item is selected the variable cmd is set to the
93name of the command, so
94<FONT FACE="COURIER"><PRE>
95    expgui_cmdlist(powpref) {{runGSASwEXP $cmd} {Powder data preparation}}
96</PRE></FONT>
97means that "runGSASwEXP powpref" will be invoked when powpref is invoked.
98For example, when powpref is selected, the tcl command
99"runGSASwEXP $cmd" is invoked, where variable cmd is set to "powpref".
100<DT><FONT FACE="COURIER">expgui(buttonlist)</FONT><DD>
101This list defines the commands that will appear on the button bar where
102each item that appears on the button bar must have a matching pair of entries
103in expgui_cmdlist.
104Thus if the command
105<FONT FACE="COURIER"><PRE>
106   set expgui(buttonlist) {expnam expedt genles ortep fourier forsrh forplot lstview}
107</PRE></FONT>
108is placed in the <FONT FACE="COURIER">localconfig</FONT> or <FONT FACE="COURIER">.gsas_config</FONT> files this will
109redefine the contents of the button bar.
110</DL></DL>
111
112In addition to the variables defined in the previous file, expgui, uses
113a small number of array elements for other configuration options. They are:
114<DL><DL>
115
116<DT><FONT FACE="COURIER">expgui(scriptdir)</FONT><DD>
117This determines where files such as <FONT FACE="COURIER">readexp.tcl</FONT>, etc.
118are located. This defaults to the location where <FONT FACE="COURIER">expgui</FONT> is located so
119it rarely needs to be changed.
120
121<DT><FONT FACE="COURIER">expgui(gsasdir)</FONT><DD>
122This contains the location of the GSAS directory, if it is not the
123parent director where expgui is found.
124This determines where a number of GSAS data files will be located. If expedt
125crashes when you try to add new atoms, this is probably wrong.
126
127<DT><FONT FACE="COURIER">expgui(gsasexe)</FONT><DD>
128This determines where the GSAS executable files are located.
129You might want to change this is you keep multiple versions of GSAS
130around or if you keep the GSAS files in a different location than
131the default or want to keep the tcl files somewhere other than
132in a subdirectory of the GSAS files.
133
134<DT><FONT FACE="COURIER">expgui(bkgcolor1)</FONT><DD>
135Sets the background color for the bottom box on the phase pane.
136The default value, #fdf, is a light violet that
137will probably drive some folks nuts, but is a good contrast to the yellow
138of the refinement flags.
139
140<DT><FONT FACE="COURIER">liveplot(hst)</FONT><DD>
141Sets the default histogram used for liveplot
142
143<DT><FONT FACE="COURIER">liveplot(legend)</FONT><DD>
144Sets the default value for display of the legend in liveplot
145
146<DT><FONT FACE="COURIER">expgui(initstring)</FONT><DD>
147Defines commands to be executed by EXPGUI after all other commands
148have been run. This is used to define initialization commands in
149the <FONT FACE="COURIER">localconfig</FONT> or <FONT FACE="COURIER">.gsas_config</FONT> files that cannot be
150run at the time when the files are sourced. <I>(added in EXPGUI v1.21)</I>
151</DL></DL>
152
153The following variables are written to <font face="courier">.gsas_config</font> when
154"Save Options" is used. These variables are all set from the GUI and therefore
155do not need to be edited manually.
156
157<DL><DL>
158<DT><FONT FACE="COURIER">expgui(archive)</FONT><DD>
159This defines the default state for the archive flag,
160where 0 is off and 1 is on. When archive is on, a copy of the .EXP file
161is saved before a new version of the file is saved in EXPGUI.
162
163<DT><FONT FACE="COURIER">expgui(font)</FONT><DD>
164This determines the base font used in the programs. You conceivably
165could want to use an integer value not present in the
166"Options/Screen Font" menu command.
167
168<DT><FONT FACE="COURIER">expgui(asorttype)</FONT><DD>
169This determines the atom sort mode.
170
171<DT><FONT FACE="COURIER">expgui(hsorttype)</FONT><DD>
172This determines the histogram sort mode.
173
174<DT><FONT FACE="COURIER">expgui(filesort)</FONT><DD>
175This determines the default file sorting mode for the expnam command.
176
177<DT><FONT FACE="COURIER">expgui(autoexpload)</FONT><DD>
178If set to 1, the experiment file is automatically reread after
179GSAS programs modify it.
180(UNIX only)
181
182<DT><FONT FACE="COURIER">expgui(showexptool)</FONT><DD>
183If set to 1, output from EXPTOOL is shown after the program is run.
184This is probably needed only for debugging purposes.
185
186<DT><FONT FACE="COURIER">env(GSASBACKSPACE)</FONT><DD>
187Used only for UNIX: This determines if the default definition
188for the backspace key is overridden; some UNIX systems need this so that
189expedt and other terminal-oriented programs work correctly and
190other systems do not. You can toggle this option using the
191"Override Backspace" option on the file menu to see what works for you.
192
193</DL></DL>
194
195
196<HR><H3><A NAME="import">Coordinate import routines for EXPGUI</A>
197<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
198</H3>
199See the <A HREF="expgui.html#import">coordinate import discussion</A> 
200for description of available formats.
201It is possible to define new formats for EXPGUI to use for importing
202phase/coordinate information. This is done by creating a file
203containing the appropriate Tcl code to read this file type.
204All that is needed to cause the code to be incorporated into
205EXPGUI is to name it
206<FONT FACE="COURIER">import_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
207and place it in the EXPGUI directory. All files with
208such names are read when EXPGUI is started.
209
210The <FONT FACE="COURIER">import_</FONT> file must contain four items:
211<UL>
212<LI>
213A description for the type of file to be read.
214<DL><DL>
215<FONT FACE="COURIER"><PRE>
216set description "PowderCell .CEL file"
217</PRE></FONT>
218</DL>
219The text should not be too long, but use a return (\n) if needed:
220<DL><FONT FACE="COURIER"><PRE>
221set description "My favorite coordinate\nfile from the GIGO pkg"
222</PRE></FONT></DL></DL>
223This description text shows up on the button for selecting a format.
224<P>
225<LI>
226A list of preferred file extensions.
227<DL><DL><FONT FACE="COURIER"><PRE>
228set extensions .cel
229</PRE></FONT></DL>
230or
231<DL><FONT FACE="COURIER"><PRE>
232set extensions {.jnk .junk}
233</PRE></FONT></DL></DL>
234In UNIX upper and lower case
235versions will be generated automatically, so do not worry about
236the case of the extension. Note that "*" (all files) is always added as well.
237<P>
238<LI>
239The name of the routine that will read the data file
240<DL><DL><FONT FACE="COURIER"><PRE>
241set procname ReadPowderCellFile
242</PRE></FONT></DL></DL>
243<LI>
244A routine that takes the file name as an argument
245<DL><DL><FONT FACE="COURIER"><PRE>
246proc ReadPowderCellFile {filename} {
247</PRE></FONT></DL></DL>
248and returns a list containing the following four items
249<OL>
250<P><LI>Space Group
251<DL><DL>
252The space group should be named and spaced appropriately for GSAS,
253e.g. P 21/c or P 21 21 21, not P21/c or P212121.
254</DL></DL>
255Note that GSAS requires that if a center of symmetry is present,
256this center defines the origin (Origin 2 settings, where more than one setting
257is given in the International Tables).
258<P><LI>Cell parameters
259<DL><DL>
260All six parameters should be specified in a list
261</DL></DL>
262<P><LI>Atom Coordinates
263<DL><DL>
264The atom coordinates should be specified as a list with a list element
265for each atom.
266The list contains the following items:
267<OL>
268<LI>Atom label
269<LI><I>x</I>
270<LI><I>y</I>
271<LI><I>z</I>
272<LI>Atom type
273<LI>Occupancy
274<LI>U<sub>iso</sub>
275</OL>
276If an item is not specified, it is left blank in the atom table, except for
277Occupancy and U<sub>iso</sub>, which default to 1.0 and 0.025, respectively.
278However, one must specify a null value, if an item will be skipped over.
279For example, use:
280<FONT FACE="COURIER"><PRE>
281    "Li1 0 0 0 li 0.5"
282</PRE></FONT>
283or
284<FONT FACE="COURIER"><PRE>
285    "{} 0 0 0 li 0.5"
286</PRE></FONT>
287but not
288<FONT FACE="COURIER"><PRE>
289    "0 0 0 li 0.5"
290</PRE></FONT>
291
292</DL></DL>
293<P><LI>Warning Message (optional)
294<DL><DL>
295The warning message is displayed at the bottom of the
296Replace Atoms and Add Atoms box after the file is read. This can be used
297to warn the user about problems reading the file, for example if
298the space group symbol needs attention.
299</DL></DL>
300</OL>
301See the file <FONT FACE="COURIER">import_cell.tcl</FONT> as an example for how this code
302is written.
303
304</UL>
305<HR><H3><A NAME="export">Coordinate Export routines for EXPGUI</A>
306<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
307</H3>
308See the <A HREF="expgui.html#export">coordinate export discussion</A> 
309for description of available formats.
310It is possible to define new formats for EXPGUI to use for exporting
311phase/coordinate information. This is done by creating a file
312containing the appropriate Tcl code to read this file type.
313All that is needed to cause the code to be incorporated into
314EXPGUI is to name it
315<FONT FACE="COURIER">export_</FONT><I>xxxx</I><FONT FACE="COURIER">.tcl</FONT> (where <I>xxxx</I> is arbitrary)
316and place it in the EXPGUI directory. All files with
317such names are read when EXPGUI the Import/Export=>"Coord Export" submenu
318is first invoked.
319
320The <FONT FACE="COURIER">export_</FONT> file must define two variables:
321<DL><DL>
322<DT>label<DD>
323This defines the text that appears on the submenu. For example:
324<FONT FACE="COURIER"><PRE>
325        set label "MSI .xtl format"
326</PRE></FONT>
327<DT>action<DD>
328This defines the Tcl routine that will be used to
329<FONT FACE="COURIER"><PRE>
330        set action exp2xtl
331</PRE></FONT>
332</DL></DL>
333See the file <FONT FACE="COURIER">export_example.example</FONT>, as well as the
334<FONT FACE="COURIER">export_*.tcl</FONT> files
335as examples for how this
336sort of routine is written.
337
338<HR><H3>LSTVIEW</H3>
339The <FONT FACE="COURIER">localconfig</FONT> and <FONT FACE="COURIER">.gsas_config</FONT> files are read, if present.
340The following options are available for customization in these files:
341<DL><DL>
342<DT><FONT FACE="COURIER">txtvw(menulength)</FONT><DD>
343This limits the number of entries that can
344exist in a menu. For example, the default is 25, so when more than 25 cycles
345are found in a .LST file, only the last 25 are listed in the
346"Go To"/cycle submenu.
347<DT><FONT FACE="COURIER">txtvw(maxchars)</FONT><DD>
348This limits the maximum number of
349characters that will be read from an existing .LST file to speed
350the start of the program. The default is ~1Mb
351for UNIX systems and ~200K for Windows.
352<DT><FONT FACE="COURIER">txtvw(plotvars)</FONT><DD>
353If txtvx(plotvars) is 1, a plot window is created for plotting of
354R-factors and parameter shifts as a function of cycle number.
355Note that the summary of shifts must be displayed, in order
356to plot parameter shifts. If this variable is set to 0, the
357plot window is not created and LSTVIEW runs a bit faster.
358</DL></DL>
359
360The following variables are written to <font face="courier">.gsas_config</font> when
361"Save Options" is used. These variables can be set from the GUI and therefore
362do not need to be edited manually.
363
364<DL><DL>
365<DT><FONT FACE="COURIER">txtvw(followcycle)</FONT><DD>
366This sets the initial value for the
367"Auto Advance" button in the "Go To" menu. When this is true,
368the program will show the last cycle in the file. As new cycles are
369added, the "view" is advanced.
370
371<DT><FONT FACE="COURIER">txtvw(font)</FONT><DD>
372This sets the font used for LSTVIEW. See documentation on the font command in
373Tk for details on font naming.
374</DL></DL>
375
376<hr><H3>LIVEPLOT</H3><A NAME="liveplot"></A>
377A description of the customization options for LIVEPLOT can be
378found in the
379<A HREF="liveplot.html#customize">
380LIVEPLOT description</A>.
381
382
383<HR>
384<a name="WIDPLT"></a>
385<H3>WIDPLT</H3>
386The widplt script is used to display the FWHM for one or more histograms
387from a .EXP file.
388At this point it only works for CW data.
389It is often convenient to add for reference the expected
390instrumental curves as options to the menu. This can be done by creating a
391file called widplot_<i>name</i>. For example, renaming the
392<font face="courier">example_widplt_BT1</font> file supplied with the distribution to
393<font face="courier">widplt_BT1</font> will cause the FWHM curves for the NIST BT-1 instrument
394to be added to the menu of defined FWHM values.
395<P>
396Creating such a file is easy. To add a entry define the following
397five array elements using a single, unique element name and then append that
398element name to variable datalist.
399Define
400<FONT FACE="COURIER"><PRE>
401    set UVWP(Ge15) {398.5 -343.2  163.0 0}
402    set XY(Ge15) {0 0}
403    set wave(Ge15) 2.0775
404    set lblarr(Ge15) "BT-1 Ge(311) 15'"
405    set ttrange(Ge15) "5 160"
406    lappend datalist Ge15
407</PRE></FONT>
408Array element UVWP(item) contains the (Gaussian) GU, GV, GW and GP values,
409while XY(item) contains the (Lorentzian) LX and LY terms. Array element
410wave(item) contains a wavelength, array element lblarr(item) contains
411the text to be shown on the "Plot Contents" menu and ttrange(item)
412defines the range the function is valid.
413<P>
414The following variables are written to <font face="courier">.gsas_config</font> when
415"Save Options" is used. These variables are all set from the GUI and therefore
416do not need to be edited manually.
417
418<DL><DL>
419<DT><FONT FACE="COURIER">graph(printout)</FONT><DD>
420This is set to 1 if PostScript files
421will be printed and 0 if they will be written to disk (for Windows all
422files should be written to disk).
423
424<DT><FONT FACE="COURIER">graph(outname)</FONT><DD>
425This is the default for the file name used
426when PostScript files will be written to disk.
427
428<DT><FONT FACE="COURIER">graph(outcmd)</FONT><DD>
429This is the default for the command used
430to print PostScript files (Unix only).
431
432<DT><FONT FACE="COURIER">graph(legend)</FONT><DD>
433Sets the default value for display of the legend in liveplot and widplt.
434
435<DT><FONT FACE="COURIER">graph(plotunits)</FONT><DD>
436Sets the units used for displaying the data. Values are "d", "q", "",
437for d-space, Q and 2-theta, respectively.
438<DT><FONT FACE="COURIER">graph(equivwave)</FONT><DD>
439Sets the wavelength used for displaying data, if blank, no conversion is
440done and data are shown in their original wavelength.
441</DL></DL>
442
443<hr>
444<a name="Customizing"><H2>
445Customizing Example 1: Adding a new button to the button bar
446</H2></A>
447When a LeBail extraction is used to refine lattice constants, profile
448terms, ... It is always a good idea to run GENLES a few times after running
449POWPREF. This is because GENLES sets the extracted intensities back to their
450crystallographic values, during the first GENLES cycle after POWPREF has been
451run. Refining anything until the extracted intensities return to reasonable
452values is a really bad idea. Forturnately, running GENLES with the number of
453cycles set to zero gives the Le Bail extraction a head start.
454<P>
455The code below can be used to define a new command, <font face="courier">leBail</font>. The first
456command adds a command to the button bar and the second one defines what will
457be done when it is invoked (the number of cycles is set to zero and
458GENLES is run three times). It also defines the help entry. Note that commands must start with a lower case letter even though Armel LeBail's last name
459does not.
460
461<FONT FACE="COURIER"><PRE>
462    lappend expgui(buttonlist) leBail
463    set expgui_cmdlist(leBail) {
464        {set entryvar(cycles) 0; runGSASwEXP "genles genles genles"}
465        {Converges GENLES with LeBail extractions;
466          Sets the number of cycles to zero and runs GENLES 3 times.}
467    }
468
469</PRE></FONT>
470To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
471file or the
472<FONT FACE="COURIER">~/.gsas_config</FONT> or (or <FONT FACE="COURIER">C:\GSAS\EXPGUI\.gsas_config</FONT>)
473file.
474<hr>
475<H2>
476Customizing Example 2: Putting DISAGL Results in a Separate Box
477</H2>
478Barbara Reisner has been asking me to put the output from DISAGL in a separate
479window. Sounds like a pretty reasonable request. Here is an example with code
480to do that as a customization option. Please note that this has now been
481incorporated into EXPGUI, so do not use this example.
482<FONT FACE="COURIER"><PRE>
483  set expgui(disaglSeparateBox) 1
484  set expgui_cmdlist(disagl) {rundisagl {Hacked Distance/angle calculations}}
485  proc rundisagl {} {
486    global expgui txtvw tcl_version tcl_platform
487    if {$expgui(disaglSeparateBox) && $tcl_platform(platform) != "windows"} {
488        set root [file root $expgui(expfile)]
489        catch {file rename $root.LST $root.OLS}
490        runGSASwEXP disagl
491        catch {file rename $root.LST $root.DIS}
492        catch {file rename $root.OLS $root.LST}
493
494        # open a new window
495        catch {toplevel .disagl}
496        catch {eval grid forget [grid slaves .disagl]}
497        text .disagl.txt -width 100 -wrap none \
498                -yscrollcommand ".disagl.yscroll set" \
499                -xscrollcommand ".disagl.xscroll set"
500        if {$tcl_version >= 8.0} {.disagl.txt config -font $txtvw(font)}
501        scrollbar .disagl.yscroll -command ".disagl.txt yview"
502        scrollbar .disagl.xscroll -command ".disagl.txt xview" -orient horizontal
503        grid .disagl.xscroll -column 0 -row 2 -sticky ew
504        grid .disagl.txt -column 0 -row 1 -sticky nsew
505        grid .disagl.yscroll -column 1 -row 1 -sticky ns
506        grid columnconfigure .disagl 0 -weight 1
507        grid rowconfigure .disagl 1 -weight 1
508        wm title .disagl "DISAGL results $expgui(expfile)"
509        wm iconname .disagl "DISAGL $root"
510        set in [open $root.DIS r]
511        .disagl.txt insert end [read $in]
512        close $in
513        bind all <Control-KeyPress-c> {destroy .disagl}
514        bind .disagl <KeyPress-Prior> ".disagl.txt yview scroll -1 page"
515        bind .disagl <KeyPress-Next> ".disagl.txt yview scroll 1 page"
516        bind .disagl <KeyPress-Right> ".disagl.txt xview scroll 1 unit"
517        bind .disagl <KeyPress-Left> ".disagl.txt xview scroll -1 unit"
518        bind .disagl <KeyPress-Up> ".disagl.txt yview scroll -1 unit"
519        bind .disagl <KeyPress-Down> ".disagl.txt yview scroll 1 unit"
520        bind .disagl <KeyPress-Home> ".disagl.txt yview 0"
521        bind .disagl <KeyPress-End> ".disagl.txt yview end"
522        # don't disable in Win as this prevents the highlighting of selected text
523        if {$tcl_platform(platform) != "windows"} {
524            .disagl.txt config -state disabled
525        }
526    } else {
527        runGSASwEXP disagl
528    }
529  }
530
531if {$tcl_platform(platform) != "windows"} {
532  append expgui(initstring) {
533      $expgui(fm).option.menu add checkbutton  -label "DISAGL window" \
534              -variable expgui(disaglSeparateBox) -underline 0;
535  }
536}
537
538</PRE></FONT>
539To make this customization, put the above in the <FONT FACE="COURIER">localconfig</FONT> 
540file or the
541<FONT FACE="COURIER">~/.gsas_config</FONT> or (or <FONT FACE="COURIER">C:\GSAS\EXPGUI\.gsas_config</FONT>)
542file.
543<P>
544Note that the <font face="courier">expgui(initstring)</font> option became available in EXPGUI
545version 1.21. (Previous versions will ignore this). This code must be executed
546after all the menus and other GUI code has been run. When executed, it
547creates a checkbutton on the Options menu to
548turn the "separate DISAGL window mode" mode on and off.
549
550<hr><H2>
551Customizing Example 3: Adding a new page to EXPGUI
552</H2>
553The steps for creating support for additional functionality, implementation
554of atom constraints, is outlined here. Routines described here can be found in
555file <font face="courier">atomcons.tcl</font> unless otherwise noted.
556<OL>
557<LI>Create a routine to read and write the appropriate records
558from the .EXP file. In this case, a new routine, constrinfo,
559was added to file <font face="courier">readexp.tcl</font>.
560This takes considerable care and manual testing.
561<LI>Create a routine that places the appropriate widgets into a frame
562(in this case MakeAtomsConstraintsPane). This routine will be called only once.
563Note that in this example expcons(atommaster) is defined to be the name of the
564frame.
565<LI>Create a routine to display and edit the information shown in the
566frame. In this case, DisplayAtomConstraints. This routine will be called each
567time the page is displayed. Note that this routine and the previous can be
568tested in a separate toplevel until they work well.
569<LI>In this particular example, the previous frame is located on a notebook
570widget that in turn placed on a notebook page, so MakeConstraintsPane is used
571to create this inner notebook when the "Constraints" notebook page is first
572shown. This in turn calls MakeAtomsConstraintsPane and DisplayAtomConstraints.
573To update this page each time it is displayed, DisplayConstraintsPane is
574called.
575<LI>Edit file <font face="courier">expgui</font> to make the following changes:
576<UL>
577<P><LI>load the <font face="courier">atomcons.tcl</font> file:
578<FONT FACE="COURIER"><PRE>
579# commands for constraints
580source [file join $expgui(scriptdir) atomcons.tcl]
581</PRE></FONT>
582<P><LI>Define a notebook page for the option. The -createcmd option
583is used only once, but the -raisecmd option is used every time
584the page is exposed.
585<FONT FACE="COURIER"><PRE>
586set expgui(consFrame) [\
587            .n insert end consPane -text Constraints \
588            -raisecmd "set expgui(pagenow) consFrame; DisplayConstraintsPane"\
589            -createcmd MakeConstraintsPane]
590lappend expgui(frameactionlist) "consFrame DisplayConstraintsPane"
591</PRE></FONT>
592Note that if we were displaying the atoms constraint page directly on
593the main notebook widget, the previous command would have been
594<font face="courier">-raisecmd DisplayAtomConstraints -createcmd MakeAtomsConstraintsPane</font>
595<P>
596Since the frame will need to be updated when information in the .EXP file
597changes, the name of the frame and a command to execute are added into list
598expgui(frameactionlist) using the <FONT FACE="COURIER">lappend expgui(frameactionlist)</FONT>
599command.
600</PRE></FONT>
601</UL>
602</OL>
603
604<hr><H2>
605Customizing Example 4: Changing the fonts used in the GUI
606</H2>
607<B>Question: </B>
608<I>I am not happy with the fonts available via the Option/Screen Font
609menu option. Is there a way to select different font size(s)/families?
610</I>
611<UL>
612<B>Answer: </B>
613The fonts used in EXPGUI can be customized by adding some code to the
614<FONT FACE="COURIER">localconfig</FONT> file or the
615<FONT FACE="COURIER">~/.gsas_config</FONT> or (or <FONT FACE="COURIER">C:\GSAS\EXPGUI\.gsas_config</FONT>) file.
616By default, fonts are 14 point for the menus, buttons, labels,... and
61712 point for the histogram and atom lists.
618<P>
619If you add a command like this:
620<UL><FONT FACE="COURIER"><PRE>
621option add *Coord.Listbox.Font "Courier -18 bold italic" 20
622</PRE></FONT></UL>
623<P>
624you will override the menu command and force the atom coordinates
625to be displayed at 18 points in a bold & italicied Courier font.
626(See the Tk documentation if this is not clear). The value 20 is a
627priority, which overrides the priority value of 10 in the
628standard initialization. Here are the options that can be specified:
629<DL><DL>
630<DT><FONT FACE="COURIER">*Graph*Font</FONT><DD>Used for Graph labels
631<DT><FONT FACE="COURIER">*Graph.font</FONT><DD>Used for Graph title
632<DT><FONT FACE="COURIER">*Canvas.font</FONT><DD>Used for notebook tabs
633<DT><FONT FACE="COURIER">*Button.font</FONT><DD>Used on most buttons
634<DT><FONT FACE="COURIER">*Menu.font</FONT><DD>Used on menu commands
635<DT><FONT FACE="COURIER">*Menubutton.font</FONT><DD>Used on "menu buttons" (e.g. Print options)
636<DT><FONT FACE="COURIER">*Label.font</FONT><DD>Used on labels
637<DT><FONT FACE="COURIER">*Scale.font</FONT><DD>Used on sliders (e.g. Marquardt damping)
638<DT><FONT FACE="COURIER">*TitleFrame.font</FONT><DD>Used on title frames (e.g. box labels such as
639the "Diffractometer Constants" label
640<DT><FONT FACE="COURIER">*SmallFont.Button.font</FONT><DD>Used for buttons with smaller letters
641<DT><FONT FACE="COURIER">*Coord.Listbox.font</FONT><DD>Used for coordinate listings, best as a
642mono-spaced font, such as Courier
643<DT><FONT FACE="COURIER">*HistList.Listbox.font</FONT><DD>Used for histogram listings
644<DT><FONT FACE="COURIER">*MonoSpc.Label.font</FONT><DD>Used in other places where a mono-spaced
645font is required
646</DL></DL>
647<P>
648It should be noted that the appearance of fonts depends on many factors --
649the fonts installed on your computer, the screen size and resolution and your
650eyes, so it is wise to experiment with different values.
651</UL>
652<hr>
653<blockquote>
654
655<A Href="http://www.ncnr.nist.gov/programs/crystallography/software/gsas.html">
656GSAS</A>
657is written by Allen C. Larson and <A HREF="http://www.nist.gov/cgi-bin/exit_nist.cgi?url=http://lansce.lanl.gov/lujan/staff12/vondreele.htm">
658Robert B. Von Dreele</A>, MS-H805,
659Los Alamos National Laboratory, Los Alamos, NM 87545. Problems, questions
660or kudos concerning GSAS should be sent to Robert B. Von Dreele at <A HREF="MAILTO:vondreele@lanl.gov">vondreele@lanl.gov</A>
661
662<P>EXPGUI is written by Brian H. Toby of the NIST Center for Neutron Research,
663<A HREF="MAILTO:Brian.Toby@NIST.GOV">Brian.Toby@NIST.GOV</A>.
664
665<P>GSAS is Copyright, 1984-1997, The Regents of the University of California.
666The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36)
667by the Los Alamos National Laboratory, which is operated by the University
668of California for the U.S. Department of Energy. The U.S. Government is
669licensed to use, reproduce, and distribute this software. Permission is
670granted to the public to copy and use this software without charge, provided
671that this notice and any statement of authorship are reproduced on all
672copies. Neither the Government nor the University makes any warranty, express
673or implied, or assumes any liability or responsibility for the use of this
674software.
675
676<P>EXPGUI is not subject to copyright. Have fun.
677</blockquote>
678<P><hr>
679<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
680<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
681</TH></TR></TABLE>
682
683<P><font size=-1><A HREF="MAILTO:crystal@NIST.gov?subject=WWW page <?=$PHP_SELF?>">Comments, corrections or questions: crystal@NIST.gov</A></font><BR>
684<font size=-1><? lastmod(); ?> </font>
685<BR>
686$Revision: 574 $ $Date: 2009-12-04 23:08:27 +0000 (Fri, 04 Dec 2009) $
687</blockquote>
688</BODY>
689</HTML>
Note: See TracBrowser for help on using the repository browser.