Revision: 38958
          http://brlcad.svn.sourceforge.net/brlcad/?rev=38958&view=rev
Author:   bob1961
Date:     2010-05-04 21:33:04 +0000 (Tue, 04 May 2010)

Log Message:
-----------
Updated Archer's shift-grips to match the original as much as possible without 
conflicting with the current mouse mode. Added support for constrained 
rotations and translations. The constrained behaviors will always be in model 
coordinates.

Modified Paths:
--------------
    brlcad/trunk/src/libtclcad/ged_obj.c
    brlcad/trunk/src/tclscripts/archer/Archer.tcl
    brlcad/trunk/src/tclscripts/lib/Ged.tcl

Modified: brlcad/trunk/src/libtclcad/ged_obj.c
===================================================================
--- brlcad/trunk/src/libtclcad/ged_obj.c        2010-05-04 21:25:12 UTC (rev 
38957)
+++ brlcad/trunk/src/libtclcad/ged_obj.c        2010-05-04 21:33:04 UTC (rev 
38958)
@@ -3464,6 +3464,9 @@
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
+    bu_vls_printf(&bindings, "bind %V <Enter> {focus %V; break}; ",
+                 &gdvp->gdv_dmp->dm_pathName,
+                 &gdvp->gdv_dmp->dm_pathName);
     bu_vls_printf(&bindings, "bind %V <Expose> {%V refresh %V; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
@@ -3558,43 +3561,31 @@
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Control-Shift-ButtonPress-1> {%V 
scale_mode %V %%x %%y; break}; ",
-                 &gdvp->gdv_dmp->dm_pathName,
-                 &go_current_gop->go_name,
-                 &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Control-Shift-ButtonPress-2> {%V 
scale_mode %V %%x %%y; break}; ",
-                 &gdvp->gdv_dmp->dm_pathName,
-                 &go_current_gop->go_name,
-                 &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Control-Shift-ButtonPress-3> {%V 
scale_mode %V %%x %%y; break}; ",
-                 &gdvp->gdv_dmp->dm_pathName,
-                 &go_current_gop->go_name,
-                 &gdvp->gdv_name);
 
     /* Constrained Rotate Mode */
-    bu_vls_printf(&bindings, "bind %V <Alt-Control-ButtonPress-1> {%V 
constrain_rmode %V x %%x %%y; break}; ",
+    bu_vls_printf(&bindings, "bind %V <Control-Lock-ButtonPress-1> {%V 
constrain_rmode %V x %%x %%y; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Control-ButtonPress-2> {%V 
constrain_rmode %V y %%x %%y; break}; ",
+    bu_vls_printf(&bindings, "bind %V <Control-Lock-ButtonPress-2> {%V 
constrain_rmode %V y %%x %%y; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Control-ButtonPress-3> {%V 
constrain_rmode %V z %%x %%y; break}; ",
+    bu_vls_printf(&bindings, "bind %V <Control-Lock-ButtonPress-3> {%V 
constrain_rmode %V z %%x %%y; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
 
     /* Constrained Translate Mode */
-    bu_vls_printf(&bindings, "bind %V <Alt-Shift-ButtonPress-1> {%V 
constrain_tmode %V x %%x %%y; break}; ",
+    bu_vls_printf(&bindings, "bind %V <Shift-Lock-ButtonPress-1> {%V 
constrain_tmode %V x %%x %%y; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Shift-ButtonPress-2> {%V 
constrain_tmode %V y %%x %%y; break}; ",
+    bu_vls_printf(&bindings, "bind %V <Shift-Lock-ButtonPress-2> {%V 
constrain_tmode %V y %%x %%y; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
-    bu_vls_printf(&bindings, "bind %V <Alt-Shift-ButtonPress-3> {%V 
constrain_tmode %V z %%x %%y; break}; ",
+    bu_vls_printf(&bindings, "bind %V <Shift-Lock-ButtonPress-3> {%V 
constrain_tmode %V z %%x %%y; break}; ",
                  &gdvp->gdv_dmp->dm_pathName,
                  &go_current_gop->go_name,
                  &gdvp->gdv_name);
@@ -4257,7 +4248,7 @@
 {
     int ret;
     int ac;
-    char *av[3];
+    char *av[4];
     fastf_t x, y;
     fastf_t dx, dy;
     fastf_t sf;
@@ -4326,18 +4317,19 @@
     bu_vls_init(&rot_vls);
     switch (argv[2][0]) {
        case 'x':
-           bu_vls_printf(&rot_vls, "%lf 0 0", sf);
+           bu_vls_printf(&rot_vls, "%lf 0 0", -sf);
        case 'y':
-           bu_vls_printf(&rot_vls, "0 %lf 0", sf);
+           bu_vls_printf(&rot_vls, "0 %lf 0", -sf);
        case 'z':
-           bu_vls_printf(&rot_vls, "0 0 %lf", sf);
+           bu_vls_printf(&rot_vls, "0 0 %lf", -sf);
     }
 
     gedp->ged_gvp = gdvp->gdv_view;
-    ac = 2;
+    ac = 3;
     av[0] = "rot";
-    av[1] = bu_vls_addr(&rot_vls);
-    av[2] = (char *)0;
+    av[1] = "-m";
+    av[2] = bu_vls_addr(&rot_vls);
+    av[3] = (char *)0;
 
     ret = ged_rot(gedp, ac, (const char **)av);
     bu_vls_free(&rot_vls);
@@ -4358,7 +4350,7 @@
 {
     int ret;
     int ac;
-    char *av[3];
+    char *av[4];
     fastf_t x, y;
     fastf_t dx, dy;
     fastf_t sf;
@@ -4429,18 +4421,19 @@
     bu_vls_init(&tran_vls);
     switch (argv[2][0]) {
        case 'x':
-           bu_vls_printf(&tran_vls, "%lf 0 0", sf);
+           bu_vls_printf(&tran_vls, "%lf 0 0", -sf);
        case 'y':
-           bu_vls_printf(&tran_vls, "0 %lf 0", sf);
+           bu_vls_printf(&tran_vls, "0 %lf 0", -sf);
        case 'z':
-           bu_vls_printf(&tran_vls, "0 0 %lf", sf);
+           bu_vls_printf(&tran_vls, "0 0 %lf", -sf);
     }
 
     gedp->ged_gvp = gdvp->gdv_view;
-    ac = 2;
+    ac = 3;
     av[0] = "tra";
-    av[1] = bu_vls_addr(&tran_vls);
-    av[2] = (char *)0;
+    av[1] = "-m";
+    av[2] = bu_vls_addr(&tran_vls);
+    av[3] = (char *)0;
 
     ret = ged_tra(gedp, ac, (const char **)av);
     bu_vls_free(&tran_vls);

Modified: brlcad/trunk/src/tclscripts/archer/Archer.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/archer/Archer.tcl       2010-05-04 21:25:12 UTC 
(rev 38957)
+++ brlcad/trunk/src/tclscripts/archer/Archer.tcl       2010-05-04 21:33:04 UTC 
(rev 38958)
@@ -2450,18 +2450,18 @@
        set win $dm
 
        if {$mViewOnly} {
-           bind $win <Control-ButtonPress-1> \
+#          bind $win <Control-ButtonPress-1> \
                "[::itcl::code $this launchDisplayMenuBegin $dname 
[$itk_component(canvas_menu) component view-menu] %X %Y]; break"
            bind $win <3> \
                "[::itcl::code $this launchDisplayMenuBegin $dname 
[$itk_component(canvas_menu) component view-menu] %X %Y]; break"
        } else {
            if {$ArcherCore::inheritFromToplevel} {
-               bind $win <Control-ButtonPress-1> \
+#              bind $win <Control-ButtonPress-1> \
                    "[::itcl::code $this launchDisplayMenuBegin $dname 
$itk_component(${prefix}displaymenu) %X %Y]; break"
                bind $win <3> \
                    "[::itcl::code $this launchDisplayMenuBegin $dname 
$itk_component(${prefix}displaymenu) %X %Y]; break"
            } else {
-               bind $win <Control-ButtonPress-1> \
+#              bind $win <Control-ButtonPress-1> \
                    "[::itcl::code $this launchDisplayMenuBegin $dname 
[$itk_component(menubar) component display-menu] %X %Y]; break"
                bind $win <3> \
                    "[::itcl::code $this launchDisplayMenuBegin $dname 
[$itk_component(menubar) component display-menu] %X %Y]; break"

Modified: brlcad/trunk/src/tclscripts/lib/Ged.tcl
===================================================================
--- brlcad/trunk/src/tclscripts/lib/Ged.tcl     2010-05-04 21:25:12 UTC (rev 
38957)
+++ brlcad/trunk/src/tclscripts/lib/Ged.tcl     2010-05-04 21:33:04 UTC (rev 
38958)
@@ -494,13 +494,13 @@
        method begin_data_arrow {_pane _x _y}
        method begin_data_line {_pane _x _y}
        method begin_data_move {_pane _x _y}
-       method begin_view_measure {_pane _x _y}
+       method begin_view_measure {_pane _part1_button _part1_button _x _y}
        method begin_view_measure_part2 {_pane _button _x _y}
        method default_views {}
        method end_data_arrow {_pane}
        method end_data_line {_pane}
        method end_data_move {_pane}
-       method end_view_measure {_pane {_part2_button 2}}
+       method end_view_measure {_pane _part1_button _part2_button}
        method end_view_measure_part2 {_pane _button}
        method getUserCmds {}
        method handle_data_move {_pane _dtype _dindex _x _y}
@@ -2621,7 +2621,7 @@
     bind $itk_component($_pane) <Motion> "[::itcl::code $this handle_data_move 
$_pane $mLastDataType $mLastDataIndex %x %y]; break"
 }
 
-::itcl::body cadwidgets::Ged::begin_view_measure {_pane _x _y} {
+::itcl::body cadwidgets::Ged::begin_view_measure {_pane _part1_button 
_part2_button _x _y} {
     measure_line_erase
 
     set mBegin3DPoint [pane_mouse_3dpoint $_pane $_x $_y]
@@ -2631,6 +2631,10 @@
     # start receiving motion events
     bind $itk_component($_pane) <Motion> "[::itcl::code $this 
handle_view_measure $_pane %x %y]; break"
 
+    foreach dm {ur ul ll lr} {
+       bind $itk_component(ur) <ButtonRelease-$_part1_button> "[::itcl::code 
$this end_view_measure ur $_part1_button $_part2_button]; break"
+    }
+
     set mMeasuringStickColorVDraw3D [get_vdraw_color 
$itk_option(-measuringStickColor)]
 }
 
@@ -2754,9 +2758,15 @@
     refresh_all
 }
 
-::itcl::body cadwidgets::Ged::end_view_measure {_pane {_part2_button 2}} {
+::itcl::body cadwidgets::Ged::end_view_measure {_pane _part1_button 
_part2_button} {
     $mGed idle_mode $itk_component($_pane)
 
+    # Add specific bindings to eliminate bleed through from measure tool 
bindings
+    foreach dm {ur ul ll lr} {
+       bind $itk_component($dm) <Control-ButtonRelease-$_part1_button> "$mGed 
idle_mode $itk_component($dm); break"
+       bind $itk_component($dm) <Shift-ButtonRelease-$_part1_button> "$mGed 
idle_mode $itk_component($dm); break"
+    }
+
     refresh_off
 
     set diff [vsub2 $mMiddle3DPoint $mBegin3DPoint]
@@ -2765,7 +2775,14 @@
     if {[expr {abs($delta) > 0.0001}]} {
        set mMeasureLineActive 1
        init_view_measure_part2 $_part2_button
+
+       # Add specific bindings to eliminate bleed through from measure tool 
bindings
+       foreach dm {ur ul ll lr} {
+           bind $itk_component($dm) <Control-ButtonRelease-$_part2_button> 
"$mGed idle_mode $itk_component($dm); break"
+           bind $itk_component($dm) <Shift-ButtonRelease-$_part2_button> 
"$mGed idle_mode $itk_component($dm); break"
+       }
     } else {
+       init_button_no_op_prot $_part2_button
        refresh_on
        return
     }
@@ -2793,8 +2810,15 @@
     set diff [vsub2 $mEnd3DPoint $mMiddle3DPoint]
     set delta [expr {[magnitude $diff] * [$mGed base2local 
$itk_component($_pane)]}]
 
-    set A [vunitize [vsub2 $mBegin3DPoint $mMiddle3DPoint]]
-    set B [vunitize [vsub2 $mEnd3DPoint $mMiddle3DPoint]]
+    set ret [catch {
+       set A [vunitize [vsub2 $mBegin3DPoint $mMiddle3DPoint]]
+       set B [vunitize [vsub2 $mEnd3DPoint $mMiddle3DPoint]]
+    }]
+
+    if {$ret} {
+       return
+    }
+
     set cos [vdot $A $B]
     set angle [format "%.2f" [expr {acos($cos) * (180.0 / 3.141592653589793)}]]
 
@@ -2817,6 +2841,10 @@
        }
     }
 
+    set mBegin3DPoint {0 0 0}
+    set mMiddle3DPoint {0 0 0}
+    set mEndDPoint {0 0 0}
+
     init_button_no_op_prot $_button
 }
 
@@ -3016,12 +3044,14 @@
        }
        default {
            foreach pane {ul ur ll lr} {
+               $mGed init_view_bindings $itk_component($pane)
                set win $itk_component($pane)
 
                # Turn off mouse bindings
                bind $win <1> {}
                bind $win <2> {}
                bind $win <3> {}
+               if {0} {
                bind $win <ButtonRelease-1> {}
 
                # Turn off rotate mode
@@ -3040,20 +3070,15 @@
                bind $win <Control-Shift-ButtonPress-3> {}
 
                # Turn off constrained rotate mode
-               bind $win <Alt-Control-ButtonPress-1> {}
-               bind $win <Alt-Control-ButtonPress-2> {}
-               bind $win <Alt-Control-ButtonPress-3> {}
+               bind $win <c><Control-ButtonPress-1> {}
+               bind $win <c><Control-ButtonPress-2> {}
+               bind $win <c><Control-ButtonPress-3> {}
 
                # Turn off constrained translate mode
-               bind $win <Alt-Shift-ButtonPress-1> {}
-               bind $win <Alt-Shift-ButtonPress-2> {}
-               bind $win <Alt-Shift-ButtonPress-3> {}
+               bind $win <C><ButtonPress-1> {}
+               bind $win <C><ButtonPress-2> {}
+               bind $win <C><ButtonPress-3> {}
 
-               # Turn off constrained scale mode
-               bind $win <Alt-Control-Shift-ButtonPress-1> {}
-               bind $win <Alt-Control-Shift-ButtonPress-2> {}
-               bind $win <Alt-Control-Shift-ButtonPress-3> {}
-
                # Turn off key bindings
                bind $win 3 {}
                bind $win 4 {}
@@ -3075,13 +3100,14 @@
                # overrides
                bind $win <Shift-ButtonPress-1> "$mGed rotate_mode $win %x %y; 
break"
                bind $win <Shift-ButtonPress-2> "$mGed scale_mode $win %x %y; 
break"
-               bind $win <Shift-ButtonPress-3> "$mGed translate_mode $win  %x 
%y; break"
+               bind $win <Shift-ButtonPress-3> "$mGed translate_mode $win %x 
%y; break"
                bind $win <Control-Shift-ButtonPress-3> "$mGed vslew $win %x 
%y; break"
 
                bind $win <Shift-ButtonRelease-1> "[::itcl::code $this 
handle_view_rotate_end $pane]; break"
                bind $win <Shift-ButtonRelease-2> "[::itcl::code $this 
handle_view_scale_end $pane]; break"
                bind $win <Shift-ButtonRelease-3> "[::itcl::code $this 
handle_view_translate_end $pane]; break"
                bind $win <Control-Shift-ButtonRelease-3> "[::itcl::code $this 
handle_view_translate_end $pane]; break"
+               }
            }
        }
     }
@@ -3101,18 +3127,12 @@
     bind $itk_component(lr) <ButtonRelease-$_button> "[::itcl::code $this 
handle_view_translate_end lr]; break"
 }
 
-::itcl::body cadwidgets::Ged::init_view_measure {{_button 1} {_part2_button 
2}} {
+::itcl::body cadwidgets::Ged::init_view_measure {{_part1_button 1} 
{_part2_button 2}} {
     measure_line_erase
 
-    bind $itk_component(ur) <$_button> "[::itcl::code $this begin_view_measure 
ur %x %y]; break"
-    bind $itk_component(ul) <$_button> "[::itcl::code $this begin_view_measure 
ul %x %y]; break"
-    bind $itk_component(ll) <$_button> "[::itcl::code $this begin_view_measure 
ll %x %y]; break"
-    bind $itk_component(lr) <$_button> "[::itcl::code $this begin_view_measure 
lr %x %y]; break"
-
-    bind $itk_component(ur) <ButtonRelease-$_button> "[::itcl::code $this 
end_view_measure ur $_part2_button]; break"
-    bind $itk_component(ul) <ButtonRelease-$_button> "[::itcl::code $this 
end_view_measure ul $_part2_button]; break"
-    bind $itk_component(ll) <ButtonRelease-$_button> "[::itcl::code $this 
end_view_measure ll $_part2_button]; break"
-    bind $itk_component(lr) <ButtonRelease-$_button> "[::itcl::code $this 
end_view_measure lr $_part2_button]; break"
+    foreach dm {ur ul ll lr} {
+       bind $itk_component(ur) <$_part1_button> "[::itcl::code $this 
begin_view_measure ur $_part1_button $_part2_button %x %y]; break"
+    }
 }
 
 ::itcl::body cadwidgets::Ged::init_view_measure_part2 {_button} {


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

Reply via email to