import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / scripts / tail.tk
1 # FILE: tail.tk
2 # This file is boilerplate TCL/TK function definitions for 'make xconfig'.
3 #
4 # CHANGES
5 # =======
6 #
7 # 8 January 1998, Michael Elizabeth Chastain, <mec@shout.net>
8 # Arrange buttons in three columns for better screen fitting.
9 #
10
11 #
12 # Read the user's settings from .config.  These will override whatever is
13 # in config.in.  Don't do this if the user specified a -D to force
14 # the defaults.
15 #
16 if { [file readable .config] == 1} then {
17         if { $argc > 0 } then {
18                 if { [lindex $argv 0] != "-D" } then {
19                         read_config .config
20                 }
21                 else
22                 {
23                         read_config $defaults
24                 }
25         } else {
26                 read_config .config
27         }
28 } else {
29         read_config $defaults
30 }
31
32 update_define 1 $total_menus 0
33 update_mainmenu
34
35 button .f0.right.save -anchor w -text "Save and Exit" -underline 0\
36     -command { catch {exec cp -f .config .config.old}; \
37                 writeconfig .config include/linux/autoconf.h; wrapup .wrap }
38
39 button .f0.right.quit -anchor w -text "Quit Without Saving" -underline 0\
40     -command { maybe_exit .maybe }
41
42 button .f0.right.load -anchor w -text "Load Configuration from File" \
43     -command { load_configfile .load "Load Configuration from file" read_config_file
44 }
45
46 button .f0.right.store -anchor w -text "Store Configuration to File" \
47     -command { load_configfile .load "Store Configuration to file" write_config_file }
48
49 #
50 # Now pack everything.
51 #
52
53 pack .f0.right.store .f0.right.load .f0.right.quit .f0.right.save \
54     -padx 0 -pady 0 -side bottom -fill x
55 pack .f0.left .f0.middle .f0.right -side left -padx 5 -pady 0 -fill y
56 pack .f0 -padx 5 -pady 5
57
58 update idletasks
59 set winy [expr 10 + [winfo reqheight .f0]]
60 set scry [lindex [wm maxsize .] 1]
61 set winx [expr 10 + [winfo reqwidth .f0]]
62 set scrx [lindex [wm maxsize .] 0]
63 if {$winx < $scrx} then {set maxx -1} else {set maxx $winx}
64 if {$winy < $scry} then {set maxy -1} else {set maxy $winy}
65 .f0 configure -width $winx -height $winy 
66 wm maxsize . $maxx $maxy
67
68 #
69 # If we cannot write our config files, disable the write button.
70 #
71 if { [file exists .config] == 1 } then {
72                 if { [file writable .config] == 0 } then {
73                         .f0.right.save configure -state disabled
74                 }
75         } else {
76                 if { [file writable .] == 0 } then {
77                         .f0.right.save configure -state disabled
78                 }
79         }
80
81 if { [file exists include/linux/autoconf.h] == 1 } then {
82                 if { [file writable include/linux/autoconf.h] == 0 } then {
83                         .f0.right.save configure -state disabled
84                 }
85         } else {
86                 if { [file writable include/linux/] == 0 } then {
87                         .f0.right.save configure -state disabled
88                 }
89         }