Revision: 56846
http://sourceforge.net/p/brlcad/code/56846
Author: n_reed
Date: 2013-08-14 21:46:47 +0000 (Wed, 14 Aug 2013)
Log Message:
-----------
Work on managing mouse event handlers for brep editing. Keeping to the script
side, whereas bot editing handles bindings partly in script and partly in
libtclcad.
Modified Paths:
--------------
brlcad/trunk/src/tclscripts/archer/Archer.tcl
brlcad/trunk/src/tclscripts/archer/BrepEditFrame.tcl
Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl 2013-08-14 20:37:42 UTC
(rev 56845)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl 2013-08-14 21:46:47 UTC
(rev 56846)
@@ -445,6 +445,7 @@
private {
variable mInstanceInit 1
+ method brepDragHandler {x y win startMode}
}
}
@@ -6472,6 +6473,16 @@
$itk_component(ged) rect lwidth 0
}
+::itcl::body Archer::brepDragHandler {x y win startMode} {
+ # if we've switched to a different (standard) editing mode or if
+ # the edit command has been unset to exit the current mode, then
+ # delete this binding and clear the edit state to ensure it isn't
+ # restored until we explicitly switch back
+ if {$mDefaultBindingMode != $startMode || $GeometryEditFrame::mEditCommand
== ""} {
+ bind $win <Button1-Motion> ""
+ $itk_component(brepView) clearEditState
+ }
+}
::itcl::body Archer::beginObjTranslate {} {
set obj $mSelectedObjPath
@@ -6510,6 +6521,8 @@
} else {
bind $win <1> "$itk_component(ged) pane_otranslate_mode
$dname $obj %x %y; break"
}
+ } elseif {$mSelectedObjType == "brep"} {
+ bind $win <Button1-Motion> "[::itcl::code $this brepDragHandler
%x %y $win $mDefaultBindingMode]; break"
} else {
bind $win <1> "$itk_component(ged)
pane_$GeometryEditFrame::mEditCommand\_mode $dname $obj
$GeometryEditFrame::mEditParam1 %x %y; break"
}
@@ -6641,7 +6654,7 @@
set diff [vsub2 $new_ocenter $ocenter]
eval editMotionDeltaCallback otranslate $diff
} else {
- if {$GeometryEditFrame::mEditCommand != ""} {
+ if {$GeometryEditFrame::mEditCommand != "" && $mSelectedObjType !=
"brep"} {
$itk_component($mSelectedObjType\View) moveElement $_dm $_obj
$vx $vy $new_ocenter
} else {
eval gedCmd ocenter $_obj $new_ocenter
Modified: brlcad/trunk/src/tclscripts/archer/BrepEditFrame.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/BrepEditFrame.tcl 2013-08-14
20:37:42 UTC (rev 56845)
+++ brlcad/trunk/src/tclscripts/archer/BrepEditFrame.tcl 2013-08-14
21:46:47 UTC (rev 56846)
@@ -25,16 +25,21 @@
constructor {args} {}
destructor {}
- public {}
+ public {
+ method CVEditMode {_dname _obj _x _y}
+ method clearEditState {{_clearModeOnly 0} {_inifFlag 0}}
+ }
protected {
+ method initCVEdit {}
# GeometryEditFrame overrides
method buildUpperPanel
method buildLowerPanel
- method initEditState {}
}
- private {}
+ private {
+ method toggleCVEdit {}
+ }
}
@@ -51,11 +56,23 @@
# PUBLIC METHODS
# ------------------------------------------------------------
+::itcl::body BrepEditFrame::CVEditMode {_dname _obj _x _y} {
+}
+::itcl::body BrepEditFrame::clearEditState {{_clearModeOnly 0} {_initFlag 0}} {
+ set mEditCommand ""
+ chain $_clearModeOnly $_initFlag
+}
# ------------------------------------------------------------
# PROTECTED METHODS
# ------------------------------------------------------------
+::itcl::body BrepEditFrame::initCVEdit {} {
+ set mEditCommand CVEditMode
+ set mEditClass $EDIT_CLASS_TRANS
+ set mEditLastTransMode $::ArcherCore::OBJECT_TRANSLATE_MODE
+ GeometryEditFrame::initEditState
+}
::itcl::body BrepEditFrame::buildUpperPanel {} {
}
@@ -65,12 +82,23 @@
itk_component add editCV {
::ttk::checkbutton $parent.editCV \
- -text "Edit Control Vertices"
+ -text "Edit Control Vertices" \
+ -variable [::itcl::scope mEditMode] \
+ -command [::itcl::code $this toggleCVEdit]
} {}
+
+ pack $itk_component(editCV)
}
-::itcl::body BrepEditFrame::initEditState {} {
- GeometryEditFrame::initEditState
+# ------------------------------------------------------------
+# PRIVATE METHODS
+# ------------------------------------------------------------
+::itcl::body BrepEditFrame::toggleCVEdit {} {
+ if {$mEditMode} {
+ initCVEdit
+ } else {
+ clearEditState 0 1
+ }
}
# Local Variables:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits