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#
16if { [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
32update_define 1 $total_menus 0
33update_mainmenu
34
35button .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
39button .f0.right.quit -anchor w -text "Quit Without Saving" -underline 0\
40    -command { maybe_exit .maybe }
41
42button .f0.right.load -anchor w -text "Load Configuration from File" \
43    -command { load_configfile .load "Load Configuration from file" read_config_file
44}
45
46button .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
53pack .f0.right.store .f0.right.load .f0.right.quit .f0.right.save \
54    -padx 0 -pady 0 -side bottom -fill x
55pack .f0.left .f0.middle .f0.right -side left -padx 5 -pady 0 -fill y
56pack .f0 -padx 5 -pady 5
57
58update idletasks
59set winy [expr 10 + [winfo reqheight .f0]]
60set scry [lindex [wm maxsize .] 1]
61set winx [expr 10 + [winfo reqwidth .f0]]
62set scrx [lindex [wm maxsize .] 0]
63if {$winx < $scrx} then {set maxx -1} else {set maxx $winx}
64if {$winy < $scry} then {set maxy -1} else {set maxy $winy}
65.f0 configure -width $winx -height $winy
66wm maxsize . $maxx $maxy
67
68#
69# If we cannot write our config files, disable the write button.
70#
71if { [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
81if { [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	}
90