diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 381230b240faef3a27757a81b4539dc5244261d5..c2c15e5050bea53a22275e74f132e65d7b4924c2 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -657,8 +657,8 @@ StringXNumber GeneralOptions_Number[] = { "Height (in pixels) of the message window" }, { F|S, "MessageWidth" , opt_general_message_size0 , 450. , "Width (in pixels) of the message window" }, - { F|O, "MouseSelection" , opt_general_mouse_selection , 2. , - "Mouse selection mode (0=none, 1=no hover, 2=full)" }, + { F|O, "MouseSelection" , opt_general_mouse_selection , 1. , + "Mouse hover and selection mode (0=none, 1=hover and select geometry but only select mesh, 2=hover and select geometry and mesh)" }, { F|O, "NoPopup" , opt_general_nopopup , 0. , "Disable interactive dialog windows in scripts (and use default values instead)" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index d2b651efd1f3b313cf568b53b647ee4428ab9fa4..047b9a06f76e6f9ccb4a9e60dda10b6683bb7462 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.298 2006-08-17 21:28:34 geuzaine Exp $ +// $Id: Options.cpp,v 1.299 2006-08-18 21:11:42 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -2778,13 +2778,13 @@ double opt_general_mouse_selection(OPT_ARGS_NUM) WID->g_status_butt[9]->color(FL_RED); } else if(CTX.enable_mouse_selection == 1){ - if(!CTX.batch) Msg(STATUS2N, "Mouse hover OFF"); - WID->g_status_butt[9]->color(FL_GREEN); - } - else{ if(!CTX.batch) Msg(STATUS2N, "Mouse selection ON"); WID->g_status_butt[9]->color(FL_BACKGROUND_COLOR); } + else{ + if(!CTX.batch) Msg(STATUS2N, "Full mouse selection ON"); + WID->g_status_butt[9]->color(FL_GREEN); + } WID->g_status_butt[9]->redraw(); } #endif diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index b7c90bae311a3e441aecdc1d8aa42e4b011dde48..f0474239f833702b754d89d2d35448d387ce69e3 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.440 2006-08-18 15:41:58 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.441 2006-08-18 21:11:42 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -467,8 +467,8 @@ void status_xyz1p_cb(CALLBACK_ARGS) } else if(!strcmp(str, "S")){ // mouse selection if(Fl::event_state(FL_SHIFT)){ - // mouse selection only (no hover) - opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 1); + // full mouse hover and select for geometry and mesh + opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 2); } else if(CTX.enable_mouse_selection){ // mouse does nothing @@ -476,8 +476,9 @@ void status_xyz1p_cb(CALLBACK_ARGS) WID->g_opengl_window->cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE); } else{ - // mouse hover and select (default) - opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 2); + // mouse hover and select for geometry, but mouse select only + // for mesh (default) + opt_general_mouse_selection(0, GMSH_SET | GMSH_GUI, 1); } } WID->update_manip_window(); @@ -1577,6 +1578,7 @@ void help_short_cb(CALLBACK_ARGS) Msg(DIRECT, " Shift+p Show post-processing options"); Msg(DIRECT, " Shift+s Show solver options"); Msg(DIRECT, " Shift+w Show post-processing view options"); + Msg(DIRECT, " Shift+Escape Enable full mouse selection"); Msg(DIRECT, " "); Msg(DIRECT, " " CC("i") " Show statistics window"); Msg(DIRECT, " " CC("l") " Show message console"); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index fec93c0782ca58961f7656570a0d126b2395a7dc..3b068dc7b6dbe89270f4728b5591a87c42944608 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.531 2006-08-18 17:49:35 geuzaine Exp $ +// $Id: GUI.cpp,v 1.532 2006-08-18 21:11:42 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -1405,7 +1405,7 @@ void GUI::create_graphic_window() g_status_butt[9] = new Fl_Button(x, glheight + 2, sw, sht, "S"); x += sw; g_status_butt[9]->callback(status_xyz1p_cb, (void *)"S"); - g_status_butt[9]->tooltip("Toggle mouse selection ON/OFF (Escape)"); + g_status_butt[9]->tooltip("Toggle mouse selection ON/OFF (Escape or Shift+Escape)"); g_status_butt[5] = new Fl_Button(x, glheight + 2, sw, sht, "?"); x += sw; diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index 89fe4f0317d7416e2e134d4548cb65a11af64474..e5ff294630b5f82befda86035605f25713ee2ec0 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.63 2006-08-18 15:41:58 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.64 2006-08-18 21:11:43 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -236,7 +236,7 @@ char SelectEntity(int type, int *n, return 'c'; } else{ - *n = Process_SelectionBuffer(WID->selection, multi, + *n = Process_SelectionBuffer(WID->selection, multi, true, WID->try_selection_xywh[0], WID->try_selection_xywh[1], WID->try_selection_xywh[2], diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp index a3de3182fa9612d099de8473914f08ab3a9235c4..b607fc56966633e731cd8e7abb45d6f8e6790e43 100644 --- a/Fltk/Opengl_Window.cpp +++ b/Fltk/Opengl_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl_Window.cpp,v 1.65 2006-08-18 15:41:58 geuzaine Exp $ +// $Id: Opengl_Window.cpp,v 1.66 2006-08-18 21:11:43 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -360,11 +360,12 @@ int Opengl_Window::handle(int event) sprintf(str, "%g", point[2]); WID->context_geometry_input[4]->value(str); redraw(); } - else if(CTX.enable_mouse_selection >= 2){ // hover mode + else{ // hover mode if(curr.win[0] != prev.win[0] || curr.win[1] != prev.win[1]){ WID->make_opengl_current(); v[0] = NULL; c[0] = NULL; s[0] = NULL; r[0] = NULL; - Process_SelectionBuffer(WID->selection, 0, + Process_SelectionBuffer(WID->selection, false, + CTX.enable_mouse_selection > 1, (int)curr.win[0], (int)curr.win[1], 5, 5, v, c, s, r); if((WID->selection == ENT_POINT && v[0]) || diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp index e49ddf03970ab99b60868c2521856bfd8bef091c..ad8c81ab4534d8bfc43dc9a28558c1bbb2e9af7f 100644 --- a/Graphics/Draw.cpp +++ b/Graphics/Draw.cpp @@ -1,4 +1,4 @@ -// $Id: Draw.cpp,v 1.103 2006-08-13 20:46:54 geuzaine Exp $ +// $Id: Draw.cpp,v 1.104 2006-08-18 21:11:43 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -357,7 +357,7 @@ int fcmp_hit_depth(const void *a, const void *b) return ((hit*)a)->depth - ((hit*)b)->depth; } -int Process_SelectionBuffer(int type, bool multi, +int Process_SelectionBuffer(int entityType, bool multi, bool selectMesh, int x, int y, int w, int h, GVertex *v[SELECTION_MAX_HITS], GEdge *c[SELECTION_MAX_HITS], @@ -377,7 +377,7 @@ int Process_SelectionBuffer(int type, bool multi, InitProjection(x, y, w, h); InitPosition(); Draw_Geom(); - Draw_Mesh(); + if(selectMesh) Draw_Mesh(); glPopMatrix(); GLint numhits = glRenderMode(GL_RENDER); @@ -413,9 +413,10 @@ int Process_SelectionBuffer(int type, bool multi, return 0; } - // filter result: if type == ENT_NONE, return the closest entity of - // "lowest dimension" (point < line < surface < volume). Otherwise, - // return the closest entity of type "type" + // filter result: if entityType == ENT_NONE, return the closest + // entity of "lowest dimension" (point < line < surface < + // volume). Otherwise, return the closest entity of type + // "entityType" unsigned int typmin = 4; for(int i = 0; i < numentities; i++) { @@ -428,11 +429,11 @@ int Process_SelectionBuffer(int type, bool multi, int j = 0; for(int i = 0; i < numentities; i++) { - if((type == ENT_NONE && hits[i].type == typmin) || - (type == ENT_POINT && hits[i].type == 0) || - (type == ENT_LINE && hits[i].type == 1) || - (type == ENT_SURFACE && hits[i].type == 2) || - (type == ENT_VOLUME && hits[i].type == 3)){ + if((entityType == ENT_NONE && hits[i].type == typmin) || + (entityType == ENT_POINT && hits[i].type == 0) || + (entityType == ENT_LINE && hits[i].type == 1) || + (entityType == ENT_SURFACE && hits[i].type == 2) || + (entityType == ENT_VOLUME && hits[i].type == 3)){ switch (hits[i].type) { case 0: if(!(v[j] = GMODEL->vertexByTag(hits[i].ient))){ diff --git a/Graphics/Draw.h b/Graphics/Draw.h index aed4460a50297c78a5c269db7bd59231999f0749..efd7f4d8d24f7d2a9ed8e55bb5a614311102d9a9 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -43,7 +43,7 @@ void InitProjection(int xpick=0, int ypick=0, int wpick=0, int hpick=0); void InitPosition(void); void InitRenderModel(void); -int Process_SelectionBuffer(int type, bool multi, +int Process_SelectionBuffer(int entityType, bool multi, bool selectMesh, int x, int y, int w, int h, GVertex *v[SELECTION_MAX_HITS], GEdge *c[SELECTION_MAX_HITS], diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index a09552a002dc0fac8730e56fd6535675dcde341d..13c9be08ff94e02918b420ac3e390cf5519c3405 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.110 2006-08-16 05:25:22 geuzaine Exp $ +// $Id: Post.cpp,v 1.111 2006-08-18 21:11:43 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -472,9 +472,6 @@ void Draw_Post(void) if(CTX.post.plugin_draw_function) (*CTX.post.plugin_draw_function)(); - if(CTX.render_mode == GMSH_SELECT) - return; - if(!CTX.post.list) return;