source: trunk/doc/expgui_cfg.html @ 862

Last change on this file since 862 was 862, checked in by toby, 13 years ago

# on 2005/12/16 00:42:42, toby did:

pane --> panel

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