diff options
-rw-r--r-- | FL/Fl.H | 8 | ||||
-rw-r--r-- | FL/Fl_Device.H | 16 | ||||
-rw-r--r-- | FL/Fl_Native_File_Chooser_MAC.H | 5 | ||||
-rw-r--r-- | FL/Fl_PostScript.H | 13 | ||||
-rw-r--r-- | FL/Fl_Printer.H | 10 | ||||
-rw-r--r-- | FL/Fl_Tree.H | 6 | ||||
-rw-r--r-- | FL/mac.H | 5 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | documentation/src/drawing.dox | 11 | ||||
-rw-r--r-- | src/Fl_Double_Window.cxx | 43 | ||||
-rw-r--r-- | src/Fl_Gl_Choice.cxx | 37 | ||||
-rw-r--r-- | src/Fl_Gl_Device_Plugin.cxx | 5 | ||||
-rw-r--r-- | src/Fl_Group.cxx | 53 | ||||
-rw-r--r-- | src/Fl_Scroll.cxx | 21 | ||||
-rw-r--r-- | src/Fl_Tree.cxx | 10 | ||||
-rw-r--r-- | src/Fl_cocoa.mm | 2 | ||||
-rw-r--r-- | src/Fl_get_key_mac.cxx | 10 | ||||
-rw-r--r-- | src/fl_cursor.cxx | 6 | ||||
-rw-r--r-- | test/button.cxx | 6 | ||||
-rw-r--r-- | test/checkers.cxx | 10 | ||||
-rw-r--r-- | test/unittest_scrollbarsize.cxx | 6 |
21 files changed, 185 insertions, 104 deletions
@@ -1,5 +1,5 @@ // -// "$Id: Fl.H 7334 2010-03-25 14:37:46Z AlbrechtS $" +// "$Id: Fl.H 7720 2010-10-12 12:34:19Z manolo $" // // Main header file for the Fast Light Tool Kit (FLTK). // @@ -779,7 +779,9 @@ public: /** @} */ /** \defgroup fl_drawings Drawing functions - fl global graphics and gui drawing functions + FLTK global graphics and GUI drawing functions. + These functions are declared in <FL/fl_draw.H>, + and in <FL/x.H> for offscreen buffer-related ones. @{ */ // <Hack to re-order the 'Drawing functions' group> /** @} */ @@ -1083,5 +1085,5 @@ public: #endif // !Fl_H // -// End of "$Id: Fl.H 7334 2010-03-25 14:37:46Z AlbrechtS $". +// End of "$Id: Fl.H 7720 2010-10-12 12:34:19Z manolo $". // diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index e4fe863..672dd9b 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Device.H 7701 2010-09-07 12:22:58Z manolo $" +// "$Id: Fl_Device.H 7719 2010-10-12 09:25:37Z manolo $" // // Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device // for the Fast Light Tool Kit (FLTK). @@ -94,16 +94,8 @@ public: * The protected virtual methods of this class are those that a graphics driver should implement to support all of FLTK drawing functions. - <br> The preferred FLTK API for drawing operations is the function collection of the - \ref fl_drawings and \ref fl_attributes modules. - <br> Alternatively, methods of the Fl_Graphics_Driver class can be called - using the global variable Fl_Graphics_Driver * \ref fl_graphics_driver that points at all time to - the single driver (an instance of an Fl_Graphics_Driver subclass) that's currently receiving graphics - requests. For example: - \code fl_graphics_driver->rect(x, y, w, h); \endcode - <br>Each protected method of the Fl_Graphics_Driver class has the same effect as the - function of the \ref fl_drawings and \ref fl_attributes modules which bears the same name - prefixed with fl_ and has the same parameter list. + <br> The public API for drawing operations is functionally presented in \ref drawing and as function lists + in the \ref fl_drawings and \ref fl_attributes modules. */ class Fl_Graphics_Driver : public Fl_Device { protected: @@ -385,5 +377,5 @@ public: #endif // Fl_Device_H // -// End of "$Id: Fl_Device.H 7701 2010-09-07 12:22:58Z manolo $". +// End of "$Id: Fl_Device.H 7719 2010-10-12 09:25:37Z manolo $". // diff --git a/FL/Fl_Native_File_Chooser_MAC.H b/FL/Fl_Native_File_Chooser_MAC.H index d9668cf..78ab4b7 100644 --- a/FL/Fl_Native_File_Chooser_MAC.H +++ b/FL/Fl_Native_File_Chooser_MAC.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Native_File_Chooser_MAC.H 7354 2010-03-29 11:07:29Z matt $" +// "$Id: Fl_Native_File_Chooser_MAC.H 7715 2010-10-11 18:10:32Z greg.ercolano $" // // FLTK native OS file chooser widget // @@ -30,7 +30,6 @@ // OSX-SPECIFIC NATIVE BROWSER #include <Carbon/Carbon.h> -#include <config.h> #undef check // necessary for use of Fl::check() @@ -118,5 +117,5 @@ public: #endif /*!FL_DOXYGEN*/ // -// End of "$Id: Fl_Native_File_Chooser_MAC.H 7354 2010-03-29 11:07:29Z matt $". +// End of "$Id: Fl_Native_File_Chooser_MAC.H 7715 2010-10-11 18:10:32Z greg.ercolano $". // diff --git a/FL/Fl_PostScript.H b/FL/Fl_PostScript.H index 0cd2365..ae285e7 100644 --- a/FL/Fl_PostScript.H +++ b/FL/Fl_PostScript.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_PostScript.H 7700 2010-09-07 11:45:08Z manolo $" +// "$Id: Fl_PostScript.H 7719 2010-10-12 09:25:37Z manolo $" // // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK). // @@ -243,11 +243,7 @@ class Clip { void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0){draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);}; void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3){draw_scaled_image(call,data, x, y, w, h, w, h, delta);}; void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1){draw_scaled_image_mono(call, data, x, y, w, h, w, h, delta);}; - - void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy); - void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy); - void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy); - + public: void page_policy(int p); int page_policy(){return page_policy_;}; @@ -265,6 +261,9 @@ public: void place(double x, double y, double tx, double ty, double scale = 1); #endif // FL_DOXYGEN Fl_PostScript_Graphics_Driver(); + void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy); + void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy); + void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy); ~Fl_PostScript_Graphics_Driver(); }; @@ -305,5 +304,5 @@ public: #endif // Fl_PostScript_H // -// End of "$Id: Fl_PostScript.H 7700 2010-09-07 11:45:08Z manolo $" +// End of "$Id: Fl_PostScript.H 7719 2010-10-12 09:25:37Z manolo $" // diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H index 9145083..6247763 100644 --- a/FL/Fl_Printer.H +++ b/FL/Fl_Printer.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Printer.H 7662 2010-07-01 15:35:28Z manolo $" +// "$Id: Fl_Printer.H 7719 2010-10-12 09:25:37Z manolo $" // // Printing support for the Fast Light Tool Kit (FLTK). // @@ -45,6 +45,7 @@ /** \brief Print support under MSWindows and Mac OS X. * + Class Fl_System_Printer is implemented only on the MSWindows and Mac OS X platforms. Use Fl_Printer instead that is cross-platform and has the same API. Fl_Printer is typedef'ed to Fl_System_Printer under MSWindows and Mac OS X. */ @@ -123,6 +124,7 @@ typedef Fl_System_Printer Fl_Printer; /** \brief Print support under Unix/Linux. * + Class Fl_PostScript_Printer is implemented only on the Unix/Linux platform. Use Fl_Printer instead that is cross-platform and has the same API. Fl_Printer is typedef'ed to Fl_PostScript_Printer under Unix/Linux. */ @@ -168,7 +170,7 @@ typedef Fl_PostScript_Printer Fl_Printer; <ul><li>Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it appears on screen, with optional translation, scaling and rotation. This is done by calling print_widget() or print_window_part(). - <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip) to + <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip, image) to compose a page appropriately shaped for printing. </ul> In both cases, begin by start_job(), start_page(), printable_rect() and origin() calls @@ -179,7 +181,7 @@ typedef Fl_PostScript_Printer Fl_Printer; <ul> <li>Unix/Linux platforms: Class Fl_RGB_Image prints but loses its transparency if it has one. - PostScript text output is presently restricted to the Latin alphabet. + See class Fl_PostScript_Graphics_Driver for a description of how UTF-8 strings appear in print. Use the static public attributes of this class to set the print dialog to other languages than English. For example, the "Printer:" dialog item Fl_Printer::dialog_printer can be set to French with: \code @@ -266,5 +268,5 @@ public: #endif // Fl_Printer_H // -// End of "$Id: Fl_Printer.H 7662 2010-07-01 15:35:28Z manolo $" +// End of "$Id: Fl_Printer.H 7719 2010-10-12 09:25:37Z manolo $" // diff --git a/FL/Fl_Tree.H b/FL/Fl_Tree.H index d077dc8..8882274 100644 --- a/FL/Fl_Tree.H +++ b/FL/Fl_Tree.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Tree.H 7694 2010-09-02 19:38:08Z yuri $" +// "$Id: Fl_Tree.H 7721 2010-10-12 15:36:16Z greg.ercolano $" // #ifndef FL_TREE_H @@ -143,7 +143,6 @@ protected: Fl_Scrollbar *_vscroll; protected: - void set_item_focus(Fl_Tree_Item *o); void item_clicked(Fl_Tree_Item* val); /// Do the callback for the item, setting the item and reason void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason) { @@ -564,6 +563,7 @@ public: int deselect_all(Fl_Tree_Item *item=0, int docallback=1); int select_only(Fl_Tree_Item *selitem, int docallback=1); int select_all(Fl_Tree_Item *item=0, int docallback=1); + void set_item_focus(Fl_Tree_Item *o); /// See if the specified \p item is selected. /// @@ -912,5 +912,5 @@ public: #endif /*FL_TREE_H*/ // -// End of "$Id: Fl_Tree.H 7694 2010-09-02 19:38:08Z yuri $". +// End of "$Id: Fl_Tree.H 7721 2010-10-12 15:36:16Z greg.ercolano $". // @@ -1,5 +1,5 @@ // -// "$Id: mac.H 7663 2010-07-01 16:51:28Z manolo $" +// "$Id: mac.H 7715 2010-10-11 18:10:32Z greg.ercolano $" // // Mac header file for the Fast Light Tool Kit (FLTK). // @@ -36,7 +36,6 @@ // Standard MacOS Carbon API includes... #include <Carbon/Carbon.h> -#include <config.h> #ifndef MAC_OS_X_VERSION_10_3 #define MAC_OS_X_VERSION_10_3 1030 @@ -189,6 +188,6 @@ extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0 /** @} */ // -// End of "$Id: mac.H 7663 2010-07-01 16:51:28Z manolo $". +// End of "$Id: mac.H 7715 2010-10-11 18:10:32Z greg.ercolano $". // diff --git a/debian/changelog b/debian/changelog index 57a4b66..31c1c85 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fltk1.3 (1.3~r7725-1) UNRELEASED; urgency=low + + * New upstream snapshot. (Not yet released.) + + -- Aaron M. Ucko <ucko@debian.org> Mon, 25 Oct 2010 23:12:20 -0400 + fltk1.3 (1.3~r7710-1) experimental; urgency=low * New upstream source base, from the UTF-8-based 1.3 branch. diff --git a/documentation/src/drawing.dox b/documentation/src/drawing.dox index 2997095..68bb2df 100644 --- a/documentation/src/drawing.dox +++ b/documentation/src/drawing.dox @@ -925,15 +925,13 @@ This is the same as doing \p draw(x,y,img->w(),img->h(),0,0). \subsection ssect_Offscreen Offscreen Drawing -\todo -Doxygenate the offscreen drawing functions. - Sometimes it can be very useful to generate a complex drawing in memory first and copy it to the screen at a later point in time. This technique can significantly reduce the amount of -repeated drawing. Fl_Double_Window uses offscreen rendering +repeated drawing. Offscreen drawing functions are declared in <FL/x.H>. +Fl_Double_Window uses offscreen rendering to avoid flickering on systems that don't support -double-buffering natively. +double-buffering natively. Fl_Offscreen fl_create_offscreen(int w, int h) @@ -957,8 +955,7 @@ void fl_end_offscreen() \par Quit sending drawing commands to this offscreen buffer. -void fl_copy_offscreen(int x, int y, int w, int h, -Fl_Offscreen osrc, int srcx, int srcy) +void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc, int srcx, int srcy) \par Copy a rectangular area of the size \p w*h from \p srcx,srcy diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 13725b5..56ea98e 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Double_Window.cxx 7671 2010-07-09 17:31:33Z manolo $" +// "$Id: Fl_Double_Window.cxx 7720 2010-10-12 12:34:19Z manolo $" // // Double-buffered window code for the Fast Light Tool Kit (FLTK). // @@ -67,6 +67,15 @@ void Fl_Double_Window::show() { static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy); +/** \addtogroup fl_drawings + @{ + */ +/** Copy a rectangular area of the given offscreen buffer into the current drawing destination. + \param x,y position where to draw the copied rectangle + \param w,h size of the copied rectangle + \param pixmap offscreen buffer containing the rectangle to copy + \param srcx,srcy origin in offscreen buffer of rectangle to copy + */ void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { if( fl_graphics_driver == fl_display_device->driver()) { fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy); @@ -79,6 +88,7 @@ void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx delete img; } } +/** @} */ #if defined(USE_X11) @@ -184,26 +194,35 @@ void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int src extern void fl_restore_clip(); -#elif defined(__APPLE_QUARTZ__) +#elif defined(__APPLE_QUARTZ__) || defined(FL_DOXYGEN) char fl_can_do_alpha_blending() { return 1; } -Fl_Offscreen fl_create_offscreen(int w, int h) { +Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h) { void *data = calloc(w*h,4); CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate( - data, w, h, 8, w*4, lut, kCGImageAlphaNoneSkipLast); + data, w, h, 8, w*4, lut, kCGImageAlphaPremultipliedLast); CGColorSpaceRelease(lut); return (Fl_Offscreen)ctx; } -Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h) { +/** \addtogroup fl_drawings + @{ + */ + +/** + Creation of an offscreen graphics buffer. + \param w,h width and height in pixels of the buffer. + \return the created graphics buffer. + */ +Fl_Offscreen fl_create_offscreen(int w, int h) { void *data = calloc(w*h,4); CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate( - data, w, h, 8, w*4, lut, kCGImageAlphaPremultipliedLast); + data, w, h, 8, w*4, lut, kCGImageAlphaNoneSkipLast); CGColorSpaceRelease(lut); return (Fl_Offscreen)ctx; } @@ -238,6 +257,9 @@ static void fl_copy_offscreen_to_display(int x,int y,int w,int h,Fl_Offscreen os CGDataProviderRelease(src_bytes); } +/** Deletion of an offscreen graphics buffer. + \param ctx the buffer to be deleted. + */ void fl_delete_offscreen(Fl_Offscreen ctx) { if (!ctx) return; void *data = CGBitmapContextGetData((CGContextRef)ctx); @@ -252,6 +274,9 @@ static CGContextRef stack_gc[stack_max]; static Window stack_window[stack_max]; static Fl_Surface_Device *_ss; +/** Send all subsequent drawing commands to this offscreen buffer. + \param ctx the offscreen buffer. + */ void fl_begin_offscreen(Fl_Offscreen ctx) { _ss = fl_surface; fl_display_device->set_current(); @@ -268,6 +293,8 @@ void fl_begin_offscreen(Fl_Offscreen ctx) { fl_push_no_clip(); } +/** Quit sending drawing commands to the current offscreen buffer. + */ void fl_end_offscreen() { Fl_X::q_release_context(); fl_pop_clip(); @@ -282,6 +309,8 @@ void fl_end_offscreen() { _ss->set_current(); } +/** @} */ + extern void fl_restore_clip(); #else @@ -428,5 +457,5 @@ Fl_Double_Window::~Fl_Double_Window() { } // -// End of "$Id: Fl_Double_Window.cxx 7671 2010-07-09 17:31:33Z manolo $". +// End of "$Id: Fl_Double_Window.cxx 7720 2010-10-12 12:34:19Z manolo $". // diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx index a2b30b1..deb456b 100644 --- a/src/Fl_Gl_Choice.cxx +++ b/src/Fl_Gl_Choice.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Choice.cxx 7351 2010-03-29 10:35:00Z matt $" +// "$Id: Fl_Gl_Choice.cxx 7724 2010-10-18 10:49:04Z manolo $" // // OpenGL visual selection code for the Fast Light Tool Kit (FLTK). // @@ -349,11 +349,21 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) { aglSetInteger( context, AGL_BUFFER_RECT, rect ); aglEnable( context, AGL_BUFFER_RECT ); } -# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - aglSetWindowRef(context, MACwindowRef(w) ); -# else - aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) ); -# endif +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 +#if __LP64__ + // 64 bit version + aglSetWindowRef(context, MACwindowRef(w) ); +#else + // 32 bit version >= 10.5 + if (aglSetWindowRef != NULL) + aglSetWindowRef(context, MACwindowRef(w) ); + else + aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) ); +#endif +#else + // 32 bit version < 10.5 + aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) ); +#endif aglSetCurrentContext(context); # else # error unsupported platform @@ -370,12 +380,13 @@ void fl_no_gl_context() { wglMakeCurrent(0, 0); # elif defined(__APPLE_QUARTZ__) // warning: the Quartz version should probably use Core GL (CGL) instead of AGL - AGLContext ctx = aglGetCurrentContext(); -# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if (ctx) aglSetWindowRef(ctx, NULL); -# else - if (ctx) aglSetDrawable(ctx, NULL); -# endif + AGLContext ctx = aglGetCurrentContext(); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + if (aglSetWindowRef != NULL) + { if(ctx) aglSetWindowRef(ctx, NULL ); } + else +#endif + if(ctx) aglSetDrawable( ctx, NULL ); aglSetCurrentContext(0); # else # error unsupported platform @@ -401,5 +412,5 @@ void fl_delete_gl_context(GLContext context) { // -// End of "$Id: Fl_Gl_Choice.cxx 7351 2010-03-29 10:35:00Z matt $". +// End of "$Id: Fl_Gl_Choice.cxx 7724 2010-10-18 10:49:04Z manolo $". // diff --git a/src/Fl_Gl_Device_Plugin.cxx b/src/Fl_Gl_Device_Plugin.cxx index ab34432..c44941f 100644 --- a/src/Fl_Gl_Device_Plugin.cxx +++ b/src/Fl_Gl_Device_Plugin.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Device_Plugin.cxx 7613 2010-05-21 07:15:13Z manolo $" +// "$Id: Fl_Gl_Device_Plugin.cxx 7715 2010-10-11 18:10:32Z greg.ercolano $" // // implementation of class Fl_Gl_Device_Plugin for the Fast Light Tool Kit (FLTK). // @@ -25,6 +25,7 @@ // http://www.fltk.org/str.php // +#include <config.h> #include <FL/Fl_Printer.H> #include <FL/Fl_Gl_Window.H> #include "Fl_Gl_Choice.H" @@ -148,5 +149,5 @@ static Fl_Gl_Device_Plugin Gl_Device_Plugin; FL_EXPORT int fl_gl_load_plugin = 0; // -// End of "$Id: Fl_Gl_Device_Plugin.cxx 7613 2010-05-21 07:15:13Z manolo $". +// End of "$Id: Fl_Gl_Device_Plugin.cxx 7715 2010-10-11 18:10:32Z greg.ercolano $". // diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index 4e8b60f..fc9d7fa 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Group.cxx 7693 2010-08-31 10:01:59Z AlbrechtS $" +// "$Id: Fl_Group.cxx 7718 2010-10-12 08:12:44Z AlbrechtS $" // // Group widget for the Fast Light Tool Kit (FLTK). // @@ -387,16 +387,51 @@ void Fl_Group::clear() { savedfocus_ = 0; resizable_ = this; init_sizes(); + + // we must change the Fl::pushed() widget, if it is one of + // the group's children. Otherwise fl_fix_focus() would send + // lots of events to children that are about to be deleted + // anyway. + + Fl_Widget *pushed = Fl::pushed(); // save pushed() widget + if (contains(pushed)) pushed = this; // set it to be the group, if it's a child + Fl::pushed(this); // for fl_fix_focus etc. + // okay, now it is safe to destroy the children: - while (children_) { - Fl_Widget* w = child(0); // *first* child widget - if (w->parent() == this) { // should always be true - remove(0); // remove child widget first - delete w; // then delete it - } else { // this should never happen ! - remove(0); // remove it only + +#define REVERSE_CHILDREN +#ifdef REVERSE_CHILDREN + // Reverse the order of the children. Doing this and deleting + // always the last child is much faster than the other way around. + if (children_ > 1) { + Fl_Widget *temp; + Fl_Widget **a = (Fl_Widget**)array(); + for (int i=0,j=children_-1; i<children_/2; i++,j--) { + temp = a[i]; + a[i] = a[j]; + a[j] = temp; } } +#endif // REVERSE_CHILDREN + + while (children_) { // delete all children + int idx = children_-1; // last child's index + Fl_Widget* w = child(idx); // last child widget + if (w->parent()==this) { // should always be true + if (children_>2) { // optimized removal + w->parent_ = 0; // reset child's parent + children_--; // update counter + } else { // slow removal + remove(idx); + } + delete w; // delete the child + } else { // should never happen + remove(idx); // remove it anyway + } + } + + if (pushed != this) Fl::pushed(pushed); // reset pushed() widget + } /** @@ -792,5 +827,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const { } // -// End of "$Id: Fl_Group.cxx 7693 2010-08-31 10:01:59Z AlbrechtS $". +// End of "$Id: Fl_Group.cxx 7718 2010-10-12 08:12:44Z AlbrechtS $". // diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx index 4ac025c..0057ead 100644 --- a/src/Fl_Scroll.cxx +++ b/src/Fl_Scroll.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Scroll.cxx 7039 2010-02-07 21:14:35Z AlbrechtS $" +// "$Id: Fl_Scroll.cxx 7718 2010-10-12 08:12:44Z AlbrechtS $" // // Scroll widget for the Fast Light Tool Kit (FLTK). // @@ -32,13 +32,16 @@ /** Clear all but the scrollbars... */ void Fl_Scroll::clear() { - for (int i=children() - 1; i >= 0; i --) { - Fl_Widget* o = child(i); - if (o != &hscrollbar && o != &scrollbar) { - remove(o); - delete o; - } - } + // Note: the scrollbars are removed from the group before calling + // Fl_Group::clear() to take advantage of the optimized widget removal + // and deletion. Finally they are added to Fl_Scroll's group again. This + // is MUCH faster than removing the widgets one by one (STR #2409). + + remove(scrollbar); + remove(hscrollbar); + Fl_Group::clear(); + add(hscrollbar); + add(scrollbar); } /** Insure the scrollbars are the last children */ @@ -413,5 +416,5 @@ int Fl_Scroll::handle(int event) { } // -// End of "$Id: Fl_Scroll.cxx 7039 2010-02-07 21:14:35Z AlbrechtS $". +// End of "$Id: Fl_Scroll.cxx 7718 2010-10-12 08:12:44Z AlbrechtS $". // diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx index 08516d9..57f7992 100644 --- a/src/Fl_Tree.cxx +++ b/src/Fl_Tree.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Tree.cxx 7691 2010-08-26 13:32:30Z greg.ercolano $" +// "$Id: Fl_Tree.cxx 7722 2010-10-12 15:46:30Z greg.ercolano $" // #include <stdio.h> @@ -304,8 +304,10 @@ Fl_Tree_Item *Fl_Tree::next_visible_item(Fl_Tree_Item *item, int dir) { } } -/// Set the item currently in focus. Handles calling redraw() -/// as needed to update the focus box. +/// Set the item that currently should have keyboard focus. +/// Handles calling redraw() to update the focus box (if its visible). +/// +/// \param[in] item The item that should take focus. If NULL, none will have focus. /// void Fl_Tree::set_item_focus(Fl_Tree_Item *item) { if ( _item_focus != item ) { // changed? @@ -892,5 +894,5 @@ void Fl_Tree::load(Fl_Preferences &prefs) } // -// End of "$Id: Fl_Tree.cxx 7691 2010-08-26 13:32:30Z greg.ercolano $". +// End of "$Id: Fl_Tree.cxx 7722 2010-10-12 15:46:30Z greg.ercolano $". // diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 2c0770d..ec45131 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -184,7 +184,7 @@ static unsigned short macKeyLookUp[128] = 0/*FL_Shift_L*/, 0/*FL_Caps_Lock*/, 0/*FL_Alt_L*/, 0/*FL_Control_L*/, 0/*FL_Shift_R*/, 0/*FL_Alt_R*/, 0/*FL_Control_R*/, 0, - 0, FL_KP+'.', FL_Right, FL_KP+'*', 0, FL_KP+'+', FL_Left, FL_Delete, + 0, FL_KP+'.', FL_Right, FL_KP+'*', 0, FL_KP+'+', FL_Left, FL_Num_Lock, FL_Down, 0, 0, FL_KP+'/', FL_KP_Enter, FL_Up, FL_KP+'-', 0, 0, FL_KP+'=', FL_KP+'0', FL_KP+'1', FL_KP+'2', FL_KP+'3', FL_KP+'4', FL_KP+'5', diff --git a/src/Fl_get_key_mac.cxx b/src/Fl_get_key_mac.cxx index 17617ad..84f0371 100644 --- a/src/Fl_get_key_mac.cxx +++ b/src/Fl_get_key_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_get_key_mac.cxx 7615 2010-05-26 21:25:11Z manolo $" +// "$Id: Fl_get_key_mac.cxx 7725 2010-10-19 12:29:35Z manolo $" // // MacOS keyboard state routines for the Fast Light Tool Kit (FLTK). // @@ -34,7 +34,7 @@ #include <config.h> // convert an FLTK (X) keysym to a MacOS symbol: -// See also the inverse converter in Fl_mac.cxx +// See also the inverse converter in table macKeyLookUp of Fl_cocoa.mm // This table is in numeric order by FLTK symbol order for binary search: static const struct {unsigned short vk, fltk;} vktab[] = { @@ -54,7 +54,7 @@ static const struct {unsigned short vk, fltk;} vktab[] = { { 107, FL_Scroll_Lock }, { 53, FL_Escape }, { 0x73, FL_Home }, { 123, FL_Left }, { 126, FL_Up }, { 124, FL_Right }, { 125, FL_Down }, { 0x74, FL_Page_Up }, { 0x79, FL_Page_Down }, { 119, FL_End }, { 0x71, FL_Print }, { 127, FL_Insert }, - { 0x6e, FL_Menu }, { 114, FL_Help }, /*{ 0x47, FL_Num_Lock },*/ + { 0x6e, FL_Menu }, { 114, FL_Help }, { 0x47, FL_Num_Lock }, { 76, FL_KP_Enter }, { 67, FL_KP+'*' }, { 69, FL_KP+'+'}, { 78, FL_KP+'-' }, { 65, FL_KP+'.' }, { 75, FL_KP+'/' }, { 82, FL_KP+'0' }, { 83, FL_KP+'1' }, { 84, FL_KP+'2' }, { 85, FL_KP+'3' }, { 86, FL_KP+'4' }, { 87, FL_KP+'5' }, { 88, FL_KP+'6' }, { 89, FL_KP+'7' }, @@ -64,7 +64,7 @@ static const struct {unsigned short vk, fltk;} vktab[] = { { 0x65, FL_F+9 }, { 0x6D, FL_F+10 }, { 0x67, FL_F+11 }, { 0x6f, FL_F+12 }, { 56, FL_Shift_L }, { 56, FL_Shift_R }, { 59, FL_Control_L }, { 59, FL_Control_R }, { 57, FL_Caps_Lock }, { 55, FL_Meta_L }, { 55, FL_Meta_R }, - { 58, FL_Alt_L }, { 58, FL_Alt_R }, /*{ 0x75, FL_Delete },*/ { 0x47, FL_Delete }, + { 58, FL_Alt_L }, { 58, FL_Alt_R }, { 0x75, FL_Delete }, }; static int fltk2mac(int fltk) { @@ -114,5 +114,5 @@ int Fl::get_key(int k) { } // -// End of "$Id: Fl_get_key_mac.cxx 7615 2010-05-26 21:25:11Z manolo $". +// End of "$Id: Fl_get_key_mac.cxx 7725 2010-10-19 12:29:35Z manolo $". // diff --git a/src/fl_cursor.cxx b/src/fl_cursor.cxx index 2d45435..953c749 100644 --- a/src/fl_cursor.cxx +++ b/src/fl_cursor.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_cursor.cxx 7351 2010-03-29 10:35:00Z matt $" +// "$Id: fl_cursor.cxx 7714 2010-10-11 18:02:00Z greg.ercolano $" // // Mouse cursor support for the Fast Light Tool Kit (FLTK). // @@ -176,7 +176,7 @@ CGContextRef CreateWatchImage(void) fl_color(FL_WHITE); fl_circle(0, 0, r+1); fl_color(FL_BLACK); - fl_rectf(-r*0.7, -r*1.7, 1.4*r, 3.4*r); + fl_rectf(int(-r*0.7), int(-r*1.7), int(1.4*r), int(3.4*r)); fl_rectf(r-1, -1, 3, 3); fl_color(FL_WHITE); fl_pie(-r, -r, 2*r, 2*r, 0, 360); @@ -333,5 +333,5 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) { #endif // -// End of "$Id: fl_cursor.cxx 7351 2010-03-29 10:35:00Z matt $". +// End of "$Id: fl_cursor.cxx 7714 2010-10-11 18:02:00Z greg.ercolano $". // diff --git a/test/button.cxx b/test/button.cxx index 361f552..823afca 100644 --- a/test/button.cxx +++ b/test/button.cxx @@ -1,5 +1,5 @@ // -// "$Id: button.cxx 6615 2009-01-01 16:35:13Z matt $" +// "$Id: button.cxx 7712 2010-10-11 01:41:50Z greg.ercolano $" // // Button/callback test program for the Fast Light Tool Kit (FLTK). // @@ -43,7 +43,7 @@ void exitcb(Fl_Widget *, void *) { // test Fl::add_fd()... void stdin_cb(int, void*) { char buf[1000]; - gets(buf); + fgets(buf, sizeof(buf), stdin); printf("stdin callback\n"); } #endif @@ -64,5 +64,5 @@ int main(int argc, char ** argv) { } // -// End of "$Id: button.cxx 6615 2009-01-01 16:35:13Z matt $". +// End of "$Id: button.cxx 7712 2010-10-11 01:41:50Z greg.ercolano $". // diff --git a/test/checkers.cxx b/test/checkers.cxx index 3a80e3b..6b85f39 100644 --- a/test/checkers.cxx +++ b/test/checkers.cxx @@ -1,5 +1,5 @@ // -// "$Id: checkers.cxx 6615 2009-01-01 16:35:13Z matt $" +// "$Id: checkers.cxx 7713 2010-10-11 01:49:20Z greg.ercolano $" // // Checkers game for the Fast Light Tool Kit (FLTK). // @@ -66,6 +66,10 @@ const char* copyright = #include <stdarg.h> #include <time.h> +#ifdef VT100 +#include <ctype.h> // toupper +#endif + //////////////////////////////////////////////////////////////// // The algorithim: @@ -732,7 +736,7 @@ node *getusermove(void) { else printf("\033[1mCommand?\033[0m "); abortflag = 0; - if (!gets(line)) { + if (!fgets(line, sizeof(line), stdin)) { putchar('\n'); if (feof(stdin)) fixexit(0); return 0; @@ -1359,5 +1363,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: checkers.cxx 6615 2009-01-01 16:35:13Z matt $". +// End of "$Id: checkers.cxx 7713 2010-10-11 01:49:20Z greg.ercolano $". // diff --git a/test/unittest_scrollbarsize.cxx b/test/unittest_scrollbarsize.cxx index 90de740..f99e678 100644 --- a/test/unittest_scrollbarsize.cxx +++ b/test/unittest_scrollbarsize.cxx @@ -1,5 +1,5 @@ // -// "$Id: unittest_scrollbarsize.cxx 7691 2010-08-26 13:32:30Z greg.ercolano $" +// "$Id: unittest_scrollbarsize.cxx 7711 2010-10-09 01:31:38Z greg.ercolano $" // // Unit tests for the Fast Light Tool Kit (FLTK). // @@ -80,7 +80,7 @@ class ScrollBarSizeTest : public Fl_Group { } void slide_cb2(Fl_Value_Slider *in) { const char *label = in->label(); - int val = in->value(); + int val = int(in->value()); //fprintf(stderr, "VAL='%d'\n",val); if ( strcmp(label,"A: Scroll Size") == 0 ) { brow_a->scrollbar_size(val); @@ -161,5 +161,5 @@ public: UnitTest scrollbarsize("scrollbar size", ScrollBarSizeTest::create); // -// End of "$Id: unittest_scrollbarsize.cxx 7691 2010-08-26 13:32:30Z greg.ercolano $" +// End of "$Id: unittest_scrollbarsize.cxx 7711 2010-10-09 01:31:38Z greg.ercolano $" // |