📄 rcs.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.# # rcs.tcl - The version control browser.# Copyright (C) 1998 Cygnus Solutions.itcl::class RevisionCtrl& { inherit sourcenav::Window # Builds the toplevel window for the Project Editor, called '$this' constructor {args} { global sn_options sn_path set font $sn_options(def,default-font) eval itk_initialize $args # loaded project source code files relative to the main # project directory which are not hidden: set proj_files [sn_project_file_list 0] sn_create_window $itk_component(hull) #only one window $itk_component(hull).status.reuse config -state disabled #------------------------------------------------------------------ # Split the main Window into three parts: # Top: Selected Files, Actions, Unloaded Files # Bottom: Symbols and history #------------------------------------------------------------------ PanedWindow $itk_component(hull).p -width 900 -height 600 -fraction "0.55"\ -orientation y -min 0 set tp [lindex [$itk_component(hull).p panes] 0] set bp [lindex [$itk_component(hull).p panes] 1] #-------------------------------------------------------------- # Split the top part into selected and (actions+unloaded) #-------------------------------------------------------------- set selected ${tp} set selected_list ${tp}.selected #------------------------------------------------------------------ # Build Menu-Frame for $this #------------------------------------------------------------------ set m $itk_component(hull).menu ${m}.edit insert 0 separator ${m}.edit insert 0 command -label [get_indep String Statistics]\ -underline [get_indep Pos Statistics] -command " sn_statistic " set m ${m}.edit ${m} configure -postcommand "[info class]::set_menu_state ${m}\ ${selected_list} ${this}" ${m} insert 0 command -label [get_indep String ChooseCheckOut]\ -underline [get_indep Pos ChooseCheckOut] -command " ${this}\ check_in_out co " ${m} insert 1 command -label [get_indep String ChooseDiscard]\ -underline [get_indep Pos ChooseDiscard] -command " ${this}\ check_in_out unco " ${m} insert 2 command -label [get_indep String ChooseCheckIn]\ -underline [get_indep Pos ChooseCheckIn] -command " ${this}\ check_in_out ci " ${m} insert 3 command -label [get_indep String ChooseDel]\ -underline [get_indep Pos ChooseDel] -command " ${this} check_in_out\ del " ${m} insert 4 command -label [get_indep String ChooseLock]\ -underline [get_indep Pos ChooseLock] -command " ${this}\ check_in_out lock " ${m} insert 5 command -label [get_indep String ChooseUnlock]\ -underline [get_indep Pos ChooseUnlock] -command " ${this}\ check_in_out unlock " ${m} insert 6 separator ${m} insert 7 command -label [get_indep String ChooseDiff]\ -underline [get_indep Pos ChooseDiff] -command " ${this} diff " ${m} insert 8 separator #------------------------------------------------------------------ # Split the bottom part into Symbols and History #------------------------------------------------------------------ PanedWindow ${bp}.rcslog -fraction 0.2 -orientation x pack ${bp}.rcslog -fill both -expand y set symbols [lindex [${bp}.rcslog panes] 0] set history [lindex [${bp}.rcslog panes] 1] #------------------------------------------------------------------ # Build views-chooser in express line #------------------------------------------------------------------ set views [paf_db_proj get -key views] set cur [paf_db_proj get -key db_exclude] if {${views} == ""} { set views "default" } set val [list] foreach v ${views} { eval lappend val [lindex ${v} 0] } Combo& $itk_component(hull).exp.view -width 20 -label\ [get_indep String View] -contents ${val}\ -selectcommand "$this open_view" set active [$itk_component(hull).exp.view selecttext ${cur}] pack $itk_component(hull).exp.view -side left #------------------------------------------------------------------ # Build button line at bottom #------------------------------------------------------------------ pack $itk_component(hull).p -fill both -expand y label ${selected}.label -anchor w -text [get_indep String ChooseFiles] set itk_option(-input) ${proj_files} set font $sn_options(def,default-font) #------------------------------------------------------------------ # Build top paned window #------------------------------------------------------------------ Selector& ${selected_list} -exportselection n\ -selectmode extended -font ${font}\ -bitmap @$sn_path(bitmapdir)/file.xbm -contents $itk_option(-input) set rcs_hist_top ${history}.top set rcs_hist_show ${history}.show ${selected_list} treebind <Double-1> "${this} edit_file" ${selected_list} treebind <Double-3> "${this} edit_file" ${selected_list} treebind <Return> "${this} edit_file; break" ${selected_list} treebind <space> "${this} edit_file; break" pack ${selected}.label -fill x pack ${selected_list} -fill both -expand y ${this} configure -title [sn_title [get_indep String RevisionControlEditorNoKey]] ${this} configure -iconname Editor #------------------------------------------------------------------ # Build bottom paned window #------------------------------------------------------------------ frame ${rcs_hist_top} label ${rcs_hist_top}.l -text [get_indep String ChooseHistory]\ -textvariable ${this}-history pack ${rcs_hist_top}.l -fill x -expand y -side left # Add a pull down menu at the history window to choose on of the # (or all) revision-logs to display: Combo& ${rcs_hist_top}.r -width 15 \ -selectcommand "${this} log_revision" pack ${rcs_hist_top}.r -side left set rcs_symb_top ${symbols}.top set rcs_symb_show ${symbols}.show label ${rcs_symb_top} -text [get_indep String SymbolicTags] listbox ${rcs_hist_show} -font ${font} pack ${rcs_hist_top} -fill x pack ${rcs_hist_show} -fill both -expand y listbox ${rcs_symb_show} -font ${font} pack ${rcs_symb_top} -fill x -pady 5 pack ${rcs_symb_show} -fill both -expand y #--------------------------------------------------------------------- # What to do if there is a mouse click on a file: # a) No version control: # Clear the selection of the 'unloaded' list # b) A new file has been selected: # Show rcs data #--------------------------------------------------------------------- set l ${selected_list}.list_text.list ${selected_list} treebind <1> " ${this} show_log \[%W get \[%W nearest %y\]\] ${rcs_hist_show}\ ${rcs_symb_show} 1 %W activate \[%W nearest %y\] " ${selected_list} treebind <3> "${this} show_log \[%W get \[%W nearest\ %y\]\] ${rcs_hist_show} ${rcs_symb_show} 1" ${this} move_to_mouse ${this} take_focus ${selected_list} activate end toggle_show #call user defined procedure catch {sn_rc_project_editor $itk_component(hull) ${this}.menu ${selected_list}} } destructor { foreach v [info globals ${this}] { uplevel #0 unset ${v} } } proc set_menu_state {menu sel_list cls} { global sn_options global sn_verctl_options set rcstype $sn_options(both,rcs-type) if {![info exists sn_verctl_options(${rcstype},checkout)] || ![info\ exists sn_verctl_options(${rcstype},checkout-exclusive)] || ![info\ exists sn_verctl_options(${rcstype},checkout-individual)]} { ${menu} entryconfig 0 -state disabled } if {![info exists sn_verctl_options(${rcstype},discard)]} { ${menu} entryconfig 1 -state disabled } if {!([info exists sn_verctl_options(${rcstype},checkin)] && ![info\ exists sn_verctl_options(${rcstype},checkin-exclusive)]) || ![info\ exists sn_verctl_options(${rcstype},checkin-comment-via)]} { ${menu} entryconfig 2 -state disabled } if {![info exists sn_verctl_options(${rcstype},delete-revision)]} { ${menu} entryconfig 3 -state disabled } if {![info exists sn_verctl_options(${rcstype},lock)] || ![info exists\ sn_verctl_options(${rcstype},lock-individual)]} { ${menu} entryconfig 4 -state disabled
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -