📄 preferences.tcl
字号:
# Copyright (c) 2000, 2001, 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.# # preferences.tcl - The preferences notebook.# Copyright (C) 1998, 1999 Cygnus Solutions.#################################################### Preferences window for all the tools that are## availiable in SN.#### names:## proj = Project## edit = Editor## ctree = Class Hierarchy## classbr = Class Browser## xref = XReference## incbr = Include## retr = Retriever (Find)## parser = Parser settings## rcs = Revision Control## clrfont = Color&Font## others = Other Settings (Misc)################################################package require Itkitcl_class Preferences& { inherit sourcenav::Window constructor {{config ""}} { global sn_options set width 780 set height 580 withdraw set NoteBook [tixNoteBook $itk_component(hull).nbook -ipadx 0 -ipady 0\ -borderwidth 0 -background white] ${NoteBook} add proj -createcmd "${this} AddProject ${NoteBook} proj"\ -raisecmd "${this} RaiseProject" -label [get_indep String\ ProjectMenu] -under [get_indep Pos ProjectMenu]\ -state [tool_availiable proj 1] ${NoteBook} add edit -createcmd "${this} AddEditor ${NoteBook} edit"\ -raisecmd "${this} RaiseEditor" -label [get_indep String\ MultiEditor] -under [get_indep Pos MultiEditor]\ -state [tool_availiable edit 1] #window is for class hierarchy and browser ${NoteBook} add ctree -createcmd "${this} AddClassHierarchy\ ${NoteBook} ctree" -raisecmd "${this} RaiseClassHierarchy"\ -image tree_image -label [get_indep String PrefClassAndHierarchy]\ -under [get_indep Pos MultiClassHierarchy] -state\ [tool_availiable ctree 1] ${NoteBook} add xref -createcmd "${this} AddXReference ${NoteBook}\ xref" -raisecmd "${this} RaiseXReference" -label [get_indep String\ MultiXRef] -under [get_indep Pos MultiXRef] -state\ [tool_availiable xref 1] ${NoteBook} add incbr -createcmd "${this} AddInclude ${NoteBook}\ incbr" -raisecmd "${this} RaiseInclude" -label [get_indep String\ MultiInclude] -under [get_indep Pos MultiInclude]\ -state [tool_availiable incbr 1] #parser ${NoteBook} add parser -createcmd "${this} AddParser ${NoteBook}\ parser" -raisecmd "${this} RaiseParser" -label [get_indep String\ Parser] -under [get_indep Pos Parser] -state [tool_availiable parser\ 1] #Revision Control System ${NoteBook} add rcs \ -createcmd "${this} AddRcs ${NoteBook} rcs" \ -raisecmd "${this} RaiseRcs" \ -label [get_indep String Rcs] \ -under [get_indep Pos Rcs] \ -state [tool_availiable rcs ${new_project}] ${NoteBook} add others \ -createcmd "${this} AddOthers ${NoteBook} others" \ -raisecmd "${this} RaiseOthers" \ -label [get_indep String Others] \ -under [get_indep Pos Others] \ -state [tool_availiable others 1] ${NoteBook} add clrfont \ -createcmd "${this} AddColorAndFont ${NoteBook} clrfont" \ -raisecmd "${this} RaiseColorAndFont" \ -label [get_indep String ColorAndFont] \ -under [get_indep Pos ColorAndFont] \ -state [tool_Exists clrfont 1] sn_motif_buttons $itk_component(hull) bottom 0 \ [get_indep String ok] \ [get_indep String Apply] \ [get_indep String SaveDefault] \ [get_indep String cancel] $itk_component(hull).button_0 config \ -command " ${this} apply " $itk_component(hull).button_1 config \ -command " ${this} apply 0 " \ -underline [get_indep Pos Apply] $itk_component(hull).button_2 config \ -command " ${this} save_cb default " \ -underline [get_indep Pos SaveDefault] $itk_component(hull).button_3 config \ -command " ${this} exitPreferences " #bind Return to apply the current window bind $itk_component(hull) <Return> "${this} apply" #no apply by creating new project if {${new_project}} { $itk_component(hull).button_1 config -state disabled } pack ${NoteBook} -fill both -expand 1 -padx 4 -pady 4 if {${raise} != "proj" || ${widget} != ""} { goto ${raise} } else { goto ${lastPage} } title [sn_title [get_indep String Preferences] ${new_project}] ${this} configure -geometry ${width}x${height} ${this} centerOnScreen ${this} deiconify# FIXME: Do we really need this call to take_focus here? ${this} take_focus #call user defined function if {[catch {sn_rc_preferences ${this}} err]} { sn_log "error while exec sn_rc_preferences: ${err}" } global preferences_wait set preferences_wait "" ::tkwait variable preferences_wait } destructor { global preferences_wait if {${preferences_wait} == ""} { set preferences_wait cancel } foreach v [::info globals "${this}-*"] { catch {uplevel #0 unset ${v}} } } method exitPreferences {} { set lastPage [${NoteBook} raised] set preferences_wait cancel itcl::delete object ${this} } ##################################################### # project preferences ##################################################### method AddProject {nb page} { global sn_options global tcl_platform set ProjectPage [${nb} subwidget ${page}] set Project ${ProjectPage} set xstep 30 #project frame set prj [tixLabelFrame ${Project}.prj \ -label [get_indep String Project]] ${prj} config -background $sn_options(def,layout-bg) set win [${Project}.prj subwidget frame] set lbl [${Project}.prj subwidget label] pack ${prj} -side top -fill x #Read-Only Project set sn_options(opt_readonly) $sn_options(readonly) set ronly ${win}.ronly CheckButton& ${ronly} \ -labels [list ""] \ -balloons [list [get_indep String ReadOnly]] \ -variables sn_options(opt_readonly) \ -label [get_indep String ReadOnly] \ -labelunderline [get_indep Pos ReadOnly] \ -labelwidth ${xstep} pack ${ronly} -side top -anchor nw -fill x #Scan Project by opening set sn_options(opt_def,refresh-project)\ $sn_options(def,refresh-project) set scan ${win}.scan CheckButton& ${scan} \ -labels [list ""] \ -balloons [list [get_indep String PrefScanProjectINFO]] \ -variables sn_options(opt_def,refresh-project) \ -label [get_indep String PrefScanProject] \ -labelunderline [get_indep Pos PrefScanProject] \ -labelwidth ${xstep} pack ${scan} -side top -anchor nw -fill x #database frame set db [tixLabelFrame ${Project}.db \ -label [get_indep String Database]] ${db} config -background $sn_options(def,layout-bg) set win [${Project}.db subwidget frame] pack ${db} -side top -fill x if {${new_project}} { set state normal } else { set state disabled } #database directory set sn_options(opt_both,db-directory) $sn_options(both,db-directory) set dbdir ${win}.prjname LabelEntryButton& ${dbdir} \ -text [get_indep String PafWdDir] \ -underline [get_indep Pos PafWdDir] \ -command " ${this} choose_db_dir ${dbdir} " \ -labelwidth ${xstep} -anchor nw \ -variable sn_options(opt_both,db-directory) \ -native 1 \ -buttonballoon [get_indep String ChooseINFO] \ -state ${state} pack ${dbdir} -side top -anchor nw -fill x #database permissions set sn_options(opt_both,user-read) $sn_options(both,user-read) set sn_options(opt_both,user-write) $sn_options(both,user-write) set sn_options(opt_both,group-read) $sn_options(both,group-read) set sn_options(opt_both,group-write) $sn_options(both,group-write) set sn_options(opt_both,others-read) $sn_options(both,others-read) set sn_options(opt_both,others-write) $sn_options(both,others-write) foreach var {FilePermUser FilePermGroup FilePermOther} { lappend lbls "[get_indep String FilePermRead] [get_indep String\ ${var}]" lappend lbls "[get_indep String FilePermWrite] [get_indep String\ ${var}]" } set vars [list sn_options(opt_both,user-read)\ sn_options(opt_both,user-write) sn_options(opt_both,group-read)\ sn_options(opt_both,group-write) sn_options(opt_both,others-read)\ sn_options(opt_both,others-write)] set balloons [list [get_indep String OwnerRead] [get_indep String\ OwnerWrite] [get_indep String GroupRead] [get_indep String\ GroupWrite] [get_indep String OthersRead] [get_indep String\ OthersWrite]] set perms ${win}.perms CheckButton& ${perms} \ -labels ${lbls} \ -balloons ${balloons} \ -variables ${vars} \ -label [get_indep String Permissions] \ -labelunderline [get_indep Pos Permissions] \ -labelwidth ${xstep} pack ${perms} -side top -anchor nw #comment database set sn_options(opt_both,create-comment-db)\ $sn_options(both,create-comment-db) set commentdb ${win}.commentdb CheckButton& ${commentdb} \ -labels [list ""] \ -values [list {-r ""}] \ -variables sn_options(opt_both,create-comment-db) \ -label [get_indep String CommentDB] \ -labelunderline [get_indep Pos CommentDB] \ -labelwidth ${xstep} \ -balloons [list [get_indep String CommentDBINFO]] pack ${commentdb} -side top -anchor nw -fill x #database cache size is always editable set cache_state "normal" # database cache size set sn_options(opt_def,db_cachesize) $sn_options(def,db_cachesize) set dbcache ${win}.dbcache Entry& ${dbcache} \ -width 2 \ -labelwidth ${xstep} \ -label [get_indep String CacheSize] \ -underline [get_indep Pos CacheSize] \ -textvariable sn_options(opt_def,db_cachesize) \ -state ${cache_state} -filter natural pack ${dbcache} -side top -anchor nw -fill x pack [label ${dbcache}.dbbytes -text [get_indep String KBytes]]\ -side left -fill y #xref database cache size set sn_options(opt_def,xref-db-cachesize)\ $sn_options(def,xref-db-cachesize) set dbxcache ${win}.dbxcache Entry& ${dbxcache} \ -width 2 \ -labelwidth ${xstep} \ -label [get_indep String xrefCacheSize] \ -underline [get_indep Pos xrefCacheSize] \ -textvariable sn_options(opt_def,xref-db-cachesize) \ -state ${cache_state} -filter natural pack ${dbxcache} -side top -anchor nw -fill x pack [label ${dbxcache}.dbbytes \ -text [get_indep String KBytes]] \ -side left -fill y #Window options set fr [tixLabelFrame ${Project}.projfr \ -label [get_indep String Window]] ${fr} config -background $sn_options(def,layout-bg) set win [${Project}.projfr subwidget frame] pack ${fr} -side top -fill x #Split Windows set sn_options(opt_def,window-alighment)\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -