📄 classpane.tcl
字号:
set all_base_classes ${base_classes} foreach b ${base_classes} { set class_viewed(${b}) 1 } } method class_members {cname loc visib type {inherit 0}} { global SN_Scope_Bits sn_sep foreach p ${mixer_vars} { upvar #0 ${this}-mixer-${p} mv if {${mv}} { set v${p} ${p} } else { set v${p} "" } } if {[string trim "${vpublic} ${vprotected} ${vprivate}"] == ""} { set vpublic public set vprotected protected set vprivate private } set file [lindex ${loc} 0] if {[catch {set beg_line [expr int([lindex ${loc} 1])]}]} { set beg_line 1 } if {[catch {set end_line [expr int([lindex ${loc} 2])]}] ||\ ${end_line} == 0} { set end_line [expr 1024 * 1024] } #read all base classes and display thim in the tree list if {![info exists all_base_classes]} { get_subclasses ${cname} ${file} ${beg_line} ${end_line} } switch ${visib} { "class" - "baseclass" { set vis [convert_sym_to_bit "${vpublic} ${vprotected}\ ${vprivate}"] } "subclass" { set vis [convert_sym_to_bit "${vpublic} ${vprotected}"] } default { set vis [convert_sym_to_bit "${vpublic} ${vprotected}\ ${vprivate}"] } } set db_types "" foreach w ${type} { if {[::info commands paf_db_${w}] != ""} { lappend db_types ${w} } } set type ${db_types} #we make filtering in the c procedure by displaying the members #by using global variable set total "" #read members for the browsed class #we don't need to display the class name of #the browsed class set bitm [$itk_component(classtree) itemcget 0 -image] if {[string first "enabled" ${bitm}] != -1} { foreach w ${type} { set app [list "\(${w}\) "] #Line format: #0. Member #1. Parameter #2. Counter #3. Type #4. Class #5. file name #6. file position #7. flags foreach r [paf_db_${w} seq -end ${file} -col [list "1 ${app}"\ {7 "| 0000 "} {6 "| \{\} "} 3 "2 -${beg_line}:${end_line} "\ "5 :0:${vis} "] "${cname}${sn_sep}"] { lappend total ${r} } } } #read members for every base class and add it's contents in a list set cou 1 foreach c ${base_classes} { if {[lsearch -exact ${base_classes} ${c}] == -1} { continue } switch ${visib} { "baseclass" { set vis [convert_sym_to_bit "${vpublic} ${vprotected}\ ${vprivate}"] } "class" { set vis [convert_sym_to_bit "${vpublic} ${vprotected}"] } "subclass" { if {$base_class_in(${c}) == $SN_Scope_Bits(private)} { continue } set vis [convert_sym_to_bit "${vpublic} ${vprotected}"] } default { set vis [convert_sym_to_bit "${vpublic} ${vprotected}\ ${vprivate}"] } } foreach w ${type} { set app [list "\(${w}\) "] set n [format %04d ${cou}] #Line format: #0. Member #2. Parameter #3. Counter #1. Type #4. Class #5. file name #6. file position #7. flags eval lappend total [paf_db_${w} seq -col [list "1 ${app}"\ "7 \"| ${n} \"" "6 \"| \"" 0 3 2 "5 :0:${vis}"]\ "${c}${sn_sep}"] } incr cou } return [::lsort -command sn_compare ${total}] } protected variable last_browsed_class "" # Refill the combobox and redisplay the class browser. method RefreshAll {{cls_name ""} {loc ""} {vis ""} {flags ""} {reset 0}} { # Reinsert the class names into combobox. fill_combo # Restore flag settings. if {${flags} != ""} { set i 0 foreach p ${mixer_vars} { upvar #0 ${this}-mixer-${p} mv set mv [lindex ${flags} ${i}] incr i } } # Redisplay the browsed class. refresh ${cls_name} ${loc} ${reset} } # Because the combobox call the function with combo and with # the selected text, make a different function. method ComboRefresh_cb {classtype} { refresh } method refresh {{cls_name ""} {loc ""} {reset 0}} { # No class is selected. if {${cls_name} == ""} { set cls_name ${class_name} } if {${cls_name} == ""} { # No class specified. return 1 } #verify if class is availiable and return it's position if {${last_browsed_class} != ${cls_name} || ${reset}} { if {${loc} == ""} { #get the location of the browsed class set cnt [read_matched_from_db "" cl -exact ${cls_name}] if {[llength ${cnt}] > 1} { set cnt [lindex ${cnt} 0] } if {${cnt} == ""} { #class not availiable return 1 } else { set cnt [split ${cnt} \t] } set location [lrange ${cnt} 4 end] } else { set location ${loc} } catch {unset all_base_classes} } if {${cls_name} != "" && ${class_name} != ${cls_name}} { set class_name ${cls_name} } # Can never happen !!! if {${location} == ""} { catch {$itk_component(classtree) remove 0} ${this} configure -contents "" set last_browsed_class "" set base_classes "" set all_base_classes "" catch {unset base_class_in} catch {unset base_class_templ} return 1 } # Get needed values from member filter. set int "" foreach p [lrange ${mixer_vars} 6 end] { upvar #0 ${this}-mixer-${p} mv if {${mv}} { lappend int ${p} } } set int [convert_sym_to_bit ${int}] if {"${int}" == ""} { set int 0 } set member_filter ${int} # Mark last listed class. set last_browsed_class ${cls_name} # Build scopes for class members to be displayed. set qry "" upvar #0 ${this}-mixer-methods methods upvar #0 ${this}-mixer-instvar instvar upvar #0 ${this}-mixer-friends friends if {${methods}} { lappend qry md } if {${instvar}} { lappend qry iv } if {${friends}} { lappend qry fr } if {${qry} == ""} { set qry [list md iv fr] } # Display members into the member list. set membersData [${this} class_members ${cls_name}\ ${location} ${visible} ${qry}] $this configure -contents $membersData SetTitle if {$itk_option(-symbols) != ""} { $itk_option(-symbols) selecttext ${cls_name} } return 0 } method classname {} { return ${class_name} } # #procedure to call the class browser ##################################### proc Browse_Class {{name ""} {gotosymbol_str ""}} { global sn_options global tkeWinNumber set mwin [MultiWindow&::find_Reusable] if {![winfo exists ${mwin}]} { #create a new multiple window incr tkeWinNumber set mwin .multiwindow-${tkeWinNumber} MultiWindow& ${mwin} -raise classbr set active_wdg [${mwin} ActiveWidget] } else { #toggle to the class browser and display the #class ${mwin} view classbr set active_wdg [${mwin} ActiveWidget] } #goto method or class if {${gotosymbol_str} != ""} { eval ${active_wdg} gotosymbol ${gotosymbol_str} #goto only to classes } else { ${active_wdg} gotosymbol cl ${name} return set ret [${active_wdg} goto "" ${name}] if {${ret}} { #no class with the specified name bell return } sn_add_history class ${name} [sn_make_history_title browse\ "" ${name}] sn_classbrowser } } method print {} { $itk_component(memberlist) print_dialog_box } method filter {{all 0}} { if {$itk_option(-symbols) == ""} { return } upvar #0 $itk_option(-symbols_filter)-related related # Verify if there are classes availiable if {[::info commands paf_db_cl] != ""} { # Display only related classes if {${related}} { $itk_option(-symbols) configure -contents [::lunique [::lsort -command sn_compare\ [concat ${class_name} ${base_classes}]]] set displayed 0 # Display all classes } else { $itk_option(-symbols) configure -contents [paf_db_cl seq -col 0] set displayed 1 } } else { $itk_option(-symbols) configure -contents "" } } # This function is called, when the symbols combobox # is called. method postcommand {m} { if {! ${displayed}} { filter set displayed 1 } } # That meens that the notepad is changed to this view # View the related toolbar buttons and enable # the menu entries for the class browser. method activate {} { #display the contents always by activating set displayed 0 if {$itk_option(-menu) != ""} { set mn [string range $itk_option(-menu) 0 [expr [string last "." $itk_option(-menu)] - 1]] ${mn} entryconfig [get_indep String MultiClass] -state normal } if {$itk_option(-toolbar) != ""} { pack $itk_option(-toolbar).clsfr -side left } # Display current class name if {$itk_option(-symbols) != ""} { $itk_option(-symbols) configure -entrytext ${class_name} } } # The notepad is changed to a different # view. Hide the related toolbar buttons and disable # the menu entries for the class browser. method deactivate {} { # Hide filter window, if availiable. if {[winfo exists ${this}-mixer]} { ${this}-mixer delete } if {$itk_option(-menu) != ""} { set mn [string range $itk_option(-menu) 0 [expr [string last "." $itk_option(-menu)] - 1]]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -