| 1 |
## -*- cperl -*- |
| 2 |
## |
| 3 |
## This file is part of Athena, copyright (c) 2001-2008 Bruce Ravel |
| 4 |
## |
| 5 |
## This section of the code contains miscellaneous subroutine which |
| 6 |
## do not fit in other sections |
| 7 |
|
| 8 |
|
| 9 |
sub BindMouseWheel { # Mastering Perl/Tk ch. 15, p. 370 |
| 10 |
my ($w) = @_; |
| 11 |
if ($^O eq 'MSWin32') { |
| 12 |
$w->bind('<MouseWheel>' => |
| 13 |
[ sub { $_[0]->yview('scroll', -($_[1]/120)*3, 'units') }, |
| 14 |
Ev('D') ] |
| 15 |
); |
| 16 |
} elsif ($^O eq 'linux') { |
| 17 |
## on linux the mousewheel works by mapping to buttons 4 and 5 |
| 18 |
$w->bind('<4>' => sub { $_[0]->yview('scroll', -1, 'units') unless $Tk::strictMotif; }); |
| 19 |
$w->bind('<5>' => sub { $_[0]->yview('scroll', +1, 'units') unless $Tk::strictMotif; }); |
| 20 |
}; |
| 21 |
}; |
| 22 |
|
| 23 |
|
| 24 |
## turn off the mouse wheel |
| 25 |
sub disable_mouse_wheel { |
| 26 |
my $w = $_[0]; |
| 27 |
my @swap_bindtags = $w->bindtags; |
| 28 |
$w -> bindtags([@swap_bindtags[1,0,2,3]]); |
| 29 |
if ($^O eq 'MSWin32') { |
| 30 |
$w -> Tk::bind('<MouseWheel>' => sub{$_[0]->break}); |
| 31 |
} else { |
| 32 |
$w -> Tk::bind('<4>' => sub{$_[0]->break}); |
| 33 |
$w -> Tk::bind('<5>' => sub{$_[0]->break}); |
| 34 |
}; |
| 35 |
}; |
| 36 |
|
| 37 |
## turn off the mouse-3 pop-up menu which is normal for a text widget |
| 38 |
sub disable_mouse3 { |
| 39 |
my $text = $_[0]; |
| 40 |
my @swap_bindtags = $text->bindtags; |
| 41 |
$text -> bindtags([@swap_bindtags[1,0,2,3]]); |
| 42 |
$text -> bind('<Button-3>' => sub{$_[0]->break}); |
| 43 |
}; |
| 44 |
|
| 45 |
|
| 46 |
sub about_demos { |
| 47 |
my $info = <<EOH |
| 48 |
Demo projects are the best way to learn about the many features of |
| 49 |
Athena. |
| 50 |
|
| 51 |
They are project files that have been specially prepared to |
| 52 |
demonstrate different aspects of Athena. The name of the project |
| 53 |
should give a hint as to which feature is being demonstrated. Each of |
| 54 |
the demo projects has extensive documentation and many hints about |
| 55 |
things to try written in the journal. |
| 56 |
|
| 57 |
To read the journal once you have imported the demo project, either |
| 58 |
select "Write in project journal" from the Edit menu or hit Control-6. |
| 59 |
|
| 60 |
EOH |
| 61 |
; |
| 62 |
## tidy up for display |
| 63 |
$info =~ s/\n/ /g; |
| 64 |
$info =~ s/ /\n\n/g; |
| 65 |
my $dialog = |
| 66 |
$top -> Dialog(-bitmap => 'info', |
| 67 |
-text => $info, |
| 68 |
-title => 'Athena: About demo projects', |
| 69 |
-buttons => [qw/OK/], |
| 70 |
-default_button => 'OK'); |
| 71 |
my $response = $dialog->Show(); |
| 72 |
}; |
| 73 |
|
| 74 |
|
| 75 |
## this should probably be called "doc_display" or some such |
| 76 |
sub pod_display { |
| 77 |
my ($file) = @_; |
| 78 |
|
| 79 |
## a pm file goes straight to the pod browser |
| 80 |
if ($file =~ m{pm$}) { |
| 81 |
pod_post($file); |
| 82 |
return 1; |
| 83 |
}; |
| 84 |
|
| 85 |
## fire up a browser with the local html version of the pod WWWBrowser vs. Tk::Pod::WWWBrowser ??? |
| 86 |
my $succeeded = 0; |
| 87 |
if (($config{doc}{prefer} eq "html") and (eval { require WWWBrowser })) { |
| 88 |
my @list = @WWWBrowser::unix_browsers; |
| 89 |
unshift @list, $config{doc}{browser} if not $is_windows; |
| 90 |
@WWWBrowser::unix_browsers = @list; |
| 91 |
my $url = File::Spec->catfile(File::Spec->catfile($groups{"Default Parameters"} -> find('athena', 'aughtml'), |
| 92 |
split("::", $file))); |
| 93 |
$url =~ s{pod$}{html}; |
| 94 |
$succeeded = WWWBrowser::start_browser($url) if (-e $url); |
| 95 |
}; |
| 96 |
return 1 if $succeeded; |
| 97 |
|
| 98 |
## fire up browser with remote version of html |
| 99 |
## -- need a way to determine if we are online |
| 100 |
|
| 101 |
## pod version of user's guide is installed |
| 102 |
if (-e File::Spec->catfile($groups{"Default Parameters"} -> find('athena', 'augpod'), "index.pod")) { |
| 103 |
pod_post($file); |
| 104 |
$succeeded = 1; |
| 105 |
}; |
| 106 |
return 1 if $succeeded; |
| 107 |
|
| 108 |
## cannot find any form of the document |
| 109 |
my $info = <<EOH |
| 110 |
It seems that you have not installed the Athena User's Guide. |
| 111 |
|
| 112 |
The User's Guide is distributed separately from the rest of Athena. |
| 113 |
Go to |
| 114 |
|
| 115 |
http://cars9.uchicago.edu/iffwiki/BruceRavel/EvolvingSoftware |
| 116 |
|
| 117 |
and follow the simple installation instructions. |
| 118 |
|
| 119 |
EOH |
| 120 |
; |
| 121 |
$info =~ s{\n}{ }g; ## tidy up for display |
| 122 |
$info =~ s{ }{\n\n}g; |
| 123 |
my $dialog = |
| 124 |
$top -> Dialog(-bitmap => 'info', |
| 125 |
-text => $info, |
| 126 |
-title => 'Athena: Missing document', |
| 127 |
-buttons => [qw/OK/], |
| 128 |
-default_button => 'OK'); |
| 129 |
my $response = $dialog->Show(); |
| 130 |
return 0 |
| 131 |
|
| 132 |
}; |
| 133 |
|
| 134 |
sub pod_post { |
| 135 |
my ($file) = @_; |
| 136 |
my $p = $top->Pod(-file=>$file); |
| 137 |
$p->zoom_in foreach (1 .. $config{doc}{zoom}); |
| 138 |
}; |
| 139 |
|
| 140 |
|
| 141 |
sub quit_athena { |
| 142 |
my $ngroups = 0; |
| 143 |
foreach (keys %marked) { ++$ngroups }; |
| 144 |
if ($ngroups and $config{general}{query_save} and !$project_saved) { |
| 145 |
my $dialog = |
| 146 |
$top -> Dialog(-bitmap => 'questhead', |
| 147 |
-text => "Would you like to save this project before exiting?", |
| 148 |
-title => 'Athena: Exiting...', |
| 149 |
-buttons => [qw/Yes No Cancel/], |
| 150 |
-default_button => $config{general}{quit_query}); |
| 151 |
my $response = $dialog->Show(); |
| 152 |
($response eq 'Cancel') and return; |
| 153 |
$config{general}{quit_query} = $response; |
| 154 |
my $config_ref = tied %config; |
| 155 |
$config_ref -> WriteConfig($personal_rcfile); |
| 156 |
($response eq 'Yes') and &save_project('all'); |
| 157 |
}; |
| 158 |
|
| 159 |
## clean up stash directory |
| 160 |
if ($config{general}{purge_stash}) { |
| 161 |
opendir C, $stash_dir; |
| 162 |
map { my $f = File::Spec->catfile($stash_dir, $_); |
| 163 |
-f $f and unlink $f} |
| 164 |
(grep !/(^\.{1,2}|TRAP)$/, readdir C); |
| 165 |
closedir C; |
| 166 |
}; |
| 167 |
unlink($groups{"Default Parameters"}->find('athena', 'temp_lcf')) |
| 168 |
if (-e $groups{"Default Parameters"}->find('athena', 'temp_lcf')); |
| 169 |
|
| 170 |
$mru{config}{last_working_directory} = $current_data_dir; |
| 171 |
|
| 172 |
## remember the geometry, save it in the mru file |
| 173 |
my ($height, $width, $x, $y) = split(/[x+]/, $top->geometry); |
| 174 |
$mru{geometry}{height} = $height; |
| 175 |
$mru{geometry}{width} = $width; |
| 176 |
$mru{geometry}{'x'} = $x; |
| 177 |
$mru{geometry}{'y'} = $y; |
| 178 |
tied(%mru) -> WriteConfig($mrufile); |
| 179 |
|
| 180 |
$top->destroy(); |
| 181 |
exit; |
| 182 |
}; |
| 183 |
|
| 184 |
|
| 185 |
## move rc and mru files from their 0.8.016 and earlier locations to |
| 186 |
## the .horae directory |
| 187 |
sub convert_config_files { |
| 188 |
my $horae_dir = $groups{"Default Parameters"} -> find('athena', 'horae'); |
| 189 |
(-d $horae_dir) or mkpath($horae_dir); |
| 190 |
my $rcfile = $groups{"Default Parameters"} -> find('athena', 'oldrc'); |
| 191 |
my $rctarget = $groups{"Default Parameters"} -> find('athena', 'rc_personal'); |
| 192 |
my $mrufile = $groups{"Default Parameters"} -> find('athena', 'oldmru'); |
| 193 |
my $mrutarget = $groups{"Default Parameters"} -> find('athena', 'mru'); |
| 194 |
##print join(" ", $horae_dir, $rcfile, $rmrufile), $/; |
| 195 |
move($rcfile, $rctarget) if (-e $rcfile); |
| 196 |
move($mrufile, $mrutarget) if (-e $mrufile); |
| 197 |
}; |
| 198 |
|
| 199 |
sub clean_old_trap_files { |
| 200 |
opendir S, $stash_dir; |
| 201 |
my @list = grep {/ATHENA/} readdir S; |
| 202 |
closedir S; |
| 203 |
map {unlink File::Spec->catfile($stash_dir, $_)} @list; |
| 204 |
}; |
| 205 |
|
| 206 |
|
| 207 |
sub stash_directory { |
| 208 |
my $dir = $groups{"Default Parameters"} -> find('athena', 'horae'); |
| 209 |
(-d $dir) or mkpath($dir); |
| 210 |
$dir = File::Spec->catfile($dir, "stash"); |
| 211 |
(-d $dir) or mkpath($dir); |
| 212 |
$dir = $groups{"Default Parameters"} -> find('athena', 'userfiletypedir'); |
| 213 |
(-d $dir) or mkpath($dir); |
| 214 |
$dir = $groups{"Default Parameters"} -> find('other', 'downloads'); |
| 215 |
(-d $dir) or mkpath($dir); |
| 216 |
return $stash_dir; |
| 217 |
}; |
| 218 |
|
| 219 |
|
| 220 |
## display $str in echo area, $app true means to append $str to what |
| 221 |
## is already there |
| 222 |
sub Echo { |
| 223 |
my ($str, $app) = @_; |
| 224 |
my $text = $echo -> cget('-text'); |
| 225 |
($str eq " ... done!") and ($text =~ s/ ... done!$//); |
| 226 |
($app) and ($str = $text . $str); |
| 227 |
|
| 228 |
push @echo_history, $str; |
| 229 |
## ($#echo_history > 2000) and shift @echo_history; |
| 230 |
$notes{echo} -> insert('end', $str."\n", "text"); |
| 231 |
$notes{echo} -> yviewMoveto(1); |
| 232 |
|
| 233 |
## strip off the character identifying the echo string as coming from Group.pm |
| 234 |
$str =~ s/^\>\s*//; |
| 235 |
if ($echo_pause) { |
| 236 |
$top -> after($echo_pause, |
| 237 |
sub{$echo -> configure(-text=>(length($str) > 110) ? |
| 238 |
substr($str, 0, 110)." ..." : $str); |
| 239 |
}); |
| 240 |
} else { |
| 241 |
$echo -> configure(-text=>(length($str) > 110) ? |
| 242 |
substr($str, 0, 110)." ..." : $str); |
| 243 |
}; |
| 244 |
$top -> update; |
| 245 |
}; |
| 246 |
|
| 247 |
sub Error { $top->bell; Echonow(@_); }; |
| 248 |
|
| 249 |
sub Echonow { my $old=$echo_pause; $echo_pause=0; Echo(@_); $echo_pause=$old}; |
| 250 |
|
| 251 |
|
| 252 |
sub show_hint { |
| 253 |
Echo("Hints file was not found"), return unless @hints; |
| 254 |
$hint_n = int(rand $#hints); |
| 255 |
Echo("HINT: " . $hints[$hint_n]); |
| 256 |
#++$hint_n; |
| 257 |
#($hint_n > $#hints) and $hint_n = 0; |
| 258 |
}; |
| 259 |
|
| 260 |
## this brings up the menu when a group in the skinny panel is |
| 261 |
## right-clicked upon |
| 262 |
sub GroupsPopupMenu { |
| 263 |
my ($w, $item, $X, $Y) = @_; |
| 264 |
set_properties(2, $item, 0); |
| 265 |
if (@_ < 3) { |
| 266 |
my $e = $w->XEvent; |
| 267 |
$X = $e->X; |
| 268 |
$Y = $e->Y; |
| 269 |
}; |
| 270 |
$group_menu->Post($X,$Y) if defined $group_menu; |
| 271 |
} |
| 272 |
|
| 273 |
sub Leave { |
| 274 |
my $this = shift; |
| 275 |
my @normal = (-fill => $config{colors}{foreground},); # -font => $config{fonts}{med}, |
| 276 |
my @rect_out = (-fill => $config{colors}{background}, -outline=>$config{colors}{background}); |
| 277 |
$this->configure(-cursor => 'top_left_arrow'); |
| 278 |
return if not exists($groups{$current}->{bindtag}); |
| 279 |
return if not $this->itemcget('current', '-tags'); |
| 280 |
if ($this->itemcget('current', '-tags')->[0] ne $groups{$current}->{bindtag}) { |
| 281 |
my $x = $this->find(below=>'current'); |
| 282 |
$this->itemconfigure($x, @rect_out,); |
| 283 |
}; |
| 284 |
}; |
| 285 |
|
| 286 |
|
| 287 |
## Dump the current states of important hashes to a file |
| 288 |
sub Dumpit { |
| 289 |
Echo("Dumping groups and marked to \`athena.dump\'"); |
| 290 |
$Data::Dumper::Indent = 2; |
| 291 |
open DUMP, ">athena.dump" or die $!; |
| 292 |
print DUMP Data::Dumper->Dump([\$current, \%groups, \%marked, \%lcf_data], |
| 293 |
[qw/current groups marked lcf_data/]); |
| 294 |
close DUMP; |
| 295 |
$Data::Dumper::Indent = 0; |
| 296 |
Echo("Dumping groups and marked to \`athena.dump\' ... done!"); |
| 297 |
}; |
| 298 |
|
| 299 |
|
| 300 |
sub reset_window { |
| 301 |
my ($parent, $which, $r_save) = @_; |
| 302 |
$parent -> packForget; |
| 303 |
undef $parent; |
| 304 |
$fat -> pack(-fill=>'both', -expand=>1); |
| 305 |
##$peak->grabRelease; $peak->destroy; |
| 306 |
map {$_ -> configure(-state=>'normal')} |
| 307 |
($data_menu, $merge_menu, $anal_menu, $settings_menu); |
| 308 |
$fat_showing = 'normal'; |
| 309 |
$which_showing = undef; |
| 310 |
$hash_pointer = undef; |
| 311 |
set_properties(1, $current, 0) if ($current); |
| 312 |
##print join(" ", $r_save, @$r_save), $/; |
| 313 |
if ($r_save) { |
| 314 |
my $ps = $project_saved; |
| 315 |
($plot_features{emin}, $plot_features{emax}) = @$r_save; |
| 316 |
project_state($ps); # don't toggle if currently saved |
| 317 |
}; |
| 318 |
Echo("Done with $which. Normal view has been returned."); |
| 319 |
}; |
| 320 |
|
| 321 |
sub swap_panels { |
| 322 |
if (grep {$_ eq 'right'} ($skinny -> packInfo())) { |
| 323 |
$config{general}{fatside} = 'right'; |
| 324 |
$config{general}{listside} = 'left'; |
| 325 |
$list -> configure(-scrollbars=>'w'); |
| 326 |
$po_left -> packForget; |
| 327 |
$po -> packForget; |
| 328 |
$po_right -> packForget; |
| 329 |
$po -> pack(-side=>'left', -fill => 'x', -expand=>1); |
| 330 |
$po_right -> pack(-side=>'left', -anchor=>'n'); |
| 331 |
} else { |
| 332 |
$config{general}{fatside} = 'left'; |
| 333 |
$config{general}{listside} = 'right'; |
| 334 |
$list -> configure(-scrollbars=>'e'); |
| 335 |
$po_left -> packForget; |
| 336 |
$po -> packForget; |
| 337 |
$po_right -> packForget; |
| 338 |
$po_left -> pack(-side=>'left', -anchor=>'n'); |
| 339 |
$po -> pack(-side=>'left', -fill => 'x', -expand=>1); |
| 340 |
}; |
| 341 |
$skinny -> pack(-side=>$config{general}{listside}); |
| 342 |
$container -> pack(-side=>$config{general}{fatside}); |
| 343 |
}; |
| 344 |
|
| 345 |
|
| 346 |
sub z_popup { |
| 347 |
return if ($groups{$current}->{frozen}); |
| 348 |
my ($curr, $which) = @_; |
| 349 |
($menus{bkg_z}, $menus{fft_edge}) = find_edge($groups{$current}->{bkg_e0}); |
| 350 |
$groups{$current} -> make(bkg_cl=>($which =~ /^cl/) ? 1 : 0, |
| 351 |
bkg_z=>$menus{bkg_z}, |
| 352 |
fft_edge=>$menus{fft_edge}, |
| 353 |
update_fft=>($which eq 'pc'), |
| 354 |
); |
| 355 |
$groups{$current} -> make(update_bkg=>($which eq 'cl')) unless $groups{$current}->{update_bkg}; |
| 356 |
$groups{$current} -> plotE('emzn',$dmode,\%plot_features, \@indicator), return if ($which =~ /update/); |
| 357 |
my $popup = $top -> Toplevel(-class=>'horae'); |
| 358 |
$popup -> protocol(WM_DELETE_WINDOW => sub{$popup->destroy}); |
| 359 |
$popup -> title("Athena: Central atom species"); |
| 360 |
$popup -> bind('<Control-d>' => sub{($which eq 'cl') and |
| 361 |
$groups{$current} -> plotE('emzn',$dmode,\%plot_features, \@indicator); |
| 362 |
$popup->destroy;}); |
| 363 |
$popup -> bind('<Control-q>' => sub{($which eq 'cl') and |
| 364 |
$groups{$current} -> plotE('emzn',$dmode,\%plot_features, \@indicator); |
| 365 |
$popup->destroy;}); |
| 366 |
my $note = ($absorption_exists) ? "\nA guess has been made, but it may not be correct" : ""; |
| 367 |
$popup -> Label(-text=>"You have selected a feature of Athena that\nneeds to know the species\nof the central atom in this data set.".$note) |
| 368 |
-> pack(); |
| 369 |
my $frame = $popup -> Frame(-borderwidth=>2, -relief=>'groove') |
| 370 |
-> pack(-pady=>4); |
| 371 |
$frame -> Label(-text=>'Choose an atom type:') |
| 372 |
-> pack(-side=>'left'); |
| 373 |
my $menu = $frame -> Optionmenu(-textvariable => \$menus{bkg_z}, -width=>4) |
| 374 |
-> pack(-side=>'right'); |
| 375 |
foreach my $l ([1..20], [21..40], [41..60], [61..80], [81..92]) { |
| 376 |
my $cas = $menu -> |
| 377 |
cascade(-label => get_symbol($$l[0]) . " to " . get_symbol($$l[$#{$l}]), |
| 378 |
-tearoff=>0 ); |
| 379 |
foreach my $i (@$l) { |
| 380 |
$cas -> command(-label => $i . ": " . get_symbol($i), |
| 381 |
-command=> |
| 382 |
sub{$menus{bkg_z}=get_symbol($i); |
| 383 |
$groups{$current}->make(bkg_cl=>($which =~ /^cl/), |
| 384 |
bkg_z=>$menus{bkg_z}, |
| 385 |
update_bkg=>($which =~ /^cl/), |
| 386 |
update_fft=>($which eq 'pc')); |
| 387 |
project_state(0); |
| 388 |
($which eq 'cl') and |
| 389 |
$groups{$current} -> plotE('emzn',$dmode,\%plot_features, \@indicator); |
| 390 |
$popup->destroy; |
| 391 |
}); |
| 392 |
}; |
| 393 |
}; |
| 394 |
$frame = $popup -> Frame() -> pack(-expand=>1, -fill=>'x'); |
| 395 |
$frame -> Button(-text=>'OK', # emzn ? |
| 396 |
-command=>sub{($which eq 'cl') and |
| 397 |
$groups{$current} -> plotE('emzn',$dmode,\%plot_features, \@indicator); |
| 398 |
$popup->destroy; }) |
| 399 |
-> pack(-expand=>1, -fill=>'x'); |
| 400 |
$top->update; |
| 401 |
$popup -> raise; |
| 402 |
$popup -> grab; |
| 403 |
}; |
| 404 |
|
| 405 |
|
| 406 |
## From the current value of the edge energy for the current group, |
| 407 |
## attempt to determine what element this is. The criterion is |
| 408 |
## closeness to a tabulated edge energy found by brute force, |
| 409 |
## linear searching. That requires that Xray::Absorption is installed. |
| 410 |
sub find_edge { |
| 411 |
return ('H', 'K') unless ($absorption_exists); |
| 412 |
my $input = $_[0]; |
| 413 |
my ($edge, $answer, $this) = ("K", 1, 0); |
| 414 |
my $diff = 100000; |
| 415 |
foreach my $ed (qw(K L1 L2 L3)) { # M1 M2 M3 M4 M5 |
| 416 |
Z: foreach (1..104) { |
| 417 |
last Z unless (Xray::Absorption->in_resource($_)); |
| 418 |
my $e = Xray::Absorption -> get_energy($_, $ed); |
| 419 |
next Z unless $e; |
| 420 |
$this = abs($e - $input); |
| 421 |
last Z if (($this > $diff) and ($e > $input)); |
| 422 |
if ($this < $diff) { |
| 423 |
$diff = $this; |
| 424 |
$answer = $_; |
| 425 |
$edge = $ed; |
| 426 |
#print "$answer $edge\n"; |
| 427 |
}; |
| 428 |
}; |
| 429 |
}; |
| 430 |
my $elem = get_symbol($answer); |
| 431 |
if ($config{general}{rel2tmk}) { |
| 432 |
## give special treatment to the case of fe oxide. |
| 433 |
($elem, $edge) = ("Fe", "K") if (($elem eq "Nd") and ($edge eq "L1")); |
| 434 |
## give special treatment to the case of mn oxide. |
| 435 |
($elem, $edge) = ("Mn", "K") if (($elem eq "Ce") and ($edge eq "L1")); |
| 436 |
## prefer Bi K to Ir L1 |
| 437 |
($elem, $edge) = ("Bi", "L3") if (($elem eq "Ir") and ($edge eq "L1")); |
| 438 |
## prefer Se K to Tl L2 |
| 439 |
($elem, $edge) = ("Se", "K") if (($elem eq "Tl") and ($edge eq "L3")); |
| 440 |
## prefer Pt L3 to W L2 |
| 441 |
#($elem, $edge) = ("Pt", "L3") if (($elem eq "W") and ($edge eq "L2")); |
| 442 |
## prefer Se K to Pb L2 |
| 443 |
($elem, $edge) = ("Rb", "K") if (($elem eq "Pb") and ($edge eq "L2")); |
| 444 |
## prefer Np L3 to At L1 |
| 445 |
#($elem, $edge) = ("Np", "L3") if (($elem eq "At") and ($edge eq "L1")); |
| 446 |
## prefer Cr K to Ba L1 |
| 447 |
($elem, $edge) = ("Cr", "K") if (($elem eq "Ba") and ($edge eq "L1")); |
| 448 |
}; |
| 449 |
return ($elem, $edge); |
| 450 |
}; |
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
sub set_status { |
| 455 |
return if (Ifeffit::Tools->vstr < 1.02007); |
| 456 |
my $val = $_[0] || 0; |
| 457 |
$groups{"Default Parameters"} -> dispose("set \&status = $val", $dmode); |
| 458 |
}; |
| 459 |
|
| 460 |
|
| 461 |
sub splash_message { |
| 462 |
my ($message) = @_; |
| 463 |
$splash_status -> configure(-text=>$message); |
| 464 |
$top -> update; |
| 465 |
#sleep 1; |
| 466 |
}; |
| 467 |
|
| 468 |
|
| 469 |
## I got this off of Usenet. Do a search at groups.google.com for the |
| 470 |
## package to find discussions of slow dialog boxes. The text of this |
| 471 |
## will be among the discussions. |
| 472 |
package Patch::SREZIC::Tk::Wm; |
| 473 |
|
| 474 |
use Tk::Wm; |
| 475 |
package Tk::Wm; |
| 476 |
|
| 477 |
sub Post |
| 478 |
{ |
| 479 |
my ($w,$X,$Y) = @_; |
| 480 |
$X = int($X); |
| 481 |
$Y = int($Y); |
| 482 |
$w->positionfrom('user'); |
| 483 |
# $w->geometry("+$X+$Y"); |
| 484 |
$w->MoveToplevelWindow($X,$Y); |
| 485 |
$w->deiconify; |
| 486 |
# $w->idletasks; # to prevent problems with KDE's kwm etc. |
| 487 |
# $w->raise; |
| 488 |
} |
| 489 |
|
| 490 |
## work around an issue in the 18 Dec 2008 release of Tk 804.028 |
| 491 |
package Patch::BR::Tk::FBox; |
| 492 |
use Tk::FBox; |
| 493 |
package Tk::FBox; |
| 494 |
sub _get_select_Path { |
| 495 |
my($w) = @_; |
| 496 |
$w->_encode_filename($w->{'selectPath'}); |
| 497 |
}; |
| 498 |
|
| 499 |
1; |
| 500 |
|
| 501 |
|
| 502 |
## END OF MISCELLANEOUS SUBSECTION |
| 503 |
########################################################################################## |