File: xconfig

package info (click to toggle)
gxedit 1.15-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,008 kB
  • ctags: 882
  • sloc: ansic: 12,736; makefile: 149; sh: 26
file content (115 lines) | stat: -rw-r--r-- 3,971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
set state1 1
set state2 0
set state3 0
set state4 0

wm title . "GXedit setup"
wm geometry . +150+150
label .l1 -text "Welcome to the setup of GXedit - PRECOMPILE OPTIONS:"
button .b1 -text "Help" -command {help 1}
checkbutton .c1 -text "Use network features" -variable state1 -onvalue 1 -offvalue 0
button .b2 -text "Help" -command {help 2}
checkbutton .c2 -text "Go to background on startup" -variable state2 -onvalue 1 -offvalue 0
button .b3 -text "Help" -command {help 3}
checkbutton .c3 -text "Use GTK 1.1.x library" -variable state3 -onvalue 1 -offvalue 0
button .b4 -text "Help" -command {help 4}
checkbutton .c4 -text "Use GtkEditor patch" -variable state4 -onvalue 1 -offvalue 0
button .b5 -text "Read README file" -command {reada README}
button .b6 -text "Read DEPENDENCIES file" -command {reada DEPENDENCIES}
button .b7 -text "Read CHANGELOG file" -command {reada CHANGELOG}
button .b8 -text "Edit advanced features" -command {adv}
button .b9 -text "Compile GXedit" -command {compile}
button .b10 -text "Compile say (for Audio functions)" -command {say}
grid .l1 -row 1 -columnspan 4
grid .b1 -row 2 -column 1
grid .c1 -row 2 -column 2
grid .b2 -row 3 -column 1
grid .c2 -row 3 -column 2
grid .b3 -row 4 -column 1
grid .c3 -row 4 -column 2
grid .b4 -row 5 -column 1
grid .c4 -row 5 -column 2
grid .b5 -row 7 -columnspan 4 -sticky "we"
grid .b6 -row 8 -columnspan 4 -sticky "we"
grid .b7 -row 9 -columnspan 4 -sticky "we"
grid .b8 -row 10 -columnspan 4 -sticky "we"
grid .b9 -row 11 -columnspan 4 -sticky "we"
grid .b10 -row 12 -columnspan 4 -sticky "we"

proc help {type} {
 toplevel .help
 wm title .help "Help"
 wm geometry .help +180+180
 if {$type == "1"} {
  label .help.l1 -text "The network features will be disabled if you select this option\nbut you should let them on unless you don't have access to\nthe Internet"
 }
 if {$type == "2"} {
  label .help.l1 -text "This option sends the program to the background on start\ndetaching the process from your terminal"
 }
 if {$type == "3"} {
  label .help.l1 -text "Use this option if you have the development GTK library 1.1.x"
 }
 if {$type == "4"} {
  label .help.l1 -text "If you want to have syntax highlighting in GXedit, you need\nthe GtkEditor patch available at http://www.daimi.aau.dk/~mailund/gtk.html\napplied to GTK 1.1.x"
 }
 button .help.b1 -text "Close" -command {destroy .help}
 grid .help.l1 -row 1
 grid .help.b1 -row 2 -sticky "we"
}

proc reada {file} {
 exec "xterm" "-e" "less" "$file"
}

proc adv args {
 exec "xterm" "-e" "vi" "./config.orig"
}

proc compile args {
 global state1
 global state2
 global state3
 global state4
 set fd [open "config.h" w]
 puts $fd "/* configuration file - precompile options */"
 if {$state1 == "1"} {
  puts $fd "#define USE_NET"
 } else {
  puts $fd "#undef USE_NET"
 }
 if {$state2 == "1"} {
  puts $fd "#define BG_ON_START"
 } else {
  puts $fd "#undef BG_ON_START"
 }
 if {$state3 == "1"} {
  puts $fd "#define GTK_1_1"
 } else {
  puts $fd "#undef GTK_1_1"
 }
 if {$state4 == "1"} {
  puts $fd "#define GTKEDITOR_PATCH"
 } else {
  puts $fd "#undef GTKEDITOR_PATCH"
 }
 close $fd
 exec "cat" "config.orig" ">>" "config.h"
 exec "make" "clean"
 if {$state4 == "1"} {
  if [catch {exec "make" "gxe-with-gtkeditor" "2>" "./make.log"} in] {
   tk_dialog .err "Error" "Compilation failed. Make sure you have the right options selected\nCompile log is in ./make.log" error 0 OK
  }
 } else {
  if [catch {exec "make" "gxe" "2>" "./make.log"} in] {
   tk_dialog .err "Error" "Compilation failed. Make sure you have the right options selected\nCompile log is in ./make.log" error 0 OK
  }
 }
 tk_dialog .done "Done" "Compilation finished\nYou can install with: make install" info 0 OK
}

proc say args {
 if [catch {exec "make" "say" "2>" "./make.log"} in] {
  tk_dialog .err "Error" "Compilation failed.\nCompile log is in ./make.log" error 0 OK
 }
 tk_dialog .done "Done" "Compilation finished\nYou can install with: make say-install" info 0 OK
}