Commit 586b837b authored by smarx's avatar smarx
Browse files

rel_0_7_04 upgrades to fltk-1.1.3, build support for os x, os x middle mouse...

rel_0_7_04 upgrades to fltk-1.1.3, build support for os x, os x middle mouse button keyboard simulation, os x workaround for partiview/fltk issues with proper redraw. this release is using a recent fltk-1.1.3 cvs upgrade - not the standard release - to resolve OpenGL bugs that will be in fltk-1.1.4. Note that this release of partiview requires fltk-1.1.x support which precludes use of the old file chooser
parent a407726a
......@@ -10,8 +10,14 @@
* Illinois Open Source License; see the file LICENSE.partiview for details.
*/
#include <GL/gl.h> /* for GLuint */
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h> /* for GLuint */
#include <GL/glu.h>
#endif
#include <stdio.h>
#define GV_ID_CAMERA (-1)
......
......@@ -19,6 +19,7 @@
#include "Gview.H"
#ifndef wallclock_time
extern "C" { extern double wallclock_time(void); } // from sclock.c
#endif
......@@ -498,7 +499,7 @@ static int verbose; /* for debugging! */
#define CONSTRAINKEY FL_CTRL
int Fl_Gview::handle(int ev) {
if(eventhook) {
// Allow clients to pre-screen our events without subclassing
switch((*eventhook)(this, ev)) {
......@@ -518,9 +519,20 @@ int Fl_Gview::handle(int ev) {
}
/* and fall into ... */
case FL_RELEASE:
if(Fl::event_state(XYBUTTON|ZBUTTON|PICKBUTTON) == 0
&& (Fl::event_button() == XYBUTTONVAL ||
Fl::event_button() == ZBUTTONVAL)) {
//=========== T. Takahei code added by Marx version 0.7.04 ===========
#ifndef __APPLE__
if(Fl::event_state(XYBUTTON|ZBUTTON|PICKBUTTON) == 0
&& (Fl::event_button() == XYBUTTONVAL ||
Fl::event_button() == ZBUTTONVAL)) {
#else
//if(Fl::event_state(XYBUTTON) == 0 && (!Fl::event_state(CONSTRAINKEY))) { //original
//handle a real two or three button mac mouse
if(Fl::event_state(XYBUTTON|ZBUTTON|PICKBUTTON) == 0 && (Fl::event_button() == XYBUTTONVAL || Fl::event_button() == ZBUTTONVAL)) {
#endif
//============ end T. Takahei code =====================================
/* If everything's released, ... */
do_nav( FL_RELEASE, evslow_, evzaxis_, evconstrain_ );
return 1;
......@@ -530,13 +542,48 @@ int Fl_Gview::handle(int ev) {
case FL_DRAG:
takeMausSample( ev, 0.125 );
//=========== T. Takahei code modified by Marx version 0.7.04 ===========
#ifndef __APPLE__
if(Fl::event_state(XYBUTTON|ZBUTTON) && !Fl::event_state(PICKBUTTON)) {
do_nav(ev, Fl::event_state(FL_SHIFT), Fl::event_state(ZBUTTON),
Fl::event_state(CONSTRAINKEY));
return 1;
} else if(Fl::event_state(PICKBUTTON)
&& !Fl::event_state(XYBUTTON|ZBUTTON)
&& pickcb_ != NULL) {
#else
/*
//debug only
if(Fl::event_state(FL_ALT))
printf("you pressed option key\n");
else if(Fl::event_state(FL_META))
printf("you pressed apple key\n");
else if(Fl::event_state(FL_CTRL))
printf("you pressed ctrl key\n");
else if(Fl::event_state(FL_BUTTON1))
printf("you pressed left mouse button\n");
else
printf("i don't know what key you pressed\n");
//end debug only
*/
if(!Fl::event_state(FL_ALT)) { //if option key is pressed skip ahead for the test for mouse button simulation.
if(Fl::event_state(XYBUTTON|ZBUTTON) && !Fl::event_state(PICKBUTTON)) {
do_nav(ev, Fl::event_state(FL_SHIFT), Fl::event_state(ZBUTTON),
Fl::event_state(CONSTRAINKEY));
Fl::event_state(CONSTRAINKEY));
return 1;
} else if(Fl::event_state(PICKBUTTON)
&& !Fl::event_state(XYBUTTON|ZBUTTON)
&& pickcb_ != NULL) {
}
}
//if(Fl::event_state(XYBUTTON) && !Fl::event_state(CONSTRAINKEY)) { original but now we ignore meta and use constrainkey (FL_CTRL) to rotate in orbit mode (hope do_nav knows this!)
if(Fl::event_state(XYBUTTON) && !Fl::event_state(FL_META) && !Fl::event_state(PICKBUTTON) ) { //enter mouse button simulation if meta key and or real middle mouse button are NOT pressed!
//do_nav(ev, Fl::event_state(FL_SHIFT), Fl::event_state(FL_ALT), Fl::event_state(FL_META)); //toshi's original
do_nav(ev, Fl::event_state(FL_SHIFT), Fl::event_state(FL_ALT), Fl::event_state(FL_CTRL));
return 1;
} else if (Fl::event_state(PICKBUTTON) && pickcb_ != NULL) {
//} else if (Fl::event_state(XYBUTTON) && Fl::event_state(CONSTRAINKEY) && pickcb_ != NULL) { commented out per Brian Abbott request not to support CTRL key to emulate middle mouse button pick on Apple
#endif
//=========== end T. Takahei code modified by Marx version 0.7.04 =======================================
dpickx_ = Fl::event_x();
dpicky_ = h() - Fl::event_y();
......
......@@ -11,7 +11,9 @@
*/
#if unix /* but not WIN32 */
#include <alloca.h>
//#include <alloca.h>
//for apple
#define alloca(size) __builtin_alloca(size)
#else
#include "winjunk.h"
#endif
......
......@@ -9,8 +9,14 @@
* Illinois Open Source License; see the file LICENSE.partiview for details.
*/
#include <GL/gl.h> /* for GLuint */
#include <GL/glu.h>
#ifdef __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
#include <stdio.h>
#ifndef __cplusplus
......
......@@ -10,7 +10,7 @@
* Illinois Open Source License; see the file LICENSE.partiview for details.
*/
#if unix
#if unix && !__APPLE__
# include "FL/x.H"
#endif
......@@ -150,7 +150,7 @@ float Fl_Plot::zoomview( float zoomfactor, int xev, int yev ) {
}
choosezoom( zoomfactor, h()-yev, h(), orthoy0_, orthoy1_, &y0_, &y1_ );
float got = choosezoom( zoomfactor, xev, w(), orthox0_, orthox1_, &x0_, &x1_ );
#if unix
#if unix && !__APPLE__
Window xwin = fl_xid(this);
if(xwin != None)
XWarpPointer(fl_display, xwin, xwin, 0, 0, 0, 0,
......
......@@ -20,7 +20,11 @@
#include <ctype.h>
#undef isspace
#include <GL/gl.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> /* for GLuint */
#endif
#include "cat_model.h"
#include "findfile.h"
......
This diff is collapsed.
......@@ -101,24 +101,40 @@ else
:, AC_MSG_ERROR([couldn't find fltk library]))
fi
#----------- orignal -----------------------------------------------------------
# Using new (fltk 1.1.0rc6) file chooser?
# If not, define HAVE_OLD_FILE_CHOOSER_H.
# If so, it demands (sigh) JPEG and PNG image libraries
# even though we don't want to use them.
# marx v 0.7.02 changed , to just newline on line: AC_DEFINE(HAVE_OLD_FILE_CHOOSER_H),
ifelse("
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $FLTK_INC"
AC_CHECK_HEADER(FL/fl_file_chooser.H,
AC_DEFINE(HAVE_OLD_FILE_CHOOSER_H)
AC_DEFINE(HAVE_OLD_FILE_CHOOSER_H),
FLTK_LIB="$FLTK_LIB -ljpeg -lpng"
)
CPPFLAGS="$save_CPPFLAGS"
")
#the single argument ifelse above is idiom for comment
#----------- as of partiview 0.7.04 - marx: ------------------------------------
#we no longer support old file chooser so we deleted support for it from this file
#in any event you should be on fltk release 1.1.x (not 2.x).
# the library fltk_images did not exist prior to 1.1.x used to determine relase == 1.1.x
if test -f "$with_fltk/lib/libfltk_images.a" || \
test -f "$with_fltk/lib/libfltk_images.so"; then
:
else
AC_MSG_ERROR("we do not support fltk on releases earlier than 1.1.x. you must be on fltk release 1.1.x")
fi
#----------end as of partiview 0.7.04 - marx: -----------------------------------
AC_SUBST(FLTK_INC)
AC_SUBST(FLTK_LIB)
dnl ---------------------------------------------------------------------
dnl 3D Graphics Libraries (see also vis5d's configure.in)
......@@ -149,6 +165,15 @@ if test "$with_mesa" = "yes"; then
AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL",
:, -lGL $XLIBS -lm), :, $XLIBS -lm)
fi
if test -d "/System/Library"; then
GLLIBS="-framework AGL -framework OpenGL -framework Carbon -framework ApplicationServices"
XLIBS=""
PV_FLAGS="-Dunix -DHAVE_BUILTIN_ALLOCA -Dtanf=tan -Dsinf=sin -Datan2f=atan2 -Dsqrtf=sqrt -Dcosf=cos -Dhypotf=hypot"
fi
if test -n "$GLLIBS"; then
AC_DEFINE(HAVE_OPENGL)
else
......
......@@ -25,6 +25,8 @@ geom.umn.edu; email: software@geom.umn.edu. */
#include <stdio.h>
#include <string.h>
#include"findfile.h"
#include <ctype.h>
#undef isspace /* Hacks for Irix 6.5.x */
#undef isascii
......
......@@ -13,6 +13,10 @@
extern "C" {
#endif
#ifdef __APPLE__
#define R_OK 4
#endif
extern char **getfiledirs(void);
extern char *findfile( char *superfile, char *fname );
extern void filedirs( char **dirs );
......
......@@ -712,6 +712,8 @@ fputtransform(FILE *file, int ntrans, float *trans, int binary)
*/
#if __GLIBC__
# define F_HASDATA(f) ((f)->_IO_read_ptr < (f)->_IO_read_end)
#elif __APPLE__ /* really? or is this MacOSX-specific? */
# define F_HASDATA(f) ((f)->_r > 0)
#else /* SGI and many others */
# define F_HASDATA(f) ((f)->_cnt > 0)
#endif
......
......@@ -23,8 +23,14 @@ extern "C" {
#endif
#ifdef unix
#ifndef __APPLE__
# include <alloca.h>
#endif
#endif
#ifdef __APPLE__
#define alloca(size) __builtin_alloca(size)
#endif
typedef struct { float x[3]; } Point;
typedef struct { float q[4]; } Quat; /* {r,i,j,k} => {0,1,2,3} */
......
......@@ -33,11 +33,10 @@ geom.umn.edu; email: software@geom.umn.edu. */
#include <errno.h>
#if defined(unix) || defined(__unix)
# include <unistd.h>
#elif defined(_WIN32) || defined(WIN32)
# include <io.h>
//# include <io.h>
# define R_OK 4 /* sigh, no Windows include-file defines R_OK! */
# define pclose fclose
#endif
......
......@@ -12,6 +12,9 @@ static char copyright[] = "Copyright (c) 2002 NCSA, University of Illinois Urban
/*
* $Log$
* Revision 1.94.2.1 2003/05/15 14:58:57 smarx
* rel_0_7_04 upgrades to fltk-1.1.3, build support for os x, os x middle mouse button keyboard simulation, os x workaround for partiview/fltk issues with proper redraw. this release is using a recent fltk-1.1.3 cvs upgrade - not the standard release - to resolve OpenGL bugs that will be in fltk-1.1.4. Note that this release of partiview requires fltk-1.1.x support which precludes use of the old file chooser
*
* Revision 1.94 2003/02/15 06:55:57 slevy
* Add "slvalid" flag to struct dyndata. Don't just use currealtime as
* the validity test.
......@@ -390,7 +393,13 @@ static char copyright[] = "Copyright (c) 2002 NCSA, University of Illinois Urban
# include <sys/types.h>
# include <netinet/in.h> /* for htonl */
# include <time.h>
# include <alloca.h>
#ifdef __APPLE__
#define alloca(size) __builtin_alloca(size)
#else
#include <alloca.h>
#endif
# ifndef WORDS_BIGENDIAN
# include "config.h" /* for WORDS_BIGENDIAN */
# endif
......@@ -427,7 +436,12 @@ static char copyright[] = "Copyright (c) 2002 NCSA, University of Illinois Urban
#include "geometry.h"
#include <GL/gl.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> /* for GLuint */
#endif
#include "shmem.h" /* NewN(), etc. */
#include "futil.h"
......
......@@ -359,7 +359,7 @@ Fl_Window* make_window() {
o->labelcolor(3);
o->callback((Fl_Callback*)pp_play_cb, (void*)(&ppui.st));
}
{ Fl_Menu_Button* o = playmenu = new Fl_Menu_Button(57, 122, 40, 20, "Play Speed (Nf = every Nth frame)");
{ Fl_Menu_Button* o = playmenu = new Fl_Menu_Button(57, 122, 40, 20, "P&lay Speed (Nf = every Nth frame)");
o->type(4);
o->callback((Fl_Callback*)cb_playmenu);
o->add("play 1|play .5|play .25|play 2|play 5|play 1f|play 2f|play 5f|play 10f");
......
......@@ -7,14 +7,14 @@ decl {\#include "partiview.H"} {}
Function {make_window()} {open
} {
Fl_Window {ppui.mainwin} {open
xywh {135 94 540 466} box DOWN_BOX color 96 resizable
code0 {o->size_range(101,130);} visible
xywh {135 94 540 466} box DOWN_BOX color 96 hide resizable
code0 {o->size_range(101,130);}
} {
Fl_Pack {} {open
xywh {0 0 540 466} color 96 resizable
code0 {o->spacing(0);}
} {
Fl_Group {ppui.toprow} {
Fl_Group {ppui.toprow} {open
xywh {0 0 540 37}
} {
Fl_Menu_Button {ppui.more} {
......@@ -53,7 +53,7 @@ Function {make_window()} {open
xywh {63 0 32 20} color 137 labelsize 12 labelcolor 3 align 2 textsize 12
} {}
}
Fl_Group {ppui.objgroup} {open
Fl_Group {ppui.objgroup} {
xywh {98 0 441 37} resizable
} {
Fl_Light_Button {ppui.point} {
......@@ -212,7 +212,7 @@ specks_commandfmt( &ppui.st, homestr, o->value());}
xywh {352 73 20 21} color 96 labelsize 10 labelcolor 3 align 6
}
}
Fl_Group {ppui.animrow} {
Fl_Group {ppui.animrow} {open
xywh {0 121 540 21}
} {
Fl_Button {ppui.rdata} {
......@@ -228,8 +228,8 @@ specks_commandfmt( &ppui.st, homestr, o->value());}
xywh {57 122 40 20} type Toggle color 32 selection_color 58 labelsize 12 labelcolor 3
}
Fl_Menu_Button playmenu {
label {Play Speed (Nf = every Nth frame)}
callback {specks_commandfmt(&ppui.st,"%s",o->text());} open
label {P&lay Speed (Nf = every Nth frame)}
callback {specks_commandfmt(&ppui.st,"%s",o->text());} open selected
xywh {57 122 40 20} type popup3
code0 {o->add("play 1|play .5|play .25|play 2|play 5|play 1f|play 2f|play 5f|play 10f");}
} {}
......@@ -248,7 +248,7 @@ specks_commandfmt( &ppui.st, homestr, o->value());}
xywh {97 121 25 20} color 33 selection_color 33 labelsize 12 labelcolor 3
}
}
Fl_Tile {ppui.maintile} {open
Fl_Tile {ppui.maintile} {
xywh {0 142 540 327} color 139 resizable
} {
Fl_Group {ppui.cmdhist} {open
......@@ -286,7 +286,7 @@ specks_commandfmt( &ppui.st, homestr, o->value());}
Fl_Group {} {open
xywh {0 217 540 252} box DOWN_BOX
} {
Fl_Box {ppui.view} {selected
Fl_Box {ppui.view} {
xywh {0 217 540 249}
code0 {o->cursor(FL_CURSOR_CROSS);}
class Fl_Gview
......
......@@ -15,7 +15,13 @@
#include "winjunk.h"
#endif
#include <GL/gl.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> /* for GLuint */
#endif
#include "Gview.H"
#include "partiview.H"
#include "geometry.h"
......@@ -30,8 +36,8 @@
#include <FL/Fl.H>
#include <FL/fl_draw.H>
#include "genericslider.H" //steven marx: generic slider introduced version 0.7.02
#include <FL/Fl_Tooltip.H> //steven marx: version 0.7.02 now using fltk-1.1.2
#include "genericslider.H" //steven marx: generic slider introduced version 0.7.02
#include <FL/Fl_Tooltip.H> //steven marx: version 0.7.02 now using fltk-1.1.2
#if HAVE_OLD_FILE_CHOOSER_H
# include <FL/fl_file_chooser.H> /* fltk 1.0.* and 1.1.rcX for X<6 */
......@@ -41,6 +47,7 @@
#include <FL/glut.H> // for GLUT_MULTISAMPLE if fltk knows it
static char local_id[] = "$Id$";
struct _ppui ppui;
......@@ -136,7 +143,6 @@ void pp_ui_postinit() {
ppui.steprow->hide();
if(ppui.detached)
parti_detachview("fullscreen");
......@@ -177,7 +183,15 @@ void pp_objtog_cb(Fl_Button* b, void *) {
sscanf(b->label(), "g%d", &objno);
if(objno<0||objno>=MAXSTUFF||stuffs[objno]==NULL)
return;
//================ marx added version 0.7.04 to support 1 button mac mouse ======================
#ifndef __APPLE__
if(Fl::event_button() == FL_RIGHT_MOUSE) {
#else
if( (Fl::event_button() == FL_RIGHT_MOUSE) || ((Fl::event_button() == FL_LEFT_MOUSE) && Fl::event_alt()) ) {
#endif
//================ end 1 button mac mouse =======================================================
stuffs[objno]->useme = 1;
parti_object( b->label(), &ppui.st, 0 );
b->value(1);
......@@ -427,13 +441,20 @@ return objno;
}
static void fitlabel( Fl_Widget *w, int excess = 4 ) {
#ifdef __APPLE__
int width = (int)fl_width( w->label(), strlen(w->label()) ) + excess; //marx added the strlen param
w->hide();
w->size( width, w->h() );
w->show();
#else
int ofont = fl_font(), osize = fl_size();
fl_font( w->labelfont(), w->labelsize() );
int width = (int)fl_width( w->label() ) + excess;
int width = (int)fl_width( w->label()) + excess; //marx added the strlen param
w->hide();
w->size( width, w->h() );
w->show();
fl_font(ofont, osize);
#endif
}
......@@ -1071,22 +1092,21 @@ ppui.view->movingtarget( 0 );
for( ; i < argc; i++) {
specks_read( &ppui.st, argv[i] );
}
pp_ui_postinit();
ppui.view->notifier( pp_viewchanged, ppui.st );
ppui_refresh( ppui.st );
if(ppui.detached != 'h')
ppui.mainwin->show(argc, argv);
ppui.mainwin->show(argc, argv);
#ifdef GLUT_MULTISAMPLE // if multisampling known to FLTK
parti_stereo( parti_stereo(NULL) ); // side effect: enables multisampling
#endif
ppui.view->show();
//marx version 0.7.03 process any pending events followed by simulation user pressing enter key
//this appears to properly initialize the steprow group
for(int i = 1; i < 5; i++)
......@@ -1094,6 +1114,12 @@ ppui.view->movingtarget( 0 );
pp_cmd_cb( ppui.cmd, NULL );
//marx version 0.7.03 end simulate enter key
#ifdef __APPLE__
Fl_Window* mw = ppui.mainwin;
Fl::wait(.1);
ppui.mainwin->resize(mw->x()+1, mw->y()+1, mw->w()+1, mw->h()+1); //marx: version 0.7.04
//the resize compensates for bug that appears under os x only - damage to widgets does not cause redraw but resize seems to cause the needed redraw
#endif
if(ppui.reqwinsize != NULL) {
parti_update();
......@@ -1101,10 +1127,11 @@ ppui.view->movingtarget( 0 );
ppui.reqwinsize = NULL;
}
Fl::visible_focus(0); //marx: version 0.7.02 - keep the pre fltk-1.1.x old style of only text widgets to get keyboard focus
Fl::visible_focus(0); //marx: version 0.7.02 - keep the pre fltk-1.1.x old style of only text widgets to get keyboard focus
Fl_Tooltip::delay(.5); //marx: version 0.7.02
Fl_Tooltip::font(FL_HELVETICA_BOLD); //marx: version 0.7.02
Fl_Tooltip::color(68); //marx: version 0.7.02
return Fl::run();
}
......@@ -13,7 +13,12 @@
#include "winjunk.h"
#endif
#include <GL/gl.h>
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h> /* for GLuint */
#endif
#include "geometry.h"
#include "shmem.h"
#include <string.h>
......
......@@ -12,7 +12,12 @@
#ifdef WIN32
# include <windows.h>
#endif
#include <GL/gl.h>
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
#include "sfont.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment