Created pseudo code for all FL_PORTED section so that FLTK compiles and links (Xcode, hello, other C flags: -D FL_PORTING -U __APPLE__ -U __APPLE_QUARTZ__)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@10993 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2016-01-04 23:09:32 +00:00
parent eb1abad3ca
commit b1520373ae
55 changed files with 916 additions and 54 deletions

View File

@ -37,6 +37,10 @@
# undef check
# endif
# ifdef BSD
# undef BSD
# endif
class Fl_Widget;
class Fl_Window;
@ -55,6 +59,7 @@ struct Fl_Label;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: define a type for FL_SOCKET"
# define FL_SOCKET int // default if not ported
# undef check
#else
# define FL_SOCKET int
#endif

View File

@ -528,6 +528,8 @@ public:
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: define a native graphics driver Fl_xxx_Graphics_Driver"
class FL_EXPORT Fl_XXX_Graphics_Driver : public Fl_Graphics_Driver {
};
#else // X11

View File

@ -210,6 +210,8 @@ public:
void *mask_; // for internal use (mask bitmap)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: define variables to hold an RGB image and a mask for Fl_RGB_Image"
unsigned id_; // don't use
unsigned mask_; // don't use
#else
unsigned id_; // for internal use
unsigned mask_; // for internal use (mask bitmap)

View File

@ -22,7 +22,7 @@
# include "Fl_Widget.H"
# include "Fl_Image.H"
# if defined(__APPLE__) && defined(check)
# if (defined(__APPLE__) || defined(FL_PORTING)) && defined(check)
# undef check
# endif

View File

@ -71,6 +71,8 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
void *mask_; // for internal use (mask bitmap)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: define member variables to store an RGB image and a mask for Fl_Pixmap"
void *id_; // don't use
void *mask_; // don't use
#else
unsigned id_; // for internal use
unsigned mask_; // for internal use (mask bitmap)

View File

@ -98,6 +98,11 @@ public:
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: define your own Fl_xxx_Printer class"
class Fl_XXX_Printer : public Fl_Paged_Device {
friend class Fl_Printer;
protected:
Fl_XXX_Printer(void) { }
};
#else
@ -233,6 +238,7 @@ private:
Fl_System_Printer *printer;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your own Fl_xxx_Printer here"
Fl_XXX_Printer *printer;
#else
Fl_PostScript_Printer *printer;
#endif

View File

@ -83,7 +83,7 @@ struct dirent {char d_name[1];};
# elif defined(FL_PORTING)
# pragma message "FL_PORTING: insert the equivalent to dirent.h on your system"
struct dirent {char d_name[1];}; // default if not ported
# include <dirent.h>
# else
/*
* WARNING: on some systems (very few nowadays?) <dirent.h> may not exist.

165
FL/porting.H Normal file
View File

@ -0,0 +1,165 @@
//
// "$Id$"
//
// Mac header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2015 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
// Do not directly include this file, instead use <FL/x.H>.
// This file can be used as a template when porting FLTK to a new platform
#if !defined(Fl_X_H)
# error "Never use <FL/porting.H> directly; include <FL/x.H> instead."
#endif // !Fl_X_H
#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program
# include <FL/Fl_Widget.H>
typedef void *Fl_Region;
typedef void *Fl_Offscreen;
#else // this part must be compiled when building the FLTK libraries
typedef void *Fl_Region;
typedef void *Fl_Offscreen;
# include "Fl_Window.H"
# include "../src/Fl_Font.H"
// Some random X equivalents
struct XPoint { int x, y; };
struct XRectangle {int x, y, width, height;};
typedef void *Window;
//typedef float CGFloat;
inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
// write code here
return 0L;
}
inline void XDestroyRegion(Fl_Region r) {
// write code here
}
extern void *fl_default_cursor;
// This object contains all platform-specific stuff about a window:
// WARNING: this object is highly subject to change!
class Fl_X {
public:
Window xid; // pointer to the native window object (FLWindow*)
Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window)
Fl_Window *w; // FLTK window for
Fl_Region region;
//#if FLTK_ABI_VERSION < 10304
// Fl_Region subRegion; // for ABI compatibility, recycled to replace subRect_
//#endif
Fl_X *next; // chain of mapped windows
//#if FLTK_ABI_VERSION < 10304
// Fl_X *xidChildren; // useless with true subwindows, recycled to replace mapped_to_retina_
// Fl_X *xidNext; // useless with true subwindows
//#endif
int wait_for_expose;
// NSCursor *cursor;
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&);
static Fl_X* make(Fl_Window*);
void flush();
//#if FLTK_ABI_VERSION >= 10304
// CGRect* subRect() { return subRect_; } // getter
// void subRect(CGRect *r) { subRect_ = r; } // setter
//#else
// CGRect* subRect() { return (CGRect*)subRegion; } // getter
// void subRect(CGRect *r) { subRegion = (Fl_Region)r; } // setter
//#endif
// bool mapped_to_retina(); // is window mapped to retina display?
// void mapped_to_retina(bool); // sets whether window is mapped to retina display
// bool changed_resolution(); // did window just moved to display with another resolution?
// void changed_resolution(bool);// sets whether window just moved to display with another resolution
// bool in_windowDidResize(); // is window performing windowDidResize?
// void in_windowDidResize(bool); // sets whether window is performing windowDidResize
// // Quartz additions:
// CGContextRef gc; // graphics context (NULL when using QD)
// static void q_fill_context(); // fill a Quartz context with current FLTK state
// static void q_clear_clipping(); // remove all clipping from a Quartz context
// static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
// static void q_begin_image(CGRect&, int x, int y, int w, int h);
// static void q_end_image();
// // Cocoa additions
// static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode
// static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window);
// static void GLcontext_update(NSOpenGLContext*);
// static void GLcontext_flushbuffer(NSOpenGLContext*);
// static void GLcontext_release(NSOpenGLContext*);
// static void GLcontext_makecurrent(NSOpenGLContext*);
// static void GL_cleardrawable(void);
// void destroy(void);
// void map(void);
// void unmap(void);
// void collapse(void);
// WindowRef window_ref(void); // useless with cocoa GL windows
// void set_key_window(void);
// // OS X doesn't have per window icons
static void set_default_icons(const Fl_RGB_Image*[], int);
void set_icons();
int set_cursor(Fl_Cursor);
int set_cursor(const Fl_RGB_Image*, int, int);
// static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
// static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
// static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h);
// static void *get_carbon_function(const char *name);
// static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // compute work area of a given screen
// static int next_marked_length; // next length of marked text after current marked text will have been replaced
// static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates & height of insertion point
// static const int CoreText_threshold; // Mac OS version from which the Core Text API is used to display text
// static Fl_Fontdesc* calc_fl_fonts(void); // computes the fl_fonts global variable
// static int dnd(int use_selection); // call Fl_X::dnd(1) to support text dragging
// static int calc_mac_os_version(void); // computes the fl_mac_os_version global variable
// static void clip_to_rounded_corners(CGContextRef gc, int w, int h);
};
extern Window fl_window;
#endif // FL_LIBRARY || FL_INTERNALS
typedef void *Fl_Bitmask;
extern void *fl_gc;
extern Window fl_xid(const Fl_Window*);
extern Fl_Window* fl_find(Window xid);
void fl_clip_region(Fl_Region);
extern Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
extern Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
extern 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 int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
extern void fl_open_display();
//
// End of "$Id$".
//

1
FL/x.H
View File

@ -32,6 +32,7 @@
# include "mac.H"
# elif defined(FL_PORTING)
# pragma message "FL_PORTING: write a header file based on this file, win32.H, or mac.H to define the FLTK core internals"
# include "porting.H"
# else // X11
# if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files
# pragma set woff 3322

View File

@ -13701,6 +13701,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
"MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4;
OTHER_CFLAGS = "";
SDKROOT = "";
};
name = Release;
@ -14886,6 +14887,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "";
SDKROOT = "";
};
name = Debug;

View File

@ -16,7 +16,9 @@
#define USE_XFT 0
#define HAVE_XDBE 0
#define USE_XDBE HAVE_XDBE
#ifdef __APPLE__
#define __APPLE_QUARTZ__ 1
#endif
#define HAVE_OVERLAY 0
#define HAVE_GL_OVERLAY HAVE_OVERLAY
#if defined(__BIG_ENDIAN__)

View File

@ -556,7 +556,8 @@ double Fl::wait(double time_to_wait) {
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement waiting for a timer or a message from the system"
# pragma message "FL_PORTING: implement waiting for a timer or a message from the system"
return fl_wait(time_to_wait);
#else

View File

@ -221,11 +221,22 @@ void Fl_Copy_Surface::prepare_copy_pdf_and_tiff(int w, int h)
/** Copies a window and its borders and title bar to the clipboard. */
void Fl_Copy_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int delta_y)
{
#if defined(WIN32)
helper->draw_decorated_window(win, delta_x, delta_y, this);
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to draw a window border around a printout"
#else
helper->draw_decorated_window(win, delta_x, delta_y, this);
#endif
}
#endif
#if !(defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN))
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you need a helper class for your graphics driver"
#elif !defined(FL_DOXYGEN)
/* graphics driver that translates all graphics coordinates before calling Xlib */
class Fl_translated_Xlib_Graphics_Driver_ : public Fl_Xlib_Graphics_Driver {
int offset_x, offset_y; // translation between user and graphical coordinates: graphical = user + offset

View File

@ -41,8 +41,12 @@ const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";
#endif
#if !(defined(__APPLE__) || defined(WIN32))
#if defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate the main graphics driver here"
#else
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
#endif
#endif
/** \brief Make this surface the current drawing surface.
@ -94,6 +98,7 @@ Fl_Display_Device *Fl_Display_Device::display_device() {
Fl_GDI_Graphics_Driver
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your display driver here"
Fl_XXX_Graphics_Driver
#else
Fl_Xlib_Graphics_Driver
#endif

View File

@ -379,9 +379,9 @@ void fl_end_offscreen() {
/** @} */
#else
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement offscreen render space generation and management"
#else
# error unsupported platform
#endif
@ -418,8 +418,9 @@ void Fl_Double_Window::flush(int eraseoverlay) {
myi->other_xid = fl_create_offscreen(w(), h());
clear_damage(FL_DAMAGE_ALL);
}
#else
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: call a function to clear any graphics port damage flags"
#else
# error unsupported platform
#endif
}

View File

@ -33,11 +33,15 @@
#endif
# if USE_XFT
#if USE_XFT
typedef struct _XftFont XftFont;
# elif !defined(WIN32) && !defined(__APPLE__)
# include "Xutf8.h"
# endif // USE_XFT
#elif defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
# include "Xutf8.h"
#endif // USE_XFT
/**
This a structure for an actual system font, with junk to

View File

@ -791,6 +791,10 @@ int Fl_GDI_Printer_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, i
return 1;
}
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement RGB image handling here"
#else
void Fl_Xlib_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;

View File

@ -34,7 +34,11 @@ const char *Fl_Image_Surface::class_id = "Fl_Image_Surface";
Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
width = w;
height = h;
#if !(defined(__APPLE__) || defined(WIN32))
#if defined(__APPLE__)
#elif defined(WIN32)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Image_Surface"
#else
gc = 0;
if (!fl_gc) { // allows use of this class before any window is shown
fl_open_display();
@ -52,6 +56,8 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
#elif defined(WIN32)
helper = new Fl_GDI_Surface_();
driver(helper->driver());
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Image_Surface"
#else
helper = new Fl_Xlib_Surface_();
driver(helper->driver());
@ -66,6 +72,8 @@ Fl_Image_Surface::~Fl_Image_Surface() {
delete (Fl_Quartz_Flipped_Surface_*)helper;
#elif defined(WIN32)
delete (Fl_GDI_Surface_*)helper;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Image_Surface"
#else
if (gc) { XFreeGC(fl_display, gc); fl_gc = 0; }
delete (Fl_Xlib_Surface_*)helper;
@ -90,6 +98,8 @@ Fl_RGB_Image* Fl_Image_Surface::image()
_ss->set_current();
fl_window=_sw;
fl_gc = _sgc;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Image_Surface"
#else
fl_pop_clip();
data = fl_read_image(NULL, 0, 0, width, height, 0);
@ -127,6 +137,8 @@ void Fl_Image_Surface::set_current()
_savedc = SaveDC(fl_gc);
fl_window=(HWND)offscreen;
fl_push_no_clip();
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Image_Surface"
#else
pre_window = fl_window;
fl_window = offscreen;

View File

@ -25,7 +25,8 @@
#include <FL/Fl_Native_File_Chooser.H>
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the native file chooser interface"
# pragma message "FL_PORTING: implement the native file chooser interface"
# include "Fl_Native_File_Chooser_FLTK.cxx"
// All else falls back to FLTK's own chooser
#else

View File

@ -30,6 +30,18 @@
#include <sys/stat.h>
#include <string.h>
#if defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Native_File_Chooser"
int Fl_Native_File_Chooser::show() { return 0; }
void Fl_Native_File_Chooser::type(int t) { }
void Fl_Native_File_Chooser::title(const char *t) { }
void Fl_Native_File_Chooser::filter(const char *f) { }
void Fl_Native_File_Chooser::options(int val) { }
const char *Fl_Native_File_Chooser::filename() const { return 0; }
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int) { }
Fl_Native_File_Chooser::~Fl_Native_File_Chooser() { }
#else
int Fl_Native_File_Chooser::have_looked_for_GTK_libs = 0;
/**
@ -504,6 +516,8 @@ int Fl_FLTK_File_Chooser::exist_dialog() {
return fl_choice("%s", fl_cancel, fl_ok, NULL, Fl_Native_File_Chooser::file_exists_message);
}
#endif
//
// End of "$Id$".
//

View File

@ -17,6 +17,9 @@
//
#include <FL/x.H>
#ifdef USE_X11
#if HAVE_DLSYM && HAVE_DLFCN_H
#include <dlfcn.h> // for dlopen et al
#endif
@ -728,6 +731,8 @@ void Fl_GTK_File_Chooser::probe_for_GTK_libs(void) {
#endif
} // probe_for_GTK_libs
#endif
//
// End of "$Id$".
//

View File

@ -201,6 +201,9 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP
}
}
//------------------------------------------------------------------------------
#elif defined(FL_PORTING)
#pragma message "Implement Fl_XXX_Graphics_Driver methods here"
//------------------------------------------------------------------------------
#else // X11, Xlib
//------------------------------------------------------------------------------

View File

@ -1553,7 +1553,11 @@ void Fl_PostScript_File_Device::end_job (void)
#endif // FL_DOXYGEN
#if ! (defined(__APPLE__) || defined(WIN32) )
#if defined(__APPLE__)
#elif defined(WIN32)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement postscript printing"
#else // X11
/** Starts a print job. */
int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) {
enum Fl_Paged_Device::Page_Format format;

View File

@ -73,7 +73,10 @@ const char *Fl_Printer::class_id = "Fl_Printer";
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
const char *Fl_System_Printer::class_id = Fl_Printer::class_id;
#endif
#if !( defined(__APPLE__) || defined(WIN32) )
#if defined(__APPLE__) || defined(WIN32)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the printer device specifics"
#else
const char *Fl_PostScript_Printer::class_id = Fl_Printer::class_id;
#endif
@ -98,6 +101,9 @@ void Fl_System_Printer::origin(int *x, int *y)
Fl_Printer::Fl_Printer(void) {
#if defined(WIN32) || defined(__APPLE__)
printer = new Fl_System_Printer();
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the printer device specifics"
printer = new Fl_XXX_Printer();
#else
printer = new Fl_PostScript_Printer();
#endif

View File

@ -232,6 +232,8 @@ Fl_Widget::draw_focus(Fl_Boxtype B, int X, int Y, int W, int H) const {
for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fl_point(X + W, Y + yy);
for (xx = W; xx > 0; xx --, i ++) if (i & 1) fl_point(X + xx, Y + H);
for (yy = H; yy > 0; yy --, i ++) if (i & 1) fl_point(X, Y + yy);
#elif defined(FL_PORTING)
# pragma message "handle focus drawing"
#else
# error unsupported platform
#endif // WIN32

View File

@ -60,6 +60,8 @@ void Fl_Window::border(int b) {
// for full fullscreen we have to make the window topmost as well
#elif defined(__APPLE_QUARTZ__)
// warning: not implemented in Quartz/Carbon
#elif defined(FL_PORTING)
# pragma message "handle window border setting"
#else
# error unsupported platform
#endif

View File

@ -136,6 +136,10 @@ static HRGN bitmap2region(Fl_Image* image) {
return hRgn;
}
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement window masks"
#else
#ifndef FL_DOXYGEN
@ -359,10 +363,10 @@ void Fl_Window::draw() {
SetWindowRgn(fl_xid(this), region, TRUE); // the system deletes the region when it's no longer needed
delete temp;
}
#elif !(defined(__APPLE__) || defined(WIN32))
#elif defined(USE_X11)
if (( shape_data_->lw_ != w() || shape_data_->lh_ != h() ) && shape_data_->shape_) {
// size of window has changed since last time
combine_mask();
// size of window has changed since last time
combine_mask();
}
# endif
}

View File

@ -34,7 +34,7 @@
#else
#endif
#if defined(WIN32) || defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__) || defined(FL_PORTING)
int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*);
# define NoValue 0x0000
# define XValue 0x0001
@ -301,7 +301,11 @@ void Fl_Window::show(int argc, char **argv) {
Fl::get_system_colors();
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: Parse additional default settings"
#else // X11
// Get defaults for drag-n-drop and focus...
const char *key = 0, *val;
@ -361,7 +365,11 @@ void Fl_Window::show(int argc, char **argv) {
// Show the window AFTER we have set the colors and scheme.
show();
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: Parse additional default settings"
#else // X11
// set the command string, used by state-saving window managers:
int j;
int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
@ -544,6 +552,10 @@ int XParseGeometry(const char* string, int* x, int* y,
return (mask);
}
#elif defined(FL_PORTING)
int XParseGeometry(const char* string, int* x, int* y, unsigned int* width, unsigned int* height) { return 0; }
#endif // ifdef WIN32
//

View File

@ -21,12 +21,6 @@
Utility functions to support text input.
*/
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement keyboard composing in the code below"
#else
#endif
#include <FL/Fl.H>
#include <FL/x.H>
@ -37,7 +31,10 @@ int Fl_X::next_marked_length = 0;
#endif
#endif
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement keyboard composing in the code below"
#else // X11
extern XIC fl_xim_ic;
#endif
@ -146,7 +143,10 @@ void Fl::insertion_point_location(int x, int y, int height) {
void Fl::compose_reset()
{
Fl::compose_state = 0;
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: compose reset extra functions"
#else
if (fl_xim_ic) XmbResetIC(fl_xim_ic);
#endif
}

View File

@ -117,6 +117,9 @@ int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
r = (uchar)R; g = (uchar)G; b = (uchar)B;
return 1;
}
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement fl_parse_color"
int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) { return 0; }
#else
// Wrapper around XParseColor...
int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
@ -203,6 +206,7 @@ void Fl::get_system_colors()
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement code to find the current desktop color scheme"
void Fl::get_system_colors() { }
#else // --- X11 ---
@ -296,7 +300,10 @@ static Fl_Pixmap tile(tile_xpm);
int Fl::scheme(const char *s) {
if (!s) {
if ((s = getenv("FLTK_SCHEME")) == NULL) {
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl::scheme"
#else
const char* key = 0;
if (Fl::first_window()) key = Fl::first_window()->xclass();
if (!key) key = "fltk";

View File

@ -30,21 +30,20 @@
extern void fl_fix_focus(); // in Fl.cxx
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: tell a window to grab all following events"
#else
#endif
#ifdef WIN32
// We have to keep track of whether we have captured the mouse, since
// MSWindows shows little respect for this... Grep for fl_capture to
// see where and how this is used.
extern HWND fl_capture;
#endif
#ifdef __APPLE__
#elif defined(__APPLE__)
extern void *fl_capture;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: tell a window to grab all following events"
#else // X11
#endif
void Fl::grab(Fl_Window* win) {
@ -65,6 +64,8 @@ void Fl::grab(Fl_Window* win) {
#elif defined(__APPLE__)
fl_capture = Fl_X::i(first_window())->xid;
Fl_X::i(first_window())->set_key_window();
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement event grabbing"
#else
Window xid = fullscreen_win ? fl_xid(fullscreen_win) : fl_xid(first_window());
XGrabPointer(fl_display,
@ -93,6 +94,8 @@ void Fl::grab(Fl_Window* win) {
ReleaseCapture();
#elif defined(__APPLE__)
fl_capture = 0;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement event grabbing"
#else
// We must keep the grab in the non-EWMH fullscreen case
if (!fullscreen_win || Fl_X::ewmh_supported()) {

361
src/Fl_porting.cxx Normal file
View File

@ -0,0 +1,361 @@
//
// "$Id$"
//
// core code stubs for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2015 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#ifndef FL_DOXYGEN
#include <FL/Fl.H>
#include <FL/fl_utf8.h>
#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
#include <FL/Enumerations.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Paged_Device.H>
#include "flstring.h"
#include "Fl_Font.H"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <signal.h>
extern unsigned int fl_codepage;
Fl_Fontdesc* fl_fonts = NULL;
void *fl_gc = NULL;
Window fl_window = NULL;
void fl_reset_spot()
{
# pragma message "FL_PORTING: implement fl_reset_spot"
}
void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
{
# pragma message "FL_PORTING: implement fl_set_spot"
}
void fl_set_status(int x, int y, int w, int h)
{
# pragma message "FL_PORTING: implement fl_set_status"
}
void Fl::add_fd(int n, int events, void (*cb)(FL_SOCKET, void*), void *v) {
# pragma message "FL_PORTING: implement Fl::add_fd"
}
void Fl::add_fd(int fd, void (*cb)(FL_SOCKET, void*), void* v) {
# pragma message "FL_PORTING: implement Fl::add_fd"
}
void Fl::remove_fd(int n, int events) {
# pragma message "FL_PORTING: implement Fl::remove_fd"
}
void Fl::remove_fd(int n) {
# pragma message "FL_PORTING: implement Fl::remove_fd"
}
static void nothing() {}
void (*fl_lock_function)() = nothing;
void (*fl_unlock_function)() = nothing;
//void* Fl::thread_message() {
//# pragma message "FL_PORTING: implement Fl::thread_message"
//}
int fl_wait(double time_to_wait) {
# pragma message "FL_PORTING: implement fl_wait"
Fl::flush();
return 0;
}
int fl_ready() {
# pragma message "FL_PORTING: implement fl_ready"
return 0;
}
void fl_open_display() {
# pragma message "FL_PORTING: implement fl_open_display()"
}
void Fl::enable_im() {
# pragma message "FL_PORTING: implement Fl::enable_im"
}
void Fl::disable_im() {
# pragma message "FL_PORTING: implement Fl::disable_im"
}
int Fl::x()
{
# pragma message "FL_PORTING: implement Fl::x"
return 0;
}
int Fl::y()
{
# pragma message "FL_PORTING: implement Fl::y"
return 0;
}
int Fl::h()
{
# pragma message "FL_PORTING: implement Fl::h"
return 600;
}
int Fl::w()
{
# pragma message "FL_PORTING: implement Fl::w"
return 800;
}
char *fl_selection_buffer[2];
int fl_selection_length[2];
int fl_selection_buffer_length[2];
char fl_i_own_selection[2];
void fl_update_clipboard(void) {
# pragma message "FL_PORTING: implement fl_update_clipboard"
}
// call this when you create a selection:
void Fl::copy(const char *stuff, int len, int clipboard, const char *type) {
# pragma message "FL_PORTING: implement Fl::copy"
}
// Call this when a "paste" operation happens:
void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type) {
# pragma message "FL_PORTING: implement Fl::paste"
}
int Fl::clipboard_contains(const char *type)
{
# pragma message "FL_PORTING: implement Fl::clipboard_contains"
return 0;
}
void fl_get_codepage()
{
# pragma message "FL_PORTING: implement fl_get_codepage"
}
int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
# pragma message "FL_PORTING: don't ask. We do't know either..."
return 0;
}
void Fl_Window::resize(int X,int Y,int W,int H) {
# pragma message "FL_PORTING: implement Fl_Window::resize"
}
//void Fl_X::make_fullscreen(int X, int Y, int W, int H) {
//# pragma message "FL_PORTING: implement Fl_X::make_fullscreen"
//}
void Fl_Window::fullscreen_x() {
# pragma message "FL_PORTING: implement Fl_Window::fullscreen_x"
}
void Fl_Window::fullscreen_off_x(int X, int Y, int W, int H) {
# pragma message "FL_PORTING: implement Fl_Window::fullscreen_off_x"
}
void fl_fix_focus(); // in Fl.cxx
char fl_show_iconic;
int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR
Fl_X* Fl_X::make(Fl_Window* w) {
# pragma message "FL_PORTING: implement Fl_X::make"
return 0;
}
void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void* data)
{
# pragma message "FL_PORTING: implement Fl::add_timeout"
}
void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void* data)
{
# pragma message "FL_PORTING: implement Fl::repeat_timeout"
}
int Fl::has_timeout(Fl_Timeout_Handler cb, void* data)
{
# pragma message "FL_PORTING: implement Fl::has_timeout"
return 0;
}
void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
{
# pragma message "FL_PORTING: implement Fl::remove_timeout"
}
void Fl_Window::size_range_() {
size_range_set = 1;
}
#include <FL/filename.H> // need so FL_EXPORT fl_filename_name works
// returns pointer to the filename, or null if name ends with '/'
const char *fl_filename_name(const char *name) {
# pragma message "FL_PORTING: implement fl_filename_name"
return 0;
}
void Fl_Window::label(const char *name,const char *iname) {
# pragma message "FL_PORTING: implement Fl_Window::label"
}
void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) {
# pragma message "FL_PORTING: implement Fl_X::set_defult_icons"
}
void Fl_X::set_icons() {
# pragma message "FL_PORTING: implement Fl_X::set_icons"
}
int Fl_X::set_cursor(Fl_Cursor c) {
# pragma message "FL_PORTING: implement Fl_X::set_cursor"
return 1;
}
int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
# pragma message "FL_PORTING: implement Fl_X::set_cursor"
return 1;
}
void Fl_Window::show() {
# pragma message "FL_PORTING: implement Fl_Window::show"
}
Fl_Window *Fl_Window::current_;
void Fl_Window::make_current() {
# pragma message "FL_PORTING: implement Fl_Window::make_current"
}
void fl_free_fonts(void)
{
# pragma message "FL_PORTING: implement fl_free_fonts"
}
//Fl_Region XRectangleRegion(int x, int y, int w, int h) {
//}
FL_EXPORT Window fl_xid_(const Fl_Window *w) {
Fl_X *temp = Fl_X::i(w);
return temp ? temp->xid : 0;
}
int Fl_Window::decorated_w()
{
return w();
}
int Fl_Window::decorated_h()
{
return h();
}
void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
{
# pragma message "FL_PORTING: implement Fl_Paged_Device::print_window"
}
//void Fl_Paged_Device::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset, Fl_Surface_Device *toset)
//{
//}
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data)
{
# pragma message "FL_PORTING: implement fl_create_bitmask"
return 0;
}
//Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data)
//{
//# pragma message "FL_PORTING: implement fl_create_alphamask"
// return 0;
//}
void fl_delete_bitmask(Fl_Bitmask bm)
{
# pragma message "FL_PORTING: implement fl_delete_bitmask"
}
Fl_Offscreen fl_create_offscreen(int w, int h)
{
# pragma message "FL_PORTING: implement fl_create_offscreen"
return 0;
}
//void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy)
//{
//# pragma message "FL_PORTING: implement fl_copy_offscreen"
//}
void fl_delete_offscreen(Fl_Offscreen gWorld)
{
# pragma message "FL_PORTING: implement fl_delete_offscreen"
}
void fl_begin_offscreen(Fl_Offscreen gWorld)
{
# pragma message "FL_PORTING: implement fl_begin_offscreen"
}
void fl_end_offscreen()
{
# pragma message "FL_PORTING: implement fl_end_offscreen"
}
void fl_clipboard_notify_change() {
# pragma message "FL_PORTING: implement fl_clipboard_notify_change"
}
Fl_Font_Descriptor::~Fl_Font_Descriptor()
{
# pragma message "FL_PORTING: implement Fl_Font_Descriptor::~Fl_Font_Descriptor"
}
int Fl::dnd()
{
# pragma message "FL_PORTING: implement Fl::dnd"
return 0;
}
void Fl::get_mouse(int &x, int &y)
{
# pragma message "FL_PORTING: implement Fl::get_mouse"
x = 0; y = 0;
}
void Fl_X::flush()
{
# pragma message "FL_PORTING: implement Fl_X::flush"
}
#endif // FL_DOXYGEN
//
// End of "$Id$".
//

View File

@ -22,6 +22,7 @@
//# include "Fl_mac.cxx" // now Fl_cocoa.mm
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement the FLTK core in its own file"
# include "Fl_porting.cxx"
#elif !defined(FL_DOXYGEN)
# define CONSOLIDATE_MOTION 1

View File

@ -121,6 +121,9 @@ int fl_filename_list(const char *d, dirent ***list,
# else
int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort);
# endif
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: defien scandir"
int n = 0;
#else
// The vast majority of UNIX systems want the sort function to have this
// prototype, most likely so that it can be passed to qsort without any

View File

@ -68,8 +68,9 @@ void Fl_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
}
CGContextStrokePath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#else
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement arc drawing"
#else
# error unsupported platform
#endif
}
@ -114,8 +115,9 @@ void Fl_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
}
CGContextFillPath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#else
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement pie drawing (mmmh, apple pie)"
#else
# error unsupported platform
#endif
}

View File

@ -29,6 +29,7 @@
# include "fl_color_mac.cxx"
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement color handling in your own file based on fl_color.cxx"
# include "fl_color_porting.cxx"
#else
// Also code to look at the X visual and figure out the best way to turn

50
src/fl_color_porting.cxx Normal file
View File

@ -0,0 +1,50 @@
//
// "$Id$"
//
// MacOS color functions for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
// The fltk "colormap". This allows ui colors to be stored in 8-bit
// locations, and provides a level of indirection so that global color
// changes can be made. Not to be confused with the X colormap, which
// I try to hide completely.
// matt: Neither Quartz nor Quickdraw support colormaps in this implementation
// matt: Quartz support done
#include <config.h>
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/fl_draw.H>
static unsigned fl_cmap[256] = {
#include "fl_cmap.h" // this is a file produced by "cmap.cxx":
};
//void Fl_XXX_Graphics_Driver::color(Fl_Color i) {
//}
//void Fl_XXX_Graphics_Driver::color(uchar r, uchar g, uchar b) {
//}
void Fl::set_color(Fl_Color i, unsigned c) {
if (fl_cmap[i] != c) {
fl_cmap[i] = c;
}
}
//
// End of "$Id$".
//

View File

@ -32,6 +32,8 @@
# include "fl_draw_image_mac.cxx"
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement image drawing in its own file"
# include <FL/x.H>
void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { }
#else
// A list of assumptions made about the X display:

View File

@ -57,7 +57,10 @@
# include "fl_font_x.cxx"
#endif // WIN32
#if ! (defined(WIN32) || defined(__APPLE__))
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you need the XFontStruct"
#else
XFontStruct *fl_X_core_font()
{
return fl_xfont.value();

View File

@ -154,8 +154,9 @@ void Fl_Graphics_Driver::line_style(int style, int width, char* dashes) {
fl_quartz_line_pattern_size = 0;
}
fl_quartz_restore_line_style_();
#else
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement line styles here"
#else
# error unsupported platform
#endif
}

View File

@ -28,6 +28,7 @@
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement code to read RGB data from screen"
static uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha) { }
#else
#endif
@ -175,6 +176,9 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
#ifdef WIN32
# include "fl_read_image_win32.cxx" // gives the WIN32 version of read_win_rectangle()
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: create your own version of fl_read_image.cxx"
# include "fl_read_image_porting.cxx"
#else
# include <X11/Xutil.h>
# ifdef __sgi

View File

@ -0,0 +1,33 @@
//
// "$Id$"
//
// WIN32 image reading routines for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2010 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#include <config.h>
//
// 'fl_read_image()' - Read an image from the current window or off-screen buffer.
//
//uchar *fl_read_image(uchar *p, int x, int y, int w, int h, int alpha)
//{
// return 0;
//}
//
// End of "$Id$".
//

View File

@ -178,6 +178,8 @@ void Fl_Graphics_Driver::rect(int x, int y, int w, int h) {
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextStrokeRect(fl_gc, rect);
if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement rect"
#else
# error unsupported platform
#endif
@ -196,6 +198,8 @@ void Fl_Graphics_Driver::rectf(int x, int y, int w, int h) {
#elif defined(__APPLE_QUARTZ__)
CGRect rect = CGRectMake(x - 0.5, y - 0.5, w , h);
CGContextFillRect(fl_gc, rect);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement rectf"
#else
# error unsupported platform
#endif
@ -220,6 +224,8 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1) {
CGContextFillRect(fl_gc, CGRectMake(x1-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement xyline"
#else
# error unsupported platform
#endif
@ -248,6 +254,8 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1, int y2) {
CGContextFillRect(fl_gc, CGRectMake(x1 - fl_quartz_line_width_/2, y2-0.5, fl_quartz_line_width_, 1));
}
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement xyline"
#else
#error unsupported platform
#endif
@ -279,6 +287,8 @@ void Fl_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) {
CGContextFillRect(fl_gc, CGRectMake(x3-0.5, y2 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement xyline"
#else
# error unsupported platform
#endif
@ -301,6 +311,8 @@ void Fl_Graphics_Driver::yxline(int x, int y, int y1) {
CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y1-0.5, fl_quartz_line_width_, 1));
}
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement yxline"
#else
# error unsupported platform
#endif
@ -329,6 +341,8 @@ void Fl_Graphics_Driver::yxline(int x, int y, int y1, int x2) {
CGContextFillRect(fl_gc, CGRectMake(x2-0.5, y1 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement yxline"
#else
# error unsupported platform
#endif
@ -360,6 +374,8 @@ void Fl_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) {
CGContextFillRect(fl_gc, CGRectMake(x2 - fl_quartz_line_width_/2, y3-0.5, fl_quartz_line_width_, 1));
}
if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement yxline"
#else
# error unsupported platform
#endif
@ -380,6 +396,8 @@ void Fl_Graphics_Driver::line(int x, int y, int x1, int y1) {
CGContextAddLineToPoint(fl_gc, x1, y1);
CGContextStrokePath(fl_gc);
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement line"
#else
# error unsupported platform
#endif
@ -406,6 +424,8 @@ void Fl_Graphics_Driver::line(int x, int y, int x1, int y1, int x2, int y2) {
CGContextAddLineToPoint(fl_gc, x2, y2);
CGContextStrokePath(fl_gc);
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement line"
#else
# error unsupported platform
#endif
@ -432,6 +452,8 @@ void Fl_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2) {
CGContextClosePath(fl_gc);
CGContextStrokePath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement loop"
#else
# error unsupported platform
#endif
@ -461,6 +483,8 @@ void Fl_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2, int
CGContextClosePath(fl_gc);
CGContextStrokePath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement loop"
#else
# error unsupported platform
#endif
@ -486,6 +510,8 @@ void Fl_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2) {
CGContextClosePath(fl_gc);
CGContextFillPath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement polygon"
#else
# error unsupported platform
#endif
@ -513,6 +539,8 @@ void Fl_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2, i
CGContextClosePath(fl_gc);
CGContextFillPath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement polygon"
#else
# error unsupported platform
#endif
@ -525,6 +553,8 @@ void Fl_Graphics_Driver::point(int x, int y) {
SetPixel(fl_gc, x, y, fl_RGB());
#elif defined(__APPLE_QUARTZ__)
CGContextFillRect(fl_gc, CGRectMake(x - 0.5, y - 0.5, 1, 1) );
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement point"
#else
# error unsupported platform
#endif
@ -532,7 +562,11 @@ void Fl_Graphics_Driver::point(int x, int y) {
////////////////////////////////////////////////////////////////
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement region stuff"
#else
// Missing X call: (is this the fastest way to init a 1-rectangle region?)
// MSWindows equivalent exists, implemented inline in win32.H
Fl_Region XRectangleRegion(int x, int y, int w, int h) {
@ -562,6 +596,8 @@ void Fl_Graphics_Driver::restore_clip() {
CGContextClipToRects(fl_gc, r->rects, r->count);
}
}
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement restore_clip"
#else
# error unsupported platform
#endif
@ -594,6 +630,8 @@ void Fl_Graphics_Driver::push_clip(int x, int y, int w, int h) {
#elif defined(__APPLE_QUARTZ__)
XDestroyRegion(r);
r = Fl_X::intersect_region_and_rect(current, x,y,w,h);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement push_clip"
#else
# error unsupported platform
#endif
@ -605,6 +643,8 @@ void Fl_Graphics_Driver::push_clip(int x, int y, int w, int h) {
r = CreateRectRgn(0,0,0,0);
#elif defined(__APPLE_QUARTZ__)
r = XRectangleRegion(0,0,0,0);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement push_clip"
#else
# error unsupported platform
#endif
@ -655,6 +695,8 @@ int Fl_Graphics_Driver::not_clipped(int x, int y, int w, int h) {
if (!CGRectIsEmpty(test)) return 1;
}
return 0;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement not_clipped"
#else
# error unsupported platform
#endif
@ -730,6 +772,8 @@ int Fl_Graphics_Driver::clip_box(int x, int y, int w, int h, int& X, int& Y, int
H = int(u.size.height + 0.5);
if(CGRectIsEmpty(u)) W = H = 0;
return ! CGRectEqualToRect(arg, u);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement clip_box"
#else
# error unsupported platform
#endif

View File

@ -150,8 +150,9 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
Fl_X::q_end_image();
CFRelease(img);
}
#else
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement scrolling of the screen contents"
#else
# error unsupported platform
#endif
if (dx) draw_area(data, clip_x, dest_y, clip_w, src_h);

View File

@ -50,7 +50,7 @@ void Fl::set_font(Fl_Font fnum, const char* name) {
for (; i < table_size; i++) {
fl_fonts[i].fontname[0] = 0;
fl_fonts[i].name = 0;
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(USE_X11)
fl_fonts[i].xlist = 0;
fl_fonts[i].n = 0;
#endif // !WIN32 && !__APPLE__
@ -59,7 +59,7 @@ void Fl::set_font(Fl_Font fnum, const char* name) {
Fl_Fontdesc* s = fl_fonts+fnum;
if (s->name) {
if (!strcmp(s->name, name)) {s->name = name; return;}
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(USE_X11)
if (s->xlist && s->n >= 0) XFreeFontNames(s->xlist);
#endif
for (Fl_Font_Descriptor* f = s->first; f;) {
@ -69,7 +69,7 @@ void Fl::set_font(Fl_Font fnum, const char* name) {
}
s->name = name;
s->fontname[0] = 0;
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(USE_X11)
s->xlist = 0;
#endif
s->first = 0;

View File

@ -243,6 +243,8 @@ const char* fl_shortcut_label(unsigned int shortcut, const char **eom) {
}
*p = 0;
return buf;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement fl_shortcut_label"
#else
const char* q;
if (key == FL_Enter || key == '\r') q="Enter"; // don't use Xlib's "Return":

View File

@ -62,6 +62,14 @@ extern "C" {
unsigned short XUtf8IsNonSpacing(unsigned int ucs);
}
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement utf8 tools."
extern "C" {
int XUtf8Tolower(int ucs);
unsigned short XUtf8IsNonSpacing(unsigned int ucs);
}
#else // X-windows platform
# include "Xutf8.h"
@ -623,6 +631,11 @@ int fl_chmod(const char* f, int mode) {
wbuf[wn] = 0;
return _wchmod(wbuf, mode);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement utf8 version of chmod."
return -1;
#else // other platforms
return chmod(f, mode);
@ -653,6 +666,11 @@ int fl_access(const char* f, int mode) {
wbuf[wn] = 0;
return _waccess(wbuf, mode);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement utf8 version of access."
return -1;
#else // other platforms
return access(f, mode);
@ -683,6 +701,11 @@ int fl_stat(const char* f, struct stat *b) {
wbuf[wn] = 0;
return _wstat(wbuf, (struct _stat*)b);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement utf8 version of stat."
return -1;
#else // other platforms
return stat(f, b);
@ -782,6 +805,11 @@ int fl_mkdir(const char* f, int mode) {
wbuf[wn] = 0;
return _wmkdir(wbuf);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement utf8 version of mkdir."
return -1;
#else // other platforms
return mkdir(f, mode);

View File

@ -131,6 +131,8 @@ void Fl_Graphics_Driver::end_points() {
CGContextStrokePath(fl_gc);
}
if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement end_points"
#else
# error unsupported platform
#endif
@ -153,6 +155,8 @@ void Fl_Graphics_Driver::end_line() {
CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
CGContextStrokePath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement end_line"
#else
# error unsupported platform
#endif
@ -190,6 +194,8 @@ void Fl_Graphics_Driver::end_polygon() {
CGContextClosePath(fl_gc);
CGContextFillPath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement end_polygon"
#else
# error unsupported platform
#endif
@ -238,6 +244,8 @@ void Fl_Graphics_Driver::end_complex_polygon() {
CGContextClosePath(fl_gc);
CGContextFillPath(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement end_complex_polygon"
#else
# error unsupported platform
#endif
@ -273,6 +281,8 @@ void Fl_Graphics_Driver::circle(double x, double y,double r) {
CGContextAddArc(fl_gc, xt, yt, (w+h)*0.25f, 0, 2.0f*M_PI, 0);
(what == POLYGON ? CGContextFillPath : CGContextStrokePath)(fl_gc);
CGContextSetShouldAntialias(fl_gc, false);
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement circle"
#else
# error unsupported platform
#endif

View File

@ -38,8 +38,11 @@
#include "Fl_Font.H"
#include <FL/fl_utf8.h>
#if !defined(WIN32) && !defined(__APPLE__)
#include "Xutf8.h"
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h? It's written for X11."
#else
# include "Xutf8.h"
#endif
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4

View File

@ -145,6 +145,7 @@ static void screen_init() {
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: return various information about the screens in the system"
static void screen_init() { }
#else
@ -298,6 +299,9 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n) {
Y = screens[n].y;
W = screens[n].width;
H = screens[n].height;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement screen_xywh"
X = 0; Y = 0; W = 800; H = 600;
#else
if (num_screens > 0) {
X = screens[n].x_org;
@ -394,6 +398,8 @@ void Fl::screen_dpi(float &h, float &v, int n)
h = dpi_h[n];
v = dpi_v[n];
}
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement screen_dpi"
#else
if (n >= 0 && n < num_screens) {
h = dpi[n][0];

View File

@ -24,7 +24,10 @@
* This file is required on all platforms for utf8 support
*/
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h? It's written for X11."
#else
# include "../Xutf8.h"
#endif /* !defined(WIN32) && !defined(__APPLE__) */

View File

@ -16,7 +16,11 @@
#define KEYSYM2UCS_INCLUDED
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
#include "../Xutf8.h"
#include "imKStoUCS.c"

View File

@ -14,7 +14,11 @@
* http://www.fltk.org/str.php
*/
#if !defined(WIN32) && !defined(__APPLE__)
#if defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
#include <config.h>
#include "../Xutf8.h"

View File

@ -24,7 +24,11 @@
* Unicode to UTF-8 conversion functions.
*/
#if !defined(WIN32) && !defined(__APPLE__)
#elif defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
#include "../Xutf8.h"

View File

@ -23,7 +23,11 @@
/*
* X11 UTF-8 text drawing functions.
*/
#if !defined(WIN32) && !defined(__APPLE__)
#elif defined(WIN32)
#elif defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
#include "../Xutf8.h"
#include <X11/Xlib.h>