📄 elix.tcl
字号:
# Copyright (c) 2000, Red Hat, Inc.# # This file is part of Source-Navigator.# # Source-Navigator is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License as published# by the Free Software Foundation; either version 2, or (at your option)# any later version.# # Source-Navigator is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License for more details.# # You should have received a copy of the GNU General Public License along# with Source-Navigator; see the file COPYING. If not, write to# the Free Software Foundation, 59 Temple Place - Suite 330, Boston,# MA 02111-1307, USA.# # elix.tcl - EL/IX configuration dialog.# Copyright (C) 1999 Cygnus Soluations.# Written by Tom Tromey <tromey@cygnus.com>.itcl_class Elix& { inherit sourcenav::Window constructor {{config ""}} { withdraw # Initialize EL/IX options. set ttys {/dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3 /dev/ttyS4} global elix_options fill elix_options set NoteBook [tixNoteBook ${this}.nbook -ipadx 0 -ipady 0\ -borderwidth 0 -background white] ${NoteBook} add target -label [get_indep String ElixTarget]\ -under [get_indep Pos ElixTarget] ${NoteBook} add filesys -label [get_indep String ElixFilesys]\ -under [get_indep Pos ElixFilesys] ${NoteBook} add mounts -label [get_indep String ElixMounts]\ -under [get_indep Pos ElixMounts] ${NoteBook} add kernel -label [get_indep String ElixKernel]\ -under [get_indep Pos ElixKernel] ${NoteBook} add debug -label [get_indep String ElixDebug]\ -under [get_indep Pos ElixDebug] sn_motif_buttons ${this} bottom 0 [get_indep String ok]\ [get_indep String Apply] [get_indep String cancel] ${this}.button_0 config -command " ${this} apply " ${this}.button_1 config -command " ${this} apply 0 "\ -underline [get_indep Pos Apply] ${this}.button_2 config -command " ${this} exitPreferences " pack ${NoteBook} -fill both -expand 1 -padx 4 -pady 4 AddTarget ${NoteBook} target AddFilesys ${NoteBook} filesys AddMount ${NoteBook} mounts AddKernel ${NoteBook} kernel AddDebug ${NoteBook} debug ${NoteBook} raise target title [sn_title [get_indep String ElixPreferences] 0] ${this} centerOnScreen } # We'd use a radiobutton-on-a-frame widget if # there was one, but there isn't. method radioframe {name args} { frame ${name} -relief flat -borderwidth 0 frame ${name}.iframe -relief groove -borderwidth 2 ::grid ${name}.iframe -row 1 -sticky news ::grid rowconfigure ${name} 1 -weight 1 ::grid columnconfigure ${name} 0 -weight 1 frame ${name}.iframe.childframe -borderwidth 4 -relief flat ::grid ${name}.iframe.childframe -row 1 -sticky news ::grid rowconfigure ${name}.iframe 1 -weight 1 ::grid columnconfigure ${name}.iframe 0 -weight 1 # Note that radio_update knows the name of this # radiobutton. eval radiobutton ${name}.radio -padx 2 ${args} set height [expr {int([winfo reqheight ${name}.radio] / 2)}] ::grid rowconfigure ${name} 0 -minsize ${height} -weight 0 ::grid rowconfigure ${name}.iframe 0 -minsize ${height} -weight 0 place ${name}.radio -in ${name}.iframe -relx 0 -x 6 -rely 0 -y -2\ -anchor w return ${name}.iframe.childframe } # A helper proc used when using radioframe. This enables or # disables the contents of related frames. ENABLE is the # frame to enable; DISABLED lists all the frames to process # (including ENABLE). method radio_update {enable disabled} { foreach frame ${disabled} { if {${frame} == ${enable}} { set state normal } else { set state disabled } set wlist [winfo children ${frame}] while {[llength ${wlist}] > 0} { set w [lindex ${wlist} 0] set wlist [lreplace ${wlist} 0 0] if {${w} == "${frame}.radio"} { continue } catch {${w} configure -state ${state}} eval lappend wlist [winfo children ${w}] } } } method AddFilesys {nb page} { global sn_options elix_options # Ugly, but S-N standard. set xstep 30 set page [${nb} subwidget ${page}] set frame [tixLabelFrame ${page}.frame -label [get_indep String\ ElixFilesys] -background $sn_options(def,layout-bg)] set child [${frame} subwidget frame] pack ${frame} -side top -fill x set frames [list ${child}.romfs ${child}.nfs ${child}.minix] set romfs [radioframe ${child}.romfs -text [get_indep String\ ElixROMfs] -variable elix_options(file-system) -value romfs\ -command [list ${this} radio_update ${child}.romfs ${frames}]] LabelEntryButton& ${romfs}.filesys -labelwidth ${xstep}\ -text [get_indep String ElixFilesysROMPath]\ -variable elix_options(file-rom-path) -directory 1 pack ${romfs}.filesys -side top -fill x -padx 4 -pady 4 set minix [radioframe ${child}.minix -text [get_indep String\ ElixMinix] -variable elix_options(file-system) -value minix\ -command [list ${this} radio_update ${child}.minix ${frames}]] LabelEntryButton& ${minix}.filesys -labelwidth ${xstep}\ -text [get_indep String ElixFilesysMinixPath]\ -variable elix_options(file-minix-path) -directory 1 set sframes [list ${minix}.relative ${minix}.absolute] set rel [radioframe ${minix}.relative -text [get_indep String\ ElixRelative] -variable elix_options(file-minix-choice)\ -value relative -command [list ${this} radio_update\ ${minix}.relative ${sframes}]] Entry& ${rel}.extra -labelwidth ${xstep} -label [get_indep String\ ElixExtra] -textvariable elix_options(file-minix-extra) pack ${rel}.extra -side top -anchor w -fill x -padx 4 -pady 4 set abs [radioframe ${minix}.absolute -text [get_indep String\ ElixAbsolute] -variable elix_options(file-minix-choice)\ -value absolute -command [list ${this} radio_update\ ${minix}.absolute ${sframes}]] Entry& ${abs}.blocks -labelwidth ${xstep} -label [get_indep String\ ElixBlocks] -textvariable elix_options(file-minix-blocks) Entry& ${abs}.inodes -labelwidth ${xstep} -label [get_indep String\ ElixInodes] -textvariable elix_options(file-minix-inodes) pack ${abs}.blocks ${abs}.inodes -side top -anchor w -fill x -padx 4\ -pady 4 pack ${minix}.filesys ${minix}.relative ${minix}.absolute -side top\ -fill x -padx 4 -pady 4 set nfsframe [radioframe ${child}.nfs -text [get_indep String ElixNFS]\ -variable elix_options(file-system) -value nfs -command\ [list ${this} radio_update ${child}.nfs ${frames}]] LabelEntryButton& ${nfsframe}.filesys -labelwidth ${xstep}\ -text [get_indep String ElixFilesysNFSPath]\ -variable elix_options(file-nfs-path) -directory 1 pack ${nfsframe}.filesys -side top -fill x -padx 4 -pady 4 pack ${child}.romfs -side top -fill x -padx 4 -pady 4 pack ${child}.minix -side top -fill x -padx 4 -pady 4 pack ${child}.nfs -side top -fill x -padx 4 -pady 4 switch -- $elix_options(file-system) { romfs { radio_update ${child}.romfs ${frames} } nfs { radio_update ${child}.nfs ${frames} } minix { radio_update ${child}.minix ${frames} } } if {$elix_options(file-minix-choice) == "relative"} { radio_update ${minix}.relative ${sframes} } else { radio_update ${minix}.absolute ${sframes} } } method AddDebug {nb page} { global sn_options elix_options # Ugly, but S-N standard. set xstep 30 set page [${nb} subwidget ${page}] set frame [tixLabelFrame ${page}.frame -label [get_indep String\ ElixDebug] -background $sn_options(def,layout-bg)] set child [${frame} subwidget frame] pack ${frame} -side top -fill x set frames [list ${child}.ether ${child}.serial] set etherframe [radioframe ${child}.ether -text [get_indep String\ ElixEthernet] -variable elix_options(dbg-interface) -value ethernet\ -command [list ${this} radio_update ${child}.ether ${frames}]] Entry& ${etherframe}.port -width 10 -labelwidth ${xstep}\ -label [get_indep String ElixPortnumber]\ -textvariable elix_options(dbg-portnumber) pack ${etherframe}.port -side top -anchor w set serframe [radioframe ${child}.serial -text [get_indep String\ ElixSerial] -variable elix_options(dbg-interface) -value serial\ -command [list ${this} radio_update ${child}.serial ${frames}]] Combo& ${serframe}.tport -labelwidth ${xstep} -label [get_indep String\ ElixTargetport] -contents ${ttys}\ -entryvariable elix_options(dbg-targettty) Combo& ${serframe}.hport -labelwidth ${xstep} -label [get_indep String\ ElixHostport] -contents ${ttys}\ -entryvariable elix_options(dbg-hosttty) Combo& ${serframe}.speed -labelwidth ${xstep} -label [get_indep String\ ElixSpeed] -contents {9600 19200 38400 56000 115200}\ -entryvariable elix_options(dbg-speed) pack ${serframe}.tport -side top -anchor w pack ${serframe}.hport -side top -anchor w pack ${serframe}.speed -side top -anchor w pack ${child}.ether -side top -fill x -padx 4 -pady 4 pack ${child}.serial -side top -fill x -padx 4 -pady 4 if {$elix_options(dbg-interface) == "serial"} { radio_update ${child}.serial ${frames} } else { radio_update ${child}.ether ${frames} } } method AddKernel {nb page} { global sn_options elix_options # Ugly, but S-N standard. set xstep 30 set page [${nb} subwidget ${page}] set frame [tixLabelFrame ${page}.frame -label [get_indep String\ ElixKernel] -background $sn_options(def,layout-bg)] set child [${frame} subwidget frame] pack ${frame} -side top -fill x Entry& ${child}.args -labelwidth ${xstep} -label [get_indep String\ ElixKernelArgs] -textvariable elix_options(kernel-args) LabelEntryButton& ${child}.sources -labelwidth ${xstep}\ -text [get_indep String ElixKernelSources]\ -variable elix_options(kernel-sources) -directory 1 tixLabelFrame ${child}.modules -label [get_indep String\ ElixKernelModules] -background $sn_options(def,layout-bg) set m [${child}.modules subwidget frame] radiobutton ${m}.monolith -text [get_indep String\ ElixKernelMonolithic] -variable elix_options(kernel-modules)\ -value monolithic -padx 4 radiobutton ${m}.all -text [get_indep String ElixKernelAll]\ -variable elix_options(kernel-modules) -value all -padx 4 radiobutton ${m}.some -text [get_indep String ElixKernelSome]\ -variable elix_options(kernel-modules) -value some -padx 4 # S-N tradition seems to be to use a text widget and # not a listbox here, so that is what we do for now. # This will change once we are able to determine a # definitive list of modules somehow. # FIXME: format of text widget is `module,options\n'... # This makes the GUI ugly for now. tixLabelFrame ${m}.modules -label [get_indep String\ ElixKernelModuleList] -background $sn_options(def,layout-bg) set module_widget [text [${m}.modules subwidget frame].modules\ -height 10] ${module_widget} insert end [join $elix_options(kernel-module-list) \n] pack ${module_widget} -side top -fill x -padx 4 -pady 4 ::grid ${m}.monolith ${m}.all ${m}.some -padx 4 -pady 4 -sticky wn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -