diff --git a/Common/Context.h b/Common/Context.h index 56497de530aa74cfef385bfe687b7d5f97d82cec..783b58c64e37da9330a9e59f034bc7d4e006a541 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -115,7 +115,6 @@ public : int small_axes_pos[2]; // small axes position int threads, threads_lock; // threads?, lock (should be a mutex...) int alpha; // enable alpha blending - int fake_transparency; // use fake transparency (a la xpost) double zoom_factor; // mouse2 zoom coefficient int fontsize; // font size for fltk UI diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index c59cb43acba71ce223d67ecd0edd38212572b1df..601fc9e2fa543db001b14f32a39e5ecd32b820b5 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -483,8 +483,6 @@ StringXNumber GeneralOptions_Number[] = { { F|O, "DrawBoundingBoxes" , opt_general_draw_bounding_box, 0. , "Draw bounding boxes" }, - { F|O, "FakeTransparency" , opt_general_fake_transparency , 0. , - "Use fake transparency (cheaper than the real thing, but incorrect)" }, { F|O, "FastRedraw" , opt_general_fast_redraw, 1. , "Draw simplified model while rotating, panning and zooming" }, { F|S, "FileChooserPositionX" , opt_general_file_chooser_position0 , 200. , @@ -1059,6 +1057,9 @@ StringXNumber ViewOptions_Number[] = { { F|O, "ExternalView" , opt_view_external_view , -1. , "Index of the view used to color vector fields (-1=self)" }, + { F|O, "FakeTransparency" , opt_view_fake_transparency , 0. , + "Use fake transparency (cheaper than the real thing, but incorrect)" }, + { F|O, "GeneralizedRaiseFactor" , opt_view_gen_raise_factor , 1. , "Generalized raise amplification factor" }, { F|O, "GeneralizedRaiseView" , opt_view_gen_raise_view , -1. , @@ -1381,10 +1382,32 @@ StringXColor PostProcessingOptions_Color[] = { { 0, NULL , NULL , 0, 0, 0 , NULL } } ; +#define ELECOL PACK_COLOR(255,255,255,255), PACK_COLOR(0,0,0,255), PACK_COLOR(0,0,0,255) + StringXColor ViewOptions_Color[] = { + { F|O, "Points" , opt_view_color_points , ELECOL, "Point color" }, + { F|O, "Lines" , opt_view_color_lines , ELECOL, "Line color" }, + { F|O, "Triangles" , opt_view_color_triangles , ELECOL, "Triangle color" }, + { F|O, "Quadrangles" , opt_view_color_quadrangles , ELECOL, "Quadrangle color" }, + { F|O, "Tetrahedra" , opt_view_color_tetrahedra , ELECOL, "Tetrahedron color" }, + { F|O, "Hexahedra" , opt_view_color_hexahedra , ELECOL, "Hexahedron color" }, + { F|O, "Prisms" , opt_view_color_prisms , ELECOL, "Prism color" }, + { F|O, "Pyramids" , opt_view_color_pyramids , ELECOL, "Pyramid color" }, + { F|O, "Tangents" , opt_view_color_tangents , + PACK_COLOR(255, 255, 0, 255), + PACK_COLOR(255, 255, 0, 255), + PACK_COLOR(0, 0, 0, 255), + "Tangent vector color" }, + { F|O, "Normals" , opt_view_color_normals , + PACK_COLOR(255, 0, 0, 255), + PACK_COLOR(255, 0, 0, 255), + PACK_COLOR(0, 0, 0, 255), + "Normal vector color" }, { 0, NULL , NULL , 0, 0, 0 , NULL } } ; +#undef ELECOL + StringXColor PrintOptions_Color[] = { { 0, NULL , NULL , 0, 0, 0 , NULL } } ; diff --git a/Common/Options.cpp b/Common/Options.cpp index c40b8681106e1ea0ceea6ab4600ede2fd458ce2c..775277713466bab51b066501a5569cd9488c5fc5 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.215 2004-12-24 20:25:11 geuzaine Exp $ +// $Id: Options.cpp,v 1.216 2004-12-24 23:10:26 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -2524,17 +2524,6 @@ double opt_general_alpha_blending(OPT_ARGS_NUM) return CTX.alpha; } -double opt_general_fake_transparency(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.fake_transparency = (int)val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->gen_butt[4]->value(CTX.fake_transparency); -#endif - return CTX.fake_transparency; -} - double opt_general_vector_type(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -2600,9 +2589,20 @@ double opt_general_color_scheme(OPT_ARGS_NUM) Set_DefaultColorOptions(0, GeneralOptions_Color); Set_DefaultColorOptions(0, GeometryOptions_Color); Set_DefaultColorOptions(0, MeshOptions_Color); + Set_DefaultColorOptions(0, SolverOptions_Color); + Set_DefaultColorOptions(0, PostProcessingOptions_Color); + for(int i = 0; i < List_Nbr(CTX.post.list); i++) + Set_DefaultColorOptions(i, ViewOptions_Color); + Set_DefaultColorOptions(0, PrintOptions_Color); + Set_ColorOptions_GUI(0, GeneralOptions_Color); Set_ColorOptions_GUI(0, GeometryOptions_Color); Set_ColorOptions_GUI(0, MeshOptions_Color); + Set_ColorOptions_GUI(0, SolverOptions_Color); + Set_ColorOptions_GUI(0, PostProcessingOptions_Color); + for(int i = 0; i < List_Nbr(CTX.post.list); i++) + Set_ColorOptions_GUI(i, ViewOptions_Color); + Set_ColorOptions_GUI(0, PrintOptions_Color); } #if defined(HAVE_FLTK) if(WID && (action & GMSH_GUI)) @@ -2639,10 +2639,6 @@ double opt_general_zoom_factor(OPT_ARGS_NUM) { if(action & GMSH_SET) CTX.zoom_factor = val; -#if defined(HAVE_FLTK) - if(WID && (action & GMSH_GUI)) - WID->gen_value[15]->value(CTX.zoom_factor); -#endif return CTX.zoom_factor; } @@ -4672,6 +4668,20 @@ double opt_view_displacement_factor(OPT_ARGS_NUM) return v->DisplacementFactor; } +double opt_view_fake_transparency(OPT_ARGS_NUM) +{ + GET_VIEW(0.); + if(action & GMSH_SET) { + v->FakeTransparency = (int)val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)) + WID->view_butt[24]->value(v->FakeTransparency); +#endif + return v->FakeTransparency; +} + double opt_view_explode(OPT_ARGS_NUM) { GET_VIEW(0.); @@ -6162,3 +6172,154 @@ unsigned int opt_mesh_color_10(OPT_ARGS_COL) #endif return CTX.color.mesh.carousel[9]; } + +unsigned int opt_view_color_points(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.point = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.point, WID->view_col[0]); + } +#endif + return v->color.point; +} + +unsigned int opt_view_color_lines(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.line = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.line, WID->view_col[1]); + } +#endif + return v->color.line; +} + +unsigned int opt_view_color_triangles(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.triangle = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.triangle, WID->view_col[2]); + } +#endif + return v->color.triangle; +} + +unsigned int opt_view_color_quadrangles(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.quadrangle = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.quadrangle, WID->view_col[3]); + } +#endif + return v->color.quadrangle; +} + +unsigned int opt_view_color_tetrahedra(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.tetrahedron = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.tetrahedron, WID->view_col[4]); + } +#endif + return v->color.tetrahedron; +} + +unsigned int opt_view_color_hexahedra(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.hexahedron = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.hexahedron, WID->view_col[5]); + } +#endif + return v->color.hexahedron; +} + +unsigned int opt_view_color_prisms(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.prism = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.prism, WID->view_col[6]); + } +#endif + return v->color.prism; +} + +unsigned int opt_view_color_pyramids(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.pyramid = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.pyramid, WID->view_col[7]); + } +#endif + return v->color.pyramid; +} + +unsigned int opt_view_color_tangents(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.tangents = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.tangents, WID->view_col[8]); + } +#endif + return v->color.tangents; +} + +unsigned int opt_view_color_normals(OPT_ARGS_COL) +{ + GET_VIEW(0); + if(action & GMSH_SET) { + v->color.normals = val; + v->Changed = 1; + } +#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)){ + CCC(v->color.normals, WID->view_col[9]); + } +#endif + return v->color.normals; +} + diff --git a/Common/Options.h b/Common/Options.h index 2aa227d09f2b1e60d3719d7a324e51c71ccaa2ca..6fd9da378b8c1d9c040001401380c517884cd96c 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -270,7 +270,6 @@ double opt_general_small_axes_position1(OPT_ARGS_NUM); double opt_general_quadric_subdivisions(OPT_ARGS_NUM); double opt_general_double_buffer(OPT_ARGS_NUM); double opt_general_alpha_blending(OPT_ARGS_NUM); -double opt_general_fake_transparency(OPT_ARGS_NUM); double opt_general_vector_type(OPT_ARGS_NUM); double opt_general_arrow_head_radius(OPT_ARGS_NUM); double opt_general_arrow_stem_length(OPT_ARGS_NUM); @@ -477,6 +476,7 @@ double opt_view_arrow_stem_radius(OPT_ARGS_NUM); double opt_view_normals(OPT_ARGS_NUM); double opt_view_tangents(OPT_ARGS_NUM); double opt_view_displacement_factor(OPT_ARGS_NUM); +double opt_view_fake_transparency(OPT_ARGS_NUM); double opt_view_explode(OPT_ARGS_NUM); double opt_view_visible(OPT_ARGS_NUM); double opt_view_intervals_type(OPT_ARGS_NUM); @@ -590,7 +590,16 @@ unsigned int opt_mesh_color_7(OPT_ARGS_COL); unsigned int opt_mesh_color_8(OPT_ARGS_COL); unsigned int opt_mesh_color_9(OPT_ARGS_COL); unsigned int opt_mesh_color_10(OPT_ARGS_COL); - +unsigned int opt_view_color_points(OPT_ARGS_COL); +unsigned int opt_view_color_lines(OPT_ARGS_COL); +unsigned int opt_view_color_triangles(OPT_ARGS_COL); +unsigned int opt_view_color_quadrangles(OPT_ARGS_COL); +unsigned int opt_view_color_tetrahedra(OPT_ARGS_COL); +unsigned int opt_view_color_hexahedra(OPT_ARGS_COL); +unsigned int opt_view_color_prisms(OPT_ARGS_COL); +unsigned int opt_view_color_pyramids(OPT_ARGS_COL); +unsigned int opt_view_color_tangents(OPT_ARGS_COL); +unsigned int opt_view_color_normals(OPT_ARGS_COL); // Data structures and global functions diff --git a/Common/Views.cpp b/Common/Views.cpp index 294d1743799381670e08d094eff1731b373b3521..b4d1d05dd209a67233ef948eda3b69a96e6d8860 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.151 2004-12-24 04:58:20 geuzaine Exp $ +// $Id: Views.cpp,v 1.152 2004-12-24 23:10:26 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -657,10 +657,21 @@ void CopyViewOptions(Post_View * src, Post_View * dest) dest->ExternalViewIndex = src->ExternalViewIndex; dest->ViewIndexForGenRaise = src->ViewIndexForGenRaise; dest->UseGenRaise = src->UseGenRaise; + dest->FakeTransparency = src->FakeTransparency; dest->GenRaiseFactor = src->GenRaiseFactor; strcpy(dest->GenRaiseX, src->GenRaiseX); strcpy(dest->GenRaiseY, src->GenRaiseY); strcpy(dest->GenRaiseZ, src->GenRaiseZ); + dest->color.point = src->color.point; + dest->color.line = src->color.line; + dest->color.triangle = src->color.triangle; + dest->color.quadrangle = src->color.quadrangle; + dest->color.tetrahedron = src->color.tetrahedron; + dest->color.hexahedron = src->color.hexahedron; + dest->color.prism = src->color.prism; + dest->color.pyramid = src->color.pyramid; + dest->color.tangents = src->color.tangents; + dest->color.normals = src->color.normals; ColorTable_Copy(&src->CT); ColorTable_Paste(&dest->CT); } diff --git a/Common/Views.h b/Common/Views.h index 57932eabc2e5817a166b67732e906f37e379a686..a3b8904026252b987ad0193e510725caee031922 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -83,7 +83,7 @@ class Post_View{ int Visible, IntervalsType, NbIso, NbAbscissa, ArrowSizeProportional; int Light, LightTwoSide, SmoothNormals; double AngleSmoothNormals; - int SaturateValues; + int SaturateValues, FakeTransparency; int ShowElement, ShowTime, ShowScale; int ScaleType, RangeType; int VectorType, TensorType, ArrowLocation; @@ -100,6 +100,13 @@ class Post_View{ double GenRaiseFactor; char GenRaiseX[256], GenRaiseY[256], GenRaiseZ[256]; void *GenRaise_f[3]; + + // color options + struct{ + unsigned int point, line, triangle, quadrangle; + unsigned int tetrahedron, hexahedron, prism, pyramid; + unsigned int tangents, normals; + } color; // dynamic double (*GVFI) (double min, double max, int nb, int index); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 1637c4ff0b4d2d92bca57121b9213cd3f2e109ab..63c1c423f0e948f66d1c9a6eb955e526193acb90 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.308 2004-12-24 03:25:36 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.309 2004-12-24 23:10:26 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -912,7 +912,6 @@ void general_options_ok_cb(CALLBACK_ARGS) opt_general_fast_redraw(0, GMSH_SET, WID->gen_butt[2]->value()); if(opt_general_double_buffer(0, GMSH_GET, 0) != WID->gen_butt[3]->value()) opt_general_double_buffer(0, GMSH_SET, WID->gen_butt[3]->value()); - opt_general_fake_transparency(0, GMSH_SET, WID->gen_butt[4]->value()); opt_general_trackball(0, GMSH_SET, WID->gen_butt[5]->value()); opt_general_terminal(0, GMSH_SET, WID->gen_butt[7]->value()); double sessionrc = opt_general_session_save(0, GMSH_GET, 0); @@ -940,7 +939,6 @@ void general_options_ok_cb(CALLBACK_ARGS) opt_general_quadric_subdivisions(0, GMSH_SET, WID->gen_value[11]->value()); opt_general_graphics_fontsize(0, GMSH_SET, WID->gen_value[12]->value()); opt_general_clip_factor(0, GMSH_SET, WID->gen_value[14]->value()); - opt_general_zoom_factor(0, GMSH_SET, WID->gen_value[15]->value()); opt_general_default_filename(0, GMSH_SET, (char *)WID->gen_input[0]->value()); opt_general_editor(0, GMSH_SET, (char *)WID->gen_input[1]->value()); @@ -3484,6 +3482,7 @@ void view_options_ok_cb(CALLBACK_ARGS) double draw_vectors = opt_view_draw_vectors(current, GMSH_GET, 0); double draw_tensors = opt_view_draw_tensors(current, GMSH_GET, 0); double use_gen_raise = opt_view_use_gen_raise(current, GMSH_GET, 0); + double fake_transparency = opt_view_fake_transparency(current, GMSH_GET, 0); double normals = opt_view_normals(current, GMSH_GET, 0); double tangents = opt_view_tangents(current, GMSH_GET, 0); @@ -3745,6 +3744,10 @@ void view_options_ok_cb(CALLBACK_ARGS) if(force || (val != use_gen_raise)) opt_view_use_gen_raise(i, GMSH_SET, val); + val = WID->view_butt[24]->value(); + if(force || (val != fake_transparency)) + opt_view_fake_transparency(i, GMSH_SET, val); + // view_values val = WID->view_value[0]->value(); @@ -3883,6 +3886,21 @@ void view_options_ok_cb(CALLBACK_ARGS) if(force || strcmp(str, gen_raise2)) opt_view_gen_raise2(i, GMSH_SET, str); + // colors (since the color buttons modify the values directly + // through callbacks, we can use the opt_XXX routines directly) + if(force || (i != current)){ + opt_view_color_points(i, GMSH_SET, opt_view_color_points(current, GMSH_GET, 0)); + opt_view_color_lines(i, GMSH_SET, opt_view_color_lines(current, GMSH_GET, 0)); + opt_view_color_triangles(i, GMSH_SET, opt_view_color_triangles(current, GMSH_GET, 0)); + opt_view_color_quadrangles(i, GMSH_SET, opt_view_color_quadrangles(current, GMSH_GET, 0)); + opt_view_color_tetrahedra(i, GMSH_SET, opt_view_color_tetrahedra(current, GMSH_GET, 0)); + opt_view_color_hexahedra(i, GMSH_SET, opt_view_color_hexahedra(current, GMSH_GET, 0)); + opt_view_color_prisms(i, GMSH_SET, opt_view_color_prisms(current, GMSH_GET, 0)); + opt_view_color_pyramids(i, GMSH_SET, opt_view_color_pyramids(current, GMSH_GET, 0)); + opt_view_color_normals(i, GMSH_SET, opt_view_color_normals(current, GMSH_GET, 0)); + opt_view_color_tangents(i, GMSH_SET, opt_view_color_tangents(current, GMSH_GET, 0)); + } + // colorbar window if(force || (WID->view_colorbar_window->changed() && i != current)) { diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp index f9aeb51832d5b4640e1d1909b9abfd0456df4682..9fed1a63db643ce21c9cef247f25e2a6b9636d34 100644 --- a/Fltk/Colorbar_Window.cpp +++ b/Fltk/Colorbar_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Colorbar_Window.cpp,v 1.43 2004-12-24 20:25:11 geuzaine Exp $ +// $Id: Colorbar_Window.cpp,v 1.44 2004-12-24 23:10:26 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -223,13 +223,10 @@ void Colorbar_Window::redraw_range(int a, int b) // print colortable mode and help fl_font(FL_HELVETICA, font_height); fl_color(fl_contrast(FL_BLACK, color_bg)); - int xx0 = 8, xx1 = 12 * font_height, yy0 = 8; + int xx0 = 10, xx1 = 13 * font_height, yy0 = 10; if(help_flag) { i = 0; - fl_draw("0, 1, 2, 3, ...", xx0, yy0 + (i + 1) * font_height); - fl_draw("select predefined colormap", xx1, yy0 + (i + 1) * font_height); - i++; - fl_draw("Ctrl+0, Ctrl+1, ...", xx0, yy0 + (i + 1) * font_height); + fl_draw("1, 2, ..., Ctrl+1, Ctrl+2, ...", xx0, yy0 + (i + 1) * font_height); fl_draw("select predefined colormap", xx1, yy0 + (i + 1) * font_height); i++; fl_draw("mouse1", xx0, yy0 + (i + 1) * font_height); diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 4d7ae559e6c7a62ecb737b9f9c282e9f3c985a8c..2c24eadcad85ed80c8992b058e8e0c3df064264a 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.389 2004-12-24 03:25:37 geuzaine Exp $ +// $Id: GUI.cpp,v 1.390 2004-12-24 23:10:27 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1514,7 +1514,7 @@ void GUI::check_rotation_center_button() void GUI::create_option_window() { - int width = 41 * fontsize; + int width = 42 * fontsize; int height = 12 * BH + 5 * WB; int L = 105 + WB; @@ -1619,12 +1619,6 @@ void GUI::create_option_window() gen_value[10] = new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 9 * BH, IW / 3, BH, "Rotation center"); gen_value[10]->align(FL_ALIGN_RIGHT); - gen_value[15] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Middle button zoom acceleration factor"); - gen_value[15]->minimum(0.05); - gen_value[15]->maximum(20.); - gen_value[15]->step(0.05); - gen_value[15]->align(FL_ALIGN_RIGHT); - o->end(); } { @@ -1700,11 +1694,6 @@ void GUI::create_option_window() gen_value[11]->step(1); gen_value[11]->align(FL_ALIGN_RIGHT); - gen_butt[4] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Use fake transparency mode"); - gen_butt[4]->type(FL_TOGGLE_BUTTON); - gen_butt[4]->down_box(TOGGLE_BOX); - gen_butt[4]->selection_color(TOGGLE_COLOR); - gen_value[6] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Point size"); gen_value[6]->minimum(0.1); gen_value[6]->maximum(50); @@ -2801,6 +2790,26 @@ void GUI::create_option_window() Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Color"); o->hide(); + view_butt[24] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Use fake transparency mode"); + view_butt[24]->type(FL_TOGGLE_BUTTON); + view_butt[24]->down_box(TOGGLE_BOX); + view_butt[24]->selection_color(TOGGLE_COLOR); + + Fl_Scroll *s = new Fl_Scroll(L + 2 * WB, 3 * WB + 2 * BH, IW + 20, height - 5 * WB - 2 * BH); + int i = 0; + while(ViewOptions_Color[i].str) { + view_col[i] = new Fl_Button(L + 2 * WB, 3 * WB + (2 + i) * BH, IW, BH, ViewOptions_Color[i].str); + view_col[i]->callback(color_cb, (void *)ViewOptions_Color[i].function); + i++; + } + s->end(); + + o->end(); + } + { + Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "Map"); + o->hide(); + view_colorbar_window = new Colorbar_Window(L + 2 * WB, 2 * WB + BH, width - 4 * WB, height - 4 * WB - BH); view_colorbar_window->end(); @@ -2981,6 +2990,18 @@ void GUI::update_view_window(int num) //opt_view_tensor_type(num, GMSH_GUI, 0); view_push_butt[0]->callback(view_arrow_param_cb, (void*)num); + opt_view_fake_transparency(num, GMSH_GUI, 0); + opt_view_color_points(num, GMSH_GUI, 0); + opt_view_color_lines(num, GMSH_GUI, 0); + opt_view_color_triangles(num, GMSH_GUI, 0); + opt_view_color_quadrangles(num, GMSH_GUI, 0); + opt_view_color_tetrahedra(num, GMSH_GUI, 0); + opt_view_color_hexahedra(num, GMSH_GUI, 0); + opt_view_color_prisms(num, GMSH_GUI, 0); + opt_view_color_pyramids(num, GMSH_GUI, 0); + opt_view_color_tangents(num, GMSH_GUI, 0); + opt_view_color_normals(num, GMSH_GUI, 0); + view_colorbar_window->update(v->Name, v->Min, v->Max, &v->CT, &v->Changed); } diff --git a/Fltk/GUI.h b/Fltk/GUI.h index 29b6c2f35f5fd4df184261e1555d96fa61ee7d3f..5f36c304943cebd4313120299cc3afe0b3ac4ed5 100644 --- a/Fltk/GUI.h +++ b/Fltk/GUI.h @@ -205,6 +205,7 @@ public: Fl_Repeat_Button *view_butt_rep[100] ; Fl_Button *view_push_butt[100] ; Fl_Choice *view_choice[100] ; + Fl_Button *view_col[50] ; Colorbar_Window *view_colorbar_window ; Fl_Return_Button *view_ok ; diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index c2027fd7a0d154279a06e0f52d8e4529e29a50aa..a69ed3451a4c2b49a19a00ca0db8203b44d09819 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.86 2004-12-07 04:52:26 geuzaine Exp $ +// $Id: Post.cpp,v 1.87 2004-12-24 23:10:27 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -523,7 +523,7 @@ void Draw_Post(void) // initialize alpha blending for transparency if(CTX.alpha && ColorTable_IsAlpha(&v->CT)){ - if(CTX.fake_transparency){ + if(v->FakeTransparency){ // simple additive blending "a la xpost": glBlendFunc(GL_SRC_ALPHA, GL_ONE); // glBlendEquation(GL_FUNC_ADD); // maximum intensity projection "a la volsuite": @@ -699,7 +699,7 @@ void Draw_Post(void) if(v->TriVertexArray && v->TriVertexArray->num){ - if(CTX.alpha && ColorTable_IsAlpha(&v->CT) && !CTX.fake_transparency && + if(CTX.alpha && ColorTable_IsAlpha(&v->CT) && !v->FakeTransparency && (changedEye() || v->Changed)){ Msg(DEBUG, "Sorting View[%d] for transparency (WITH vertex array)", v->Index); v->TriVertexArray->sort(storedEye); diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index 87cae4ff99edce8ef4821399cc4f0f84b5b66b03..abfc5c19de0146b3a517745278f5ff5b7293e3f8 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.56 2004-12-08 18:03:44 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.57 2004-12-24 23:10:27 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -37,21 +37,24 @@ extern Context_T CTX; void Draw_ElementBoundary(int type, Post_View * View, double *X, double *Y, double *Z) { - glColor4ubv((GLubyte *) & CTX.color.fg); switch (type) { case POST_POINT: + glColor4ubv((GLubyte *) & View->color.point); Draw_Point(View->PointType, View->PointSize, X, Y, Z, View->Light); break; case POST_LINE: + glColor4ubv((GLubyte *) & View->color.line); Draw_Line(0, View->LineWidth, X, Y, Z, View->Light); break; case POST_TRIANGLE: + glColor4ubv((GLubyte *) & View->color.triangle); glBegin(GL_LINE_LOOP); for(int k = 0; k < 3; k++) glVertex3d(X[k], Y[k], Z[k]); glEnd(); break; case POST_TETRAHEDRON: + glColor4ubv((GLubyte *) & View->color.tetrahedron); glBegin(GL_LINES); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); @@ -68,12 +71,14 @@ void Draw_ElementBoundary(int type, Post_View * View, glEnd(); break; case POST_QUADRANGLE: + glColor4ubv((GLubyte *) & View->color.quadrangle); glBegin(GL_LINE_LOOP); for(int k = 0; k < 4; k++) glVertex3d(X[k], Y[k], Z[k]); glEnd(); break; case POST_HEXAHEDRON: + glColor4ubv((GLubyte *) & View->color.hexahedron); glBegin(GL_LINES); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); @@ -102,6 +107,7 @@ void Draw_ElementBoundary(int type, Post_View * View, glEnd(); break; case POST_PRISM: + glColor4ubv((GLubyte *) & View->color.prism); glBegin(GL_LINES); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); @@ -124,6 +130,7 @@ void Draw_ElementBoundary(int type, Post_View * View, glEnd(); break; case POST_PYRAMID: + glColor4ubv((GLubyte *) & View->color.pyramid); glBegin(GL_LINES); glVertex3d(X[0], Y[0], Z[0]); glVertex3d(X[1], Y[1], Z[1]); @@ -261,7 +268,7 @@ void Draw_ScalarLine(Post_View * View, int preproNormals, t[0] *= View->Tangents * CTX.pixel_equiv_x / CTX.s[0]; t[1] *= View->Tangents * CTX.pixel_equiv_x / CTX.s[1]; t[2] *= View->Tangents * CTX.pixel_equiv_x / CTX.s[2]; - glColor4ubv((GLubyte *) & CTX.color.mesh.tangents); + glColor4ubv((GLubyte *) & View->color.tangents); Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, (X[0] + X[1]) / 2., (Y[0] + Y[1]) / 2., (Z[0] + Z[1]) / 2., @@ -380,7 +387,7 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, t[0] *= View->Normals * CTX.pixel_equiv_x / CTX.s[0]; t[1] *= View->Normals * CTX.pixel_equiv_x / CTX.s[1]; t[2] *= View->Normals * CTX.pixel_equiv_x / CTX.s[2]; - glColor4ubv((GLubyte *) & CTX.color.mesh.normals); + glColor4ubv((GLubyte *) & View->color.normals); Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, (X[0] + X[1] + X[2]) / 3., @@ -1007,7 +1014,7 @@ void Draw_VectorElement(int type, Post_View * View, int preproNormals, nn[0] *= View->Normals * CTX.pixel_equiv_x / CTX.s[0]; nn[1] *= View->Normals * CTX.pixel_equiv_x / CTX.s[1]; nn[2] *= View->Normals * CTX.pixel_equiv_x / CTX.s[2]; - glColor4ubv((GLubyte *) & CTX.color.mesh.normals); + glColor4ubv((GLubyte *) & View->color.normals); Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, xc, yc, zc, nn[0], nn[1], nn[2], View->Light); @@ -1019,7 +1026,7 @@ void Draw_VectorElement(int type, Post_View * View, int preproNormals, t[0] *= View->Tangents * CTX.pixel_equiv_x / CTX.s[0]; t[1] *= View->Tangents * CTX.pixel_equiv_x / CTX.s[1]; t[2] *= View->Tangents * CTX.pixel_equiv_x / CTX.s[2]; - glColor4ubv((GLubyte *) & CTX.color.mesh.tangents); + glColor4ubv((GLubyte *) & View->color.tangents); Draw_Vector(CTX.vector_type, 0, CTX.arrow_rel_head_radius, CTX.arrow_rel_stem_length, CTX.arrow_rel_stem_radius, xc, yc, zc, t[0], t[1], t[2], View->Light); diff --git a/Makefile b/Makefile index f23f9b42d105fd1fbcb8b7fd2f7ddc5bd75ea033..3815307aa7ab6667d73c7c5b2961b0cade01ea1b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.381 2004-12-23 03:21:36 geuzaine Exp $ +# $Id: Makefile,v 1.382 2004-12-24 23:10:25 geuzaine Exp $ # # Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle # @@ -93,7 +93,7 @@ clean-most: for i in doc lib ${GMSH_DIRS:Netgen=}; do (cd $$i && ${MAKE} clean); done rm -f ${GMSH_VERSION_FILE} -depend: +depend: initialtag for i in ${GMSH_DIRS};\ do (cd $$i && ${MAKE} depend "FLAGS=-DHAVE_GSL -DHAVE_FLTK"); done diff --git a/doc/texinfo/opt_general.texi b/doc/texinfo/opt_general.texi index 7ae2e483ac17ea1b2c0b4d8ca6b034de545692fe..92178d16e4306c75b85503b08ac9c6c58279c5e6 100644 --- a/doc/texinfo/opt_general.texi +++ b/doc/texinfo/opt_general.texi @@ -269,11 +269,6 @@ Draw bounding boxes@* Default value: @code{0}@* Saved in: @code{General.OptionsFileName} -@item General.FakeTransparency -Use fake transparency (cheaper than the real thing, but incorrect)@* -Default value: @code{0}@* -Saved in: @code{General.OptionsFileName} - @item General.FastRedraw Draw simplified model while rotating, panning and zooming@* Default value: @code{1}@* diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi index 2c42ae27916ea8f104b6a469231bf349baee99b6..89fc85afce91fc9ae6f485dd8c4541ad1209ca7f 100644 --- a/doc/texinfo/opt_view.texi +++ b/doc/texinfo/opt_view.texi @@ -214,6 +214,11 @@ Index of the view used to color vector fields (-1=self)@* Default value: @code{-1}@* Saved in: @code{General.OptionsFileName} +@item View.FakeTransparency +Use fake transparency (cheaper than the real thing, but incorrect)@* +Default value: @code{0}@* +Saved in: @code{General.OptionsFileName} + @item View.GeneralizedRaiseFactor Generalized raise amplification factor@* Default value: @code{1}@* @@ -414,6 +419,56 @@ Width (in pixels) of the scale or 2D graph@* Default value: @code{300}@* Saved in: @code{General.OptionsFileName} +@item View.Color.Points +Point color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Lines +Line color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Triangles +Triangle color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Quadrangles +Quadrangle color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Tetrahedra +Tetrahedron color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Hexahedra +Hexahedron color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Prisms +Prism color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Pyramids +Pyramid color@* +Default value: @code{@{255,255,255@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Tangents +Tangent vector color@* +Default value: @code{@{255,255,0@}}@* +Saved in: @code{General.OptionsFileName} + +@item View.Color.Normals +Normal vector color@* +Default value: @code{@{255,0,0@}}@* +Saved in: @code{General.OptionsFileName} + @item View.ColorTable Color table used to draw the view@* Saved in: @code{General.OptionsFileName}