⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hyperhelp.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 2 页
字号:
}# ------------------------------------------------------------------# OPTION: -helpdir## Set location of help files# ------------------------------------------------------------------itcl::configbody iwidgets::Hyperhelp::helpdir {    if {[file pathtype $itk_option(-helpdir)] == "relative"} {      configure -helpdir [file join [pwd] $itk_option(-helpdir)]    } else {      set _history {}      set _history_len 0      set _history_ndx -1      $itk_component(navmenu) entryconfig 0 -state disabled      $itk_component(navmenu) entryconfig 1 -state disabled      configure -topics $itk_option(-topics)   }}# ------------------------------------------------------------------# OPTION: -closecmd## Specify the command to execute when close is selected from the menu# ------------------------------------------------------------------itcl::configbody iwidgets::Hyperhelp::closecmd {  $itk_component(topicmenu) entryconfigure last -command $itk_option(-closecmd) }# ------------------------------------------------------------------#                            METHODS# ------------------------------------------------------------------# ------------------------------------------------------------------# METHOD: showtopic topic## render text of help topic <topic>. The text is expected to be found in# <helpdir>/<topic>.html# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::showtopic {topic} {  if ![regexp {(.*)#(.*)} $topic dummy topicname anchorpart] {    set topicname $topic    set anchorpart {}  }  if {$topicname == ""} {    set topicname $_file    set filepath $_file  } else {    set filepath $itk_option(-helpdir)/$topicname.html  }  if {[incr _history_ndx] < $itk_option(-maxhistory)} {    set _history [lrange $_history 0 [expr {$_history_ndx - 1}]]    set _history_len [expr {$_history_ndx + 1}]  } else {    incr _history_ndx -1    set _history [lrange $_history 1 $_history_ndx]    set _history_len [expr {$_history_ndx + 1}]  }  lappend _history [list $topicname $filepath $anchorpart]  _readtopic $filepath $anchorpart}# ------------------------------------------------------------------# METHOD: followlink link## Callback for click on a link. Shows new topic.# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::followlink {link} {  if {[string compare $beforelink ""] != 0} {    eval $beforelink $link  }  if ![regexp {(.*)#(.*)} $link dummy filepart anchorpart] {    set filepart $link    set anchorpart {}  }  if {$filepart != "" && [string index [file dirname $filepart] 0] != "/" && \      [string index [file dirname $filepart] 0] != "~"} {    set filepart [$itk_component(scrtxt) pwd]/$filepart    set hfile $filepart  } else {    set hfile $_file  }  incr _history_ndx  set _history [lrange $_history 0 [expr {$_history_ndx - 1}]]  set _history_len [expr {$_history_ndx + 1}]  lappend _history [list [file rootname [file tail $hfile]] $hfile $anchorpart]  set ret [_readtopic $filepart $anchorpart]  if {[string compare $afterlink ""] != 0} {    eval $afterlink $link  }  return $ret}# ------------------------------------------------------------------# METHOD: forward## Show topic one forward in history list# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::forward {} {    if {$_rendering || ($_history_ndx+1) >= $_history_len} return    incr _history_ndx    eval _readtopic [lrange [lindex $_history $_history_ndx] 1 end]}# ------------------------------------------------------------------# METHOD: back## Show topic one back in history list# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::back {} {    if {$_rendering || $_history_ndx <= 0} return    incr _history_ndx -1    set _histdir 1    eval _readtopic [lrange [lindex $_history $_history_ndx] 1 end]}# ------------------------------------------------------------------# METHOD: updatefeedback remaining## Callback from text to update feedback widget# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::updatefeedback {n} {    if {($_remaining - $n) > .1*$_len} {      [$itk_interior.feedbackshell childsite].helpfeedback step [expr {$_remaining - $n}]      update idletasks      set _remaining $n    }}# ------------------------------------------------------------------# PRIVATE METHOD: _readtopic ## Read in file, render it in text area, and jump to anchorpoint# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::_readtopic {file {anchorpoint {}}} {    if {$file != ""} {        if {[string compare $file $_file] != 0} {            if {[catch {set f [open $file r]} err]} {                incr _history_ndx $_histdir                set _history_len [expr {$_history_ndx + 1}]                set _histdir -1                set m $itk_component(navmenu)                if {($_history_ndx+1) < $_history_len} {                    $m entryconfig 0 -state normal                } else {                    $m entryconfig 0 -state disabled                }                if {$_history_ndx > 0} {                    $m entryconfig 1 -state normal                } else {                    $m entryconfig 1 -state disabled                }                return            }            set _file $file            set txt [read $f]            iwidgets::shell $itk_interior.feedbackshell -title \                    "Rendering HTML" -padx 1 -pady 1            iwidgets::Feedback [$itk_interior.feedbackshell \                    childsite].helpfeedback \            -steps [set _len [string length $txt]] \                    -labeltext "Rendering HTML" -labelpos n            pack [$itk_interior.feedbackshell childsite].helpfeedback            $itk_interior.feedbackshell center $itk_interior            $itk_interior.feedbackshell activate            set _remaining $_len            set _rendering 1            if {[catch {$itk_component(scrtxt) render $txt [file dirname \                    $file]} err]} {                if [regexp "</pre>" $err] {                    $itk_component(scrtxt) render "<tt>$err</tt>"                } else {                    $itk_component(scrtxt) render "<pre>$err</pre>"                }            }            wm title $itk_component(hull) "Help: $file"            itcl::delete object [$itk_interior.feedbackshell \                    childsite].helpfeedback            itcl::delete object $itk_interior.feedbackshell            set _rendering 0        }    }    set m $itk_component(navmenu)    if {($_history_ndx+1) < $_history_len} {        $m entryconfig 0 -state normal    } else {        $m entryconfig 0 -state disabled    }    if {$_history_ndx > 0} {        $m entryconfig 1 -state normal    } else {        $m entryconfig 1 -state disabled    }    if {$anchorpoint != {}} {        $itk_component(scrtxt) import -link #$anchorpoint    } else {        $itk_component(scrtxt) import -link #    }    set _histdir -1}# ------------------------------------------------------------------# PRIVATE METHOD: _fill_go_menu## update go submenu with current history# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::_fill_go_menu {} {    set m $itk_component(navgo)    catch {$m delete 0 last}    for {set i [expr {$_history_len - 1}]} {$i >= 0} {incr i -1} {        set topic [lindex [lindex $_history $i] 0]        set filepath [lindex [lindex $_history $i] 1]        set anchor [lindex [lindex $_history $i] 2]        $m add command -label $topic \                -command [list $this followlink $filepath#$anchor]    }}# ------------------------------------------------------------------# PRIVATE METHOD: _pageforward## Callback for page forward shortcut key# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::_pageforward {} {    $itk_component(scrtxt) yview scroll 1 pages}# ------------------------------------------------------------------# PRIVATE METHOD: _pageback## Callback for page back shortcut key# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::_pageback {} {    $itk_component(scrtxt) yview scroll -1 pages}# ------------------------------------------------------------------# PRIVATE METHOD: _lineforward## Callback for line forward shortcut key# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::_lineforward {} {     $itk_component(scrtxt) yview scroll 1 units }# ------------------------------------------------------------------# PRIVATE METHOD: _lineback## Callback for line back shortcut key# ------------------------------------------------------------------itcl::body iwidgets::Hyperhelp::_lineback {} {     $itk_component(scrtxt) yview scroll -1 units }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -