diff --git a/Common/Message.h b/Common/Message.h index 3c799c9cf949dc245da960ad0aaff50a35790872..7cc1b7f8fe325b7111719ae1265fc8ffca7bd759 100644 --- a/Common/Message.h +++ b/Common/Message.h @@ -55,8 +55,7 @@ #define STATUS2N 25 // Same as STATUS2, but not going into the log file #define STATUS3N 26 // Same as STATUS3, but not going into the log file -#define ONSCREEN1 27 // Persistent on-screen message (line 1) -#define ONSCREEN2 28 // Persistent on-screen message (line 2) +#define ONSCREEN 27 // Persistent on-screen message #define DIRECT 30 // Direct message (no special formatting) #define SOLVER 31 // Solver message diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 6244df8ef909a06aca1de01e49aff827128c8fd1..377bc0508a7dfee1383c97a09df9820841d138f7 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.235 2004-05-18 18:00:29 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.236 2004-05-18 18:52:00 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1010,8 +1010,7 @@ void general_options_rotation_center_select_cb(CALLBACK_ARGS) } Msg(STATUS3N, "Setting rotation center"); - Msg(ONSCREEN1, "Select point"); - Msg(ONSCREEN2, "[Press 'q' to abort]"); + Msg(ONSCREEN, "Select point\n[Press 'q' to abort]"); char ib = SelectEntity(ENT_POINT, &v, &c, &s); if(ib == 'l') { // This would bypass the "Apply" button... Not necessarily bad, @@ -1028,8 +1027,7 @@ void general_options_rotation_center_select_cb(CALLBACK_ARGS) ZeroHighlight(THEM); Draw(); Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void general_options_ok_cb(CALLBACK_ARGS) @@ -1776,8 +1774,8 @@ static void _new_multiline(int type) Draw(); } - Msg(ONSCREEN1, "Select control points"); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select control points\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); n = 0; while(1) { @@ -1822,8 +1820,7 @@ static void _new_multiline(int type) } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void geometry_elementary_add_new_line_cb(CALLBACK_ARGS) @@ -1843,15 +1840,15 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS) Draw(); } - Msg(ONSCREEN2, "[Press 'u' to undo last selection or 'q' to abort]"); - n = 0; while(1) { Msg(STATUS3N, "Creating straight line"); if(n == 0) - Msg(ONSCREEN1, "Select start point"); + Msg(ONSCREEN, "Select start point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); if(n == 1) - Msg(ONSCREEN1, "Select end point"); + Msg(ONSCREEN, "Select end point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); char ib = SelectEntity(ENT_POINT, &v, &c, &s); if(ib == 'l') { p[n++] = v->Num; @@ -1877,8 +1874,7 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS) } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void geometry_elementary_add_new_spline_cb(CALLBACK_ARGS) @@ -1903,17 +1899,18 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS) Draw(); } - Msg(ONSCREEN2, "[Press 'u' to undo last selection or 'q' to abort]"); - n = 0; while(1) { Msg(STATUS3N, "Creating circle"); if(n == 0) - Msg(ONSCREEN1, "Select start point"); + Msg(ONSCREEN, "Select start point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); if(n == 1) - Msg(ONSCREEN1, "Select center point"); + Msg(ONSCREEN, "Select center point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); if(n == 2) - Msg(ONSCREEN1, "Select end point"); + Msg(ONSCREEN, "Select end point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); char ib = SelectEntity(ENT_POINT, &v, &c, &s); if(ib == 'l') { p[n++] = v->Num; @@ -1939,8 +1936,7 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS) } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS) @@ -1955,19 +1951,21 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS) Draw(); } - Msg(ONSCREEN2, "[Press 'u' to undo last selection or 'q' to abort]"); - n = 0; while(1) { Msg(STATUS3N, "Creating ellipse"); if(n == 0) - Msg(ONSCREEN1, "Select start point"); + Msg(ONSCREEN, "Select start point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); if(n == 1) - Msg(ONSCREEN1, "Select center point"); + Msg(ONSCREEN, "Select center point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); if(n == 2) - Msg(ONSCREEN1, "Select major axis point"); + Msg(ONSCREEN, "Select major axis point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); if(n == 3) - Msg(ONSCREEN1, "Select end point"); + Msg(ONSCREEN, "Select end point\n" + "[Press 'u' to undo last selection or 'q' to abort]"); char ib = SelectEntity(ENT_POINT, &v, &c, &s); if(ib == 'l') { p[n++] = v->Num; @@ -1993,8 +1991,7 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS) } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } static void _new_surface_volume(int mode) @@ -2031,13 +2028,15 @@ static void _new_surface_volume(int mode) while(1) { if(type == ENT_LINE){ Msg(STATUS3N, "Creating surface"); - Msg(ONSCREEN1, "Select surface boundary"); + Msg(ONSCREEN, "Select surface boundary\n" + "[Press 'u' to undo last selection or 'q' to abort]"); } else{ Msg(STATUS3N, "Creating volume"); - Msg(ONSCREEN1, "Select volume boundary"); + Msg(ONSCREEN, "Select volume boundary\n" + "[Press 'u' to undo last selection or 'q' to abort]"); } - Msg(ONSCREEN2, "[Press 'u' to undo last selection or 'q' to abort]"); + char ib = SelectEntity(type, &v, &c, &s); if(ib == 'q') { ZeroHighlight(THEM); @@ -2076,8 +2075,8 @@ static void _new_surface_volume(int mode) List_Reset(ListUnsorted); List_Add(List2, &num); while(1) { - Msg(ONSCREEN1, "Select hole boundaries (if none, press 'e')"); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select hole boundaries (if none, press 'e')\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); ib = SelectEntity(type, &v, &c, &s); if(ib == 'q') { ZeroHighlight(THEM); @@ -2143,8 +2142,7 @@ stopall:; List_Delete(List2); List_Delete(ListUnsorted); Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void geometry_elementary_add_new_planesurface_cb(CALLBACK_ARGS) @@ -2195,8 +2193,7 @@ static void _transform_point_line_surface(int transfo, int mode, char *what) } } - Msg(ONSCREEN1, "Select %s", str); - Msg(ONSCREEN2, "[Press 'q' to abort]"); + Msg(ONSCREEN, "Select %s\n[Press 'q' to abort]", str); while(1) { Msg(STATUS3N, "Transforming %s", str); @@ -2276,8 +2273,7 @@ static void _transform_point_line_surface(int transfo, int mode, char *what) } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void geometry_elementary_add_translate_cb(CALLBACK_ARGS) @@ -2580,8 +2576,8 @@ static void _add_physical(char *what) return; } - Msg(ONSCREEN1, "Select %s", str); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select %s\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]", str); List1 = List_Create(5, 5, sizeof(int)); while(1) { @@ -2626,8 +2622,7 @@ static void _add_physical(char *what) } List_Delete(List1); Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void geometry_physical_add_cb(CALLBACK_ARGS) @@ -2726,8 +2721,8 @@ void mesh_define_length_cb(CALLBACK_ARGS) WID->create_mesh_context_window(0); - Msg(ONSCREEN1, "Select points"); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select points\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); while(1) { Msg(STATUS3N, "Setting characteristic length"); @@ -2756,8 +2751,7 @@ void mesh_define_length_cb(CALLBACK_ARGS) } } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void mesh_define_recombine_cb(CALLBACK_ARGS) @@ -2772,8 +2766,8 @@ void mesh_define_recombine_cb(CALLBACK_ARGS) Draw(); } - Msg(ONSCREEN1, "Select surfaces"); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select surfaces\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); n = 0; while(1) { @@ -2803,8 +2797,7 @@ void mesh_define_recombine_cb(CALLBACK_ARGS) } } Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void mesh_define_transfinite_cb(CALLBACK_ARGS) @@ -2851,13 +2844,12 @@ static void _add_transfinite(int dim) Msg(STATUS3N, "Setting transfinite contraints"); switch (dim) { case 1: - Msg(ONSCREEN1, "Select lines"); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select lines\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); ib = SelectEntity(ENT_LINE, &v, &c, &s); break; case 2: - Msg(ONSCREEN1, "Select surface"); - Msg(ONSCREEN2, "[Press 'q' to abort]"); + Msg(ONSCREEN, "Select surface\n[Press 'q' to abort]"); ib = SelectEntity(ENT_SURFACE, &v, &c, &s); break; default: @@ -2900,8 +2892,8 @@ static void _add_transfinite(int dim) p[n++] = s->Num; // fall-through case 3: while(1) { - Msg(ONSCREEN1, "Select boundary points (in order)"); - Msg(ONSCREEN2, "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); + Msg(ONSCREEN, "Select boundary points (in order)\n" + "[Press 'e' to end selection, 'u' to undo last selection or 'q' to abort]"); ib = SelectEntity(ENT_POINT, &v, &c, &s); if(ib == 'l') { p[n++] = v->Num; @@ -2947,8 +2939,7 @@ static void _add_transfinite(int dim) stopall: Msg(STATUS3N, "Ready"); - Msg(ONSCREEN1, ""); - Msg(ONSCREEN2, ""); + Msg(ONSCREEN, ""); } void mesh_define_transfinite_line_cb(CALLBACK_ARGS) diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 0402b66dfa9acc66353656639b8cfa511882fae8..7b82c0574a644ab7a2f57abd3d9a163a6f281841 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.302 2004-05-18 17:44:55 geuzaine Exp $ +// $Id: GUI.cpp,v 1.303 2004-05-18 18:52:00 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1310,11 +1310,18 @@ void GUI::set_status(char *msg, int num) g_status_label[num]->label(msg); g_status_label[num]->redraw(); } - else{ - if(num == 3) - strncpy(onscreen_buffer[0], msg, 255); - if(num == 4) - strncpy(onscreen_buffer[1], msg, 255); + else if (num == 3){ + int n = strlen(msg); + int i = 0; + while(i < n) + if(msg[i++] == '\n') break; + + strncpy(onscreen_buffer[0], msg, 255); + if(i < n) + strncpy(onscreen_buffer[1], &msg[i], 255); + else + onscreen_buffer[1][0] = '\0'; + onscreen_buffer[0][i-1] = '\0'; redraw_opengl(); } } diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index 92fe734ac1668ef9ad3933b2956c705999fbf02c..99697dc89c821a130e52278141ed875bbe89955f 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.52 2004-05-18 17:00:37 geuzaine Exp $ +// $Id: Message.cpp,v 1.53 2004-05-18 18:52:01 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -90,8 +90,7 @@ void Msg(int level, char *fmt, ...) case STATUS2 : str = INFO_STR; verb = 1; window = 1; break ; case STATUS3N : log = 0; //fallthrough case STATUS3 : str = INFO_STR; verb = 1; window = 2; break ; - case ONSCREEN1: log = 0; verb = 1; window = 3; break ; - case ONSCREEN2: log = 0; verb = 1; window = 4; break ; + case ONSCREEN : log = 0; verb = 1; window = 3; break ; case FATAL : str = FATAL_STR; abort = 1; break ; case FATAL1 : str = FATAL_STR; break ; diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index a1994277d772e06c15bd583b3db5e5d3ba17931a..6b55eca539cf8fe9be94f1092c798345968cd624 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.58 2004-05-18 17:44:55 geuzaine Exp $ +// $Id: Geom.cpp,v 1.59 2004-05-18 18:52:01 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -292,7 +292,6 @@ void Draw_Triangulated_Surface(Surface * s) } } - void Draw_Plane_Surface(Surface * s) { int i, j, k; @@ -306,24 +305,16 @@ void Draw_Plane_Surface(Surface * s) return; } - if(!s->Orientations) - s->Orientations = List_Create(20, 2, sizeof(Vertex)); - - if(!List_Nbr(s->Orientations)) { - - s->Orientations = List_Create(20, 2, sizeof(Vertex)); + if(List_Nbr(s->Orientations) < 1) { List_T *points = List_Create(10, 10, sizeof(Vertex *)); - for(i = 0; i < List_Nbr(s->Generatrices); i++) { List_Read(s->Generatrices, i, &c); for(j = 0; j < List_Nbr(c->Control_Points); j++) { List_Add(points, List_Pointer(c->Control_Points, j)); } } - MeanPlane(points, s); - List_Delete(points); k = 0; @@ -418,17 +409,25 @@ void Draw_Plane_Surface(Surface * s) List_Add(s->Orientations, &vv); Msg(STATUS2N, "Plane Surface %d (%d points)", s->Num, List_Nbr(s->Orientations)); + + if(!List_Nbr(s->Orientations)) // add dummy + List_Add(s->Orientations, &vv); } if(List_Nbr(s->Orientations) > 1) { if(CTX.geom.surfaces) { + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0x0F0F); + gl2psEnable(GL2PS_LINE_STIPPLE); glBegin(GL_LINES); for(i = 0; i < List_Nbr(s->Orientations); i++) { List_Read(s->Orientations, i, &vv); glVertex3d(vv.Pos.X, vv.Pos.Y, vv.Pos.Z); } glEnd(); + glDisable(GL_LINE_STIPPLE); + gl2psDisable(GL2PS_LINE_STIPPLE); } if(CTX.geom.surfaces_num) { @@ -443,7 +442,6 @@ void Draw_Plane_Surface(Surface * s) } if(CTX.geom.normals) { - glDisable(GL_LINE_STIPPLE); List_Read(s->Orientations, 0, &vv1); List_Read(s->Orientations, 1, &vv2); n[0] = s->plan[2][0]; @@ -486,6 +484,9 @@ void Draw_NonPlane_Surface(Surface * s) glDisable(GL_LIGHTING); } else{ + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0x0F0F); + gl2psEnable(GL2PS_LINE_STIPPLE); int N = 50; glBegin(GL_LINE_STRIP); for(int i = 0; i < N + 1; i++) { @@ -501,6 +502,8 @@ void Draw_NonPlane_Surface(Surface * s) glVertex3d(v.Pos.X, v.Pos.Y, v.Pos.Z); } glEnd(); + glDisable(GL_LINE_STIPPLE); + gl2psDisable(GL2PS_LINE_STIPPLE); } } @@ -516,7 +519,6 @@ void Draw_NonPlane_Surface(Surface * s) } if(CTX.geom.normals) { - glDisable(GL_LINE_STIPPLE); Vertex n1 = InterpolateSurface(s, 0.5, 0.5, 0, 0); Vertex n2 = InterpolateSurface(s, 0.6, 0.5, 0, 0); Vertex n3 = InterpolateSurface(s, 0.5, 0.6, 0, 0); @@ -565,15 +567,11 @@ void Draw_Surface(void *a, void *b) gl2psLineWidth(CTX.geom.line_width * CTX.print.eps_line_width_factor); glColor4ubv((GLubyte *) & CTX.color.geom.surface); } - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x0F0F); if(s->Typ == MSH_SURF_STL) { - glDisable(GL_LINE_STIPPLE); Tree_Action(s->STL->Simplexes, Draw_Simplex_Surface); } else if(s->Typ == MSH_SURF_DISCRETE) { - glDisable(GL_LINE_STIPPLE); Tree_Action(s->Simplexes, Draw_Simplex_Surface); } else if(s->Typ == MSH_SURF_PLAN) @@ -584,8 +582,6 @@ void Draw_Surface(void *a, void *b) if(CTX.render_mode == GMSH_SELECT) { glPopName(); } - - glDisable(GL_LINE_STIPPLE); } // Volumes diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp index 25b9b793fc444a609a9a7f72557bc7bca79ef5fe..0c2ba658b21e62db71594429f770aae103c33c77 100644 --- a/Mesh/Create.cpp +++ b/Mesh/Create.cpp @@ -1,4 +1,4 @@ -// $Id: Create.cpp,v 1.51 2004-05-18 17:44:55 geuzaine Exp $ +// $Id: Create.cpp,v 1.52 2004-05-18 18:52:01 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -690,7 +690,7 @@ Surface *Create_Surface(int Num, int Typ) pS->Vertices = Tree_Create(sizeof(Vertex *), compareVertex); pS->TrsfVertices = List_Create(1, 10, sizeof(Vertex *)); pS->Contours = List_Create(1, 1, sizeof(List_T *)); - pS->Orientations = NULL; + pS->Orientations = List_Create(20, 2, sizeof(Vertex)); pS->Support = pS; pS->Control_Points = List_Create(1, 10, sizeof(Vertex *)); pS->Generatrices = NULL;