Changeset 935 for trunk/gsascmds.tcl


Ignore:
Timestamp:
Mar 3, 2010 9:27:00 AM (11 years ago)
Author:
toby
Message:

EXPGUI:

  • Implement routine to locate window where user wants (see LocateWindow?)
  • allow pgplot in gsas/pgl or gsas/pgplot

Import_cif: make sure that missing or defaulted values for Uiso & occ are set to valid values.

gsascmds:

  • implement LocateWindow?
  • update to use saved pgplot location: $expgui(pgplotdir)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsascmds.tcl

    r930 r935  
    464464    afterputontop
    465465    return $makenew(result)
     466}
     467
     468# place a window on a selected part of the screen
     469# xfrac specifies the hozontal position with 0 to the left and 100 to the right
     470# yfrac specifies the vertical position with 0 to the top and 100 to the bottom
     471# loc chooses the part of the window to place at that location: N: upper, S: lower, W: left, E: right
     472# use NSEW for center
     473proc LocateWindow {win {xfrac 50} {yfrac 50} {loc c}} {
     474    wm withdraw $win
     475    set maxx [winfo screenwidth $win]
     476    set maxy [winfo screenheight $win]
     477    set reqx [winfo reqwidth $win]
     478    set reqy [winfo reqheight $win]
     479    set x [expr {$maxx*$xfrac/100.}]
     480    set y [expr {$maxy*$yfrac/100.}]
     481    if {[string match -nocase "*e*" $loc] && [string match -nocase "*w*" $loc]} {
     482        # EW: center
     483        set x [expr {$x - $reqx/2. }]
     484    } elseif {[string match -nocase "*e*" $loc]} {
     485        # right corner
     486        set x [expr {$x - $reqx}]
     487    } elseif {[string match -nocase "*w*" $loc]} {     
     488        # left corner -- do nothing
     489    } else {
     490        # center
     491        set x [expr {$x - $reqx/2. }]
     492    }
     493    if {[string match -nocase "*n*" $loc] && [string match -nocase "*s*" $loc]} {
     494        # NS: center
     495        set y [expr {$y - $reqy/2 }]
     496    } elseif {[string match -nocase "*n*" $loc]} {
     497        # upper corner -- do nothing
     498    } elseif {[string match -nocase "*s*" $loc]} {
     499        # lower corner
     500        set y [expr {$y - $reqy}]
     501    } else {
     502        # center
     503        set y [expr {$y - $reqy/2 }]
     504    }
     505    set x [expr {int($x + 0.5)}]
     506    set y [expr {int($y + 0.5)}]
     507    if {$x < 0} {set x 0}
     508    if {$x > $maxx-$reqx} {set x [expr {$maxx-$reqx}]}
     509    if {$y < 0} {set y 0}
     510    if {$y > $maxy-$reqy} {set y [expr {$maxy-$reqy}]}
     511    wm geom $win +$x+$y
     512    wm deiconify $win
    466513}
    467514
     
    25252572        set env(GSAS) [file nativename $expgui(gsasdir)]
    25262573        # PGPLOT_FONT is needed by PGPLOT
    2527         set env(PGPLOT_FONT) [file nativename [file join $expgui(gsasdir) pgl grfont.dat]]
     2574        set env(PGPLOT_FONT) [file nativename [file join $expgui(pgplotdir) grfont.dat]]
    25282575        # this is the number of lines/page in the .LST (etc.) file
    25292576        set env(LENPAGE) 60
     
    26112658        set env(GSAS) [file nativename $expgui(gsasdir)]
    26122659        # PGPLOT_FONT is needed by PGPLOT
    2613         set env(PGPLOT_FONT) [file nativename [file join $expgui(gsasdir) pgl grfont.dat]]
     2660        set env(PGPLOT_FONT) [file nativename [file join $expgui(pgplotdir) grfont.dat]]
    26142661        # this is the number of lines/page in the .LST (etc.) file
    26152662        set env(LENPAGE) 60
     
    26382685                # replace the forward slashes with backward
    26392686                regsub -all / $cmd \\ cmd
     2687                # use of file attributes -shortname & normalize and nativename
     2688                # might help here
    26402689                exec $env(COMSPEC) /c \
    26412690                        "start [file join $expgui(scriptdir) $script] $cmd"
     
    26712720        set env(ATMXSECT) [file join $expgui(gsasdir) data atmxsect.dat]
    26722721        # PGPLOT_DIR is needed by PGPLOT
    2673         set env(PGPLOT_DIR) [file join $expgui(gsasdir) pgl]
     2722        set env(PGPLOT_DIR) $expgui(pgplotdir)
    26742723        # this is the number of lines/page in the .LST (etc.) file
    26752724        set env(LENPAGE) 60
     
    27172766        set env(GSAS) [file nativename $expgui(gsasdir)]
    27182767        # PGPLOT_FONT is needed by PGPLOT
    2719         set env(PGPLOT_FONT) [file nativename [file join $expgui(gsasdir) pgl grfont.dat]]
     2768        set env(PGPLOT_FONT) [file nativename [file join $expgui(pgplotdir) grfont.dat]]
    27202769        # this is the number of lines/page in the .LST (etc.) file
    27212770        set env(LENPAGE) 60
     
    27372786        set env(ATMXSECT) [file join $expgui(gsasdir) data atmxsect.dat]
    27382787        # PGPLOT_DIR is needed by PGPLOT
    2739         set env(PGPLOT_DIR) [file join $expgui(gsasdir) pgl]
     2788        set env(PGPLOT_DIR) $expgui(pgplotdir)
    27402789        # this is the number of lines/page in the .LST (etc.) file
    27412790        set env(LENPAGE) 60
Note: See TracChangeset for help on using the changeset viewer.