| 1 |
## -*- cperl -*- |
| 2 |
## |
| 3 |
## This file is part of Athena, copyright (c) 2001-2006, 2008 Bruce Ravel |
| 4 |
## |
| 5 |
## This section of the code contains the subroutine for setting |
| 6 |
## properties for display of a newly selected group |
| 7 |
|
| 8 |
sub set_properties { |
| 9 |
my $how = shift; |
| 10 |
my $item = shift; |
| 11 |
my $saving = shift; |
| 12 |
my @normal = (-fill =>$config{colors}{background}, |
| 13 |
-outline=>$config{colors}{background}); |
| 14 |
my @selected = (-fill =>$config{colors}{current}, |
| 15 |
-outline=>$config{colors}{current}); |
| 16 |
|
| 17 |
## fixed step may not be up to date if the fixstep button was |
| 18 |
## pressed, then the step size was edited |
| 19 |
$groups{$current} -> make(bkg_step => $widget{bkg_step}->cget('-value')) if $groups{$current}->{bkg_fixstep}; |
| 20 |
|
| 21 |
#return if (($fat_showing eq 'normal') and ($item eq $current)); |
| 22 |
|
| 23 |
## a regex to match %grab buttons *not* on the main page |
| 24 |
my $grabskip = join("|", qw(deg lr peak etrun sta)); |
| 25 |
my ($blue, $cyan, $grey, $black, $h_font) = ($config{colors}{activehighlightcolor}, |
| 26 |
$config{colors}{requiresupdate}, |
| 27 |
$config{colors}{disabledforeground}, |
| 28 |
$config{colors}{foreground}, |
| 29 |
$config{fonts}{bold}); |
| 30 |
my $textcolor = $config{colors}{foreground}; |
| 31 |
|
| 32 |
## place a mark in the skinny window indicating which group is current |
| 33 |
my ($check, $widg, $rect, $prev); |
| 34 |
if ($current) { |
| 35 |
$rect = $groups{$current}->{rect}; |
| 36 |
$list -> itemconfigure($rect, @normal); |
| 37 |
update_hook($current); |
| 38 |
}; |
| 39 |
$prev = $current; |
| 40 |
$current = $item; |
| 41 |
if ($groups{$current}->{frozen}) { |
| 42 |
#($blue, $cyan) = ($config{colors}{frozen}, $config{colors}{frozenrequiresupdate}); |
| 43 |
#$textcolor = $config{colors}{frozen}; |
| 44 |
$h_font = $config{fonts}{boldit}; |
| 45 |
@selected = (-fill =>$config{colors}{frozencurrent}, |
| 46 |
-outline=>$config{colors}{frozencurrent}); |
| 47 |
}; |
| 48 |
$rect = $groups{$current}->{rect}; |
| 49 |
$list -> itemconfigure($rect, @selected); |
| 50 |
## restore normal text size/color to this label |
| 51 |
$list -> itemconfigure($groups{$current}->{text}, |
| 52 |
-fill => $textcolor, |
| 53 |
-font => ($groups{$current}->{frozen}) ? $config{fonts}{medit} : $config{fonts}{med}); |
| 54 |
|
| 55 |
($how == 1) or Echonow("displaying parameters for group \"$groups{$item}->{label}\""); |
| 56 |
|
| 57 |
## only want to do a Busy if something else isn't already doing so |
| 58 |
## because we do not want to release the grab at the end of this |
| 59 |
## routine should something else need to continue the grab after |
| 60 |
## this is finished |
| 61 |
my $is_busy = grep (/Busy/, $top->bindtags); |
| 62 |
#print join(" ", "before", $top->bindtags), $/; |
| 63 |
$top -> Busy unless $is_busy; |
| 64 |
#print join(" ", "after", $top->bindtags), $/; |
| 65 |
|
| 66 |
## these two widgets should be uneditable but selectable |
| 67 |
|
| 68 |
$widget{current} -> configure(qw/-state normal/); |
| 69 |
$widget{current} -> delete(qw/0 end/); |
| 70 |
if ($use_default) { |
| 71 |
$widget{current} -> insert(0, $groups{$item}->{label}); |
| 72 |
} else { |
| 73 |
if ($item eq "Default Parameters") { |
| 74 |
$widget{current} -> insert(0, "<no files loaded>"); |
| 75 |
project_state(1); |
| 76 |
} else { |
| 77 |
$widget{current} -> insert(0, $groups{$item}->{label}); |
| 78 |
}; |
| 79 |
}; |
| 80 |
$widget{current} -> configure(qw/-state disabled/); |
| 81 |
|
| 82 |
$widget{group} -> configure(qw/-state normal/); |
| 83 |
$widget{group} -> delete(qw/0 end/); |
| 84 |
if ($use_default) { |
| 85 |
$widget{group} -> insert(0, $groups{$item}->{label}); |
| 86 |
} else { |
| 87 |
$widget{group} -> insert(0, ($item eq "Default Parameters") ? "" : |
| 88 |
$groups{$item}->{group}); |
| 89 |
}; |
| 90 |
$widget{group} -> configure(qw/-state disabled/); |
| 91 |
|
| 92 |
|
| 93 |
$widget{file} -> configure(qw/-state normal/); |
| 94 |
$widget{file} -> delete(qw/0 end/); |
| 95 |
$widget{file} -> insert(0, $groups{$item}->{file}); |
| 96 |
$widget{file} -> xview('end'); |
| 97 |
$widget{file} -> configure(qw/-state disabled/); |
| 98 |
|
| 99 |
$widget{z} -> configure(-state=>($item eq "Default Parameters") ? |
| 100 |
'disabled' : 'normal'); |
| 101 |
$widget{edge} -> configure(-state=>($item eq "Default Parameters") ? |
| 102 |
'disabled' : 'normal'); |
| 103 |
|
| 104 |
#$widget{bkg_eshift} -> configure(-text=>$groups{$current}->{bkg_eshift}); |
| 105 |
#$widget{bkg_step} -> configure(-text=>sprintf "%.2f", $groups{$current}->{bkg_step}); |
| 106 |
|
| 107 |
$header{project} -> configure(-foreground=>$blue, -font=>$h_font); |
| 108 |
$header{current} -> configure(-foreground=>$blue, -font=>$h_font, |
| 109 |
-text=>$groups{$current}->{frozen} ? " Frozen group" : " Current group"); |
| 110 |
$header{plot} -> configure(-foreground=>$blue, -font=>$h_font); |
| 111 |
if ($item eq "Default Parameters") { |
| 112 |
map {$header{$_} -> configure(-foreground=>$blue, -font=>$h_font)} qw(bkg fft bft); |
| 113 |
}; |
| 114 |
|
| 115 |
## enable/disable red plotting buttons |
| 116 |
map {$b_red{$_} -> configure(-state=>'normal')} (keys %b_red); |
| 117 |
## enable/disable "save as" menu options |
| 118 |
## -1=chi rec, +1=mu, +2=norm, +3=chi(k), +4=chi(R), +5=chi(q) |
| 119 |
my $sep = ($Tk::VERSION > 804) ? 7 : 8; |
| 120 |
map {$file_menu -> menu -> entryconfigure($_, -state=>'normal')} ($sep+1 .. $sep+5); |
| 121 |
$data_menu -> menu -> entryconfigure(9, -state=>'disabled'); # Self Absorption |
| 122 |
##$freeze_menu -> menu -> entryconfigure(1, -label=>$groups{$item}->{frozen} ? 'Unfreeze this group': 'Freeze this group'); |
| 123 |
## also enable/disable headers according to data type |
| 124 |
SWITCH:{ |
| 125 |
($groups{$item}->{is_xanes}) and do { |
| 126 |
$header{bkg} -> configure(-foreground=>($groups{$item}->{update_bkg}) ? $cyan : $blue, -font=>$h_font); |
| 127 |
$header{bkg_secondary} -> configure(-foreground=>($groups{$item}->{update_bkg}) ? $cyan : $blue, -font=>$h_font); |
| 128 |
$header{fft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 129 |
$header{bft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 130 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'disabled')} (keys %grab); |
| 131 |
map {$grab{"bkg_$_"} -> configure(-state=>'normal')} (qw(pre1 pre2 nor1 nor2 e0)); |
| 132 |
map {$b_red{$_} -> configure(-state=>'disabled')} (qw(k R q kq)); |
| 133 |
map {$file_menu -> menu -> entryconfigure($_, -state=>'disabled')} ($sep+3 .. $sep+4); |
| 134 |
$data_menu -> menu -> entryconfigure(9, -state=>'normal'); # Self Absorption |
| 135 |
last SWITCH; |
| 136 |
}; |
| 137 |
($groups{$item}->{is_xmu}) and do { |
| 138 |
$header{bkg} -> configure(-foreground=>($groups{$item}->{update_bkg}) ? $cyan : $blue, -font=>$h_font); |
| 139 |
$header{bkg_secondary} -> configure(-foreground=>($groups{$item}->{update_bkg}) ? $cyan : $blue, -font=>$h_font); |
| 140 |
$header{fft} -> configure(-foreground=>($groups{$item}->{update_fft}) ? $cyan : $blue, -font=>$h_font); |
| 141 |
$header{bft} -> configure(-foreground=>($groups{$item}->{update_bft}) ? $cyan : $blue, -font=>$h_font); |
| 142 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'normal')} (keys %grab); |
| 143 |
$data_menu -> menu -> entryconfigure(9, -state=>'normal'); # Self Absorption |
| 144 |
last SWITCH; |
| 145 |
}; |
| 146 |
($groups{$item}->{is_chi}) and do { |
| 147 |
$header{bkg} -> configure(-foreground=>$grey, -font=>$h_font); |
| 148 |
$header{bkg_secondary} -> configure(-foreground=>$grey, -font=>$h_font); |
| 149 |
$header{fft} -> configure(-foreground=>($groups{$item}->{update_fft}) ? $cyan : $blue, -font=>$h_font); |
| 150 |
$header{bft} -> configure(-foreground=>($groups{$item}->{update_bft}) ? $cyan : $blue, -font=>$h_font); |
| 151 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'disabled')} (keys %grab); |
| 152 |
map {$grab{$_} -> configure(-state=>'normal')} (qw/fft_kmin fft_kmax bft_rmin bft_rmax/); |
| 153 |
map {$b_red{$_} -> configure(-state=>'disabled')} (qw(E)); |
| 154 |
map {$file_menu -> menu -> entryconfigure($_, -state=>'disabled')} ($sep+1 .. $sep+2); |
| 155 |
$data_menu -> menu -> entryconfigure(9, -state=>'normal'); # Self Absorption |
| 156 |
last SWITCH; |
| 157 |
}; |
| 158 |
($groups{$item}->{is_rsp}) and do { |
| 159 |
$header{bkg} -> configure(-foreground=>$grey, -font=>$h_font); |
| 160 |
$header{bkg_secondary} -> configure(-foreground=>$grey, -font=>$h_font); |
| 161 |
$header{fft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 162 |
$header{bft} -> configure(-foreground=>($groups{$item}->{update_bft}) ? $cyan : $blue, -font=>$h_font); |
| 163 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'disabled')} (keys %grab); |
| 164 |
map {$grab{$_} -> configure(-state=>'normal')} (qw/bft_rmin bft_rmax/); |
| 165 |
map {$b_red{$_} -> configure(-state=>'disabled')} (qw(E k kq)); |
| 166 |
map {$file_menu -> menu -> entryconfigure($_, -state=>'disabled')} ($sep+1 .. $sep+3); |
| 167 |
last SWITCH; |
| 168 |
}; |
| 169 |
($groups{$item}->{is_qsp}) and do { |
| 170 |
$header{bkg} -> configure(-foreground=>$grey, -font=>$h_font); |
| 171 |
$header{bkg_secondary} -> configure(-foreground=>$grey, -font=>$h_font); |
| 172 |
$header{fft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 173 |
$header{bft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 174 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'disabled')} (keys %grab); |
| 175 |
map {$b_red{$_} -> configure(-state=>'disabled')} (qw(E k R kq)); |
| 176 |
map {$file_menu -> menu -> entryconfigure($_, -state=>'disabled')} ($sep+1 .. $sep+4); |
| 177 |
last SWITCH; |
| 178 |
}; |
| 179 |
($groups{$item}->{not_data}) and do { |
| 180 |
$header{bkg} -> configure(-foreground=>$grey, -font=>$h_font); |
| 181 |
$header{bkg_secondary} -> configure(-foreground=>$grey, -font=>$h_font); |
| 182 |
$header{fft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 183 |
$header{bft} -> configure(-foreground=>$grey, -font=>$h_font); |
| 184 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'disabled')} (keys %grab); |
| 185 |
map {$b_red{$_} -> configure(-state=>'disabled')} (qw(k R q kq)); |
| 186 |
map {$file_menu -> menu -> entryconfigure($_, -state=>'disabled')} ($sep+2 .. $sep+5); |
| 187 |
last SWITCH; |
| 188 |
}; |
| 189 |
}; |
| 190 |
if (not $groups{$item}->{is_xmu}) { |
| 191 |
$widget{"bkg_$_"} -> configure(-state=>'disabled') |
| 192 |
foreach (qw(alg fixstep flatten fnorm nnorm1 nnorm2 nnorm3)); |
| 193 |
} else { |
| 194 |
$widget{"bkg_$_"} -> configure(-state=>'normal') |
| 195 |
foreach (qw(fixstep flatten fnorm nnorm1 nnorm2 nnorm3)); |
| 196 |
$widget{bkg_step} -> configure(-foreground => $config{colors}{foreground}); |
| 197 |
}; |
| 198 |
$widget{fft_pc} -> configure(-state=>'normal'); |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
foreach my $x ($groups{$item} -> Keys) { |
| 203 |
next if (($x eq "file") or ($x eq "line")); |
| 204 |
next if ($x eq "fft_edge"); |
| 205 |
next if (($x eq "bkg_z") or ($x eq "fft_edge")); |
| 206 |
next if ($x eq "bkg_nclamp"); |
| 207 |
next if ($x eq "bkg_fitted_step"); |
| 208 |
next if ($x eq "bkg_stan_lab"); |
| 209 |
|
| 210 |
## treat BrowsEntry widgets specially |
| 211 |
my $normal = (ref($widget{$x}) =~ m{BrowseEntry}) ? 'readonly' : 'normal'; |
| 212 |
|
| 213 |
if ($x eq "bkg_cl") { |
| 214 |
if ($groups{$item}->{is_diff}) { |
| 215 |
$widget{bkg_alg} -> configure(-state=>'disabled'); |
| 216 |
#$widget{z} -> configure(-state=>'disabled'); |
| 217 |
} elsif ($groups{$item}->{is_xmu}) { |
| 218 |
$widget{bkg_alg} -> configure(-state=>$normal); |
| 219 |
$menus{bkg_alg} = ($groups{$item}->{bkg_cl}) ? 'CLnorm' : 'Autobk'; |
| 220 |
#$widget{z} -> |
| 221 |
# configure(-state => ($menus{bkg_alg} eq 'CLnorm') ? $normal : 'disabled'); |
| 222 |
} else { |
| 223 |
$widget{bkg_alg} -> configure(-state=>'disabled'); |
| 224 |
}; |
| 225 |
# } elsif ($x eq "bkg_z") { |
| 226 |
# $widget{z} -> configure(-validate=>'none'); |
| 227 |
# $menus{bkg_z} = $groups{$item}->{bkg_z}; |
| 228 |
# $widget{z} -> configure(-validate=>'focusout'); |
| 229 |
} else { |
| 230 |
#($x eq 'bkg_step') and print "bkg_step\n"; |
| 231 |
$widget{$x} -> configure(-state=>$normal); |
| 232 |
if ($widget{$x} =~ /Entry/) { |
| 233 |
$widget{$x} -> configure(-validate=>'none'); |
| 234 |
$widget{$x} -> delete(qw/0 end/); |
| 235 |
$widget{$x} -> insert(0, $groups{$item}->{$x}); |
| 236 |
$widget{$x} -> configure(-validate=>'key'); |
| 237 |
} elsif ($widget{$x} =~ /Optionmenu/) { |
| 238 |
$menus{$x} = $groups{$item}->{$x}; |
| 239 |
} elsif ($widget{$x} =~ /Check/) { |
| 240 |
$menus{$x} = $groups{$item}->{$x}; |
| 241 |
}; |
| 242 |
}; |
| 243 |
next unless (Exists($widget{$x})); |
| 244 |
$widget{$x} -> configure(-state=>$normal), next if ($x =~ /^plot/); |
| 245 |
## disable widgets in the fields according to data type |
| 246 |
SWITCH: { |
| 247 |
($groups{$item}->{is_xanes}) and do { |
| 248 |
if (($x =~ /^bkg/) or ($x eq "importance")) { |
| 249 |
$widget{$x} -> configure(-state=>$normal); |
| 250 |
$widget{$x} -> configure(-foreground=>$black); |
| 251 |
} else { |
| 252 |
$widget{$x} -> configure(-state=>'disable'); |
| 253 |
$widget{$x} -> configure(-foreground=>$grey); |
| 254 |
}; |
| 255 |
$widget{$x} -> configure(-state=>'disable') |
| 256 |
if ($x =~ /(clamp[12]|kw|rbkg|spl[12]e?|stan)/); |
| 257 |
last SWITCH; |
| 258 |
}; |
| 259 |
($groups{$item}->{is_xmu}) and do { |
| 260 |
$widget{$x} -> configure(-state=>$normal); |
| 261 |
if ($groups{$item}->{bkg_cl}) { |
| 262 |
if ($x =~ /^bkg_spl/) { |
| 263 |
$widget{$x} -> configure(-state=>'disabled'); |
| 264 |
$grab{$x} -> configure(-state=>'disabled'); |
| 265 |
}; |
| 266 |
}; |
| 267 |
$widget{$x} -> configure(-foreground=>$black) unless (ref($widget{$x}) =~ /NumEntry/); |
| 268 |
if ($groups{$item}->{is_nor}) { |
| 269 |
if ($x =~ /bkg_(pre[12]|nor[12])/) { |
| 270 |
$widget{$x} -> configure(-state=>'disabled', -foreground=>$grey); |
| 271 |
$grab{$x} -> configure(-state=>'disabled'); |
| 272 |
}; |
| 273 |
#if ($x =~ /bkg_f(ixstep|latten)/) { |
| 274 |
if ($x =~ /bkg_fixstep/) { |
| 275 |
$widget{$x} -> configure(-state=>'disabled', -foreground=>$grey); |
| 276 |
}; |
| 277 |
}; |
| 278 |
last SWITCH; |
| 279 |
}; |
| 280 |
($groups{$item}->{is_chi}) and do { |
| 281 |
if ($x =~ /^bkg/) { |
| 282 |
$widget{$x} -> configure(-state=>'disabled'); |
| 283 |
$widget{$x} -> configure(-foreground=>$grey); |
| 284 |
} else { |
| 285 |
$widget{$x} -> configure(-state=>$normal); |
| 286 |
$widget{$x} -> configure(-foreground=>$black); |
| 287 |
}; |
| 288 |
last SWITCH; |
| 289 |
}; |
| 290 |
($groups{$item}->{is_rsp}) and do { |
| 291 |
if ($x =~ /^(bkg|fft)/) { |
| 292 |
$widget{$x} -> configure(-state=>'disabled'); |
| 293 |
$widget{$x} -> configure(-foreground=>$grey); |
| 294 |
} else { |
| 295 |
$widget{$x} -> configure(-state=>$normal); |
| 296 |
$widget{$x} -> configure(-foreground=>$black); |
| 297 |
}; |
| 298 |
last SWITCH; |
| 299 |
}; |
| 300 |
($groups{$item}->{is_qsp}) and do { |
| 301 |
$widget{$x} -> configure(-state=>'disabled'); |
| 302 |
$widget{$x} -> configure(-foreground=>$grey); |
| 303 |
last SWITCH; |
| 304 |
}; |
| 305 |
($groups{$item}->{not_data}) and do { |
| 306 |
$widget{$x} -> configure(-state=>'disabled'); |
| 307 |
$widget{$x} -> configure(-foreground=>$grey); |
| 308 |
last SWITCH; |
| 309 |
}; |
| 310 |
}; |
| 311 |
}; |
| 312 |
|
| 313 |
if ($groups{$item}->{frozen}) { |
| 314 |
$widget{"bkg_$_"} -> configure(-state=>'disabled') |
| 315 |
foreach (qw(fixstep flatten fnorm nnorm1 nnorm2 nnorm3 step stan)); |
| 316 |
$widget{fft_pc} -> configure(-state=>'disabled'); |
| 317 |
map {($_ =~ /^($grabskip)/) or $grab{$_} -> configure(-state=>'disabled')} (keys %grab); |
| 318 |
}; |
| 319 |
map {$values_menubutton -> menu -> entryconfigure($_, -state=>$groups{$item}->{frozen} ? 'disabled' : 'normal')} |
| 320 |
(3, 10); |
| 321 |
|
| 322 |
|
| 323 |
## set various buttons |
| 324 |
foreach (qw(fixstep flatten fnorm nnorm tie_e0)) { |
| 325 |
$menus{"bkg_$_"} = $groups{$item}->{"bkg_$_"}; |
| 326 |
}; |
| 327 |
## disable these until it's all working |
| 328 |
$widget{"bkg_fnorm"} -> configure(-state=>'disabled'); |
| 329 |
|
| 330 |
|
| 331 |
## mark eshift if this is a reference or a group with a reference |
| 332 |
my ($red, $bold, $normal) = ($config{colors}{button}, $config{fonts}{entrybold}, $config{fonts}{entry}); |
| 333 |
if ($groups{$item}->{reference}) { |
| 334 |
$widget{bkg_eshift} -> configure(-foreground => $red, |
| 335 |
-font => $bold,) |
| 336 |
} else { |
| 337 |
$widget{bkg_eshift} -> configure(-foreground => $black, |
| 338 |
-font => $normal,) |
| 339 |
}; |
| 340 |
|
| 341 |
## set up the Standard optionmenu -- the list may have changed recently... |
| 342 |
## (commented out stuff is from Optionmenu, tidy up when stable) |
| 343 |
if (($groups{$item}->{bkg_stan} ne 'None') |
| 344 |
and (exists $groups{$groups{$item}->{bkg_stan}})) { |
| 345 |
## $menus{bkg_stan} = $groups{$groups{$item}->{bkg_stan}}->{label}; |
| 346 |
$groups{$groups{$item}->{bkg_stan}}->dispatch_bkg($dmode) if |
| 347 |
$groups{$groups{$item}->{bkg_stan}}->{update_bkg}; |
| 348 |
} else { |
| 349 |
$menus{bkg_stan} = 'None'; |
| 350 |
$menus{bkg_stan_lab} = '0: None'; |
| 351 |
$groups{$item}->make(bkg_stan=>'None', |
| 352 |
bkg_stan_lab=>'0: None'); |
| 353 |
}; |
| 354 |
|
| 355 |
$widget{bkg_stan} -> delete(0, 'end'); |
| 356 |
$widget{bkg_stan} -> insert("end", "0: None"); |
| 357 |
my @list = ('None'); |
| 358 |
my $i = 1; |
| 359 |
foreach my $x (&sorted_group_list) { |
| 360 |
next if ($x eq $current); |
| 361 |
next unless (($groups{$x}->{is_xmu}) or ($groups{$x}->{is_chi})); |
| 362 |
push @list, $x; |
| 363 |
$widget{bkg_stan} -> insert("end", "$i: $groups{$x}->{label}"); |
| 364 |
my $label = $groups{$groups{$item}->{bkg_stan}}->{label}; |
| 365 |
if ($groups{$item}->{bkg_stan} eq $x) { |
| 366 |
$menus{bkg_stan_lab} = "$i: $label"; |
| 367 |
$groups{$item} -> make(bkg_stan_lab => "$i: $label"); |
| 368 |
}; |
| 369 |
++$i; |
| 370 |
}; |
| 371 |
$menus{keys} = [@list]; |
| 372 |
|
| 373 |
## is this group a merge? |
| 374 |
$plot_menu -> menu -> entryconfigure(5, -state=>($groups{$item}->{is_merge}) ? 'normal' : 'disabled'); |
| 375 |
$plot_menu -> menu -> entryconfigure(6, -state=>($groups{$item}->{i0}) ? 'normal' : 'disabled'); |
| 376 |
$plot_menu -> menu -> entryconfigure(7, -state=>($groups{$item}->{i0}) ? 'normal' : 'disabled'); |
| 377 |
## can chi(E) be plotted? |
| 378 |
my $ok = ($groups{$item}->{is_xmu} or $groups{$item}->{is_nor} or |
| 379 |
$groups{$item}->{is_chi}); |
| 380 |
#$plot_menu -> menu -> entryconfigure(9, -state=> $ok ? 'normal' : 'disabled'); |
| 381 |
#$plot_menu -> menu -> entryconfigure(10, -state=> 'normal'); |
| 382 |
## is this an xmu group? If so enable thingies to make detector |
| 383 |
## groups and background group |
| 384 |
$ok = ($groups{$item}->{is_xmu} and $groups{$item}->{denominator} |
| 385 |
and (not $groups{$item}->{is_proj})); |
| 386 |
my $ind = 5; #($group_menubutton -> children())[0] -> index('detector'); |
| 387 |
$group_menubutton -> menu -> |
| 388 |
entryconfigure($ind, -state=> $ok ? 'normal' : 'disabled'); |
| 389 |
$group_menubutton -> menu -> |
| 390 |
entryconfigure($ind+1, -state=> $groups{$item}->{is_xmu} ? 'normal' : 'disabled'); |
| 391 |
|
| 392 |
my $is_energy = not ($groups{$item}->{is_chi} or $groups{$item}->{is_rsp} or $groups{$item}->{is_qsp}); |
| 393 |
$group_menubutton -> menu -> |
| 394 |
entryconfigure(8, -state=> $is_energy ? 'normal' : 'disabled'); |
| 395 |
|
| 396 |
## phase correction parameters (a checkbutton and two menus) |
| 397 |
$menus{bkg_z} = $groups{$item}->{bkg_z}; |
| 398 |
$menus{fft_pc} = $groups{$item}->{fft_pc}; |
| 399 |
$menus{fft_edge} = $groups{$item}->{fft_edge}; |
| 400 |
#$widget{z} -> configure(-state=>($menus{fft_pc} eq 'on') ? 'normal' : 'disabled'); |
| 401 |
#$widget{edge} -> configure(-state=>($menus{fft_pc} eq 'on') ? 'normal' : 'disabled'); |
| 402 |
|
| 403 |
## deal with various parameters if something other than the normal |
| 404 |
## display is present |
| 405 |
FAT: { |
| 406 |
($saving) and do { |
| 407 |
1; # do nothing more |
| 408 |
last FAT; |
| 409 |
}; |
| 410 |
|
| 411 |
($fat_showing eq 'peakfit') and do { |
| 412 |
$widget{peak_group} -> configure(-text=>$groups{$item}->{label}); |
| 413 |
$widget{peak_save} -> configure(-state=>'disabled'); |
| 414 |
$widget{peak_log} -> configure(-state=>'disabled'); |
| 415 |
## need to worry about non-xmu groups being selected |
| 416 |
unless ($groups{$item}->{is_xmu}) { |
| 417 |
if ($groups{$item}->{not_data}) { |
| 418 |
$groups{$item}->plotE('em', $dmode, \%plot_features, \@indicator); |
| 419 |
} else { |
| 420 |
Error("$groups{$item}->{label} cannot be plotted in energy."); |
| 421 |
}; |
| 422 |
last FAT |
| 423 |
}; |
| 424 |
my $r_peaks = $$hash_pointer{peaks}; |
| 425 |
$groups{$item}->{update_bkg} and $groups{$item}->dispatch_bkg($dmode); |
| 426 |
$groups{$item}->{peak} and peak_fill_variables($item, $hash_pointer, $r_peaks); |
| 427 |
$groups{$item}->plotE('emn', $dmode, \%plot_features, \@indicator); |
| 428 |
my ($emin, $emax) = ($$hash_pointer{enot}+$$hash_pointer{emin}, |
| 429 |
$$hash_pointer{enot}+$$hash_pointer{emax}); |
| 430 |
$groups{$item}->plot_vertical_line($emin, 0, $$hash_pointer{ymax}, |
| 431 |
$dmode, "fit range", $groups{$item}->{plot_yoffset}); |
| 432 |
$groups{$item}->plot_vertical_line($emax, 0, $$hash_pointer{ymax}, |
| 433 |
$dmode, "", $groups{$item}->{plot_yoffset}); |
| 434 |
$last_plot='e'; |
| 435 |
last FAT; |
| 436 |
}; |
| 437 |
|
| 438 |
($fat_showing eq 'lograt') and do { |
| 439 |
$widget{lr_unknown} -> configure(-text=>$groups{$item}->{label}); |
| 440 |
## it is possible that the groups list has changed of late, so update |
| 441 |
## the lists of standards |
| 442 |
my @keys = (); |
| 443 |
foreach my $k (&sorted_group_list) { |
| 444 |
($groups{$k}->{is_xmu} or $groups{$k}->{is_chi}) and push @keys, $k; |
| 445 |
}; |
| 446 |
$widget{lr_menu} -> delete(0, 'end'); |
| 447 |
my $i = 1; |
| 448 |
foreach my $s (@keys) { |
| 449 |
$widget{lr_menu} -> insert("end", "$i: $groups{$s}->{label}"); |
| 450 |
++$i; |
| 451 |
}; |
| 452 |
|
| 453 |
|
| 454 |
## need to worry about non-xmu/chi groups being selected |
| 455 |
&reset_lr_data($hash_pointer, $$hash_pointer{standard}, $current) |
| 456 |
if ($groups{$current}->{is_xmu} or $groups{$current}->{is_chi}); |
| 457 |
last FAT; |
| 458 |
}; |
| 459 |
|
| 460 |
($fat_showing eq 'calibrate') and do { |
| 461 |
$widget{cal_group} -> configure(-text=>$groups{$item}->{label}); |
| 462 |
## need to worry about non-xmu groups being selected |
| 463 |
$groups{$current} -> dispose("set $current.deriv = deriv($current.xmu)/deriv($current.energy)\n", $dmode); |
| 464 |
($groups{$current}->{bkg_z}, $groups{$current}->{fft_edge}) |
| 465 |
= find_edge($groups{$current}->{bkg_e0}); |
| 466 |
$$hash_pointer{cal_to} = Xray::Absorption->get_energy($groups{$current}->{bkg_z}, |
| 467 |
$groups{$current}->{fft_edge}); |
| 468 |
$$hash_pointer{e0} = $groups{$current}->{bkg_e0}; |
| 469 |
## plot this group |
| 470 |
$plot_features{suppress_markers} = 1; |
| 471 |
$groups{$current}->plotE($$hash_pointer{str}, $dmode, \%plot_features, \@indicator); |
| 472 |
$plot_features{suppress_markers} = 0; |
| 473 |
&cal_marker($current, $$hash_pointer{e0}, $$hash_pointer{str}); |
| 474 |
last FAT; |
| 475 |
}; |
| 476 |
|
| 477 |
($fat_showing eq 'align') and do { |
| 478 |
## need check for non-xmu data and for (standard->{ref} eq current) |
| 479 |
$widget{align_unknown} -> configure(-text=>$groups{$item}->{label}); |
| 480 |
##$widget{align_other_label} -> configure(-text=>"Shift \"$groups{$current}->{label}\" by "); |
| 481 |
$widget{align_other_label} -> configure(-text=>"Shift by "); |
| 482 |
$widget{align_result} -> delete(qw(0 end)); |
| 483 |
$widget{align_result} -> insert('end', $groups{$current}->{bkg_eshift}); |
| 484 |
$$hash_pointer{shift} = $groups{$current}->{bkg_eshift}; |
| 485 |
$$hash_pointer{prior_shift} = $groups{$current}->{bkg_eshift}; |
| 486 |
|
| 487 |
## it is possible that the groups list has changed of late, so update |
| 488 |
## the lists of standards |
| 489 |
my @keys = (); |
| 490 |
foreach my $k (&sorted_group_list) { |
| 491 |
$groups{$k}->{is_xmu} and push @keys, $k; |
| 492 |
}; |
| 493 |
$widget{align_menu} -> delete(0, 'end'); |
| 494 |
my $i = 1; |
| 495 |
foreach my $s (@keys) { |
| 496 |
$widget{align_menu} -> insert("end", "$i: $groups{$s}->{label}"); |
| 497 |
++$i; |
| 498 |
}; |
| 499 |
|
| 500 |
&do_eshift($hash_pointer, $current); |
| 501 |
last FAT; |
| 502 |
}; |
| 503 |
|
| 504 |
($fat_showing eq 'pixel') and do { |
| 505 |
$widget{pixel_unknown} -> configure(-text=>$groups{$item}->{label}); |
| 506 |
if ($groups{$item}->{is_pixel}) { |
| 507 |
map {$widget{"pixel_".$_}->configure(-state=>'normal')} |
| 508 |
(qw(refine replot make offset constrain linear linear_button quad)); |
| 509 |
} else { |
| 510 |
map {$widget{"pixel_".$_}->configure(-state=>'disabled')} |
| 511 |
(qw(refine replot make offset constrain linear linear_button quad)); |
| 512 |
}; |
| 513 |
## $widget{pixel_make} -> configure(-state=>'disabled'); |
| 514 |
&pixel_setup($hash_pointer) if $groups{$item}->{is_pixel}; |
| 515 |
last FAT; |
| 516 |
}; |
| 517 |
|
| 518 |
($fat_showing eq 'truncate') and do { |
| 519 |
$widget{trun_group} -> configure(-text=>$groups{$item}->{label}); |
| 520 |
$groups{$item} -> make(etruncate=>$widget{etruncate}->get()); |
| 521 |
## need to worry about non-xmu groups being selected |
| 522 |
$groups{$item} -> plotE('em',$dmode,\%plot_features, \@indicator); |
| 523 |
$last_plot = 'e'; |
| 524 |
my $e = $groups{$item}->{etruncate}; |
| 525 |
$groups{$item} -> dispose("set(___f = floor($item.xmu), ___c = ceil($item.xmu))\n", 1); |
| 526 |
my $ymin = Ifeffit::get_scalar("___f"); |
| 527 |
my $ymax = Ifeffit::get_scalar("___c"); |
| 528 |
$groups{$item} -> plot_vertical_line($e, $ymin, $ymax, $dmode, |
| 529 |
"truncate", $groups{$item}->{plot_yoffset}); |
| 530 |
last FAT; |
| 531 |
}; |
| 532 |
|
| 533 |
($fat_showing eq 'rebin') and do { |
| 534 |
$widget{rb_group} -> configure(-text=>$groups{$item}->{label}); |
| 535 |
$$hash_pointer{abs} = $groups{$item}->{bkg_z}; |
| 536 |
$$hash_pointer{edge} = $groups{$item}->{bkg_e0}; |
| 537 |
$widget{rb_plot}->configure(-state=>($groups{$item}->{is_xmu}) ? 'normal' : 'disabled'); |
| 538 |
$widget{rb_save}->configure(-state=>'disabled'); |
| 539 |
$groups{$item} -> plotE('em',$dmode,\%plot_features, \@indicator); |
| 540 |
last FAT; |
| 541 |
}; |
| 542 |
|
| 543 |
($fat_showing eq 'smooth') and do { |
| 544 |
$widget{sm_group} -> configure(-text=>$groups{$item}->{label}); |
| 545 |
$groups{$item}->dispose("erase $item.smoothed", $dmode); |
| 546 |
$widget{sm_save}->configure(-state=>'disabled'); |
| 547 |
$groups{$item} -> plotE('em',$dmode,\%plot_features, \@indicator); |
| 548 |
last FAT; |
| 549 |
}; |
| 550 |
|
| 551 |
($fat_showing eq 'convolve') and do { |
| 552 |
$$hash_pointer{current} = $groups{$current}->{label}; |
| 553 |
$widget{conv_group}->configure(-state=>'disabled'); |
| 554 |
$groups{$item}->plotE('emn', $dmode, \%plot_features, \@indicator); |
| 555 |
last FAT; |
| 556 |
}; |
| 557 |
|
| 558 |
($fat_showing eq 'diff') and do { |
| 559 |
$widget{diff_unknown} -> configure(-text=>$groups{$item}->{label}); |
| 560 |
## need to worry about selected group not being plottable in the |
| 561 |
## difference space |
| 562 |
Error("Difference plot aborted: You cannot select the same data group twice!"), |
| 563 |
return if ($$hash_pointer{standard} eq $current); |
| 564 |
$$hash_pointer{integral} = ""; |
| 565 |
my $dfg = $config{colors}{disabledforeground}; |
| 566 |
$$hash_pointer{diff_integral_label} -> configure(-foreground=>$dfg); |
| 567 |
my $state = 'normal'; |
| 568 |
my @keys = (); |
| 569 |
my @allkeys = (&sorted_group_list); |
| 570 |
SWITCH: { |
| 571 |
($groups{$item}->{is_diff}) and do { |
| 572 |
$state = 'disabled'; |
| 573 |
last SWITCH; |
| 574 |
}; |
| 575 |
($$hash_pointer{space} =~ /[en]/) and do { |
| 576 |
($state = 'disabled') unless $groups{$item}->{is_xmu}; |
| 577 |
foreach my $k (@allkeys) { |
| 578 |
($groups{$k}->{is_xmu}) and push @keys, $k; |
| 579 |
}; |
| 580 |
last SWITCH; |
| 581 |
}; |
| 582 |
($$hash_pointer{space} eq 'k') and do { |
| 583 |
($state = 'disabled') unless ($groups{$item}->{is_xmu} or $groups{$item}->{is_chi}); |
| 584 |
foreach my $k (@allkeys) { |
| 585 |
($groups{$k}->{is_xmu} or $groups{$k}->{is_chi}) and push @keys, $k; |
| 586 |
}; |
| 587 |
last SWITCH; |
| 588 |
}; |
| 589 |
($$hash_pointer{space} eq 'r') and do { |
| 590 |
foreach my $k (@allkeys) { |
| 591 |
($groups{$k}->{is_qsp}) or push @keys, $k; |
| 592 |
}; |
| 593 |
($state = 'disabled') if $groups{$item}->{is_qsp}; |
| 594 |
last SWITCH; |
| 595 |
}; |
| 596 |
($$hash_pointer{space} eq 'q') and do { |
| 597 |
foreach my $k (@allkeys) { |
| 598 |
($groups{$k}->{not_data}) or push @keys, $k; |
| 599 |
}; |
| 600 |
last SWITCH; |
| 601 |
}; |
| 602 |
}; |
| 603 |
map { $widget{'diff_'.$_} -> configure(-state=>$state) } |
| 604 |
(qw(savemarkedi savemarked save replot xmin xmax)); |
| 605 |
map { $grab{'diff_'.$_} -> configure(-state=>$state) } |
| 606 |
(qw(xmin xmax)); |
| 607 |
|
| 608 |
## it is possible that the groups list has changed of late, so update |
| 609 |
## the lists of standards |
| 610 |
$widget{diff_menu} -> delete(0, 'end'); |
| 611 |
my $i = 1; |
| 612 |
foreach my $s (@keys) { |
| 613 |
$widget{diff_menu} -> insert("end", "$i: $groups{$s}->{label}"); |
| 614 |
++$i; |
| 615 |
}; |
| 616 |
|
| 617 |
if ($state eq 'normal') { |
| 618 |
my $ok = $groups{$$hash_pointer{standard}} -> |
| 619 |
plot_difference($groups{$current}, $hash_pointer, $dmode, \%plot_features); |
| 620 |
$last_plot=$$hash_pointer{space} if $ok; |
| 621 |
}; |
| 622 |
last FAT; |
| 623 |
}; |
| 624 |
|
| 625 |
($fat_showing eq 'deglitch') and do { |
| 626 |
$widget{deg_group} -> configure(-text=>$groups{$item}->{label}); |
| 627 |
## worry about non-xmu groups |
| 628 |
$$hash_pointer{standard} = $current; |
| 629 |
set_deglitch_params($hash_pointer); |
| 630 |
if ($$hash_pointer{space} eq 'emg') { |
| 631 |
$groups{$current} -> plotE('emg',$dmode,\%plot_features, \@indicator); |
| 632 |
} else { |
| 633 |
&plot_chie($current); |
| 634 |
}; |
| 635 |
$last_plot = 'e'; |
| 636 |
last FAT; |
| 637 |
}; |
| 638 |
|
| 639 |
($fat_showing eq 'lcf') and do { |
| 640 |
$widget{lcf_unknown} -> configure(-text=>$groups{$item}->{label}); |
| 641 |
$widget{lcf_operations} -> entryconfigure(4, -state=>'disabled', -style=>$$hash_pointer{disabled_style}); |
| 642 |
$widget{lcf_operations} -> entryconfigure(8, -state=>'disabled', -style=>$$hash_pointer{disabled_style}); |
| 643 |
if ($groups{$item}->{is_chi} and ($$hash_pointer{fitspace} ne 'k')) { |
| 644 |
$groups{$item}->MAKE("lcf_fitspace" => 'k'); |
| 645 |
}; |
| 646 |
if ($groups{$item}->{is_xanes} and ($$hash_pointer{fitspace} eq 'k')) { |
| 647 |
$groups{$item}->MAKE("lcf_fitspace" => 'e'); |
| 648 |
}; |
| 649 |
|
| 650 |
## need to initialize these for a group that doesn't have them |
| 651 |
$groups{$item}->{lcf_fitspace} ||= $config{linearcombo}{fitspace}; |
| 652 |
$groups{$item}->{lcf_fitmin_k} ||= $config{linearcombo}{fitmin_k}; |
| 653 |
$groups{$item}->{lcf_fitmax_k} ||= $config{linearcombo}{fitmax_k}; |
| 654 |
$groups{$item}->{lcf_fitmin_e} ||= $config{linearcombo}{fitmin}; |
| 655 |
$groups{$item}->{lcf_fitmax_e} ||= $config{linearcombo}{fitmax}; |
| 656 |
if ($groups{$item}->{lcf_fitspace} eq 'k') { |
| 657 |
$groups{$item}->{lcf_fitmin} = $groups{$item}->{lcf_fitmin_k}; |
| 658 |
$groups{$item}->{lcf_fitmax} = $groups{$item}->{lcf_fitmax_k}; |
| 659 |
} else { |
| 660 |
$groups{$item}->{lcf_fitmin} = $groups{$item}->{lcf_fitmin_e}; |
| 661 |
$groups{$item}->{lcf_fitmax} = $groups{$item}->{lcf_fitmax_e}; |
| 662 |
}; |
| 663 |
## make sure these display correctly and are correctly stored in the |
| 664 |
## parameters hash |
| 665 |
foreach (qw(fitmin fitmax)) { |
| 666 |
my $key = "lcf_" . $_; |
| 667 |
$widget{$key} -> configure(-validate=>"none"); |
| 668 |
$widget{$key} -> delete(0, 'end'); |
| 669 |
$widget{$key} -> insert(0, $groups{$item}->{$key}); |
| 670 |
$widget{$key} -> configure(-validate=>"key"); |
| 671 |
$$hash_pointer{$_} = $groups{$item}->{$key}; |
| 672 |
}; |
| 673 |
|
| 674 |
unless ($groups{$item}->{is_xmu}) { |
| 675 |
$widget{lcf_fit} -> configure(-state=>'disabled'); |
| 676 |
last FAT; |
| 677 |
}; |
| 678 |
$$hash_pointer{fitspace} = $groups{$item}->{"lcf_fitspace"} || $$hash_pointer{fitspace}; |
| 679 |
$$hash_pointer{linear} = $groups{$item}->{"lcf_linear"} || $$hash_pointer{linear}; |
| 680 |
$$hash_pointer{nonneg} = $groups{$item}->{"lcf_nonneg"} || $$hash_pointer{nonneg}; |
| 681 |
$$hash_pointer{100} = $groups{$item}->{"lcf_100"} || $$hash_pointer{100}; |
| 682 |
$$hash_pointer{e0all} = $groups{$item}->{"lcf_e0all"} || $$hash_pointer{e0all}; |
| 683 |
|
| 684 |
## it is possible that the groups list has changed of late, so update |
| 685 |
## the lists of standards |
| 686 |
my @keys = ('None'); |
| 687 |
foreach my $k (&sorted_group_list) { |
| 688 |
($groups{$k}->{is_xmu} or $groups{$k}->{is_chi}) and push @keys, $k; |
| 689 |
}; |
| 690 |
$$hash_pointer{keys} = \@keys; |
| 691 |
## when switching groups, use the standards associated with the |
| 692 |
## group, if available, else use the standards already in the |
| 693 |
## table |
| 694 |
if (exists $groups{$item}->{lcf_fit} and $groups{$item}->{lcf_fit}) { |
| 695 |
my $any_set = 0; |
| 696 |
foreach my $i (1 .. $config{linearcombo}{maxspectra}) { |
| 697 |
++$any_set if (exists($groups{$item}->{"lcf_standard$i"}) and ($groups{$item}->{"lcf_standard$i"} ne 'None')); |
| 698 |
}; |
| 699 |
foreach my $i (1 .. $config{linearcombo}{maxspectra}) { |
| 700 |
my $test = (exists($groups{$item}->{"lcf_standard$i"}) and ($groups{$item}->{"lcf_standard$i"} ne 'None')); |
| 701 |
$$hash_pointer{"standard$i"} = ($any_set) ? $groups{$item}->{"lcf_standard$i"} : $$hash_pointer{"standard$i"}; |
| 702 |
$$hash_pointer{"standard$i"} = "None" unless defined $$hash_pointer{"standard$i"}; |
| 703 |
$$hash_pointer{"e0$i"} = ($any_set) ? $groups{$item}->{"lcf_e0$i"} : $$hash_pointer{"e0$i"}; |
| 704 |
$$hash_pointer{"e0val$i"} = ($any_set) ? $groups{$item}->{"lcf_e0val$i"} : $$hash_pointer{"e0val$i"}; |
| 705 |
$$hash_pointer{"value$i"} = ($any_set) ? $groups{$item}->{"lcf_value$i"} : $$hash_pointer{"value$i"}; |
| 706 |
|
| 707 |
$widget{"lcf_standard_list$i"} -> delete(0, "end"); |
| 708 |
$widget{"lcf_standard_list$i"} -> insert("end", "0: None"); |
| 709 |
my $j = 1; |
| 710 |
foreach my $s (@keys) { |
| 711 |
next if ($s eq 'None'); |
| 712 |
$groups{$s}->MAKE(lcf_menu_label => "$j: $groups{$s}->{label}"); |
| 713 |
$widget{"lcf_standard_list$i"} -> insert("end", "$j: $groups{$s}->{label}"); |
| 714 |
++$j; |
| 715 |
}; |
| 716 |
if (not exists $groups{$item}->{"lcf_standard$i"}) { |
| 717 |
$$hash_pointer{"standard_lab$i"} = "0: None"; |
| 718 |
} elsif ($groups{$item}->{"lcf_standard$i"} eq 'None') { |
| 719 |
$$hash_pointer{"standard_lab$i"} = "0: None"; |
| 720 |
} else { |
| 721 |
$$hash_pointer{"standard_lab$i"} = ($any_set) ? $groups{$groups{$item}->{"lcf_standard$i"}}->{lcf_menu_label} : $$hash_pointer{"standard_lab$i"}; |
| 722 |
}; |
| 723 |
## make sure menu labels are up to date |
| 724 |
#my $label = ""; |
| 725 |
#($label = $groups{$groups{$current}->{"lcf_standard$i"}}->{lcf_menu_label}) |
| 726 |
# if (exists $groups{$current}->{"lcf_standard$i"}); |
| 727 |
#$$hash_pointer{"standard_lab$i"} = $label || $$hash_pointer{"standard_lab$i"}; |
| 728 |
}; |
| 729 |
lcf_results($hash_pointer); |
| 730 |
$widget{lcf_operations} -> entryconfigure(4, -state=>'normal', -style=>$$hash_pointer{normal_style}); |
| 731 |
|
| 732 |
} else { |
| 733 |
$widget{lcf_text} -> delete('1.0', 'end'); |
| 734 |
}; |
| 735 |
|
| 736 |
$$hash_pointer{fitmin} = $groups{$item}->{lcf_fitmin}; |
| 737 |
$$hash_pointer{fitmax} = $groups{$item}->{lcf_fitmax}; |
| 738 |
if ($$hash_pointer{fitspace} eq 'k') { |
| 739 |
$widget{lcf_operations} -> entryconfigure(7, -state=>'normal', -style=>$$hash_pointer{normal_style}); |
| 740 |
lcf_quickplot_k($hash_pointer); |
| 741 |
} else { |
| 742 |
$widget{lcf_operations} -> entryconfigure(7, -state=>'disabled', -style=>$$hash_pointer{disabled_style}); |
| 743 |
lcf_quickplot_e($hash_pointer); |
| 744 |
}; |
| 745 |
my $how = ($groups{$item}->{lcf_fit}) ? 0 : 2; |
| 746 |
lcf_initialize($hash_pointer, $how); |
| 747 |
$widget{lcf_notebook} -> raise('standards') unless ($widget{lcf_notebook}->raised eq 'results'); |
| 748 |
## if (exists $lcf_data{$item}) { |
| 749 |
## $widget{lcf_notebook} -> pageconfigure('combinatorics', -state=>'normal'); |
| 750 |
## lcf_display(); |
| 751 |
## } else { |
| 752 |
## ## empty out both combinatorics tables |
| 753 |
## $widget{lcf_select_table}->delete('all'); |
| 754 |
## $widget{lcf_result_table}->delete('all'); |
| 755 |
## $widget{lcf_notebook} -> raise('standards'); |
| 756 |
## $widget{lcf_notebook} -> pageconfigure('combinatorics', -state=>'disabled'); |
| 757 |
## }; |
| 758 |
last FAT; |
| 759 |
}; |
| 760 |
|
| 761 |
($fat_showing eq 'sa') and do { |
| 762 |
$widget{safluo_group} -> configure(-text=>$groups{$item}->{label}); |
| 763 |
$widget{safluo_elem} -> configure(-text=>$groups{$item}->{bkg_z}); |
| 764 |
$widget{safluo_edge} -> configure(-text=>$groups{$item}->{fft_edge}); |
| 765 |
my $is_xmu = $groups{$item}->{is_xmu}; |
| 766 |
$widget{safluo_plot} -> configure(-state=>($is_xmu) ? 'normal' : 'disabled'); |
| 767 |
$widget{safluo_make} -> configure(-state=>'disabled'); |
| 768 |
$widget{safluo_fluo} -> configure(-state=>'normal'); |
| 769 |
unless ($is_xmu) { # deal with chi(k) record |
| 770 |
($$hash_pointer{algorithm} = "booth") if ($$hash_pointer{algorithm} eq 'fluo'); |
| 771 |
$widget{safluo_fluo} -> configure(-state=>'disabled'); |
| 772 |
}; |
| 773 |
foreach my $k (qw(formula angle_in angle_out thickness)) { |
| 774 |
$$hash_pointer{$k} = $groups{$item}->{"sa_$k"} if ((exists $groups{$item}->{"sa_$k"}) and |
| 775 |
($groups{$item}->{"sa_$k"} !~ /^\s*$/)); |
| 776 |
}; |
| 777 |
if ($$hash_pointer{algorithm} eq 'fluo') { |
| 778 |
$groups{$item}->plotE('emn', $dmode, \%plot_features, \@indicator) if $is_xmu; |
| 779 |
$last_plot = 'e'; |
| 780 |
$plotsel->raise('e') unless ($plotsel->raised() =~ /(Stack|Ind|PF)/); |
| 781 |
} elsif ($$hash_pointer{algorithm} =~ /atoms|booth|troger/) { |
| 782 |
my $str = 'k'.$plot_features{k_w}; |
| 783 |
$groups{$current} -> plotk($str, $dmode, \%plot_features, \@indicator); |
| 784 |
$last_plot='k'; |
| 785 |
$plotsel->raise('k') unless ($plotsel->raised() =~ /(Stack|Ind|PF)/); |
| 786 |
}; |
| 787 |
last FAT; |
| 788 |
}; |
| 789 |
|
| 790 |
($fat_showing eq 'mee') and do { |
| 791 |
my $is_xmu = $groups{$item}->{is_xmu}; |
| 792 |
map {$widget{"mee_$_"} -> configure(-state=>($is_xmu) ? 'normal' : 'disabled')} |
| 793 |
qw(store make e k r q); |
| 794 |
my $key = join("_", lc($groups{$item}->{bkg_z}), lc($groups{$item}->{fft_edge})); |
| 795 |
$$hash_pointer{shift} = $groups{$item}->{mee_en} || $mee_energies{energies}{$key} || 100; |
| 796 |
$$hash_pointer{width} = $groups{$item}->{mee_wi} || 10; |
| 797 |
$$hash_pointer{amp} = $groups{$item}->{mee_am} || 0.01; |
| 798 |
$$hash_pointer{key} = $key; |
| 799 |
$widget{mee_data} -> configure(-text=>$groups{$item}->{label}); |
| 800 |
last FAT; |
| 801 |
}; |
| 802 |
|
| 803 |
## this section is the demo section, add a new section for a new |
| 804 |
## analysis chore as appropriate |
| 805 |
($fat_showing eq 'demo') and do { |
| 806 |
## update the "unknown" with this label, if needed |
| 807 |
$widget{foobar_unknown} -> configure(-text=>$groups{$item}->{label}); |
| 808 |
## you may wish to fret about the standard and unknown being the |
| 809 |
## same group and do something sensible |
| 810 |
|
| 811 |
## set any other foobar_params as needed using |
| 812 |
## $$hash_pointer{whatever} = "whatever"; |
| 813 |
|
| 814 |
## do you need to make a plot? it is best to use a plotting |
| 815 |
## method and don't forget to set the $last_plot global variable |
| 816 |
## so the pluck buttons work correctly |
| 817 |
last FAT; |
| 818 |
}; |
| 819 |
|
| 820 |
($fat_showing eq 'series') and do { |
| 821 |
my $this = $$hash_pointer{param}; |
| 822 |
$$hash_pointer{group} = $current; |
| 823 |
$$hash_pointer{label} = $groups{$current}->{label}; |
| 824 |
$$hash_pointer{current} = sprintf("%.3f", $groups{$current}->{$this}); |
| 825 |
$$hash_pointer{begin} = sprintf("%.3f", $groups{$current}->{$this}); |
| 826 |
last FAT; |
| 827 |
}; |
| 828 |
|
| 829 |
($fat_showing eq 'teach_ft') and do { |
| 830 |
last FAT; |
| 831 |
}; |
| 832 |
|
| 833 |
## this is what is done if the normal view is showing. |
| 834 |
do { |
| 835 |
last FAT if ($config{general}{groupreplot} eq 'none'); |
| 836 |
plot_current_e() if ($config{general}{groupreplot} eq 'e'); |
| 837 |
plot_current_k() if ($config{general}{groupreplot} eq 'k'); |
| 838 |
plot_current_r() if ($config{general}{groupreplot} eq 'r'); |
| 839 |
plot_current_q() if ($config{general}{groupreplot} eq 'q'); # () |
| 840 |
last FAT; |
| 841 |
}; |
| 842 |
|
| 843 |
}; # end of non-normal display switch |
| 844 |
|
| 845 |
|
| 846 |
## and finally, put titles in the title display |
| 847 |
if ($prev and defined $groups{$prev}) { |
| 848 |
refresh_titles($groups{$prev}) unless (($prev eq 'Default Parameters') or |
| 849 |
($current eq 'Default Parameters')); |
| 850 |
}; |
| 851 |
$notes{titles} -> configure(-state=>'normal'); |
| 852 |
$notes{titles} -> delete(qw/1.0 end/); |
| 853 |
unless ($item eq "Default Parameters") { |
| 854 |
$groups{$item} -> get_titles; |
| 855 |
foreach (@{$groups{$item}->{titles}}) { |
| 856 |
$notes{titles} -> insert('end', $_."\n", "text"); |
| 857 |
}; |
| 858 |
}; |
| 859 |
|
| 860 |
sanity_check($item) if ((not $reading_project) and (not $saving) and ($fat_showing eq 'normal')); |
| 861 |
|
| 862 |
$top -> Unbusy unless $is_busy; |
| 863 |
return unless ($fat_showing eq 'normal'); |
| 864 |
($how == 1) or Echonow("displaying parameters for group \"$groups{$item}->{label}\" ... done."); |
| 865 |
}; |
| 866 |
|
| 867 |
sub sanity_check { |
| 868 |
my $item = shift; |
| 869 |
my $problems = $groups{$item}->sanity; |
| 870 |
if ($problems) { |
| 871 |
Error("Athena has found suspicious values for one or more parameters. Please check the indicated value."); |
| 872 |
my $d = $top->DialogBox(-title => "Athena: Suspicious parameter values!", |
| 873 |
-buttons => ["OK"], |
| 874 |
-popover => 'cursor'); |
| 875 |
my $r = $d -> add('ROText', |
| 876 |
-font=>$config{fonts}{fixed}, |
| 877 |
) |
| 878 |
-> pack(); |
| 879 |
$r -> tagConfigure("text", -font=>$config{fonts}{fixedsm}); |
| 880 |
$r -> insert('1.0', $problems, 'text'); |
| 881 |
$r -> insert('1.0', "The following problems were found for group \"$groups{$item}->{label}\"\n\n", 'text'); |
| 882 |
$r -> insert('end', "\nYou should fix these values before continuing analysis of these data.\n", 'text'); |
| 883 |
$d -> Show; |
| 884 |
#print $problems; |
| 885 |
return 1; |
| 886 |
}; |
| 887 |
return 0; |
| 888 |
}; |
| 889 |
|
| 890 |
|
| 891 |
## END OF SET PROPERTIES SUBSECTION |
| 892 |
########################################################################################## |