📄 classpane.tcl
字号:
${mn} entryconfig [get_indep String MultiClass] -state disabled } if {$itk_option(-toolbar) != ""} { pack forget $itk_component(toolbar) } } method gotosymbol {{scope ""} {sym ""} {cls ""} {file ""} {from ""} {type\ ""} {prm ""} {to ""} {always 1}} { #goto class if {${scope} == "cl" || ${scope} == "" || ${cls} != "" && ${sym} ==\ ""} { return [goto "" ${sym}] } #here twice must be availiable (class and member) if {${sym} == "" || ${cls} == ""} { #something wrong!! return 1 } #first goto class if {[goto "" ${cls}]} { #invalid class name return 1 } #now we want to select the given member in the list if {${scope} == "mi"} { #all displayed methods are declarations set scope "md" } set str "${sym}(${scope})\t\t" set idx [[$itk_component(memberlist) tree] search -begins ${str} 0] if {${idx} != ""} { $itk_component(memberlist) selectnum ${idx} } return 0 } method goto {combo cls} { set cls [string trim ${cls}] if {${cls} == ""} { return 1 } # Already selected. if {${class_name} == ${cls}} { return 0 } # Dump the current view into the history stack. ${topw} history_stack_add_point ${this} # Verify if the class is availiable. set res [refresh ${cls}] if {${res}} { # Invalid class name. return 1 } # Select the current class in the upper combo box. if {$itk_option(-symbols) != ""} { $itk_option(-symbols) selecttext ${cls} } # Class displayed successfull. return 0 } # Return selected class or selected member method Selection {} { global sn_options sn_sep # Is a member selected? set sel [$itk_component(memberlist) curselection] if {${sel} != ""} { set txt [Retriever&::convert_to_line $itk_component(memberlist)] set txt [split ${txt} \t] get_key_and_scope [lindex ${txt} 0] sym scope set cls [lindex ${txt} 1] if {${cls} == ""} { set cls ${class_name} } set typ [lindex ${txt} 2] set prm [lindex ${txt} 3] set fil [lindex ${txt} 4] set lin [lindex ${txt} 5] # Goto definition or implementation (optional). if {$sn_options(def,class-goto-imp) == "imp"} { if {${scope} == "md"} { set scope "mi" set ffil "" set llin "" set ccls ${cls} set mod 1 }\ elseif {${scope} == "fr"} { set scope "fu" set ffil "" set llin "" # Friend impl. has no class name. set ccls "" set mod 1 } else { set mod 0 } # Get file and position name, if nothing is found # about implementation, goto definition. if {${mod}} { set pat [string trim "${ccls}${sn_sep}${sym}" " ${sn_sep}"] # Build a search string, so that a match is looked for # on the priority of the options. lappend looking_list [list ${typ} ${prm} ${fil}] lappend looking_list [list ${typ} ${prm} ""] lappend looking_list [list "" ${prm} ${fil}] lappend looking_list [list "" ${prm} ""] lappend looking_list [list "" "" ""] foreach look ${looking_list} { set tt [lindex ${look} 0] set pp [lindex ${look} 1] set ff [lindex ${look} 2] # Don't make the same fetch again! if {[info exists looking_arr(${tt},${pp},${ff})]} { continue } set looking_arr(${tt},${pp},${ff}) 1 # 1. Try to find something in the current file. set cnt [read_matched_from_db "" ${scope}\ -exact ${pat} ${tt} ${pp} ${ff}] # Give up if nothing is found!! if {${cnt} != ""} { set cnt [split [lindex ${cnt} 0] \t] set typ [lindex ${cnt} 1] set prm [lindex ${cnt} 2] set fil [lindex ${cnt} 4] set lin [lindex ${cnt} 5] set cls ${ccls} break } } catch {unset looking_list} catch {unset looking_arr} } } return [list ${scope} ${sym} ${cls} ${fil} ${lin} ${typ} ${prm} ""] } # Is a class selected? set sel [$itk_component(classtree) curselection] if {${sel} != ""} { return [list cl [$itk_component(classtree) get ${sel}] "" "" "" "" "" ""] } # Nothing is selected, return the current browsed class. if {${class_name} != ""} { return [list cl ${class_name} "" "" "" "" "" ""] } return "" } method clearselection {} { $itk_component(memberlist) selection clear 0 end $itk_component(classtree) selection clear 0 end } method Focus {} { focus [$itk_component(memberlist) tree] } #make a title for the Dump position, this is usefull #for the views stack (prev/next) method DumpTitle {{dump ""}} { if {${dump} == ""} { set dump [Dump] } set scope [lindex ${dump} 0] if {${scope} == "cl"} { set cls [lindex ${dump} 1] set mtd "" } else { set mtd [lindex ${dump} 1] set cls [lindex ${dump} 2] } if {${mtd} == ""} { return "Class ${cls}" } else { return "Class ${mtd}(${scope}) ${cls}" } } method AddHistoryFromDump {dump title} { set scope [lindex ${dump} 0] if {${scope} == "cl"} { set cls [lindex ${dump} 1] set mtd "" } else { set mtd [lindex ${dump} 1] set cls [lindex ${dump} 2] } if {${mtd} == ""} { set name ${cls} } else { set name "${mtd}(${scope}) ${cls}" } sn_add_history class [list "" ${dump}] [sn_make_history_title browse\ "" ${name}] sn_classbrowser } #return the important data to restore this widget #in later time again (used by saving the project) method Dump {} { return [Selection] } #gets the result from the function "Dump" to #restore the older state (used by restoring the project) method Restore {str} { eval ${this} gotosymbol ${str} #Focus } method Refresh_Display {} { global sn_options refresh ${class_name} "" 1 } method Update_Layout {} { global sn_options } method Close {{mode 0}} { return 1 } method whoami {} { return classbr } method fillcbwrapper {{cls ""} {data ""}} { $this fill 0 } method fill {{bsy 1}} { global sn_options if {![winfo exists [namespace tail ${this}]]} { return } if {${bsy}} { $itk_component(memberlist) config -state disabled } set y [lindex [$itk_component(memberlist) yview] 0] set filter [$itk_component(memberlist) getfilter] # Check new contents to view only filtered values. if {${filter} != "*"} { # There is no option currently for changing # where the pattern filter will be case dependant # or not, so for now lets assume nocase until # we have other a preference option. set nocase 1 if {${nocase}} { set flt [Tree::nocase_glob_pattern ${filter}] } else { set flt ${filter} } set show [lmatch -glob 0 $itk_option(-contents) ${flt}] } else { set show $itk_option(-contents) } # Display contents in the browse list. class_browser_insert \ -delete $itk_component(memberlist).tree ${show}\ [itcl::scope base_classes_of] [itcl::scope sub_classes_of] \ [itcl::scope class_viewed] ${overridden}\ ${member_filter} $sn_options(def,public-font)\ $sn_options(def,protected-font) $sn_options(def,private-font)\ ${class_name} ${and} $itk_component(memberlist) SyncTabs if {${bsy}} { $itk_component(memberlist) config -state normal } } protected variable topw protected variable displayed 0 protected variable base_classes "" protected variable all_base_classes "" protected variable base_class_in "" protected variable base_class_templ "" protected variable tree "" protected variable memlist "" protected variable ClassTitle "" protected variable mixer_vars "methods instvar friends public private protected\ static structor inline virtual {pure virtual} overridden overloaded" protected variable can itk_option define -classname classname Classname "" { goto "" $itk_option(-classname) } public variable location "" public variable flags "" public variable width 80 public variable height 30 public variable class_doubleclickcommand "" public variable class_selectcommand "" protected variable overridden "0" private variable member_filter "0" private variable class_name "" private variable and "" # Array that maps a class name to a boolean # to record if a given class has been viewed private variable class_viewed private variable visible 0 # Array that maps a class name to a subclass name private variable sub_classes_of # Array that mapes a class name to its base classes private variable base_classes_of itk_option define -contents contents Contents "" { if {[info exists itk_component(memberlist)]} { ${this} fill 0 } }}proc sn_classbrowser {{name ""} {gotosymbol_str ""}} { global Switch_Is_Enabled incr Switch_Is_Enabled -1 #verify if we want to use the multi window mode? Class&::Browse_Class ${name} ${gotosymbol_str} incr Switch_Is_Enabled 1}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -