diff options
| -rw-r--r-- | FL/Fl_Printer.H | 6 | ||||
| -rw-r--r-- | FL/mac.H | 84 | ||||
| -rw-r--r-- | ide/Xcode3/FLTK.xcodeproj/project.pbxproj | 34 | ||||
| -rw-r--r-- | ide/Xcode3/fltk.pch | 3 | ||||
| -rw-r--r-- | makeinclude.in | 2 | ||||
| -rw-r--r-- | src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/Fl.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 5 | ||||
| -rw-r--r-- | src/Makefile | 2 | ||||
| -rw-r--r-- | test/demo.cxx | 2 |
10 files changed, 70 insertions, 71 deletions
diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H index 59d36ce2c..00f85856a 100644 --- a/FL/Fl_Printer.H +++ b/FL/Fl_Printer.H @@ -58,9 +58,9 @@ private: float scale_x; float scale_y; float angle; // rotation angle in radians - PMPrintSession printSession; - PMPageFormat pageFormat; - PMPrintSettings printSettings; + Fl_PMPrintSession printSession; + Fl_PMPageFormat pageFormat; + Fl_PMPrintSettings printSettings; #elif defined(WIN32) int abortPrint; PRINTDLG pd; @@ -34,8 +34,28 @@ # error "Never use <FL/mac.H> directly; include <FL/x.H> instead." #endif // !Fl_X_H +typedef void* Window; // this is really a pointer to the subclass FLWindow of NSWindow +typedef void* Fl_Offscreen; // this is really a CGContextRef +typedef void* Fl_Bitmask; // this is really a CGImageRef + +#ifndef FL_LIBRARY // this part is used when compiling an application program + +typedef void* Fl_Region; +typedef void* Fl_CGContextRef; +typedef void* Fl_PMPrintSettings; +typedef void* Fl_PMPageFormat; +typedef void* Fl_PMPrintSession; + +#else // this part must be compiled when building the FLTK libraries + // Standard MacOS Carbon API includes... #include <Carbon/Carbon.h> +#undef check // because of Fl::check() + +typedef CGContextRef Fl_CGContextRef; +typedef PMPrintSettings Fl_PMPrintSettings; +typedef PMPageFormat Fl_PMPageFormat; +typedef PMPrintSession Fl_PMPrintSession; #ifndef MAC_OS_X_VERSION_10_3 #define MAC_OS_X_VERSION_10_3 1030 @@ -53,6 +73,16 @@ #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_3 #endif +typedef struct flCocoaRegion { + int count; + CGRect *rects; +} *Fl_Region; // a region is the union of a series of rectangles + +# include "Fl_Window.H" + +// Some random X equivalents +struct XPoint { int x, y; }; +struct XRectangle {int x, y, width, height;}; #ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h #if defined(__LP64__) && __LP64__ typedef double CGFloat; @@ -61,21 +91,7 @@ typedef float CGFloat; #endif #endif // CGFLOAT_DEFINED - -// Now make some fixes to the headers... -#undef check // Dunno where this comes from... - -// Some random X equivalents -struct XPoint { int x, y; }; -struct XRectangle {int x, y, width, height;}; - -typedef void *Window; // this is really a pter to the subclass FLWindow of NSWindow -typedef struct flCocoaRegion { - int count; - CGRect *rects; -} *Fl_Region; // a region is the union of a series of rectangles extern CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h); - inline Fl_Region XRectangleRegion(int x, int y, int w, int h) { Fl_Region R = (Fl_Region)malloc(sizeof(*R)); R->count = 1; @@ -85,18 +101,12 @@ inline Fl_Region XRectangleRegion(int x, int y, int w, int h) { } inline void XDestroyRegion(Fl_Region r) { if(r) { - free(r->rects); - free(r); - } + free(r->rects); + free(r); + } } -extern void *fl_default_cursor; extern void *fl_system_menu; -typedef CGContextRef Fl_Offscreen; -typedef CGImageRef Fl_Bitmask; - -void fl_clip_region(Fl_Region); - -# include "Fl_Window.H" +extern void *fl_default_cursor; // This object contains all mac-specific stuff about a window: // WARNING: this object is highly subject to change! @@ -104,7 +114,7 @@ class Fl_X { public: Window xid; // pointer to the Cocoa window object (FLWindow*) - Fl_Offscreen other_xid; // pointer for offscreen bitmaps (doublebuffer) + Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window) Fl_Window *w; // FLTK window for Fl_Region region; Fl_Region subRegion; // region for this specific subwindow @@ -147,36 +157,32 @@ private: static void relink(Fl_Window*, Fl_Window*); }; -inline Window fl_xid(const Fl_Window*w) -{ - return Fl_X::i(w)->xid; -} - extern struct Fl_XMap { RGBColor rgb; ulong pen; } *fl_current_xmap; - -extern FL_EXPORT void *fl_display; extern FL_EXPORT Window fl_window; -extern FL_EXPORT CGContextRef fl_gc; + +#endif // FL_LIBRARY + +extern FL_EXPORT Fl_CGContextRef fl_gc; extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar; +extern Window fl_xid(const Fl_Window*); +void fl_clip_region(Fl_Region); +extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data); +extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data); +extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm); extern Fl_Offscreen fl_create_offscreen(int w, int h); extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy); extern void fl_delete_offscreen(Fl_Offscreen gWorld); extern void fl_begin_offscreen(Fl_Offscreen gWorld); extern void fl_end_offscreen(); - -extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data); -extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data); -extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm); - +extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b); extern void fl_open_display(); -extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b); #endif // FL_DOXYGEN /** \defgroup group_macosx Mac OS X-specific functions diff --git a/ide/Xcode3/FLTK.xcodeproj/project.pbxproj b/ide/Xcode3/FLTK.xcodeproj/project.pbxproj index 963216b53..b5705bb3f 100644 --- a/ide/Xcode3/FLTK.xcodeproj/project.pbxproj +++ b/ide/Xcode3/FLTK.xcodeproj/project.pbxproj @@ -10999,6 +10999,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = fltk.pch; + GCC_PREPROCESSOR_DEFINITIONS = FL_LIBRARY; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -11873,8 +11874,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1"; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -12065,8 +12064,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1"; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -12561,8 +12558,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -12594,6 +12589,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = fltk.pch; + GCC_PREPROCESSOR_DEFINITIONS = FL_LIBRARY; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -12660,8 +12656,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -12975,8 +12969,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1"; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -13047,6 +13039,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = fltk.pch; + GCC_PREPROCESSOR_DEFINITIONS = FL_LIBRARY; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -13108,8 +13101,6 @@ FRAMEWORK_VERSION = A; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -13447,8 +13438,6 @@ FRAMEWORK_VERSION = A; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -13791,8 +13780,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1"; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -13913,8 +13900,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1"; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -14074,6 +14059,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = fltk.pch; + GCC_PREPROCESSOR_DEFINITIONS = FL_LIBRARY; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -14290,12 +14276,12 @@ AC3226B9FE17327A0476ACA0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + ARCHS = "$(NATIVE_ARCH_ACTUAL)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; }; @@ -14770,6 +14756,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = fltk.pch; + GCC_PREPROCESSOR_DEFINITIONS = FL_LIBRARY; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -14801,8 +14788,6 @@ FRAMEWORK_VERSION = A; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, @@ -15639,8 +15624,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; GCC_PREPROCESSOR_DEFINITIONS = "USING_XCODE=1"; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -15769,6 +15752,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = fltk.pch; + GCC_PREPROCESSOR_DEFINITIONS = FL_LIBRARY; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, @@ -15925,8 +15909,6 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = fltk.pch; HEADER_SEARCH_PATHS = ( ../../ide/XCode3/, ../../, diff --git a/ide/Xcode3/fltk.pch b/ide/Xcode3/fltk.pch index b02c91181..83be8d454 100644 --- a/ide/Xcode3/fltk.pch +++ b/ide/Xcode3/fltk.pch @@ -6,3 +6,6 @@ #import <Cocoa/Cocoa.h> #endif +#ifdef FL_LIBRARY +#include <Carbon/Carbon.h> +#endif diff --git a/makeinclude.in b/makeinclude.in index b023e1481..535062347 100644 --- a/makeinclude.in +++ b/makeinclude.in @@ -60,7 +60,7 @@ RC = @RC@ ARCHFLAGS = @ARCHFLAGS@ OPTIM = @OPTIM@ CFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CFLAGS@ -CXXFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CXXFLAGS@ +CXXFLAGS = $(OPTIM) @LARGEFILE@ @PTHREAD_FLAGS@ @CPPFLAGS@ @CXXFLAGS@ $(FLTKFLAGS) # program to make the archive: LIBNAME = @LIBNAME@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b35ac57a..b613766a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -194,6 +194,7 @@ set(CFILES ) if(APPLE) + add_definitions(-DFL_LIBRARY) set(MMFILES Fl_cocoa.mm Fl_Quartz_Printer.mm diff --git a/src/Fl.cxx b/src/Fl.cxx index 53d758f1d..6e0780f66 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -667,7 +667,7 @@ Fl_Window* Fl::next_window(const Fl_Window* window) { */ void Fl::first_window(Fl_Window* window) { if (!window || !window->shown()) return; - fl_find(fl_xid(window)); + fl_find( Fl_X::i(window)->xid ); } /** diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index cd191a5a0..2ad315037 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3266,6 +3266,11 @@ CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h) { return CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0); } +Window fl_xid(const Fl_Window* w) +{ + return Fl_X::i(w)->xid; +} + #endif // __APPLE__ // diff --git a/src/Makefile b/src/Makefile index ff26b0315..dc56621d7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -217,7 +217,7 @@ UTF8CFILES = \ xutf8/utf8Wrap.c ################################################################ - +FLTKFLAGS = -DFL_LIBRARY include ../makeinclude MMFILES = $(shell if test $(USEMMFILES) = Yes; then echo $(OBJCPPFILES); fi) diff --git a/test/demo.cxx b/test/demo.cxx index 9adc25d19..f52951b2b 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -136,6 +136,8 @@ const char *default_menu[] = { # define chdir _chdir # define putenv _putenv # endif // !__WATCOMC__ +#elif defined USING_XCODE +#include <Carbon/Carbon.h> #else # include <unistd.h> #endif |
