Skip to content
Snippets Groups Projects
Commit bc976ec9 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent 03abe7cd
Branches
Tags
No related merge requests found
// $Id: GUI.cpp,v 1.37 2001-02-04 12:46:08 geuzaine Exp $ // $Id: GUI.cpp,v 1.38 2001-02-04 15:52:26 geuzaine Exp $
// To make the interface as visually consistent as possible, please: // To make the interface as visually consistent as possible, please:
// - use the BH, BW, WB, IW values for button heights/widths, window borders, etc. // - use the BH, BW, WB, IW values for button heights/widths, window borders, etc.
...@@ -535,12 +535,18 @@ void GUI::run(){ ...@@ -535,12 +535,18 @@ void GUI::run(){
Fl::run(); Fl::run();
} }
// Check if any pending events and run them // Check (now) if any pending events and run them
void GUI::check(){ void GUI::check(){
Fl::check(); Fl::check();
} }
// Wait for any events and run them
void GUI::wait(){
Fl::wait();
}
//********************************* Create the menu window ***************************** //********************************* Create the menu window *****************************
void GUI::create_menu_window(int argc, char **argv){ void GUI::create_menu_window(int argc, char **argv){
......
...@@ -184,6 +184,7 @@ public: ...@@ -184,6 +184,7 @@ public:
// general purpose interaction // general purpose interaction
void run(); void run();
void check(); void check();
void wait();
void make_opengl_current(); void make_opengl_current();
void make_colorbar_current(); void make_colorbar_current();
void make_overlay_current(); void make_overlay_current();
......
// $Id: Opengl.cpp,v 1.17 2001-02-04 12:46:09 geuzaine Exp $ // $Id: Opengl.cpp,v 1.18 2001-02-04 15:52:26 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -112,7 +112,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){ ...@@ -112,7 +112,7 @@ int SelectEntity(int type, Vertex **v, Curve **c, Surface **s){
WID->end_selection = 0; WID->end_selection = 0;
while(1){ while(1){
Fl::check(); WID->wait();
if(WID->quit_selection){ if(WID->quit_selection){
WID->quit_selection = 0; WID->quit_selection = 0;
return 0; return 0;
......
// $Id: Opengl_Window.cpp,v 1.11 2001-02-04 12:46:09 geuzaine Exp $ // $Id: Opengl_Window.cpp,v 1.12 2001-02-04 15:52:26 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
...@@ -23,7 +23,7 @@ void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2, ...@@ -23,7 +23,7 @@ void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2); GLdouble Xc1, GLdouble Xc2, GLdouble Yc1, GLdouble Yc2);
static int ZOOM = 0 ; static int ZOOM = 0 ;
static double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2; static double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1;
void Opengl_Window::draw() { void Opengl_Window::draw() {
if(!valid()){ if(!valid()){
...@@ -68,11 +68,13 @@ void Opengl_Window::draw() { ...@@ -68,11 +68,13 @@ void Opengl_Window::draw() {
glVertex2d(ZOOM_X0, ZOOM_Y1); glVertex2d(ZOOM_X0, ZOOM_Y1);
glVertex2d(ZOOM_X0, ZOOM_Y0); glVertex2d(ZOOM_X0, ZOOM_Y0);
glEnd(); glEnd();
ZOOM_X1 = CTX.vxmin + ((double)Fl::event_x()/(double)w()) * (CTX.vxmax - CTX.vxmin);
ZOOM_Y1 = CTX.vymax - ((double)Fl::event_y()/(double)h()) * (CTX.vymax - CTX.vymin);
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
glVertex2d(ZOOM_X0, ZOOM_Y0); glVertex2d(ZOOM_X0, ZOOM_Y0);
glVertex2d(ZOOM_X2, ZOOM_Y0); glVertex2d(ZOOM_X1, ZOOM_Y0);
glVertex2d(ZOOM_X2, ZOOM_Y2); glVertex2d(ZOOM_X1, ZOOM_Y1);
glVertex2d(ZOOM_X0, ZOOM_Y2); glVertex2d(ZOOM_X0, ZOOM_Y1);
glVertex2d(ZOOM_X0, ZOOM_Y0); glVertex2d(ZOOM_X0, ZOOM_Y0);
glEnd(); glEnd();
glDisable(GL_BLEND); glDisable(GL_BLEND);
...@@ -101,8 +103,7 @@ void Opengl_Window::clear_overlay() { ...@@ -101,8 +103,7 @@ void Opengl_Window::clear_overlay() {
int Opengl_Window::handle(int event) { int Opengl_Window::handle(int event) {
static int xpos, ypos, xmov, ymov, ibut, hits; static int xpos, ypos, xmov, ymov, ibut, hits;
static int ZoomClick=0, FirstClick=0; static int ZoomClick=0, FirstClick=0;
static GLdouble xc1, yc1, xc2, yc2, xt1, yt1, xscale1, yscale1; static GLdouble xc, yc, xc1, yc1, xc2, yc2, xt1, yt1, xscale1, yscale1;
static GLdouble xb, yb, xc, yc, xe, ye;
static Vertex *v=NULL, *ov; static Vertex *v=NULL, *ov;
static Curve *c=NULL, *oc; static Curve *c=NULL, *oc;
static Surface *s=NULL, *os; static Surface *s=NULL, *os;
...@@ -119,20 +120,19 @@ int Opengl_Window::handle(int event) { ...@@ -119,20 +120,19 @@ int Opengl_Window::handle(int event) {
if(ibut == 1 && !Fl::event_state(FL_SHIFT)){ if(ibut == 1 && !Fl::event_state(FL_SHIFT)){
if(!ZoomClick && Fl::event_state(FL_CTRL)){ if(!ZoomClick && Fl::event_state(FL_CTRL)){
xb = CTX.vxmin + ((double)xpos/(double)w()) * (CTX.vxmax - CTX.vxmin); ZOOM_X0 = ZOOM_X1 = CTX.vxmin + ((double)xpos/(double)w()) * (CTX.vxmax - CTX.vxmin);
yb = CTX.vymax - ((double)ypos/(double)h()) * (CTX.vymax - CTX.vymin); ZOOM_Y0 = ZOOM_Y1 = CTX.vymax - ((double)ypos/(double)h()) * (CTX.vymax - CTX.vymin);
xc1 = xb/CTX.s[0] - CTX.t[0]; xc1 = ZOOM_X0/CTX.s[0] - CTX.t[0];
yc1 = yb/CTX.s[1] - CTX.t[1]; yc1 = ZOOM_Y0/CTX.s[1] - CTX.t[1];
ZoomClick = 1; ZoomClick = 1;
} }
else if(ZoomClick){ else if(ZoomClick){
xe = CTX.vxmin + ((double)xpos/(double)w()) * (CTX.vxmax - CTX.vxmin); xc2 = ZOOM_X1/CTX.s[0] - CTX.t[0];
ye = CTX.vymax - ((double)ypos/(double)h()) * (CTX.vymax - CTX.vymin); yc2 = ZOOM_Y1/CTX.s[1] - CTX.t[1];
xc2 = xe/CTX.s[0] - CTX.t[0];
yc2 = ye/CTX.s[1] - CTX.t[1];
ZoomClick = 0; ZoomClick = 0;
clear_overlay(); clear_overlay();
if(xb!=xe && yb!=ye) myZoom(xb,xe,yb,ye,xc1,xc2,yc1,yc2); if(ZOOM_X0 != ZOOM_X1 && ZOOM_Y0 != ZOOM_Y1)
myZoom(ZOOM_X0,ZOOM_X1,ZOOM_Y0,ZOOM_Y1,xc1,xc2,yc1,yc2);
} }
else{ else{
WID->try_selection = 1 ; WID->try_selection = 1 ;
...@@ -183,12 +183,6 @@ int Opengl_Window::handle(int event) { ...@@ -183,12 +183,6 @@ int Opengl_Window::handle(int event) {
ymov = Fl::event_y() - ypos; ymov = Fl::event_y() - ypos;
if(ZoomClick) { if(ZoomClick) {
ZOOM_X0 = xb;
ZOOM_Y0 = yb;
ZOOM_X1 = CTX.vxmin + ((double)xpos/(double)w()) * (CTX.vxmax - CTX.vxmin);
ZOOM_Y1 = CTX.vymax - ((double)ypos/(double)h()) * (CTX.vymax - CTX.vymin);
ZOOM_X2 = CTX.vxmin + ((double)Fl::event_x()/(double)w()) * (CTX.vxmax - CTX.vxmin);
ZOOM_Y2 = CTX.vymax - ((double)Fl::event_y()/(double)h()) * (CTX.vymax - CTX.vymin);
ZOOM = 1; ZOOM = 1;
redraw(); redraw();
} }
...@@ -248,8 +242,8 @@ int Opengl_Window::handle(int event) { ...@@ -248,8 +242,8 @@ int Opengl_Window::handle(int event) {
} }
redraw(); redraw();
} }
xpos += xmov; xpos += xmov;
ypos += ymov; ypos += ymov;
return 1; return 1;
...@@ -260,12 +254,6 @@ int Opengl_Window::handle(int event) { ...@@ -260,12 +254,6 @@ int Opengl_Window::handle(int event) {
ymov = Fl::event_y()-ypos; ymov = Fl::event_y()-ypos;
if(ZoomClick) { if(ZoomClick) {
ZOOM_X0 = xb;
ZOOM_Y0 = yb;
ZOOM_X1 = CTX.vxmin + ((double)xpos/(double)w()) * (CTX.vxmax - CTX.vxmin);
ZOOM_Y1 = CTX.vymax - ((double)ypos/(double)h()) * (CTX.vymax - CTX.vymin);
ZOOM_X2 = CTX.vxmin + ((double)Fl::event_x()/(double)w()) * (CTX.vxmax - CTX.vxmin);
ZOOM_Y2 = CTX.vymax - ((double)Fl::event_y()/(double)h()) * (CTX.vymax - CTX.vymin);
ZOOM = 1; ZOOM = 1;
redraw(); redraw();
} }
......
# $Id: Makefile,v 1.47 2001-02-03 13:10:26 geuzaine Exp $ # $Id: Makefile,v 1.48 2001-02-04 15:52:26 geuzaine Exp $
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Makefile for Gmsh # Makefile for Gmsh
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -150,7 +150,7 @@ tag: ...@@ -150,7 +150,7 @@ tag:
echo "#define GMSH_VERSION $(GMSH_RELEASE)" > Common/GmshVersion.h echo "#define GMSH_VERSION $(GMSH_RELEASE)" > Common/GmshVersion.h
echo "#define GMSH_DATE \"`date`\"" >> Common/GmshVersion.h echo "#define GMSH_DATE \"`date`\"" >> Common/GmshVersion.h
echo "#define GMSH_HOST \"`hostname`\"" >> Common/GmshVersion.h echo "#define GMSH_HOST \"`hostname`\"" >> Common/GmshVersion.h
echo "#define GMSH_PACKAGER \"`logname`\"" >> Common/GmshVersion.h echo "#define GMSH_PACKAGER \"`whoami`\"" >> Common/GmshVersion.h
echo "#define GMSH_OS \"`uname -sr`\"" >> Common/GmshVersion.h echo "#define GMSH_OS \"`uname -sr`\"" >> Common/GmshVersion.h
initialtag: initialtag:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment