Revision: 54603
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54603&view=rev
Author:   bob1961
Date:     2013-03-11 12:13:40 +0000 (Mon, 11 Mar 2013)
Log Message:
-----------
Added a default display mode preference and the ability to double-click objects 
in Archer's tree to display.

Modified Paths:
--------------
    brlcad/trunk/src/tclscripts/archer/Archer.tcl
    brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl

Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl       2013-03-11 12:08:06 UTC 
(rev 54602)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl       2013-03-11 12:13:40 UTC 
(rev 54603)
@@ -222,7 +222,6 @@
        method buildCommandView {}
        method checkIfSelectedObjExists {}
        method compSelectCallback {_mstring}
-       method dblClick {_tags}
        method handleTreeSelect {}
        method initCompPick {}
        method initCompSelect {}
@@ -2099,45 +2098,6 @@
 }
 
 
-::itcl::body Archer::dblClick {tags} {
-    return
-
-    set element [split $tags ":"]
-    if {[llength $element] > 1} {
-       set element [lindex $element 1]
-    }
-
-    set node [$itk_component(tree) query -path $element]
-    set type [$itk_component(tree) query -nodetype $element]
-
-    set mPrevSelectedObjPath $mSelectedObjPath
-    set mPrevSelectedObj $mSelectedObj
-    set mSelectedObjPath $node
-    set mSelectedObj [$itk_component(tree) query -text $element]
-
-    if {$mPrevSelectedObj != $mSelectedObj} {
-       if {!$mViewOnly} {
-           if {$mObjViewMode == $OBJ_ATTR_VIEW_MODE} {
-               initObjAttrView
-           } else {
-               initObjEditView
-           }
-       }
-
-       set mPrevSelectedObjPath $mSelectedObjPath
-       set mPrevSelectedObj $mSelectedObj
-    }
-
-    $itk_component(tree) selection clear
-    $itk_component(tree) selection set $tags
-
-    switch -- $type {
-       "leaf"   -
-       "branch" {renderComp $node}
-    }
-}
-
-
 ::itcl::body Archer::handleTreeSelect {} {
     ::ArcherCore::handleTreeSelect
 
@@ -2740,6 +2700,36 @@
            -value $LIGHT_MODE_FRONT_AND_BACK_LIGHT \
            -variable [::itcl::scope mLightingModePref]
     } {}
+
+    itk_component add displayModeL {
+       ::ttk::label $parent.displayModeL \
+           -anchor e \
+           -text "Default Display Mode:"
+    } {}
+    itk_component add displayModeF {
+       ::ttk::frame $parent.displayModeF \
+           -relief sunken \
+           -borderwidth 1
+    } {}
+    itk_component add displayModeWireRB {
+       ::ttk::radiobutton $itk_component(displayModeF).displayModeWireRB \
+           -text "Wireframe" \
+           -value $DISPLAY_MODE_WIREFRAME \
+           -variable [::itcl::scope mDefaultDisplayModePref]
+    } {}
+    itk_component add displayModeShadedRB {
+       ::ttk::radiobutton $itk_component(displayModeF).displayModeShadedRB \
+           -text "Shaded" \
+           -value $DISPLAY_MODE_SHADED_ALL \
+           -variable [::itcl::scope mDefaultDisplayModePref]
+    } {}
+    itk_component add displayModeHiddenRB {
+       ::ttk::radiobutton $itk_component(displayModeF).displayModeHiddenRB \
+           -text "Hidden" \
+           -value $DISPLAY_MODE_HIDDEN \
+           -variable [::itcl::scope mDefaultDisplayModePref]
+    } {}
+
     itk_component add dlistModeCB {
        ::ttk::checkbutton $parent.dlistModeCB \
            -text "Use Display Lists" \
@@ -2762,6 +2752,13 @@
     grid columnconfigure $itk_component(lightModeF) 0 -weight 1
 
     set i 0
+    grid $itk_component(displayModeWireRB) -row $i -sticky nsew
+    incr i
+    grid $itk_component(displayModeShadedRB) -row $i -sticky nsew
+    incr i
+    grid $itk_component(displayModeHiddenRB) -row $i -sticky nsew
+
+    set i 0
     grid $itk_component(perspectiveL) -column 0 -row $i -sticky se
     grid $itk_component(perspectiveS) -column 1 -row $i -sticky ew
     incr i
@@ -2780,6 +2777,9 @@
     grid $itk_component(lightModeL) -column 0 -row $i -sticky ne
     grid $itk_component(lightModeF) -column 1 -row $i -sticky ew
     incr i
+    grid $itk_component(displayModeL) -column 0 -row $i -sticky ne
+    grid $itk_component(displayModeF) -column 1 -row $i -sticky ew
+    incr i
     grid $itk_component(dlistModeCB) -columnspan 2 -column 0 -row $i -sticky sw
     grid rowconfigure $parent $i -weight 1
     grid columnconfigure $parent 1 -weight 1
@@ -8280,6 +8280,10 @@
        set rflag 1
     }
 
+    if {$mDefaultDisplayModePref != $mDefaultDisplayMode} {
+       set mDefaultDisplayMode $mDefaultDisplayModePref
+    }
+
     if {$mDisplayListModePref != $mDisplayListMode} {
        set mDisplayListMode $mDisplayListModePref
        gedCmd dlist_on $mDisplayListMode
@@ -8960,6 +8964,7 @@
     set mZClipBackPref $mZClipBack
     set mZClipFrontPref $mZClipFront
     set mLightingModePref $mLightingMode
+    set mDefaultDisplayModePref $mDefaultDisplayMode
     set mDisplayListModePref $mDisplayListMode
     set mWireframeModePref $mWireframeMode
 
@@ -9123,6 +9128,7 @@
     puts $_pfile "set mZClipBack $mZClipBack"
     puts $_pfile "set mZClipFront $mZClipFront"
     puts $_pfile "set mLightingMode $mLightingMode"
+    puts $_pfile "set mDefaultDisplayMode $mDefaultDisplayMode"
     puts $_pfile "set mDisplayListMode $mDisplayListMode"
     puts $_pfile "set mWireframeMode $mWireframeMode"
 

Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2013-03-11 12:08:06 UTC 
(rev 54602)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl   2013-03-11 12:13:40 UTC 
(rev 54603)
@@ -77,6 +77,13 @@
        common OBJECT_CENTER_MODE 10
        common FIRST_FREE_BINDING_MODE 11
 
+       common DISPLAY_MODE_OFF -1
+       common DISPLAY_MODE_WIREFRAME 0
+       common DISPLAY_MODE_SHADED 1
+       common DISPLAY_MODE_SHADED_ALL 2
+       common DISPLAY_MODE_EVALUATED 3
+       common DISPLAY_MODE_HIDDEN 4
+
        common MATRIX_ABOVE_MODE 0
        common MATRIX_BELOW_MODE 1
 
@@ -414,18 +421,6 @@
        variable mCompSelectGroupPref ""
        variable mCompSelectGroupList ""
 
-       variable mPerspective 0
-       variable mPerspectivePref 0
-
-       variable mZClipBack 100.0
-       variable mZClipBackPref 100.0
-       variable mZClipFront 100.0
-       variable mZClipFrontPref 100.0
-       variable mZClipBackMax 1000
-       variable mZClipBackMaxPref 1000
-       variable mZClipFrontMax 1000
-       variable mZClipFrontMaxPref 1000
-
        variable mBindingMode Default
        variable mBindingModePref ""
        variable mBackground "0 0 0"
@@ -462,6 +457,18 @@
        variable mDisplayFontSizePref ""
        variable mDisplayFontSizes {}
 
+       variable mPerspective 0
+       variable mPerspectivePref 0
+
+       variable mZClipBack 100.0
+       variable mZClipBackPref 100.0
+       variable mZClipFront 100.0
+       variable mZClipFrontPref 100.0
+       variable mZClipBackMax 1000
+       variable mZClipBackMaxPref 1000
+       variable mZClipFrontMax 1000
+       variable mZClipFrontMaxPref 1000
+
        variable mLightingMode 1
        variable mLightingModePref ""
        variable mDisplayListMode 0
@@ -469,6 +476,9 @@
        variable mWireframeMode 0
        variable mWireframeModePref ""
 
+       variable mDefaultDisplayMode $DISPLAY_MODE_WIREFRAME
+       variable mDefaultDisplayModePref ""
+
        variable mGridAnchor "0 0 0"
        variable mGridAnchorXPref ""
        variable mGridAnchorYPref ""
@@ -811,6 +821,7 @@
        method bot_split2 {_bot}
 
        # tree commands
+       method dblClick {_x _y}
        method fillTree          {_pnode _ctext _flat {_allow_multiple 0}}
        method fillTreeColumns   {_cnode _ctext}
        method isRegion          {_cgdata}
@@ -1637,6 +1648,7 @@
     bind $itk_component(newtree) <<TreeviewOpen>> [::itcl::code $this 
handleTreeOpen]
     bind $itk_component(newtree) <<TreeviewClose>> [::itcl::code $this 
handleTreeClose]
     $itk_component(newtree) tag bind $TREE_POPUP_TAG <Button-3> [::itcl::code 
$this handleTreePopup TREE_POPUP_TYPE_NODE %x %y %X %Y]
+    $itk_component(newtree) tag bind $TREE_POPUP_TAG <Double-1> [::itcl::code 
$this dblClick %x %y]
     $itk_component(newtree) tag configure $TREE_FULLY_DISPLAYED_TAG \
        -foreground red \
        -font TkHeadingFont
@@ -3635,50 +3647,48 @@
     catch {
        if {[catch {gedCmd attr get \
                        $tnode displayColor} displayColor]} {
-           switch -exact -- $_state {
-               "0" {
+           switch -exact -- $_state \
+               $DISPLAY_MODE_WIREFRAME {
                    gedCmd draw -m0 -x$_trans $_node
-               }
-               "1" {
+               } \
+               $DISPLAY_MODE_SHADED {
                    gedCmd draw -m1 -x$_trans $_node
-               }
-               "2" {
+               } \
+               $DISPLAY_MODE_SHADED_ALL {
                    gedCmd draw -m2 -x$_trans $_node
-               }
-               "3" {
+               } \
+               $DISPLAY_MODE_EVALUATED {
                    gedCmd E $_node
-               }
-               "4" {
+               } \
+               $DISPLAY_MODE_HIDDEN {
                    gedCmd draw -h $_node
-               }
-               "-1" {
+               } \
+               $DISPLAY_MODE_OFF {
                    gedCmd erase $_node
                }
-           }
        } else {
-           switch -exact -- $_state {
-               "0" {
+           switch -exact -- $_state \
+               $DISPLAY_MODE_WIREFRAME {
                    gedCmd draw -m0 -x$_trans \
                        -C$displayColor $_node
-               }
-               "1" {
+               } \
+               $DISPLAY_MODE_SHADED {
                    gedCmd draw -m1 -x$_trans \
                        -C$displayColor $_node
-               }
-               "2" {
+               } \
+               $DISPLAY_MODE_SHADED_ALL {
                    gedCmd draw -m2 -x$_trans \
                        -C$displayColor $_node
-               }
-               "3" {
+               } \
+               $DISPLAY_MODE_EVALUATED {
                    gedCmd E -C$displayColor $_node
-               }
-               "4" {
+               } \
+               $DISPLAY_MODE_HIDDEN {
                    gedCmd draw -h -C$displayColor $_node
-               }
-               "-1" {
+               } \
+               $DISPLAY_MODE_OFF {
                    gedCmd erase $_node
                }
-           }
        }
     }
 
@@ -3757,7 +3767,11 @@
     }
 
     if {$_node_id != ""} {
-       $itk_component(newtree) selection set $_node_id
+       set snode [$itk_component(newtree) selection]
+
+       if {$snode != $_node_id} {
+           $itk_component(newtree) selection set $_node_id
+       }
     }
 }
 
@@ -4018,6 +4032,21 @@
 #                     PROTECTED TREE COMMANDS
 # ------------------------------------------------------------
 
+
+::itcl::body ArcherCore::dblClick {_x _y} {
+    set item [$itk_component(newtree) identify row $_x $_y]
+    set obj [$itk_component(newtree) item $item -text]
+    set path [getTreePath $item $obj]
+
+    set rdata [gedCmd how -b $path]
+    if {$rdata == -1} {
+       render $path $mDefaultDisplayMode 1 1 1 $item
+    } else {
+       erase $path
+    }
+}
+
+
 ::itcl::body ArcherCore::fillTree {_pnode _ctext _flat {_allow_multiple 0}} {
     global no_tree_decorate
 
@@ -4164,21 +4193,21 @@
 
     set mRenderMode [gedCmd how $_node]
     # do this in case "ev" was used from the command line
-    if {!$mEnableBigE && 2 < $mRenderMode} {
+    if {!$mEnableBigE && $mRenderMode == 3} {
        set mRenderMode 0
     }
 
     if {$_nodeType == "leaf"} {
        $_menu add radiobutton -label "Wireframe" \
            -indicatoron 1 -value 0 -variable [::itcl::scope mRenderMode] \
-           -command [::itcl::code $this render $_node 0 1 1 1 $_node_id]
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_WIREFRAME 
1 1 1 $_node_id]
 
        $_menu add radiobutton -label "Shaded" \
-           -indicatoron 1 -value 1 -variable [::itcl::scope mRenderMode] \
-           -command [::itcl::code $this render $_node 1 1 1 1 $_node_id]
+           -indicatoron 1 -value 2 -variable [::itcl::scope mRenderMode] \
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_SHADED_ALL 
1 1 1 $_node_id]
        $_menu add radiobutton -label "Hidden Line" \
-           -indicatoron 1 -value 2 -variable [::itcl::scope mRenderMode] \
-           -command [::itcl::code $this render $_node 4 1 1 1 $_node_id]
+           -indicatoron 1 -value 4 -variable [::itcl::scope mRenderMode] \
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_HIDDEN 1 1 
1 $_node_id]
 
        if {$mEnableBigE} {
            $_menu add radiobutton \
@@ -4186,29 +4215,29 @@
                -indicatoron 1 \
                -value 3 \
                -variable [::itcl::scope mRenderMode] \
-               -command [::itcl::code $this render $_node 3 1 1 1 $_node_id]
+               -command [::itcl::code $this render $_node 
$DISPLAY_MODE_EVALUATED 1 1 1 $_node_id]
        }
 
        $_menu add radiobutton -label "Off" \
            -indicatoron 1 -value -1 -variable [::itcl::scope mRenderMode] \
-           -command [::itcl::code $this render $_node -1 1 1]
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_OFF 1 1]
     } else {
        $_menu add command -label "Wireframe" \
-           -command [::itcl::code $this render $_node 0 1 1 1 $_node_id]
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_WIREFRAME 
1 1 1 $_node_id]
 
        $_menu add command -label "Shaded" \
-           -command [::itcl::code $this render $_node 1 1 1 1 $_node_id]
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_SHADED_ALL 
1 1 1 $_node_id]
        $_menu add command -label "Hidden Line" \
-           -command [::itcl::code $this render $_node 4 1 1 1 $_node_id]
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_HIDDEN 1 1 
1 $_node_id]
 
        if {$mEnableBigE} {
            $_menu add command \
                -label "Evaluated" \
-               -command [::itcl::code $this render $_node 3 1 1 1 $_node_id]
+               -command [::itcl::code $this render $_node 
$DISPLAY_MODE_EVALUATED 1 1 1 $_node_id]
        }
 
        $_menu add command -label "Off" \
-           -command [::itcl::code $this render $_node -1 1 1]
+           -command [::itcl::code $this render $_node $DISPLAY_MODE_OFF 1 1]
     }
 
     set nodeList [split $_node /]

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to