diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 749e3b38462121b1f9bd0ad4d69fa39518fdd49e..f8d2070bfae0b444483ca6e2c891c8ad3e44b146 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.472 2006-11-05 18:02:59 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.473 2006-11-07 19:47:12 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -2121,6 +2121,75 @@ void visibility_number_cb(CALLBACK_ARGS) Draw(); } +void visibility_hide_cb(CALLBACK_ARGS) +{ + char *str = (char*)data; + int what; + + if(!strcmp(str, "elements")){ + CTX.pick_elements = 1; + what = ENT_ALL; + } + else if(!strcmp(str, "points")){ + CTX.pick_elements = 0; + what = ENT_POINT; + } + else if(!strcmp(str, "lines")){ + CTX.pick_elements = 0; + what = ENT_LINE; + } + else if(!strcmp(str, "surfaces")){ + CTX.pick_elements = 0; + what = ENT_SURFACE; + } + else if(!strcmp(str, "volumes")){ + CTX.pick_elements = 0; + what = ENT_VOLUME; + } + else + return; + + std::vector<GVertex*> vertices; + std::vector<GEdge*> edges; + std::vector<GFace*> faces; + std::vector<GRegion*> regions; + std::vector<MElement*> elements; + + while(1) { + CTX.mesh.changed = ENT_ALL; + Draw(); + Msg(ONSCREEN, "Select %s\n[Press 'q' to abort]", str); + char ib = SelectEntity(what, vertices, edges, faces, regions, elements); + if(ib == 'l') { + if(CTX.pick_elements){ + for(unsigned int i = 0; i < elements.size(); i++) + elements[i]->setVisibility(0); + } + else{ + for(unsigned int i = 0; i < vertices.size(); i++) + vertices[i]->setVisibility(0); + for(unsigned int i = 0; i < edges.size(); i++) + edges[i]->setVisibility(0); + for(unsigned int i = 0; i < faces.size(); i++) + faces[i]->setVisibility(0); + for(unsigned int i = 0; i < regions.size(); i++) + regions[i]->setVisibility(0); + } + int pos = WID->vis_browser->position(); + visibility_cb(NULL, NULL); + WID->vis_browser->position(pos); + } + if(ib == 'q'){ + break; + } + } + + CTX.mesh.changed = ENT_ALL; + CTX.pick_elements = 0; + Draw(); + Msg(ONSCREEN, ""); +} + // Clipping planes menu void clip_cb(CALLBACK_ARGS) diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index 5f853b50495d2a640c01aa4813ee7626e4bbf404..392857a2eef356ffdcdc13d88f46a174c6dbb971 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -153,6 +153,7 @@ void message_save_cb(CALLBACK_ARGS); void visibility_cb(CALLBACK_ARGS); void visibility_sort_cb(CALLBACK_ARGS); void visibility_number_cb(CALLBACK_ARGS); +void visibility_hide_cb(CALLBACK_ARGS); void visibility_ok_cb(CALLBACK_ARGS); void visibility_save_cb(CALLBACK_ARGS); void visibility_delete_cb(CALLBACK_ARGS); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 9aab3e8223dd3147ad524cd419b763220e86236e..3003a4742ab5723f53fd4b52fb9d6ceb10a4003c 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.560 2006-11-05 18:02:59 geuzaine Exp $ +// $Id: GUI.cpp,v 1.561 2006-11-07 19:47:12 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -3983,18 +3983,21 @@ void GUI::create_visibility_window() Fl_Group::current()->resizable(o); } { - Fl_Group *o = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - BH, "Numeric Input"); + Fl_Group *o = new Fl_Group(WB, WB + BH, width - 2 * WB, height - 3 * WB - BH, "Selector"); o->resizable(NULL); + Fl_Box *b1 = new Fl_Box(FL_NO_BOX, 2 * WB, 2 * WB + 1 * BH, IW, BH, "Show/hide by identification number:"); + b1->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); + for(int i = 0; i < 6; i++){ - vis_input[i] = new Fl_Input(width/2-WB/2-IW, 2 * WB + (i+1) * BH, IW, BH); + vis_input[i] = new Fl_Input(width/2-WB/2-IW, 2 * WB + (i+2) * BH, IW, BH); vis_input[i]->align(FL_ALIGN_LEFT); vis_input[i]->value("*"); - Fl_Button *o1 = new Fl_Button(width/2+WB/2, 2 * WB + (i+1) * BH, BB, BH, "Show"); + Fl_Button *o1 = new Fl_Button(width/2+WB/2, 2 * WB + (i+2) * BH, BB, BH, "Show"); o1->callback(visibility_number_cb, (void *)(100+i)); - Fl_Button *o2 = new Fl_Button(width/2+WB/2+BB+WB, 2 * WB + (i+1) * BH, BB, BH, "Hide"); + Fl_Button *o2 = new Fl_Button(width/2+WB/2+BB+WB, 2 * WB + (i+2) * BH, BB, BH, "Hide"); o2->callback(visibility_number_cb, (void *)i); } @@ -4016,12 +4019,26 @@ void GUI::create_visibility_window() vis_input[5]->label("Volume"); vis_input[5]->tooltip("Enter volume number, or *"); + Fl_Box *b2 = new Fl_Box(FL_NO_BOX, 2 * WB, 2 * WB + 9 * BH, IW, BH, "Hide with mouse:"); + b2->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); + + Fl_Button *butt1 = new Fl_Button(width/2-WB/2-IW, 2 * WB + 10 * BH, IW, BH, "Elements"); + butt1->callback(visibility_hide_cb, (void *)"elements"); + Fl_Button *butt2 = new Fl_Button(width/2-WB/2-IW, 2 * WB + 11 * BH, IW, BH, "Points"); + butt2->callback(visibility_hide_cb, (void *)"points"); + Fl_Button *butt3 = new Fl_Button(width/2-WB/2-IW, 2 * WB + 12 * BH, IW, BH, "Lines"); + butt3->callback(visibility_hide_cb, (void *)"lines"); + Fl_Button *butt4 = new Fl_Button(width/2-WB/2-IW, 2 * WB + 13 * BH, IW, BH, "Surfaces"); + butt4->callback(visibility_hide_cb, (void *)"surfaces"); + Fl_Button *butt5 = new Fl_Button(width/2-WB/2-IW, 2 * WB + 14 * BH, IW, BH, "Volumes"); + butt5->callback(visibility_hide_cb, (void *)"volumes"); + o->end(); } o->end(); vis_window->resizable(o); - vis_window->size_range(width, 8 * BH + 5 * WB, width); + vis_window->size_range(width, 16 * BH + 5 * WB, width); { Fl_Button *o = new Fl_Button(width - BB - WB, height - BH - WB, BB, BH, "Cancel");