📄 preferences.tcl
字号:
$sn_options(def,include-locatefiles) set lookforinc ${win}.lookforinc CheckButton& ${lookforinc} \ -labels [list [get_indep String LocateIncludeFiles]] \ -underlines [list [get_indep Pos LocateIncludeFiles]] \ -variables sn_options(opt_def,include-locatefiles) \ -balloons [list [get_indep String LocateIncludeFilesINFO]] \ -label "" \ -labelwidth 35 pack ${lookforinc} -side top -anchor nw set inc_editor ${win}.t scrollbar ${win}.x -orient horiz -command " ${inc_editor} xview " scrollbar ${win}.y -command " ${inc_editor} yview " text ${inc_editor} -wrap none -xscrollcommand "${win}.x set"\ -yscrollcommand "${win}.y set" ${inc_editor} insert end [join $sn_options(include-source-directories)\ "\n"] ${inc_editor} mark set insert 0.0 ${inc_editor} see 0.0 pack ${win}.y -side right -fill y pack ${win}.x -side bottom -fill x pack ${inc_editor} -side left -fill both -expand y # Don't dismiss entire dialog when Return key is presed in editor bindtags ${inc_editor} {Text all} lappend AvailTools ${Include} } method RaiseInclude {} { #set lastPage incbr } ##################################################### # Parser ##################################################### method AddParser {nb page} { global sn_options global Avail_Parsers Parser_Info global opt_Parser_Info set ParserPage [${nb} subwidget ${page}] set Parser ${ParserPage} #language extensitions #copy parser info foreach tt [array names Parser_Info] { set opt_Parser_Info(${tt}) $Parser_Info(${tt}) } set ext [tixLabelFrame ${Parser}.ext -label [get_indep String\ LanguageExt]] ${ext} config -background $sn_options(def,layout-bg) set win [${Parser}.ext subwidget frame] pack ${ext} -fill x -side top -anchor c label $win.label -text [get_indep String LanguageExtLanguage] # Figure out how many chars wide the combo should be. # Default to the first parser in the list. set max_width 5 set default_type "" foreach type [lsort -dictionary ${Avail_Parsers}] { set width [string length $type] if {$width > $max_width} { set max_width $width } if {[string equal $default_type ""]} { set default_type $type } } incr max_width 1 set extension_entry ${win}.ext_entry set editor_entry ${win}.edit_entry set combo ${win}.combo combobox::combobox $combo \ -editable 0 \ -width $max_width foreach type [lsort -dictionary ${Avail_Parsers}] { $combo listinsert end $type } grid $win.label -row 0 -column 0 -sticky ew grid $combo -row 0 -column 1 -sticky ew -pady 5 label $win.ext_label -text [get_indep String LanguageExtFileExtensions] entry $extension_entry grid $win.ext_label -row 1 -column 0 -sticky w -pady 5 grid $extension_entry -row 1 -column 1 -sticky we -columnspan 2 label $win.edit_label -text [get_indep String ExternalEditor] entry $editor_entry grid $win.edit_label -row 2 -column 0 -sticky w -pady 5 grid $editor_entry -row 2 -column 1 -sticky we -columnspan 2 grid columnconfigure ${win} 2 -weight 1 #Macro files set macfr [tixLabelFrame ${Parser}.macros -label [get_indep String\ MacroFiles]] ${macfr} config -background $sn_options(def,layout-bg) set win [${Parser}.macros subwidget frame] pack ${macfr} -side top -anchor c -fill x set macros ${win}.edit set sn_options(opt_macrofiles) $sn_options(macrofiles) button ${win}.add -text [get_indep String Choose] -command " ${this}\ choose_macrofile ${macros} " balloon_bind_info ${win}.add [get_indep String ChooseINFO] pack ${win}.add -side right -anchor nw pack [scrollbar ${win}.y -command " ${macros} yview "] -side right\ -fill y pack [text ${macros} -wrap word -height 5 -yscrollcommand\ "${win}.y set"] -side left -fill x -expand y bind ${macros} <Tab> {focus [tk_focusNext %W]; break} bind ${macros} <Shift-Tab> {focus [tk_focusPrev %W]; break} ${macros} insert 0.0 [join $sn_options(opt_macrofiles) \n] balloon_bind_info ${macros} [get_indep String AddYourMacroFiles] # Set parser type selected callback and invoke it once with # the default type to get things in the proper state. $combo configure -command \ [itcl::code parser_type_combo_changed $extension_entry $editor_entry \ $win.add $macros] $combo entryset $default_type parser_type_combo_changed $extension_entry $editor_entry \ $win.add $macros $combo $default_type lappend AvailTools ${Parser} } method RaiseParser {} { #set lastPage parser } # Invoked when a new type is selected in the parser combo box. # This will set the textvar used by the extension and editor # entries and disable or enable the macro widgets. proc parser_type_combo_changed { extension_widget editor_widget macro_button_widget macro_text_widget combo_widget type } { $extension_widget configure -textvariable opt_Parser_Info(${type},SUF) $editor_widget configure -textvariable opt_Parser_Info(${type},EDIT) if {[string equal $::opt_Parser_Info(${type},MACRO) ""]} { $macro_button_widget configure -state disabled $macro_text_widget configure -state disabled } else { $macro_button_widget configure -state normal $macro_text_widget configure -state normal } } #add macro file, if not availiable method choose_macrofile_cb {cls file} { set files [string trim [${cls} get 0.0 end]] foreach f [split ${files} \n] { if {${f} == ${file}} { bell return } } if {${files} == ""} { ${cls} insert 0.0 ${file} } else { ${cls} insert end "\n${file}" } } method choose_macrofile {cls} { Editor&::FileDialog ${this} -title [get_indep String Open]\ -script "${this} choose_macrofile_cb ${cls}" -defaultextension ".h" }# FIXME: code to manage parsing of a project should not be in the prefs !!! proc Reparse {{ask "ask"} {reopen "reopen"}} { global sn_options if {${ask} == "ask"} { set answer [tk_dialog auto [get_indep String Reparse]\ [get_indep String DoYouWantToReparse] question_image 0\ [get_indep String Ok] [get_indep String Cancel]] if {${answer} != 0} { return "break" } } sn_log "reparse project <$sn_options(sys,project-file)>" #make sure that we stay in the correct directory catch {cd $sn_options(sys,project-dir)} if {[sn_processes_running 1]} { sn_error_dialog [get_indep String BackProcsRun] return "break" } #delete database files set ret [sn_db_delete_files $sn_options(sys,project-dir)\ $sn_options(db_files_prefix) 0] #databases couldn't be removed if {${ret} != 1} { set answer [tk_dialog auto [get_indep String Delete]\ [get_indep String DatabaseFilesCouldNotBeDeleted] question_image\ 0 [get_indep String Continue] [get_indep String Cancel]] if {${answer} != 0} { return "break" } set ret 1 } if {[info commands paf_db_exclude] != ""} { paf_db_exclude close } set_project_dir_files #reparse the project now set ret [sn_parse_uptodate] hide_loading_message if {${ret} == 0} { sn_error_dialog [get_indep String UnableToReparse] set ret "break" } else { set ret "success" } return ${ret} } ##################################################### # Rcs ##################################################### method AddRcs {nb page} { global sn_options set RcsPage [${nb} subwidget ${page}] set Rcs ${RcsPage} #Revision Control System set rcsys [tixLabelFrame ${Rcs}.rcsys -label [get_indep String PrefRcs]] ${rcsys} config -background $sn_options(def,layout-bg) set win [${Rcs}.rcsys subwidget frame] pack ${rcsys} -fill x -side top -anchor c #choose revision control set sn_options(opt_both,rcs-type) $sn_options(both,rcs-type) set sys ${win}.sys set lbls "" set values "" foreach rcs $sn_options(sys,supported-vcsystems) { lappend lbls [lindex ${rcs} 0] lappend values [lindex ${rcs} 1] } Radio& ${sys} -variable sn_options(opt_both,rcs-type) -labels ${lbls}\ -contents ${values} -label "" pack ${sys} -side top -expand y -fill x # Ignore directories set ignoredir [tixLabelFrame ${Rcs}.ignoredir \ -label [get_indep String IgnoredDirectories]] ${ignoredir} config -background $sn_options(def,layout-bg) set win [${Rcs}.ignoredir subwidget frame] pack ${ignoredir} -side top -anchor c -fill both set ign_editor ${win}.t scrollbar ${win}.y -command " ${ign_editor} yview " text ${ign_editor} -height 6 -wrap none -yscrollcommand "${win}.y set" # bindtags $ign_editor [list $ign_editor Text all] ${ign_editor} insert end [join $sn_options(def,ignored-directories)\ "\n"] ${ign_editor} mark set insert 0.0 ${ign_editor} see 0.0 pack ${win}.y -side right -fill y pack ${ign_editor} -side left -fill both -expand y lappend AvailTools ${Rcs} } method RaiseRcs {} { #set lastPage rcs } ##################################################### # Others ##################################################### method AddOthers {nb page} { global sn_options tcl_platform set OthersPage [${nb} subwidget ${page}] set Others ${OthersPage} #Make settings set make [tixLabelFrame ${Others}.make -label [get_indep String\ PrefMake]] ${make} config -background $sn_options(def,layout-bg) set win [${Others}.make subwidget frame] pack ${make} -fill x -side top -anchor c #Make command set sn_options(opt_both,make-command) $sn_options(both,make-command) set makecmd ${win}.makecmd LabelEntryButton& ${makecmd} -text "" -anchor nw\ -variable sn_options(opt_both,make-command) -native 1\ -extensions $sn_options(executable_ext)\ -defaultextension $sn_options(executable_defaultext) pack ${makecmd} -side top -anchor nw -fill x # Windows will use fault HTML viewer. if {$tcl_platform(platform)!="windows"} { #Help settings set help [tixLabelFrame ${Others}.help -label [get_indep String\ PafHtmlView]] ${help} config -background $sn_options(def,layout-bg) set win [${Others}.help subwidget frame] pack ${help} -fill x -side top -anchor c #HTML viewer set sn_options(opt_def,html-viewer) $sn_options(def,html-viewer) set html ${win}.html LabelEntryButton& ${html} -text "" -anchor nw\ -variable sn_options(opt_def,html-viewer)\ -extensions $sn_options(executable_ext)\ -defaultextension $sn_options(executable_defaultext) pack ${html} -side top -anchor nw -fill x } #no printer commands on windows if {$tcl_platform(platform) != "windows"} { #Printer set printer [tixLabelFrame ${Others}.printer -label\ [get_indep String PrefPrinter]] ${printer} config -background $sn_options(def,layout-bg) set win [${Others}.printer subwidget frame] pack ${printer} -fill x -side top -anchor c #Ascii Print command set sn_options(opt_def,ascii-print-command)\ $sn_options(def,ascii-print-command)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -