~ubuntu-branches/debian/squeeze/gmsh/squeeze

« back to all changes in this revision

Viewing changes to Fltk/openglWindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2009-02-17 10:12:27 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090217101227-mdrolkldak2pgd2i
Tags: 2.3.0.dfsg-1
* New upstream release
  + major graphics and GUI code refactoring; 
  + new full-quad/hexa subdivision algorithm (removed 
    Mesh.RecombineAlgo);
  + improved automatic transfinite corner selection (now also 
    for volumes); 
  + improved visibility browser; new automatic adaptive visualization
    for high-order simplices;
  + modified arrow size, clipping planes and transform options; many
    improvements and
  + bug fixes all over the place.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
 
2
//
 
3
// See the LICENSE.txt file for license information. Please report all
 
4
// bugs and problems to <gmsh@geuz.org>.
 
5
 
 
6
#ifndef _OPENGL_WINDOW_H_
 
7
#define _OPENGL_WINDOW_H_
 
8
 
 
9
#include <vector>
 
10
#include <string>
 
11
#include <FL/Fl_Gl_Window.H>
 
12
#include <FL/Fl_Box.H>
 
13
#include "drawContext.h"
 
14
 
 
15
class GVertex;
 
16
class GEdge;
 
17
class GFace;
 
18
class GRegion;
 
19
class MElement;
 
20
 
 
21
class mousePosition {
 
22
 public:
 
23
  double win[3]; // window coordinates
 
24
  double wnr[3]; // world coordinates BEFORE rotation
 
25
  double s[3]; // scaling state when the event was recorded
 
26
  double t[3]; // translation state when the event was recorded
 
27
  mousePosition()
 
28
  {
 
29
    for(int i = 0; i < 3; i++)
 
30
      win[i] = wnr[i] = s[i] = t[i] = 0.;
 
31
  }
 
32
  mousePosition(const mousePosition &instance)
 
33
  {
 
34
    for(int i = 0; i < 3; i++){
 
35
      win[i] = instance.win[i];
 
36
      wnr[i] = instance.wnr[i];
 
37
      s[i] = instance.s[i];
 
38
      t[i] = instance.t[i];
 
39
    }
 
40
  }
 
41
  void set(drawContext *ctx);
 
42
  void recenter(drawContext *ctx);
 
43
};
 
44
 
 
45
class openglWindow : public Fl_Gl_Window {
 
46
 private:
 
47
  static openglWindow *_lastHandled;
 
48
  mousePosition _click, _curr, _prev;
 
49
  drawContext *_ctx;
 
50
  double _point[3];
 
51
  int _selection, _trySelection, _trySelectionXYWH[4];
 
52
  double _lassoXY[2];
 
53
  void drawScreenMessage();
 
54
  void drawBorder();
 
55
  bool processSelectionBuffer(int type, 
 
56
                              bool multipleSelection, bool meshSelection,
 
57
                              int x, int y, int w, int h,
 
58
                              std::vector<GVertex*> &vertices,
 
59
                              std::vector<GEdge*> &edges,
 
60
                              std::vector<GFace*> &faces,
 
61
                              std::vector<GRegion*> &regions,
 
62
                              std::vector<MElement*> &elements);
 
63
  void draw();
 
64
  int handle(int);
 
65
 public:
 
66
  bool addPointMode, lassoMode, selectionMode;
 
67
  int endSelection, undoSelection, invertSelection, quitSelection;
 
68
  std::string screenMessage[2];
 
69
  openglWindow(int x, int y, int w, int h, const char *l=0);
 
70
  ~openglWindow();
 
71
  drawContext *getDrawContext(){ return _ctx; }
 
72
  char selectEntity(int type, 
 
73
                    std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges,
 
74
                    std::vector<GFace*> &faces, std::vector<GRegion*> &regions,
 
75
                    std::vector<MElement*> &elements);
 
76
  static openglWindow *getLastHandled(){ return _lastHandled; }
 
77
  static void setLastHandled(openglWindow *w){ _lastHandled = w; }
 
78
};
 
79
 
 
80
#endif