From 1f4767550c46323f55674801fde5aa1d58ed966b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 18 Aug 2006 15:41:58 +0000 Subject: [PATCH] enable multiple de-selections at once using the lasso --- Fltk/Callbacks.cpp | 10 +++++----- Fltk/Opengl.cpp | 4 ++-- Fltk/Opengl_Window.cpp | 16 +++++++++++++--- doc/texinfo/gmsh.texi | 12 ++++++------ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index f8d34a50e6..b7c90bae31 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.439 2006-08-18 02:22:40 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.440 2006-08-18 15:41:58 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -1640,17 +1640,17 @@ void help_mouse_cb(CALLBACK_ARGS) Msg(DIRECT, " Move - Highlight the elementary geometrical entity"); Msg(DIRECT, " currently under the mouse pointer and display"); Msg(DIRECT, " its properties in the status bar"); - Msg(DIRECT, " - Resize a lasso zoom/selection"); + Msg(DIRECT, " - Resize a lasso zoom/(un)selection"); Msg(DIRECT, " Left button - Rotate"); Msg(DIRECT, " - Select an entity"); Msg(DIRECT, " - Accept a lasso zoom/selection"); - Msg(DIRECT, " Ctrl+Left button Start a lasso zoom/selection"); + Msg(DIRECT, " Ctrl+Left button Start a lasso zoom/(un)selection"); Msg(DIRECT, " Middle button - Zoom"); Msg(DIRECT, " - Unselect an entity"); - Msg(DIRECT, " - Cancel a lasso zoom/selection"); + Msg(DIRECT, " - Accept a lasso zoom/unselection"); Msg(DIRECT, " Ctrl+Middle button Orthogonalize display"); Msg(DIRECT, " Right button - Pan"); - Msg(DIRECT, " - Cancel a lasso zoom/selection"); + Msg(DIRECT, " - Cancel a lasso zoom/(un)selection"); Msg(DIRECT, " - Pop-up menu on post-processing view button"); Msg(DIRECT, " Ctrl+Right button Reset to default viewpoint"); Msg(DIRECT, " "); diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index d337b11dc5..89fe4f0317 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.62 2006-08-13 20:46:54 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.63 2006-08-18 15:41:58 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -229,7 +229,7 @@ char SelectEntity(int type, int *n, } if(WID->try_selection) { bool add = (WID->try_selection > 0) ? true : false; - bool multi = (WID->try_selection > 1) ? true : false; + bool multi = (abs(WID->try_selection) > 1) ? true : false; WID->try_selection = 0; if(WID->selection == ENT_NONE){ // just report the mouse click WID->g_opengl_window->SelectionMode = false; diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp index cb3623f764..a3de3182fa 100644 --- a/Fltk/Opengl_Window.cpp +++ b/Fltk/Opengl_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl_Window.cpp,v 1.64 2006-08-13 20:46:54 geuzaine Exp $ +// $Id: Opengl_Window.cpp,v 1.65 2006-08-18 15:41:58 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -228,14 +228,24 @@ int Opengl_Window::handle(int event) } else if(Fl::event_button() == 2 || (Fl::event_button() == 1 && Fl::event_state(FL_SHIFT))) { - if(Fl::event_state(FL_CTRL) && !LassoMode) { + if(!LassoMode && Fl::event_state(FL_CTRL)) { // make zoom isotropic CTX.s[1] = CTX.s[0]; CTX.s[2] = CTX.s[0]; redraw(); } else if(LassoMode) { - LassoMode = false; + LassoMode = false; + if(SelectionMode && CTX.enable_mouse_selection){ + WID->try_selection = -2; // will try to unselect multiple entities + WID->try_selection_xywh[0] = (int)(click.win[0] + curr.win[0])/2; + WID->try_selection_xywh[1] = (int)(click.win[1] + curr.win[1])/2; + WID->try_selection_xywh[2] = (int)fabs(click.win[0] - curr.win[0]); + WID->try_selection_xywh[3] = (int)fabs(click.win[1] - curr.win[1]); + } + else{ + lasso_zoom(click, curr); + } } else if(CTX.enable_mouse_selection){ WID->try_selection = -1; // will try to unselect clicked entity diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi index 88d500961e..f5ff203569 100644 --- a/doc/texinfo/gmsh.texi +++ b/doc/texinfo/gmsh.texi @@ -1,5 +1,5 @@ \input texinfo.tex @c -*-texinfo-*- -@c $Id: gmsh.texi,v 1.210 2006-08-18 02:22:40 geuzaine Exp $ +@c $Id: gmsh.texi,v 1.211 2006-08-18 15:41:58 geuzaine Exp $ @c @c Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle @c @@ -2770,8 +2770,8 @@ In the following, for a 2 button mouse, @kbd{Middle button} = Highlight the elementary geometrical entity currently under the mouse pointer and display its properties in the status bar @item -Resize a lasso zoom or a lasso selection started with @kbd{Ctrl+Left -button} +Resize a lasso zoom or a lasso selection/unselection started with +@kbd{Ctrl+Left button} @end itemize @kbd{Left button}: @@ -2785,7 +2785,7 @@ Accept a lasso zoom or a lasso selection started with @kbd{Ctrl+Left button} @end itemize -@kbd{Ctrl+Left button}: Start a lasso zoom or a lasso selection +@kbd{Ctrl+Left button}: Start a lasso zoom or a lasso selection/unselection @kbd{Middle button}: @itemize @bullet @@ -2794,7 +2794,7 @@ Zoom @item Unselect an entity @item -Cancel a lasso zoom or a lasso selection +Accept a lasso zoom or a lasso unselection @end itemize @kbd{Ctrl+Middle button}: Orthogonalize display @@ -2804,7 +2804,7 @@ Cancel a lasso zoom or a lasso selection @item Pan @item -Cancel a lasso zoom or a lasso selection +Cancel a lasso zoom or a lasso selection/unselection @item Pop-up menu on post-processing view button @end itemize -- GitLab