mirror of https://github.com/fltk/fltk
OS X: removed all Carbon and Quickdraw references. Starting with 1.3, we only support Cocoa and Quartz.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7351 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
b77071a3de
commit
941901e273
|
@ -57,20 +57,10 @@ public:
|
|||
NEW_FOLDER = 0x0002, // Show 'New Folder' icon (if supported)
|
||||
PREVIEW = 0x0004, // enable preview mode
|
||||
};
|
||||
#ifndef __APPLE_COCOA__
|
||||
protected:
|
||||
NavDialogCreationOptions _opts; // file navigation options
|
||||
#endif
|
||||
private:
|
||||
int _btype; // kind-of browser to show()
|
||||
int _options; // general options
|
||||
#ifdef __APPLE_COCOA__
|
||||
void *_panel;
|
||||
#else
|
||||
NavDialogRef _ref; // file navigation reference
|
||||
NavActionState _keepstate; // holds button permissions
|
||||
NavMenuItemSpec _tempitem; // Popup menu selection
|
||||
#endif
|
||||
char **_pathnames; // array of pathnames
|
||||
int _tpathnames; // total pathnames
|
||||
char *_directory; // default pathname to use
|
||||
|
@ -92,41 +82,14 @@ private:
|
|||
int _filt_value; // index of the selected filter
|
||||
char *_errmsg; // error message
|
||||
|
||||
#ifndef __APPLE_COCOA__
|
||||
// PRIVATE CLASS TO HANDLE NAVIGATION DIALOG REPLY STRUCT
|
||||
// Class-ified, mainly to ensure proper cleanup.
|
||||
//
|
||||
class NavReply {
|
||||
int _valid_reply;
|
||||
NavReplyRecord _reply;
|
||||
public:
|
||||
NavReply();
|
||||
~NavReply();
|
||||
int get_reply(NavDialogRef& ref);
|
||||
int get_saveas_basename(char *s, int slen);
|
||||
int get_dirname(char *s, int slen);
|
||||
int get_pathnames(char **&pathnames, int& tpathnames);
|
||||
};
|
||||
#endif
|
||||
// Private methods
|
||||
void errmsg(const char *msg);
|
||||
void clear_pathnames();
|
||||
void set_single_pathname(const char *s);
|
||||
#ifdef __APPLE_COCOA__
|
||||
int get_saveas_basename(void);
|
||||
#else
|
||||
int get_saveas_basename(NavDialogRef& ref);
|
||||
int get_pathnames(NavDialogRef& ref);
|
||||
static void event_handler(NavEventCallbackMessage callBackSelector,
|
||||
NavCBRecPtr cbparm, void *data);
|
||||
#endif
|
||||
void clear_filters();
|
||||
void add_filter(const char *, const char *);
|
||||
void parse_filter(const char *from);
|
||||
#ifndef __APPLE_COCOA__
|
||||
static Boolean filter_proc_cb(AEDesc *, void *, void *, NavFilterModes);
|
||||
Boolean filter_proc_cb2(AEDesc*, void*, void*, NavFilterModes);
|
||||
#endif
|
||||
int post();
|
||||
|
||||
public:
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
fl_sys_menu_bar = this;
|
||||
}
|
||||
void menu(const Fl_Menu_Item *m);
|
||||
#if defined(__APPLE_COCOA__) || defined(FL_DOXYGEN)
|
||||
int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
|
||||
void remove(int n);
|
||||
void replace(int rank, const char *name);
|
||||
|
@ -63,7 +62,6 @@ public:
|
|||
// function doMenuOrItemOperation is in file Fl_cocoa.mm because it contains objective-c code
|
||||
static void *doMenuOrItemOperation( menuOrItemOperation operation, ...);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
|
|
33
FL/mac.H
33
FL/mac.H
|
@ -72,8 +72,6 @@ typedef float CGFloat;
|
|||
struct XPoint { int x, y; };
|
||||
struct XRectangle {int x, y, width, height;};
|
||||
|
||||
#ifdef __APPLE_COCOA__
|
||||
|
||||
typedef void *Window; // this is really a pter to the subclass FLWindow of NSWindow
|
||||
typedef struct flCocoaRegion {
|
||||
int count;
|
||||
|
@ -99,25 +97,6 @@ extern void *fl_system_menu;
|
|||
typedef CGContextRef Fl_Offscreen;
|
||||
typedef CGImageRef Fl_Bitmask;
|
||||
|
||||
#else
|
||||
|
||||
typedef WindowRef Window;
|
||||
typedef RgnHandle Fl_Region;
|
||||
inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
|
||||
Fl_Region R = NewRgn();
|
||||
SetRectRgn(R, x, y, x+w, y+h);
|
||||
return R;
|
||||
}
|
||||
inline void XDestroyRegion(Fl_Region r) {
|
||||
DisposeRgn(r);
|
||||
}
|
||||
extern CursHandle fl_default_cursor;
|
||||
extern Handle fl_system_menu;
|
||||
typedef GWorldPtr Fl_Offscreen;
|
||||
typedef GWorldPtr Fl_Bitmask; // Carbon requires a 1-bit GWorld instead of a BitMap
|
||||
|
||||
#endif
|
||||
|
||||
void fl_clip_region(Fl_Region);
|
||||
|
||||
# include "Fl_Window.H"
|
||||
|
@ -135,11 +114,7 @@ public:
|
|||
Fl_X *next; // linked tree to support subwindows
|
||||
Fl_X *xidChildren, *xidNext; // more subwindow tree
|
||||
int wait_for_expose;
|
||||
#ifdef __APPLE_COCOA__
|
||||
void *cursor; // is really NSCursor*
|
||||
#else
|
||||
CursHandle cursor;
|
||||
#endif
|
||||
static Fl_X* first;
|
||||
static Fl_X* i(const Fl_Window* w) {return w->i;}
|
||||
static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
|
||||
|
@ -154,18 +129,12 @@ public:
|
|||
static void q_end_image();
|
||||
};
|
||||
|
||||
#ifdef __APPLE_COCOA__
|
||||
extern void MacDestroyWindow(Fl_Window*,void *);
|
||||
extern void MacMapWindow(Fl_Window*,void *);
|
||||
extern void MacUnmapWindow(Fl_Window*,void *);
|
||||
extern WindowRef MACwindowRef(Fl_Window *w);
|
||||
extern Fl_Region MacRectRegionIntersect(Fl_Region current, int x,int y,int w, int h);
|
||||
extern void MacCollapseWindow(Window w);
|
||||
#else
|
||||
extern void MacDestroyWindow(Fl_Window*,WindowPtr);
|
||||
extern void MacMapWindow(Fl_Window*,WindowPtr);
|
||||
extern void MacUnmapWindow(Fl_Window*,WindowPtr);
|
||||
#endif
|
||||
|
||||
extern int MacUnlinkWindow(Fl_X*,Fl_X*start=0L);
|
||||
|
||||
|
@ -204,7 +173,6 @@ extern void fl_open_callback(void (*cb)(const char *));
|
|||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
#endif // FL_DOXYGEN
|
||||
|
||||
#if defined(__APPLE_COCOA__) || defined(FL_DOXYGEN)
|
||||
/** \defgroup group_macosx Mac OS X-specific functions
|
||||
@{ */
|
||||
|
||||
|
@ -219,7 +187,6 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
|
|||
*/
|
||||
extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0);
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
|
|
43
src/Fl.cxx
43
src/Fl.cxx
|
@ -410,16 +410,12 @@ double Fl::wait(double time_to_wait) {
|
|||
// the idle function may turn off idle, we can then wait:
|
||||
if (idle) time_to_wait = 0.0;
|
||||
}
|
||||
#ifdef __APPLE_COCOA__
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
#endif
|
||||
flush();
|
||||
if (idle && !in_idle) // 'idle' may have been set within flush()
|
||||
time_to_wait = 0.0;
|
||||
double retval = fl_wait(time_to_wait);
|
||||
#ifdef __APPLE_COCOA__
|
||||
[pool release];
|
||||
#endif
|
||||
return retval;
|
||||
|
||||
#else
|
||||
|
@ -1290,11 +1286,7 @@ int Fl_Window::handle(int ev)
|
|||
#if defined(USE_X11) || defined(WIN32)
|
||||
XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
MacMapWindow(this, i->xid);
|
||||
#else
|
||||
MacMapWindow(this, fl_xid(this));
|
||||
#endif
|
||||
MacMapWindow(this, i->xid);
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif // __APPLE__
|
||||
|
@ -1316,11 +1308,7 @@ int Fl_Window::handle(int ev)
|
|||
#if defined(USE_X11) || defined(WIN32)
|
||||
XUnmapWindow(fl_display, fl_xid(this));
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
MacUnmapWindow(this, i->xid);
|
||||
#else
|
||||
MacUnmapWindow(this, fl_xid(this));
|
||||
#endif
|
||||
#else
|
||||
# error platform unsupported
|
||||
#endif
|
||||
|
@ -1473,22 +1461,15 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
|
|||
CombineRgn(i->region, i->region, R, RGN_OR);
|
||||
XDestroyRegion(R);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
|
||||
int j; // don't add a rectangle totally inside the Fl_Region
|
||||
for(j = 0; j < i->region->count; j++) {
|
||||
if(CGRectContainsRect(i->region->rects[j], arg)) break;
|
||||
}
|
||||
if( j >= i->region->count) {
|
||||
i->region->rects = (CGRect*)realloc(i->region->rects, (++(i->region->count)) * sizeof(CGRect));
|
||||
i->region->rects[i->region->count - 1] = arg;
|
||||
}
|
||||
#else
|
||||
Fl_Region R = NewRgn();
|
||||
SetRectRgn(R, X, Y, X+W, Y+H);
|
||||
UnionRgn(R, i->region, i->region);
|
||||
DisposeRgn(R);
|
||||
#endif
|
||||
CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
|
||||
int j; // don't add a rectangle totally inside the Fl_Region
|
||||
for(j = 0; j < i->region->count; j++) {
|
||||
if(CGRectContainsRect(i->region->rects[j], arg)) break;
|
||||
}
|
||||
if( j >= i->region->count) {
|
||||
i->region->rects = (CGRect*)realloc(i->region->rects, (++(i->region->count)) * sizeof(CGRect));
|
||||
i->region->rects[i->region->count - 1] = arg;
|
||||
}
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -1512,11 +1493,7 @@ void Fl_Window::flush() {
|
|||
#ifdef WIN32
|
||||
# include "Fl_win32.cxx"
|
||||
#elif defined(__APPLE__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
# include "Fl_cocoa.mm"
|
||||
#else
|
||||
# include "Fl_mac.cxx"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "flstring.h"
|
||||
|
||||
#if defined(__APPLE_QUARTZ__)
|
||||
|
||||
|
||||
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
|
||||
static uchar reverse[16] = /* Bit reversal lookup table */
|
||||
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
|
||||
|
@ -58,7 +60,11 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
|
|||
void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
if (bm) CGImageRelease((CGImageRef)bm);
|
||||
}
|
||||
|
||||
|
||||
#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) {
|
||||
// we need to pad the lines out to words & swap the bits
|
||||
|
@ -146,39 +152,15 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
|
|||
return bm;
|
||||
}
|
||||
|
||||
#if 0 // This doesn't appear to be used anywhere...
|
||||
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data, int for_mask) {
|
||||
// we need to pad the lines out to words & swap the bits
|
||||
// in each byte.
|
||||
int w1 = (w+7)/8;
|
||||
int w2 = ((w+15)/16)*2;
|
||||
uchar* newarray = new uchar[w2*h];
|
||||
const uchar* src = data;
|
||||
uchar* dest = newarray;
|
||||
Fl_Bitmask bm;
|
||||
static uchar reverse[16] = /* Bit reversal lookup table */
|
||||
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
|
||||
0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
|
||||
|
||||
for (int y=0; y < h; y++) {
|
||||
for (int n = 0; n < w1; n++, src++)
|
||||
*dest++ = (reverse[*src & 0x0f] & 0xf0) |
|
||||
(reverse[(*src >> 4) & 0x0f] & 0x0f);
|
||||
dest += w2-w1;
|
||||
}
|
||||
|
||||
bm = CreateBitmap(w, h, 1, 1, newarray);
|
||||
|
||||
delete[] newarray;
|
||||
|
||||
return bm;
|
||||
}
|
||||
# endif // 0
|
||||
|
||||
void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
DeleteObject((HGDIOBJ)bm);
|
||||
}
|
||||
|
||||
|
||||
#else // X11 bitmask functions
|
||||
|
||||
|
||||
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
|
||||
return XCreateBitmapFromData(fl_display, fl_window, (const char *)data,
|
||||
(w+7)&-8, h);
|
||||
|
@ -187,6 +169,8 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
|
|||
void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
fl_delete_offscreen((Fl_Offscreen)bm);
|
||||
}
|
||||
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
|
||||
|
@ -368,7 +352,7 @@ Fl_Bitmap::~Fl_Bitmap() {
|
|||
|
||||
void Fl_Bitmap::uncache() {
|
||||
if (id_) {
|
||||
#if defined(__APPLE__) && defined(__APPLE_COCOA__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
fl_delete_bitmask((Fl_Bitmask)id_);
|
||||
#else
|
||||
fl_delete_bitmask((Fl_Offscreen)id_);
|
||||
|
|
|
@ -58,18 +58,12 @@ public:
|
|||
TEXTMETRIC metr;
|
||||
int angle;
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
||||
# elif defined(__APPLE_QD__)
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
||||
short font, face, size;
|
||||
short ascent, descent;
|
||||
short width[256];
|
||||
bool knowMetrics;
|
||||
# elif defined(__APPLE_QUARTZ__)
|
||||
FL_EXPORT Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size);
|
||||
ATSUTextLayout layout;
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
CTFontRef fontref;
|
||||
#endif
|
||||
# endif
|
||||
ATSUStyle style;
|
||||
short ascent, descent, q_width;
|
||||
// short width[256];
|
||||
|
|
|
@ -57,10 +57,6 @@
|
|||
#ifdef WIN32
|
||||
# include <FL/gl.h>
|
||||
# define GLContext HGLRC
|
||||
#elif defined(__APPLE_QD__)
|
||||
# include <OpenGL/gl.h>
|
||||
# include <AGL/agl.h>
|
||||
# define GLContext AGLContext
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
# include <OpenGL/gl.h>
|
||||
|
@ -80,8 +76,6 @@ public:
|
|||
#ifdef WIN32
|
||||
int pixelformat; // the visual to use
|
||||
PIXELFORMATDESCRIPTOR pfd; // some wgl calls need this thing
|
||||
#elif defined(__APPLE_QD__)
|
||||
AGLPixelFormat pixelformat;
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
AGLPixelFormat pixelformat;
|
||||
|
@ -101,10 +95,6 @@ class Fl_Window;
|
|||
|
||||
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
|
||||
|
||||
#elif defined(__APPLE_QD__)
|
||||
|
||||
GLContext fl_create_gl_context(Fl_Window*, const Fl_Gl_Choice*, int layer=0);
|
||||
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
|
||||
|
|
|
@ -304,19 +304,11 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
|
|||
if (!context) return 0;
|
||||
add_context((GLContext)context);
|
||||
if ( window->parent() ) {
|
||||
#ifdef __APPLE_COCOA__
|
||||
int H = window->window()->h();
|
||||
GLint rect[] = { window->x(), H-window->h()-window->y(), window->w(), window->h() };
|
||||
#else
|
||||
Rect wrect;
|
||||
GetWindowPortBounds( fl_xid(window), &wrect );
|
||||
GLint rect[] = { window->x(), wrect.bottom-window->h()-window->y(), window->w(), window->h() };
|
||||
#endif
|
||||
aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect );
|
||||
aglEnable( (GLContext)context, AGL_BUFFER_RECT );
|
||||
int H = window->window()->h();
|
||||
GLint rect[] = { window->x(), H-window->h()-window->y(), window->w(), window->h() };
|
||||
aglSetInteger( (GLContext)context, AGL_BUFFER_RECT, rect );
|
||||
aglEnable( (GLContext)context, AGL_BUFFER_RECT );
|
||||
}
|
||||
#if defined(__APPLE_COCOA__)
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if __LP64__
|
||||
// 64 bit version
|
||||
|
@ -332,10 +324,6 @@ GLContext fl_create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g, int lay
|
|||
// 32 bit version < 10.5
|
||||
aglSetDrawable( context, GetWindowPort( MACwindowRef(window) ) );
|
||||
#endif
|
||||
|
||||
#else
|
||||
aglSetDrawable( context, GetWindowPort( fl_xid(window) ) );
|
||||
#endif
|
||||
return (context);
|
||||
}
|
||||
# else
|
||||
|
@ -356,26 +344,16 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
|
|||
# elif defined(__APPLE_QUARTZ__)
|
||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
if ( w->parent() ) { //: resize our GL buffer rectangle
|
||||
#ifdef __APPLE_COCOA__
|
||||
int H = w->window()->h();
|
||||
GLint rect[] = { w->x(), H-w->h()-w->y(), w->w(), w->h() };
|
||||
#else
|
||||
Rect wrect;
|
||||
GetWindowPortBounds( fl_xid(w), &wrect );
|
||||
GLint rect[] = { w->x(), wrect.bottom-w->h()-w->y(), w->w(), w->h() };
|
||||
#endif
|
||||
int H = w->window()->h();
|
||||
GLint rect[] = { w->x(), H-w->h()-w->y(), w->w(), w->h() };
|
||||
aglSetInteger( context, AGL_BUFFER_RECT, rect );
|
||||
aglEnable( context, AGL_BUFFER_RECT );
|
||||
}
|
||||
#if defined(__APPLE_COCOA__)
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
aglSetWindowRef(context, MACwindowRef(w) );
|
||||
#else
|
||||
# else
|
||||
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
|
||||
#endif
|
||||
#else
|
||||
aglSetDrawable( context, GetWindowPort( fl_xid(w) ) );
|
||||
#endif
|
||||
# endif
|
||||
aglSetCurrentContext(context);
|
||||
# else
|
||||
# error unsupported platform
|
||||
|
|
|
@ -70,7 +70,7 @@ int Fl_Gl_Window::can_do(int a, const int *b) {
|
|||
}
|
||||
|
||||
void Fl_Gl_Window::show() {
|
||||
#if defined(__APPLE__) && defined(__APPLE_COCOA__)
|
||||
#if defined(__APPLE__)
|
||||
int need_redraw = 0;
|
||||
#endif
|
||||
if (!shown()) {
|
||||
|
@ -90,7 +90,7 @@ void Fl_Gl_Window::show() {
|
|||
#if !defined(WIN32) && !defined(__APPLE__)
|
||||
Fl_X::make_xid(this, g->vis, g->colormap);
|
||||
if (overlay && overlay != this) ((Fl_Gl_Window*)overlay)->show();
|
||||
#elif defined(__APPLE__) && defined(__APPLE_COCOA__)
|
||||
#elif defined(__APPLE__)
|
||||
extern void MACsetContainsGLsubwindow(Fl_Window *);
|
||||
if( ! parent() ) need_redraw=1;
|
||||
else MACsetContainsGLsubwindow( window() );
|
||||
|
@ -100,9 +100,7 @@ void Fl_Gl_Window::show() {
|
|||
|
||||
#ifdef __APPLE__
|
||||
set_visible();
|
||||
#ifdef __APPLE_COCOA__
|
||||
if(need_redraw) redraw();//necessary only after creation of a top-level GL window
|
||||
#endif
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
|
@ -251,17 +249,14 @@ void Fl_Gl_Window::swap_buffers() {
|
|||
SwapBuffers(Fl_X::i(this)->private_dc);
|
||||
# endif
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
#ifdef __APPLE_COCOA__
|
||||
if(overlay != NULL) {
|
||||
//aglSwapBuffers does not work well with overlays under cocoa
|
||||
glReadBuffer(GL_BACK);
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glCopyPixels(0,0,w(),h(),GL_COLOR);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
aglSwapBuffers((AGLContext)context_);
|
||||
aglSwapBuffers((AGLContext)context_);
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -283,11 +278,7 @@ void Fl_Gl_Window::flush() {
|
|||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
//: clear previous clipping in this shared port
|
||||
#if ! __LP64__
|
||||
#ifdef __APPLE_COCOA__
|
||||
GrafPtr port = GetWindowPort( MACwindowRef(this) );
|
||||
#else
|
||||
GrafPtr port = GetWindowPort( fl_xid(this) );
|
||||
#endif
|
||||
Rect rect; SetRect( &rect, 0, 0, 0x7fff, 0x7fff );
|
||||
GrafPtr old; GetPort( &old );
|
||||
SetPort( port );
|
||||
|
@ -334,7 +325,6 @@ void Fl_Gl_Window::flush() {
|
|||
|
||||
if (!SWAP_TYPE) {
|
||||
#if defined __APPLE_QUARTZ__
|
||||
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
|
||||
SWAP_TYPE = COPY;
|
||||
#else
|
||||
SWAP_TYPE = UNDEFINED;
|
||||
|
|
|
@ -1142,7 +1142,9 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||
"/%s/%s.prefs", vendor, application);
|
||||
for (char *s = filename; *s; s++) if (*s == '\\') *s = '/';
|
||||
#elif defined ( __APPLE__ )
|
||||
#ifdef __APPLE_COCOA__
|
||||
// TODO: verify that this is the Apple sanctioned way of finding these folders
|
||||
// (On MSWindows, this frequently leads to issues with internationalized systems)
|
||||
// Carbon: err = FindFolder( kLocalDomain, kPreferencesFolderType, 1, &spec.vRefNum, &spec.parID );
|
||||
switch (root) {
|
||||
case SYSTEM:
|
||||
strcpy(filename, "/Library/Preferences");
|
||||
|
@ -1151,23 +1153,6 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||
sprintf(filename, "%s/Library/Preferences", fl_getenv("HOME"));
|
||||
break;
|
||||
}
|
||||
#else
|
||||
FSSpec spec = { 0 };
|
||||
FSRef ref;
|
||||
OSErr err = fnfErr;
|
||||
switch (root) {
|
||||
case SYSTEM:
|
||||
err = FindFolder( kLocalDomain, kPreferencesFolderType,
|
||||
1, &spec.vRefNum, &spec.parID );
|
||||
break;
|
||||
case USER:
|
||||
err = FindFolder( kUserDomain, kPreferencesFolderType,
|
||||
1, &spec.vRefNum, &spec.parID );
|
||||
break;
|
||||
}
|
||||
FSpMakeFSRef( &spec, &ref );
|
||||
FSRefMakePath( &ref, (UInt8*)filename, FL_PATH_MAX );
|
||||
#endif
|
||||
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
|
||||
"/%s/%s.prefs", vendor, application );
|
||||
#else
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
#include <FL/Fl.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#ifdef __APPLE_COCOA__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
extern void fl_quartz_restore_line_style_();
|
||||
|
||||
|
@ -50,7 +48,7 @@ int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
|
|||
{
|
||||
OSStatus status;
|
||||
Fl_X::q_release_context();
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && defined(__APPLE_COCOA__)
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
if( [NSPrintPanel instancesRespondToSelector:@selector(runModalWithPrintInfo:)] &&
|
||||
[NSPrintInfo instancesRespondToSelector:@selector(PMPrintSession)] ) {
|
||||
NSAutoreleasePool *localPool;
|
||||
|
@ -119,7 +117,7 @@ int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
|
|||
status = PMSessionBeginDocumentNoDialog(printSession, printSettings, pageFormat);
|
||||
#endif //__LP64__
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && defined(__APPLE_COCOA__)
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
}
|
||||
#endif
|
||||
if (status != noErr) return 1;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// MacOS system menu bar widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2009 by Bill Spitzak and others.
|
||||
// Copyright 1998-2010 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
|
@ -63,76 +63,14 @@
|
|||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __APPLE_COCOA__
|
||||
#define MenuHandle void *
|
||||
#endif
|
||||
|
||||
typedef const Fl_Menu_Item *pFl_Menu_Item;
|
||||
|
||||
/*
|
||||
* copy the text of a menuitem into a buffer.
|
||||
* Skip all '&' which would mark the shortcut in FLTK
|
||||
* Skip all Mac control characters ('(', '<', ';', '^', '!' )
|
||||
*/
|
||||
|
||||
#ifndef __APPLE_COCOA__
|
||||
static void catMenuText( const char *src, char *dst )
|
||||
{
|
||||
char c;
|
||||
while ( *dst )
|
||||
dst++;
|
||||
if ( *src == '-' )
|
||||
src++;
|
||||
while ( ( c = *src++ ) )
|
||||
{
|
||||
if ( !strchr( "&(<;^!", c ) )
|
||||
*dst++ = c;
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* append a marker to identify the menu font style
|
||||
* <B, I, U, O, and S
|
||||
*/
|
||||
|
||||
static void catMenuFont( const Fl_Menu_Item *m, char *dst )
|
||||
{
|
||||
if ( !m->labeltype_ && !m->labelfont_ )
|
||||
return;
|
||||
while ( *dst )
|
||||
dst++;
|
||||
|
||||
if ( m->labelfont_ & FL_BOLD )
|
||||
strcat( dst, "<B" );
|
||||
if ( m->labelfont_ & FL_ITALIC )
|
||||
strcat( dst, "<I" );
|
||||
//if ( m->labelfont_ & FL_UNDERLINE )
|
||||
// strcat( dst, "<U" );
|
||||
|
||||
if ( m->labeltype_ == FL_EMBOSSED_LABEL )
|
||||
strcat( dst, "<U" );
|
||||
else if ( m->labeltype_ == FL_ENGRAVED_LABEL )
|
||||
strcat( dst, "<O" );
|
||||
else if ( m->labeltype_ == FL_SHADOW_LABEL )
|
||||
strcat( dst, "<S" );
|
||||
//else if ( m->labeltype_ == FL_SYMBOL_LABEL )
|
||||
; // not supported
|
||||
}
|
||||
|
||||
/*
|
||||
* append a marker to identify the menu shortcut
|
||||
* <B, I, U, O, and S
|
||||
enum {
|
||||
kMenuNoModifiers = 0,
|
||||
kMenuShiftModifier = (1 << 0),
|
||||
kMenuOptionModifier = (1 << 1),
|
||||
kMenuControlModifier = (1 << 2),
|
||||
kMenuNoCommandModifier = (1 << 3)
|
||||
};
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Set a shortct for an Apple manu item using the FLTK shortcut descriptor.
|
||||
*/
|
||||
static void setMenuShortcut( MenuHandle mh, int miCnt, const Fl_Menu_Item *m )
|
||||
{
|
||||
if ( !m->shortcut_ )
|
||||
|
@ -145,69 +83,29 @@ static void setMenuShortcut( MenuHandle mh, int miCnt, const Fl_Menu_Item *m )
|
|||
if ( !isalnum( key ) )
|
||||
return;
|
||||
|
||||
#ifdef __APPLE_COCOA__
|
||||
void *menuItem = Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::itemAtIndex, mh, miCnt);
|
||||
Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::setKeyEquivalent, menuItem, m->shortcut_ & 0xff );
|
||||
Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::setKeyEquivalentModifierMask, menuItem, m->shortcut_ );
|
||||
#else
|
||||
long macMod = kMenuNoCommandModifier;
|
||||
if ( m->shortcut_ & FL_META ) macMod = kMenuNoModifiers;
|
||||
if ( m->shortcut_ & FL_SHIFT || isupper(key) ) macMod |= kMenuShiftModifier;
|
||||
if ( m->shortcut_ & FL_ALT ) macMod |= kMenuOptionModifier;
|
||||
if ( m->shortcut_ & FL_CTRL ) macMod |= kMenuControlModifier;
|
||||
|
||||
//SetMenuItemKeyGlyph( mh, miCnt, key );
|
||||
SetItemCmd( mh, miCnt, toupper(key) );
|
||||
SetMenuItemModifiers( mh, miCnt, macMod );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// this function needs to be verified before we compile it back in.
|
||||
static void catMenuShortcut( const Fl_Menu_Item *m, char *dst )
|
||||
{
|
||||
if ( !m->shortcut_ )
|
||||
return;
|
||||
char c = m->shortcut_ & 0xff;
|
||||
if ( !isalnum( c & 0xff ) )
|
||||
return;
|
||||
while ( *dst )
|
||||
dst++;
|
||||
if ( m->shortcut_ & FL_CTRL )
|
||||
{
|
||||
sprintf( dst, "/%c", toupper( c ) );
|
||||
}
|
||||
//if ( isalnum( mm->shortcut_ ) && !( mm->flags & FL_SUBMENU ) )
|
||||
//sprintf( buf+strlen(buf), "/%c", mm->shortcut_ );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Set the Toggle and Radio flag based on FLTK flags
|
||||
*/
|
||||
static void setMenuFlags( MenuHandle mh, int miCnt, const Fl_Menu_Item *m )
|
||||
{
|
||||
if ( m->flags & FL_MENU_TOGGLE )
|
||||
{
|
||||
#ifdef __APPLE_COCOA__
|
||||
void *menuItem = Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::itemAtIndex, mh, miCnt);
|
||||
Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::setState, menuItem, m->flags & FL_MENU_VALUE );
|
||||
#else
|
||||
SetItemMark( mh, miCnt, ( m->flags & FL_MENU_VALUE ) ? 0x12 : 0 );
|
||||
#endif
|
||||
}
|
||||
else if ( m->flags & FL_MENU_RADIO ) {
|
||||
#ifdef __APPLE_COCOA__
|
||||
void *menuItem = Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::itemAtIndex, mh, miCnt);
|
||||
Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::setState, menuItem, m->flags & FL_MENU_VALUE );
|
||||
#else
|
||||
SetItemMark( mh, miCnt, ( m->flags & FL_MENU_VALUE ) ? 0x13 : 0 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(__APPLE_COCOA__) || defined(FL_DOXYGEN)
|
||||
|
||||
/*
|
||||
* create a sub menu for a specific menu handle
|
||||
*/
|
||||
|
@ -256,9 +154,11 @@ static void createSubMenu( void * mh, pFl_Menu_Item &mm )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* convert a complete Fl_Menu_Item array into a series of menus in the top menu bar
|
||||
* ALL PREVIOUS SYSTEM MENUS, EXCEPT APPLICATION MENU, ARE REPLACED BY THE NEW DATA
|
||||
*/
|
||||
static void convertToMenuBar(const Fl_Menu_Item *mm)
|
||||
//convert a complete Fl_Menu_Item array into a series of menus in the top menu bar
|
||||
//ALL PREVIOUS SYSTEM MENUS, EXCEPT APPLICATION MENU, ARE REPLACED BY THE NEW DATA
|
||||
{
|
||||
int count;//first, delete all existing system menus
|
||||
Fl_Sys_Menu_Bar::doMenuOrItemOperation(Fl_Sys_Menu_Bar::numberOfItems, fl_system_menu, &count);
|
||||
|
@ -287,6 +187,7 @@ static void convertToMenuBar(const Fl_Menu_Item *mm)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief create a system menu bar using the given list of menu structs
|
||||
*
|
||||
|
@ -301,6 +202,7 @@ void Fl_Sys_Menu_Bar::menu(const Fl_Menu_Item *m)
|
|||
convertToMenuBar(m);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief add to the system menu bar a new menu item
|
||||
*
|
||||
|
@ -317,6 +219,7 @@ int Fl_Sys_Menu_Bar::add(const char* label, int shortcut, Fl_Callback *cb, void
|
|||
return rank;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief remove an item from the system menu bar
|
||||
*
|
||||
|
@ -341,149 +244,14 @@ void Fl_Sys_Menu_Bar::replace(int rank, const char *name)
|
|||
fl_sys_menu_bar->Fl_Menu_::replace(rank, name);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void catMenuFlags( const Fl_Menu_Item *m, char *dst )
|
||||
{
|
||||
if ( !m->flags )
|
||||
return;
|
||||
if ( m->flags & FL_MENU_INACTIVE )
|
||||
strcat( dst, "(" );
|
||||
}
|
||||
|
||||
/*
|
||||
* create a sub menu for a specific menu handle
|
||||
*/
|
||||
static void createSubMenu( MenuHandle mh, int &cnt, pFl_Menu_Item &mm )
|
||||
{
|
||||
char buf[255];
|
||||
int miCnt = 1;
|
||||
while ( mm->text )
|
||||
{
|
||||
MenuHandle smh = 0;
|
||||
buf[1] = 0;
|
||||
catMenuFont( mm, buf+1 );
|
||||
//catMenuShortcut( mm, buf+1 );
|
||||
catMenuText( mm->text, buf+1 );
|
||||
catMenuFlags( mm, buf+1 );
|
||||
if ( mm->flags & (FL_SUBMENU | FL_SUBMENU_POINTER) )
|
||||
{
|
||||
cnt++;
|
||||
smh = NewMenu( cnt, (unsigned char*)"\001 " );
|
||||
sprintf( buf+1+strlen(buf+1), "/\033!%c", cnt );
|
||||
}
|
||||
if ( mm->flags & FL_MENU_DIVIDER )
|
||||
strcat( buf+1, ";-" );
|
||||
buf[0] = strlen( buf+1 );
|
||||
AppendMenu( mh, (unsigned char*)buf );
|
||||
// insert Appearanc manager functions here!
|
||||
setMenuFlags( mh, miCnt, mm );
|
||||
setMenuShortcut( mh, miCnt, mm );
|
||||
SetMenuItemRefCon( mh, miCnt, (UInt32)mm );
|
||||
miCnt++;
|
||||
if ( mm->flags & FL_MENU_DIVIDER )
|
||||
miCnt++;
|
||||
if ( mm->flags & FL_SUBMENU )
|
||||
{
|
||||
createSubMenu( smh, cnt, ++mm );
|
||||
}
|
||||
else if ( mm->flags & FL_SUBMENU_POINTER )
|
||||
{
|
||||
const Fl_Menu_Item *smm = (Fl_Menu_Item*)mm->user_data_;
|
||||
createSubMenu( mh, cnt, smm );
|
||||
}
|
||||
mm++;
|
||||
}
|
||||
InsertMenu( mh, -1 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* create a system menu bar using the given list of menu structs
|
||||
*
|
||||
* \author Matthias Melcher
|
||||
*
|
||||
* @param m list of Fl_Menu_Item
|
||||
* Draw the menu bar.
|
||||
* Nothing here because the OS does this for us.
|
||||
*/
|
||||
void Fl_Sys_Menu_Bar::menu(const Fl_Menu_Item *m)
|
||||
{
|
||||
fl_open_display();
|
||||
Fl_Menu_Bar::menu( m );
|
||||
fl_sys_menu_bar = this;
|
||||
|
||||
char buf[255];
|
||||
|
||||
int cnt = 1; // first menu is no 2. no 1 is the Apple Menu
|
||||
const Fl_Menu_Item *mm = m;
|
||||
for (;;)
|
||||
{
|
||||
if ( !mm || !mm->text )
|
||||
break;
|
||||
char visible = mm->visible() ? 1 : 0;
|
||||
buf[1] = 0;
|
||||
catMenuText( mm->text, buf+1 );
|
||||
buf[0] = strlen( buf+1 );
|
||||
MenuHandle mh = NewMenu( ++cnt, (unsigned char*)buf );
|
||||
if ( mm->flags & FL_MENU_INACTIVE ) {
|
||||
ChangeMenuAttributes(mh, kMenuAttrAutoDisable, 0);
|
||||
DisableAllMenuItems(mh);
|
||||
DisableMenuItem(mh, 0);
|
||||
}
|
||||
if ( mm->flags & FL_SUBMENU )
|
||||
createSubMenu( mh, cnt, ++mm );
|
||||
else if ( mm->flags & FL_SUBMENU_POINTER ) {
|
||||
const Fl_Menu_Item *smm = (Fl_Menu_Item*)mm->user_data_;
|
||||
createSubMenu( mh, cnt, smm );
|
||||
}
|
||||
if ( visible ) {
|
||||
InsertMenu( mh, 0 );
|
||||
}
|
||||
mm++;
|
||||
}
|
||||
DrawMenuBar();
|
||||
}
|
||||
|
||||
#endif //__APPLE_COCOA__
|
||||
|
||||
/*
|
||||
const Fl_Menu_Item* Fl_Sys_Menu_Bar::picked(const Fl_Menu_Item* v) {
|
||||
Fl_menu_Item *ret = Fl_Menu_Bar::picked( v );
|
||||
|
||||
if ( m->flags & FL_MENU_TOGGLE )
|
||||
{
|
||||
SetItemMark( mh, miCnt, ( m->flags & FL_MENU_VALUE ) ? 0x12 : 0 );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
void Fl_Sys_Menu_Bar::draw() {
|
||||
}
|
||||
|
||||
/*
|
||||
int Fl_Menu_Bar::handle(int event) {
|
||||
const Fl_Menu_Item* v;
|
||||
if (menu() && menu()->text) switch (event) {
|
||||
case FL_ENTER:
|
||||
case FL_LEAVE:
|
||||
return 1;
|
||||
case FL_PUSH:
|
||||
v = 0;
|
||||
J1:
|
||||
v = menu()->pulldown(x(), y(), w(), h(), v, this, 0, 1);
|
||||
picked(v);
|
||||
return 1;
|
||||
case FL_SHORTCUT:
|
||||
if (visible_r()) {
|
||||
v = menu()->find_shortcut();
|
||||
if (v && v->submenu()) goto J1;
|
||||
}
|
||||
return test_shortcut() != 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
|
|
@ -111,7 +111,8 @@ void Fl_Window::draw() {
|
|||
draw_children();
|
||||
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
if (!parent() && resizable() && (!size_range_set || minh!=maxh || minw!=maxw)) {
|
||||
extern CGContextRef fl_gc;
|
||||
if (fl_gc && !parent() && resizable() && (!size_range_set || minh!=maxh || minw!=maxw)) {
|
||||
int dx = Fl::box_dw(box())-Fl::box_dx(box());
|
||||
int dy = Fl::box_dh(box())-Fl::box_dy(box());
|
||||
if (dx<=0) dx = 1;
|
||||
|
@ -126,10 +127,6 @@ void Fl_Window::draw() {
|
|||
int i;
|
||||
for (i=dx; i<12; i++) {
|
||||
fl_color(c[i&3]);
|
||||
#ifdef __APPLE_COCOA__
|
||||
extern CGContextRef fl_gc;
|
||||
if(fl_gc)
|
||||
#endif
|
||||
fl_line(x1--, y1, x2, y2--);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,11 +37,7 @@ void Fl_Window::iconize() {
|
|||
#ifdef WIN32
|
||||
ShowWindow(i->xid, SW_SHOWMINNOACTIVE);
|
||||
#elif defined(__APPLE__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
MacCollapseWindow((Window)i->xid);
|
||||
#else
|
||||
CollapseWindow( i->xid, true );
|
||||
#endif
|
||||
MacCollapseWindow((Window)i->xid);
|
||||
#else
|
||||
XIconifyWindow(fl_display, i->xid, fl_screen);
|
||||
#endif
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#ifdef __APPLE_COCOA__
|
||||
|
||||
static const char* const compose_pairs =
|
||||
" ! % # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "//00A0 ...
|
||||
"`A'A^A~A:A*AAE,C`E'E^E:E`I'I^I:I-D~N`O'O^O~O:Ox O/`U'U^U:U'YTHss" //00C0 ...
|
||||
|
@ -48,20 +46,6 @@ static const char* const compose_pairs =
|
|||
|
||||
#else
|
||||
|
||||
static const char* const compose_pairs =
|
||||
":A*A,C'E~N:O:U'a`a^a:a~a*a,c'e`e"
|
||||
"^e:e'i`i^i:i~n'o`o^o:o~o'u`u^u:u"
|
||||
"+ o /c# SS* P|ssrOcOTM' : !=AE/O"
|
||||
"oo+-<=>=Y=mudtSgPipiS a dgOmaeo/"
|
||||
"? ! !!v-f ~~Dt<<>>.. `A~A~OOEoe"
|
||||
"- --''``\"'\"`:-^V:y:Y//E=< > fifl"
|
||||
"++..,,_\"%%^A^E'A:E`E'I^I:I`I'O^O"
|
||||
"mc`O'U^U`U||^ ~^_ u . * , ~-; v ";
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
static const char* const compose_pairs =
|
||||
"=E _'f _\"..+ ++^ %%^S< OE ^Z ^''^^\"\"^-*- --~ TM^s> oe ^z:Y"
|
||||
" ! % # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "
|
||||
|
|
|
@ -47,13 +47,8 @@ extern HWND fl_capture;
|
|||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// MacOS Carbon does not seem to have a mechanism to grab the mouse pointer
|
||||
#ifdef __APPLE_COCOA__
|
||||
extern void MACsetkeywindow(void *nsw);
|
||||
extern void *fl_capture;
|
||||
#else
|
||||
extern Window fl_capture;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void Fl::grab(Fl_Window* win) {
|
||||
|
@ -63,13 +58,8 @@ void Fl::grab(Fl_Window* win) {
|
|||
SetActiveWindow(fl_capture = fl_xid(first_window()));
|
||||
SetCapture(fl_capture);
|
||||
#elif defined(__APPLE__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
fl_capture = Fl_X::i(first_window())->xid;
|
||||
MACsetkeywindow(fl_capture);
|
||||
#else
|
||||
fl_capture = fl_xid( first_window() );
|
||||
SetUserFocusWindow( fl_capture );
|
||||
#endif
|
||||
fl_capture = Fl_X::i(first_window())->xid;
|
||||
MACsetkeywindow(fl_capture);
|
||||
#else
|
||||
XGrabPointer(fl_display,
|
||||
fl_xid(first_window()),
|
||||
|
@ -97,9 +87,6 @@ void Fl::grab(Fl_Window* win) {
|
|||
ReleaseCapture();
|
||||
#elif defined(__APPLE__)
|
||||
fl_capture = 0;
|
||||
#ifndef __APPLE_COCOA__
|
||||
SetUserFocusWindow( (WindowRef)kUserFocusAuto );
|
||||
#endif
|
||||
#else
|
||||
XUngrabKeyboard(fl_display, fl_event_time);
|
||||
XUngrabPointer(fl_display, fl_event_time);
|
||||
|
|
|
@ -2442,10 +2442,8 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
|
|||
*/
|
||||
void Fl_Window::make_current()
|
||||
{
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
OSStatus err;
|
||||
Fl_X::q_release_context();
|
||||
#endif
|
||||
if ( !fl_window_region )
|
||||
fl_window_region = NewRgn();
|
||||
fl_window = i->xid;
|
||||
|
@ -2479,29 +2477,26 @@ void Fl_Window::make_current()
|
|||
DisposeRgn( r );
|
||||
}
|
||||
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
err = QDBeginCGContext(GetWindowPort(i->xid), &i->gc);
|
||||
if (err!=noErr)
|
||||
fprintf(stderr, "Error %d in QDBeginCGContext\n", (int)err);
|
||||
fl_gc = i->gc;
|
||||
CGContextSaveGState(fl_gc);
|
||||
Fl_X::q_fill_context();
|
||||
#if defined(USE_CAIRO) && defined (__APPLE_QUARTZ__)
|
||||
#if defined(USE_CAIRO)
|
||||
if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
|
||||
#endif
|
||||
|
||||
#endif
|
||||
fl_clip_region( 0 );
|
||||
SetPortClipRegion( GetWindowPort(i->xid), fl_window_region );
|
||||
|
||||
#if defined(__APPLE_QUARTZ__) && defined(USE_CAIRO)
|
||||
#if defined(USE_CAIRO)
|
||||
// update the cairo_t context
|
||||
if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
// helper function to manage the current CGContext fl_gc
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
extern Fl_Color fl_color_;
|
||||
extern class Fl_Font_Descriptor *fl_fontsize;
|
||||
extern void fl_font(class Fl_Font_Descriptor*);
|
||||
|
@ -2545,7 +2540,7 @@ void Fl_X::q_release_context(Fl_X *x) {
|
|||
fprintf(stderr, "Error %d in QDEndCGContext\n", (int)err);
|
||||
}
|
||||
fl_gc = 0;
|
||||
#if defined(USE_CAIRO) && defined (__APPLE_QUARTZ__)
|
||||
#if defined(USE_CAIRO)
|
||||
if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0); // capture gc changes automatically to update the cairo context adequately
|
||||
#endif
|
||||
}
|
||||
|
@ -2569,8 +2564,6 @@ void Fl_X::q_end_image() {
|
|||
CGContextRestoreGState(fl_gc);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Copy & Paste fltk implementation.
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -64,9 +64,7 @@ void Fl_Device::arc(int x,int y,int w,int h,double a1,double a2) {
|
|||
#elif defined(__APPLE_QUARTZ__)
|
||||
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
|
||||
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
if (w!=h) {
|
||||
CGContextSaveGState(fl_gc);
|
||||
CGContextTranslateCTM(fl_gc, cx, cy);
|
||||
|
@ -78,9 +76,7 @@ void Fl_Device::arc(int x,int y,int w,int h,double a1,double a2) {
|
|||
CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
|
||||
}
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -108,9 +104,7 @@ void Fl_Device::pie(int x,int y,int w,int h,double a1,double a2) {
|
|||
#elif defined(__APPLE_QUARTZ__)
|
||||
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
|
||||
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
if (w!=h) {
|
||||
CGContextSaveGState(fl_gc);
|
||||
CGContextTranslateCTM(fl_gc, cx, cy);
|
||||
|
@ -126,9 +120,7 @@ void Fl_Device::pie(int x,int y,int w,int h,double a1,double a2) {
|
|||
CGContextClosePath(fl_gc);
|
||||
}
|
||||
CGContextFillPath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
|
|
@ -66,29 +66,21 @@ void Fl_Device::color(Fl_Color i) {
|
|||
g = c>>16;
|
||||
b = c>> 8;
|
||||
}
|
||||
#if defined(__APPLE_QUARTZ__)
|
||||
if (!fl_gc) return; // no context yet? We will assign the color later.
|
||||
float fr = r/255.0f;
|
||||
float fg = g/255.0f;
|
||||
float fb = b/255.0f;
|
||||
CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f);
|
||||
CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
|
||||
#else
|
||||
# error : neither Quickdraw nor Quartz defined
|
||||
#endif
|
||||
}
|
||||
|
||||
void Fl_Device::color(uchar r, uchar g, uchar b) {
|
||||
fl_color_ = fl_rgb_color(r, g, b);
|
||||
#if defined(__APPLE_QUARTZ__)
|
||||
float fr = r/255.0f;
|
||||
float fg = g/255.0f;
|
||||
float fb = b/255.0f;
|
||||
CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f);
|
||||
CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
|
||||
#else
|
||||
# error : Quartz not defined
|
||||
#endif
|
||||
}
|
||||
|
||||
void Fl::set_color(Fl_Color i, unsigned c) {
|
||||
|
|
|
@ -134,7 +134,6 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color c1, Fl_Color c2) {
|
|||
# error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE_COCOA__
|
||||
extern void *MACSetCursor(Fl_Cursor c);
|
||||
extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h);
|
||||
|
||||
|
@ -241,122 +240,6 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
|
|||
|
||||
#else
|
||||
|
||||
static Cursor crsrHAND =
|
||||
{
|
||||
{ E(0x0600), E(0x0900), E(0x0900), E(0x0900), E(0x09C0), E(0x0938), E(0x6926), E(0x9805),
|
||||
E(0x8801), E(0x4801), E(0x2002), E(0x2002), E(0x1004), E(0x0804), E(0x0408), E(0x0408) },
|
||||
{ E(0x0600), E(0x0F00), E(0x0F00), E(0x0F00), E(0x0FC0), E(0x0FF8), E(0x6FFE), E(0xFFFF),
|
||||
E(0xFFFF), E(0x7FFF), E(0x3FFE), E(0x3FFE), E(0x1FFC), E(0x0FFC), E(0x07F8), E(0x07F8) },
|
||||
{ 1, 5 } // Hotspot: ( y, x )
|
||||
}, *crsrHANDptr = &crsrHAND;
|
||||
static Cursor crsrHELP =
|
||||
{
|
||||
{ E(0x0000), E(0x4000), E(0x6000), E(0x7000), E(0x783C), E(0x7C7E), E(0x7E66), E(0x7F06),
|
||||
E(0x7F8C), E(0x7C18), E(0x6C18), E(0x4600), E(0x0618), E(0x0318), E(0x0300), E(0x0000) },
|
||||
{ E(0xC000), E(0xE000), E(0xF000), E(0xF83C), E(0xFC7E), E(0xFEFF), E(0xFFFF), E(0xFFFF),
|
||||
E(0xFFFE), E(0xFFFC), E(0xFE3C), E(0xEF3C), E(0xCF3C), E(0x07BC), E(0x0798), E(0x0380) },
|
||||
{ 1, 1 }
|
||||
}, *crsrHELPptr = &crsrHELP;
|
||||
static Cursor crsrMOVE =
|
||||
{
|
||||
{ E(0x0000), E(0x0180), E(0x03C0), E(0x07E0), E(0x07E0), E(0x1998), E(0x399C), E(0x7FFE),
|
||||
E(0x7FFE), E(0x399C), E(0x1998), E(0x07E0), E(0x07E0), E(0x03C0), E(0x0180), E(0x0000) },
|
||||
{ E(0x0180), E(0x03C0), E(0x07E0), E(0x0FF0), E(0x1FF8), E(0x3FFC), E(0x7FFE), E(0xFFFF),
|
||||
E(0xFFFF), E(0x7FFE), E(0x3FFC), E(0x1FF8), E(0x0FF0), E(0x07E0), E(0x03C0), E(0x0180) },
|
||||
{ 8, 8 }
|
||||
}, *crsrMOVEptr = &crsrMOVE;
|
||||
static Cursor crsrNS =
|
||||
{
|
||||
{ E(0x0000), E(0x0180), E(0x03C0), E(0x07E0), E(0x0FF0), E(0x0180), E(0x0180), E(0x0180),
|
||||
E(0x0180), E(0x0180), E(0x0180), E(0x0FF0), E(0x07E0), E(0x03C0), E(0x0180), E(0x0000) },
|
||||
{ E(0x0180), E(0x03C0), E(0x07E0), E(0x0FF0), E(0x1FF8), E(0x1FF8), E(0x03C0), E(0x03C0),
|
||||
E(0x03C0), E(0x03C0), E(0x1FF8), E(0x1FF8), E(0x0FF0), E(0x07E0), E(0x03C0), E(0x0180) },
|
||||
{ 8, 8 }
|
||||
}, *crsrNSptr = &crsrNS;
|
||||
static Cursor crsrWE =
|
||||
{
|
||||
{ E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0810), E(0x1818), E(0x381C), E(0x7FFE),
|
||||
E(0x7FFE), E(0x381C), E(0x1818), E(0x0810), E(0x0000), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ E(0x0000), E(0x0000), E(0x0000), E(0x0C30), E(0x1C38), E(0x3C3C), E(0x7FFE), E(0xFFFF),
|
||||
E(0xFFFF), E(0x7FFE), E(0x3C3C), E(0x1C38), E(0x0C30), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ 8, 8 }
|
||||
}, *crsrWEptr = &crsrWE;
|
||||
static Cursor crsrNWSE =
|
||||
{
|
||||
{ E(0x0000), E(0x7E00), E(0x7C00), E(0x7800), E(0x7C00), E(0x6E00), E(0x4710), E(0x03B0),
|
||||
E(0x01F0), E(0x00F0), E(0x01F0), E(0x03F0), E(0x0000), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ E(0xFF00), E(0xFF00), E(0xFE00), E(0xFC00), E(0xFE00), E(0xFF18), E(0xEFB8), E(0xC7F8),
|
||||
E(0x03F8), E(0x01F8), E(0x03F8), E(0x07F8), E(0x07F8), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ 8, 8 }
|
||||
}, *crsrNWSEptr = &crsrNWSE;
|
||||
static Cursor crsrNESW =
|
||||
{
|
||||
{ E(0x0000), E(0x03F0), E(0x01F0), E(0x00F0), E(0x01F0), E(0x03B0), E(0x4710), E(0x6E00),
|
||||
E(0x7C00), E(0x7800), E(0x7C00), E(0x7E00), E(0x0000), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ E(0x07F8), E(0x07F8), E(0x03F8), E(0x01F8), E(0x03F8), E(0xC7F8), E(0xEFB8), E(0xFF18),
|
||||
E(0xFE00), E(0xFC00), E(0xFE00), E(0xFF00), E(0xFF00), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ 8, 8 }
|
||||
}, *crsrNESWptr = &crsrNESW;
|
||||
static Cursor crsrNONE =
|
||||
{
|
||||
{ E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000),
|
||||
E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000),
|
||||
E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000), E(0x0000) },
|
||||
{ 0, 0 }
|
||||
}, *crsrNONEptr = &crsrNONE;
|
||||
static Cursor crsrARROW =
|
||||
{
|
||||
{ E(0x0000), E(0x4000), E(0x6000), E(0x7000), E(0x7800), E(0x7C00), E(0x7E00), E(0x7F00),
|
||||
E(0x7F80), E(0x7C00), E(0x6C00), E(0x4600), E(0x0600), E(0x0300), E(0x0300), E(0x0000) },
|
||||
{ E(0xC000), E(0xE000), E(0xF000), E(0xF800), E(0xFC00), E(0xFE00), E(0xFF00), E(0xFF80),
|
||||
E(0xFFC0), E(0xFFC0), E(0xFE00), E(0xEF00), E(0xCF00), E(0x0780), E(0x0780), E(0x0380) },
|
||||
{ 1, 1 }
|
||||
}, *crsrARROWptr = &crsrARROW;
|
||||
|
||||
#undef E
|
||||
|
||||
void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
|
||||
if (c == FL_CURSOR_DEFAULT) {
|
||||
c = cursor_default;
|
||||
}
|
||||
CursHandle icrsr = fl_default_cursor;
|
||||
switch (c) {
|
||||
case FL_CURSOR_CROSS: icrsr = GetCursor( crossCursor ); break;
|
||||
case FL_CURSOR_WAIT: icrsr = GetCursor( watchCursor ); break;
|
||||
case FL_CURSOR_INSERT: icrsr = GetCursor( iBeamCursor ); break;
|
||||
case FL_CURSOR_N:
|
||||
case FL_CURSOR_S:
|
||||
case FL_CURSOR_NS: icrsr = &crsrNSptr; break;
|
||||
case FL_CURSOR_HELP: icrsr = &crsrHELPptr; break;
|
||||
case FL_CURSOR_HAND: icrsr = &crsrHANDptr; break;
|
||||
case FL_CURSOR_MOVE: icrsr = &crsrMOVEptr; break;
|
||||
case FL_CURSOR_NE:
|
||||
case FL_CURSOR_SW:
|
||||
case FL_CURSOR_NESW: icrsr = &crsrNESWptr; break;
|
||||
case FL_CURSOR_E:
|
||||
case FL_CURSOR_W:
|
||||
case FL_CURSOR_WE: icrsr = &crsrWEptr; break;
|
||||
case FL_CURSOR_SE:
|
||||
case FL_CURSOR_NW:
|
||||
case FL_CURSOR_NWSE: icrsr = &crsrNWSEptr; break;
|
||||
case FL_CURSOR_NONE: icrsr = &crsrNONEptr; break;
|
||||
case FL_CURSOR_ARROW: icrsr = &crsrARROWptr; break;
|
||||
case FL_CURSOR_DEFAULT:
|
||||
default: break;
|
||||
}
|
||||
if (icrsr) { // make sure we have a non null icrsr before updating cursor state
|
||||
SetCursor( *icrsr );
|
||||
if (i) {
|
||||
i->cursor = icrsr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //__APPLE_COCOA__
|
||||
|
||||
#else
|
||||
|
||||
// I like the MSWindows resize cursors, so I duplicate them here:
|
||||
|
||||
#define CURSORSIZE 16
|
||||
|
|
|
@ -46,48 +46,8 @@ extern int fl_selection_length;
|
|||
*/
|
||||
int Fl::dnd()
|
||||
{
|
||||
#ifdef __APPLE_COCOA__
|
||||
extern int MACpreparedrag(void);
|
||||
return MACpreparedrag();
|
||||
#else
|
||||
|
||||
OSErr result;
|
||||
DragReference dragRef;
|
||||
result = NewDrag( &dragRef );
|
||||
if ( result != noErr ) return false;
|
||||
|
||||
result = AddDragItemFlavor( dragRef, 1, 'utf8', fl_selection_buffer, fl_selection_length, 0 );
|
||||
if ( result != noErr ) { DisposeDrag( dragRef ); return false; }
|
||||
|
||||
Point mp;
|
||||
GetMouse(&mp);
|
||||
LocalToGlobal( &mp );
|
||||
RgnHandle region = NewRgn();
|
||||
SetRectRgn( region, mp.h-10, mp.v-10, mp.h+10, mp.v+10 );
|
||||
RgnHandle r2 = NewRgn();
|
||||
SetRectRgn( r2, mp.h-8, mp.v-8, mp.h+8, mp.v+8 );
|
||||
DiffRgn( region, r2, region );
|
||||
DisposeRgn( r2 );
|
||||
|
||||
EventRecord event;
|
||||
ConvertEventRefToEventRecord( fl_os_event, &event );
|
||||
result = TrackDrag( dragRef, &event, region );
|
||||
|
||||
Fl_Widget *w = Fl::pushed();
|
||||
if ( w )
|
||||
{
|
||||
int old_event = Fl::e_number;
|
||||
w->handle(Fl::e_number = FL_RELEASE);
|
||||
Fl::e_number = old_event;
|
||||
Fl::pushed( 0 );
|
||||
}
|
||||
|
||||
if ( result != noErr ) { DisposeRgn( region ); DisposeDrag( dragRef ); return false; }
|
||||
|
||||
DisposeRgn( region );
|
||||
DisposeDrag( dragRef );
|
||||
return true;
|
||||
#endif //__APPLE_COCOA__
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -346,7 +346,8 @@ void fl_draw(
|
|||
int x, int y, int w, int h,
|
||||
Fl_Align align,
|
||||
Fl_Image* img,
|
||||
int draw_symbols) {
|
||||
int draw_symbols)
|
||||
{
|
||||
if ((!str || !*str) && !img) return;
|
||||
if (w && h && !fl_not_clipped(x, y, w, h) && (align & FL_ALIGN_INSIDE)) return;
|
||||
if (align & FL_ALIGN_CLIP) fl_push_clip(x, y, w, h);
|
||||
|
|
|
@ -61,7 +61,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
|
|||
{
|
||||
if (!linedelta) linedelta = W*delta;
|
||||
|
||||
#if defined(__APPLE_QUARTZ__)
|
||||
const void *array = buf;
|
||||
uchar *tmpBuf = 0;
|
||||
if (cb) {
|
||||
|
@ -147,9 +146,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
|
|||
}
|
||||
}
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
# error : you must define __APPLE_QUARTZ__
|
||||
#endif
|
||||
}
|
||||
|
||||
void Fl_Device::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
|
||||
|
|
|
@ -34,9 +34,7 @@ extern unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short*
|
|||
#define check_default_font() {if (!fl_fontsize) fl_font(0, 12);}
|
||||
|
||||
static const CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 };
|
||||
#if defined(__APPLE_COCOA__)
|
||||
static SInt32 MACsystemVersion = 0;
|
||||
#endif
|
||||
|
||||
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
|
||||
next = 0;
|
||||
|
@ -49,7 +47,7 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
|
|||
q_name = strdup(name);
|
||||
size = Size;
|
||||
minsize = maxsize = Size;
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion);
|
||||
|
||||
if(MACsystemVersion >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also!
|
||||
|
@ -146,7 +144,7 @@ else {
|
|||
ATSUSetTransientFontMatching (layout, true);
|
||||
# endif
|
||||
#endif//__LP64__
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -169,7 +167,7 @@ Fl_Font_Descriptor::~Fl_Font_Descriptor() {
|
|||
#endif
|
||||
*/
|
||||
if (this == fl_fontsize) fl_fontsize = 0;
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
if(MACsystemVersion >= 0x1050) CFRelease(fontref);
|
||||
#else
|
||||
/* ATSUDisposeTextLayout(layout);
|
||||
|
@ -219,11 +217,7 @@ Fl_Fontdesc* fl_fonts = built_in_table;
|
|||
|
||||
void fl_font(Fl_Font_Descriptor* s) {
|
||||
fl_fontsize = s;
|
||||
#if defined(__APPLE_QUARTZ__)
|
||||
// we will use fl_fontsize later to access the required style and layout
|
||||
#else
|
||||
# error : need to defined either Quartz or Quickdraw
|
||||
#endif
|
||||
}
|
||||
|
||||
static Fl_Font_Descriptor* find(Fl_Font fnum, Fl_Fontsize size) {
|
||||
|
@ -276,7 +270,7 @@ double fl_width(const UniChar* txt, int n) {
|
|||
if (!fl_fontsize)
|
||||
return 8*n; // user must select a font first!
|
||||
}
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
if(MACsystemVersion >= 0x1050) {
|
||||
CTFontRef fontref = fl_fontsize->fontref;
|
||||
CFStringRef str = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n * sizeof(UniChar), kCFStringEncodingUTF16, false);
|
||||
|
@ -316,7 +310,7 @@ else {
|
|||
int len = FixedToInt(bAfter);
|
||||
return len;
|
||||
#endif
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
}
|
||||
#endif
|
||||
return 0; // FIXME: I do not understand the shuffeling of the above ifdef's and why they are here!
|
||||
|
@ -345,7 +339,7 @@ void fl_text_extents(const UniChar* txt, int n, int &dx, int &dy, int &w, int &h
|
|||
h = 8.0;
|
||||
return;
|
||||
}
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
if(MACsystemVersion >= 0x1050) {
|
||||
CTFontRef fontref = fl_fontsize->fontref;
|
||||
CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n *sizeof(UniChar), kCFStringEncodingUTF16, false);
|
||||
|
@ -393,7 +387,7 @@ else {
|
|||
dy = -bbox.bottom;
|
||||
//printf("r: %d l: %d t: %d b: %d w: %d h: %d\n", bbox.right, bbox.left, bbox.top, bbox.bottom, w, h);
|
||||
#endif
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
@ -413,7 +407,6 @@ void Fl_Device::draw(const char* str, int n, int x, int y) {
|
|||
}
|
||||
|
||||
|
||||
#if defined(__APPLE_COCOA__)
|
||||
static CGColorRef flcolortocgcolor(Fl_Color i)
|
||||
{
|
||||
uchar r, g, b;
|
||||
|
@ -429,7 +422,6 @@ static CGColorRef flcolortocgcolor(Fl_Color i)
|
|||
}
|
||||
return CGColorCreate(cspace, components);
|
||||
}
|
||||
#endif
|
||||
|
||||
void fl_draw(const char *str, int n, float x, float y) {
|
||||
|
||||
|
@ -437,7 +429,7 @@ void fl_draw(const char *str, int n, float x, float y) {
|
|||
check_default_font();
|
||||
// convert to UTF-16 first
|
||||
UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
if(MACsystemVersion >= 0x1050) {
|
||||
CFStringRef keys[2];
|
||||
CFTypeRef values[2];
|
||||
|
@ -479,71 +471,25 @@ void fl_draw(const char *str, int n, float x, float y) {
|
|||
ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
|
||||
|
||||
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, n, n);
|
||||
#if defined(__APPLE_COCOA__)
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
err = ATSUDrawText(layout, kATSUFromTextBeginning, n, FloatToFixed(x), FloatToFixed(y));
|
||||
#if defined(__APPLE_COCOA__)
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Fl_Device::draw(int angle, const char *str, int n, int x, int y) {
|
||||
#if defined(__APPLE_COCOA__)
|
||||
CGContextSaveGState(fl_gc);
|
||||
CGContextTranslateCTM(fl_gc, x, y);
|
||||
CGContextRotateCTM(fl_gc, - angle*(M_PI/180) );
|
||||
fl_draw(str, n, (float)0., (float)0.);
|
||||
CGContextRestoreGState(fl_gc);
|
||||
#else
|
||||
OSStatus err;
|
||||
// convert to UTF-16 first
|
||||
UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
|
||||
|
||||
// avoid a crash if no font has been selected by user yet !
|
||||
check_default_font();
|
||||
// now collect our ATSU resources
|
||||
ATSUTextLayout layout = fl_fontsize->layout;
|
||||
|
||||
Fixed ang = IntToFixed(-angle);
|
||||
ByteCount iSize[] = {sizeof(Fixed), sizeof(CGContextRef)};
|
||||
ATSUAttributeTag iTag[] = {kATSULineRotationTag, kATSUCGContextTag};
|
||||
ATSUAttributeValuePtr aAttr[] = { &ang, &fl_gc};
|
||||
ATSUSetLayoutControls(layout, 2, iTag, iSize, aAttr);
|
||||
|
||||
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, n, n);
|
||||
err = ATSUDrawText(layout, kATSUFromTextBeginning, n, FloatToFixed(x), FloatToFixed(y));
|
||||
//restore layout baseline
|
||||
ang = IntToFixed(0);
|
||||
ATSUSetLayoutControls(layout, 2, iTag, iSize, aAttr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void fl_rtl_draw(const char* c, int n, int x, int y) {
|
||||
#if defined(__APPLE_COCOA__)
|
||||
fl_draw(c, n, x - fl_width(c, n), y); //to check;
|
||||
#else
|
||||
// I guess with ATSU the thing to do is force the layout mode to RTL and let ATSU draw the text...
|
||||
double offs = fl_width(c, n);
|
||||
OSStatus err;
|
||||
// convert to UTF-16 first
|
||||
UniChar *uniStr = mac_Utf8_to_Utf16(c, n, &n);
|
||||
// now collect our ATSU resources
|
||||
ATSUTextLayout layout = fl_fontsize->layout;
|
||||
// reverse the layout direction
|
||||
ATSUAttributeTag llo = kATSURightToLeftBaseDirection; // layout option
|
||||
ByteCount iSize[] = {sizeof(ATSUAttributeTag), sizeof(CGContextRef)};
|
||||
ATSUAttributeTag iTag[] = {kATSULineDirectionTag, kATSUCGContextTag};
|
||||
ATSUAttributeValuePtr aAttr[] = { &llo, &fl_gc};
|
||||
ATSUSetLayoutControls (layout, 2, iTag, iSize, aAttr );
|
||||
|
||||
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, n, n);
|
||||
err = ATSUDrawText(layout, kATSUFromTextBeginning, n, FloatToFixed(x-offs), FloatToFixed(y));
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -26,9 +26,7 @@
|
|||
//
|
||||
|
||||
#include <config.h>
|
||||
#ifdef __APPLE_COCOA__
|
||||
extern unsigned char *MACbitmapFromRectOfWindow(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
|
||||
#endif
|
||||
|
||||
//
|
||||
// 'fl_read_image()' - Read an image from the current window.
|
||||
|
@ -41,7 +39,6 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
|
|||
int w, // I - Width of area to read
|
||||
int h, // I - Height of area to read
|
||||
int alpha) { // I - Alpha value for image (0 for none)
|
||||
#if defined(__APPLE_COCOA__)
|
||||
Fl_Window *window = Fl_Window::current();
|
||||
while(window->window()) window = window->window();
|
||||
int delta;
|
||||
|
@ -56,103 +53,14 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
|
|||
int idx, idy; // Current X & Y in image
|
||||
uchar *pdst, *psrc;
|
||||
for (idy = 0, pdst = p; idy < h; idy ++) {
|
||||
for (idx = 0, psrc = base + idy * rowBytes; idx < w; idx ++, psrc += delta, pdst += d) {
|
||||
/*R*/ pdst[0] = psrc[0];
|
||||
/*G*/ pdst[1] = psrc[1];
|
||||
/*B*/ pdst[2] = psrc[2];
|
||||
}
|
||||
}
|
||||
delete base;
|
||||
#else
|
||||
Rect src, // Source rectangle
|
||||
dst; // Destination rectangle
|
||||
GWorldPtr osbuffer; // Temporary off-screen buffer for copy
|
||||
GrafPtr srcPort; // Source port
|
||||
RGBColor rgb; // RGB colors for copy mask...
|
||||
PixMapHandle pm; // Pixmap handle for off-screen buffer
|
||||
uchar *base, // Base address of off-screen buffer
|
||||
*psrc, // Pointer into off-screen buffer
|
||||
*pdst; // Pointer into pixel buffer
|
||||
int idx, idy; // Current X & Y in image
|
||||
int d; // Depth of image
|
||||
int rowBytes; // Number of bytes per row...
|
||||
|
||||
// Set the source and destination rectangles...
|
||||
src.top = y;
|
||||
src.left = x;
|
||||
src.bottom = y + h;
|
||||
src.right = x + w;
|
||||
|
||||
dst.top = 0;
|
||||
dst.left = 0;
|
||||
dst.bottom = h;
|
||||
dst.right = w;
|
||||
|
||||
// Get an off-screen buffer for copying the image...
|
||||
QDErr err = NewGWorld(&osbuffer, 0, &dst, 0L, 0L, 0);
|
||||
if (!osbuffer) return 0;
|
||||
if (err!=noErr) {
|
||||
DisposeGWorld(osbuffer);
|
||||
return 0;
|
||||
for (idx = 0, psrc = base + idy * rowBytes; idx < w; idx ++, psrc += delta, pdst += d) {
|
||||
pdst[0] = psrc[0]; // R
|
||||
pdst[1] = psrc[1]; // G
|
||||
pdst[2] = psrc[2]; // B
|
||||
}
|
||||
}
|
||||
|
||||
// Get the source port...
|
||||
GetPort(&srcPort);
|
||||
|
||||
// Set the RGB copy mask via the foreground/background colors...
|
||||
rgb.red = 0xffff;
|
||||
rgb.green = 0xffff;
|
||||
rgb.blue = 0xffff;
|
||||
RGBBackColor(&rgb);
|
||||
|
||||
rgb.red = 0x0000;
|
||||
rgb.green = 0x0000;
|
||||
rgb.blue = 0x0000;
|
||||
RGBForeColor(&rgb);
|
||||
|
||||
// Copy the screen image to the off-screen buffer...
|
||||
CopyBits(GetPortBitMapForCopyBits(srcPort),
|
||||
GetPortBitMapForCopyBits(osbuffer), &src, &dst, srcCopy, 0L);
|
||||
|
||||
// Allocate the image data array as needed...
|
||||
d = alpha ? 4 : 3;
|
||||
|
||||
if (!p) p = new uchar[w * h * d];
|
||||
|
||||
// Initialize the default colors/alpha in the whole image...
|
||||
memset(p, alpha, w * h * d);
|
||||
|
||||
// Set the correct port for the off-screen buffer and lock the buffer
|
||||
SetGWorld(osbuffer, 0);
|
||||
|
||||
pm = GetGWorldPixMap(osbuffer);
|
||||
LockPixels(pm);
|
||||
|
||||
base = (uchar *)GetPixBaseAddr(pm);
|
||||
rowBytes = (*pm)->rowBytes & 0x3fff;
|
||||
|
||||
// Copy the image from the off-screen buffer to the memory buffer.
|
||||
for (idy = 0, pdst = p; idy < h; idy ++)
|
||||
#ifdef __i386__
|
||||
for (idx = 0, psrc = base + idy * rowBytes; idx < w; idx ++, psrc += 4, pdst += d) {
|
||||
pdst[0] = psrc[2];
|
||||
pdst[1] = psrc[1];
|
||||
pdst[2] = psrc[0];
|
||||
}
|
||||
#else
|
||||
for (idx = 0, psrc = base + idy * rowBytes + 1; idx < w; idx ++, psrc += 4, pdst += d) {
|
||||
pdst[0] = psrc[0];
|
||||
pdst[1] = psrc[1];
|
||||
pdst[2] = psrc[2];
|
||||
}
|
||||
#endif // __i386__
|
||||
// Unlock and delete the off-screen buffer, then return...
|
||||
UnlockPixels(pm);
|
||||
DisposeGWorld(osbuffer);
|
||||
|
||||
SetPort(srcPort);
|
||||
#endif
|
||||
return p;
|
||||
delete base;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
|
193
src/fl_rect.cxx
193
src/fl_rect.cxx
|
@ -43,10 +43,8 @@
|
|||
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
extern float fl_quartz_line_width_;
|
||||
#ifdef __APPLE_COCOA__
|
||||
#define USINGQUARTZPRINTER (Fl_Device::current()->type() == quartz_printer)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void Fl_Device::rect(int x, int y, int w, int h) {
|
||||
|
||||
|
@ -60,18 +58,10 @@ void Fl_Device::rect(int x, int y, int w, int h) {
|
|||
LineTo(fl_gc, x, y+h-1);
|
||||
LineTo(fl_gc, x, y);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGRect rect = CGRectMake(x, y, w-1, h-1);
|
||||
CGContextStrokeRect(fl_gc, rect);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -87,18 +77,10 @@ void Fl_Device::rectf(int x, int y, int w, int h) {
|
|||
rect.right = x + w; rect.bottom = y + h;
|
||||
FillRect(fl_gc, &rect, fl_brush());
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGRect rect = CGRectMake(x, y, w-1, h-1);
|
||||
CGContextFillRect(fl_gc, rect);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -110,19 +92,11 @@ void Fl_Device::xyline(int x, int y, int x1) {
|
|||
#elif defined(WIN32)
|
||||
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -141,20 +115,12 @@ void Fl_Device::xyline(int x, int y, int x1, int y2) {
|
|||
LineTo(fl_gc, x1, y);
|
||||
LineTo(fl_gc, x1, y2);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y2);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
#error unsupported platform
|
||||
#endif
|
||||
|
@ -175,21 +141,13 @@ void Fl_Device::xyline(int x, int y, int x1, int y2, int x3) {
|
|||
LineTo(fl_gc, x1, y2);
|
||||
LineTo(fl_gc, x3, y2);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y2);
|
||||
CGContextAddLineToPoint(fl_gc, x3, y2);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -203,19 +161,11 @@ void Fl_Device::yxline(int x, int y, int y1) {
|
|||
else y1++;
|
||||
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x, y1);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -234,20 +184,12 @@ void Fl_Device::yxline(int x, int y, int y1, int x2) {
|
|||
LineTo(fl_gc, x, y1);
|
||||
LineTo(fl_gc, x2, y1);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y1);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -268,21 +210,13 @@ void Fl_Device::yxline(int x, int y, int y1, int x2, int y3) {
|
|||
LineTo(fl_gc, x2, y1);
|
||||
LineTo(fl_gc, x2, y3);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y3);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -298,19 +232,11 @@ void Fl_Device::line(int x, int y, int x1, int y1) {
|
|||
// functions will not draw the last point ("it's a feature!"...)
|
||||
SetPixel(fl_gc, x1, y1, fl_RGB());
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y1);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -331,20 +257,12 @@ void Fl_Device::line(int x, int y, int x1, int y1, int x2, int y2) {
|
|||
// functions will not draw the last point ("it's a feature!"...)
|
||||
SetPixel(fl_gc, x2, y2, fl_RGB());
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y2);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -364,17 +282,13 @@ void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2) {
|
|||
LineTo(fl_gc, x2, y2);
|
||||
LineTo(fl_gc, x, y);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y2);
|
||||
CGContextClosePath(fl_gc);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -396,18 +310,14 @@ void Fl_Device::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y
|
|||
LineTo(fl_gc, x3, y3);
|
||||
LineTo(fl_gc, x, y);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y2);
|
||||
CGContextAddLineToPoint(fl_gc, x3, y3);
|
||||
CGContextClosePath(fl_gc);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -426,17 +336,13 @@ void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2) {
|
|||
SelectObject(fl_gc, fl_brush());
|
||||
Polygon(fl_gc, p, 3);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y2);
|
||||
CGContextClosePath(fl_gc);
|
||||
CGContextFillPath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -456,18 +362,14 @@ void Fl_Device::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, in
|
|||
SelectObject(fl_gc, fl_brush());
|
||||
Polygon(fl_gc, p, 4);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x, y);
|
||||
CGContextAddLineToPoint(fl_gc, x1, y1);
|
||||
CGContextAddLineToPoint(fl_gc, x2, y2);
|
||||
CGContextAddLineToPoint(fl_gc, x3, y3);
|
||||
CGContextClosePath(fl_gc);
|
||||
CGContextFillPath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -479,19 +381,11 @@ void Fl_Device::point(int x, int y) {
|
|||
#elif defined(WIN32)
|
||||
SetPixel(fl_gc, x, y, fl_RGB());
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, x-.5, y); // Quartz needs a line that is one pixel long, or it will not draw anything
|
||||
CGContextAddLineToPoint(fl_gc, x+.5, y);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -527,41 +421,16 @@ void fl_restore_clip() {
|
|||
SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if ( fl_window ) { // clipping for a true window
|
||||
#ifdef __APPLE_COCOA__
|
||||
Fl_X::q_clear_clipping();
|
||||
Fl_X::q_fill_context();//flip coords if bitmap context
|
||||
//apply program clip
|
||||
if(r) {
|
||||
CGContextClipToRects(fl_gc, r->rects, r->count);
|
||||
}
|
||||
#else
|
||||
extern Fl_Region fl_window_region;
|
||||
GrafPtr port = GetWindowPort( fl_window );
|
||||
if ( port ) {
|
||||
RgnHandle portClip = NewRgn();
|
||||
CopyRgn( fl_window_region, portClip ); // changed
|
||||
if ( r )
|
||||
SectRgn( portClip, r, portClip );
|
||||
Rect portRect; GetPortBounds(port, &portRect);
|
||||
Fl_X::q_clear_clipping();
|
||||
ClipCGContextToRegion(fl_gc, &portRect, portClip );
|
||||
Fl_X::q_fill_context();
|
||||
DisposeRgn( portClip );
|
||||
}
|
||||
#endif
|
||||
} else if (fl_gc) { // clipping for an offscreen drawing world (CGBitmap)
|
||||
Fl_X::q_clear_clipping();
|
||||
if (r) {
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextClipToRects(fl_gc, r->rects, r->count);
|
||||
#else
|
||||
Rect portRect;
|
||||
portRect.top = 0;
|
||||
portRect.left = 0;
|
||||
portRect.bottom = CGBitmapContextGetHeight(fl_gc);
|
||||
portRect.right = CGBitmapContextGetWidth(fl_gc);
|
||||
ClipCGContextToRegion(fl_gc, &portRect, r);
|
||||
#endif
|
||||
}
|
||||
Fl_X::q_fill_context();
|
||||
}
|
||||
|
@ -595,12 +464,8 @@ void Fl_Device::push_clip(int x, int y, int w, int h) {
|
|||
#elif defined(WIN32)
|
||||
CombineRgn(r,r,current,RGN_AND);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
XDestroyRegion(r);
|
||||
r = MacRectRegionIntersect(current, x,y,w,h);
|
||||
#else
|
||||
SectRgn(r, current, r);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -611,12 +476,7 @@ void Fl_Device::push_clip(int x, int y, int w, int h) {
|
|||
#elif defined(WIN32)
|
||||
r = CreateRectRgn(0,0,0,0);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
r = XRectangleRegion(0,0,0,0);
|
||||
#else
|
||||
r = NewRgn();
|
||||
SetEmptyRgn(r);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -661,18 +521,12 @@ int Fl_Device::not_clipped(int x, int y, int w, int h) {
|
|||
return RectInRegion(r,&rect);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if (!r) return 1;
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
|
||||
for(int i = 0; i < r->count; i++) {
|
||||
CGRect test = CGRectIntersection(r->rects[i], arg);
|
||||
if( ! CGRectIsEmpty(test)) return 1;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
Rect rect;
|
||||
rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
|
||||
return RectInRgn(&rect, r);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -732,37 +586,22 @@ int Fl_Device::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int&
|
|||
DeleteObject(rr);
|
||||
return ret;
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
|
||||
CGRect u = CGRectMake(0,0,0,0);
|
||||
CGRect test;
|
||||
for(int i = 0; i < r->count; i++) {
|
||||
test = CGRectIntersection(r->rects[i], arg);
|
||||
if( ! CGRectIsEmpty(test) ) {
|
||||
if(CGRectIsEmpty(u)) u = test;
|
||||
else u = CGRectUnion(u, test);
|
||||
}
|
||||
}
|
||||
X = u.origin.x;
|
||||
Y = u.origin.y;
|
||||
W = u.size.width + 1;
|
||||
H = u.size.height + 1;
|
||||
if(CGRectIsEmpty(u)) W = H = 0;
|
||||
return ! CGRectEqualToRect(arg, u);
|
||||
#else
|
||||
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;
|
||||
#endif
|
||||
CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
|
||||
CGRect u = CGRectMake(0,0,0,0);
|
||||
CGRect test;
|
||||
for(int i = 0; i < r->count; i++) {
|
||||
test = CGRectIntersection(r->rects[i], arg);
|
||||
if( ! CGRectIsEmpty(test) ) {
|
||||
if(CGRectIsEmpty(u)) u = test;
|
||||
else u = CGRectUnion(u, test);
|
||||
}
|
||||
}
|
||||
X = u.origin.x;
|
||||
Y = u.origin.y;
|
||||
W = u.size.width + 1;
|
||||
H = u.size.height + 1;
|
||||
if(CGRectIsEmpty(u)) W = H = 0;
|
||||
return ! CGRectEqualToRect(arg, u);
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
|
|
@ -151,8 +151,6 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
|
|||
BitBlt(fl_gc, dest_x, dest_y, src_w, src_h, fl_gc, src_x, src_y,SRCCOPY);
|
||||
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
|
||||
#if defined(__APPLE_COCOA__)
|
||||
extern CGImageRef MAC_CGImageFromRectOfWindow(Fl_Window*, int x, int y, int w, int h);
|
||||
CGImageRef img = MAC_CGImageFromRectOfWindow(Fl_Window::current(), src_x, src_y, src_w, src_h);
|
||||
CGRect rect = { { dest_x, dest_y }, { src_w, src_h } };
|
||||
|
@ -160,19 +158,6 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
|
|||
CGContextDrawImage(fl_gc, rect, img);
|
||||
Fl_X::q_end_image();
|
||||
CFRelease(img);
|
||||
#else
|
||||
// warning: there does not seem to be an equivalent to this function in Quartz
|
||||
// ScrollWindowRect is a QuickDraw function and won't work here.
|
||||
// Since on OS X all windows are fully double buffered, we need not
|
||||
// worry about offscreen or obscured areas
|
||||
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);
|
||||
#endif
|
||||
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
|
|
@ -60,7 +60,7 @@ static int fl_free_font = FL_FREE_FONT;
|
|||
|
||||
Fl_Font Fl::set_fonts(const char* xstarname) {
|
||||
#pragma unused ( xstarname )
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
static SInt32 MACsystemVersion = 0;
|
||||
if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion);
|
||||
if(MACsystemVersion >= 0x1050) {
|
||||
|
@ -91,26 +91,6 @@ if(MACsystemVersion >= 0x1050) {
|
|||
else {
|
||||
#endif
|
||||
#if ! __LP64__
|
||||
#if defined(OLD__APPLE_QUARTZ__)
|
||||
ATSFontIterator it;
|
||||
ATSFontIteratorCreate(kATSFontContextGlobal, 0L, 0L, kATSOptionFlagsUnRestrictedScope, &it);
|
||||
for (;;) {
|
||||
ATSFontRef font;
|
||||
CFStringRef fname = 0;
|
||||
OSStatus err = ATSFontIteratorNext(it, &font);
|
||||
if (err!=noErr) break;
|
||||
ATSFontGetName(font, kATSOptionFlagsDefault, &fname);
|
||||
char buf[1024];
|
||||
CFStringGetCString(fname, buf, 1024, kCFStringEncodingUTF8);
|
||||
int i;
|
||||
for (i=0; i<FL_FREE_FONT; i++) // skip if one of our built-in fonts
|
||||
if (!strcmp(Fl::get_font_name((Fl_Font)i),buf)) break;
|
||||
if ( i < FL_FREE_FONT ) continue;
|
||||
Fl::set_font((Fl_Font)(fl_free_font++), strdup((char*)buf));
|
||||
}
|
||||
ATSFontIteratorRelease(&it);
|
||||
return (Fl_Font)fl_free_font;
|
||||
#else
|
||||
ItemCount oFontCount, oCountAgain;
|
||||
ATSUFontID *oFontIDs;
|
||||
// How many fonts?
|
||||
|
@ -145,9 +125,8 @@ else {
|
|||
}
|
||||
free(oFontIDs);
|
||||
return (Fl_Font)fl_free_font;
|
||||
#endif //OLD__APPLE_QUARTZ__
|
||||
#endif //__LP64__
|
||||
#if defined(__APPLE_COCOA__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
}
|
||||
#endif
|
||||
return 0; // FIXME: I do not understand the shuffeling of the above ifdef's and why they are here!
|
||||
|
|
|
@ -207,21 +207,13 @@ void Fl_Device::end_points() {
|
|||
#elif defined(WIN32)
|
||||
for (int i=0; i<n; i++) SetPixel(fl_gc, p[i].x, p[i].y, fl_RGB());
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
for (int i=0; i<n; i++) {
|
||||
CGContextMoveToPoint(fl_gc, p[i].x, p[i].y);
|
||||
CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
|
||||
CGContextStrokePath(fl_gc);
|
||||
}
|
||||
#ifdef __APPLE_COCOA__
|
||||
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
|
||||
#else
|
||||
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -238,16 +230,12 @@ void Fl_Device::end_line() {
|
|||
if (n>1) Polyline(fl_gc, p, n);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if (n<=1) return;
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
|
||||
for (int i=1; i<n; i++)
|
||||
CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
|
||||
CGContextStrokePath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -278,17 +266,13 @@ void Fl_Device::end_polygon() {
|
|||
}
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if (n<=1) return;
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
|
||||
for (int i=1; i<n; i++)
|
||||
CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
|
||||
CGContextClosePath(fl_gc);
|
||||
CGContextFillPath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -336,17 +320,13 @@ void Fl_Device::end_complex_polygon() {
|
|||
}
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if (n<=1) return;
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
|
||||
for (int i=1; i<n; i++)
|
||||
CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
|
||||
CGContextClosePath(fl_gc);
|
||||
CGContextFillPath(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -378,14 +358,10 @@ void Fl_Device::circle(double x, double y,double r) {
|
|||
#elif defined(__APPLE_QUARTZ__)
|
||||
// Quartz warning : circle won't scale to current matrix!
|
||||
//last argument must be 0 (counterclockwise) or it draws nothing under __LP64__ !!!!
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, true);
|
||||
#endif
|
||||
CGContextAddArc(fl_gc, xt, yt, (w+h)*0.25f, 0, 2.0f*M_PI, 0);
|
||||
(what == POLYGON ? CGContextFillPath : CGContextStrokePath)(fl_gc);
|
||||
#ifdef __APPLE_COCOA__
|
||||
CGContextSetShouldAntialias(fl_gc, false);
|
||||
#endif
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
|
|
@ -110,7 +110,7 @@ void gl_font(int fontid, int size) {
|
|||
wglUseFontBitmaps(fl_gc, base, count, fl_fontsize->listbase+base);
|
||||
SelectObject(fl_gc, oldFid);
|
||||
# elif defined(__APPLE_QUARTZ__)
|
||||
#if ! defined(__APPLE_COCOA__)
|
||||
/* FIXME: no OpenGL Font Selection in Cocoa!
|
||||
//AGL is not supported for use in 64-bit applications:
|
||||
//http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/Carbon64BitGuide/OtherAPIChanges/OtherAPIChanges.html
|
||||
short font, face, size;
|
||||
|
@ -123,7 +123,7 @@ void gl_font(int fontid, int size) {
|
|||
fl_fontsize->listbase = glGenLists(256);
|
||||
aglUseFont(aglGetCurrentContext(), font, face,
|
||||
size, 0, 256, fl_fontsize->listbase);
|
||||
#endif
|
||||
*/
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
|
@ -132,7 +132,7 @@ void gl_font(int fontid, int size) {
|
|||
|
||||
}
|
||||
gl_fontsize = fl_fontsize;
|
||||
#if !( defined(__APPLE__) && defined(__APPLE_COCOA__) )
|
||||
#ifndef __APPLE_COCOA__
|
||||
glListBase(fl_fontsize->listbase);
|
||||
#endif
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ static void get_list(int r) {
|
|||
wglUseFontBitmapsW(fl_gc, ii, ii + 0x03ff, gl_fontsize->listbase+ii);
|
||||
SelectObject(fl_gc, oldFid);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
// FIXME
|
||||
// FIXME:
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
|
@ -210,20 +210,13 @@ void gl_remove_displaylist_fonts()
|
|||
Draws an array of n characters of the string in the current font
|
||||
at the current position.
|
||||
*/
|
||||
#if defined(__APPLE__) && defined(__APPLE_COCOA__)
|
||||
#ifdef __APPLE__
|
||||
static void gl_draw_cocoa(const char* str, int n);
|
||||
#endif
|
||||
|
||||
void gl_draw(const char* str, int n) {
|
||||
#ifdef __APPLE__
|
||||
|
||||
#if defined(__APPLE_COCOA__)
|
||||
gl_draw_cocoa(str, n);
|
||||
#else
|
||||
// Should be converting the text here, as for other platforms???
|
||||
glCallLists(n, GL_UNSIGNED_BYTE, str);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
gl_draw_cocoa(str, n);
|
||||
#else
|
||||
static xchar *buf = NULL;
|
||||
static int l = 0;
|
||||
|
@ -367,7 +360,7 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) {
|
|||
glDrawPixels(w,h,d<4?GL_RGB:GL_RGBA,GL_UNSIGNED_BYTE,(const ulong*)b);
|
||||
}
|
||||
|
||||
#if defined(__APPLE__) && defined(__APPLE_COCOA__)
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <FL/glu.h>
|
||||
|
||||
|
|
|
@ -109,22 +109,7 @@ XRectangle screens[16];
|
|||
|
||||
extern int MACscreen_init(XRectangle screens[]);
|
||||
static void screen_init() {
|
||||
#ifdef __APPLE_COCOA__
|
||||
num_screens = MACscreen_init(screens);
|
||||
#else
|
||||
GDHandle gd;
|
||||
|
||||
for (gd = GetDeviceList(), num_screens = 0; gd; gd = GetNextDevice(gd)) {
|
||||
GDPtr gp = *gd;
|
||||
screens[num_screens].x = gp->gdRect.left;
|
||||
screens[num_screens].y = gp->gdRect.top;
|
||||
screens[num_screens].width = gp->gdRect.right - gp->gdRect.left;
|
||||
screens[num_screens].height = gp->gdRect.bottom - gp->gdRect.top;
|
||||
|
||||
num_screens ++;
|
||||
if (num_screens >= 16) break;
|
||||
}
|
||||
#endif
|
||||
num_screens = MACscreen_init(screens);
|
||||
}
|
||||
#elif HAVE_XINERAMA
|
||||
# include <X11/extensions/Xinerama.h>
|
||||
|
|
Loading…
Reference in New Issue