summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2004-08-25 00:20:27 +0000
committerMatthias Melcher <fltk@matthiasm.com>2004-08-25 00:20:27 +0000
commit8327822026ac50dc9e20823988b0f53bc143b7ba (patch)
tree864e83d7482fa6414d48621a16b677246e49f8ae
parent522f98d5230e78f983ffcc8f05391c060661cf1a (diff)
Updated config stuff to allow for --enable-quartz ofr Mac OS X which in
turn defined USE_QUARTZ to 1 and defines __APPLE_QUARTZ__. If Quartz is not disabled, it will define __APPLE_QD__ for Quickdraw. I also replaced all relevand #ifdef __APPLE__ with #ifdef __APPLE_QD__ #elif defined(__APPLE_QUARTZ__). This does not affect the compile at this time and both version will generate the same Quickdraw code. I will start to replace all QD calls with Quartz calls for the remainder of the week until I can completely remove all QD calls from the Quartz branch. Thanks to Robert Smith for a great initial Quartz implementation. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3782 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--configh.in18
-rw-r--r--configure.in16
-rw-r--r--src/Fl.cxx58
-rw-r--r--src/Fl_Bitmap.cxx70
-rw-r--r--src/Fl_Double_Window.cxx118
-rw-r--r--src/Fl_Font.H15
-rw-r--r--src/Fl_Gl_Choice.H23
-rw-r--r--src/Fl_Gl_Choice.cxx108
-rw-r--r--src/Fl_Gl_Window.cxx50
-rw-r--r--src/Fl_Image.cxx42
-rw-r--r--src/Fl_Pixmap.cxx26
-rw-r--r--src/Fl_Widget.cxx6
-rw-r--r--src/Fl_Window_fullscreen.cxx12
-rw-r--r--src/Fl_get_key_mac.cxx9
-rw-r--r--src/Fl_mac.cxx9
-rw-r--r--src/fl_arci.cxx21
-rw-r--r--src/fl_color_mac.cxx8
-rw-r--r--src/fl_cursor.cxx7
-rw-r--r--src/fl_dnd_mac.cxx8
-rw-r--r--src/fl_draw_image_mac.cxx8
-rw-r--r--src/fl_font_mac.cxx10
-rw-r--r--src/fl_line_style.cxx21
-rw-r--r--src/fl_overlay.cxx14
-rw-r--r--src/fl_read_image_mac.cxx10
-rw-r--r--src/fl_rect.cxx173
-rw-r--r--src/fl_scroll_area.cxx15
-rw-r--r--src/fl_set_fonts_mac.cxx10
-rw-r--r--src/fl_vertex.cxx45
-rw-r--r--src/gl_draw.cxx12
-rw-r--r--src/gl_start.cxx14
30 files changed, 813 insertions, 143 deletions
diff --git a/configh.in b/configh.in
index cc80cc0d1..0d9a08183 100644
--- a/configh.in
+++ b/configh.in
@@ -1,5 +1,5 @@
/*
- * "$Id: configh.in,v 1.11.2.11.2.17 2004/04/11 04:38:53 easysw Exp $"
+ * "$Id: configh.in,v 1.11.2.11.2.18 2004/08/25 00:20:24 matthiaswm Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
@@ -99,6 +99,20 @@
#define USE_XDBE HAVE_XDBE
/*
+ * USE_QUARTZ:
+ *
+ * Use Quartz instead of Quickdraw on Apple Mac OS X machines.
+ * FLTK was originally ported to Quickdraw which is no longer
+ * supported by Apple. If USE_QUARTZ is defined, FLTK will be
+ * compiled using Quartz instead. This flag has no meaning on
+ * other operating systems.
+ */
+
+#define USE_QUARTZ 0
+#undef __APPLE_QUARTZ__
+#undef __APPLE_QD__
+
+/*
* HAVE_OVERLAY:
*
* Use the X overlay extension? FLTK will try to use an overlay
@@ -220,5 +234,5 @@
/*
- * End of "$Id: configh.in,v 1.11.2.11.2.17 2004/04/11 04:38:53 easysw Exp $".
+ * End of "$Id: configh.in,v 1.11.2.11.2.18 2004/08/25 00:20:24 matthiaswm Exp $".
*/
diff --git a/configure.in b/configure.in
index 856739bf1..36186cf63 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf"
dnl
-dnl "$Id: configure.in,v 1.33.2.31.2.116 2004/07/29 18:13:10 easysw Exp $"
+dnl "$Id: configure.in,v 1.33.2.31.2.117 2004/08/25 00:20:25 matthiaswm Exp $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
@@ -223,6 +223,18 @@ AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support
AC_ARG_WITH(optim, [ --with-optim="flags" use custom optimization flags])
+case $uname in
+ Darwin*)
+ AC_ARG_ENABLE(quartz, [ --enable-quartz use Quartz instead of Quickdraw (default=no)])
+ if test "x$enable_quartz" = "xyes"; then
+ AC_DEFINE(USE_QUARTZ, 1)
+ AC_DEFINE(__APPLE_QUARTZ__)
+ else
+ AC_DEFINE(__APPLE_QD__)
+ fi
+ ;;
+esac
+
dnl Find commands...
AC_PROG_CC
AC_PROG_CXX
@@ -899,5 +911,5 @@ dnl Make sure the fltk-config script is executable...
chmod +x fltk-config
dnl
-dnl End of "$Id: configure.in,v 1.33.2.31.2.116 2004/07/29 18:13:10 easysw Exp $".
+dnl End of "$Id: configure.in,v 1.33.2.31.2.117 2004/08/25 00:20:25 matthiaswm Exp $".
dnl
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 1bfadd870..5bc56e79f 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl.cxx,v 1.24.2.41.2.62 2004/04/11 04:38:56 easysw Exp $"
+// "$Id: Fl.cxx,v 1.24.2.41.2.63 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@@ -317,7 +317,10 @@ Fl_X* Fl_X::first;
Fl_Window* fl_find(Window xid) {
Fl_X *window;
for (Fl_X **pp = &Fl_X::first; (window = *pp); pp = &window->next)
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ if (window->xid == xid && !window->w->window()) {
+#elif defined(__APPLE_QUARTZ__)
+# warning QUARTZ
if (window->xid == xid && !window->w->window()) {
#else
if (window->xid == xid) {
@@ -368,12 +371,19 @@ void Fl::flush() {
#ifdef WIN32
GdiFlush();
-#elif defined (__APPLE__)
+#elif defined (__APPLE_QD__)
GrafPtr port; GetPort( &port );
if ( port )
{
QDFlushPortBuffer( port, 0 );
}
+#elif defined (__APPLE_QUARTZ__)
+#warning quartz
+ GrafPtr port; GetPort( &port );
+ if ( port )
+ {
+ QDFlushPortBuffer( port, 0 );
+ }
#else
if (fl_display) XFlush(fl_display);
#endif
@@ -734,13 +744,21 @@ void Fl_Window::hide() {
for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
*pp = ip->next;
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
// remove all childwindow links
for ( Fl_X *pc = Fl_X::first; pc; pc = pc->next )
{
if ( pc->xidNext == ip ) pc->xidNext = ip->xidNext;
if ( pc->xidChildren == ip ) pc->xidChildren = ip->xidNext;
}
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
+ // remove all childwindow links
+ for ( Fl_X *pc = Fl_X::first; pc; pc = pc->next )
+ {
+ if ( pc->xidNext == ip ) pc->xidNext = ip->xidNext;
+ if ( pc->xidChildren == ip ) pc->xidChildren = ip->xidNext;
+ }
#endif // __APPLE__
i = 0;
@@ -773,14 +791,26 @@ void Fl_Window::hide() {
fl_window = (HWND)-1;
fl_gc = 0;
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ if ( ip->xid == fl_window )
+ fl_window = 0;
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
if ( ip->xid == fl_window )
fl_window = 0;
#else
if (ip->region) XDestroyRegion(ip->region);
#endif
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ if ( !parent() ) // don't destroy shared windows!
+ {
+ //+ RemoveTrackingHandler( dndTrackingHandler, ip->xid );
+ //+ RemoveReceiveHandler( dndReceiveHandler, ip->xid );
+ XDestroyWindow(fl_display, ip->xid);
+ }
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
if ( !parent() ) // don't destroy shared windows!
{
//+ RemoveTrackingHandler( dndTrackingHandler, ip->xid );
@@ -835,9 +865,13 @@ int Fl_Window::handle(int ev)
Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
if (p->type() >= FL_WINDOW) break; // don't do the unmap
}
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
hide();
set_visible();
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
+ hide();
+ set_visible();
#else
XUnmapWindow(fl_display, fl_xid(this));
#endif // __APPLE__
@@ -956,11 +990,17 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
Fl_Region R = XRectangleRegion(X, Y, W, H);
CombineRgn(i->region, i->region, R, RGN_OR);
XDestroyRegion(R);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
Fl_Region R = NewRgn();
SetRectRgn(R, X, Y, X+W, Y+H);
UnionRgn(R, i->region, i->region);
DisposeRgn(R);
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
+ Fl_Region R = NewRgn();
+ SetRectRgn(R, X, Y, X+W, Y+H);
+ UnionRgn(R, i->region, i->region);
+ DisposeRgn(R);
#else
XRectangle R;
R.x = X; R.y = Y; R.width = W; R.height = H;
@@ -985,5 +1025,5 @@ void Fl_Window::flush() {
}
//
-// End of "$Id: Fl.cxx,v 1.24.2.41.2.62 2004/04/11 04:38:56 easysw Exp $".
+// End of "$Id: Fl.cxx,v 1.24.2.41.2.63 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx
index cc9d7a16e..c1799e29c 100644
--- a/src/Fl_Bitmap.cxx
+++ b/src/Fl_Bitmap.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.23 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.24 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
//
@@ -31,7 +31,7 @@
#include <FL/Fl_Bitmap.H>
#include "flstring.h"
-#ifdef __APPLE__ // MacOS bitmask functions
+#ifdef __APPLE_QD__ // MacOS bitmask functions
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
Rect srcRect;
srcRect.left = 0; srcRect.right = w;
@@ -77,6 +77,51 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
void fl_delete_bitmask(Fl_Bitmask id) {
if (id) DisposeGWorld(id);
}
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
+Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
+ Rect srcRect;
+ srcRect.left = 0; srcRect.right = w;
+ srcRect.top = 0; srcRect.bottom = h;
+ GrafPtr savePort;
+
+ GetPort(&savePort); // remember the current port
+
+ Fl_Bitmask gw;
+ NewGWorld( &gw, 1, &srcRect, 0L, 0L, 0 );
+ PixMapHandle pm = GetGWorldPixMap( gw );
+ if ( pm )
+ {
+ LockPixels( pm );
+ if ( *pm )
+ {
+ uchar *base = (uchar*)GetPixBaseAddr( pm );
+ if ( base )
+ {
+ PixMapPtr pmp = *pm;
+ // verify the parameters for direct memory write
+ if ( pmp->pixelType == 0 || pmp->pixelSize == 1 || pmp->cmpCount == 1 || pmp->cmpSize == 1 )
+ {
+ static uchar reverse[16] = /* Bit reversal lookup table */
+ { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee, 0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
+ uchar *dst = base;
+ const uchar *src = array;
+ int rowBytesSrc = (w+7)>>3 ;
+ int rowPatch = (pmp->rowBytes&0x3fff) - rowBytesSrc;
+ for ( int j=0; j<h; j++,dst+=rowPatch )
+ for ( int i=0; i<rowBytesSrc; i++,src++ )
+ *dst++ = (reverse[*src & 0x0f] & 0xf0) | (reverse[(*src >> 4) & 0x0f] & 0x0f);
+ }
+ }
+ UnlockPixels( pm );
+ }
+ }
+ SetPort(savePort);
+ return gw; /* tell caller we succeeded! */
+}
+void fl_delete_bitmask(Fl_Bitmask id) {
+ if (id) DisposeGWorld(id);
+}
#elif defined(WIN32) // Windows bitmask functions...
// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
@@ -213,7 +258,7 @@ void fl_delete_bitmask(Fl_Bitmask bm) {
// If you want to test/fix this, uncomment the "#ifdef __APPLE__" and comment out
// the "#if 0" here. Also see Fl_Image.cxx for a similar check...
-//#ifdef __APPLE__
+//#ifdef __APPLE_QD__
#if 0
// Create an 8-bit mask used for alpha blending
Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
@@ -356,7 +401,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
// secret bitblt code found in old MSWindows reference manual:
BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
DeleteDC(tempdc);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
if (!id) id = fl_create_bitmask(w(), h(), array);
GrafPtr dstPort;
GetPort( &dstPort );
@@ -370,6 +415,21 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
&dst, // dst bounds
srcOr, // mode
0L); // mask region
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
+ if (!id) id = fl_create_bitmask(w(), h(), array);
+ GrafPtr dstPort;
+ GetPort( &dstPort );
+ Rect src, dst;
+ GetPortBounds( (Fl_Offscreen)id, &src );
+ SetRect( &src, cx, cy, cx+W, cy+H );
+ SetRect( &dst, X, Y, X+W, Y+H );
+ CopyBits(GetPortBitMapForCopyBits((Fl_Offscreen)id), // srcBits
+ GetPortBitMapForCopyBits(dstPort), // dstBits
+ &src, // src bounds
+ &dst, // dst bounds
+ srcOr, // mode
+ 0L); // mask region
#else
if (!id) id = fl_create_bitmask(w(), h(), array);
@@ -474,5 +534,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
//
-// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.23 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.24 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index 29143c83a..a14aac216 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.9 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.10 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Double-buffered window code for the Fast Light Tool Kit (FLTK).
//
@@ -94,11 +94,8 @@ void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy)
extern void fl_restore_clip();
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
-/**
- * Mac:
- */
GWorldPtr fl_create_offscreen(int w, int h) {
GWorldPtr gw;
Rect bounds;
@@ -111,9 +108,6 @@ GWorldPtr fl_create_offscreen(int w, int h) {
return gw;
}
-/**
- * Mac:
- */
void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) {
Rect src;
if ( !gWorld ) return;
@@ -129,9 +123,6 @@ void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int src
CopyBits(GetPortBitMapForCopyBits(gWorld), GetPortBitMapForCopyBits(dstPort), &src, &dst, srcCopy, 0L);
}
-/**
- * Mac:
- */
void fl_delete_offscreen(GWorldPtr gWorld) {
DisposeGWorld(gWorld);
}
@@ -139,9 +130,6 @@ void fl_delete_offscreen(GWorldPtr gWorld) {
static GrafPtr prevPort;
static GDHandle prevGD;
-/**
- * Mac:
- */
void fl_begin_offscreen(GWorldPtr gWorld) {
GetGWorld( &prevPort, &prevGD );
if ( gWorld )
@@ -162,9 +150,75 @@ void fl_begin_offscreen(GWorldPtr gWorld) {
fl_push_no_clip();
}
-/**
- * Mac:
- */
+void fl_end_offscreen() {
+ GWorldPtr currPort;
+ GDHandle currGD;
+ GetGWorld( &currPort, &currGD );
+ fl_pop_clip();
+ PixMapHandle pm = GetGWorldPixMap(currPort);
+ UnlockPixels(pm);
+ SetGWorld( prevPort, prevGD );
+ fl_window = GetWindowFromPort( prevPort );
+}
+
+extern void fl_restore_clip();
+
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+GWorldPtr fl_create_offscreen(int w, int h) {
+ GWorldPtr gw;
+ Rect bounds;
+ bounds.left=0; bounds.right=w; bounds.top=0; bounds.bottom=h;
+ QDErr err = NewGWorld(&gw, 0, &bounds, 0L, 0L, 0); // 'useTempMem' should not be used (says the Carbon port manual)
+ if ( err == -108 )
+ { }
+// fl_message( "The application memory is low. Please increase the initial memory assignment.\n" );
+ if (err!=noErr || gw==0L) return 0L;
+ return gw;
+}
+
+void fl_copy_offscreen(int x,int y,int w,int h,GWorldPtr gWorld,int srcx,int srcy) {
+ Rect src;
+ if ( !gWorld ) return;
+ src.top = srcy; src.left = srcx; src.bottom = srcy+h; src.right = srcx+w;
+ Rect dst;
+ GrafPtr dstPort; GetPort(&dstPort);
+ dst.top = y; dst.left = x; dst.bottom = y+h; dst.right = x+w;
+ RGBColor rgb;
+ rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff;
+ RGBBackColor( &rgb );
+ rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
+ RGBForeColor( &rgb );
+ CopyBits(GetPortBitMapForCopyBits(gWorld), GetPortBitMapForCopyBits(dstPort), &src, &dst, srcCopy, 0L);
+}
+
+void fl_delete_offscreen(GWorldPtr gWorld) {
+ DisposeGWorld(gWorld);
+}
+
+static GrafPtr prevPort;
+static GDHandle prevGD;
+
+void fl_begin_offscreen(GWorldPtr gWorld) {
+ GetGWorld( &prevPort, &prevGD );
+ if ( gWorld )
+ {
+ SetGWorld( gWorld, 0 ); // sets the correct port
+ PixMapHandle pm = GetGWorldPixMap(gWorld);
+ Boolean ret = LockPixels(pm);
+ if ( ret == false )
+ {
+ Rect rect;
+ GetPortBounds( gWorld, &rect );
+ UpdateGWorld( &gWorld, 0, &rect, 0, 0, 0 );
+ pm = GetGWorldPixMap( gWorld );
+ LockPixels( pm );
+ }
+ fl_window = 0;
+ }
+ fl_push_no_clip();
+}
+
void fl_end_offscreen() {
GWorldPtr currPort;
GDHandle currGD;
@@ -195,7 +249,16 @@ void Fl_Double_Window::flush(int eraseoverlay) {
XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeUndefined);
else
#endif
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ // the Apple OS X window manager double buffers ALL windows
+ // anyway, so there is no need to waste memory and time.
+ //
+ // BTW: Windows2000 and later also forces doublebuffering if
+ // transparent windows are beeing used (alpha channel)
+ if ( ( !QDIsPortBuffered( GetWindowPort(myi->xid) ) ) || force_doublebuffering_ )
+ myi->other_xid = fl_create_offscreen(w(), h());
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
// the Apple OS X window manager double buffers ALL windows
// anyway, so there is no need to waste memory and time.
//
@@ -243,7 +306,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
draw();
DeleteDC(fl_gc);
fl_gc = _sgc;
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
if ( myi->other_xid ) {
fl_begin_offscreen( myi->other_xid );
fl_clip_region( 0 );
@@ -252,6 +315,16 @@ void Fl_Double_Window::flush(int eraseoverlay) {
} else {
draw();
}
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ if ( myi->other_xid ) {
+ fl_begin_offscreen( myi->other_xid );
+ fl_clip_region( 0 );
+ draw();
+ fl_end_offscreen();
+ } else {
+ draw();
+ }
#else // X:
fl_window = myi->other_xid;
draw();
@@ -262,7 +335,10 @@ void Fl_Double_Window::flush(int eraseoverlay) {
// on Irix (at least) it is faster to reduce the area copied to
// the current clip region:
int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H);
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
#else
fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
@@ -299,5 +375,5 @@ Fl_Double_Window::~Fl_Double_Window() {
}
//
-// End of "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.9 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Double_Window.cxx,v 1.12.2.4.2.10 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Font.H b/src/Fl_Font.H
index f221be3b2..49c7e5ab9 100644
--- a/src/Fl_Font.H
+++ b/src/Fl_Font.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Font.H,v 1.6.2.3.2.5 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Font.H,v 1.6.2.3.2.6 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Font definitions for the Fast Light Tool Kit (FLTK).
//
@@ -36,6 +36,8 @@
#ifndef FL_FONT_
#define FL_FONT_
+#include <config.h>
+
# if USE_XFT
typedef struct _XftFont XftFont;
# endif // USE_XFT
@@ -48,7 +50,14 @@ public:
int width[256];
TEXTMETRIC metr;
FL_EXPORT Fl_FontSize(const char* fontname, int size);
-# elif defined(__APPLE__)
+# elif defined(__APPLE_QD__)
+ FL_EXPORT Fl_FontSize(const char* fontname, int size);
+ short font, face, size;
+ short ascent, descent;
+ short width[256];
+ bool knowMetrics;
+# elif defined(__APPLE_QUARTZ__)
+#warning quartz
FL_EXPORT Fl_FontSize(const char* fontname, int size);
short font, face, size;
short ascent, descent;
@@ -94,5 +103,5 @@ FL_EXPORT char *fl_find_fontsize(char *name);
#endif
//
-// End of "$Id: Fl_Font.H,v 1.6.2.3.2.5 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Font.H,v 1.6.2.3.2.6 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Gl_Choice.H b/src/Fl_Gl_Choice.H
index 5b96969a7..9f1c6e19c 100644
--- a/src/Fl_Gl_Choice.H
+++ b/src/Fl_Gl_Choice.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.3 2001/12/18 11:00:09 matthiaswm Exp $"
+// "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.4 2004/08/25 00:20:25 matthiaswm Exp $"
//
// OpenGL definitions for the Fast Light Tool Kit (FLTK).
//
@@ -57,7 +57,12 @@
#ifdef WIN32
# include <FL/gl.h>
# define GLContext HGLRC
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+# include <OpenGL/gl.h>
+# include <AGL/agl.h>
+# define GLContext AGLContext
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
# include <OpenGL/gl.h>
# include <AGL/agl.h>
# define GLContext AGLContext
@@ -75,7 +80,10 @@ public:
#ifdef WIN32
int pixelformat; // the visual to use
PIXELFORMATDESCRIPTOR pfd; // some wgl calls need this thing
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ AGLPixelFormat pixelformat;
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
AGLPixelFormat pixelformat;
#else
XVisualInfo *vis; // the visual to use
@@ -93,7 +101,12 @@ class Fl_Window;
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+
+GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
+
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
@@ -115,5 +128,5 @@ void fl_delete_gl_context(GLContext);
#endif
//
-// End of "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.3 2001/12/18 11:00:09 matthiaswm Exp $".
+// End of "$Id: Fl_Gl_Choice.H,v 1.4.2.6.2.4 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx
index e8276823a..ec9f8f10b 100644
--- a/src/Fl_Gl_Choice.cxx
+++ b/src/Fl_Gl_Choice.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.19 2004/05/15 22:58:18 easysw Exp $"
+// "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.20 2004/08/25 00:20:25 matthiaswm Exp $"
//
// OpenGL visual selection code for the Fast Light Tool Kit (FLTK).
//
@@ -33,7 +33,10 @@
# include <FL/gl_draw.H>
# include "flstring.h"
-# ifdef __APPLE__
+# ifdef __APPLE_QD__
+# include <FL/Fl_Window.H>
+# elif defined(__APPLE_QUARTZ__)
+#warning quartz
# include <FL/Fl_Window.H>
# endif
@@ -49,7 +52,7 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) {
if (g->mode == m && g->alist == alistp)
return g;
-# ifdef __APPLE__
+# ifdef __APPLE_QD__
const int *blist;
int list[32];
@@ -97,6 +100,56 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) {
fl_open_display();
AGLPixelFormat fmt = aglChoosePixelFormat(NULL, 0, (GLint*)blist);
if (!fmt) return 0;
+
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ const int *blist;
+ int list[32];
+
+ if (alistp)
+ blist = alistp;
+ else {
+ int n = 0;
+ if (m & FL_INDEX) {
+ list[n++] = AGL_BUFFER_SIZE;
+ list[n++] = 8; // glut tries many sizes, but this should work...
+ } else {
+ list[n++] = AGL_RGBA;
+ list[n++] = AGL_GREEN_SIZE;
+ list[n++] = (m & FL_RGB8) ? 8 : 1;
+ if (m & FL_ALPHA) {
+ list[n++] = AGL_ALPHA_SIZE;
+ list[n++] = 1;
+ }
+ if (m & FL_ACCUM) {
+ list[n++] = AGL_ACCUM_GREEN_SIZE;
+ list[n++] = 1;
+ if (m & FL_ALPHA) {
+ list[n++] = AGL_ACCUM_ALPHA_SIZE;
+ list[n++] = 1;
+ }
+ }
+ }
+ if (m & FL_DOUBLE) {
+ list[n++] = AGL_DOUBLEBUFFER;
+ }
+ if (m & FL_DEPTH) {
+ list[n++] = AGL_DEPTH_SIZE; list[n++] = 24;
+ }
+ if (m & FL_STENCIL) {
+ list[n++] = AGL_STENCIL_SIZE; list[n++] = 1;
+ }
+# ifdef AGL_STEREO
+ if (m & FL_STEREO) {
+ list[n++] = AGL_STEREO;
+ }
+# endif
+ list[n] = AGL_NONE;
+ blist = list;
+ }
+ fl_open_display();
+ AGLPixelFormat fmt = aglChoosePixelFormat(NULL, 0, (GLint*)blist);
+ if (!fmt) return 0;
# elif !defined(WIN32)
@@ -205,7 +258,10 @@ Fl_Gl_Choice *Fl_Gl_Choice::find(int m, const int *alistp) {
# ifdef WIN32
g->pixelformat = pixelformat;
g->pfd = chosen_pfd;
-# elif defined(__APPLE__)
+# elif defined(__APPLE_QD__)
+ g->pixelformat = fmt;
+# elif defined(__APPLE_QUARTZ__)
+#warning quartz
g->pixelformat = fmt;
# else
g->vis = visp;
@@ -271,7 +327,7 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
return context;
}
-# elif defined(__APPLE__)
+# elif defined(__APPLE_QD__)
GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
GLContext context, shared_ctx = context_list ? context_list[0] : 0;
context = aglCreateContext( g->pixelformat, shared_ctx);
@@ -286,6 +342,22 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
aglSetDrawable( context, GetWindowPort( fl_xid(window) ) );
return (context);
}
+# elif defined(__APPLE_QUARTZ__)
+#warning quartz
+GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int layer) {
+ GLContext context, shared_ctx = context_list ? context_list[0] : 0;
+ context = aglCreateContext( g->pixelformat, shared_ctx);
+ if (!context) return 0;
+ add_context((GLContext)context);
+ if ( window->parent() ) {
+ Rect wrect; GetWindowPortBounds( fl_xid(window), &wrect );
+ GLint rect[] = { window->x(), wrect.bottom-window->h()-window->y(), window->w(), window->h() };
+ aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect );
+ aglEnable( (GLContext)context, AGL_BUFFER_RECT );
+ }
+ aglSetDrawable( context, GetWindowPort( fl_xid(window) ) );
+ return (context);
+}
# else
GLContext fl_create_gl_context(XVisualInfo* vis) {
@@ -307,7 +379,7 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
cached_window = w;
# ifdef WIN32
wglMakeCurrent(Fl_X::i(w)->private_dc, context);
-# elif defined(__APPLE__)
+# elif defined(__APPLE_QD__)
if ( w->parent() ) { //: resize our GL buffer rectangle
Rect wrect; GetWindowPortBounds( fl_xid(w), &wrect );
GLint rect[] = { w->x(), wrect.bottom-w->h()-w->y(), w->w(), w->h() };
@@ -316,6 +388,16 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
}
aglSetDrawable(context, GetWindowPort( fl_xid(w) ) );
aglSetCurrentContext(context);
+# elif defined(__APPLE_QUARTZ__)
+#warning
+ if ( w->parent() ) { //: resize our GL buffer rectangle
+ Rect wrect; GetWindowPortBounds( fl_xid(w), &wrect );
+ GLint rect[] = { w->x(), wrect.bottom-w->h()-w->y(), w->w(), w->h() };
+ aglSetInteger( context, AGL_BUFFER_RECT, rect );
+ aglEnable( context, AGL_BUFFER_RECT );
+ }
+ aglSetDrawable(context, GetWindowPort( fl_xid(w) ) );
+ aglSetCurrentContext(context);
# else
glXMakeCurrent(fl_display, fl_xid(w), context);
# endif
@@ -327,7 +409,10 @@ void fl_no_gl_context() {
cached_window = 0;
# ifdef WIN32
wglMakeCurrent(0, 0);
-# elif defined(__APPLE__)
+# elif defined(__APPLE_QD__)
+ aglSetCurrentContext(0);
+# elif defined(__APPLE_QUARTZ__)
+#warning quartz
aglSetCurrentContext(0);
# else
glXMakeCurrent(fl_display, 0, 0);
@@ -338,10 +423,15 @@ void fl_delete_gl_context(GLContext context) {
if (cached_context == context) fl_no_gl_context();
# ifdef WIN32
wglDeleteContext(context);
-# elif defined(__APPLE__)
+# elif defined(__APPLE_QD__)
aglSetCurrentContext( NULL );
aglSetDrawable( context, NULL );
aglDestroyContext( context );
+# elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ aglSetCurrentContext( NULL );
+ aglSetDrawable( context, NULL );
+ aglDestroyContext( context );
# else
glXDestroyContext(fl_display, context);
# endif
@@ -352,5 +442,5 @@ void fl_delete_gl_context(GLContext context) {
//
-// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.19 2004/05/15 22:58:18 easysw Exp $".
+// End of "$Id: Fl_Gl_Choice.cxx,v 1.5.2.7.2.20 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx
index adaf8221c..96d5ca57d 100644
--- a/src/Fl_Gl_Window.cxx
+++ b/src/Fl_Gl_Window.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.20 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.21 2004/08/25 00:20:25 matthiaswm Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@@ -106,7 +106,10 @@ int Fl_Gl_Window::mode(int m, const int *a) {
hide();
show();
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ redraw();
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
redraw();
#else
// under X, if the visual changes we must make a new X window (yuck!):
@@ -189,7 +192,10 @@ void Fl_Gl_Window::swap_buffers() {
# else
SwapBuffers(Fl_X::i(this)->private_dc);
# endif
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ aglSwapBuffers((AGLContext)context_);
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
aglSwapBuffers((AGLContext)context_);
#else
glXSwapBuffers(fl_display, fl_xid(this));
@@ -204,7 +210,16 @@ int fl_overlay_depth = 0;
void Fl_Gl_Window::flush() {
uchar save_valid = valid_;
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ //: clear previous clipping in this shared port
+ GrafPtr port = GetWindowPort( fl_xid(this) );
+ Rect rect; SetRect( &rect, 0, 0, 0x7fff, 0x7fff );
+ GrafPtr old; GetPort( &old );
+ SetPort( port );
+ ClipRect( &rect );
+ SetPort( old );
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
//: clear previous clipping in this shared port
GrafPtr port = GetWindowPort( fl_xid(this) );
Rect rect; SetRect( &rect, 0, 0, 0x7fff, 0x7fff );
@@ -251,7 +266,10 @@ void Fl_Gl_Window::flush() {
glDrawBuffer(GL_BACK);
if (!SWAP_TYPE) {
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ SWAP_TYPE = COPY;
+#elif defined __APPLE_QUARTZ__
+#warning quartz
SWAP_TYPE = COPY;
#else
SWAP_TYPE = UNDEFINED;
@@ -338,7 +356,25 @@ void Fl_Gl_Window::resize(int X,int Y,int W,int H) {
// printf("Fl_Gl_Window::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
if (W != w() || H != h()) {
valid(0);
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+ GLint xywh[4];
+
+ if (window()) {
+ // MRS: This isn't quite right, but the parent window won't have its W and H updated yet...
+ xywh[0] = x();
+ xywh[1] = window()->h() - y() - h();
+ } else {
+ xywh[0] = 0;
+ xywh[1] = 0;
+ }
+
+ xywh[2] = W;
+ xywh[3] = H;
+ aglSetInteger(context_, AGL_BUFFER_RECT, xywh);
+// printf("resize: xywh=[%d %d %d %d]\n", xywh[0], xywh[1], xywh[2], xywh[3]);
+
+ aglUpdateContext(context_);
+#elif defined(__APPLE_QUARTZ__)
GLint xywh[4];
if (window()) {
@@ -409,5 +445,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
-// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.20 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.21 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index b1f39e97b..eb5681d72 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Image.cxx,v 1.5.2.3.2.32 2004/04/11 04:38:57 easysw Exp $"
+// "$Id: Fl_Image.cxx,v 1.5.2.3.2.33 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -329,7 +329,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
} else {
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
if (mask) {
Rect src, dst;
// MRS: STR #114 says we should be using cx, cy, W, and H...
@@ -364,6 +364,42 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
} else {
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
}
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ if (mask) {
+ Rect src, dst;
+ // MRS: STR #114 says we should be using cx, cy, W, and H...
+// src.left = 0; src.right = w();
+// src.top = 0; src.bottom = h();
+// dst.left = X; dst.right = X+w();
+// dst.top = Y; dst.bottom = Y+h();
+ src.left = cx; src.right = cx+W;
+ src.top = cy; src.bottom = cy+H;
+ dst.left = X; dst.right = X+W;
+ dst.top = Y; dst.bottom = Y+H;
+ RGBColor rgb;
+ rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff;
+ RGBBackColor(&rgb);
+ rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
+ RGBForeColor(&rgb);
+
+# if 0
+ // MRS: This *should* work, but doesn't on my system (iBook); change to
+ // "#if 1" and restore the corresponding code in Fl_Bitmap.cxx
+ // to test the real alpha channel support.
+ CopyDeepMask(GetPortBitMapForCopyBits((GrafPtr)id),
+ GetPortBitMapForCopyBits((GrafPtr)mask),
+ GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
+ &src, &src, &dst, blend, NULL);
+# else // Fallback to screen-door transparency...
+ CopyMask(GetPortBitMapForCopyBits((GrafPtr)id),
+ GetPortBitMapForCopyBits((GrafPtr)mask),
+ GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
+ &src, &src, &dst);
+# endif // 0
+ } else {
+ fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+ }
#else
if (mask) {
// I can't figure out how to combine a mask with existing region,
@@ -397,5 +433,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
-// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.32 2004/04/11 04:38:57 easysw Exp $".
+// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.33 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx
index f07cdd973..924246a13 100644
--- a/src/Fl_Pixmap.cxx
+++ b/src/Fl_Pixmap.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.28 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.29 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -104,7 +104,7 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
} else {
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
if (mask) {
Rect src, dst;
src.left = cx; src.right = cx+W;
@@ -123,6 +123,26 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
} else {
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
}
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ if (mask) {
+ Rect src, dst;
+ src.left = cx; src.right = cx+W;
+ src.top = cy; src.bottom = cy+H;
+ dst.left = X; dst.right = X+W;
+ dst.top = Y; dst.bottom = Y+H;
+ RGBColor rgb;
+ rgb.red = 0xffff; rgb.green = 0xffff; rgb.blue = 0xffff;
+ RGBBackColor(&rgb);
+ rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
+ RGBForeColor(&rgb);
+ CopyMask(GetPortBitMapForCopyBits((GrafPtr)id),
+ GetPortBitMapForCopyBits((GrafPtr)mask),
+ GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
+ &src, &src, &dst);
+ } else {
+ fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
+ }
#else
if (mask) {
// I can't figure out how to combine a mask with existing region,
@@ -461,5 +481,5 @@ void Fl_Pixmap::desaturate() {
}
//
-// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.28 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.29 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Widget.cxx b/src/Fl_Widget.cxx
index 14fc2edbf..528ac5b81 100644
--- a/src/Fl_Widget.cxx
+++ b/src/Fl_Widget.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.23 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Widget.cxx,v 1.5.2.4.2.24 2004/08/25 00:20:25 matthiaswm Exp $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
@@ -150,7 +150,7 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
fl_color(fl_contrast(FL_BLACK, color()));
-#if defined(WIN32) || defined(__APPLE__)
+#if defined(WIN32) || defined(__APPLE_QD__)
// Windows 95/98/ME do not implement the dotted line style, so draw
// every other pixel around the focus area...
//
@@ -245,5 +245,5 @@ int Fl_Widget::contains(const Fl_Widget *o) const {
}
//
-// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.23 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Widget.cxx,v 1.5.2.4.2.24 2004/08/25 00:20:25 matthiaswm Exp $".
//
diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx
index ab2dcae8c..09d128151 100644
--- a/src/Fl_Window_fullscreen.cxx
+++ b/src/Fl_Window_fullscreen.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.6 2004/04/11 04:38:58 easysw Exp $"
+// "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.7 2004/08/25 00:20:26 matthiaswm Exp $"
//
// Fullscreen window support for the Fast Light Tool Kit (FLTK).
//
@@ -36,6 +36,10 @@
#include <FL/Fl.H>
#include <FL/x.H>
+#ifdef __APPLE__
+#include <config.h>
+#endif
+
void Fl_Window::border(int b) {
if (b) {
if (border()) return;
@@ -47,8 +51,10 @@ void Fl_Window::border(int b) {
#ifdef WIN32
// not yet implemented, but it's possible
// for full fullscreen we have to make the window topmost as well
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
// \todo Mac : not yet implemeted
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
#else
if (shown()) Fl_X::i(this)->sendxjunk();
#endif
@@ -73,5 +79,5 @@ void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
}
//
-// End of "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.6 2004/04/11 04:38:58 easysw Exp $".
+// End of "$Id: Fl_Window_fullscreen.cxx,v 1.5.2.3.2.7 2004/08/25 00:20:26 matthiaswm Exp $".
//
diff --git a/src/Fl_get_key_mac.cxx b/src/Fl_get_key_mac.cxx
index d992a2554..8bd3f6bc8 100644
--- a/src/Fl_get_key_mac.cxx
+++ b/src/Fl_get_key_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_get_key_mac.cxx,v 1.1.2.9 2004/06/19 01:50:31 matthiaswm Exp $"
+// "$Id: Fl_get_key_mac.cxx,v 1.1.2.10 2004/08/25 00:20:26 matthiaswm Exp $"
//
// MacOS keyboard state routines for the Fast Light Tool Kit (FLTK).
//
@@ -29,6 +29,11 @@
#include <FL/Fl.H>
#include <FL/x.H>
+#include <config.h>
+
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
// convert an FLTK (X) keysym to a MacOS symbol:
// See also the inverse converter in Fl_mac.cxx
@@ -99,5 +104,5 @@ int Fl::get_key(int k) {
}
//
-// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.9 2004/06/19 01:50:31 matthiaswm Exp $".
+// End of "$Id: Fl_get_key_mac.cxx,v 1.1.2.10 2004/08/25 00:20:26 matthiaswm Exp $".
//
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx
index a0b1a6746..80d5dca2b 100644
--- a/src/Fl_mac.cxx
+++ b/src/Fl_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_mac.cxx,v 1.1.2.56 2004/06/19 01:50:31 matthiaswm Exp $"
+// "$Id: Fl_mac.cxx,v 1.1.2.57 2004/08/25 00:20:26 matthiaswm Exp $"
//
// MacOS specific code for the Fast Light Tool Kit (FLTK).
//
@@ -45,6 +45,7 @@ extern "C" {
#include <pthread.h>
}
+#include <config.h>
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/Fl_Tooltip.H>
@@ -55,6 +56,10 @@ extern "C" {
#include "flstring.h"
#include <unistd.h>
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
// #define DEBUG_SELECT // UNCOMMENT FOR SELECT()/THREAD DEBUGGING
#ifdef DEBUG_SELECT
#include <stdio.h> // testing
@@ -1922,6 +1927,6 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
//
-// End of "$Id: Fl_mac.cxx,v 1.1.2.56 2004/06/19 01:50:31 matthiaswm Exp $".
+// End of "$Id: Fl_mac.cxx,v 1.1.2.57 2004/08/25 00:20:26 matthiaswm Exp $".
//
diff --git a/src/fl_arci.cxx b/src/fl_arci.cxx
index 85f41c4f7..8f481a63c 100644
--- a/src/fl_arci.cxx
+++ b/src/fl_arci.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_arci.cxx,v 1.4.2.5.2.5 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: fl_arci.cxx,v 1.4.2.5.2.6 2004/08/25 00:20:26 matthiaswm Exp $"
//
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
//
@@ -38,6 +38,9 @@
#ifdef WIN32
#include <FL/math.h>
#endif
+#ifdef __APPLE__
+#include <config.h>
+#endif
void fl_arc(int x,int y,int w,int h,double a1,double a2) {
if (w <= 0 || h <= 0) return;
@@ -47,7 +50,12 @@ void fl_arc(int x,int y,int w,int h,double a1,double a2) {
int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ Rect r; r.left=x; r.right=x+w; r.top=y; r.bottom=y+h;
+ a1 = a2-a1; a2 = 450-a2;
+ FrameArc(&r, (short int)a2, (short int)a1);
+#elif defined(__APPLE_QUARTZ__)
+# warning quartz
Rect r; r.left=x; r.right=x+w; r.top=y; r.bottom=y+h;
a1 = a2-a1; a2 = 450-a2;
FrameArc(&r, (short int)a2, (short int)a1);
@@ -66,7 +74,12 @@ void fl_pie(int x,int y,int w,int h,double a1,double a2) {
int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
SelectObject(fl_gc, fl_brush());
Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ Rect r; r.left=x; r.right=x+w; r.top=y; r.bottom=y+h;
+ a1 = a2-a1; a2 = 450-a2;
+ PaintArc(&r, (short int)a2, (short int)a1);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
Rect r; r.left=x; r.right=x+w; r.top=y; r.bottom=y+h;
a1 = a2-a1; a2 = 450-a2;
PaintArc(&r, (short int)a2, (short int)a1);
@@ -76,5 +89,5 @@ void fl_pie(int x,int y,int w,int h,double a1,double a2) {
}
//
-// End of "$Id: fl_arci.cxx,v 1.4.2.5.2.5 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: fl_arci.cxx,v 1.4.2.5.2.6 2004/08/25 00:20:26 matthiaswm Exp $".
//
diff --git a/src/fl_color_mac.cxx b/src/fl_color_mac.cxx
index 675b7a008..f7ff589d7 100644
--- a/src/fl_color_mac.cxx
+++ b/src/fl_color_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_color_mac.cxx,v 1.1.2.6 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: fl_color_mac.cxx,v 1.1.2.7 2004/08/25 00:20:26 matthiaswm Exp $"
//
// MacOS color functions for the Fast Light Tool Kit (FLTK).
//
@@ -35,6 +35,10 @@
#include <FL/x.H>
#include <FL/fl_draw.H>
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
static unsigned fl_cmap[256] = {
#include "fl_cmap.h" // this is a file produced by "cmap.cxx":
};
@@ -86,5 +90,5 @@ void Fl::set_color(Fl_Color i, unsigned c) {
}
//
-// End of "$Id: fl_color_mac.cxx,v 1.1.2.6 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: fl_color_mac.cxx,v 1.1.2.7 2004/08/25 00:20:26 matthiaswm Exp $".
//
diff --git a/src/fl_cursor.cxx b/src/fl_cursor.cxx
index 9e26a90c4..1de6684fc 100644
--- a/src/fl_cursor.cxx
+++ b/src/fl_cursor.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_cursor.cxx,v 1.6.2.6.2.10 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: fl_cursor.cxx,v 1.6.2.6.2.11 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Mouse cursor support for the Fast Light Tool Kit (FLTK).
//
@@ -109,6 +109,9 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
}
#elif defined(__APPLE__)
+#ifdef __APPLE_QUARTZ__
+#warning are cursor shaped handled in Quickdraw/Quartz or in Carbon?
+#endif
static Cursor crsrHAND =
{
@@ -312,5 +315,5 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) {
#endif
//
-// End of "$Id: fl_cursor.cxx,v 1.6.2.6.2.10 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: fl_cursor.cxx,v 1.6.2.6.2.11 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_dnd_mac.cxx b/src/fl_dnd_mac.cxx
index ef9bae3d2..05fc5a82c 100644
--- a/src/fl_dnd_mac.cxx
+++ b/src/fl_dnd_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_dnd_mac.cxx,v 1.1.2.5 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: fl_dnd_mac.cxx,v 1.1.2.6 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Drag & Drop code for the Fast Light Tool Kit (FLTK).
//
@@ -31,6 +31,10 @@
#include <FL/x.H>
#include <FL/Fl_Window.H>
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
extern EventRef fl_os_event;
extern char *fl_selection_buffer;
extern int fl_selection_length;
@@ -81,5 +85,5 @@ int Fl::dnd()
//
-// End of "$Id: fl_dnd_mac.cxx,v 1.1.2.5 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: fl_dnd_mac.cxx,v 1.1.2.6 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx
index aecd8ae2a..5e656b5f3 100644
--- a/src/fl_draw_image_mac.cxx
+++ b/src/fl_draw_image_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_draw_image_mac.cxx,v 1.1.2.6 2004/04/11 04:38:59 easysw Exp $"
+// "$Id: fl_draw_image_mac.cxx,v 1.1.2.7 2004/08/25 00:20:27 matthiaswm Exp $"
//
// MacOS image drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -30,6 +30,10 @@
#include <FL/fl_draw.H>
#include <FL/x.H>
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
#define MAXBUFFER 0x40000 // 256k
/**
@@ -275,5 +279,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
}
//
-// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.6 2004/04/11 04:38:59 easysw Exp $".
+// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.7 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index ecc58d1d7..12c3c8cb3 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_font_mac.cxx,v 1.1.2.15 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_font_mac.cxx,v 1.1.2.16 2004/08/25 00:20:27 matthiaswm Exp $"
//
// MacOS font selection routines for the Fast Light Tool Kit (FLTK).
//
@@ -23,6 +23,12 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
+#include <config.h>
+
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
//: MeasureText, FontMetrics, WidthTabHandle, GetSysFont, SysFontSize
//: TextSize, TextFont
//: GetFNum (theName: Str255; VAR familyID: Integer);
@@ -195,5 +201,5 @@ void fl_draw(const char* str, int n, int x, int y) {
//
-// End of "$Id: fl_font_mac.cxx,v 1.1.2.15 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_font_mac.cxx,v 1.1.2.16 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_line_style.cxx b/src/fl_line_style.cxx
index d13b2c831..39580d0f5 100644
--- a/src/fl_line_style.cxx
+++ b/src/fl_line_style.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_line_style.cxx,v 1.3.2.3.2.14 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_line_style.cxx,v 1.3.2.3.2.15 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Line style code for the Fast Light Tool Kit (FLTK).
//
@@ -54,7 +54,7 @@ void fl_line_style(int style, int width, char* dashes) {
HPEN oldpen = (HPEN)SelectObject(fl_gc, newpen);
DeleteObject(oldpen);
fl_current_xmap->pen = newpen;
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
// QuickDraw supports pen size and pattern, but no arbitrary line styles.
static Pattern styles[] = {
{ { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }, // FL_SOLID
@@ -68,6 +68,21 @@ void fl_line_style(int style, int width, char* dashes) {
style &= 0xff;
if (style > 2) style = 2;
PenPat(styles + style);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ // QuickDraw supports pen size and pattern, but no arbitrary line styles.
+ static Pattern styles[] = {
+ { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }, // FL_SOLID
+ { { 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f } }, // FL_DASH
+ { { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 } } // FL_DOT
+ };
+
+ if (!width) width = 1;
+ PenSize(width, width);
+
+ style &= 0xff;
+ if (style > 2) style = 2;
+ PenPat(styles + style);
#else
int ndashes = dashes ? strlen(dashes) : 0;
// emulate the WIN32 dash patterns on X
@@ -104,5 +119,5 @@ void fl_line_style(int style, int width, char* dashes) {
//
-// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.14 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_line_style.cxx,v 1.3.2.3.2.15 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_overlay.cxx b/src/fl_overlay.cxx
index 995981c99..14ab40961 100644
--- a/src/fl_overlay.cxx
+++ b/src/fl_overlay.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_overlay.cxx,v 1.4.2.3.2.4 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_overlay.cxx,v 1.4.2.3.2.5 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Overlay support for the Fast Light Tool Kit (FLTK).
//
@@ -30,6 +30,9 @@
#include <FL/x.H>
#include <FL/fl_draw.H>
+#ifdef __APPLE__
+#include <config.h>
+#endif
static int px,py,pw,ph;
@@ -38,7 +41,12 @@ static void draw_current_rect() {
int old = SetROP2(fl_gc, R2_NOT);
fl_rect(px, py, pw, ph);
SetROP2(fl_gc, old);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ PenMode( patXor );
+ fl_rect(px, py, pw, ph);
+ PenMode( patCopy );
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
PenMode( patXor );
fl_rect(px, py, pw, ph);
PenMode( patCopy );
@@ -66,5 +74,5 @@ void fl_overlay_rect(int x, int y, int w, int h) {
}
//
-// End of "$Id: fl_overlay.cxx,v 1.4.2.3.2.4 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_overlay.cxx,v 1.4.2.3.2.5 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_read_image_mac.cxx b/src/fl_read_image_mac.cxx
index 262321c55..dd57096dd 100644
--- a/src/fl_read_image_mac.cxx
+++ b/src/fl_read_image_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_read_image_mac.cxx,v 1.1.2.5 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_read_image_mac.cxx,v 1.1.2.6 2004/08/25 00:20:27 matthiaswm Exp $"
//
// WIN32 image reading routines for the Fast Light Tool Kit (FLTK).
//
@@ -23,6 +23,12 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
+#include <config.h>
+
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
//
// 'fl_read_image()' - Read an image from the current window.
//
@@ -116,5 +122,5 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
//
-// End of "$Id: fl_read_image_mac.cxx,v 1.1.2.5 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_read_image_mac.cxx,v 1.1.2.6 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx
index 79a737eb2..a7d2f2c9f 100644
--- a/src/fl_rect.cxx
+++ b/src/fl_rect.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_rect.cxx,v 1.10.2.4.2.11 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_rect.cxx,v 1.10.2.4.2.12 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
//
@@ -28,6 +28,7 @@
// Also all fl_clip routines, since they are always linked in so
// that minimal update works.
+#include <config.h>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>
#include <FL/x.H>
@@ -40,7 +41,12 @@ void fl_rect(int x, int y, int w, int h) {
LineTo(fl_gc, x+w-1, y+h-1);
LineTo(fl_gc, x, y+h-1);
LineTo(fl_gc, x, y);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ Rect rect;
+ SetRect(&rect, x, y, x+w, y+h);
+ FrameRect(&rect);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
Rect rect;
SetRect(&rect, x, y, x+w, y+h);
FrameRect(&rect);
@@ -56,7 +62,12 @@ void fl_rectf(int x, int y, int w, int h) {
rect.left = x; rect.top = y;
rect.right = x + w; rect.bottom = y + h;
FillRect(fl_gc, &rect, fl_brush());
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ Rect rect;
+ SetRect(&rect, x, y, x+w, y+h);
+ PaintRect(&rect);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
Rect rect;
SetRect(&rect, x, y, x+w, y+h);
PaintRect(&rect);
@@ -68,7 +79,10 @@ void fl_rectf(int x, int y, int w, int h) {
void fl_xyline(int x, int y, int x1) {
#ifdef WIN32
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ MoveTo(x, y); LineTo(x1, y);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
MoveTo(x, y); LineTo(x1, y);
#else
XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y);
@@ -82,10 +96,15 @@ void fl_xyline(int x, int y, int x1, int y2) {
MoveToEx(fl_gc, x, y, 0L);
LineTo(fl_gc, x1, y);
LineTo(fl_gc, x1, y2);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x1, y);
LineTo(x1, y2);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x1, y);
+ LineTo(x1, y2);
#else
XPoint p[3];
p[0].x = x; p[0].y = p[1].y = y;
@@ -102,11 +121,17 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
LineTo(fl_gc, x1, y);
LineTo(fl_gc, x1, y2);
LineTo(fl_gc, x3, y2);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x1, y);
LineTo(x1, y2);
LineTo(x3, y2);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x1, y);
+ LineTo(x1, y2);
+ LineTo(x3, y2);
#else
XPoint p[4];
p[0].x = x; p[0].y = p[1].y = y;
@@ -121,7 +146,10 @@ void fl_yxline(int x, int y, int y1) {
if (y1 < y) y1--;
else y1++;
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ MoveTo(x, y); LineTo(x, y1);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
MoveTo(x, y); LineTo(x, y1);
#else
XDrawLine(fl_display, fl_window, fl_gc, x, y, x, y1);
@@ -135,10 +163,15 @@ void fl_yxline(int x, int y, int y1, int x2) {
MoveToEx(fl_gc, x, y, 0L);
LineTo(fl_gc, x, y1);
LineTo(fl_gc, x2, y1);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x, y1);
LineTo(x2, y1);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x, y1);
+ LineTo(x2, y1);
#else
XPoint p[3];
p[0].x = p[1].x = x; p[0].y = y;
@@ -155,11 +188,17 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
LineTo(fl_gc, x, y1);
LineTo(fl_gc, x2, y1);
LineTo(fl_gc, x2, y3);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x, y1);
LineTo(x2, y1);
LineTo(x2, y3);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x, y1);
+ LineTo(x2, y1);
+ LineTo(x2, y3);
#else
XPoint p[4];
p[0].x = p[1].x = x; p[0].y = y;
@@ -176,9 +215,13 @@ void fl_line(int x, int y, int x1, int y1) {
// Draw the last point *again* because the GDI line drawing
// functions will not draw the last point ("it's a feature!"...)
SetPixel(fl_gc, x1, y1, fl_RGB());
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x1, y1);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x1, y1);
#else
XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y1);
#endif
@@ -192,10 +235,15 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
// Draw the last point *again* because the GDI line drawing
// functions will not draw the last point ("it's a feature!"...)
SetPixel(fl_gc, x2, y2, fl_RGB());
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x1, y1);
LineTo(x2, y2);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x1, y1);
+ LineTo(x2, y2);
#else
XPoint p[3];
p[0].x = x; p[0].y = y;
@@ -211,11 +259,17 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
LineTo(fl_gc, x1, y1);
LineTo(fl_gc, x2, y2);
LineTo(fl_gc, x, y);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x1, y1);
LineTo(x2, y2);
LineTo(x, y);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x1, y1);
+ LineTo(x2, y2);
+ LineTo(x, y);
#else
XPoint p[4];
p[0].x = x; p[0].y = y;
@@ -233,12 +287,19 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
LineTo(fl_gc, x2, y2);
LineTo(fl_gc, x3, y3);
LineTo(fl_gc, x, y);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y);
LineTo(x1, y1);
LineTo(x2, y2);
LineTo(x3, y3);
LineTo(x, y);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y);
+ LineTo(x1, y1);
+ LineTo(x2, y2);
+ LineTo(x3, y3);
+ LineTo(x, y);
#else
XPoint p[5];
p[0].x = x; p[0].y = y;
@@ -258,7 +319,16 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
#ifdef WIN32
SelectObject(fl_gc, fl_brush());
Polygon(fl_gc, p, 3);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ PolyHandle poly = OpenPoly();
+ MoveTo(x, y);
+ LineTo(x1, y1);
+ LineTo(x2, y2);
+ ClosePoly();
+ PaintPoly(poly);
+ KillPoly(poly);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
PolyHandle poly = OpenPoly();
MoveTo(x, y);
LineTo(x1, y1);
@@ -282,7 +352,17 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
#ifdef WIN32
SelectObject(fl_gc, fl_brush());
Polygon(fl_gc, p, 4);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ PolyHandle poly = OpenPoly();
+ MoveTo(x, y);
+ LineTo(x1, y1);
+ LineTo(x2, y2);
+ LineTo(x3, y3);
+ ClosePoly();
+ PaintPoly(poly);
+ KillPoly(poly);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
PolyHandle poly = OpenPoly();
MoveTo(x, y);
LineTo(x1, y1);
@@ -301,8 +381,11 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
void fl_point(int x, int y) {
#ifdef WIN32
SetPixel(fl_gc, x, y, fl_RGB());
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
MoveTo(x, y); Line(0, 0);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ MoveTo(x, y); Line(0, 0);
#else
XDrawPoint(fl_display, fl_window, fl_gc, x, y);
#endif
@@ -328,7 +411,10 @@ Fl_Region XRectangleRegion(int x, int y, int w, int h) {
}
#endif
-#ifdef __APPLE__
+#ifdef __APPLE_QD__
+extern Fl_Region fl_window_region;
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
extern Fl_Region fl_window_region;
#endif
@@ -338,7 +424,7 @@ void fl_restore_clip() {
Fl_Region r = rstack[rstackptr];
#ifdef WIN32
SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
# if 1
if ( fl_window )
{
@@ -359,6 +445,20 @@ void fl_restore_clip() {
ClipRect(&rect);
}
# endif
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ if ( fl_window )
+ {
+ GrafPtr port = GetWindowPort( fl_window );
+ if ( port ) {
+ RgnHandle portClip = NewRgn();
+ CopyRgn( fl_window_region, portClip ); // changed
+ if ( r )
+ SectRgn( portClip, r, portClip );
+ SetPortClipRegion( port, portClip );
+ DisposeRgn( portClip );
+ }
+ }
#else
if (r) XSetRegion(fl_display, fl_gc, r);
else XSetClipMask(fl_display, fl_gc, 0);
@@ -387,8 +487,11 @@ void fl_push_clip(int x, int y, int w, int h) {
if (current) {
#ifdef WIN32
CombineRgn(r,r,current,RGN_AND);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
SectRgn(r, current, r);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ SectRgn(r, current, r);
#else
Fl_Region temp = XCreateRegion();
XIntersectRegion(current, r, temp);
@@ -399,9 +502,13 @@ void fl_push_clip(int x, int y, int w, int h) {
} else { // make empty clip region:
#ifdef WIN32
r = CreateRectRgn(0,0,0,0);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
r = NewRgn();
SetEmptyRgn(r);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ r = NewRgn();
+ SetEmptyRgn(r);
#else
r = XCreateRegion();
#endif
@@ -435,7 +542,13 @@ int fl_not_clipped(int x, int y, int w, int h) {
RECT rect;
rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
return RectInRegion(r,&rect);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ if (!r) return 1;
+ Rect rect;
+ rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
+ return RectInRgn(&rect, r);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
if (!r) return 1;
Rect rect;
rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
@@ -472,7 +585,21 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
DeleteObject(temp);
DeleteObject(rr);
return ret;
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ RgnHandle rr = NewRgn();
+ SetRectRgn( rr, x, y, x+w, y+h );
+ SectRgn( r, rr, rr );
+ Rect rp; GetRegionBounds(rr, &rp);
+ X = rp.left;
+ Y = rp.top;
+ W = rp.right - X;
+ H = rp.bottom - Y;
+ DisposeRgn( rr );
+ if ( H==0 ) return 2;
+ if ( h==H && w==W ) return 0;
+ return 0;
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
RgnHandle rr = NewRgn();
SetRectRgn( rr, x, y, x+w, y+h );
SectRgn( r, rr, rr );
@@ -508,5 +635,5 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
}
//
-// End of "$Id: fl_rect.cxx,v 1.10.2.4.2.11 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_rect.cxx,v 1.10.2.4.2.12 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_scroll_area.cxx b/src/fl_scroll_area.cxx
index e22e91788..b6a4a1ccc 100644
--- a/src/fl_scroll_area.cxx
+++ b/src/fl_scroll_area.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_scroll_area.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_scroll_area.cxx,v 1.4.2.3.2.7 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Scrolling routines for the Fast Light Tool Kit (FLTK).
//
@@ -27,6 +27,7 @@
// a "callback" which is called to draw rectangular areas that are moved
// into the drawing area.
+#include <config.h>
#include <FL/Fl.H>
#include <FL/x.H>
@@ -102,7 +103,15 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
if (temp > limit) {
draw_area(data, dest_x, dest_y + src_h - temp + limit, src_w, temp - limit);
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ Rect src = { src_y, src_x, src_y+src_h, src_x+src_w };
+ Rect dst = { dest_y, dest_x, dest_y+src_h, dest_x+src_w };
+ static RGBColor bg = { 0xffff, 0xffff, 0xffff }; RGBBackColor( &bg );
+ static RGBColor fg = { 0x0000, 0x0000, 0x0000 }; RGBForeColor( &fg );
+ CopyBits( GetPortBitMapForCopyBits( GetWindowPort(fl_window) ),
+ GetPortBitMapForCopyBits( GetWindowPort(fl_window) ), &src, &dst, srcCopy, 0L);
+#elif defined(__APPLE_QUARTZ__)
+#warning
Rect src = { src_y, src_x, src_y+src_h, src_x+src_w };
Rect dst = { dest_y, dest_x, dest_y+src_h, dest_x+src_w };
static RGBColor bg = { 0xffff, 0xffff, 0xffff }; RGBBackColor( &bg );
@@ -127,5 +136,5 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
}
//
-// End of "$Id: fl_scroll_area.cxx,v 1.4.2.3.2.6 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_scroll_area.cxx,v 1.4.2.3.2.7 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_set_fonts_mac.cxx b/src/fl_set_fonts_mac.cxx
index fd8c0216b..ee03c7d9f 100644
--- a/src/fl_set_fonts_mac.cxx
+++ b/src/fl_set_fonts_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_set_fonts_mac.cxx,v 1.1.2.10 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_set_fonts_mac.cxx,v 1.1.2.11 2004/08/25 00:20:27 matthiaswm Exp $"
//
// MacOS font utilities for the Fast Light Tool Kit (FLTK).
//
@@ -23,6 +23,12 @@
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
+#include <config.h>
+
+#ifdef __APPLE_QUARTZ__
+#warning quartz
+#endif
+
// This function fills in the fltk font table with all the fonts that
// are found on the X server. It tries to place the fonts into families
// and to sort them so the first 4 in a family are normal, bold, italic,
@@ -162,5 +168,5 @@ int Fl::get_font_sizes(Fl_Font fnum, int*& sizep) {
}
//
-// End of "$Id: fl_set_fonts_mac.cxx,v 1.1.2.10 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_set_fonts_mac.cxx,v 1.1.2.11 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/fl_vertex.cxx b/src/fl_vertex.cxx
index 1fdc60fcb..30bfcea86 100644
--- a/src/fl_vertex.cxx
+++ b/src/fl_vertex.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_vertex.cxx,v 1.5.2.3.2.8 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: fl_vertex.cxx,v 1.5.2.3.2.9 2004/08/25 00:20:27 matthiaswm Exp $"
//
// Portable drawing routines for the Fast Light Tool Kit (FLTK).
//
@@ -26,6 +26,7 @@
// Portable drawing code for drawing arbitrary shapes with
// simple 2D transformations. See also fl_arc.cxx
+#include <config.h>
#include <FL/fl_draw.H>
#include <FL/x.H>
#include <FL/math.h>
@@ -123,8 +124,11 @@ void fl_vertex(double x,double y) {
void fl_end_points() {
#ifdef WIN32
for (int i=0; i<n; i++) SetPixel(fl_gc, p[i].x, p[i].y, fl_RGB());
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
for (int i=0; i<n; i++) { MoveTo(p[i].x, p[i].y); Line(0, 0); }
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ for (int i=0; i<n; i++) { MoveTo(p[i].x, p[i].y); Line(0, 0); }
#else
if (n>1) XDrawPoints(fl_display, fl_window, fl_gc, p, n, 0);
#endif
@@ -137,7 +141,12 @@ void fl_end_line() {
}
#ifdef WIN32
if (n>1) Polyline(fl_gc, p, n);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ if (n<=1) return;
+ MoveTo(p[0].x, p[0].y);
+ for (int i=1; i<n; i++) LineTo(p[i].x, p[i].y);
+#elif defined(__APPLE_QUARTZ__)
+#warning
if (n<=1) return;
MoveTo(p[0].x, p[0].y);
for (int i=1; i<n; i++) LineTo(p[i].x, p[i].y);
@@ -167,7 +176,16 @@ void fl_end_polygon() {
SelectObject(fl_gc, fl_brush());
Polygon(fl_gc, p, n);
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ if (n<=1) return;
+ PolyHandle ph = OpenPoly();
+ MoveTo(p[0].x, p[0].y);
+ for (int i=1; i<n; i++) LineTo(p[i].x, p[i].y);
+ ClosePoly();
+ PaintPoly(ph);
+ KillPoly(ph);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
if (n<=1) return;
PolyHandle ph = OpenPoly();
MoveTo(p[0].x, p[0].y);
@@ -218,7 +236,16 @@ void fl_end_complex_polygon() {
SelectObject(fl_gc, fl_brush());
PolyPolygon(fl_gc, p, counts, numcount);
}
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ if (n<=1) return;
+ PolyHandle ph = OpenPoly();
+ MoveTo(p[0].x, p[0].y);
+ for (int i=1; i<n; i++) LineTo(p[i].x, p[i].y);
+ ClosePoly();
+ PaintPoly(ph);
+ KillPoly(ph);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
if (n<=1) return;
PolyHandle ph = OpenPoly();
MoveTo(p[0].x, p[0].y);
@@ -250,7 +277,11 @@ void fl_circle(double x, double y,double r) {
Pie(fl_gc, llx, lly, llx+w, lly+h, 0,0, 0,0);
} else
Arc(fl_gc, llx, lly, llx+w, lly+h, 0,0, 0,0);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ Rect rt; rt.left=llx; rt.right=llx+w; rt.top=lly; rt.bottom=lly+h;
+ (what == POLYGON ? PaintOval : FrameOval)(&rt);
+#elif defined(__APPLE_QUARTZ__)
+#warning
Rect rt; rt.left=llx; rt.right=llx+w; rt.top=lly; rt.bottom=lly+h;
(what == POLYGON ? PaintOval : FrameOval)(&rt);
#else
@@ -260,5 +291,5 @@ void fl_circle(double x, double y,double r) {
}
//
-// End of "$Id: fl_vertex.cxx,v 1.5.2.3.2.8 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: fl_vertex.cxx,v 1.5.2.3.2.9 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx
index 6bbdb5ab0..c00afbcde 100644
--- a/src/gl_draw.cxx
+++ b/src/gl_draw.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gl_draw.cxx,v 1.7.2.5.2.13 2004/05/15 22:58:19 easysw Exp $"
+// "$Id: gl_draw.cxx,v 1.7.2.5.2.14 2004/08/25 00:20:27 matthiaswm Exp $"
//
// OpenGL drawing support routines for the Fast Light Tool Kit (FLTK).
//
@@ -56,7 +56,13 @@ void gl_font(int fontid, int size) {
fl_fontsize->listbase = glGenLists(256);
wglUseFontBitmaps(fl_gc, base, count, fl_fontsize->listbase+base);
SelectObject(fl_gc, oldFid);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ // undefined characters automatically receive an empty GL list in aglUseFont
+ fl_fontsize->listbase = glGenLists(256);
+ aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face,
+ fl_fontsize->size, 0, 256, fl_fontsize->listbase);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
// undefined characters automatically receive an empty GL list in aglUseFont
fl_fontsize->listbase = glGenLists(256);
aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face,
@@ -207,5 +213,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) {
#endif
//
-// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.13 2004/05/15 22:58:19 easysw Exp $".
+// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.14 2004/08/25 00:20:27 matthiaswm Exp $".
//
diff --git a/src/gl_start.cxx b/src/gl_start.cxx
index 9e28cbd6c..2cff9a4e8 100644
--- a/src/gl_start.cxx
+++ b/src/gl_start.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: gl_start.cxx,v 1.6.2.5.2.9 2004/04/11 04:39:00 easysw Exp $"
+// "$Id: gl_start.cxx,v 1.6.2.5.2.10 2004/08/25 00:20:27 matthiaswm Exp $"
//
// OpenGL context routines for the Fast Light Tool Kit (FLTK).
//
@@ -65,9 +65,12 @@ void gl_start() {
#ifdef WIN32
if (!gl_choice) Fl::gl_visual(0);
context = fl_create_gl_context(Fl_Window::current(), gl_choice);
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
// \todo Mac : We need to check the code and verify it with Apple Sample code. The 'shiny'-test should at least work with the software OpenGL emulator
context = fl_create_gl_context(Fl_Window::current(), gl_choice);
+#elif defined(__APPLE_QUARTZ__)
+#warning quartz
+ context = fl_create_gl_context(Fl_Window::current(), gl_choice);
#else
context = fl_create_gl_context(fl_visual);
#endif
@@ -110,7 +113,10 @@ int Fl::gl_visual(int mode, int *alist) {
if (!c) return 0;
#ifdef WIN32
gl_choice = c;
-#elif defined(__APPLE__)
+#elif defined(__APPLE_QD__)
+ gl_choice = c;
+#elif defined(__APPLE_QUARTZ__)
+#warning
gl_choice = c;
#else
fl_visual = c->vis;
@@ -122,5 +128,5 @@ int Fl::gl_visual(int mode, int *alist) {
#endif
//
-// End of "$Id: gl_start.cxx,v 1.6.2.5.2.9 2004/04/11 04:39:00 easysw Exp $".
+// End of "$Id: gl_start.cxx,v 1.6.2.5.2.10 2004/08/25 00:20:27 matthiaswm Exp $".
//