Revision: 76233
http://sourceforge.net/p/brlcad/code/76233
Author: starseeker
Date: 2020-06-27 15:12:31 +0000 (Sat, 27 Jun 2020)
Log Message:
-----------
Expose snapping to lines option in Archer menu, but still quite a bit to do to
actually enable the feature...
Modified Paths:
--------------
brlcad/trunk/src/tclscripts/archer/Archer.tcl
brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
brlcad/trunk/src/tclscripts/lib/Ged.tcl
Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl 2020-06-27 06:57:31 UTC
(rev 76232)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl 2020-06-27 15:12:31 UTC
(rev 76233)
@@ -5747,6 +5747,8 @@
-helpstr "Toggle display of the grid."
checkbutton sgrid -label "Snap Grid" \
-helpstr "Toggle grid snapping."
+ checkbutton slines -label "Snap to Lines" \
+ -helpstr "Toggle line snapping."
checkbutton adc -label "Angle/Distance Cursor" \
-helpstr "Toggle display of the angle distance cursor."
}
@@ -5883,6 +5885,12 @@
-variable [::itcl::scope mSnapGrid] \
-command [::itcl::code $this snapGrid] \
-state disabled
+ $itk_component(menubar) menuconfigure .modes.slines \
+ -offvalue 0 \
+ -onvalue 1 \
+ -variable [::itcl::scope mSnapLines] \
+ -command [::itcl::code $this snapLines] \
+ -state disabled
$itk_component(menubar) menuconfigure .modes.adc \
-offvalue 0 \
-onvalue 1 \
@@ -6190,6 +6198,13 @@
-command [::itcl::code $this snapGrid] \
-state disabled
$itk_component(${_prefix}modesmenu) add checkbutton \
+ -label "Snap to Lines" \
+ -offvalue 0 \
+ -onvalue 1 \
+ -variable [::itcl::scope mSnapLines] \
+ -command [::itcl::code $this snapLines] \
+ -state disabled
+ $itk_component(${_prefix}modesmenu) add checkbutton \
-label "Angle/Distance Cursor" \
-offvalue 0 \
-onvalue 1 \
@@ -6230,6 +6245,7 @@
$itk_component(${prefix}modesmenu) entryconfigure "Lighting"
-state normal
$itk_component(${prefix}modesmenu) entryconfigure "Grid" -state
normal
$itk_component(${prefix}modesmenu) entryconfigure "Snap Grid"
-state normal
+ $itk_component(${prefix}modesmenu) entryconfigure "Snap to
Lines" -state normal
$itk_component(${prefix}modesmenu) entryconfigure
"Angle/Distance Cursor" -state normal
$itk_component(${prefix}raytracemenu) entryconfigure "check
overlaps" -state normal
@@ -6261,6 +6277,7 @@
$itk_component(menubar) menuconfigure .modes.light -state normal
$itk_component(menubar) menuconfigure .modes.grid -state normal
$itk_component(menubar) menuconfigure .modes.sgrid -state normal
+ $itk_component(menubar) menuconfigure .modes.slines -state normal
$itk_component(menubar) menuconfigure .modes.adc -state normal
$itk_component(menubar) menuconfigure .raytrace.checkoverlaps
-state normal
@@ -9364,6 +9381,7 @@
puts $_pfile "set mLighting $mLighting"
puts $_pfile "set mShowGrid $mShowGrid"
puts $_pfile "set mSnapGrid $mSnapGrid"
+ puts $_pfile "set mSnapLines $mSnapLines"
puts $_pfile "set mShowADC $mShowADC"
puts $_pfile "set GeometryEditFrame::mHighlightPoints
$GeometryEditFrame::mHighlightPoints"
Modified: brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl 2020-06-27 06:57:31 UTC
(rev 76232)
+++ brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl 2020-06-27 15:12:31 UTC
(rev 76233)
@@ -396,6 +396,7 @@
variable mShowScale 0
variable mShowGrid 0
variable mSnapGrid 0
+ variable mSnapLines 0
variable mShowADC 0
# variables for preference state
@@ -945,6 +946,7 @@
method showModelAxesTicks {}
method showGrid {}
method snapGrid {}
+ method snapLines {}
method showADC {}
# private mged commands
@@ -2140,6 +2142,9 @@
if {$mSnapGrid} {
snapGrid
}
+ if {$mSnapLines} {
+ snapLines
+ }
if {$mShowADC} {
showADC
}
@@ -4110,6 +4115,7 @@
set mShowViewAxes [gedCmd cget -viewAxesEnable]
set mShowGrid [gedCmd cget -gridEnable]
set mSnapGrid [gedCmd cget -gridSnap]
+ set mSnapLines [gedCmd cget -linesSnap]
set mShowADC [gedCmd cget -adcEnable]
}
@@ -4230,6 +4236,10 @@
catch {gedCmd configure -gridSnap $mSnapGrid}
}
+::itcl::body ArcherCore::snapLines {} {
+ catch {gedCmd configure -linesSnap $mSnapLines}
+}
+
::itcl::body ArcherCore::showADC {} {
catch {gedCmd configure -adcEnable $mShowADC}
}
Modified: brlcad/trunk/src/tclscripts/lib/Ged.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/lib/Ged.tcl 2020-06-27 06:57:31 UTC (rev
76232)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl 2020-06-27 15:12:31 UTC (rev
76233)
@@ -85,6 +85,7 @@
itk_option define -centerDotEnable centerDotEnable CenterDotEnable 1
itk_option define -gridEnable gridEnable GridEnable 0
itk_option define -gridSnap gridSnap GridSnap 0
+ itk_option define -linesSnap linesSnap LinesSnap 0
itk_option define -hideSubtractions hideSubtractions HideSubtractions 0
itk_option define -measuringStickColor measuringStickColor
MeasuringStickColor Yellow
itk_option define -measuringStickMode measuringStickMode
MeasuringStickMode 0
@@ -1038,6 +1039,10 @@
grid snap $itk_option(-gridSnap)
}
+::itcl::configbody cadwidgets::Ged::linesSnap {
+ #puts "called Ged::linesSnap method"
+}
+
::itcl::configbody cadwidgets::Ged::mGedFile {
cadwidgets::Ged::open $mGedFile
}
@@ -4325,6 +4330,8 @@
# above (i.e. neither a geometry object nor a data point was hit)
# and gridSnap is active, apply snap to grid to the data point
# currently being moved.
+
+ # TODO - need to handle lines snapping in some fashion here as well...
if {$point == "" && $itk_option(-gridSnap)} {
# First, get the data point being moved.
if {$mLastDataType == "data_labels" || $mLastDataType ==
"sdata_labels"} {
@@ -4374,6 +4381,7 @@
::itcl::body cadwidgets::Ged::end_data_poly_move {_pane} {
refresh_off
+ # TODO - need to handle lines snapping in some fashion here as well...
if {$itk_option(-gridSnap)} {
# First, get the data point being moved.
set point [eval $mGed data_polygons $itk_component($_pane) get_point
$mLastDataIndex]
@@ -4455,6 +4463,7 @@
::itcl::body cadwidgets::Ged::end_data_poly_circ {_pane {_button 1}} {
$mGed idle_mode $itk_component($_pane)
+ # TODO - need to handle lines snapping in some fashion here as well...
if {$itk_option(-gridSnap)} {
set mpos [$mGed get_prev_mouse $itk_component($_pane)]
eval $mGed mouse_poly_circ $itk_component($_pane) $mpos
@@ -4478,6 +4487,7 @@
set mpos [$mGed get_prev_mouse $itk_component($_pane)]
+ # TODO - need to handle lines snapping in some fashion here as well...
if {$itk_option(-gridSnap)} {
set view [eval $mGed screen2view $itk_component($_pane) $mpos]
set view [$mGed snap_view $itk_component($_pane) [lindex $view 0]
[lindex $view 1]]
@@ -4503,6 +4513,7 @@
::itcl::body cadwidgets::Ged::end_data_poly_ell {_pane {_button 1}} {
$mGed idle_mode $itk_component($_pane)
+ # TODO - need to handle lines snapping in some fashion here as well...
if {$itk_option(-gridSnap)} {
set mpos [$mGed get_prev_mouse $itk_component($_pane)]
eval $mGed mouse_poly_ell $itk_component($_pane) $mpos
@@ -4524,6 +4535,7 @@
::itcl::body cadwidgets::Ged::end_data_poly_rect {_pane {_button 1}} {
$mGed idle_mode $itk_component($_pane)
+ # TODO - need to handle lines snapping in some fashion here as well...
if {$itk_option(-gridSnap)} {
set mpos [$mGed get_prev_mouse $itk_component($_pane)]
eval $mGed mouse_poly_rect $itk_component($_pane) $mpos
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits