diff options
22 files changed, 1188 insertions, 23 deletions
diff --git a/Android/FL/abi-version.h b/Android/FL/abi-version.h new file mode 100644 index 000000000..0379081bb --- /dev/null +++ b/Android/FL/abi-version.h @@ -0,0 +1,31 @@ +/* + * "$Id: abi-version.cmake.in 10788 2015-07-13 18:17:33Z AlbrechtS $" + * + * Configuration 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 EDIT - This file is generated by CMake ! + ============================================================================ +*/ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +/* #undef FL_ABI_VERSION */ + +/* + * End of "$Id: abi-version.cmake.in 10788 2015-07-13 18:17:33Z AlbrechtS $". + */ diff --git a/Android/adb-run.sh b/Android/adb-run.sh new file mode 100755 index 000000000..e28064e89 --- /dev/null +++ b/Android/adb-run.sh @@ -0,0 +1,5 @@ +PATH=$(dirname $(which android))/../build-tools/21.1.1:$PATH +pkg=$(aapt dump badging $1|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}') +act=$(aapt dump badging $1|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}') +adb shell am start -n $pkg/$act + diff --git a/Android/config.h b/Android/config.h new file mode 100644 index 000000000..97133f88c --- /dev/null +++ b/Android/config.h @@ -0,0 +1,371 @@ +/* config.h. Generated from configh.cmake.in by CMake. */ +/* + * "$Id: configh.cmake.in 11262 2016-03-02 00:54:37Z matt $" + * + * Configuration file for the Fast Light Tool Kit (FLTK). + * + * Copyright 1998-2016 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 + */ + +/* + * Where to find files... + */ + +#define FLTK_DATADIR "/usr/local/share/fltk" +#define FLTK_DOCDIR "/usr/local/share/doc/fltk" + +/* + * BORDER_WIDTH: + * + * Thickness of FL_UP_BOX and FL_DOWN_BOX. Current 1,2, and 3 are + * supported. + * + * 3 is the historic FLTK look. + * 2 is the default and looks like Microsoft Windows, KDE, and Qt. + * 1 is a plausible future evolution... + * + * Note that this may be simulated at runtime by redefining the boxtypes + * using Fl::set_boxtype(). + */ + +#define BORDER_WIDTH 2 + +/* + * HAVE_GL: + * + * Do you have OpenGL? Set this to 0 if you don't have or plan to use + * OpenGL, and FLTK will be smaller. + */ + +#undef HAVE_GL + +/* + * HAVE_GL_GLU_H: + * + * Do you have the OpenGL Utility Library header file? + * (many broken Mesa RPMs do not...) + */ + +#undef HAVE_GL_GLU_H + +/* + * HAVE_GLXGETPROCADDRESSARB: + * + * Do you have the OpenGL glXGetProcAddressARB() function? + */ + +/* #undef HAVE_GLXGETPROCADDRESSARB */ + +/* + * USE_COLORMAP: + * + * Setting this to zero will save a good deal of code (especially for + * fl_draw_image), but FLTK will only work on TrueColor visuals. + */ + +#define USE_COLORMAP 1 + +/* + * HAVE_XINERAMA + * + * Do we have the Xinerama library to support multi-head displays? + */ + +#define HAVE_XINERAMA 0 + +/* + * USE_XFT + * + * Use the new Xft library to draw anti-aliased text. + */ + +#define USE_XFT 0 + +/* + * HAVE_XDBE: + * + * Do we have the X double-buffer extension? + */ + +#define HAVE_XDBE 0 + +/* + * USE_XDBE: + * + * Actually try to use the double-buffer extension? + */ + +#define USE_XDBE HAVE_XDBE + +/* + * HAVE_XFIXES: + * + * Do we have the X fixes extension? + */ + +#define HAVE_XFIXES 0 + +/* + * HAVE_XCURSOR: + * + * Do we have the X cursor library? + */ + +#define HAVE_XCURSOR 0 + +/* + * HAVE_XRENDER: + * + * Do we have the X render library? + */ + +#define HAVE_XRENDER 0 + +/* + * HAVE_X11_XREGION_H: + * + * Do we have the X11 Xregion.h header file ? + */ + +#define HAVE_X11_XREGION_H 1 + +/* + * __APPLE_QUARTZ__: + * + * All Apple implementations are now based on Quartz and Cocoa, + * so this flag should always be on for Mac OS X. This flag has + * no meaning on operating systems other than Mac OS X. + */ + +/* #undef __APPLE_QUARTZ__ */ + + +/* + * USE_X11 + * + * Should we use X11 for the current platform + * + */ + +/* #undef USE_X11 */ + +/* + * USE_SDL + * + * Should we use SDL for the current platform + * + */ + +//#define USE_SDL 1 + +/* + * FL_PORTING + * + * A little helper that points to locations in the core that still need to be ported to + * the core driver setup. + */ + +#define FL_PORTING 1 + +/* + * HAVE_OVERLAY: + * + * Use the X overlay extension? FLTK will try to use an overlay + * visual for Fl_Overlay_Window, the Gl_Window overlay, and for the + * menus. Setting this to zero will remove a substantial amount of + * code from FLTK. Overlays have only been tested on SGI servers! + */ + +#define HAVE_OVERLAY 0 + +/* + * HAVE_GL_OVERLAY: + * + * It is possible your GL has an overlay even if X does not. If so, + * set this to 1. + */ + +#define HAVE_GL_OVERLAY HAVE_OVERLAY + +/* + * WORDS_BIGENDIAN: + * + * Byte order of your machine: 1 = big-endian, 0 = little-endian. + */ + +#ifdef __APPLE__ +#include <mac_endianness.h> +#else +#define WORDS_BIGENDIAN 0 +#endif + +/* + * U16, U32, U64: + * + * Types used by fl_draw_image. One of U32 or U64 must be defined. + * U16 is optional but FLTK will work better with it! + */ + +#define U16 unsigned short +#define U32 unsigned +#define U64 unsigned long + +/* + * HAVE_DIRENT_H, HAVE_SYS_NDIR_H, HAVE_SYS_DIR_H, HAVE_NDIR_H, + * HAVE_SCANDIR, HAVE_SCANDIR_POSIX: + * + * Where is <dirent.h> (used only by fl_file_chooser and scandir). + */ + +#define HAVE_DIRENT_H 1 +/* #undef HAVE_SYS_NDIR_H */ +/* #undef HAVE_SYS_DIR_H */ +/* #undef HAVE_NDIR_H */ +#define HAVE_SCANDIR 1 +#define HAVE_SCANDIR_POSIX 1 + +/* + * Possibly missing sprintf-style functions: + */ + +#define HAVE_VSNPRINTF 1 +#define HAVE_SNPRINTF 1 + +/* + * String functions and headers... + */ + +#define HAVE_STRINGS_H 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRLCPY 1 + +/* + * Do we have POSIX locale support? + */ + +#define HAVE_LOCALE_H 1 +#define HAVE_LOCALECONV 1 + +/* + * HAVE_SYS_SELECT_H: + * + * Whether or not select() call has its own header file. + */ + +#define HAVE_SYS_SELECT_H 1 + +/* + * HAVE_SYS_STDTYPES_H: + * + * Whether or not we have the <sys/stdtypes.h> header file. + */ + +/* #undef HAVE_SYS_STDTYPES_H */ + +/* + * USE_POLL: + * + * Use the poll() call provided on Linux and Irix instead of select() + */ + +#define USE_POLL 0 + +/* + * Do we have various image libraries? + */ + +#define HAVE_LIBPNG 1 +#define HAVE_LIBZ 1 +#define HAVE_LIBJPEG 1 + +/* + * FLTK_USE_CAIRO + * + * Do we have the cairo library available and want extended cairo use in FLTK ? + * This implies to link cairo.lib in all FLTK based apps. + */ + +/* #undef FLTK_USE_CAIRO */ + +/* + * FLTK_HAVE_CAIRO + * + * Do we have the cairo library available? + */ + +/* #undef FLTK_HAVE_CAIRO */ + +/* + * Which header file do we include for libpng? + */ + +#define HAVE_PNG_H 1 +/* #undef HAVE_LIBPNG_PNG_H */ + +/* + * Do we have the png_xyz() functions? + */ + +#define HAVE_PNG_GET_VALID 1 +#define HAVE_PNG_SET_TRNS_TO_ALPHA 1 + +/* + * Do we have POSIX threading? + */ + +#define HAVE_PTHREAD 1 +#define HAVE_PTHREAD_H 1 + +/* + * Do we have the ALSA library? + */ + +/* #undef HAVE_ALSA_ASOUNDLIB_H */ + +/* + * Do we have the long long type? + */ + +#define HAVE_LONG_LONG 1 + +#ifdef HAVE_LONG_LONG +# define FLTK_LLFMT "%lld" +# define FLTK_LLCAST (long long) +#else +# define FLTK_LLFMT "%ld" +# define FLTK_LLCAST (long) +#endif /* HAVE_LONG_LONG */ + +/* + * Do we have the dlsym() function and header? + */ + +#define HAVE_DLFCN_H 1 +#define HAVE_DLSYM 1 + +/* + * Do we want print support? + */ + +/* #undef NO_PRINT_SUPPORT */ + +/* + * Do we want filename handling and a filechooser? + */ + +/* #undef FL_CFG_NO_FILESYSTEM_SUPPORT */ + +/* + * End of "$Id: configh.cmake.in 11262 2016-03-02 00:54:37Z matt $". + */ diff --git a/Android/jni/Android.mk b/Android/jni/Android.mk index 9e64d8042..b42a34894 100644 --- a/Android/jni/Android.mk +++ b/Android/jni/Android.mk @@ -12,15 +12,187 @@ # See the License for the specific language governing permissions and # limitations under the License. # -LOCAL_PATH := $(call my-dir) +TOP_PATH := $(call my-dir)/../.. + +################# +## FLTK library include $(CLEAR_VARS) +LOCAL_PATH += $(TOP_PATH)/Android +LOCAL_PATH += $(TOP_PATH) +LOCAL_MODULE := native-activity +LOCAL_C_INCLUDES := $(TOP_PATH) + +LOCAL_SRC_FILES := \ + src/Fl.cxx \ + src/Fl_Adjuster.cxx \ + src/Fl_Bitmap.cxx \ + src/Fl_Browser.cxx \ + src/Fl_Browser_.cxx \ + src/Fl_Browser_load.cxx \ + src/Fl_Box.cxx \ + src/Fl_Button.cxx \ + src/Fl_Chart.cxx \ + src/Fl_Check_Browser.cxx \ + src/Fl_Check_Button.cxx \ + src/Fl_Choice.cxx \ + src/Fl_Clock.cxx \ + src/Fl_Color_Chooser.cxx \ + src/Fl_Copy_Surface.cxx \ + src/Fl_Counter.cxx \ + src/Fl_Device.cxx \ + src/Fl_Dial.cxx \ + src/Fl_Help_Dialog_Dox.cxx \ + src/Fl_Double_Window.cxx \ + src/Fl_File_Browser.cxx \ + src/Fl_File_Chooser.cxx \ + src/Fl_File_Chooser2.cxx \ + src/Fl_File_Icon.cxx \ + src/Fl_File_Input.cxx \ + src/Fl_Graphics_Driver.cxx \ + src/Fl_Group.cxx \ + src/Fl_Help_View.cxx \ + src/Fl_Image.cxx \ + src/Fl_Image_Surface.cxx \ + src/Fl_Input.cxx \ + src/Fl_Input_.cxx \ + src/Fl_Light_Button.cxx \ + src/Fl_Menu.cxx \ + src/Fl_Menu_.cxx \ + src/Fl_Menu_Bar.cxx \ + src/Fl_Menu_Button.cxx \ + src/Fl_Menu_Window.cxx \ + src/Fl_Menu_add.cxx \ + src/Fl_Menu_global.cxx \ + src/Fl_Multi_Label.cxx \ + src/Fl_Native_File_Chooser.cxx \ + src/Fl_Overlay_Window.cxx \ + src/Fl_Pack.cxx \ + src/Fl_Paged_Device.cxx \ + src/Fl_Pixmap.cxx \ + src/Fl_Positioner.cxx \ + src/Fl_Preferences.cxx \ + src/Fl_Printer.cxx \ + src/Fl_Progress.cxx \ + src/Fl_Repeat_Button.cxx \ + src/Fl_Return_Button.cxx \ + src/Fl_Roller.cxx \ + src/Fl_Round_Button.cxx \ + src/Fl_Screen_Driver.cxx \ + src/Fl_Scroll.cxx \ + src/Fl_Scrollbar.cxx \ + src/Fl_Shared_Image.cxx \ + src/Fl_Single_Window.cxx \ + src/Fl_Slider.cxx \ + src/Fl_Table.cxx \ + src/Fl_Table_Row.cxx \ + src/Fl_Tabs.cxx \ + src/Fl_Text_Buffer.cxx \ + src/Fl_Text_Display.cxx \ + src/Fl_Text_Editor.cxx \ + src/Fl_Tile.cxx \ + src/Fl_Tiled_Image.cxx \ + src/Fl_Tooltip.cxx \ + src/Fl_Tree.cxx \ + src/Fl_Tree_Item_Array.cxx \ + src/Fl_Tree_Item.cxx \ + src/Fl_Tree_Prefs.cxx \ + src/Fl_Valuator.cxx \ + src/Fl_Value_Input.cxx \ + src/Fl_Value_Output.cxx \ + src/Fl_Value_Slider.cxx \ + src/Fl_Widget.cxx \ + src/Fl_Widget_Surface.cxx \ + src/Fl_Window.cxx \ + src/Fl_Window_Driver.cxx \ + src/Fl_Window_fullscreen.cxx \ + src/Fl_Window_hotspot.cxx \ + src/Fl_Window_iconize.cxx \ + src/Fl_Window_shape.cxx \ + src/Fl_Wizard.cxx \ + src/Fl_XBM_Image.cxx \ + src/Fl_XPM_Image.cxx \ + src/Fl_abort.cxx \ + src/Fl_add_idle.cxx \ + src/Fl_arg.cxx \ + src/Fl_compose.cxx \ + src/Fl_display.cxx \ + src/Fl_get_key.cxx \ + src/Fl_get_system_colors.cxx \ + src/Fl_grab.cxx \ + src/Fl_lock.cxx \ + src/Fl_own_colormap.cxx \ + src/Fl_visual.cxx \ + src/Fl_x.cxx \ + src/filename_absolute.cxx \ + src/filename_expand.cxx \ + src/filename_ext.cxx \ + src/filename_isdir.cxx \ + src/filename_list.cxx \ + src/filename_match.cxx \ + src/filename_setext.cxx \ + src/fl_arc.cxx \ + src/fl_ask.cxx \ + src/fl_boxtype.cxx \ + src/fl_color.cxx \ + src/fl_cursor.cxx \ + src/fl_curve.cxx \ + src/fl_diamond_box.cxx \ + src/fl_dnd.cxx \ + src/fl_draw.cxx \ + src/fl_draw_pixmap.cxx \ + src/fl_engraved_label.cxx \ + src/fl_file_dir.cxx \ + src/fl_font.cxx \ + src/fl_gleam.cxx \ + src/fl_gtk.cxx \ + src/fl_labeltype.cxx \ + src/fl_line_style.cxx \ + src/fl_open_uri.cxx \ + src/fl_oval_box.cxx \ + src/fl_overlay.cxx \ + src/fl_overlay_visual.cxx \ + src/fl_plastic.cxx \ + src/fl_read_image.cxx \ + src/fl_rect.cxx \ + src/fl_round_box.cxx \ + src/fl_rounded_box.cxx \ + src/fl_set_font.cxx \ + src/fl_scroll_area.cxx \ + src/fl_shadow_box.cxx \ + src/fl_shortcut.cxx \ + src/fl_show_colormap.cxx \ + src/fl_symbols.cxx \ + src/fl_vertex.cxx \ + src/screen_xywh.cxx \ + src/fl_utf8.cxx \ + src/fl_encoding_latin1.cxx \ + src/fl_encoding_mac_roman.cxx \ + src/drivers/Pico/Fl_Pico_System_Driver.cxx \ + src/drivers/Pico/Fl_Pico_Screen_Driver.cxx \ + src/drivers/Pico/Fl_Pico_Window_Driver.cxx \ + src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx \ + src/drivers/Pico/Fl_Pico_Copy_Surface.cxx \ + src/drivers/Pico/Fl_Pico_Image_Surface.cxx \ + src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx \ + src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx \ + src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx \ + src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx \ + src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx \ + src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx \ + test/hello.cxx + +#Android/jni/main.c + + +LOCAL_CFLAGS := -DFL_PORTING -DANDROID -DFL_PICO_ANDROID -DFL_LIBRARY -LOCAL_MODULE := native-activity -LOCAL_SRC_FILES := main.c LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM LOCAL_STATIC_LIBRARIES := android_native_app_glue include $(BUILD_SHARED_LIBRARY) + + + $(call import-module,android/native_app_glue) diff --git a/Android/mk b/Android/mk new file mode 100755 index 000000000..c921c69d7 --- /dev/null +++ b/Android/mk @@ -0,0 +1,7 @@ + +ndk-build +android update project --path . --name native +ant debug +adb install -r bin/native-debug.apk +./adb-run.sh bin/native-debug.apk +adb logcat | grep native-activity diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index 63aa67ec0..2888b85fc 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -73,6 +73,7 @@ class FL_EXPORT Fl_Window : public Fl_Group { friend class Fl_X; friend class Fl_Window_Driver; friend class Fl_PicoSDL_Window_Driver; + friend class Fl_PicoAndroid_Window_Driver; Fl_X *i; // points at the system-specific stuff, but exists only after the window is mapped Fl_Window_Driver *pWindowDriver; // points at the system-specific stuff at window creatino time diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H index 2ab4bf192..d36774535 100644 --- a/FL/Fl_Window_Driver.H +++ b/FL/Fl_Window_Driver.H @@ -28,6 +28,7 @@ class Fl_Window; +class Fl_X; class Fl_Image; diff --git a/FL/porting.H b/FL/porting.H index 01984aa71..d2a51912a 100644 --- a/FL/porting.H +++ b/FL/porting.H @@ -24,7 +24,6 @@ # error "Never use <FL/porting.H> directly; include <FL/x.H> instead." #endif // !Fl_X_H - typedef void *Window; #if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program @@ -61,7 +60,6 @@ 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) @@ -31,26 +31,8 @@ # include "win32.H" # elif defined(__APPLE__) // PORTME: Fl_Window_Driver - Fl_X Window Driver interface # include "mac.H" -# elif defined(ANDROID) -# pragma message "A clean port requires a driver-style system for Fl_X" # elif defined(USE_SDL) # pragma message "FL_PORTING: write a header file based on this file, win32.H, or mac.H to define the FLTK core internals" - -//typedef void *Window; -//typedef void *Fl_Region; -//typedef void *Fl_Bitmask; -//typedef void *Fl_Offscreen; -//#include <FL/Fl_Window.H> -//class FL_EXPORT Fl_X { -//public: -// Window xid; -// Window other_xid; -// Fl_X *next; -// char wait_for_expose; -// static Fl_X* first; -// static Fl_X* i(const Fl_Window* wi) {return (Fl_X*)wi->i;} -//}; - # include "porting.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" diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 82af113b7..f2092296b 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -29,6 +29,8 @@ class Fl_Widget *fl_selection_requestor; //# include "Fl_mac.cxx" // now Fl_cocoa.mm #elif defined(USE_SDL) # pragma message "FL_SDL: implement the FLTK core in its own file" +#elif defined(ANDROID) +# pragma message "ANDROID: implement the FLTK core in its own file" #elif defined(FL_PORTING) # pragma message "FL_PORTING: implement the FLTK core in its own file" # include "Fl_porting.cxx" diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.H new file mode 100644 index 000000000..ea31c3771 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.H @@ -0,0 +1,15 @@ + +class Fl_Copy_Surface::Helper : public Fl_Widget_Surface { // class model + friend class Fl_Copy_Surface; +private: + int width; + int height; + Helper(int w, int h) : Fl_Widget_Surface(NULL), width(w), height(h) {} // to implement + ~Helper() {} // to implement + void set_current(){} // to implement + void translate(int x, int y) {} // to implement + void untranslate() {} // to implement + int w() {return width;} + int h() {return height;} + int printable_rect(int *w, int *h) {*w = width; *h = height; return 0;} +}; diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Copy_Surface.cxx @@ -0,0 +1 @@ + diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H new file mode 100644 index 000000000..583fc72fa --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.H @@ -0,0 +1,125 @@ + +// +// "$Id: Fl_PicoAndroid_Graphics_Driver.H 11017 2016-01-20 21:40:12Z matt $" +// +// Definition of the Pico Android graphics driver +// for the Fast Light Tool Kit (FLTK). +// +// Copyright 2010-2016 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 +// + +/** + \file Fl_PicoAndroid_Graphics_Driver.H + \brief Definition of Pico minimal graphics driver. + */ + +#ifndef FL_PICOANDROID_GRAPHICS_DRIVER_H +#define FL_PICOANDROID_GRAPHICS_DRIVER_H + +#include "../Pico/Fl_Pico_Graphics_Driver.H" + + +/** + \brief The Pico minimal SDL graphics class. + * + This class is implemented as a base class for minimal core SDL drivers. + */ +class Fl_PicoAndroid_Graphics_Driver : public Fl_Pico_Graphics_Driver { +protected: + // CGContextRef gc_; +public: + // virtual int has_feature(driver_feature mask) { return mask & NATIVE; } + // virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (CGContextRef)ctxt; } + // virtual void *gc() {return gc_;} + // char can_do_alpha_blending(); + // + // // --- bitmap stuff + // Fl_Bitmask create_bitmask(int w, int h, const uchar *array); + // void delete_bitmask(Fl_Bitmask bm); + // void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); + // void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); + // void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy); + // int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP); + // void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0); + // void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); + // void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0); + // void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); + // fl_uintptr_t cache(Fl_Pixmap *img, int w, int h, const char *const*array); + // fl_uintptr_t cache(Fl_Bitmap *img, int w, int h, const uchar *array); + // void uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_uintptr_t &mask_); + // void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy); + // void draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh); + //protected: + // // --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/quartz_rect.cxx + void point(int x, int y); + // void rect(int x, int y, int w, int h); + void rectf(int x, int y, int w, int h); + void line(int x, int y, int x1, int y1); + // void line(int x, int y, int x1, int y1, int x2, int y2); + // void xyline(int x, int y, int x1); + // void xyline(int x, int y, int x1, int y2); + // void xyline(int x, int y, int x1, int y2, int x3); + // void yxline(int x, int y, int y1); + // void yxline(int x, int y, int y1, int x2); + // void yxline(int x, int y, int y1, int x2, int y3); + // void loop(int x0, int y0, int x1, int y1, int x2, int y2); + // void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); + // void polygon(int x0, int y0, int x1, int y1, int x2, int y2); + // void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); + // // --- clipping + // void push_clip(int x, int y, int w, int h); + // int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); + // int not_clipped(int x, int y, int w, int h); + // void push_no_clip(); + // void pop_clip(); + // void restore_clip(); + // // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx + // void begin_complex_polygon(); + // void transformed_vertex(double xf, double yf); + // void vertex(double x, double y); + // void end_points(); + // void end_line(); + // void end_loop(); + // void end_polygon(); + // void end_complex_polygon(); + // void gap(); + // void circle(double x, double y, double r); + // // --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed + // // using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end); + // // --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx + // void arc(int x, int y, int w, int h, double a1, double a2); + // void pie(int x, int y, int w, int h, double a1, double a2); + // // --- implementation is in src/fl_line_style.cxx which includes src/cfg_gfx/xxx_line_style.cxx + // void line_style(int style, int width=0, char* dashes=0); + // // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx + // void color(Fl_Color c); + // Fl_Color color() { return color_; } + // void color(uchar r, uchar g, uchar b); + // // --- implementation is in src/fl_font.cxx which includes src/cfg_gfx/xxx_font.cxx + // void draw(const char *str, int n, int x, int y); + // void draw(const char *str, int n, float x, float y); + // void draw(int angle, const char *str, int n, int x, int y); + // void rtl_draw(const char *str, int n, int x, int y); + // void font(Fl_Font face, Fl_Fontsize fsize); + // double width(const char *str, int n); + // double width(unsigned int c); + // void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); + // int height(); + // int descent(); +}; + +#endif // FL_PICOANDROID_GRAPHICS_DRIVER_H + +// +// End of "$Id: Fl_PicoAndroid_Graphics_Driver.H 11017 2016-01-20 21:40:12Z matt $". +// diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx new file mode 100644 index 000000000..81fa3efab --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Graphics_Driver.cxx @@ -0,0 +1,69 @@ +// +// "$Id: Fl_PicoAndroid_Graphics_Driver.cxx 11241 2016-02-27 13:52:27Z manolo $" +// +// Rectangle drawing routines for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2016 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_lib.h" +#include "Fl_PicoAndroid_Graphics_Driver.h" + +#include <FL/Fl.H> +//#define __APPLE__ +//#include <SDL2/SDL.h> +//#undef __APPLE__ + +/* + * By linking this module, the following static method will instatiate the + * PicoSDL Graphics driver as the main display driver. + */ +Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() +{ + return new Fl_PicoAndroid_Graphics_Driver(); +} + + +void Fl_PicoAndroid_Graphics_Driver::rectf(int x, int y, int w, int h) +{ +// uchar r, g, b; +// Fl::get_color(Fl_Graphics_Driver::color(), r, g, b); +// SDL_SetRenderDrawColor((SDL_Renderer*)fl_window, r, g, b, SDL_ALPHA_OPAQUE); +// SDL_Rect rect = {x, y, w, h}; +// SDL_RenderFillRect((SDL_Renderer*)fl_window, &rect); +} + + +void Fl_PicoAndroid_Graphics_Driver::line(int x, int y, int x1, int y1) +{ +// uchar r, g, b; +// Fl::get_color(Fl_Graphics_Driver::color(), r, g, b); +// SDL_SetRenderDrawColor((SDL_Renderer*)fl_window, r, g, b, SDL_ALPHA_OPAQUE); +// SDL_RenderDrawLine((SDL_Renderer*)fl_window, x, y, x1, y1); +} + + +void Fl_PicoAndroid_Graphics_Driver::point(int x, int y) +{ +// uchar r, g, b; +// Fl::get_color(Fl_Graphics_Driver::color(), r, g, b); +// SDL_SetRenderDrawColor((SDL_Renderer*)fl_window, r, g, b, SDL_ALPHA_OPAQUE); +// SDL_RenderDrawPoint((SDL_Renderer*)fl_window, x, y); +} + + + +// +// End of "$Id: Fl_PicoAndroid_Graphics_Driver.cxx 11241 2016-02-27 13:52:27Z manolo $". +// diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.H new file mode 100644 index 000000000..05202afdd --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.H @@ -0,0 +1,15 @@ +class Fl_Image_Surface::Helper : public Fl_Widget_Surface { // class model + friend class Fl_Image_Surface; +public: + Fl_Offscreen offscreen; + int width; + int height; + Helper(int w, int h, int high_res) : Fl_Widget_Surface(NULL), width(w), height(h) {} // to implement + ~Helper() {} // to implement + void set_current(){} // to implement + void translate(int x, int y) {} // to implement + void untranslate() {} // to implement + Fl_RGB_Image *image() {} // to implement + void end_current() {} // to implement + int printable_rect(int *w, int *h) {*w = width; *h = height; return 0;} +}; diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Image_Surface.cxx @@ -0,0 +1 @@ + diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H new file mode 100644 index 000000000..f0e0efdd0 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.H @@ -0,0 +1,44 @@ +// +// "$Id: Fl_PicoAndroid_Screen_Driver.H 11017 2016-01-20 21:40:12Z matt $" +// +// Definition of Android Screen interface based on Pico +// for the Fast Light Tool Kit (FLTK). +// +// Copyright 2010-2016 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 +// + +/** + \file Fl_PicoAndroid_Screen_Driver.H + \brief Definition of SDL Screen interface based on Pico. + */ + +#ifndef FL_PICOANDROID_SCREEN_DRIVER_H +#define FL_PICOANDROID_SCREEN_DRIVER_H + +#include "../Pico/Fl_Pico_Screen_Driver.H" + + +class FL_EXPORT Fl_PicoAndroid_Screen_Driver : public Fl_Pico_Screen_Driver +{ +public: + Fl_PicoAndroid_Screen_Driver(); + virtual ~Fl_PicoAndroid_Screen_Driver(); + virtual double wait(double time_to_wait); +}; + + +#endif // FL_PICOANDROID_SCREEN_DRIVER_H + +// +// End of "$Id: Fl_PicoAndroid_Screen_Driver.H 11017 2016-01-20 21:40:12Z matt $". +// diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx new file mode 100644 index 000000000..cbe0c9ed7 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx @@ -0,0 +1,181 @@ +// +// "$Id: Fl_PicoAndroid_Screen_Driver.cxx 11253 2016-03-01 00:54:21Z matt $" +// +// Definition of Android Screen interface based on Pico +// +// Copyright 1998-2016 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_lib.h" +#include "Fl_PicoAndroid_Screen_Driver.H" + +#include <FL/Fl_Window_Driver.H> + +//#define __APPLE__ +//#include <SDL2/SDL.h> +//#undef __APPLE__ + + +Fl_Screen_Driver* Fl_Screen_Driver::newScreenDriver() +{ + return new Fl_PicoAndroid_Screen_Driver(); +} + + +Fl_PicoAndroid_Screen_Driver::Fl_PicoAndroid_Screen_Driver() +{ +} + +Fl_PicoAndroid_Screen_Driver::~Fl_PicoAndroid_Screen_Driver() +{ +} + + +double Fl_PicoAndroid_Screen_Driver::wait(double time_to_wait) +{ + Fl::flush(); +// SDL_Event e; +// if (SDL_PollEvent(&e)) { +// switch (e.type) { +// case SDL_QUIT: +// exit(0); +// case SDL_WINDOWEVENT_EXPOSED: +// case SDL_WINDOWEVENT_SHOWN: +// { // not happening! +// //event->window.windowID +// Fl_Window *window = Fl::first_window(); +// if ( !window ) break;; +// Fl_X *i = Fl_X::i(Fl::first_window()); +// i->wait_for_expose = 0; +// +// if ( i->region ) { +// XDestroyRegion(i->region); +// i->region = 0; +// } +// window->clear_damage(FL_DAMAGE_ALL); +// i->flush(); +// window->clear_damage(); +// Fl_X::first->wait_for_expose = 0; +// } +// break; +// +// } +// } + return 0.0; +} + + + +#include <FL/x.H> +#include <FL/Fl.H> +#include <FL/Fl_Image_Surface.H> +#include <FL/Fl_Double_Window.H> +#include <FL/Fl_Graphics_Driver.H> + +/* + * The following code should not be here! + * All this must be refactored into the driver system! + */ + +/* + + The following symbols are not found if we naively compile the core modules and + no specific platform implementations. This list is a hint at all the functions + and methods that probably need to be refactored into the driver system. + + Undefined symbols for architecture x86_64: + */ + +void fl_set_spot(int, int, int, int, int, int, Fl_Window*) { } +void fl_reset_spot() { } +const char *fl_filename_name(char const*) { return 0; } +void fl_clipboard_notify_change() { } + +//Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() { return 0; } +//Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { return 0; } +void Fl_Graphics_Driver::global_gc() { } +int Fl::dnd() { return 0; } +void Fl::copy(char const*, int, int, char const*) { } +void Fl::paste(Fl_Widget&, int, char const*) { } +void Fl::get_mouse(int&, int&) { } +void Fl::set_color(unsigned int, unsigned int) { } +int Fl_X::set_cursor(Fl_Cursor) { return 0; } +int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; } +void Fl_X::set_default_icons(Fl_RGB_Image const**, int) { } + +void Fl_X::flush() +{ + w->driver()->flush(); +} + +void Fl_X::set_icons() { } +void Fl_Window::size_range_() { } +void Fl_Window::fullscreen_x() { } + +void Fl_Window::make_current() +{ + fl_window = i->xid; + current_ = this; +} + +void Fl_Window::fullscreen_off_x(int, int, int, int) { } + +Window fl_xid(const Fl_Window* w) +{ + Fl_X *temp = Fl_X::i(w); + return temp ? temp->xid : 0; +} + +void Fl_Window::show() { + if (!shown()) { + Fl_X::make(this); + } +} + +Fl_X* Fl_X::make(Fl_Window *w) +{ + return w->driver()->makeWindow(); +} + +void Fl_Window::label(char const*, char const*) { } +void Fl_Window::resize(int, int, int, int) { } +Fl_Window *Fl_Window::current_; +char fl_show_iconic; +Window fl_window; +//void Fl_Image_Surface::translate(int x, int y) { } +//void Fl_Image_Surface::untranslate() { } + +void Fl::add_fd(int, void (*)(int, void*), void*) +{ +} + +void Fl::remove_fd(int) +{ +} + +int Fl_Window::decorated_h() +{ + return h(); +} + +int Fl_Window::decorated_w() +{ + return w(); +} + + +// +// End of "$Id: Fl_PicoAndroid_Screen_Driver.cxx 11253 2016-03-01 00:54:21Z matt $". +// + diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.H @@ -0,0 +1 @@ + diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_System_Driver.cxx @@ -0,0 +1 @@ + diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H new file mode 100644 index 000000000..250280a12 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.H @@ -0,0 +1,51 @@ +// +// "$Id: Fl_PicoAndroid_Window_Driver.H 11017 2016-01-20 21:40:12Z matt $" +// +// Definition of Android Window interface +// for the Fast Light Tool Kit (FLTK). +// +// Copyright 2010-2016 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 +// + +/** + \file Fl_PicoAndroid_Window_Driver.H + \brief Definition of SDL Window interface. + */ + +#ifndef FL_PICOANDROID_WINDOW_DRIVER_H +#define FL_PICOANDROID_WINDOW_DRIVER_H + +#include "../Pico/Fl_Pico_Window_Driver.H" + +//#define __APPLE__ +//#include <SDL2/SDL.h> +//#undef __APPLE__ + + +class FL_EXPORT Fl_PicoAndroid_Window_Driver : public Fl_Pico_Window_Driver +{ +// SDL_Window *pNativeWindow; +public: + Fl_PicoAndroid_Window_Driver(Fl_Window *win); + virtual ~Fl_PicoAndroid_Window_Driver(); + + virtual Fl_X *makeWindow(); + virtual void flush(); +}; + + +#endif // FL_PICOSDL_WINDOW_DRIVER_H + +// +// End of "$Id: Fl_PicoSDL_Window_Driver.H 11017 2016-01-20 21:40:12Z matt $". +// diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx new file mode 100644 index 000000000..fc0afc339 --- /dev/null +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx @@ -0,0 +1,91 @@ +// +// "$Id: Fl_PicoAndroid_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $" +// +// Definition of Android Window interface based on SDL +// +// Copyright 1998-2016 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_lib.h" +#include "Fl_PicoAndroid_Window_Driver.H" +#include <FL/Fl.H> + + +Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *win) +{ + return new Fl_PicoAndroid_Window_Driver(win); +} + + +Fl_PicoAndroid_Window_Driver::Fl_PicoAndroid_Window_Driver(Fl_Window *win) +: Fl_Pico_Window_Driver(win) +{ +} + + +Fl_PicoAndroid_Window_Driver::~Fl_PicoAndroid_Window_Driver() +{ +} + + +Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow() +{ + Fl_Group::current(0); + if (pWindow->parent() && !Fl_X::i(pWindow->window())) { + pWindow->set_visible(); + return 0L; + } + Window parent; + if (pWindow->parent()) { + parent = fl_xid(pWindow->window()); + } else { + parent = 0; + } + Fl_X *x = new Fl_X; + x->other_xid = 0; + x->w = pWindow; + x->region = 0; + if (!pWindow->force_position()) { +// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pWindow->w(), pWindow->h(), 0); + } else { +// pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0); + } +// x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED); + x->next = Fl_X::first; + x->wait_for_expose = 0; + pWindow->i = x; + Fl_X::first = x; + + pWindow->set_visible(); + pWindow->redraw(); + flush(); + int old_event = Fl::e_number; + pWindow->handle(Fl::e_number = FL_SHOW); + Fl::e_number = old_event; + + return x; +} + + +void Fl_PicoAndroid_Window_Driver::flush() +{ +// SDL_RenderClear((SDL_Renderer*)fl_window); + pWindow->flush(); +// SDL_RenderPresent((SDL_Renderer*)fl_window); +} + + +// +// End of "$Id: Fl_PicoSDL_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $". +//
\ No newline at end of file |
