From f15b66fda523aa3f21f0fa779f66f08bfbc152b2 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 11 Jan 2001 12:25:23 +0000
Subject: [PATCH] *** empty log message ***

---
 Fltk/Callbacks.cpp     | 18 ++++++++++++------
 Fltk/GUI.h             |  2 +-
 Fltk/Main.cpp          |  4 ++--
 Fltk/Opengl.cpp        |  9 ++++++---
 Fltk/Opengl_Window.cpp | 18 +++++++++++-------
 5 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index e7b3c82533..dfc6867d89 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.13 2001-01-11 07:32:35 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.14 2001-01-11 12:25:23 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -761,6 +761,8 @@ void mesh_1d_cb(CALLBACK_ARGS){
   else
 #endif
     mai3d(&M, 1); 
+  Init(); 
+  Draw();
 }
 void mesh_2d_cb(CALLBACK_ARGS){
 #ifdef _USETHREADS
@@ -772,6 +774,8 @@ void mesh_2d_cb(CALLBACK_ARGS){
   else
 #endif
     mai3d(&M, 2);
+  Init(); 
+  Draw();
 } 
 void mesh_3d_cb(CALLBACK_ARGS){
 #ifdef _USETHREADS
@@ -783,6 +787,8 @@ void mesh_3d_cb(CALLBACK_ARGS){
   else
 #endif
     mai3d(&M, 3); 
+  Init(); 
+  Draw();
 } 
 void mesh_define_length_cb (CALLBACK_ARGS){
   Vertex   *v;
@@ -802,20 +808,20 @@ void mesh_define_length_cb (CALLBACK_ARGS){
     if (ib == -1){ /* 'e' */
       if(n >= 1) {
 	add_charlength(n,p,CTX.filename); 
+	n=0;
+	ZeroHighlight(&M);
+	DrawUpdate();
 	break;
       }
-      n=0;
-      ZeroHighlight(&M);
-      Replot();
     }
     if(ib == 0){ /* 'q' */
       n=0 ;
       ZeroHighlight(&M);
-      Replot();
+      DrawUpdate();
       break;
     }
   }
-  if(!CTX.threads) Msg(STATUS,"Ready");
+  Msg(STATUS,"Ready");
 }
 void mesh_define_recombine_cb (CALLBACK_ARGS){
   printf("mesh define reco\n");
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index 83abd0cda4..8c65ba0899 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -179,7 +179,7 @@ public:
   void activate_custom(int val);
   void add_handler();
   int  global_shortcuts(int event);
-  int  quit_selection, end_selection;
+  int  try_selection, quit_selection, end_selection;
 
   // geometry contexts queries
   char *get_geometry_parameter(int num);
diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp
index 00e85811cf..52c52817e6 100644
--- a/Fltk/Main.cpp
+++ b/Fltk/Main.cpp
@@ -1,4 +1,4 @@
-// $Id: Main.cpp,v 1.6 2001-01-10 08:50:29 geuzaine Exp $
+// $Id: Main.cpp,v 1.7 2001-01-11 12:25:23 geuzaine Exp $
 
 #include <signal.h>
 
@@ -92,7 +92,6 @@ int main(int argc, char *argv[]){
 
   // The GUI is ready
   CTX.interactive = 0 ; 
-  CTX.expose = 1 ;
 
   // Say welcome!
 
@@ -130,6 +129,7 @@ int main(int argc, char *argv[]){
   // Draw the actual scene
   Init();
   Draw();
+  CTX.expose = 1 ;
 
   // loop
   WID->run();
diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp
index 83f9ba2876..20c53e1c44 100644
--- a/Fltk/Opengl.cpp
+++ b/Fltk/Opengl.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl.cpp,v 1.10 2001-01-11 07:32:35 geuzaine Exp $
+// $Id: Opengl.cpp,v 1.11 2001-01-11 12:25:23 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -43,10 +43,11 @@ void DrawUI(void){
   WID->check();
 }
 
-// one should not call Opengl_Window::draw() from the handle(), but
+// Opengl_Window::draw() from the handle(), but
 // rather the following:
 
 void DrawUpdate(){
+  if(!CTX.expose) return ;
   WID->make_current();
   Orthogonalize(0,0);
   glClearColor(UNPACK_RED(CTX.color.bg)/255.,
@@ -114,6 +115,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
 
   *v = NULL; *c = NULL; *s = NULL;
   
+  WID->try_selection = 0;
   WID->quit_selection = 0;
   WID->end_selection = 0;
   
@@ -127,7 +129,8 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
       WID->end_selection = 0;
       return -1;
     }
-    if(Fl::event_is_click()){
+    if(WID->try_selection){
+      WID->try_selection = 0;
       Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj);
       Filter_SelectionBuffer(hits,ii,jj,v,c,s,&M);
       if(check_type(type,*v,*c,*s)){
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index d898d6f3e0..e57f3fabe5 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.6 2001-01-10 21:35:08 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.7 2001-01-11 12:25:23 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -173,7 +173,10 @@ int Opengl_Window::handle(int event) {
         ZoomClick=0;
         clear_overlay();
         if(xb!=xe && yb!=ye) myZoom(xb,xe,yb,ye,xc1,xc2,yc1,yc2);
-      } 
+      }
+      else{
+	WID->try_selection = 1 ;
+      }
       break;
     case 2:
       if(Modifier && !ZoomClick){
@@ -313,15 +316,16 @@ int Opengl_Window::handle(int event) {
   case FL_MOVE:
     movx = Fl::event_x()-x;
     movy = Fl::event_y()-y;
+    WID->make_current();
     Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj);
     ov = v; oc = c; os = s; v = NULL; c = NULL; s = NULL;
     Filter_SelectionBuffer(hits,ii,jj,&v,&c,&s,&M);
 
-
-            BeginHighlight();
-            HighlightEntity(v,c,s,0);
-            EndHighlight(0);
-
+    if(ov != v || oc != c || os != s) { 
+      BeginHighlight();
+      HighlightEntity(v,c,s,0);
+      EndHighlight(0);
+    }
 
 #if 0
     // l'overlay ne marche pas, meme dans les demos de fltk!
-- 
GitLab