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

📄 panedwindow.itk

📁 windows下的GDB insight前端
💻 ITK
📖 第 1 页 / 共 3 页
字号:
      set minaft [$itk_component([lindex $_activePanes $i]) cget -minimum]      set _minheight($i) [expr {$minaft + (2 * $margaft)}]      incr totMinHeight $_minheight($i)    }    set _dragging [expr {$_dimension > $totMinHeight}]    grab  $itk_component(sash$num)    raise $itk_component(separator$num)    raise $itk_component(sash$num)        $itk_component(sash$num) configure -relief sunken}# ------------------------------------------------------------------# PROTECTED METHOD: _endGrip where num## Ends the sash drag and drop operation.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_endGrip {where num} {    $itk_component(sash$num) configure -relief $_relief($itk_option(-showhandle))    grab release $itk_component(sash$num)    if {$_dragging} {      _calcFraction [expr {$_sashloc($num) + $where}] $num      _placePanes [expr {$_minsashmoved - 1}] $_maxsashmoved      set _dragging 0    }}# ------------------------------------------------------------------# PROTECTED METHOD: _configGrip where num## Configure  action for sash.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_configGrip {where num} {   set _sashloc($num) $where}# ------------------------------------------------------------------# PROTECTED METHOD: _handleGrip where num## Motion action for sash.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_handleGrip {where num} { if {$_dragging} {  _moveSash [expr {$where + $_sashloc($num)}] $num  incr _movecount  if {$_movecount>4} {    set _movecount 0    update idletasks  } }}# ------------------------------------------------------------------# PROTECTED METHOD: _moveSash where num## Move the sash to the absolute pixel location# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_moveSash {where num} {  set _minsashmoved [expr {($_minsashmoved<$num)?$_minsashmoved:$num}]  set _maxsashmoved [expr {($_maxsashmoved>$num)?$_maxsashmoved:$num}]  set oldfrac $_frac($num)  _calcFraction $where $num  if {$_frac($num)!=$oldfrac} { _placeSash $num }}# ------------------------------------------------------------------# PRIVATE METHOD: _setFracArray## Calculates the percentages for the fraction array which lists the# percentages for each pane.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_setFracArray {} {    set perc 0.0    if {[llength $_activePanes] != 0} {	set percIncr [expr {1.0 / [llength $_activePanes]}]    }        for {set i 0} {$i < [llength $_activePanes]} {incr i} {	set _frac($i) $perc	set perc [expr {$perc + $percIncr}]    }        set _frac($i) 1.0}# ------------------------------------------------------------------# PRIVATE METHOD: _setActivePanes## Resets the active pane list.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_setActivePanes {} {    set _prevActivePanes $_activePanes    set _activePanes {}        foreach pane $_panes {	if {[lsearch -exact $_prevActivePanes $pane] != -1} {	    lappend _activePanes $pane	}    }}# ------------------------------------------------------------------# PRIVATE METHOD: _calcFraction where num## Determines the fraction for the sash.  Make sure the fraction does# not go past the minimum for the pane on each side of the separator.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_calcFraction {where num} {        set numi [expr {$num + 1}]    set numd [expr {$num - 1}]    set _lowerlimit [expr {$_pixels($numd) + $_minheight($numd)}]    set _upperlimit [expr {$_pixels($numi) - $_minheight($num)}]    set dir [expr {$where - $_pixels($num)}]    if {$where < $_lowerlimit && $dir <= 0} {     if {$num == 1} {      set _pixels($num) $_lowerlimit     } {      _moveSash [expr {$where - $_minheight($numd)}] $numd      set _pixels($num) [expr {$_pixels($numd) + $_minheight($numd)}]     }    } elseif {$where > $_upperlimit && $dir >= 0} {     if {$numi == [llength $_activePanes]} {      set _pixels($num) $_upperlimit     } {      _moveSash [expr {$where + $_minheight($num)}] $numi      set _pixels($num) \	     [expr {$_pixels($numi) - $_minheight($num)}]     }    } else {      set _pixels($num) $where    }    set _frac($num) [expr $_pixels($num).0 / $_dimension]}# ------------------------------------------------------------------# PRIVATE METHOD: _makeSashes## Removes any previous sashes and separators and creates new one.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_makeSashes {} {    #    # Remove any existing sashes and separators.    #    foreach sash $_sashes {	destroy $itk_component($sash)    }        foreach separator $_separators {	destroy $itk_component($separator)    }        set _sashes {}    set _separators {}        #    # Create one less separator and sash than the number of panes.      #    for {set id 1} {$id < [llength $_activePanes]} {incr id} {	itk_component add sash$id {	    frame $itk_interior.sash$id -relief $_relief($itk_option(-showhandle)) \		    -borderwidth $itk_option(-sashborderwidth) \		    -cursor $itk_option(-sashcursor) \		    -width $itk_option(-sashwidth) \		    -height $itk_option(-sashheight)	} {	    keep -background	}   	lappend _sashes sash$id		switch $itk_option(-orient) {	    vertical {		bind $itk_component(sash$id) <Button-1> \			[itcl::code $this _startGrip %x $id]		bind $itk_component(sash$id) <B1-Motion> \			[itcl::code $this _handleGrip %x $id]		bind $itk_component(sash$id) <B1-ButtonRelease-1> \			[itcl::code $this _endGrip %x $id]		bind $itk_component(sash$id) <Configure> \			    [itcl::code $this _configGrip %x $id]	    }	    	    horizontal {		bind $itk_component(sash$id) <Button-1> \			[itcl::code $this _startGrip %y $id]		bind $itk_component(sash$id) <B1-Motion> \			[itcl::code $this _handleGrip %y $id]		bind $itk_component(sash$id) <B1-ButtonRelease-1> \			[itcl::code $this _endGrip %y $id]		bind $itk_component(sash$id) <Configure> \			    [itcl::code $this _configGrip %y $id]	    }	}		itk_component add separator$id {	    frame $itk_interior.separator$id -relief sunken \		    -height $itk_option(-thickness) \		    -width $itk_option(-thickness) \		    -borderwidth [expr {$itk_option(-thickness) / 2}]	} {	    keep -background -cursor	}		lappend _separators separator$id    }}# ------------------------------------------------------------------# PRIVATE METHOD: _placeSash i## Places the position of the sash and separator.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_placeSash {i} {    if {$itk_option(-orient) == "horizontal"} {	place $itk_component(separator$i) -in $itk_component(hull) \		-x 0 -relwidth 1 -rely $_frac($i) -anchor w \		-height $itk_option(-thickness)		if {$itk_option(-sashindent) < 0} {	    set sashPos [expr {$_width + $itk_option(-sashindent)}]	    set sashAnchor e	} else {	    set sashPos $itk_option(-sashindent)	    set sashAnchor w	}		if {$itk_option(-showhandle)} {		place $itk_component(sash$i) -in $itk_component(hull) \			-x $sashPos -rely $_frac($i) -anchor $sashAnchor	} else {		place $itk_component(sash$i) -in $itk_component(hull) \			-x 0 -relwidth 1 -rely $_frac($i) -anchor w \			-height $itk_option(-thickness)	}    } else {	place $itk_component(separator$i) -in $itk_component(hull) \		-y 0 -relheight 1 -relx $_frac($i) -anchor n \		-width $itk_option(-thickness)		if {$itk_option(-sashindent) < 0} {	    set sashPos [expr {$_height + $itk_option(-sashindent)}]	    set sashAnchor s	} else {	    set sashPos $itk_option(-sashindent)	    set sashAnchor n	}		if {$itk_option(-showhandle)} {		place $itk_component(sash$i) -in $itk_component(hull) \			-y $sashPos -relx $_frac($i) -anchor $sashAnchor	} else {		place $itk_component(sash$i) -in $itk_component(hull) \			-y 0 -relheight 1 -relx $_frac($i) -anchor n \			-width $itk_option(-thickness)	}    }}# ------------------------------------------------------------------# PRIVATE METHOD: _placePanes## Resets the panes of the window following movement of the sash.# ------------------------------------------------------------------itcl::body iwidgets::Panedwindow::_placePanes {{start 0} {end end}} {     if {$end=="end"} { set end [expr {[llength $_activePanes] - 1}] }     set _updatePanes [lrange $_activePanes $start $end]     if {$_updatePanes == $_activePanes} {       set _forgetPanes $_panes     } {       set _forgetPanes $_updatePanes     }    foreach pane $_forgetPanes {	place forget $itk_component($pane)    }           if {$itk_option(-orient) == "horizontal"} {	set i $start	foreach pane $_updatePanes {	    place $itk_component($pane) -in $itk_component(hull) \		    -x 0 -rely $_frac($i) -relwidth 1 \		    -relheight [expr {$_frac([expr {$i + 1}]) - $_frac($i)}]	    incr i	}	    } else {	set i $start	foreach pane $_updatePanes {	    place $itk_component($pane) -in $itk_component(hull) \		    -y 0 -relx $_frac($i) -relheight 1 \		    -relwidth [expr {$_frac([expr {$i + 1}]) - $_frac($i)}]	    incr i	}	    }    for {set i [expr {$start+1}]} {$i <= $end} {incr i} {	if {[array names itk_component separator$i] != ""} {	    _placeSash $i	    raise $itk_component(separator$i)	    raise $itk_component(sash$i)	}    }}

⌨️ 快捷键说明

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