From c0191cac90a9c1ba0ee368df43ad3ea6e1721c54 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 11 Oct 2012 20:01:41 +0000
Subject: [PATCH] first working selection of onelab regions

---
 Common/OpenFile.cpp |  2 +-
 Fltk/CMakeLists.txt |  1 +
 Fltk/inputRange.h   |  5 +++++
 Fltk/inputRegion.h  | 20 ++++++++++++++------
 4 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 2da48961bd..722fff2cb4 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -374,7 +374,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing)
     status = readFile3M(fileName);
   }
 #endif
-#if defined(HAVE_ONELAB_METAMODEL) && defined(HAVE_FLTK) 
+#if defined(HAVE_ONELAB_METAMODEL) && defined(HAVE_FLTK)
   else if(ext == ".ol"){
     // TODO: allow passing action to metamodel from command line
     status = metamodel_cb(fileName);
diff --git a/Fltk/CMakeLists.txt b/Fltk/CMakeLists.txt
index 930d9657cd..7814c45c19 100644
--- a/Fltk/CMakeLists.txt
+++ b/Fltk/CMakeLists.txt
@@ -25,6 +25,7 @@ set(SRC
     classificationEditor.cpp
     partitionDialog.cpp
     onelabWindow.cpp
+    inputRegion.cpp
 )
 
 file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) 
diff --git a/Fltk/inputRange.h b/Fltk/inputRange.h
index 720197382d..2d8e340377 100644
--- a/Fltk/inputRange.h
+++ b/Fltk/inputRange.h
@@ -3,6 +3,9 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
 
+#ifndef _INPUT_RANGE_H_
+#define _INPUT_RANGE_H_
+
 #include <string>
 #include <sstream>
 #include <stdio.h>
@@ -316,3 +319,5 @@ class inputRange : public Fl_Group {
   int color(){ return _input->color(); }
   Fl_Value_Input *input(){ return _input; }
 };
+
+#endif
diff --git a/Fltk/inputRegion.h b/Fltk/inputRegion.h
index 12419b9b06..a2b8090175 100644
--- a/Fltk/inputRegion.h
+++ b/Fltk/inputRegion.h
@@ -3,12 +3,22 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
 
+#ifndef _INPUT_REGION_H_
+#define _INPUT_REGION_H_
+
 #include <string>
 #include <stdio.h>
+#include <set>
+#include <string>
 #include <FL/Fl.H>
+#include <FL/Fl_Group.H>
 #include <FL/Fl_Input.H>
 #include <FL/Fl_Output.H>
 #include <FL/Fl_Button.H>
+#include "FlGui.h"
+#include "GEntity.h"
+#include "Options.h"
+#include "GmshDefines.h"
 
 class inputRegion : public Fl_Group {
  private:
@@ -19,11 +29,7 @@ class inputRegion : public Fl_Group {
     inputRegion *b = (inputRegion*)data;
     b->do_callback();
   }
-  static void _region_butt_cb(Fl_Widget *w, void *data)
-  {
-    inputRegion *b = (inputRegion*)data;
-    printf("SELECT region with mouse!\n");
-  }
+  static void _region_butt_cb(Fl_Widget *w, void *data);
   std::string _set2string(const std::set<std::string> &s)
   {
     std::string out;
@@ -66,7 +72,7 @@ class inputRegion : public Fl_Group {
     _input->callback(_input_cb, this);
     _input->when(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE);
 
-    _region_butt = new Fl_Button(x + input_w, y, butt_w, h, ".");
+    _region_butt = new Fl_Button(x + input_w, y, butt_w, h, "+");
     _region_butt->callback(_region_butt_cb, this);
     _region_butt->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE);
     _region_butt->tooltip("Interactive region selection");
@@ -82,3 +88,5 @@ class inputRegion : public Fl_Group {
     _input->value(_set2string(val).c_str());
   }
 };
+
+#endif
-- 
GitLab